📄 smbmusicapmainplayerplaydrawer.cpp
字号:
/* Copyright (C) 2007 Sony Ericsson Mobile Communications Japan, Inc. */
/*-------------------------------------------------------------------------*/
// FileName:
// SmbMusicAPMainPlayerPlayDrawer.cpp
//
// Description:
// 儈儏乕僕僢僋僾儗僀儎乕嵞惗宯偺昤夋僐儞僩儘乕儖僋儔僗
/*------------------------------------------------------------------------*/
//曄峏棜楌
//擔晅 |曄峏幰 |撪梕
//--------------+-----------+----------------------------------------------
//2007/04/17 |K3拞堜 | 弶斉儕儕乕僗
/// 嵞惗宯昤夋僐儞僩儘乕儖僋儔僗
/**
* @file SmbMusicAPMainPlayerPlayDrawer.c
*
* 儈儏乕僕僢僋僾儗僀儎乕嵞惗宯偺昤夋僐儞僩儘乕儖僋儔僗偺掕媊僿僢僟
*/
//#define __SKIP_EFFECT__
#define KSmbMusicAPMainPlayerLevelCount 5
#include "SmbMusicAPMainPlayerPlayDebug.h"
#ifndef __E32STD_H__
#include <e32std.h>
#endif
#ifndef FJPGBASICLASERVER_H__
#include <FjpgBasicLaServer.h>
#endif
#ifndef __SMBPGMENU_H__
#include <SmbPGMenu.h>
#endif
#ifndef __SMBMUSICAPMAINPLAYERDIALOGMANAGER_H__
#include "SmbMusicAPMainPlayerDialogManager.h"
#endif
#ifndef __SMBMUSICAPMAINPLAYERPLAYDRAWER_H__
#include "SmbMusicAPMainPlayerPlayDrawer.h"
#endif
#ifndef __SMBMUSICAPMAINPLAYERCOMMONDEF_H__
#include "SmbMusicAPMainPlayerCommonDef.h"
#endif
#ifndef __SMBMUSICAPMAINPLAYERUTILITY_H__
#include "SmbMusicAPMainPlayerUtility.h"
#endif
#ifndef __SMBMUSICAPMAINPLAYEREXTERNALINTERFACE_H__
#include <SmbMusicAPMainPlayerExternalInterface.h>
#endif
#ifdef __SMBMUSICAP_PERFORMANCE_DEF__
#ifndef __SKONEFFECTOR_H__
#include <SkonEffector.h>
#endif
#endif
#ifdef __DRAW_CHANGE_CPU_SPEED_
// Add 2008.08.15
#ifndef FJLACLIENT_H__
#include <Fjlaclient.h>
#endif
// Add End 2008.08.15
#endif
SEMCJ_NAMESPACE_BEGIN
#include <SmbMusicAPMainPlayer.RSG>
/**
* 僋儔僗惗惉
* @param[in] aAfEnv 娐嫬僋儔僗
* @param[in] aLog RLog僆僽僕僃僋僩
* @param[in] aPropAgent 僾儘僷僥傿僄乕僕僃儞僩僆僽僕僃僋僩
* @return 惗惉偟偨CSmbMusicAPMainPlayerPlayCmd僆僽僕僃僋僩
*/
CSmbMusicAPMainPlayerPlayDrawer* CSmbMusicAPMainPlayerPlayDrawer::NewL(
CCoeControl& aContainer,
MSmbMusicAPMainPlayerEnv& aAfEnv,
RLog& aLog,
// Change 2007.09.03
// RPGPropAgent& aPropAgent
RPGPropAgent& aPropAgent,
CFbsBitmap* aOffScreen, // Add 2007.09.01
CSkonBitGc* aSkonGc
)
{
// CSmbMusicAPMainPlayerPlayDrawer* self = new(ELeave) CSmbMusicAPMainPlayerPlayDrawer(aContainer, aAfEnv, aLog, aPropAgent);
CSmbMusicAPMainPlayerPlayDrawer* self = new(ELeave) CSmbMusicAPMainPlayerPlayDrawer(aContainer, aAfEnv, aLog, aPropAgent, aOffScreen, aSkonGc);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(); // self
return self;
}
/**
* 僀儞僗僞儞僗惗惉
* @param[in] aAfEnv 娐嫬僋儔僗
* @param[in] aLog RLog僆僽僕僃僋僩
* @param[in] aPropAgent 僾儘僷僥傿僄乕僕僃儞僩僆僽僕僃僋僩
*/
CSmbMusicAPMainPlayerPlayDrawer::CSmbMusicAPMainPlayerPlayDrawer(
CCoeControl& aContainer,
MSmbMusicAPMainPlayerEnv& aAfEnv,
RLog& aLog,
// Change 2007.09.03
// RPGPropAgent& aPropAgent
RPGPropAgent& aPropAgent,
CFbsBitmap* aOffScreen, // Add 2007.09.01
CSkonBitGc* aSkonGc
)
: iContainer(aContainer), iAfEnv(aAfEnv), iLog(aLog), iPropAgent(aPropAgent)
{
// Add 2007.09.03
iScreen = aOffScreen; // Add 2007.09.01
iSkonGc = aSkonGc;
}
/**
* 僨僗僩儔僋僞
*/
CSmbMusicAPMainPlayerPlayDrawer::~CSmbMusicAPMainPlayerPlayDrawer()
{
// 僞僀儅掆巭
StopRedrawTimer();
// SkonMusic娭楢偺嶍彍
delete iMusicControl;
delete iPlayPanel;
delete iVolumePanel;
delete iVss;
delete iTrackInfo;
delete iListInfo;
delete iSettingInfo;
// Bitmap娭楢
// del 2007.09.01
// delete iScreen;
// delete iSkonGc;
// delete iDev;
// 夋憸僨乕僞偺嶍彍 2006/07/04
if (NULL != iJacketDataDef)
{
if (iJacketDataDef != iJacketData)
{
delete iJacketData;
delete iJacketIcon;
}
delete iJacketDataDef;
delete iJacketIconDef;
}
else
{
delete iJacketData;
delete iJacketIcon;
}
// 僉乕僈僀僟儞僗
delete iPlayKeyGuidance;
delete iPauseKeyGuidance;
delete iFFKeyGuidance;
delete iNoneKeyGuidance;
delete iFailSongKeyGuidance;
}
/**
* 擇師僐儞僗僩儔僋僞
*
*/
void CSmbMusicAPMainPlayerPlayDrawer::ConstructL()
{
// 僆僼僗僋儕乕儞傪惗惉
// Delete 2007.09.01
// iScreen = new(ELeave) CFbsBitmap;
// iScreen->Create(TSize(KSmbLayout_WIN_W, KSmbLayout_WIN_H), iEikonEnv->DefaultDisplayMode());
// iDev = CFbsBitmapDevice::NewL(iScreen);
// iDev->CreateContext(iScreenGc);
// iSkonGc = CSkonBitGc::NewL(iScreenGc, iScreen);
iDispStatus = ESmbMusicAPMainPlayerPlayDispNone;
// 嵞惗忣曬僷僱儖傪惗惉
iPlayPanel = new(ELeave) CSkonMusicPlayInfoPanel();
iPlayPanel->ConstructL(CSkonMusicPlayInfoPanel::EDisplayModeLarge);
iPlayPanel->SetObserver(this);
iPlayPanel->SetOwnedExternally( ETrue ); // 僷僱儖忣曬傪強桳偟側偄 nakai
// 嵞惗忣曬僷僱儖偺僩儔僢僋忣曬
iTrackInfo = new (ELeave)CSkonMusicTrackInfo();
iTrackInfo->SetMusicTitleL( _L("") );
iTrackInfo->SetAlbumNameL( _L("") );
iTrackInfo->SetArtistNameL( _L("") );
iTrackInfo->SetTrackNo(0);
iTrackInfo->SetMusicTime(0);
iTrackInfo->SetJacketIcon(NULL);
iPlayPanel->SetTrackInfo(iTrackInfo);
// 嵞惗忣曬僷僱儖偺憤僩儔僢僋悢
iListInfo = new (ELeave)CSkonMusicListInfo();
iPlayPanel->SetListInfo(iListInfo);
// 儈儏乕僕僢僋愝掕忣曬
iSettingInfo = new (ELeave)CSkonMusicSettingInfo();
iPlayPanel->SetSettingInfo(iSettingInfo);
iPlayTimeDelay = 1 * 1000; // 嵞惗忣曬僷僱儖峏怴梡僞僀儅偺Delay(1昩)
// 壒検愝掕僷僱儖傪惗惉
iVolumePanel = new(ELeave) CSkonMusicVolumePanel();
iVolumePanel->ConstructL(CSkonMusicVolumePanel::EDisplayModeLarge);
iVolumePanel->SetObserver(this);
}
// Add 2006.09.21
/**
* 嵞惗忣曬僷僱儖偺僆僽僓乕僶搊榐傪嵞愝掕偡傞丅
*/
void CSmbMusicAPMainPlayerPlayDrawer::SetPlayInfoObserver()
{
if (NULL != iPlayPanel)
{
iPlayPanel->SetObserver(this);
}
}
// Add End 2006.09.21
/**
* 僐儞僥僫僐儞僩儘乕儖嶌惉帪偺僐儞僗僩儔僋僞
* @param[in] aContainer 恊僐儞僥僫僋儔僗
* @param[in] aSettingData 儈儏乕僕僢僋愝掕僨乕僞
*
*/
void CSmbMusicAPMainPlayerPlayDrawer::DoConstructL(TSmbMusicAPMainPlayerPlaySettingData* aSettingData)
{
SetContainerWindowL(iContainer);
// Music梡僐儞僩儘乕儖偺僐儞僥僫僋儔僗傪惗惉
iMusicControl = new(ELeave) CSkonMusicControlContainer();
iMusicControl->SetContainerWindowL(iContainer);
iMusicControl->ConstructL(CSkonMusicControlContainer::EDisplayModeLarge);
iMusicControl->SetExtent(TPoint(0,0), iContainer.Size());
iMusicControl->SetObserver(this);
// VirualSpaceScreen傪惗惉
iVss = new(ELeave) CSkonVirtualSpaceScreen;
iVss->SetContainerWindowL(iContainer);
iVss->ConstructL(this);
iVss->SetObserver(this);
iVss->SetExtent(TPoint(0,0), iContainer.Size());
iVs = iVss->VirtualSpace();
// 僕儍働僢僩昞帵梡偺Visualizer傪惗惉
iVzNormal = new(ELeave) CSkonVisualizer();
iVzNormal->SetContainerWindowL(iContainer);
iVzNormal->ConstructL(CSkonVisualizer::EDisplayModeLarge);
iVzNormal->SetObserver(this);
iVzNormal->SetSize(iContainer.Size());
iVzNormal->SetVisualizerPattern(CSkonVisualizer::EPatternNormal);
iVzNormal->SetImage(NULL);
iVs->AddControlL(iVzNormal, TPoint(KSmbMusicAPMainPlayerPlayVzPointX, KSmbMusicAPMainPlayerPlayVzPointY));
// VirualSpaceScreen傪Music僐儞僥僫僋儔僗偵僙僢僩偡傞丅
iMusicControl->SetVirtualSpaceScreen(iVss);
// 嵞惗忣曬僷僱儖傪Music僐儞僥僫僋儔僗偵僙僢僩偡傞丅
iPlayPanel->SetContainerWindowL(iContainer);
iPlayPanel->SetPanelPosition(CSkonMusicPlayInfoPanel::EDisplayPositionBottom);
iPlayPanel->SetRect(iContainer.Rect());
iMusicControl->SetMusicPlayInfoPanel(iPlayPanel);
iPlayPanel->ShowL(EFalse);
// 壒検愝掕僷僱儖傪弶婜愝掕偡傞丅
iVolumePanel->SetContainerWindowL(iContainer);
iVolumePanel->SetRect(iContainer.Rect());
// 僼僅乕僇僗僀儀儞僩偑偙側偔側傞偺偱丄埲壓偺巜掕偑昁梫乮T.B.D.乯丅
iVolumePanel->ActivateL();
// 壒検愝掕僷僱儖傪Music僐儞僥僫僋儔僗偵僙僢僩偡傞丅
iMusicControl->SetMusicVolumePanel(iVolumePanel);
// 奺僐儞僩儘乕儖忣曬傪僙僢僩偡傞丅
SetControlInfo(aSettingData);
// Add 2007.08.23 昤夋娫妘挷惍
iMusicControl->SetIntervalL(KSmbMusicAPMainPlayerPlayDrawInterval);
// Add End 2007.08.23 昤夋娫妘挷惍
DoMusicEnableL(ETrue);
// 僉乕僈僀僟儞僗傪峔抸偡傞丅
ConstructKeyGuidanceL();
iCurKeyGuidance = iNoneKeyGuidance;
iDispStatus = ESmbMusicAPMainPlayerPlayDispIdle; // 2006.08.30
SetComponentsToInheritVisibility(EFalse);
MakeVisible(ETrue);
}
#ifdef __SMBMUSICAP_PERFORMANCE_DEF__
// ################# 昤夋惈擻挷惍 ###########################################################
void CSmbMusicAPMainPlayerPlayDrawer::SetDrawInterval(TInt aVal)
{
// CSkonEffector* effector = iMusicControl->Effector();
// effector->SetIntervalL(aVal * 1000);
// effector->SetTimeToTarget(aVal * 4);
iMusicControl->SetIntervalL(aVal * 1000);
_LIT(KLogFmt1, "CSmbMusicAPMainPlayerPlayDrawer::SetDrawInterval val=%dmsec");
SmbMusicAPMainPlayerUtility::OutputLog(iLog, 220016, ELogLevelHigh, KLogFmt1, aVal);
iDrawInterval = aVal;
iTrackInfo->SetTrackNo(aVal);
iListInfo->SetTotalTrackNo(aVal);
iPlayPanel->HandleControlStatusUpdatedL();
}
// ################# 昤夋惈擻挷惍 ###########################################################
#endif
// 2006.10.04 TRK:9205
/**
* Music僐儞僩儘乕儖偵嵞惗忣曬僷僱儖傪愝掕偡傞丅
*/
void CSmbMusicAPMainPlayerPlayDrawer::SetPlayInfoPanel()
{
iMusicControl->SetMusicPlayInfoPanel(iPlayPanel);
}
/**
* SkonMusic偺嵞昤夋桳岠/柍岠偺愝掕曄峏
* @param[in] aEnable ETrue:嵞昤夋桳岠丄EFalse:嵞昤夋柍岠
*/
void CSmbMusicAPMainPlayerPlayDrawer::DoMusicEnableL(TBool aEnable)
{
if (NULL != iMusicControl)
{
if (EFalse != aEnable)
{
iMusicControl->EnableDrawingL();
}
else
{
iMusicControl->DisableDrawing();
}
}
}
/**
* 昤夋僐儞僩儘乕儖偺僆僽僓乕僶傪愝掕偡傞丅
* @param[in] aObserver 昤夋僐儞僩儘乕儖偺僆僽僓乕僶僋儔僗
*/
void CSmbMusicAPMainPlayerPlayDrawer::SetObserver(MSmbMusicAPMainPlayerPlayDrawObserver* aObserver)
{
iObserver = aObserver;
}
/**
* SkonMusic僐儞僩儘乕儖偵奺庬愝掕忣曬傪愝掕偡傞丅
* @param[in] aSettingData 儈儏乕僕僢僋愝掕僨乕僞
*/
void CSmbMusicAPMainPlayerPlayDrawer::SetControlInfo(TSmbMusicAPMainPlayerPlaySettingData* aSettingData)
{
// 儈儏乕僕僢僋愝掕忣曬偺愝掕
iSettingInfo->SetPlayMode(ConvertPlayMode(aSettingData->PlayMode));
iSettingInfo->SetRepeat(ConvertRepeatMode(aSettingData->Repeat));
iSettingInfo->SetVPT(ConvertVPTSetting(aSettingData->VPT));
iSettingInfo->SetBassSetting(ConvertBassSetting(aSettingData->Bass));
iSettingInfo->SetEqualizer(ConvertEqualizer(aSettingData->Equalizer));
iSettingInfo->SetVolume(aSettingData->Volume);
iAvls = aSettingData->AVLS;
iAvlsValue = KSmbMusicAPMainPlayerAVLSLimit;
// 壒検愝掕僷僱儖偵壒検抣傪僙僢僩偡傞
iVolumePanel->SetLevel(aSettingData->Volume);
// 價僕儏傾儔僀僓乕梡偺僩儔僢僋忣曬
iVzNormal->SetTrackInfo(iTrackInfo);
}
/**
* 僉乕僈僀僟儞僗傪嵞峔抸偡傞丅
*/
void CSmbMusicAPMainPlayerPlayDrawer::ConstructKeyGuidanceL()
{
// 嵞惗夋柺梡僉乕僈僀僟儞僗偺惗惉
TResourceReader playkey;
CEikonEnv::Static()->CreateResourceReaderLC(playkey, R_KG_MUSIC_MAIN_PLAY_PLAY);
iPlayKeyGuidance = new(ELeave) CSkonKeyGuidance(NULL, this);
iPlayKeyGuidance->ConstructFromResourceL(playkey);
CleanupStack::PopAndDestroy(); // playkey
// 掆巭夋柺梡僉乕僈僀僟儞僗偺惗惉
CEikonEnv::Static()->CreateResourceReaderLC(playkey, R_KG_MUSIC_MAIN_PLAY_STOP);
iPauseKeyGuidance = new(ELeave) CSkonKeyGuidance(NULL, this);
iPauseKeyGuidance->ConstructFromResourceL(playkey);
CleanupStack::PopAndDestroy(); // playkey
// 憗憲傝乮憗栠偟乯夋柺梡僉乕僈僀僟儞僗偺惗惉
CEikonEnv::Static()->CreateResourceReaderLC(playkey, R_KG_MUSIC_MAIN_PLAY_FF);
iFFKeyGuidance = new(ELeave) CSkonKeyGuidance(NULL, this);
iFFKeyGuidance->ConstructFromResourceL(playkey);
CleanupStack::PopAndDestroy(); // playkey
// 枹張棟夋柺梡僉乕僈僀僟儞僗偺惗惉
CEikonEnv::Static()->CreateResourceReaderLC(playkey, R_KG_MUSIC_MAIN_PLAY_NONE);
iNoneKeyGuidance = new(ELeave) CSkonKeyGuidance(NULL, this);
iNoneKeyGuidance->ConstructFromResourceL(playkey);
CleanupStack::PopAndDestroy(); // playkey
// Add 2007.04.04 PTX824 TRK:497 懳墳
// 枹張棟夋柺梡僉乕僈僀僟儞僗偺惗惉
CEikonEnv::Static()->CreateResourceReaderLC(playkey, R_KG_MUSIC_MAIN_PLAY_PLAY_FAIL_SONG);
iFailSongKeyGuidance = new(ELeave) CSkonKeyGuidance(NULL, this);
iFailSongKeyGuidance->ConstructFromResourceL(playkey);
CleanupStack::PopAndDestroy(); // playkey
// Add End 2007.04.04 PTX824 TRK:497 懳墳
}
/**
* 僉乕僈僀僟儞僗傪嵞昤夋偡傞丅
*/
void CSmbMusicAPMainPlayerPlayDrawer::RedrawKeyGuidance()
{
//Change 2006.12.22 TRK:12643 (PTX824 TRK:771)
// if (EFalse != IsDrawable() && iAfEnv.DialogManager().DisplayDialogNum() == 0 &&
// EFalse == iShowVolumePanel // 2006.10.03 TRK:10837
// )
if (EFalse != IsDrawable() && EFalse != IsFocused())
//Change End 2006.12.22 TRK:12643 (PTX824 TRK:771)
{
// Delete 2007.08.01 婡擻僉乕昞帵曄峏偼峴傢側偄
//// Add 2007.04.23
// if (IsFuncKeyState() == EFalse)
// {
// // 婡擻僉乕柍岠偺応崌偼旕昞帵偵偡傞
// iCurKeyGuidance->MakeVisibleKey(ESkonKeyGuidanceSoftKeyLeft, EFalse);
// }
// else
// {
// iCurKeyGuidance->MakeVisibleKey(ESkonKeyGuidanceSoftKeyLeft, ETrue);
// }
// Add End 2007.04.23
// Delete End 2007.08.01
iKeyGuidanceDrawed = ETrue;
iCurKeyGuidance->DrawNow();
}
else
{
iKeyGuidanceDrawed = EFalse;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -