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

📄 bencoolensettingsdlg.cpp

📁 Symbian截图软件ScreenShot*水印版*的源码,2nd和3rd的也在这个包中
💻 CPP
字号:
/*
 * BencoolenSettingsDlg.cpp
 *
 * Copyright 2005 - 2007, Antony Pranata
 * http://www.antonypranata.com
 *
 * Project: Screenshot for Symbian OS.
 *
 * This program 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 program 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 program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

// INCLUDES
#include <eikchlst.h> // ChoiceList
#include <eikgted.h>  // CEikGlobalTextEditor
#include <screenshot.rsg>
#include "BencoolenSettingsDlg.h"
#include "ScreenShotData.h"
#include "Bencoolen.hrh"

// MEMBER FUNCTIONS

// --------------------------------------------------------------------------
// Default constructor.
// --------------------------------------------------------------------------
CBencoolenSettingsDlg::CBencoolenSettingsDlg(CScreenShotData& aScreenShotData)
:CEikDialog(),
 iScreenShotData(aScreenShotData)
    {
    }

// --------------------------------------------------------------------------
// Creates controls and sets the default values for each of them.
// --------------------------------------------------------------------------
void CBencoolenSettingsDlg::PreLayoutDynInitL()
    {
    iChoiceListMode     = static_cast<CEikChoiceList*> (Control(EBencoolenDlgMode));
    iChoiceListShortcut = static_cast<CEikChoiceList*> (Control(EBencoolenDlgShortcut));
    iChoiceListFormat   = static_cast<CEikChoiceList*> (Control(EBencoolenDlgImageFormat));
    iTextEditorFileName = static_cast<CEikGlobalTextEditor*> (Control(EBencoolenDlgFileName));
    iChoiceListDelay    = static_cast<CEikChoiceList*> (Control(EBencoolenDlgDelay));

    if (iScreenShotData.Mode() <= iChoiceListMode->DesCArray()->Count())
        {
        iChoiceListMode->SetCurrentItem(iScreenShotData.Mode() - 1);
            // We have to minus 1 because the shortcut start at index 1.
        }

    if (iScreenShotData.Shortcut() <= iChoiceListShortcut->DesCArray()->Count())
        {
        iChoiceListShortcut->SetCurrentItem(iScreenShotData.Shortcut() - 1);
            // We have to minus 1 because the shortcut start at index 1.
        }

    if (iScreenShotData.ImageFormat() <= iChoiceListFormat->DesCArray()->Count())
        {
        iChoiceListFormat->SetCurrentItem(iScreenShotData.ImageFormat() - 1);
            // We have to minus 1 because the image format starts at index 1.
        }

    if (iScreenShotData.Delay() <= iChoiceListDelay->DesCArray()->Count())
        {
        iChoiceListDelay->SetCurrentItem(iScreenShotData.Delay() - 1);
            // We have to minus 1 because the delay starts at index 1.
        }

    TPtrC fileName(iScreenShotData.FileName());
    iTextEditorFileName->SetTextL(&fileName);
    }

// --------------------------------------------------------------------------
// If the user presses OK, it changes the user preferences stored
// at iScreenShotData.
// --------------------------------------------------------------------------
TBool CBencoolenSettingsDlg::OkToExitL(TInt aButtonId)
    {
    if (aButtonId == EEikBidOk)
        {
        iScreenShotData.SetMode((CScreenShotData::TMode) 
            (iChoiceListMode->CurrentItem() + 1));
        iScreenShotData.SetShortcut((CScreenShotData::TShortcut)
            (iChoiceListShortcut->CurrentItem() + 1));
        iScreenShotData.SetImageFormat((CScreenShotData::TImageFormat)
            (iChoiceListFormat->CurrentItem() + 1));
        TBuf<KMaxFileName> buffer;
        iTextEditorFileName->GetText(buffer);
        iScreenShotData.SetFileNameL(buffer);
        iScreenShotData.SetDelay((CScreenShotData::TDelay)
            (iChoiceListDelay->CurrentItem() + 1));
        }

    return ETrue;
    }

// End of File

⌨️ 快捷键说明

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