VirtualBox

Ignore:
Timestamp:
May 8, 2014 12:56:38 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: 6660: Advanced extra-data management framework: Integrate GUI_HideDescriptionForWizards.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r51209 r51213  
    241241#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    242242
     243bool UIExtraDataManager::isDescriptionHiddenForWizard(const QString &strWizardName)
     244{
     245    /* True if wizard-name among the others: */
     246    return extraDataStringList(GUI_HideDescriptionForWizards).contains(strWizardName);
     247}
     248
     249void UIExtraDataManager::setDescriptionHiddenForWizard(const QString &strWizardName, bool fHidden)
     250{
     251    /* Get current value: */
     252    QStringList oldValue = extraDataStringList(GUI_HideDescriptionForWizards);
     253    QStringList newValue = oldValue;
     254    /* Include wizard-name if necessary: */
     255    if (fHidden && !newValue.contains(strWizardName))
     256        newValue << strWizardName;
     257    /* Exclude wizard-name if necessary: */
     258    else if (!fHidden && newValue.contains(strWizardName))
     259        newValue.removeAll(strWizardName);
     260    /* Update extra-data if necessary: */
     261    if (newValue != oldValue)
     262        setExtraDataStringList(GUI_HideDescriptionForWizards, newValue);
     263}
     264
    243265bool UIExtraDataManager::isFirstRun(const QString &strId) const
    244266{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51209 r51213  
    114114    bool shouldWeAllowApplicationUpdate() const;
    115115#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
     116
     117    /** Returns whether description should be hidden for wizard @a strWizardName. */
     118    bool isDescriptionHiddenForWizard(const QString &strWizardName);
     119    /** Defines whether description should be @a fHidden for wizard @a strWizardName. */
     120    void setDescriptionHiddenForWizard(const QString &strWizardName, bool fHidden);
    116121
    117122    /** Returns whether this machine started for the first time. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.cpp

    r45060 r51213  
    2828#include "VBoxGlobal.h"
    2929#include "QIRichTextLabel.h"
     30#include "UIExtraDataManager.h"
    3031
    3132void UIWizard::sltCurrentIdChanged(int iId)
     
    5152        cleanup();
    5253
    53         /* Compose wizard's name: */
    54         QString strWizardName = nameForType(m_type);
    55         /* Load mode settings: */
    56         QStringList wizards = vboxGlobal().virtualBox().GetExtraDataStringList(GUI_HideDescriptionForWizards);
    57 
    5854        /* Switch mode: */
    5955        switch (m_mode)
    6056        {
    61             case UIWizardMode_Basic:
    62             {
    63                 m_mode = UIWizardMode_Expert;
    64                 if (!wizards.contains(strWizardName))
    65                     wizards << strWizardName;
    66                 break;
    67             }
    68             case UIWizardMode_Expert:
    69             {
    70                 m_mode = UIWizardMode_Basic;
    71                 if (wizards.contains(strWizardName))
    72                     wizards.removeAll(strWizardName);
    73                 break;
    74             }
    75             default:
    76             {
    77                 AssertMsgFailed(("Invalid mode: %d", m_mode));
    78                 break;
    79             }
     57            case UIWizardMode_Basic:  m_mode = UIWizardMode_Expert; break;
     58            case UIWizardMode_Expert: m_mode = UIWizardMode_Basic;  break;
     59            default: AssertMsgFailed(("Invalid mode: %d", m_mode)); break;
    8060        }
    8161
    8262        /* Save mode settings: */
    83         vboxGlobal().virtualBox().SetExtraDataStringList(GUI_HideDescriptionForWizards, wizards);
     63        gEDataManager->setDescriptionHiddenForWizard(nameForType(m_type), m_mode == UIWizardMode_Expert);
    8464
    8565        /* Prepare: */
     
    547527    if (type == UIWizardType_FirstRun)
    548528        return UIWizardMode_Basic;
    549     /* Get mode from extra-data: */
    550     QStringList wizards = vboxGlobal().virtualBox().GetExtraDataStringList(GUI_HideDescriptionForWizards);
    551     if (wizards.contains(nameForType(type)))
    552         return UIWizardMode_Expert;
    553     /* Return mode: */
    554     return UIWizardMode_Basic;
    555 }
    556 
     529    /* Otherwise get mode from extra-data manager: */
     530    return gEDataManager->isDescriptionHiddenForWizard(nameForType(type))
     531           ? UIWizardMode_Expert : UIWizardMode_Basic;
     532}
     533
Note: See TracChangeset for help on using the changeset viewer.

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