VirtualBox

Ignore:
Timestamp:
Jul 1, 2014 1:11:22 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Selector UI: Details-pane: Load/Save settings as part of prepare/cleanup logic only.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.cpp

    r51532 r51768  
    6666void UIGDetailsGroup::rebuildGroup()
    6767{
    68     /* Load settings: */
    69     loadSettings();
    70 
    7168    /* Cleanup build-step: */
    7269    delete m_pBuildStep;
     
    111108
    112109        /* Build set: */
    113         pSet->buildSet(m_machineItems[iStepNumber], m_machineItems.size() == 1, m_settings);
     110        pSet->buildSet(m_machineItems[iStepNumber], m_machineItems.size() == 1, model()->settings());
    114111    }
    115112    else
     
    191188    connect(this, SIGNAL(sigMinimumHeightHintChanged(int)),
    192189            model(), SIGNAL(sigRootItemMinimumHeightHintChanged(int)));
    193 }
    194 
    195 void UIGDetailsGroup::loadSettings()
    196 {
    197     /* Load settings: */
    198     m_settings = gEDataManager->selectorWindowDetailsElements();
    199     /* If settings are empty: */
    200     if (m_settings.isEmpty())
    201     {
    202         /* Propose the defaults: */
    203         m_settings[DetailsElementType_General] = true;
    204         m_settings[DetailsElementType_Preview] = true;
    205         m_settings[DetailsElementType_System] = true;
    206         m_settings[DetailsElementType_Display] = true;
    207         m_settings[DetailsElementType_Storage] = true;
    208         m_settings[DetailsElementType_Audio] = true;
    209         m_settings[DetailsElementType_Network] = true;
    210         m_settings[DetailsElementType_USB] = true;
    211         m_settings[DetailsElementType_SF] = true;
    212         m_settings[DetailsElementType_Description] = true;
    213         gEDataManager->setSelectorWindowDetailsElements(m_settings);
    214     }
    215190}
    216191
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.h

    r51532 r51768  
    2222/* GUI includes: */
    2323#include "UIGDetailsItem.h"
    24 #include "UIExtraDataDefs.h"
    2524
    2625/* Forward declarations: */
     
    8281    /* Helpers: Prepare stuff: */
    8382    void prepareConnections();
    84     void loadSettings();
    8583
    8684    /* Helpers: Layout stuff: */
     
    9795    UIBuildStep *m_pBuildStep;
    9896    QString m_strGroupId;
    99     QMap<DetailsElementType, bool> m_settings;
    10097
    10198    /* Friends: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.cpp

    r51532 r51768  
    4343    prepareRoot();
    4444
     45    /* Load settings: */
     46    loadSettings();
     47
    4548    /* Register meta-type: */
    4649    qRegisterMetaType<DetailsElementType>();
     
    4952UIGDetailsModel::~UIGDetailsModel()
    5053{
     54    /* Save settings: */
     55    saveSettings();
     56
    5157    /* Cleanup root: */
    5258    cleanupRoot();
     
    157163    updateLayout();
    158164
    159     /* Load elements settings to modify: */
    160     QMap<DetailsElementType, bool> settings = gEDataManager->selectorWindowDetailsElements();
    161     /* If setting for corresponding element type exists: */
    162     if (settings.contains(type))
    163     {
    164         /* Update element open/close status: */
    165         settings[type] = fToggled;
    166         /* Save elements settings back: */
    167         gEDataManager->setSelectorWindowDetailsElements(settings);
    168     }
     165    /* Update element open/close status: */
     166    if (m_settings.contains(type))
     167        m_settings[type] = fToggled;
    169168}
    170169
     
    175174    DetailsElementType type = pAction->data().value<DetailsElementType>();
    176175
    177     /* Load elements settings to modify: */
    178     QMap<DetailsElementType, bool> settings = gEDataManager->selectorWindowDetailsElements();
    179     /* Toggle element visibility setting: */
    180     if (settings.contains(type))
    181         settings.remove(type);
     176    /* Toggle element visibility status: */
     177    if (m_settings.contains(type))
     178        m_settings.remove(type);
    182179    else
    183         settings[type] = true;
    184     /* Save elements settings back: */
    185     gEDataManager->setSelectorWindowDetailsElements(settings);
     180        m_settings[type] = true;
    186181
    187182    /* Rebuild group: */
     
    223218{
    224219    m_pRoot = new UIGDetailsGroup(scene());
     220}
     221
     222void UIGDetailsModel::loadSettings()
     223{
     224    /* Load settings: */
     225    m_settings = gEDataManager->selectorWindowDetailsElements();
     226}
     227
     228void UIGDetailsModel::saveSettings()
     229{
     230    /* If settings are empty: */
     231    if (m_settings.isEmpty())
     232    {
     233        /* Propose the defaults: */
     234        m_settings[DetailsElementType_General] = true;
     235        m_settings[DetailsElementType_Preview] = true;
     236        m_settings[DetailsElementType_System] = true;
     237        m_settings[DetailsElementType_Display] = true;
     238        m_settings[DetailsElementType_Storage] = true;
     239        m_settings[DetailsElementType_Audio] = true;
     240        m_settings[DetailsElementType_Network] = true;
     241        m_settings[DetailsElementType_USB] = true;
     242        m_settings[DetailsElementType_SF] = true;
     243        m_settings[DetailsElementType_Description] = true;
     244    }
     245
     246    /* Save settings: */
     247    gEDataManager->setSelectorWindowDetailsElements(m_settings);
    225248}
    226249
     
    260283    /* Prepare context-menu: */
    261284    QMenu contextMenu;
    262     /* Load elements settings: */
    263     QMap<DetailsElementType, bool> settings = gEDataManager->selectorWindowDetailsElements();
     285    /* Enumerate elements settings: */
    264286    for (int iType = DetailsElementType_General; iType <= DetailsElementType_Description; ++iType)
    265287    {
     
    267289        QAction *pAction = contextMenu.addAction(gpConverter->toString(currentElementType), this, SLOT(sltElementTypeToggled()));
    268290        pAction->setCheckable(true);
    269         pAction->setChecked(settings.contains(currentElementType));
     291        pAction->setChecked(m_settings.contains(currentElementType));
    270292        pAction->setData(QVariant::fromValue(currentElementType));
    271293    }
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.h

    r51187 r51768  
    7373    void setItems(const QList<UIVMItem*> &items);
    7474
     75    /** Returns the details settings. */
     76    const QMap<DetailsElementType, bool>& settings() const { return m_settings; }
     77
    7578private slots:
    7679
     
    103106    void prepareScene();
    104107    void prepareRoot();
     108    void loadSettings();
    105109
    106110    /* Helpers: Cleanup stuff: */
     111    void saveSettings();
    107112    void cleanupRoot();
    108113    void cleanupScene();
     
    118123    UIGDetailsGroup *m_pRoot;
    119124    UIGDetailsElementAnimationCallback *m_pAnimationCallback;
     125    /** Holds the details settings. */
     126    QMap<DetailsElementType, bool> m_settings;
    120127};
    121128
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