smbmusicapmainplayerstatebase.cpp

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

CPP
2,123
字号
/* Copyright (C) 2006 Sony Ericsson Mobile Communications Japan, Inc. */
/*-------------------------------------------------------------------------*/
// FileName:
//	SmbMusicAPMainPlayerStateBase.cpp
//
// Description: 
//	儈儏乕僕僢僋僾儗僀儎乕嵞惗宯偺價儏乕僋儔僗
/*------------------------------------------------------------------------*/
//曄峏棜楌
//擔晅			|曄峏幰 	|撪梕
//--------------+-----------+----------------------------------------------
//2006/06/07	|K3拞堜		| 弶斉儕儕乕僗

/// 忬懺僋儔僗
/**
 * @file SmbMusicAPMainPlayerStateBase.cpp
 *
 * 儈儏乕僕僢僋僾儗僀儎乕嵞惗宯偺價儏乕僋儔僗
 */


//////////////////////////////////////////////////////////
//#define __SKIP_GETIMAGE__			// 摦嶌晄椙偺偨傔僗僉僢僾
//#define __SKIP_NOTIFY_INDEX__		// 摦嶌晄椙偺偨傔僗僉僢僾
#define __SKIP_ASSERT__
//////////////////////////////////////////////////////////

#include "SmbMusicAPMainPlayerPlayDebug.h"

#ifdef __SMBMUSICAP_PERFORMANCE_DEF__
#ifndef   FJLACLIENT_H__
#include <Fjlaclient.h>
#endif
#endif

#ifndef FJAFENV_H__
#include <FjAfEnv.h>
#endif

#ifndef FJPGBASIC_H__
#include <FjpgBasic.h>
#endif

#ifndef FJPGBASICSTATUS_H__
#include <FjpgBasicStatus.h>
#endif

#ifndef FJPGBASICLASERVER_H__
#include <FjpgBasicLaServer.h>
#endif

#ifndef __SMBPGMENU_H__
#include <SmbPGMenu.h>
#endif

#ifndef FJPGKEYSOUNDBACKLIGHTS_H__
#include <FjpgKeySoundBackLight.h>
#endif

#ifndef FJLACOMMON_H__
#include <Fjlacommon.h>
#endif

#ifndef __SMBAFWORDINGFORMATTER_H__
#include <SmbAfWordingFormatter.h>
#endif

#ifndef __SMBMUSICAPPLAYERCOMMONDEF_H__
#include "SmbMusicAPPlayerCommonDef.h"
#endif

#ifndef __SMBMUSICAPMAINPLAYEREXTERNALINTERFACE_H__
#include <SmbMusicAPMainPlayerExternalInterface.h>
#endif

#ifndef __SMBMUSICAPSONGINFOEXTERNALINTERFACE_H__
#include <SmbMusicAPSongInfoExternalInterface.h>
#endif

#ifndef __SMBMUSICAPMAINPLAYERSTATEBASE_H__
#include "SmbMusicAPMainPlayerStateBase.h"
#endif

#ifndef __SMBMUSICAPMAINPLAYERUTILITY_H__
#include "SmbMusicAPMainPlayerUtility.h"
#endif

#ifndef __SMBMUSICAPMAINPLAYERDIALOGMANAGER_H__
#include "SmbMusicAPMainPlayerDialogManager.h"
#endif

#ifndef __SMBMUSICAPMAINPLAYERAPPBASISPARTFUNCINTERFACE_H__
#include "SmbMusicAPMainPlayerBasisPartFuncInterface.h"
#endif

#ifndef __SMBMUSICAPMAINPLAYERAPPUI_H__
#include "SmbMusicAPMainPlayerAppUi.h"
#endif

#ifndef __SMBAFWORDING_RSG__
#include <SmbAfWording.rsg>
#endif

SEMCJ_NAMESPACE_BEGIN
USING_NAMESPACE_DCM

#include <SmbMusicAPMainPlayer.RSG>

#ifndef __SMBMUSICAPMAINPLAYERSTATEBASE_H__
#include "SmbMusicAPMainPlayerStateBase.h"
#endif

#include <Music.mbg>


/**
 * 僀儞僗僞儞僗惗惉
 * @param[in] aMusicAPMainPlayerEnv 儊僀儞僾儗僀儎乕娐嫬
 * @param[in] aMusicSyncEngine 摨婜僄儞僕儞
 * @param[in] aSelectView 専嶕宯價儏乕
 */
CSmbMusicAPMainPlayerStateBase::CSmbMusicAPMainPlayerStateBase(MSmbMusicAPMainPlayerEnv& aPlayerEnv,
								 RLog& aLog, RPGPropAgent& aPropAgent, CSmbMusicAPMainPlayerPlayView* aView
								  )
									:iPlayerEnv(aPlayerEnv),
									iLog(aLog), iPropAgent(aPropAgent), iView(aView)

	{
	}

/**
* 僨僗僩儔僋僞
*/
CSmbMusicAPMainPlayerStateBase::~CSmbMusicAPMainPlayerStateBase()
	{
	}

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

/**
 * 嬻偺嵞惗儕僗僩傪巜掕偝傟偨偲偒偺張棟
 * Y: public
 * Y: DoViewActivatedImplL()偐傜屇偽傟傞丅
 * Y: 弶婜忬懺偱掆巭偟偨忬懺偵偡傞丅
 * Y: 嵞惗拞偺応崌偵偼嵞惗傪掆巭偡傞
 * Y: 掆巭拞偺応崌偵偼儕僕儏乕儉忣曬傪攋婞偡傞丅
 * Y: 嵞惗拞偺傒張棟偑堎側傞丅CSmbMusicAPMainPlayerStatePlay::ChangedEmptySongListL()嶲徠
 */
void CSmbMusicAPMainPlayerStateBase::ChangedEmptySongListL()
	{
	//Y:儅僫乕儌乕僪嵞惗偺僼儔僌傪儕僙僢僩
	iPlayerEnv.SetMannerModePlayingStateL(EFalse);	// 2006.10.25
	
	//Y:嵞惗拞埲奜偺応崌
	
	// 儗僕儏乕儉忣曬傪攑婞偡傞丅	2006.10.06
	iView->iCmd->DeleteResumeInfo();
	
// PTX824懳墳
	iView->ChangeFuncKeyState(ETrue);		// 2007.04.23

	// 傾僀僥儉僇僂儞僩偑0偺応崌偼嬻偺嵞惗夋柺傪昞帵偡傞丅
	iView->iDrawer->DrawIdlePictureL(EFalse, EFalse);
	
	//忬懺傪弶婜忬懺偵曄峏
	iView->ChangeState(ESmbMusicAPMainPlayerPlayInitial);		// TRK:10282	2006.09.30

	//Y:昞帵偺峏怴
	iView->iPlayList.iListHandle = iView->iReqPlayList.iListHandle;
	iView->iPlayList.iIndex      = iView->iReqPlayList.iIndex;
	
	TInt ret = iView->iCmd->UpdateDisplayInfo(ESmbMusicAPPlayerChangePlayViewEvent, iView->iPlayList, iView->iReqPlayList.iShuffle);

	if (KErrNone != ret)
		{//昞帵峏怴僄儔乕
		
		_LIT(KLogFmt, "CSmbMusicAPMainPlayerStateBase::ChangedEmptySongListL UpdateDisplayInfo err=%d");
		SmbMusicAPMainPlayerUtility::OutputLog(iLog, 201006, ELogLevelHigh, KLogFmt, ret);
		
		User::Leave(ret);
		}
	}


/**
 * 嵞惗晄壜嬋僗僉僢僾張棟忬懺偱嬻偺嵞惗儕僗僩傪巜掕偝傟偨偲偒偺張棟
 * Y: ChangedEmptySongListL()偺僾儔僀儀乕僩娭悢
 * Y: 撪梕僠僃僢僋嵪傒乮View僋儔僗偐傜嶍彍)
 * Y: private
 */
//void CSmbMusicAPMainPlayerStateBase::ChangedEmptySongListInFailSkipL()
//	{
//	iView->iFailState = EFalse;
//	if (NULL != iView->iPeriodic)
//		{
//		// 僗僉僢僾懸偪忬懺偺応崌
//		delete iView->iPeriodic;
//		iView->iPeriodic = NULL;
//		
//		iView->iDrawer->ReleaseJacketPictureL(EFalse);			// TRK:11836  2006.10.24
//		iView->iDrawer->ReleaseJacketPictureL(ETrue);			// TRK:11836  2006.10.24
//		
//		iView->iPauseResumeCancel = ETrue;
//		
//		iView->iCmd->PlayStop();				// 2006.10.01  TRK:10286
//		}
//	else 
//		{
//		
//		iView->iCmd->GetRequestKind(iView->iProckind, iView->iInfokind);
//		
//		if (ESmbMusicAPMainPlayerReqPlayNext == iView->iProckind)
//			{
//			// 嬋憲傝拞偺応崌
//			iView->iFial2Idle = ETrue;
//			iView->iNotifyFial2Idle = ETrue;
//			}
//		else
//			{
//			if (ESmbMusicAPMainPlayerReqGetPlayTime == iView->iProckind)
//				{
//				// 嵞惗帪娫庢摼拞偺応崌
//				iView->iCancelTimeGet = ETrue;
//				}
//			if (ESmbMusicAPMainPlayerReqNone != iView->iInfokind)
//				{
//				iView->iCmd->CancelAction();
//				}
//				
//			iView->iDrawer->ReleaseJacketPictureL(EFalse);			// TRK:11836  2006.10.24
//			iView->iDrawer->ReleaseJacketPictureL(ETrue);			// TRK:11836  2006.10.24
//			
//			iView->iPauseResumeCancel = ETrue;
//			
//			iView->iCmd->PlayStop();				// 2006.10.01  TRK:10286
//			}
//		}
//	}

/**
 * 價儏乕愗懼偊傪梫媮偝傟偨偲偒偺張棟
 * Y: public
 * Y: DoViewActivatedImplL()偐傜屇偽傟傞丅
 * Y: 撪梕僠僃僢僋嵪傒乮View僋儔僗偐傜嶍彍)
 */
void CSmbMusicAPMainPlayerStateBase::ChangeViewFromFilterViewL()
	{
	if (ESmbMusicAPMainPlayerPlayProcNone == iView->iProc)
		{
		//僄儞僕儞傊偺梫媮偑敪峴偝傟偰偄側偄応崌
		
		iView->iProc = ESmbMusicAPMainPlayerPlayProcEngUse;
		
// PTX824懳墳
// Change 2007.03.07
//		// 夋憸枃悢傪庢摼
//		iView->iCmd->GetImageNumber(iView->iPlayList);
		// 嵞惗嬋忣曬傪庢摼
		iView->ReqGetPlayInfoL();
// Change End 2007.03.07
		
		}
	else
		{
		//僄儞僕儞傊偺梫媮傪敪峴偟偰偄傞応崌
		
		//壗傕偟側偄
		//乮嵞惗拞偺応崌偼價僕儏傾儔僀僓乕偺奐巒傪峴偆丅
		// c.f. CSmbMusicAPMainPlayerStatePlay::ChangeViewFromFilterViewL())
		}
	}


/**
 * 儕僗僩嵞惗傪梫媮偝傟偨偲偒偺張棟
 * Y: public
 * Y: DoViewActivatedImplL()偐傜屇偽傟傞丅
 * Y: 撪梕僠僃僢僋嵪傒乮View僋儔僗偐傜嶍彍)
 * @retval ETrue 張棟拞偵働乕僗僋儘乕僘偝傟偨
 * @retval EFalse 偦偺懠
 */
TBool CSmbMusicAPMainPlayerStateBase::PlaySelectedListL()
	{
	TSmbMusicAPSyncEngineItemIndex sinfo;
	
	iView->iReqPlayList.iIndex = 0;
	
	sinfo.iListHandle = iView->iReqPlayList.iListHandle;
	sinfo.iIndex      = iView->iReqPlayList.iIndex;
	
	TBool result = StartPlayListL(sinfo, iView->iReqPlayList.iShuffle, EFalse);
	
	return result;
	}

/**
 * 嬋堦棗偐傜偺嵞惗傪梫媮偝傟偨偲偒偺張棟
 * Y: public
 * Y: DoViewActivatedImplL()偐傜屇偽傟傞丅
 * Y: 撪梕僠僃僢僋嵪傒乮View僋儔僗偐傜嶍彍)
 * @retval ETrue 張棟拞偵働乕僗僋儘乕僘偝傟偨
 * @retval EFalse 偦偺懠
 */
TBool CSmbMusicAPMainPlayerStateBase::PlaySelectedSongL()
	{
	// 嬋堦棗儕僗僩嵞惗張棟
	TSmbMusicAPSyncEngineItemIndex sinfo;
	
	sinfo.iListHandle = iView->iReqPlayList.iListHandle;
	sinfo.iIndex      = iView->iReqPlayList.iIndex;
	
	TBool result = StartPlayListL(sinfo, iView->iReqPlayList.iShuffle, EFalse);
	
	return result;
	}

/**
 * 嵞惗奐巒張棟乮儗僕儏乕儉嵞惗乯\n
 *   儗僕儏乕儉忣曬偐傜偺嵞惗傪奐巒偡傞丅
 *
 * Y: public
 * Y: DoViewActivatedImplL()偐傜屇偽傟傞丅
 * Y: 撪梕僠僃僢僋嵪傒乮View僋儔僗偐傜嶍彍)
 *
 * @retval ETrue 僼傿儖僞乕價儏乕傊愗懼偊偑昁梫
 * @retval ETrue 僼傿儖僞乕價儏乕傊愗懼偊晄梫
 */
TBool CSmbMusicAPMainPlayerStateBase::StartPlayResumeL()
	{
	// 儗僕儏乕儉忣曬庢摼
	TSmbMusicAPSyncEngineResumeInfo rinfo;
	
	if (EFalse == iView->iCmd->GetResumeInfo(rinfo))
		{
		// 庢摼偵幐攕偟偨応崌偼僼傿儖僞乕價儏乕傊愗懼偊傞丅
		iView->iDrawer->DoMusicEnableL(EFalse);	// TRK:11398	2006.10.16

		iView->iViewTop = EFalse;		// TRK:10795  2006.10.13
		iPlayerEnv.BasisPartFuncInterface().ChangeViewL(ESmbMusicAPMainPlayerFilterViewId,
		                                                KSmbMusicAPMainPlayerChangeViewMsgUid, KNullDesC8);

		_LIT(KLogFmt, "CSmbMusicAPMainPlayerStateBase::StartPlayResumeL GetResumeInfo() error");
		SmbMusicAPMainPlayerUtility::OutputLog(iLog, 200011, ELogLevelNormal, KLogFmt);
		
		iPlayerEnv.SetMannerModePlayingStateL(EFalse);	// 2006.10.25
		
		return EFalse;
		}
	
	// 儗僕儏乕儉忣曬偐傜嵞惗儕僗僩忣曬傪嶌惉偡傞丅
	TSmbMusicAPSyncEngineItemIndex sinfo;
	
	sinfo.iListHandle = rinfo.iPlayList.iListHandle;
	iView->iReqPlayList.iListHandle = rinfo.iPlayList.iListHandle;
	sinfo.iIndex      = rinfo.iPlayList.iIndex;
	iView->iReqPlayList.iIndex = rinfo.iPlayList.iIndex;
	
	iView->iReqPlayList.iCount = iView->iCmd->GetItemCount(iView->iReqPlayList.iListHandle);

	// 嵞惗儕僗僩偺庬暿傪庢摼偡傞丅
	TSmbMusicAPSyncEngineListType listType;
	iView->iCmd->GetListType(iView->iReqPlayList.iListHandle, listType);
	
	switch (listType)
		{
		case ESmbMusicAPSyncEngineTypeOriginalPlaylist:
		case ESmbMusicAPSyncEngineTypeImportPlaylist:
		case ESmbMusicAPSyncEngineTypeWMAPlaylist:
			// 僾儗僀儕僗僩
			iView->iReqPlayList.iListType = ESmbMusicAPMainPlayerPlayListTypePlaylist;
			break;
		case ESmbMusicAPSyncEngineTypeGenre:
		case ESmbMusicAPSyncEngineTypeArtist:
		case ESmbMusicAPSyncEngineTypeAlbum:
		case ESmbMusicAPSyncEngineTypeSonglist:
			// 専嶕儕僗僩
			iView->iReqPlayList.iListType = ESmbMusicAPMainPlayerPlayListTypeFilterlist;
			break;
		default:
			break;
		}

	// 嵞惗弨旛張棟
	iView->iProc = ESmbMusicAPMainPlayerPlayProcPlayResume;
	
	TBool result = StartPlayListL(sinfo, 0, ETrue);
	
	return result;
	}

/**
 * 嵞惗帪娫庢摼梫媮拞偵僼傿儖僞乕價儏乕偐傜嵞惗奐巒偑捠抦偝傟偨応崌偺張棟
 */
void CSmbMusicAPMainPlayerStateBase::StartPlayAfterGetTImeL()
	{
	iView->iProc = ESmbMusicAPMainPlayerPlayProcNone;
	TSmbMusicAPSyncEngineItemIndex songinfo;
	songinfo.iListHandle = iView->iReqPlayList.iListHandle;
	songinfo.iIndex      = iView->iReqPlayList.iIndex;
	TBool ret = StartPlayListL(songinfo, iView->iAllShuffle, EFalse);//Y:
	if (EFalse != ret)
		{
		// 働乕僗僋儘乕僘偝傟偨
		// 僼傿儖僞乕價儏乕傊愗懼偊傞丅
		iView->iDrawer->DoMusicEnableL(EFalse);
		iPlayerEnv.SetMannerModePlayingStateL(EFalse);
		iView->iViewTop = EFalse;
		iPlayerEnv.BasisPartFuncInterface().ChangeViewL(ESmbMusicAPMainPlayerFilterViewId,
		                                                KSmbMusicAPMainPlayerChangeViewMsgUid, KNullDesC8);
		}
	}

/**
 * 嵞惗奐巒張棟乮儕僗僩嵞惗乯\n
 *   僼傿儖僞價儏乕偐傜巜掕偝傟偨嵞惗儕僗僩偺嵞惗傪奐巒偡傞丅\n
 *
 * Y: private
 * Y: 廋惓嵪傒
 *
 * @param[in] aSongInfo 嵞惗儕僗僩忣曬

⌨️ 快捷键说明

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