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

📄 videoplayerappui.cpp

📁 《基于Symbian OS的手机开发与应用实践》这本书的配套源码。
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CVideoPlayerAppUi from VideoPlayerAppui.cpp
*  Part of  : VideoPlayer
*  Created  : 31.01.2006 by ToBeReplacedByAuthor
*  Implementation notes:
*     Initial content was generated by Series 60 Application Wizard.
*  Version  :
*  Copyright: ToBeReplacedByCopyright
* ============================================================================
*/

// INCLUDE FILES
#include <avkon.hrh>
#include <aknutils.h>
#include <eikbtgpc.h>
#include <VideoPlayer.rsg>
#include "VideoPlayer.hrh"

#include "VideoPlayerAppui.h"
#include "VideoPlayerContainer.h" 

// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CVideoPlayerAppUi::ConstructL()
// 
// ----------------------------------------------------------
//
void CVideoPlayerAppUi::ConstructL()
    {
    BaseConstructL();

    iAppContainer = new (ELeave) CVideoPlayerContainer;
    iAppContainer->SetMopParent( this );
    iAppContainer->ConstructL( ClientRect() );

    iVideoPlayerEngine = CVideoPlayerEngine::NewL(*this, *(iAppContainer->DrawableWindow()));

    AddToStackL( iAppContainer );
    }

// ----------------------------------------------------
// CVideoPlayerAppUi::~CVideoPlayerAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CVideoPlayerAppUi::~CVideoPlayerAppUi()
    {
    if (iAppContainer)
        {
        RemoveFromStack( iAppContainer );
        delete iAppContainer;
        }
    delete iVideoPlayerEngine;
    }

// ----------------------------------------------------
// CVideoPlayerAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CVideoPlayerAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
        case EEikCmdExit:
            {
            Exit();
            break;
            }
        case EVideoPlayerCmdPlay:
            {
            _LIT(KVideoFile, "video.3gp");
            TFileName videoFile(KVideoFile);
            CompleteWithAppPath(videoFile);
            iVideoPlayerEngine->PlayL(videoFile);
            SetCbaL(R_SOFTKEYS_PAUSE_STOP);
            break;
            }
        case EVideoPlayerCmdPause:
            {
            iVideoPlayerEngine->PauseL();
            SetCbaL(R_SOFTKEYS_CONTINUE_STOP);
            break;
            }
        case EVideoPlayerCmdContinue:
            {
            iVideoPlayerEngine->Play();
            SetCbaL(R_SOFTKEYS_PAUSE_STOP);
            break;
            }
        case EVideoPlayerCmdStop:
            {
            iVideoPlayerEngine->Stop();
            SetCbaL(R_SOFTKEYS_PLAY_EXIT);
            break;
            }
        default:
            break;      
        }
    }

void CVideoPlayerAppUi::OnComplete(TInt aError)
    {
    TRAPD(err, SetCbaL(R_SOFTKEYS_PLAY_EXIT));
    }


void CVideoPlayerAppUi::SetCbaL(TInt aResourceId)
    {
    CEikButtonGroupContainer* cba = Cba();
    cba->SetCommandSetL(aResourceId);
    cba->DrawDeferred();
    }

// End of File  

⌨️ 快捷键说明

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