VirtualBox

Changeset 88585 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 19, 2021 4:35:03 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161: A bit of rework for Chooser pane; Much more selective definition saving policy, saves only changed and removes only excessive values.

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

Legend:

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

    r88411 r88585  
    27882788}
    27892789
    2790 void UIExtraDataManager::clearSelectorWindowGroupsDefinitions()
    2791 {
    2792     /* Wipe-out each the group definition record: */
     2790QStringList UIExtraDataManager::knownMachineGroupDefinitionKeys()
     2791{
     2792    /* Acquire a list of known group definition keys: */
     2793    QStringList result;
    27932794    foreach (const QString &strKey, m_data.value(GlobalID).keys())
    27942795        if (strKey.startsWith(GUI_GroupDefinitions))
    2795             setExtraDataString(strKey, QString());
    2796 }
    2797 
    2798 QStringList UIExtraDataManager::selectorWindowGroupsDefinitions(const QString &strGroupID)
     2796        {
     2797            QString strGroupID = strKey;
     2798            strGroupID.remove(GUI_GroupDefinitions);
     2799            result << strGroupID;
     2800        }
     2801
     2802    /* Return result: */
     2803    return result;
     2804}
     2805
     2806QStringList UIExtraDataManager::machineGroupDefinitions(const QString &strGroupID)
    27992807{
    28002808    return extraDataStringList(GUI_GroupDefinitions + strGroupID);
    28012809}
    28022810
    2803 void UIExtraDataManager::setSelectorWindowGroupsDefinitions(const QString &strGroupID, const QStringList &definitions)
     2811void UIExtraDataManager::setMachineGroupDefinitions(const QString &strGroupID, const QStringList &definitions)
    28042812{
    28052813    setExtraDataStringList(GUI_GroupDefinitions + strGroupID, definitions);
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r88411 r88585  
    344344        void setSelectorWindowStatusBarVisible(bool fVisible);
    345345
    346         /** Clears all the existing selector-window chooser-pane' group definitions. */
    347         void clearSelectorWindowGroupsDefinitions();
    348         /** Returns selector-window chooser-pane' groups definitions for passed @a strGroupID. */
    349         QStringList selectorWindowGroupsDefinitions(const QString &strGroupID);
    350         /** Defines selector-window chooser-pane' groups @a definitions for passed @a strGroupID. */
    351         void setSelectorWindowGroupsDefinitions(const QString &strGroupID, const QStringList &definitions);
     346        /** Returns all the existing selector-window chooser-pane' group definition keys. */
     347        QStringList knownMachineGroupDefinitionKeys();
     348        /** Returns selector-window chooser-pane' group definitions for passed @a strGroupID. */
     349        QStringList machineGroupDefinitions(const QString &strGroupID);
     350        /** Defines selector-window chooser-pane' group @a definitions for passed @a strGroupID. */
     351        void setMachineGroupDefinitions(const QString &strGroupID, const QStringList &definitions);
    352352
    353353        /** Returns last-item ID of the item chosen in selector-window chooser-pane. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r86910 r88585  
    334334    COMBase::InitializeCOM(false);
    335335
    336     /* Clear all the extra-data records related to group definitions: */
    337     gEDataManager->clearSelectorWindowGroupsDefinitions();
    338     /* For every particular group definition: */
     336    /* Acquire a list of known group definition keys: */
     337    QStringList knownKeys = gEDataManager->knownMachineGroupDefinitionKeys();
     338    /* For every group definition to be saved: */
    339339    foreach (const QString &strId, m_lists.keys())
    340         gEDataManager->setSelectorWindowGroupsDefinitions(strId, m_lists.value(strId));
     340    {
     341        /* Save definition only if there is a change: */
     342        if (gEDataManager->machineGroupDefinitions(strId) != m_lists.value(strId))
     343            gEDataManager->setMachineGroupDefinitions(strId, m_lists.value(strId));
     344        /* Remove it from known keys: */
     345        knownKeys.removeAll(strId);
     346    }
     347    /* Wipe out rest of known group definitions: */
     348    foreach (const QString strId, knownKeys)
     349        gEDataManager->setMachineGroupDefinitions(strId, QStringList());
    341350
    342351    /* Notify listeners about completeness: */
     
    13971406{
    13981407    /* Read group definitions: */
    1399     const QStringList definitions = gEDataManager->selectorWindowGroupsDefinitions(pParentNode->fullName());
     1408    const QStringList definitions = gEDataManager->machineGroupDefinitions(pParentNode->fullName());
    14001409    /* Return 'false' if no definitions found: */
    14011410    if (definitions.isEmpty())
     
    14271436{
    14281437    /* Read group definitions: */
    1429     const QStringList definitions = gEDataManager->selectorWindowGroupsDefinitions(pParentNode->fullName());
     1438    const QStringList definitions = gEDataManager->machineGroupDefinitions(pParentNode->fullName());
    14301439    /* Return 'false' if no definitions found: */
    14311440    if (definitions.isEmpty())
     
    15481557{
    15491558    /* Read group definitions: */
    1550     const QStringList definitions = gEDataManager->selectorWindowGroupsDefinitions(pParentNode->fullName());
     1559    const QStringList definitions = gEDataManager->machineGroupDefinitions(pParentNode->fullName());
    15511560    /* Return 'false' if no definitions found: */
    15521561    if (definitions.isEmpty())
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