📄 preferencesdialog.cpp
字号:
/* Copyright (C) 2006 Lucas Gomez All Rights Reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
// INCLUDE FILES
#include "PreferencesDialog.h"
#include "VncViewer.hrh"
#include "VncViewer.rsg"
#include "VncViewerAppUi.h"
// CONSTANTS
CPreferencesDialog::CPreferencesDialog(TBool aReadOnly,CVncViewerAppUi* aCallback)
{
iReadOnly=aReadOnly;
iCallback=aCallback;
}
CPreferencesDialog::~CPreferencesDialog()
{
if(iEncodingSettingList)
{
delete iEncodingSettingList;
iEncodingSettingList=NULL;
}
if(iInputSettingList)
{
delete iInputSettingList;
iInputSettingList=NULL;
}
if(iMiscSettingList)
{
delete iMiscSettingList;
iMiscSettingList=NULL;
}
CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
np->Pop();
delete iNaviDecorator;
}
TInt CPreferencesDialog::CountComponentControls() const
{
return 1;
}
CCoeControl* CPreferencesDialog::ComponentControl(TInt /*aIndex*/) const
{
switch(iCurrentPageInd)
{
case 0:
return iEncodingSettingList;
case 1:
return iInputSettingList;
case 2:
return iMiscSettingList;
}
return NULL;
}
void CPreferencesDialog::PreLayoutDynInitL()
{
iCurrentPageInd=0;
iEncodingSettingList = new (ELeave) CEncodingPrefSettingList(iCallback->GetAutoSelect(),iCallback->GetEncoding(),iCallback->GetColourLevel());
iEncodingSettingList->SetMopParent(this);
iEncodingSettingList->ConstructFromResourceL(R_PREFERENCES_ENCODING_LIST);
iEncodingSettingList->SetReadOnly(iReadOnly);
iInputSettingList = new (ELeave) CInputPrefSettingList(iCallback->GetViewOnly(),iCallback->GetAcceptClipboard(),iCallback->GetSendClipboard());
iInputSettingList->SetMopParent(this);
iInputSettingList->ConstructFromResourceL(R_PREFERENCES_INPUT_LIST);
iInputSettingList->SetReadOnly(iReadOnly);
iMiscSettingList = new (ELeave) CMiscPrefSettingList(iCallback->GetShared(),iCallback->GetUseLocalCursor(),iCallback->GetFastCopyRect());
iMiscSettingList->SetMopParent(this);
iMiscSettingList->ConstructFromResourceL(R_PREFERENCES_MISC_LIST);
iMiscSettingList->SetReadOnly(iReadOnly);
//get the navigation
CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
TResourceReader reader;
iCoeEnv->CreateResourceReaderLC(reader,R_PREFERENCES_TAB_GROUP);
iNaviDecorator = np->CreateTabGroupL(reader);
CleanupStack::PopAndDestroy(); // resource reader
np->PushL(*iNaviDecorator); // Set new tab group.
sp->DrawNow();
}
void CPreferencesDialog::ChangeCurrentPage()
{
iCurrentPageInd = Max(0, iCurrentPageInd);
iCurrentPageInd = Min(2, iCurrentPageInd);
//hide all setting listboxes
iEncodingSettingList->MakeVisible(EFalse);
iInputSettingList->MakeVisible(EFalse);
iMiscSettingList->MakeVisible(EFalse);
//change the tab
CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>(iNaviDecorator->DecoratedControl());
switch(iCurrentPageInd)
{
case 0:
iEncodingSettingList->MakeVisible(ETrue);
iEncodingSettingList->ActivateL();
tabGroup->SetActiveTabById(EPreferencesDialogPage01);
break;
case 1:
iInputSettingList->MakeVisible(ETrue);
iInputSettingList->ActivateL();
tabGroup->SetActiveTabById(EPreferencesDialogPage02);
break;
case 2:
iMiscSettingList->MakeVisible(ETrue);
iMiscSettingList->ActivateL();
tabGroup->SetActiveTabById(EPreferencesDialogPage03);
break;
}
DrawNow();
}
TKeyResponse CPreferencesDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
if(aType==EEventKey)
{
switch (aKeyEvent.iScanCode)
{
case EStdKeyRightArrow:
iCurrentPageInd++;
ChangeCurrentPage();
break;
case EStdKeyLeftArrow:
iCurrentPageInd--;
ChangeCurrentPage();
break;
}
}
switch(iCurrentPageInd)
{
case 0: return iEncodingSettingList->OfferKeyEventL(aKeyEvent, aType);
case 1: return iInputSettingList->OfferKeyEventL(aKeyEvent, aType);
case 2: return iMiscSettingList->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasNotConsumed;
}
TBool CPreferencesDialog::OkToExitL(TInt /*aButtonId*/)
{
iCallback->SetAutoSelect(GetAutoSelect());
iCallback->SetEncoding(GetEncoding());
//iCallback->SetColourLevel(GetColourLevel());
iCallback->SetViewOnly(GetViewOnly());
//iCallback->SetAcceptClipboard(GetAcceptClipboard());
//iCallback->SetSendClipboard(GetSendClipboard());
iCallback->SetShared(GetShared());
iCallback->SetUseLocalCursor(GetUseLocalCursor());
iCallback->SetFastCopyRect(GetFastCopyRect());
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -