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

📄 filmreel2appui.cpp

📁 series60 应用程序开发的源代码 series60 应用程序开发的源代码
💻 CPP
字号:
/**
* 
* @brief Definition of CFilmReel2AppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDE FILES

// Class include
#include "FilmReel2AppUi.h"

// System includes
#include <AknNoteWrappers.h>    // CAknWarningNote
#include <AknQueryDialog.h>        // CAknQueryDialog 
#include <eikmenup.h>            // CEikMenuPane
#include <StringLoader.h>        // StringLoader 

// User includes
#include <FilmReel2.rsg>            // own resources
#include "FilmReel2.hrh"            // own enumerations
#include "FilmReel2Container.h"    // CFilmReel2Container

// Constants
// REMOVED AT REQUEST OF NOKIA--
//const TUid KMediaGalleryAppUid = {  };    // UID of Photo album application
//const TUid KMediaGalleryViewUid = {  };        // UID of Photo album main view
//--

// ================= MEMBER FUNCTIONS =======================

/**
* Symbian OS 2nd phase constructor.  Constructs the application's container, 
* setting itself as the container's MOP parent, and adds it to the control 
* stack.
*/        
void CFilmReel2AppUi::ConstructL()
{
    // Enable skin option.
    BaseConstructL(EAknEnableSkin);

    iAppContainer = CFilmReel2Container::NewL(ClientRect());
    iAppContainer->SetMopParent(this);
    AddToStackL(iAppContainer);
}

/**
* Destructor.
* Removes the application's container from the stack and deletes it.
*/    
CFilmReel2AppUi::~CFilmReel2AppUi()
{
    if (iAppContainer)
    {
        RemoveFromStack(iAppContainer);
        delete iAppContainer;
    }
}

/**
* From CEikAppUi, takes care of command handling.
*
* @param aCommand command to be handled
*/
void CFilmReel2AppUi::HandleCommandL(TInt aCommand)
{
    switch (aCommand)
    {
        case EFilmReel2Record:
            iAppContainer->RecordModeL();
            break;
        case EFilmReel2Continue:
            iAppContainer->PreviewModeL();
            break;
        case EFilmReel2LaunchPhotoAlbum:
        {
            // Launch photo album app
// REMOVED AT REQUEST OF NOKIA--
//            CCoeAppUi::ActivateViewL(TVwsViewId(KMediaGalleryAppUid, KMediaGalleryViewUid));
//--
// Instead show warning--
            _LIT(KNoSwitch, "Cannot switch to Media Gallery");
            CAknWarningNote* note = new (ELeave) CAknWarningNote;
            note->ExecuteLD(KNoSwitch);
//--
            break;
        }
        case EFilmReel2Delete:
        {
            // Delete filename
            // Launch dialog to confirm that the image should be deleted 
            if (ShowDeleteConfirmationQueryL())
            {
                CCoeEnv::Static()->FsSession().Delete(iAppContainer->FileName());
                iAppContainer->PreviewModeL();
            }
        }
            break;
        case EAknSoftkeyExit:
        case EAknSoftkeyBack:
        case EEikCmdExit:
        {
            Exit();
            break;
        }
        default:
            break;        
    }
}

/**
* From CEikAppUi, updates menu based on current state of appContainer
*
* @param aResourceId resource id of the menu pane
* @param aMenuPane menu pane
*/
void CFilmReel2AppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
    if (aResourceId == R_FILMREEL2_OPTIONS_MENU)
    {
        switch (iAppContainer->CurrentState())
        {
            case CFilmReel2Container::EPreviewing:
                aMenuPane->SetItemDimmed(EFilmReel2Continue, ETrue);
                break;
            case CFilmReel2Container::ERecording:
                aMenuPane->SetItemDimmed(EFilmReel2Record, ETrue);
                aMenuPane->SetItemDimmed(EFilmReel2Continue, ETrue);
                break;
            case CFilmReel2Container::EDisplayingResult:
                aMenuPane->SetItemDimmed(EFilmReel2Record, ETrue);
                break;
            case CFilmReel2Container::ESavingImage:
                aMenuPane->SetItemDimmed(EFilmReel2Record, ETrue);
                aMenuPane->SetItemDimmed(EFilmReel2Continue, ETrue);
                break;
            case CFilmReel2Container::EPoweredDown:
                aMenuPane->SetItemDimmed(EFilmReel2Record, ETrue);
                break;
            case CFilmReel2Container::ENotReady:
                aMenuPane->SetItemDimmed(EFilmReel2Record, ETrue);
                aMenuPane->SetItemDimmed(EFilmReel2Continue, ETrue);
                break;
            default:
                break;
        }
    }
}

TKeyResponse CFilmReel2AppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/)
{
    TInt code = aKeyEvent.iCode;

    switch(code)
    {
        // navigator button is pressed
        case EKeyOK:
        {
            if (iAppContainer->CurrentState() == CFilmReel2Container::EPreviewing)
            {
                iAppContainer->RecordModeL();
            }
            else if ((iAppContainer->CurrentState() == CFilmReel2Container::EDisplayingResult)
                || (iAppContainer->CurrentState() == CFilmReel2Container::EPoweredDown))
            {
                iAppContainer->PreviewModeL();
            }
            return (EKeyWasConsumed);
        }
        default:
            break;
    }

    // Default return value
    return(EKeyWasNotConsumed); 
}

TBool CFilmReel2AppUi::ShowDeleteConfirmationQueryL()
{
    HBufC* prompt = StringLoader::LoadLC(R_DELETE_IMAGE_TEXT, iAppContainer->ImageName());
    CAknQueryDialog* dlg = CAknQueryDialog::NewL();

    dlg->SetPromptL(prompt->Des());
    CleanupStack::PopAndDestroy(prompt);

    return dlg->ExecuteLD(R_DELETE_GAME_CONFIRMATION_QUERY );
}

// End of File    

⌨️ 快捷键说明

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