VirtualBox

Changeset 51214 in vbox for trunk/src


Ignore:
Timestamp:
May 8, 2014 1:23:04 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93613
Message:

FE/Qt: 6660: Advanced extra-data management framework: Move WizardType enum and linked stuff into corresponding places.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h

    r51187 r51214  
    7676template<> bool canConvert<GlobalSettingsPageType>();
    7777template<> bool canConvert<MachineSettingsPageType>();
     78template<> bool canConvert<WizardType>();
    7879template<> bool canConvert<IndicatorType>();
    7980template<> bool canConvert<MachineCloseAction>();
     
    139140template<> MachineSettingsPageType fromInternalString<MachineSettingsPageType>(const QString &strMachineSettingsPageType);
    140141template<> QPixmap toWarningPixmap(const MachineSettingsPageType &machineSettingsPageType);
     142template<> QString toInternalString(const WizardType &wizardType);
     143template<> WizardType fromInternalString<WizardType>(const QString &strWizardType);
    141144template<> QString toInternalString(const IndicatorType &indicatorType);
    142145template<> IndicatorType fromInternalString<IndicatorType>(const QString &strIndicatorType);
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r51149 r51214  
    4848template<> bool canConvert<GlobalSettingsPageType>() { return true; }
    4949template<> bool canConvert<MachineSettingsPageType>() { return true; }
     50template<> bool canConvert<WizardType>() { return true; }
    5051template<> bool canConvert<IndicatorType>() { return true; }
    5152template<> bool canConvert<MachineCloseAction>() { return true; }
     
    963964}
    964965
     966/* QString <= WizardType: */
     967template<> QString toInternalString(const WizardType &wizardType)
     968{
     969    QString strResult;
     970    switch (wizardType)
     971    {
     972        case WizardType_NewVM:           strResult = "NewVM"; break;
     973        case WizardType_CloneVM:         strResult = "CloneVM"; break;
     974        case WizardType_ExportAppliance: strResult = "ExportAppliance"; break;
     975        case WizardType_ImportAppliance: strResult = "ImportAppliance"; break;
     976        case WizardType_FirstRun:        strResult = "FirstRun"; break;
     977        case WizardType_NewVD:           strResult = "NewVD"; break;
     978        case WizardType_CloneVD:         strResult = "CloneVD"; break;
     979        default:
     980        {
     981            AssertMsgFailed(("No text for wizard type=%d", wizardType));
     982            break;
     983        }
     984    }
     985    return strResult;
     986}
     987
     988/* WizardType <= QString: */
     989template<> WizardType fromInternalString<WizardType>(const QString &strWizardType)
     990{
     991    /* Here we have some fancy stuff allowing us
     992     * to search through the keys using 'case-insensitive' rule: */
     993    QStringList keys;          QList<WizardType> values;
     994    keys << "NewVM";           values << WizardType_NewVM;
     995    keys << "CloneVM";         values << WizardType_CloneVM;
     996    keys << "ExportAppliance"; values << WizardType_ExportAppliance;
     997    keys << "ImportAppliance"; values << WizardType_ImportAppliance;
     998    keys << "FirstRun";        values << WizardType_FirstRun;
     999    keys << "NewVD";           values << WizardType_NewVD;
     1000    keys << "CloneVD";         values << WizardType_CloneVD;
     1001    /* Invalid type for unknown words: */
     1002    if (!keys.contains(strWizardType, Qt::CaseInsensitive))
     1003        return WizardType_Invalid;
     1004    /* Corresponding type for known words: */
     1005    return values.at(keys.indexOf(QRegExp(strWizardType, Qt::CaseInsensitive)));
     1006}
     1007
    9651008/* QString <= IndicatorType: */
    9661009template<> QString toInternalString(const IndicatorType &indicatorType)
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r51189 r51214  
    190190Q_DECLARE_METATYPE(MachineSettingsPageType);
    191191
     192/** Common UI: Wizard types. */
     193enum WizardType
     194{
     195    WizardType_Invalid,
     196    WizardType_NewVM,
     197    WizardType_CloneVM,
     198    WizardType_ExportAppliance,
     199    WizardType_ImportAppliance,
     200    WizardType_FirstRun,
     201    WizardType_NewVD,
     202    WizardType_CloneVD
     203};
     204
    192205
    193206/** Selector UI: Details-element types. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.cpp

    r51213 r51214  
    2929#include "QIRichTextLabel.h"
    3030#include "UIExtraDataManager.h"
     31#include "UIConverter.h"
    3132
    3233void UIWizard::sltCurrentIdChanged(int iId)
     
    3839        fIsHideShowDescriptionButtonAvailable = true;
    3940    /* But first-run wizard has no such button anyway: */
    40     if (m_type == UIWizardType_FirstRun)
     41    if (m_type == WizardType_FirstRun)
    4142        fIsHideShowDescriptionButtonAvailable = false;
    4243    /* Set a flag for hide/show description button finally: */
     
    6162
    6263        /* Save mode settings: */
    63         gEDataManager->setDescriptionHiddenForWizard(nameForType(m_type), m_mode == UIWizardMode_Expert);
     64        gEDataManager->setDescriptionHiddenForWizard(gpConverter->toInternalString(m_type), m_mode == UIWizardMode_Expert);
    6465
    6566        /* Prepare: */
     
    6869}
    6970
    70 UIWizard::UIWizard(QWidget *pParent, UIWizardType type, UIWizardMode mode)
     71UIWizard::UIWizard(QWidget *pParent, WizardType type, UIWizardMode mode)
    7172    : QIWithRetranslateUI<QWizard>(pParent)
    7273    , m_type(type)
    73     , m_mode(mode == UIWizardMode_Auto ? loadModeForType(m_type) : mode)
     74    , m_mode(mode == UIWizardMode_Auto ? modeForType(m_type) : mode)
    7475{
    7576#ifdef Q_WS_WIN
     
    382383    switch (m_type)
    383384    {
    384         case UIWizardType_CloneVM:
     385        case WizardType_CloneVM:
    385386            dRatio -= 0.4;
    386387            break;
    387         case UIWizardType_NewVD:
    388         case UIWizardType_CloneVD:
     388        case WizardType_NewVD:
     389        case WizardType_CloneVD:
    389390            dRatio += 0.1;
    390391            break;
    391         case UIWizardType_ExportAppliance:
     392        case WizardType_ExportAppliance:
    392393            dRatio += 0.3;
    393394            break;
    394         case UIWizardType_FirstRun:
     395        case WizardType_FirstRun:
    395396            dRatio += 0.3;
    396397            break;
     
    505506
    506507/* static */
    507 QString UIWizard::nameForType(UIWizardType type)
    508 {
    509     QString strName;
    510     switch (type)
    511     {
    512         case UIWizardType_NewVM: strName = "NewVM"; break;
    513         case UIWizardType_CloneVM: strName = "CloneVM"; break;
    514         case UIWizardType_ExportAppliance: strName = "ExportAppliance"; break;
    515         case UIWizardType_ImportAppliance: strName = "ImportAppliance"; break;
    516         case UIWizardType_FirstRun: strName = "FirstRun"; break;
    517         case UIWizardType_NewVD: strName = "NewVD"; break;
    518         case UIWizardType_CloneVD: strName = "CloneVD"; break;
    519     }
    520     return strName;
    521 }
    522 
    523 /* static */
    524 UIWizardMode UIWizard::loadModeForType(UIWizardType type)
     508UIWizardMode UIWizard::modeForType(WizardType type)
    525509{
    526510    /* Some wizard use only basic mode: */
    527     if (type == UIWizardType_FirstRun)
     511    if (type == WizardType_FirstRun)
    528512        return UIWizardMode_Basic;
    529513    /* Otherwise get mode from extra-data manager: */
    530     return gEDataManager->isDescriptionHiddenForWizard(nameForType(type))
     514    return gEDataManager->isDescriptionHiddenForWizard(gpConverter->toInternalString(type))
    531515           ? UIWizardMode_Expert : UIWizardMode_Basic;
    532516}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.h

    r43424 r51214  
    2626/* Local includes: */
    2727#include "QIWithRetranslateUI.h"
     28#include "UIExtraDataDefs.h"
    2829
    2930/* Forward declarations: */
    3031class UIWizardPage;
    31 
    32 /* Wizard type: */
    33 enum UIWizardType
    34 {
    35     UIWizardType_NewVM,
    36     UIWizardType_CloneVM,
    37     UIWizardType_ExportAppliance,
    38     UIWizardType_ImportAppliance,
    39     UIWizardType_FirstRun,
    40     UIWizardType_NewVD,
    41     UIWizardType_CloneVD
    42 };
    4332
    4433/* Wizard mode: */
     
    7362
    7463    /* Constructor: */
    75     UIWizard(QWidget *pParent, UIWizardType type, UIWizardMode mode = UIWizardMode_Auto);
     64    UIWizard(QWidget *pParent, WizardType type, UIWizardMode mode = UIWizardMode_Auto);
    7665
    7766    /* Translation stuff: */
     
    10695    void assignWatermarkHelper();
    10796#endif /* !Q_WS_MAC */
    108     static QString nameForType(UIWizardType type);
    109     static UIWizardMode loadModeForType(UIWizardType type);
     97    static UIWizardMode modeForType(WizardType type);
    11098
    11199    /* Variables: */
    112     UIWizardType m_type;
     100    WizardType m_type;
    113101    UIWizardMode m_mode;
    114102#ifndef Q_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp

    r47431 r51214  
    3535
    3636UIWizardCloneVD::UIWizardCloneVD(QWidget *pParent, const CMedium &sourceVirtualDisk)
    37     : UIWizard(pParent, UIWizardType_CloneVD)
     37    : UIWizard(pParent, WizardType_CloneVD)
    3838    , m_sourceVirtualDisk(sourceVirtualDisk)
    3939{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp

    r45328 r51214  
    3131
    3232UIWizardCloneVM::UIWizardCloneVM(QWidget *pParent, const CMachine &machine, CSnapshot snapshot /* = CSnapshot() */)
    33     : UIWizard(pParent, UIWizardType_CloneVM)
     33    : UIWizard(pParent, WizardType_CloneVM)
    3434    , m_machine(machine)
    3535    , m_snapshot(snapshot)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp

    r50882 r51214  
    3737
    3838UIWizardExportApp::UIWizardExportApp(QWidget *pParent, const QStringList &selectedVMNames)
    39     : UIWizard(pParent, UIWizardType_ExportAppliance)
     39    : UIWizard(pParent, WizardType_ExportAppliance)
    4040    , m_selectedVMNames(selectedVMNames)
    4141{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.cpp

    r48314 r51214  
    3030
    3131UIWizardFirstRun::UIWizardFirstRun(QWidget *pParent, const CMachine &machine)
    32     : UIWizard(pParent, UIWizardType_FirstRun)
     32    : UIWizard(pParent, WizardType_FirstRun)
    3333    , m_machine(machine)
    3434    , m_fHardDiskWasSet(isBootHardDiskAttached(m_machine))
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp

    r47007 r51214  
    136136
    137137UIWizardImportApp::UIWizardImportApp(QWidget *pParent, const QString &strFileName)
    138     : UIWizard(pParent, UIWizardType_ImportAppliance)
     138    : UIWizard(pParent, WizardType_ImportAppliance)
    139139    , m_strFileName(strFileName)
    140140{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp

    r48314 r51214  
    3838                             qulonglong uDefaultSize,
    3939                             UIWizardMode mode)
    40     : UIWizard(pParent, UIWizardType_NewVD, mode)
     40    : UIWizard(pParent, WizardType_NewVD, mode)
    4141    , m_strDefaultName(strDefaultName)
    4242    , m_strDefaultPath(strDefaultPath)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r51209 r51214  
    3636
    3737UIWizardNewVM::UIWizardNewVM(QWidget *pParent, const QString &strGroup /* = QString() */)
    38     : UIWizard(pParent, UIWizardType_NewVM)
     38    : UIWizard(pParent, WizardType_NewVM)
    3939    , m_strGroup(strGroup)
    4040    , m_iIDECount(0)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette