chxavsettingsview.cpp

来自「symbian 下的helix player源代码」· C++ 代码 · 共 187 行

CPP
187
字号
/************************************************************************
 * chxavsettingsview.h
 * -------------------
 *
 * Synopsis:
 * Contains the declaration of the setting view, which manages prefs.
 *
 * Target:
 * Symbian OS
 *
 *
 * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
 *
 ************************************************************************/

// Symbian includes...
#include <aknnavide.h>
#include <aknconsts.h>
#include <aknselectionlist.h>
#include <aknviewappui.h>

// Includes from this project...
#include "comptr_traits.h"
#include "chxavplayer.h"
#include "chxavmisc.h"
#include "chxavplayerui.h"
#include "chxavsettingslist.h"
#include "chxavsettingsview.h"
#include "chxavsettingsviewwindow.h"
#include "chxavselectsettingsview.h"
#include "hxsym_debug.h"
#include "hxapihelp.h"
#include "realplayer.hrh"
#include "chxavconfignames.h"




///////////////////////////////////
//
CHXAvSettingsView::CHXAvSettingsView(TInt idxView, CHXAvPlayerUI* pPlayerUI)
: CHXAvViewBase(idxView, pPlayerUI)
, m_idxPendingActivePage(0)
, m_pPlayerUi(pPlayerUI)
{ 
    HX_ASSERT(m_pPlayerUi);
}


CHXAvSettingsView::~CHXAvSettingsView()
{
}

////////////////////////////////////////////////////////////
//
void CHXAvSettingsView::ConstructL()
{
    BaseConstructL(R_AVP_SETTINGS_VIEW_INFO); 
}



////////////////////////////////////////////////////////////////
//
void CHXAvSettingsView::SaveChangesL()
{
    DPRINTF(SYMP_INFO, ("CHXAvSettingsView::SaveChangesL(): updating config file\n"));

    m_spWindow->ApplyChangesL();
}



////////////////////////////////////////////////////////////////
// exit the view
void CHXAvSettingsView::DoBackL()
{
    // prepare the select settings view with the index to initially show
    CAknView* pView = m_playerUI->View(TUid::Uid(CHXAvPlayerUI::VID_SelectSettingsView));
    HX_ASSERT(pView);
    CHXAvSelectSettingsView* pSelectSettingsView = static_cast<CHXAvSelectSettingsView*>(pView);
    TInt idxCurrent = m_spWindow->GetCurrentPageIndex();
    pSelectSettingsView->ResetCurrentIndex(idxCurrent);

    SaveChangesL();
    AppUi()->HandleCommandL(EAknSoftkeyBack);
}


///////////////////////////////////
//
void CHXAvSettingsView::SetActivePageIndexL(TInt idxPage)
{
    if( m_spWindow )
    {
        m_spWindow->ShowPageL(idxPage);
    }
    else
    {
        // remember this until next time we show window
        m_idxPendingActivePage = idxPage;
    }
}

///////////////////////////////////
//
CCoeControl* CHXAvSettingsView::CreateViewWindowForActivatingViewL()
{
    DPRINTF(SYMP_INFO, ("CHXAvSettingsView::CreateViewWindowForActivatingViewL()\n"));

    m_pPlayerUi->SetPrefChangeObserver(this);

    if( !m_spWindow )
    {
        m_spWindow = new (ELeave) CHXAvSettingsViewWindow(this);
        m_spWindow->ConstructL(ClientRect(), m_idxPendingActivePage);
        m_idxPendingActivePage = 0;
    }

    return m_spWindow.raw_ptr();
}

////////////////////////////////////////////////////////////////////
//
void CHXAvSettingsView::UpdateViewStateL()
{
    m_spWindow->UpdateTopAndBottomL();
}

///////////////////////////////////
//
void CHXAvSettingsView::FinishViewDeactivateL()
{
    DPRINTF(SYMP_INFO, ("CHXAvSettingsView::FinishViewDeactivateL()\n"));
    m_pPlayerUi->SetPrefChangeObserver(0);
    m_spWindow = 0;
    m_idxPendingActivePage = 0;
}


///////////////////////////////////
//
void
CHXAvSettingsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
    if(R_AVP_SETTINGS_MENU_PANE == aResourceId)
    {
        CHXAvMisc::InitHelpMenuItem(aMenuPane);
    }
}

void CHXAvSettingsView::OnPrefsChanged()
{
    // refresh current page
    m_spWindow->ShowPageL(m_spWindow->GetCurrentPageIndex());
}

////////////////////////////////////////////////////////////////
//
// this view gets first crack at command; unknowns forwarded to appui
//
void CHXAvSettingsView::HandleCommandL(TInt command)
{
    DPRINTF(SYMP_INFO, ("CHXAvSettingsView::HandleCommandL(%d)\n", command));
    switch(command)
    {
    case EAknSoftkeyBack:
    case EAknSoftkeyOk:
	DoBackL();
	break;
    case EAknSoftkeyExit:
    case EAknCmdExit:// framework tranlates EAknCmdExit to EEikCmdExit
    case EEikCmdExit: 
        SaveChangesL();
        AppUi()->HandleCommandL(command);
        break;
    case EChange:
	m_spWindow->EditCurrentItemL();
	break;
    default:
	AppUi()->HandleCommandL(command);
	break;
    }
}


⌨️ 快捷键说明

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