⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smbmusicapmainplayerplayview.cpp

📁 symbian
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/* Copyright (C) 2007 Sony Ericsson Mobile Communications Japan, Inc. */
/*-------------------------------------------------------------------------*/
// FileName:
//	SmbMusicAPMainPlayerPlayView.cpp
//
// Description: 
//	儈儏乕僕僢僋僾儗僀儎乕嵞惗宯偺價儏乕僋儔僗
/*------------------------------------------------------------------------*/
//曄峏棜楌
//擔晅			|曄峏幰 	|撪梕
//--------------+-----------+----------------------------------------------
//2006/04/17	|K3拞堜		| 弶斉儕儕乕僗

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


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

#include "SmbMusicAPMainPlayerPlayDebug.h"

#ifdef __SMBMUSICAP_PTX824_DEF__
#ifndef __SMBAFENV_H__
#include <SmbAfEnv.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 __SMBMUSICAPPLAYERCOMMONDEF_H__
#include "SmbMusicAPPlayerCommonDef.h"
#endif

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

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

#ifndef __SMBMUSICAPMAINPLAYERPLAYVIEW_H__
#include "SmbMusicAPMainPlayerPlayView.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

//Y: State僋儔僗偺摫擖
#include "SmbMusicAPMainPlayerStateInitial.h"
#include "SmbMusicAPMainPlayerStatePause.h"
#include "SmbMusicAPMainPlayerStatePlay.h"
#include "SmbMusicAPMainPlayerStateFF.h"
#include "SmbMusicAPMainPlayerStateFR.h"
#include "SmbMusicAPMainPlayerStateResourceFail.h"

SEMCJ_NAMESPACE_BEGIN
USING_NAMESPACE_DCM

#include <SmbMusicAPMainPlayer.RSG>

#ifndef __SMBMUSICAPMAINPLAYERPLAYVIEW_HRH__
#include "SmbMusicAPMainPlayerPlayView.hrh"
#endif

#include <Music.mbg>



// 僨僼僅儖僩夋憸價僢僩儅僢僾
_LIT(KSmbMusicApPlayerDefaultBitmap, "Z:\\WcdmaMp\\Media\\Image\\Music.mbm");

/**
 * CSmbMusicAPMainPlayerViewBase梡僷儔儊乕僞
 */
const TAfViewParam KSmbMusicAPMainPlayerPlayViewParam =
	{
	ESmbMusicAPMainPlayerPlayViewId, 	// iViewId
	0,									// iTitleResId
	0									// iKeyGuidanceResId
	};



/**
 * 僋儔僗惗惉
 * @param[in] aMusicAPMainPlayerEnv 儊僀儞僾儗僀儎乕娐嫬
 * @param[in] aMusicSyncEngine 摨婜僄儞僕儞
 * @param[in] aSelectView 専嶕宯價儏乕
 * @return 惗惉偟偨CSmbMusicAPMainPlayerPlayView僆僽僕僃僋僩
 */
CSmbMusicAPMainPlayerPlayView* CSmbMusicAPMainPlayerPlayView::NewL(MSmbMusicAPMainPlayerEnv& aPlayerEnv,
	                                           CSmbMusicAPSyncEngine& aMusicSyncEngine,
// Change 2007.09.03
//	                                           MSmbMusicAPMainPlayerPlayHandler& aFiltertView
	                                           MSmbMusicAPMainPlayerPlayHandler& aFiltertView,
				                               CFbsBitmap* aOffScreen,		// Add 2007.09.01
				                               CSkonBitGc* aSkonGc
	                                           )
	{
//	CSmbMusicAPMainPlayerPlayView* self = new(ELeave) CSmbMusicAPMainPlayerPlayView(aPlayerEnv, aMusicSyncEngine, aFiltertView);
	CSmbMusicAPMainPlayerPlayView* self = new(ELeave) CSmbMusicAPMainPlayerPlayView(aPlayerEnv, aMusicSyncEngine, aFiltertView, aOffScreen, aSkonGc);
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::Pop(); // self
	return self;
	}

/**
 * 僀儞僗僞儞僗惗惉
 * @param[in] aMusicAPMainPlayerEnv 儊僀儞僾儗僀儎乕娐嫬
 * @param[in] aMusicSyncEngine 摨婜僄儞僕儞
 * @param[in] aSelectView 専嶕宯價儏乕
 */
CSmbMusicAPMainPlayerPlayView::CSmbMusicAPMainPlayerPlayView(MSmbMusicAPMainPlayerEnv& aPlayerEnv,
	                              CSmbMusicAPSyncEngine& aSyncEngine,
// Change 2007.09.03
//	                              MSmbMusicAPMainPlayerPlayHandler& aFiltertView
	                              MSmbMusicAPMainPlayerPlayHandler& aFiltertView,
	                              CFbsBitmap* aOffScreen,		// Add 2007.09.01
				                  CSkonBitGc* aSkonGc
	                              )
	: CSmbMusicAPMainPlayerViewBase(KSmbMusicAPMainPlayerPlayViewParam, aPlayerEnv, aSyncEngine),
	  iSyncEngine(aSyncEngine), iFilterView(aFiltertView),
	  iAppUi(static_cast<CSmbMusicAPMainPlayerAppUi&>(*(CEikonEnv::Static()->EikAppUi())))
	{
// Add 2007.09.03
	iOffScreen = aOffScreen;
	iSkonGc = aSkonGc;
	}

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

	StopedVisualizer();
	
	delete iCmd;
	delete iDrawer;
	delete iDelete;
	
	delete iPeriodic;
	delete iPeriodicTime;
	delete iUndefTitle;
	delete iPeriodicStart;			// 2006.10.17 悪杮
//	delete iSubMenu;

	// 奺忬懺僆僽僕僃僋僩傪攋婞
	for (TInt i = ESmbMusicAPMainPlayerPlayPlayResourceFail; i >= 0; i--)
		{
		delete iStateArray[i];
		}
	}


/**
 * 擇師僐儞僗僩儔僋僞
 * 
 * TrappedConstructL傪僩儔僢僾偟偰屇傃弌偡丅
 */
void CSmbMusicAPMainPlayerPlayView::ConstructL()
	{
	TInt step(0);
	
	TRAPD(err, TrappedConstructL(step));
	
	if (KErrNone != err)
		{
		// ConstructL()幐攕.
		_LIT(KLogFmt, "CSmbMusicAPMainPlayerPlayView::ConstructL step=%d");
		SmbMusicAPMainPlayerUtility::OutputLog(iAfEnv.Log(), 200001, ELogLevelHigh, KLogFmt, step);
		
		User::Leave(err);
		}
	}

/**
 * 擇師僐儞僗僩儔僋僞乮幚懱乯
 * 僐儅儞僪僋儔僗傪惗惉偡傞丅
 * @param[in,out] aStep 張棟僗僥僢僾
 */
void CSmbMusicAPMainPlayerPlayView::TrappedConstructL(TInt& aStep)
	{
	_LIT(KLogFmt, "CSmbMusicAPMainPlayerPlayView::ConstructL Start");
	SmbMusicAPMainPlayerUtility::OutputLog(iAfEnv.Log(), 200002, ELogLevelLow, KLogFmt);
	
	// 僐儅儞僪僋儔僗傪惗惉偡傞丅
	aStep++;
//__UHEAP_FAILNEXT(1);  // UT丗
	iCmd = CSmbMusicAPMainPlayerPlayCmd::NewL(iSyncEngine, iAfEnv.Log());
	iCmd->SetObserver(this);
	
	// 昤夋僋儔僗傪惗惉偡傞丅
	aStep++;
// Change 2007.09.03
//	iDrawer = CSmbMusicAPMainPlayerPlayDrawer::NewL(*this, iPlayerEnv, iAfEnv.Log(), iAfEnv.PropAgent());
	iDrawer = CSmbMusicAPMainPlayerPlayDrawer::NewL(*this, iPlayerEnv, iAfEnv.Log(), iAfEnv.PropAgent(), iOffScreen, iSkonGc);
// Change End 2007.09.03
	iDrawer->SetObserver(this);

	aStep++;
	iDelete = CSmbMusicAPMainPlayerPlayDelete::NewL(iFilterView, iAfEnv.Log());
	iDelete->SetObserver(this);

	iFilterView.SetPlayerObserver(this);

	aStep++;
//	TVwsViewId viewId;
//	ActivateViewL(viewId, KNullUid, KNullDesC8);

	iUndefTitle = CEikonEnv::Static()->AllocReadResourceL(R_SMB_AF_STR_ETC437);
	
	// 枹張棟忬懺偵偡傞丅
	ChangeState(ESmbMusicAPMainPlayerPlayInitial);
	iJacketIndex   = KSmbMusicAPMainPlayerPlayDefaaultJaket;		// 2006.08.25
	iSongInfoIndex = KSmbMusicAPMainPlayerPlayDefaaultJaket;		// 2006.09.11

	// 僶僢僋儔僀僩忬懺弶婜壔
	iBacklight = ETrue;
	iDrawer->SetBacklight(iBacklight);
	
	//Y: 忬懺僆僽僕僃僋僩偺惗惉
	
	iStateArray[ESmbMusicAPMainPlayerPlayInitial]			= new(ELeave) CSmbMusicAPMainPlayerStateInitial(iPlayerEnv, iAfEnv.Log(), iAfEnv.PropAgent(), this);
	iStateArray[ESmbMusicAPMainPlayerPlayPlaying]			= new(ELeave) CSmbMusicAPMainPlayerStatePlay(iPlayerEnv, iAfEnv.Log(), iAfEnv.PropAgent(), this);
	iStateArray[ESmbMusicAPMainPlayerPlayStop]				= new(ELeave) CSmbMusicAPMainPlayerStatePause(iPlayerEnv, iAfEnv.Log(), iAfEnv.PropAgent(), this);
	iStateArray[ESmbMusicAPMainPlayerPlayPlayFF]			= new(ELeave) CSmbMusicAPMainPlayerStateFF(iPlayerEnv, iAfEnv.Log(), iAfEnv.PropAgent(), this);
	iStateArray[ESmbMusicAPMainPlayerPlayPlayFR]			= new(ELeave) CSmbMusicAPMainPlayerStateFR(iPlayerEnv, iAfEnv.Log(), iAfEnv.PropAgent(), this);
	iStateArray[ESmbMusicAPMainPlayerPlayPlayResourceFail]	= new(ELeave) CSmbMusicAPMainPlayerStateResourceFail(iPlayerEnv, iAfEnv.Log(), iAfEnv.PropAgent(), this);
	
	iState = iStateArray[ESmbMusicAPMainPlayerPlayInitial];
	
// PTX824懳墳
	ChangeFuncKeyState(EFalse);		// 2007.04.23

#ifdef __SMBMUSICAP_PERFORMANCE_DEF__
/////// 昤夋惈擻帋尡梡 2007.08.08
	iDrawInterval = 60;		// 弶婜抣 60msec
#endif
	
	_LIT(KLogFmtEnd, "CSmbMusicAPMainPlayerPlayView::ConstructL End");
	SmbMusicAPMainPlayerUtility::OutputLog(iAfEnv.Log(), 200003, ELogLevelLow, KLogFmtEnd);
	}

/**
 * 價儏乕僐儞僥僫偺弶婜壔\n
 *   昤夋僋儔僗傪弶婜壔偡傞丅
 */
void CSmbMusicAPMainPlayerPlayView::DoConstructContainerL()
	{
	TInt step(0);
	TRAPD(err, TrappedDoConstructContainerL(step));
	if (KErrNone != err)
		{
		// DoConstructContainerL()幐攕.
		_LIT(KLogFmt, "CSmbMusicAPMainPlayerPlayView::DoConstructContainerL step=%d");
		SmbMusicAPMainPlayerUtility::OutputLog(iAfEnv.Log(), 200004, ELogLevelHigh, KLogFmt, step);
		User::Leave(err);
		}
	}

/**
 * 僐儞僥僫僐儞僩儘乕儖偺嶌惉傪峴偆丅
 * @param[in,out] aStep 張棟僗僥僢僾
 */
void CSmbMusicAPMainPlayerPlayView::TrappedDoConstructContainerL(TInt& aStep)
	{
	
	aStep++;
	CSakKeyGuidance* keyGuidance = SwapKeyGuidance(NULL);
	delete keyGuidance;
	
	// 儈儏乕僕僢僋愝掕僨乕僞傪庢摼偡傞丅
	aStep++;
	iSetdata.PlayMode  = SmbPGMusic::PlayModeSettingL(iAfEnv.PropAgent());
	iSetdata.Repeat    = SmbPGMusic::RepeatSettingL(iAfEnv.PropAgent());
	iSetdata.VPT       = SmbPGMusic::VPTSettingL(iAfEnv.PropAgent());
	iSetdata.Bass      = SmbPGMusic::BassSettingL(iAfEnv.PropAgent());
	iSetdata.Equalizer = SmbPGMusic::EqualizerSettingL(iAfEnv.PropAgent());
	iSetdata.AVLS      = SmbPGMusic::AVLSSettingL(iAfEnv.PropAgent());
	iSetdata.Norm      = SmbPGMusic::DynamicNormalizerSettingL(iAfEnv.PropAgent());
	iSetdata.Volume    = SmbPGMusic::APVolumeSettingL(iAfEnv.PropAgent());
	// 昤夋僋儔僗偺僐儞僗僩儔僋僩張棟
	aStep++;
	iDrawer->DoConstructL(&iSetdata);

	aStep++;

	_LIT(KLogFmtEnd, "CSmbMusicAPMainPlayerPlayView::DoConstructContainerL End");
	SmbMusicAPMainPlayerUtility::OutputLog(iAfEnv.Log(), 200005, ELogLevelLow, KLogFmtEnd);

	}

/**
 * 幚嵺偺價儏乕傾僋僥傿儀乕僩帪偺張棟\n
 *   婲摦梫場偵懳墳偟偰價儏乕偺弶婜張棟傪峴偆丅
 * @param[in] aPrevViewId
 * @param[in] aCustomMessageId
 * @param[in] aCustomMessage
 */
void CSmbMusicAPMainPlayerPlayView::DoViewActivatedImplL(const TVwsViewId& /*aPrevViewId*/, TUid aCustomMessageId, const TDesC8& aCustomMessage)
	{
	TBool	changeFilterView(EFalse);		// 2006.09.13
	
	_LIT(KLogFmtStart, "CSmbMusicAPMainPlayerPlayView::DoViewActivatedImplL ID=%x");
	SmbMusicAPMainPlayerUtility::OutputLog(iAfEnv.Log(), 200006, ELogLevelLow, KLogFmtStart, aCustomMessageId);
	
	iViewTop = ETrue;		// 嵟慜柺價儏乕偱偁傞偙偲傪僙僢僩
	
	iExtMemory = EFalse;
	iBottomSong = EFalse;		// 2006.10.18  TRK:11799
	iLowBatteryStoped = EFalse;		// 2006.10.25
// PTX824懳墳
// Add 2007.02.27
	iTopSong = EFalse;
// Add End 2007.02.27
	
	// 嵞惗壜擻忬懺峏怴
	SetDrawableL();
//	iDrawer->DoMusicEnableL(ETrue);
	iDrawer->MakeVisible(ETrue);
	iDrawer->SetPlayInfoObserver();			// 2006.09.20
	(iDrawer->PlayInfoPanel())->ShowL(EFalse);
	iDrawer->SetPlayInfoPanel();			// 2006.09.26  TRK:9205
	iDrawer->DoMusicEnableL(ETrue);			// 2006.09.26  TRK:9205

	// 儊僢僙乕僕僷儔儊乕僞傪撪晹偵僉儍僢僔儏偡傞
	iCurMessageID = aCustomMessageId;
	if (IsRequestSongListPlay(aCustomMessageId)  != EFalse)
		{
		// 儕僗僩嵞惗丄嬋堦棗儕僗僩嵞惗偺応崌偼丄嵞惗儕僗僩忣曬傪庢摼偡傞丅
		const TSmbMusicAPMainPlayerPrmPlayList* CustomParam = reinterpret_cast<const TSmbMusicAPMainPlayerPrmPlayList*>(aCustomMessage.Ptr());
		iReqPlayList.iListHandle = CustomParam->iListHandle;
		iReqPlayList.iIndex      = CustomParam->iIndex;
		iReqPlayList.iCount      = CustomParam->iCount;
		iReqPlayList.iShuffle    = CustomParam->iShuffle;
		iReqPlayList.iListType   = CustomParam->iListType;		// 2006.09.11

		_LIT(KLogFmt01, "CSmbMusicAPMainPlayerPlayView::DoViewActivatedImplL ListHandle=%X Index=%d AllShuffle=%d ListType=%d");
		SmbMusicAPMainPlayerUtility::OutputLog(iAfEnv.Log(), 200106, ELogLevelNormal, KLogFmt01, iReqPlayList.iListHandle, iReqPlayList.iIndex, iReqPlayList.iShuffle, iReqPlayList.iListType);

		if (0 == iReqPlayList.iCount)		// 2006.07.27
			{
			// 嬻偺嵞惗儕僗僩偑巜掕偝傟偨
// Add 2007.04.09  TRK:12407 (PTX824 TRK:799)
			ProcCancelAction();
// Add End 2007.04.09  TRK:12407 (PTX824 TRK:799)
			iState->ChangedEmptySongListL();//Y: State僋儔僗偵埾忳
			return;
			}

		if (IsPlaySongChanged() != EFalse)
			{
			// 嵞惗嬋偑曄峏偝傟偨
//			TBool playInfo = (ESmbMusicAPMainPlayerPlayPlaying == iStatus) ? ETrue : EFalse;
			
			if (ESmbMusicAPMainPlayerPlayPlaying != iState->PlayStatus())
				{
				//Y: 嵞惗拞偺応崌

⌨️ 快捷键说明

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