smbmusicapmainplayerstatebase.cpp

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

CPP
2,123
字号
 * @param[in] aAllShuffle 慡嬋僔儍僢僼儖巜掕乮ETrue:慡嬋僔儍僢僼儖乯
 * @param[in] aResume 儗僕儏乕儉嵞惗巜掕乮ETrue:儗僕儏乕儉嵞惗乯
 * @retval ETrue 僼傿儖僞乕價儏乕傊愗懼偊偑昁梫
 * @retval ETrue 僼傿儖僞乕價儏乕傊愗懼偊晄梫
 */
TBool CSmbMusicAPMainPlayerStateBase::StartPlayListL(TSmbMusicAPSyncEngineItemIndex aSongInfo, TBool aAllShuffle, TBool /*aResume*/)
	{
// PTX824懳墳
	// 婡擻僉乕柍岠  2007.03.09
	iView->ChangeFuncKeyState(EFalse);		// 2007.04.23

	// 嵞惗奐巒慜偵働乕僗僋儘乕僘偝傟偨応崌丄僼傿儖僞乕價儏乕傊愗懼偊傞丅
	if (iView->IsCaseClosedL() != EFalse)
		{
		iView->iDonePreparePlay = EFalse;			// TRK:11888 2006.10.21
		return ETrue;
		}

	// Music傾僾儕忬懺庢摼
	TSmbPGMusicAPPlayerState playerState = SmbPGMusic::MusicAPPlayerStateL(iPropAgent);
	
	iView->iCmd->GetRequestKind(iView->iProckind, iView->iInfokind);
	
	if (ESmbMusicAPMainPlayerReqNone != iView->iInfokind)
		{// 嬋忣曬庢摼宯張棟梫媮拞
		
		// 敪峴嵪傒梫媮偺僉儍儞僙儖
		iView->iCmd->CancelAction();
		}
	else
		{// 梫媮偑敪峴偝傟偰偄側偄応崌
		
		if (ESmbMusicAPMainPlayerReqGetPlayTime == iView->iProckind)
			{// 嵞惗帪娫庢摼梫媮拞

			iView->iPlayStartWaiting = ETrue;
			iView->iAllShuffle = aAllShuffle;
			iView->iDonePreparePlay = EFalse;			// TRK:11888 2006.10.21
			
			return EFalse;
			}
		}

	//Y: PlayStart偑儁儞僨傿儞僌偵側偭偰偄傞偙偲傪帵偡僼儔僌傪儕僙僢僩偡傞
	iView->iPlayStartWaiting = EFalse;
	
	//僾儗乕儎偺忬懺偵墳偠偰嵞惗奐巒偺張棟傪峴偆丅
	// PlayView偺State偲偼堎側傞偙偲偵拲堄
	if (ESmbPGMusicAPPlayerStateNotPlaying == playerState)
		{
		// 旕嵞惗拞忬懺偺応崌偺張棟
		StartPlayListInNotPlayingL(aSongInfo, aAllShuffle);
		}
	else if (ESmbPGMusicAPPlayerStatePlaying == playerState)
		{
		// 嵞惗拞忬懺偺応崌偺張棟
		StartPlayListInPlayingL(aSongInfo, aAllShuffle);
		}

	return EFalse;
	}


/**
 * 旕嵞惗拞偺嵞惗奐巒張棟
 *
 * Y: private
 * Y: 廋惓嵪傒
 *
 * @param[in] aSongInfo 嵞惗儕僗僩忣曬
 * @param[in] aAllShuffle 慡嬋僔儍僢僼儖巜掕乮ETrue:慡嬋僔儍僢僼儖乯
 */
void CSmbMusicAPMainPlayerStateBase::StartPlayListInNotPlayingL(TSmbMusicAPSyncEngineItemIndex aSongInfo, TBool aAllShuffle)
	{
	if (EFalse == iView->iDonePreparePlay)
		{// 嵞惗弨旛(PreparePlay)偑偱偒偰偄側偄応崌
		
		//僾儗僀儕僗僩偺峏怴
		iView->iPlayList = aSongInfo;
		iView->iAllShuffle = aAllShuffle;

		TSmbMusicAPSyncEngineItemIndex sinfo;
		sinfo.iListHandle = iView->iPlayList.iListHandle;
		sinfo.iIndex      = iView->iPlayList.iIndex;
		if (EFalse != iView->iAllShuffle)
			{
			sinfo.iIndex = KSmbMusicAPSyncEngineNoIndex;
			}
			
		//嵞惗弨旛張棟偺梫媮傪敪峴
		iView->iCmd->PreparePlay(sinfo, iView->iAllShuffle, EFalse);
		
		//張棟庬暿傪StartPlay偵僙僢僩偡傞
		//旕摨婜墳摎偺張棟(RespPreparePlayL)偱PlayStart梫媮傪敪峴偡傞
		iView->iProc = ESmbMusicAPMainPlayerPlayProcStartPlay;
		
		}
	else
		{ // 嵞惗弨旛嵪傒偺応崌
		
		//嵞惗弨旛嵪傒僼儔僌傪僋儕傾
		iView->iDonePreparePlay = EFalse;

		// 嵞惗奐巒梫媮傪敪峴偡傞丅
		TBool result =iView->iCmd->PlayStart(iPlayerEnv.MannerModePlayingState());
			
		if (EFalse == result)
			{// 堎忢廔椆帪偺張棟
			
			// 張棟庬暿傪乽張棟側偟乿偵偡傞丅
			iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;
			
			_LIT(KLogFmt, "CSmbMusicAPMainPlayerStateBase::StartPlayListInNotPlayingL PlayStart() error");
			SmbMusicAPMainPlayerUtility::OutputLog(iLog, 200010, ELogLevelNormal, KLogFmt);
			
		    // Drawer偺掆巭
			iView->iDrawer->DoMusicEnableL(EFalse);	// TRK:11398	2006.10.16
			//僼傿儖僞乕價儏乕傊偺愗傝懼偊
			iView->iViewTop = EFalse;		// TRK:10795  2006.10.13
			iPlayerEnv.BasisPartFuncInterface().ChangeViewL(ESmbMusicAPMainPlayerFilterViewId,
		                                                    KSmbMusicAPMainPlayerChangeViewMsgUid, KNullDesC8);
			// 僩僢僾價儏乕偱偁傞偙偲傪帵偡僼儔僌傪儕僙僢僩
			iView->iViewTop = EFalse;		// TRK:10795  2006.10.13
			// 儅僫乕儌乕僪嵞惗偺僼儔僌傪儕僙僢僩
			iPlayerEnv.SetMannerModePlayingStateL(EFalse);	// 2006.10.25
			
			return;
			}

		// 嵞惗奐巒張棟忬懺
		if (ESmbMusicAPMainPlayerPlayProcNone == iView->iProc)
			{// 張棟庬暿偑乽張棟側偟乿偺応崌
			
			//張棟庬暿傪StartPlay偵僙僢僩
			iView->iProc = ESmbMusicAPMainPlayerPlayProcStartPlay;
			}

		iView->iPlayList = aSongInfo;
		iView->iAllShuffle = aAllShuffle;

		if ((ESmbMusicAPMainPlayerPlayProcStartPlay == iView->iProc 		// 嵞惗奐巒張棟
		     && EFalse == iView->iPlayComplete)							// 儕僗僩嵞惗姰椆帪偱偼側偄
		    || ESmbMusicAPMainPlayerPlayProcPlayResume == iView->iProc		// 儗僕儏乕儉嵞惗 TRK:10133 2006.09.25
		   )
			{
			if (EFalse == iView->iExtMemory)								// 奜晹儊儌儕乕憓敳偱側偄応崌 TRK:11730 2006.10.18
				{// 奜晹儊儌儕乕憓敳偱側偄応崌
				
				// 夋柺曄峏捠抦
				TInt ret = iView->iCmd->UpdateDisplayInfo(ESmbMusicAPPlayerChangePlayViewEvent, iView->iPlayList, iView->iReqPlayList.iShuffle);
				
				if (KErrNone != ret)
					{// 堎忢廔椆偺応崌
					_LIT(KLogFmt, "CSmbMusicAPMainPlayerStateBase::StartPlayListInNotPlayingL err=%d");
					SmbMusicAPMainPlayerUtility::OutputLog(iLog, 201007, ELogLevelHigh, KLogFmt, ret);
					
					User::Leave(ret);
					}
				}
			}

		// 嵞惗慜偺夋柺乮嬻夋柺乯傪昞帵偡傞丅
		iView->iDrawer->DrawIdlePictureL(EFalse, EFalse);
		iView->ChangeState(ESmbMusicAPMainPlayerPlayInitial);		// TRK:10282	2006.09.30
		}
	}

/**
 * 嵞惗拞偺嵞惗奐巒張棟
 *
 * Y: private
 * Y: 廋惓嵪傒
 *
 * @param[in] aSongInfo 嵞惗儕僗僩忣曬
 * @param[in] aAllShuffle 慡嬋僔儍僢僼儖巜掕乮ETrue:慡嬋僔儍僢僼儖乯
 */
void CSmbMusicAPMainPlayerStateBase::StartPlayListInPlayingL(TSmbMusicAPSyncEngineItemIndex aSongInfo, TBool aAllShuffle)
	{
	if (EFalse != iView->iFailState)
		{
		// 嵞惗晄壜嬋僗僉僢僾拞偺応崌
		ChangeSongInFailSkip(aSongInfo, aAllShuffle);
		
		return;
		}

	if (KSmbMusicAPMainPlayerPlaySongListMsgUid == iView->iCurMessageID &&
	    iView->IsPlaySongChanged() == EFalse
	   )
		{
		// 嬋堦棗儕僗僩嵞惗偱丄巜掕嬋偑嵞惗拞嬋偲堦抳偟偰偄傞応崌偼偦偺傑傑嵞惗宲懕
		iView->RedrawByChangeViewL();		// 嵞惗夋柺偺昤夋

		iView->iPlayList = aSongInfo;
		iView->iAllShuffle = aAllShuffle;

		// 抂枛奐忬懺偺応崌丄夋柺曄峏捠抦
		TInt ret = iView->iCmd->UpdateDisplayInfo(ESmbMusicAPPlayerChangePlayViewEvent, iView->iPlayList, iView->iReqPlayList.iShuffle);
		
		if (KErrNone != ret)
			{
			_LIT(KLogFmt, "CSmbMusicAPMainPlayerStateBase::StartPlayListInPlayingL err=%d");
			SmbMusicAPMainPlayerUtility::OutputLog(iLog, 201007, ELogLevelHigh, KLogFmt, ret);
			
			User::Leave(ret);
			}
		return;
		}

	//嵞惗拞偺嬋傪掆巭偡傞丅
	iView->iDrawer->DrawIdlePictureL(ETrue, ETrue);		// 2006.10.18
	iView->iDrawer->StopRedrawTimer();		// 2006.08.10
	
	iView->iPlayList = aSongInfo;
	iView->iAllShuffle = aAllShuffle;
	iView->iCancelClearKey = ETrue;		// 2006.10.10  TRK:11010
	
	iView->iCmd->PlayStop();
	
	// 嵞惗奐巒張棟忬懺
	iView->iStartPause = ETrue;			// 2006.10.06  TRK:9895
	iView->iProc = ESmbMusicAPMainPlayerPlayProcStartPlay;
	iView->ChangeState(ESmbMusicAPMainPlayerPlayStop);
	}

// 2007.01.09
/**
 * 嵞惗晄壜嬋僗僉僢僾張棟忬懺偱嵞惗嬋曄峏傪偝傟偨偲偒偺張棟
 *
 * Y: private
 * Y: StartPlayListInPlayingL()偐傜屇偽傟傞
 * Y: 撪梕僠僃僢僋嵪傒乮View僋儔僗偐傜嶍彍)
 *
 * @param[in] aSongInfo 嵞惗儕僗僩忣曬
 * @param[in] aAllShuffle 慡嬋僔儍僢僼儖巜掕乮ETrue:慡嬋僔儍僢僼儖乯
 */
void CSmbMusicAPMainPlayerStateBase::ChangeSongInFailSkip(TSmbMusicAPSyncEngineItemIndex aSongInfo, TBool aAllShuffle)
	{
	iView->iPlayList = aSongInfo;
	iView->iAllShuffle = aAllShuffle;
	iView->iFailState = EFalse;
	
	if (NULL != iView->iPeriodic)
		{
		// 僗僉僢僾懸偪忬懺偺応崌
		
		delete iView->iPeriodic;
		iView->iPeriodic = NULL;
		iView->iCancelClearKey = ETrue;		// 2006.10.10  TRK:11010
		
		iView->iCmd->PlayStop();
		
		// 嵞惗奐巒張棟忬懺
		iView->iStartPause = ETrue;			// 2006.10.06  TRK:9895
		iView->iProc = ESmbMusicAPMainPlayerPlayProcStartPlay;
		iView->ChangeState(ESmbMusicAPMainPlayerPlayStop);
		}
	else 
		{
		// 僗僉僢僾懸偪忬懺偱偼柍偄応崌
		
		iView->iCmd->GetRequestKind(iView->iProckind, iView->iInfokind);
		
		if (ESmbMusicAPMainPlayerReqPlayNext == iView->iProckind)
			{
			// 嬋憲傝拞偺応崌
			iView->iFial2Play = ETrue;
			}
		else
			{
			if (ESmbMusicAPMainPlayerReqGetPlayTime == iView->iProckind)
				{
				// 嵞惗帪娫庢摼拞偺応崌
				iView->iCancelTimeGet = ETrue;
				}
				
			if (ESmbMusicAPMainPlayerReqNone != iView->iInfokind)
				{
				//敪峴拞偺梫媮偺僉儍儞僙儖
				iView->iCmd->CancelAction();
				}
				
			iView->iCancelClearKey = ETrue;		// 2006.10.10  TRK:11010
			
			//Y: 嬋偺嵞惗傪掆巭偡傞
			iView->iCmd->PlayStop();
			
			// 嵞惗奐巒張棟忬懺
			iView->iStartPause = ETrue;			// 2006.10.06  TRK:9895
			iView->iProc = ESmbMusicAPMainPlayerPlayProcStartPlay;
			iView->ChangeState(ESmbMusicAPMainPlayerPlayStop);
			}
		}
	}


/**
 * 宲懕嵞惗傪梫媮偝傟偨偲偒偺張棟
 * @retval ETrue 張棟拞偵働乕僗僋儘乕僘偝傟偨
 * @retval EFalse 偦偺懠
 */
//Y: 巊傢傟偰偄側偄
/**
TBool CSmbMusicAPMainPlayerStateBase::ContinuousPlayL()
	{
	TBool ret(EFalse);
	// 嵞惗奐巒慜偵働乕僗僋儘乕僘偝傟偨応崌
	if (iView->IsCaseClosedL() != EFalse)
		{
		ret = ETrue;
		}

	// 嵞惗壜擻偺応崌丄尰嵼嬋偺嵞惗奐巒
	if (EFalse != iCmd->PlayStart(iPlayerEnv.MannerModePlayingState()))
		{
		// 宲懕嵞惗張棟忬懺
		iProc = ESmbMusicAPMainPlayerPlayProcPlay;
		}
	return ret;
	}
*/

//==============================================================================================
//
//  OfferKeyEvent娭楢儊僜僢僪
//
//
//==============================================================================================

/**
 * 寛掕僉乕張棟\n
 *   嵞惗拞偼掆巭張棟丄掆巭拞偼嵞惗奐巒張棟傪峴偆丅
 *
 * Y: public
 * Y: staic娭悢
 *
 * @param[in] aKeyFunc 僉乕僀儀儞僩張棟僋儔僗
 */
void CSmbMusicAPMainPlayerStateBase::ProcKeyDecideL(CSmbMusicAPMainPlayerStateBase& aKeyFunc)
	{
// Change 2007.08.20
//	aKeyFunc.NSProcKeyDecideL();
	if (EFalse == aKeyFunc.iView->iStartingAutoResume)
		{
		// 僆乕僩儗僕儏乕儉嵞惗奐巒拞偱側偄応崌
		aKeyFunc.NSProcKeyDecideL();
		}
// Change End 2007.08.20
	}

void CSmbMusicAPMainPlayerStateBase::NSProcKeyDecideL()
	{
	_LIT(KLogFmt, "CSmbMusicAPMainPlayerStateBase::NSProcKeyDecideL err=%d");
	SmbMusicAPMainPlayerUtility::OutputLog(iLog, 201014, ELogLevelHigh, KLogFmt, 999);
	
	User::Leave(999);
	}
	
//void CSmbMusicAPMainPlayerStateBase::NSProcKeyDecideL()
//	{
//	TBool failStatue = iView->iFailState;
//	iView->iFailState = EFalse;
//	
//	if (iView->IsEnableDecideKey(*iView) != EFalse)
//		{
//		if (ESmbMusicAPMainPlayerPlayPlaying == iView->iStatus)
//			{
//			// 嵞惗價儏乕忬懺偑嵞惗拞偺応崌偺張棟
//			ProcKeyDecideInPlayingL(failStatue);
//			}
//
//		else if (iView->IsProcStartPlay(iView->iProc) != EFalse)
//			{
//			// 嵞惗奐巒張棟拞偺応崌
//			ProcKeyDecideInProcStartL();
//			}
//		else if (ESmbMusicAPMainPlayerPlayInitial != iView->iStatus)
//			{
//			if (EFalse ==  iView->iPlay2Start)
//				{
//				// 嵞惗價儏乕忬懺偑掆巭拞偺応崌偺張棟
//				ProcKeyDecideInPauseL();
//				}
//			}
//		}
//
//	}


/**
 * 嵞惗拞忬懺偺寛掕僉乕張棟
 *
 * Y: private 
 * Y: ProcKeyDecideL()偐傜屇偽傟傞
 * Y: 旕static娭悢
 *
 * @param[in] aKeyFunc 僉乕僀儀儞僩張棟僋儔僗
 * @param[in] aFailState ETrue:嵞惗晄壜嬋僗僉僢僾張棟忬懺
 */
void CSmbMusicAPMainPlayerStateBase::ProcKeyDecideInPlayingL(TBool /*aFailState*/)
	{
	_LIT(KLogFmt, "CSmbMusicAPMainPlayerStateBase::ProcKeyDecideInPlayingL err=%d");
	SmbMusicAPMainPlayerUtility::OutputLog(iLog, 201014, ELogLevelHigh, KLogFmt, 999);
	
	User::Leave(999);
	}
	
//void CSmbMusicAPMainPlayerStateBase::ProcKeyDecideInPlayingL(TBool aFailState)
//	{
//	if (EFalse != iView->iPauseState)
//		{
//		// 掆巭憖嶌張棟拞偺応崌偼柍張棟
//		return;
//		}
//
//	iView->iCmd->GetRequestKind(iView->iProckind, iView->iInfokind);
//
//	if (EFalse != aFailState)
//		{// 嵞惗晄壜嬋僗僉僢僾張棟忬懺偺応崌
//		
//		if (NULL != iView->iPeriodic)
//			{
//			// 僗僉僢僾懸偪偺応崌乮僗僉僢僾懸偪僞僀儅乕偑婲摦拞乯
//			iView->iProc = ESmbMusicAPMainPlayerPlayProcFailSongCancel;
//			

⌨️ 快捷键说明

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