VirtualBox

Changeset 58689 in vbox for trunk


Ignore:
Timestamp:
Nov 13, 2015 3:19:03 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: ​​bugref:8088: Rework session-information window: Extra-Data Manager: Adding extra-data support for saving/loading information-window elements.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/extradata
Files:
4 edited

Legend:

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

    r58674 r58689  
    147147/* Virtual Machine: Information dialog: */
    148148const char* UIExtraDataDefs::GUI_InformationWindowGeometry = "GUI/InformationWindowGeometry";
     149const char* UIExtraDataDefs::GUI_InformationWindowElements = "GUI/InformationWindowElements";
    149150
    150151/* Virtual Machine: Close dialog: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r58686 r58689  
    256256        /** Holds information-window geometry. */
    257257        extern const char* GUI_InformationWindowGeometry;
     258        /** Holds information-window elements. */
     259        extern const char* GUI_InformationWindowElements;
    258260    /** @} */
    259261
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r58674 r58689  
    18821882           << GUI_ScaleFactor << GUI_Scaling_Optimization
    18831883           << GUI_InformationWindowGeometry
     1884           << GUI_InformationWindowElements
    18841885           << GUI_DefaultCloseAction << GUI_RestrictedCloseActions
    18851886           << GUI_LastCloseAction << GUI_CloseActionHook
     
    35613562}
    35623563
     3564QMap<InformationElementType, bool> UIExtraDataManager::informationWindowElements()
     3565{
     3566    /* Get corresponding extra-data: */
     3567    const QStringList data = extraDataStringList(GUI_InformationWindowElements);
     3568
     3569    /* Desearialize passed elements: */
     3570    QMap<InformationElementType, bool> elements;
     3571    foreach (QString strItem, data)
     3572    {
     3573        bool fOpened = true;
     3574        if (strItem.endsWith("Closed", Qt::CaseInsensitive))
     3575        {
     3576            fOpened = false;
     3577            strItem.remove("Closed");
     3578        }
     3579        InformationElementType type = gpConverter->fromInternalString<InformationElementType>(strItem);
     3580        if (type != InformationElementType_Invalid)
     3581            elements[type] = fOpened;
     3582    }
     3583
     3584    /* Return elements: */
     3585    return elements;
     3586}
     3587
     3588void UIExtraDataManager::setInformationWindowElements(const QMap<InformationElementType, bool> &elements)
     3589{
     3590    /* Prepare corresponding extra-data: */
     3591    QStringList data;
     3592
     3593    /* Searialize passed elements: */
     3594    foreach (InformationElementType type, elements.keys())
     3595    {
     3596        QString strValue = gpConverter->toInternalString(type);
     3597        if (!elements[type])
     3598            strValue += "Closed";
     3599        data << strValue;
     3600    }
     3601
     3602    /* Re-cache corresponding extra-data: */
     3603    setExtraDataStringList(GUI_InformationWindowElements, data);
     3604}
     3605
    35633606MachineCloseAction UIExtraDataManager::defaultMachineCloseAction(const QString &strID)
    35643607{
     
    37243767    /* Parse loaded data: */
    37253768    int iX = 0, iY = 0, iW = 0, iH = 0;
    3726     bool fOk = data.size() >= 4;   
     3769    bool fOk = data.size() >= 4;
    37273770    do
    37283771    {
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r58674 r58689  
    498498        /** Defines information-window @a geometry and @a fMaximized state. */
    499499        void setInformationWindowGeometry(const QRect &geometry, bool fMaximized, const QString &strID);
     500
     501        /** Returns information-window elements. */
     502        QMap<InformationElementType, bool> informationWindowElements();
     503        /** Defines information-window @a elements. */
     504        void setInformationWindowElements(const QMap<InformationElementType, bool> &elements);
    500505    /** @} */
    501506
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