VirtualBox

Changeset 83452 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 26, 2020 7:36:19 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9686. Saving the hidden column list to the extra data.

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

Legend:

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

    r82968 r83452  
    126126template<> SHARED_LIBRARY_STUFF bool canConvert<UIMediumFormat>();
    127127template<> SHARED_LIBRARY_STUFF bool canConvert<UISettingsDefs::RecordingMode>();
     128template<> SHARED_LIBRARY_STUFF bool canConvert<VMResouceMonitorColumn>();
    128129
    129130/* Declare COM canConvert specializations: */
     
    268269template<> SHARED_LIBRARY_STUFF QString toString(const UISettingsDefs::RecordingMode &enmRecordingMode);
    269270template<> SHARED_LIBRARY_STUFF UISettingsDefs::RecordingMode fromString<UISettingsDefs::RecordingMode>(const QString &enmRecordingMode);
     271template<> SHARED_LIBRARY_STUFF QString toInternalString(const VMResouceMonitorColumn &enmVMResourceMonitorColumn);
     272template<> SHARED_LIBRARY_STUFF VMResouceMonitorColumn fromInternalString<VMResouceMonitorColumn>(const QString &strVMResourceMonitorColumn);
    270273
    271274/* Declare COM conversion specializations: */
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r83314 r83452  
    8080template<> bool canConvert<UIMediumFormat>() { return true; }
    8181template<> bool canConvert<UISettingsDefs::RecordingMode>() { return true; }
     82template<> bool canConvert<VMResouceMonitorColumn>(){ return true; };
    8283
    8384
     
    25692570    return values.at(keys.indexOf(QRegExp(strRecordingMode, Qt::CaseInsensitive)));
    25702571}
     2572
     2573template<> QString toInternalString(const VMResouceMonitorColumn &enmVMResourceMonitorColumn)
     2574{
     2575    QString strResult;
     2576    switch (enmVMResourceMonitorColumn)
     2577    {
     2578        case VMResouceMonitorColumn_Name:              strResult = "VMName"; break;
     2579        case VMResouceMonitorColumn_CPUGuestLoad:      strResult = "CPUGuestLoad"; break;
     2580        case VMResouceMonitorColumn_CPUVMMLoad:        strResult = "CPUVMMLoad"; break;
     2581        case VMResouceMonitorColumn_RAMUsedAndTotal:   strResult = "RAMUsedAndTotal"; break;
     2582        case VMResouceMonitorColumn_RAMUsedPercentage: strResult = "RAMUsedPercentage"; break;
     2583        case VMResouceMonitorColumn_NetworkUpRate:     strResult = "NetworkUpRate"; break;
     2584        case VMResouceMonitorColumn_NetworkDownRate:   strResult = "NetworkDownRate"; break;
     2585        case VMResouceMonitorColumn_NetworkUpTotal:    strResult = "NetworkUpTotal"; break;
     2586        case VMResouceMonitorColumn_NetworkDownTotal:  strResult = "NetworkDownTotal"; break;
     2587        case VMResouceMonitorColumn_DiskIOReadRate:    strResult = "DiskIOReadRate"; break;
     2588        case VMResouceMonitorColumn_DiskIOWriteRate:   strResult = "DiskIOWriteRate"; break;
     2589        case VMResouceMonitorColumn_DiskIOReadTotal:   strResult = "DiskIOReadTotal"; break;
     2590        case VMResouceMonitorColumn_DiskIOWriteTotal:  strResult = "DiskIOWriteTotal"; break;
     2591        case VMResouceMonitorColumn_VMExits:           strResult = "VMExits"; break;
     2592        default:
     2593            {
     2594                AssertMsgFailed(("No text for VM Resource Monitor Column=%d", enmVMResourceMonitorColumn));
     2595                break;
     2596            }
     2597    }
     2598    return strResult;
     2599}
     2600
     2601template<> VMResouceMonitorColumn fromInternalString<VMResouceMonitorColumn>(const QString &strVMResourceMonitorColumn)
     2602{
     2603    QStringList keys;    QList<VMResouceMonitorColumn> values;
     2604    keys << "VMName";             values << VMResouceMonitorColumn_Name;
     2605    keys << "CPUGuestLoad";       values << VMResouceMonitorColumn_CPUGuestLoad;
     2606    keys << "CPUVMMLoad";         values << VMResouceMonitorColumn_CPUVMMLoad;
     2607    keys << "RAMUsedAndTotal";    values << VMResouceMonitorColumn_RAMUsedAndTotal;
     2608    keys << "RAMUsedPercentage";  values << VMResouceMonitorColumn_RAMUsedPercentage;
     2609    keys << "NetworkUpRate";      values << VMResouceMonitorColumn_NetworkUpRate;
     2610    keys << "NetworkDownRate";    values << VMResouceMonitorColumn_NetworkDownRate;
     2611    keys << "NetworkUpTotal";     values << VMResouceMonitorColumn_NetworkUpTotal;
     2612    keys << "NetworkDownTotal";   values << VMResouceMonitorColumn_NetworkDownTotal;
     2613    keys << "DiskIOReadRate";     values << VMResouceMonitorColumn_DiskIOReadRate;
     2614    keys << "DiskIOWriteRate";    values << VMResouceMonitorColumn_DiskIOWriteRate;
     2615    keys << "DiskIOReadTotal";    values << VMResouceMonitorColumn_DiskIOReadTotal;
     2616    keys << "DiskIOWriteTotal";   values << VMResouceMonitorColumn_DiskIOWriteTotal;
     2617    keys << "VMExits";            values << VMResouceMonitorColumn_VMExits;
     2618    if (!keys.contains(strVMResourceMonitorColumn, Qt::CaseInsensitive))
     2619        return VMResouceMonitorColumn_Max;
     2620    /* Corresponding format for known words: */
     2621    return values.at(keys.indexOf(QRegExp(strVMResourceMonitorColumn, Qt::CaseInsensitive)));
     2622}
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r83304 r83452  
    240240const char *UIExtraDataDefs::GUI_GuestControl_LogViewerVisiblePanels = "GUI/LogViewerVisiblePanels";
    241241
     242/* VM Resource Monitor: */
     243const char *UIExtraDataDefs::GUI_VMResourceManager_HiddenColumns = "GUI/VMResourceManagerHiddenColumns";
     244
    242245/* Obsolete keys: */
    243246QMap<QString, QString> UIExtraDataDefs::prepareObsoleteKeysMap()
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r83304 r83452  
    439439    /** @} */
    440440
     441    /** @name Manager UI: VM Resource Monitor Related stuff
     442      * @{ */
     443        SHARED_LIBRARY_STUFF extern const char *GUI_VMResourceManager_HiddenColumns;
     444    /** @} */
     445
    441446    /** @name Old key support stuff.
    442447      * @{ */
     
    10641069};
    10651070
     1071/** Manager UI: VM resource Monitor Column types.
     1072  * @note The first element must be 0 and the rest must be consecutive */
     1073enum VMResouceMonitorColumn
     1074{
     1075    VMResouceMonitorColumn_Name = 0,
     1076    VMResouceMonitorColumn_CPUGuestLoad,
     1077    VMResouceMonitorColumn_CPUVMMLoad,
     1078    VMResouceMonitorColumn_RAMUsedAndTotal,
     1079    VMResouceMonitorColumn_RAMUsedPercentage,
     1080    VMResouceMonitorColumn_NetworkUpRate,
     1081    VMResouceMonitorColumn_NetworkDownRate,
     1082    VMResouceMonitorColumn_NetworkUpTotal,
     1083    VMResouceMonitorColumn_NetworkDownTotal,
     1084    VMResouceMonitorColumn_DiskIOReadRate,
     1085    VMResouceMonitorColumn_DiskIOWriteRate,
     1086    VMResouceMonitorColumn_DiskIOReadTotal,
     1087    VMResouceMonitorColumn_DiskIOWriteTotal,
     1088    VMResouceMonitorColumn_VMExits,
     1089    VMResouceMonitorColumn_Max
     1090};
    10661091
    10671092#endif /* !FEQT_INCLUDED_SRC_extradata_UIExtraDataDefs_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r83367 r83452  
    45674567}
    45684568
     4569void UIExtraDataManager::setVMResourceMonitorHiddenColumnList(const QStringList &hiddenColumnList)
     4570{
     4571    setExtraDataStringList(GUI_VMResourceManager_HiddenColumns, hiddenColumnList);
     4572}
     4573
     4574QStringList UIExtraDataManager::VMResourceMonitorHiddenColumnList()
     4575{
     4576    return extraDataStringList(GUI_VMResourceManager_HiddenColumns);
     4577}
     4578
    45694579void UIExtraDataManager::sltExtraDataChange(const QUuid &uMachineID, const QString &strKey, const QString &strValue)
    45704580{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r82968 r83452  
    755755        void setLogViewerVisiblePanels(const QStringList &panelNameList);
    756756        QStringList logViewerVisiblePanels();
     757    /** @} */
     758
     759    /** @name Manager UI: VM Resource Monitor
     760      * @{ */
     761        void setVMResourceMonitorHiddenColumnList(const QStringList &hiddenColumnList);
     762        QStringList VMResourceMonitorHiddenColumnList();
    757763    /** @} */
    758764
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.cpp

    r83439 r83452  
    3232#include "UIActionPoolManager.h"
    3333#include "UICommon.h"
     34#include "UIConverter.h"
     35#include "UIExtraDataDefs.h"
    3436#include "UIExtraDataManager.h"
    3537#include "UIIconPool.h"
     
    5254/* Other VBox includes: */
    5355#include <iprt/cidr.h>
    54 
    55 /* The first element must be 0 and the rest must be consecutive: */
    56 enum VMResouceMonitorColumn
    57 {
    58     VMResouceMonitorColumn_Name = 0,
    59     VMResouceMonitorColumn_CPUGuestLoad,
    60     VMResouceMonitorColumn_CPUVMMLoad,
    61     VMResouceMonitorColumn_RAMUsedAndTotal,
    62     VMResouceMonitorColumn_RAMUsedPercentage,
    63     VMResouceMonitorColumn_NetworkUpRate,
    64     VMResouceMonitorColumn_NetworkDownRate,
    65     VMResouceMonitorColumn_NetworkUpTotal,
    66     VMResouceMonitorColumn_NetworkDownTotal,
    67     VMResouceMonitorColumn_DiskIOReadRate,
    68     VMResouceMonitorColumn_DiskIOWriteRate,
    69     VMResouceMonitorColumn_DiskIOReadTotal,
    70     VMResouceMonitorColumn_DiskIOWriteTotal,
    71     VMResouceMonitorColumn_VMExits,
    72     VMResouceMonitorColumn_Max
    73 };
    7456
    7557struct ResourceColumn
     
    635617}
    636618
     619UIResourceMonitorWidget::~UIResourceMonitorWidget()
     620{
     621    saveSettings();
     622}
     623
    637624QMenu *UIResourceMonitorWidget::menu() const
    638625{
     
    679666void UIResourceMonitorWidget::prepare()
    680667{
    681     m_columnShown.resize(VMResouceMonitorColumn_Max);
    682     for (int i = 0; i < m_columnShown.size(); ++i)
    683         m_columnShown[i] = true;
     668    loadHiddenColumnList();
    684669    prepareWidgets();
    685670    loadSettings();
     
    801786}
    802787
     788void UIResourceMonitorWidget::loadHiddenColumnList()
     789{
     790    QStringList hiddenColumnList = gEDataManager->VMResourceMonitorHiddenColumnList();
     791    m_columnShown.resize(VMResouceMonitorColumn_Max);
     792    for (int i = 0; i < m_columnShown.size(); ++i)
     793        m_columnShown[i] = true;
     794    foreach(const QString& strColumn, hiddenColumnList)
     795    {
     796        VMResouceMonitorColumn enmColumn = gpConverter->fromInternalString<VMResouceMonitorColumn>(strColumn);
     797        if ((int)enmColumn < m_columnShown.size())
     798            m_columnShown[(int)enmColumn] = false;
     799    }
     800}
     801
     802void UIResourceMonitorWidget::saveSettings()
     803{
     804    QStringList hiddenColumnList;
     805    for (int i = 0; i < m_columnShown.size(); ++i)
     806    {
     807        if (!m_columnShown[i])
     808            hiddenColumnList << gpConverter->toInternalString((VMResouceMonitorColumn) i);
     809    }
     810    gEDataManager->setVMResourceMonitorHiddenColumnList(hiddenColumnList);
     811}
     812
    803813void UIResourceMonitorWidget::sltToggleColumnSelectionMenu(bool fChecked)
    804814{
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.h

    r83439 r83452  
    5252    UIResourceMonitorWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    5353                               bool fShowToolbar = true, QWidget *pParent = 0);
     54    ~UIResourceMonitorWidget();
    5455
    5556    QMenu *menu() const;
     
    8586        void prepareActions();
    8687        void loadSettings();
     88        void loadHiddenColumnList();
     89        void saveSettings();
    8790    /** @} */
    8891
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