smbmusicapmainplayerstatebase.cpp

来自「symbian」· C++ 代码 · 共 2,123 行 · 第 1/5 页

CPP
2,123
字号

/**
 * 奺夋柺偵懳墳偟偨僉乕僀儀儞僩張棟傪幚峴偡傞丅
 * @param[in] aKeyEvent 僉乕僀儀儞僩
 * @param[in] aTbl 僉乕僀儀儞僩庴晅偗僥乕僽儖
 * @param[in] aNum 僥乕僽儖偺僄儞僩儕乕悢
 * @return 僉乕偺徚旓(EKeyWasConsumed)丒旕徚旓(EKeyWasNotConsumed)傪曉媝偡傞丅
 */
TKeyResponse CSmbMusicAPMainPlayerStateBase::KeyEventL(const TKeyEvent& aKeyEvent, const TSmbMusicAPMainPlayerStateKeyEvent aTbl[], TInt aNum)
	{
	TKeyResponse ret(EKeyWasConsumed);

	// 僉乕庴晅偗僥乕僽儖偐傜僉乕僀儀儞僩傪専嶕偡傞丅
	for (TInt ix = 0; ix < aNum; ix++ )
		{
		if (aKeyEvent.iCode == aTbl[ix].iKeyCode)
			{
			// 僉乕偑尒偮偐偭偨
			if (ESmbMusicAPMainPlayerPlayKeyUnUse == aTbl[ix].iAccept)
				{
				// 旕徚旓僉乕
				ret = EKeyWasNotConsumed;
				break;
				}
			if (ESmbMusicAPMainPlayerPlayKeyRelease == aTbl[ix].iAccept)
				{
				// 柍岠乮攑婞乯僉乕
				// return EKeyWasConsumed;
				break;
				}
			if (NULL != aTbl[ix].iLongPressFunc)
				{
				// 挿墴偟張棟偑偁傞応崌偺張棟
				if (0 != (aKeyEvent.iModifiers & EWcdmaMpModifierLongPress))
					{
					// 僉乕挿墴偟傪専弌
					if (EFalse == iView->iFailState)						// 2006.09.30  TRK:9614
						{
						aTbl[ix].iLongPressFunc(*this);
						}
					
					// 僉乕徚旓偟偰廔椆
					// return EKeyWasConsumed;
					break;
					}
				else if (0 != (aKeyEvent.iModifiers & EWcdmaMpModifierShortPress))
					{
					// 僉乕抁墴偟傪専弌
					if (aTbl[ix].iShortPressFunc)
						{
						// 抁墴偟張棟
						if (EFalse == iView->iFailState ||				// 2006.09.30  TRK:9614
						    EWcdmaMpKeySelect == aKeyEvent.iCode
						   )
							{
							aTbl[ix].iShortPressFunc(*this);
							}
						// 僉乕徚旓偟偰廔椆
						// return EKeyWasConsumed;
						break;
						}
					}
				else
					{
					// 挿墴偟搊榐
// PTX824 APF
//					iView->iAppUi.GenerateExtraKeyEvent(CSmbAfAppUi::EExtraKeyEventLongShort);
					iView->iAppUi.GenerateExtraKeyEvent(CSakAppUi::EExtraKeyEventLongShort);
					
					// 僉乕徚旓偟偰廔椆
					// return EKeyWasConsumed;
					break;
					}
				}

			if (NULL != aTbl[ix].iShortPressFunc)
				{
				// 抁墴偟張棟偺傒偑偁傞応崌偺張棟
				if (EFalse == iView->iFailState ||					// 2006.09.26  TRK:9614
				    EWcdmaMpKeySelect == aKeyEvent.iCode
				   )
					{
					aTbl[ix].iShortPressFunc(*this);
					}
				
				// 僉乕傪徚旓偟偰廔椆
				// return EKeyWasConsumed;
				break;
				}
			}
		}
			
	// 僉乕庴晅偗僥乕僽儖偵側偄傕偺偼柍岠乮攑婞乯僉乕偲偡傞丅
	// return EKeyWasConsumed;
	return ret;
	}

//==============================================================================================
//
//  旕摨婜屇傃弌偟偺墳摎張棟娭楢儊僜僢僪
//
//
//==============================================================================================

/**
 * 嵞惗弨旛墳摎張棟
 * @param[in] aResult 張棟寢壥
 */
void CSmbMusicAPMainPlayerStateBase::RespPreparePlayL(TInt aResult)
	{

	iView->iJacketIndex   = KSmbMusicAPMainPlayerPlayDefaaultJaket;		// 2006.08.25
	iView->iSongInfoIndex = KSmbMusicAPMainPlayerPlayDefaaultJaket;		// 2006.09.12

	iView->iBottomSong = EFalse;		// 2006.10.16
// PTX824懳墳
// Add 2007.02.27
	iView->iTopSong = EFalse;
// Add End 2007.02.27

	if (ESmbMusicAPMainPlayerPlayProcDelete == iView->iProc)
		{
		// 1審嶍彍姰椆屻偺嵞惗弨旛偺応崌偼丄僒僽僾儗僀儎乕偺Hold傪夝彍偡傞丅
		iPlayerEnv.BasisPartFuncInterface().CancelHoldAppEx();
		}

	if (EFalse != iView->iReqPreparePlay)
		{
		// 僼傿儖僞價儏乕偐傜偺嵞惗弨旛張棟忬懺
		PreparePlayFromFilterViewL(aResult);
		
		return;
		}

	if (EFalse != iView->iExtMemory)
		{
		// 奜晹儊儌儕乕憓敳偑偁偭偨
		iPlayerEnv.SetMannerModePlayingStateL(EFalse);	// 2006.10.25
		
		return;
		}

	if (iView->IsCaseClosedL() != EFalse && ESmbMusicAPMainPlayerPlayProcDelete != iView->iProc)
		{
		_LIT(KLogFmt, "CSmbMusicAPMainPlayerPlayView::RespPreparePlayL CaseClosed iProc=%d");
		SmbMusicAPMainPlayerUtility::OutputLog(iLog, 201012, ELogLevelNormal, KLogFmt, iView->iProc);
		
		// 働乕僗僋儘乕僘偝傟偨応崌(扐偟丄1審嶍彍張棟拞偼徣偔)
		CaseClosedInPlayPrepareL();
		
		return;
		}

	if (KErrNone != aResult)
		{
		// 堎忢廔椆偺応崌
		_LIT(KLogFmt, "CSmbMusicAPMainPlayerPlayView::RespPreparePlayL error %d");
		SmbMusicAPMainPlayerUtility::OutputLog(iLog, 200012, ELogLevelNormal, KLogFmt, aResult);
		
		RespPlayPrepareErrorL();
		
		return;
		}

	if (ESmbMusicAPMainPlayerPlayProcStartPlay == iView->iProc &&		// 嵞惗奐巒張棟
	    EFalse == iView->iPlayComplete &&								// 儕僗僩嵞惗姰椆帪偱偼側偄
// Change 2007.09.17
//	    EFalse == iView->iViewTop										// 2007.09.13
	    EFalse != iView->iViewTop										// 2007.09.13
	   )
		{
		// 抂枛奐忬懺偺応崌丄夋柺曄峏捠抦
		TInt ret = iView->iCmd->UpdateDisplayInfo(ESmbMusicAPPlayerChangePlayViewEvent, iView->iPlayList, iView->iReqPlayList.iShuffle);
		if (KErrNone != ret)
			{
			_LIT(KLogFmt, "CSmbMusicAPMainPlayerPlayView::UpdateDisplayInfo err=%d");
			SmbMusicAPMainPlayerUtility::OutputLog(iLog, 201007, ELogLevelHigh, KLogFmt, ret);
			
			User::Leave(ret);
			}
		}

	if (EFalse != iView->iLowBattery)
		{
		// 傾僾儕掅揹埑敪惗傪捠抦偝傟偰偄傞応崌
		iView->iDrawer->DrawStopPictureL(ETrue);
		iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;
		iView->iLowBattery = EFalse;
		
		return;
		}

	if (ESmbMusicAPMainPlayerPlayProcDelete == iView->iProc)
		{
		//1審嶍彍姰椆屻偺応崌丄夋柺曄峏捠抦
		TInt ret = iView->iCmd->UpdateDisplayInfo(ESmbMusicAPPlayerPlayViewChangeSongIndexEvent, iView->iPlayList, iView->iReqPlayList.iShuffle);
		if (KErrNone != ret)
			{
			_LIT(KLogFmt1, "CSmbMusicAPMainPlayerPlayView::RespPreparePlayL UpdateDisplayInfo err=%d");
			SmbMusicAPMainPlayerUtility::OutputLog(iLog, 201012, ELogLevelHigh, KLogFmt1, ret);
			
			User::Leave(ret);
			}
// Add 2007.07.20		D_82400007770 懳墳
		iView->iProc = ESmbMusicAPMainPlayerPlayProcStopChange;
// Add  End 2007.07.20	D_82400007770 懳墳
		
		// 僼傽僀儖嶍彍張棟忬懺偺応崌丄愭摢嬋偺嬋忣曬傪庢摼偡傞丅
// PTX824懳墳
// Change 2007.03.07
//		// 夋憸枃悢傪庢摼
//		iView->iCmd->GetImageNumber(iView->iPlayList);
		// 嵞惗嬋忣曬傪庢摼
		iView->ReqGetPlayInfoL();
// Change End 2007.03.07
		
		return;
		}
	
	if (ESmbMusicAPMainPlayerPlayProcStartPlay == iView->iProc)
		{
		// 嵞惗奐巒張棟忬懺偺応崌偼丄嵞惗奐巒梫媮傪敪峴偡傞丅
		if (EFalse == iView->iCmd->PlayStart(iPlayerEnv.MannerModePlayingState()))
			{
			// 堎忢廔椆偺応崌丄枹張棟忬懺偵偡傞丅
			iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;
			}
		}
	else if (ESmbMusicAPMainPlayerPlayProcListEnd == iView->iProc)
		{
		// 儕僗僩嵞惗姰椆張棟忬懺偺応崌丄愭摢嬋偺嬋忣曬傪庢摼偡傞丅
		iView->iPlayList.iIndex = 0;
		
// PTX824懳墳
// Change 2007.03.07
//		// 夋憸枃悢傪庢摼
//		iView->iCmd->GetImageNumber(iView->iPlayList);
		// 嵞惗嬋忣曬傪庢摼
		iView->ReqGetPlayInfoL();
// Change End 2007.03.07
		}
	}


/**
 * 嵞惗弨旛墳摎張棟
 * 僼傿儖僞價儏乕偐傜嵞惗弨旛傪梫媮偝傟偨応崌偺張棟
 *
 * Y: private
 * Y: RespPreparePlayL()偐傜屇偽傟傞
 *
 * @param[in] aResult 張棟寢壥
 */
void CSmbMusicAPMainPlayerStateBase::PreparePlayFromFilterViewL(TInt aResult)
	{
	if (iView->IsCaseClosedL() != EFalse)
		{//僔僃儖偑暵偠傜傟偰偄傞応崌
		aResult = KErrServerBusy;
		}
	//僼傿儖僞價儏乕傊偺廔椆捠抦
	iView->iFilterView.RespPreparePlay(aResult);
	
	//張棟庬暿傪僋儕傾
	iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;
	iView->iReqPreparePlay = EFalse;		// 2006.10.12
	
	if (KErrNone == aResult)
		{//惓忢廔椆帪
		
		iView->iDonePreparePlay = ETrue;
		}
	else
		{//僄儔乕敪惗帪
		
		iPlayerEnv.SetMannerModePlayingStateL(EFalse);
		}
	}

/**
 * 嵞惗弨旛墳摎張棟
 * 働乕僗僋儘乕僘偝傟偨応崌偺張棟
 *
 * Y: private
 * Y: RespPreparePlayL()偐傜屇偽傟傞
 *
 */
void CSmbMusicAPMainPlayerStateBase::CaseClosedInPlayPrepareL()
	{
	// 僼傿儖僞乕價儏乕傊愗懼偊傞丅
	iView->iDrawer->DoMusicEnableL(EFalse);
	iView->iViewTop = EFalse;
	iPlayerEnv.BasisPartFuncInterface().ChangeViewL(ESmbMusicAPMainPlayerFilterViewId,
	                                                KSmbMusicAPMainPlayerChangeViewMsgUid, KNullDesC8);
	iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;

	iView->iCancelClearKey = EFalse;
	
	iPlayerEnv.SetMannerModePlayingStateL(EFalse);
	}

/**
 * 嵞惗弨旛墳摎張棟
 * 堎忢廔椆偺応崌偺張棟
 *
 * Y: private
 * Y: RespPreparePlayL()偐傜屇偽傟傞
 *
 */
void CSmbMusicAPMainPlayerStateBase::RespPlayPrepareErrorL()
	{
	// 堎忢廔椆偺応崌丄枹張棟忬懺偵偡傞丅
	iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;
	iView->iPlayerEnv.SetMannerModePlayingStateL(EFalse);
	
	// 僼傿儖僞乕價儏乕傊愗懼偊傞丅
	iView->iDrawer->DoMusicEnableL(EFalse);
	iView->iViewTop = EFalse;
	iPlayerEnv.BasisPartFuncInterface().ChangeViewL(ESmbMusicAPMainPlayerFilterViewId,
	                                                KSmbMusicAPMainPlayerChangeViewMsgUid, KNullDesC8);
	iView->iCancelClearKey = EFalse;
	}

/**
 * 奺庬忬懺張棟僼儔僌傪弶婜壔偡傞丅
 */
void CSmbMusicAPMainPlayerStateBase::ResetAnyStatusFlags()
	{
	iView->iBottomSong = EFalse;		// 嵟廔嬋忬懺
	iView->iTopSong = EFalse;			// 愭摢嬋忬懺
	iView->iCancelClearKey = EFalse;	// 僋儕傾僉乕柍岠忬懺
	iView->iFailState = EFalse;			// 嵞惗晄壜嬋僗僉僢僾張棟拞忬懺
	iView->iPlay2Start = EFalse;		// 嵞惗奐巒偐傜嵞惗奐巒捠抦傑偱偺忬懺
	}

/**
 * 嵞惗奐巒墳摎張棟\n
 * 仸嵞惗夋柺傊偺曄峏偼捠忢嵞惗奐巒捠抦傪庴偗偨偲偒偵偡傞丅
 *
 *Y: public
 *
 * @param[in] aResult 張棟寢壥
 * @param[in] aIndex 摨婜僒乕僶偐傜捠抦偝傟偨嵞惗嬋僀儞僨僢僋僗斣崋
 */
void CSmbMusicAPMainPlayerStateBase::RespPlayStartL(TInt aResult, TInt aIndex)
	{
	
	_LIT(KLogFmt1, "CSmbMusicAPMainPlayerPlayView::RespPlayStartL aResult=%d aIndex=%d");
	SmbMusicAPMainPlayerUtility::OutputLog(iLog, 200013, ELogLevelNormal, KLogFmt1, aResult, aIndex);

	if (KErrNone != aResult)
		{
		// 堎忢廔椆偺応崌
		iView->iPlayList.iIndex = aIndex;		// 2006.09.28

		ResetAnyStatusFlags();

// 堏摦  2007.09.04
//		iView->iStartingAutoResume = EFalse;		// 2007.08.20

		iView->iPauseWaiting = EFalse;			// 2006.10.20
		iView->iPauseState = EFalse;			// 2007.01.29
// PTX824懳墳
// Add 2007.02.27
		iView->iTopSong = EFalse;
// Add End 2007.02.27

		if (KErrInUse == aResult)
			{
			// 儕僜乕僗嫞崌偺応崌偼僟僀傾儘僌昞帵偟偰掆巭夋柺昞帵
			ResourceFailInStartPlayL();
// 堏摦愭  2007.09.04
			iView->iStartingAutoResume = EFalse;		// 2007.08.20
			return;
			}

// 堏摦愭  2007.09.04
		iView->iStartingAutoResume = EFalse;		// 2007.08.20

// Add 2007.04.05 PTX824 TRK:540 懳墳
		if (KErrServerBusy == aResult)
			{
			// 僒乕僶價僕乕偺応崌偼柍帇乮枹張棟忬懺偵偡傞乯
			iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;
			return;
			}
// Add End 2007.04.05 PTX824 TRK:540 懳墳

		if (iView->IsDiscardInPlayError(aResult) == EFalse)
			{// 柍帇偱偒側偄僄儔乕偺応崌 (KErrNotReady, KErrCorrupt, KErrCancel, KErrServerBusy埲奜)
			
			iView->iDrawer->DoMusicEnableL(EFalse);	// TRK:11398	2006.10.16
			// 柍帇偱偒側偄僄儔乕偺応崌
			if (iView->IsPlayFromFilterView() != EFalse &&
			    EFalse == iView->iExtMemory			// 奜晹儊儌儕乕憓敳偱側偄応崌  2006.10.07
			   )
				{
				// 僼傿儖僞乕價儏乕傊愗懼偊傞丅
				iView->iViewTop = EFalse;		// TRK:10795  2006.10.13
				iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;

				iPlayerEnv.BasisPartFuncInterface().ChangeViewL(ESmbMusicAPMainPlayerFilterViewId,
			                                                         KSmbMusicAPMainPlayerChangeViewMsgUid, KNullDesC8);
			                                                         
				_LIT(KLogFmt, "CSmbMusicAPMainPlayerPlayView::RespPlayStartL error %d");
				SmbMusicAPMainPlayerUtility::OutputLog(iLog, 200013, ELogLevelNormal, KLogFmt, aResult);
				
				iPlayerEnv.SetMannerModePlayingStateL(EFalse);	// 2006.10.25
				}
			}
		}
	}

/**
 * 嵞惗奐巒墳摎張棟\n
 * 丂儕僜乕僗嫞崌敪惗帪偺張棟
 *
 * Y: private
 * Y: RespPlayStartL()偐傜屇偽傟傞
 *
 */
void CSmbMusicAPMainPlayerStateBase::ResourceFailInStartPlayL()
	{
	// 儕僜乕僗嫞崌偺応崌

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?