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

📄 smbmusicapsonginfoplaylistview.cpp

📁 索爱手机代码
💻 CPP
字号:
/* Copyright (C) 2007 Sony Ericsson Mobile Communications Japan, Inc. */
/*-------------------------------------------------------------------------*/
// FileName:
//	SmbMusicAPSongInfoPlayListView.cpp
//
// Description:
//	儈儏乕僕僢僋梡徻嵶忣曬昞帵-PlayList昞帵夋柺價儏乕僋儔僗
/*-------------------------------------------------------------------------*/
//曄峏棜楌
//擔晅				|曄峏幰			|撪梕
//---------------------------------------------------------------------------
//2007/08/14		|SEMCJ汭弐		|怴婯嶌惉
#include "SmbMusicAPSongInfoPlayListView.h"
#include <SkonTextLabel.h>

USING_NAMESPACE_SEMCJ
///////////////////////////////////////////////////////////////////////////////
/**
 * PlayList昞帵夋柺峔抸梡僷儔儊乕僞
 */
const TAfViewParam KSongInfoPlayListViewParam =
	{
	ESmbMusicAPSongInfoPlayListInfoView,	// 價儏乕ID
	R_SONGINFO_PLAYLIST_TITLE,				// 僞僀僩儖
	R_SONGINFO_PLAYLIST_KEYGUIDANCE	// 僉乕僈僀僟儞僗
	};

/**
 * 僐儞僗僩儔僋僞
 *
 * @param[in]		aLog				儘僌僒乕僶偺僙僢僔儑儞
 * @param[in]		aAppUi				傾僾儕働乕僔儑儞UI僋儔僗
 */
CSmbMusicAPSongInfoPlayListView::CSmbMusicAPSongInfoPlayListView(RLog& aLog, CSmbMusicAPSongInfoAppUi& aAppUi)
	:CSmbAfView(KSongInfoPlayListViewParam), iLog(aLog), iAppUi(aAppUi)
	{
	}

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

/**
 * 價儏乕僐儞僥僫弶婜壔帪張棟
 */
void CSmbMusicAPSongInfoPlayListView::DoConstructContainerL()
	{
	//悅捈曽岦僐儞僥僫傪梡堄偡傞
	iContainer = new(ELeave)CSkonVerticalContainer;

	iContainer->SetContainerWindowL(*this);
	TResourceReader reader;
	iCoeEnv->CreateResourceReaderLC(reader, R_SONGINFO_PLAYLISTVIEW_CONTAINER);
	iContainer->ConstructFromResourceL(reader);
	CleanupStack::PopAndDestroy();	//reader
	iContainer->SetExtent(TPoint(KSmbLayout_BASE_X,KSmbLayout_TBAR_H), TSize(KSmbLayout_WIN_W,KSmbLayout_WIN_TBAR_H));
	iContainer->SetOverlapEnable(EFalse);

	AddControlL(iContainer);

	//僥僉僗僩儔儀儖傪惗惉偡傞
	CSkonTextLabel* textLabel = new (ELeave) CSkonTextLabel;
	CleanupStack::PushL(textLabel);

	//CCoeControl偺儕僼傽儗儞僗愝掕
	TRAPD(error, textLabel->SetContainerWindowL(*this));
	if(KErrNone != error)
		{
		//儘僌弌椡
		SmbMusicAPSongInfoLog::OutputLog(iLog, ESongInfoLogNo291, ELogLevelHighest, error, KSmbMusicAPSongInfoLogSetContainerWindowLErr);
		//儕乕僽張棟
		User::Leave(error);
		}
	
	TRAP(error, textLabel->ConstructL());
	if(KErrNone != error)
		{
		//儘僌弌椡
		SmbMusicAPSongInfoLog::OutputLog(iLog, ESongInfoLogNo292, ELogLevelHighest, error, KSmbMusicAPSongInfoLogConstructLErr);
		//儕乕僽張棟
		User::Leave(error);
		}	

	TInt controlCount = iContainer->CountControls();
	//嵟屻偵抲偔
	iContainer->InsertControlL(textLabel, controlCount);
	CleanupStack::Pop(); //	textLabel
	
	iContainer->Layout();
	ActivateL();
	}

/**
 * 價儏乕傾僋僥傿僽姰椆帪偺僐乕儖僶僢僋娭悢撪張棟
 *
 * @param[in]		aPrevViewId			屇傃弌偟尦價儏乕ID
 * @param[in]		aCustomMessageId		儊僢僙乕僕ID
 * @param[in]		aCustomMessage		儊僢僙乕僕僶僢僼傽
 */
void CSmbMusicAPSongInfoPlayListView::DoViewActivatedL(const TVwsViewId& /*aPrevViewId*/,
												TUid aCustomMessageId,
												const TDesC8& aCustomMessage)
	{
	//儘乕僇儖UID偺応崌偺張棟
	if(KSmbMusicAPSongInfoLocalUid == aCustomMessageId)
		{
		//僐儅儞僪梷惂夝彍僐儅儞僪傪敪峴偡傞
		iAppUi.HandleCommandL(ECmdReleaseCommand);
		}
	else if(KSmbMusicAPSongInfoStartUid == aCustomMessageId)
		{
		const TSmbMusicAPPlayListInfoStartParam *param;
		param = reinterpret_cast<const TSmbMusicAPPlayListInfoStartParam *>(aCustomMessage.Ptr());
		iPlayListTitle = param->iPlayListTitle;

		//栠傝愭忣曬傪曐帩偡傞
		iAppUi.SetReturnView(param->iViewId);

		TInt controlCount = iContainer->CountControls();
		//嵟屻偺CSkonTextLabel傪庢摼
		CSkonTextLabel* textLabel = STATIC_CAST(CSkonTextLabel *, iContainer->ControlByIndex(controlCount-1));
		TRAPD(error, textLabel->SetTextL(iPlayListTitle));
		if(KErrNone != error)
		  {
			//儘僌弌椡
			SmbMusicAPSongInfoLog::OutputLog(iLog, ESongInfoLogNo293, ELogLevelHighest, error, KSmbMusicAPSongInfoLogSetTextLErr);
			//儕乕僽張棟
			User::Leave(error);
		  }

		iContainer->Layout();
		ActivateL();
		}
	}


/**
 * 僉乕僀儀儞僩張棟
 *
 * @param[in]		aKeyEvent	僉乕僀儀儞僩
 * @param[in]		aType		僀儀儞僩僞僀僾
 * @return		僉乕儗僗億儞僗
 */
TKeyResponse CSmbMusicAPSongInfoPlayListView::OfferKeyEventL(const TKeyEvent& aKeyEvent,	TEventCode aType)
	{
	if(EEventKey != aType)
		{
		return EKeyWasNotConsumed;
		}

	switch(aKeyEvent.iCode)
		{
		//僋儕傾僉乕
		case EWcdmaMpKeyClear:
			{
			//傾僾儕廔椆僐儅儞僪捠抦
			iAppUi.HandleCommandL(EEikCmdExit);
			//奺僐儅儞僪僋儔僗偺HandleViewCommandL娭悢偵偰儘僌弌椡偡傞偨傔丄偙偙偱偼TRAP仺儘僌弌椡偺張棟偼峴傢側偄
			return EKeyWasConsumed;
			}

		default:
			{
			//壗傕偟側偄
			}
			break;
		}
	TKeyResponse res = EKeyWasNotConsumed;
	TRAPD(error, res = CSmbAfView::OfferKeyEventL(aKeyEvent, aType));
	if(KErrNone != error)
		{
		//儘僌弌椡
		SmbMusicAPSongInfoLog::OutputLog(iLog, ESongInfoLogNo294, ELogLevelHighest, error, KSmbMusicAPSongInfoLogOfferKeyEventLError);
		//儕乕僽張棟
		User::Leave(error);
		}
	return res;
	}
// end of SmbMusicAPSongInfoPlayListView.cpp
/* Copyright (C) 2007 Sony Ericsson Mobile Communications Japan, Inc. */

⌨️ 快捷键说明

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