VirtualBox

Changeset 85434 in vbox


Ignore:
Timestamp:
Jul 23, 2020 1:33:01 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9686, bugref:9510: A bit of cleanup for Performance Monitor stuff.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp

    r85426 r85434  
    22482248        setStatusTip(QApplication::translate("UIActionPool", "Show the properties of currently selected file object(s)"));
    22492249        setToolTip(  QApplication::translate("UIActionPool", "Show Properties of Current Object(s)")
    2250                    + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
    2251     }
    2252 };
    2253 
    2254 /** Menu action extension, used as 'Performance' menu class. */
    2255 class UIActionMenuPerformanceMonitor : public UIActionMenu
    2256 {
    2257     Q_OBJECT;
    2258 
    2259 public:
    2260 
    2261     /** Constructs action passing @a pParent to the base-class. */
    2262     UIActionMenuPerformanceMonitor(UIActionPool *pParent)
    2263         : UIActionMenu(pParent)
    2264     {}
    2265 
    2266 protected:
    2267 
    2268     /** Returns shortcut extra-data ID. */
    2269     virtual QString shortcutExtraDataID() const /* override */
    2270     {
    2271         return QString("PerformanceMonitorMenu");
    2272     }
    2273 
    2274     /** Handles translation event. */
    2275     virtual void retranslateUi() /* override */
    2276     {
    2277         setName(QApplication::translate("UIActionPool", "Performance"));
    2278     }
    2279 };
    2280 
    2281 /** Simple action extension, used as 'Export' action class. */
    2282 class UIActionMenuPerformanceMonitorExport : public UIActionSimple
    2283 {
    2284     Q_OBJECT;
    2285 
    2286 public:
    2287 
    2288     /** Constructs action passing @a pParent to the base-class. */
    2289     UIActionMenuPerformanceMonitorExport(UIActionPool *pParent)
    2290         : UIActionSimple(pParent,
    2291                          ":/log_viewer_save_32px.png", ":/log_viewer_save_16px.png",
    2292                          ":/log_viewer_save_disabled_32px.png", ":/log_viewer_save_disabled_16px.png")
    2293     {
    2294         setShortcutContext(Qt::WidgetWithChildrenShortcut);
    2295     }
    2296 
    2297 protected:
    2298 
    2299     /** Returns shortcut extra-data ID. */
    2300     virtual QString shortcutExtraDataID() const /* override */
    2301     {
    2302         return QString("ExportCharts");
    2303     }
    2304 
    2305     /** Returns default shortcut. */
    2306     virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
    2307     {
    2308         return QKeySequence();
    2309     }
    2310 
    2311     /** Handles translation event. */
    2312     virtual void retranslateUi() /* override */
    2313     {
    2314         setName(QApplication::translate("UIActionPool", "Export..."));
    2315         setShortcutScope(QApplication::translate("UIActionPool", "Performance Monitor"));
    2316         setStatusTip(QApplication::translate("UIActionPool", "Export the chart data into a text file"));
    2317         setToolTip(  QApplication::translate("UIActionPool", "Export the chart data into a text file")
    23182250                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
    23192251    }
     
    25692501    m_pool[UIActionIndex_M_FileManager_S_Guest_ShowProperties] = new UIActionMenuFileManagerShowProperties(this);
    25702502
    2571     /* Create 'Performance Monitor' actions: */
    2572     m_pool[UIActionIndex_M_PerformanceMonitor] = new UIActionMenuPerformanceMonitor(this);
    2573     m_pool[UIActionIndex_M_PerformanceMonitor_S_Export] = new UIActionMenuPerformanceMonitorExport(this);
    2574 
    2575 
    25762503    /* Prepare update-handlers for known menus: */
    25772504#ifdef VBOX_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r85426 r85434  
    136136    UIActionIndex_M_FileManager_S_Guest_ShowProperties,
    137137
    138     /* Machine performance monitor actions. */
    139     UIActionIndex_M_PerformanceMonitor,
    140     UIActionIndex_M_PerformanceMonitor_S_Export,
    141 
    142 
    143138    /* Maximum index: */
    144139    UIActionIndex_Max
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp

    r85426 r85434  
    17271727
    17281728/** Simple action extension, used as 'Show Performance Monitor' action class. */
    1729 class UIActionToggleSelectorToolsMachineShowPerformanceMonitor : public UIActionToggle
    1730 {
    1731     Q_OBJECT;
    1732 
    1733 public:
    1734 
    1735     /** Constructs action passing @a pParent to the base-class. */
    1736     UIActionToggleSelectorToolsMachineShowPerformanceMonitor(UIActionPool *pParent)
     1729class UIActionToggleSelectorToolsMachineShowPerformance : public UIActionToggle
     1730{
     1731    Q_OBJECT;
     1732
     1733public:
     1734
     1735    /** Constructs action passing @a pParent to the base-class. */
     1736    UIActionToggleSelectorToolsMachineShowPerformance(UIActionPool *pParent)
    17371737        : UIActionToggle(pParent)
    17381738    {
     
    17541754    virtual void retranslateUi() /* override */
    17551755    {
    1756         setName(QApplication::translate("UIActionPool", "&PerformanceMonitor"));
    1757         setStatusTip(QApplication::translate("UIActionPool", "Open the machine performance monitor pane"));
     1756        setName(QApplication::translate("UIActionPool", "&Performance"));
     1757        setStatusTip(QApplication::translate("UIActionPool", "Open the machine performance pane"));
    17581758    }
    17591759};
     
    21362136        setStatusTip(QApplication::translate("UIActionPool", "Clone selected virtual machine"));
    21372137        setToolTip(  QApplication::translate("UIActionPool", "Clone Virtual Machine")
     2138                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2139    }
     2140};
     2141
     2142
     2143/** Menu action extension, used as 'Performance' menu class. */
     2144class UIActionMenuSelectorPerformance : public UIActionMenu
     2145{
     2146    Q_OBJECT;
     2147
     2148public:
     2149
     2150    /** Constructs action passing @a pParent to the base-class. */
     2151    UIActionMenuSelectorPerformance(UIActionPool *pParent)
     2152        : UIActionMenu(pParent)
     2153    {}
     2154
     2155protected:
     2156
     2157    /** Returns shortcut extra-data ID. */
     2158    virtual QString shortcutExtraDataID() const /* override */
     2159    {
     2160        return QString("PerformanceMenu");
     2161    }
     2162
     2163    /** Handles translation event. */
     2164    virtual void retranslateUi() /* override */
     2165    {
     2166        setName(QApplication::translate("UIActionPool", "&Performance"));
     2167    }
     2168};
     2169
     2170/** Simple action extension, used as 'Export' action class. */
     2171class UIActionMenuSelectorPerformanceExport : public UIActionSimple
     2172{
     2173    Q_OBJECT;
     2174
     2175public:
     2176
     2177    /** Constructs action passing @a pParent to the base-class. */
     2178    UIActionMenuSelectorPerformanceExport(UIActionPool *pParent)
     2179        : UIActionSimple(pParent,
     2180                         ":/log_viewer_save_32px.png", ":/log_viewer_save_16px.png",
     2181                         ":/log_viewer_save_disabled_32px.png", ":/log_viewer_save_disabled_16px.png")
     2182    {
     2183        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2184    }
     2185
     2186protected:
     2187
     2188    /** Returns shortcut extra-data ID. */
     2189    virtual QString shortcutExtraDataID() const /* override */
     2190    {
     2191        return QString("ExportCharts");
     2192    }
     2193
     2194    /** Handles translation event. */
     2195    virtual void retranslateUi() /* override */
     2196    {
     2197        setName(QApplication::translate("UIActionPool", "&Export..."));
     2198        setShortcutScope(QApplication::translate("UIActionPool", "Performance Monitor"));
     2199        setStatusTip(QApplication::translate("UIActionPool", "Export the chart data into a text file"));
     2200        setToolTip(  QApplication::translate("UIActionPool", "Export Data to File")
    21382201                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
    21392202    }
     
    33663429    m_pool[UIActionIndexST_M_Group_M_Tools_T_Snapshots] = new UIActionToggleSelectorToolsMachineShowSnapshots(this);
    33673430    m_pool[UIActionIndexST_M_Group_M_Tools_T_Logs] = new UIActionToggleSelectorToolsMachineShowLogs(this);
     3431    m_pool[UIActionIndexST_M_Group_M_Tools_T_Performance] = new UIActionToggleSelectorToolsMachineShowPerformance(this);
    33683432    m_pool[UIActionIndexST_M_Group_S_Discard] = new UIActionSimpleSelectorCommonPerformDiscard(this);
    33693433    m_pool[UIActionIndexST_M_Group_S_ShowLogDialog] = new UIActionSimpleSelectorCommonShowMachineLogs(this);
     
    34063470    m_pool[UIActionIndexST_M_Machine_M_Tools_T_Snapshots] = new UIActionToggleSelectorToolsMachineShowSnapshots(this);
    34073471    m_pool[UIActionIndexST_M_Machine_M_Tools_T_Logs] = new UIActionToggleSelectorToolsMachineShowLogs(this);
    3408     m_pool[UIActionIndexST_M_Machine_M_Tools_T_PerformanceMonitor] = new UIActionToggleSelectorToolsMachineShowPerformanceMonitor(this);
     3472    m_pool[UIActionIndexST_M_Machine_M_Tools_T_Performance] = new UIActionToggleSelectorToolsMachineShowPerformance(this);
    34093473    m_pool[UIActionIndexST_M_Machine_S_Discard] = new UIActionSimpleSelectorCommonPerformDiscard(this);
    34103474    m_pool[UIActionIndexST_M_Machine_S_ShowLogDialog] = new UIActionSimpleSelectorCommonShowMachineLogs(this);
     
    34293493    m_pool[UIActionIndexST_M_Snapshot_T_Properties] = new UIActionMenuSelectorSnapshotToggleProperties(this);
    34303494    m_pool[UIActionIndexST_M_Snapshot_S_Clone] = new UIActionMenuSelectorSnapshotPerformClone(this);
     3495
     3496    /* Performance Monitor actions: */
     3497    m_pool[UIActionIndex_M_Performance] = new UIActionMenuSelectorPerformance(this);
     3498    m_pool[UIActionIndex_M_Performance_S_Export] = new UIActionMenuSelectorPerformanceExport(this);
    34313499
    34323500    /* Virtual Medium Manager actions: */
     
    34793547    m_groupPool[UIActionIndexST_M_Group_M_Tools]->addAction(m_pool.value(UIActionIndexST_M_Group_M_Tools_T_Snapshots));
    34803548    m_groupPool[UIActionIndexST_M_Group_M_Tools]->addAction(m_pool.value(UIActionIndexST_M_Group_M_Tools_T_Logs));
     3549    m_groupPool[UIActionIndexST_M_Group_M_Tools]->addAction(m_pool.value(UIActionIndexST_M_Group_M_Tools_T_Performance));
    34813550
    34823551    /* 'Machine' action groups: */
     
    34853554    m_groupPool[UIActionIndexST_M_Machine_M_Tools]->addAction(m_pool.value(UIActionIndexST_M_Machine_M_Tools_T_Snapshots));
    34863555    m_groupPool[UIActionIndexST_M_Machine_M_Tools]->addAction(m_pool.value(UIActionIndexST_M_Machine_M_Tools_T_Logs));
    3487     m_groupPool[UIActionIndexST_M_Machine_M_Tools]->addAction(m_pool.value(UIActionIndexST_M_Machine_M_Tools_T_PerformanceMonitor));
     3556    m_groupPool[UIActionIndexST_M_Machine_M_Tools]->addAction(m_pool.value(UIActionIndexST_M_Machine_M_Tools_T_Performance));
    34883557
    34893558    /* Prepare update-handlers for known menus: */
     
    35993668    updateMenuLogViewerWindow();
    36003669    updateMenuLogViewer();
    3601     /* 'Performance' Menu: */
    3602     addMenu(m_mainMenus, action(UIActionIndex_M_PerformanceMonitor));
     3670    /* 'Performance' menu: */
     3671    addMenu(m_mainMenus, action(UIActionIndex_M_Performance));
    36033672    updateMenuPerformanceMonitor();
    36043673
     
    38723941    pMenu->addAction(action(UIActionIndexST_M_Group_M_Tools_T_Snapshots));
    38733942    pMenu->addAction(action(UIActionIndexST_M_Group_M_Tools_T_Logs));
     3943    pMenu->addAction(action(UIActionIndexST_M_Group_M_Tools_T_Performance));
    38743944
    38753945    /* Mark menu as valid: */
     
    38893959    pMenu->addAction(action(UIActionIndexST_M_Machine_M_Tools_T_Snapshots));
    38903960    pMenu->addAction(action(UIActionIndexST_M_Machine_M_Tools_T_Logs));
    3891     pMenu->addAction(action(UIActionIndexST_M_Machine_M_Tools_T_PerformanceMonitor));
     3961    pMenu->addAction(action(UIActionIndexST_M_Machine_M_Tools_T_Performance));
    38923962
    38933963    /* Mark menu as valid: */
     
    41564226{
    41574227    /* Get corresponding menu: */
    4158     UIMenu *pMenu = action(UIActionIndex_M_PerformanceMonitor)->menu();
     4228    UIMenu *pMenu = action(UIActionIndex_M_Performance)->menu();
    41594229    AssertPtrReturnVoid(pMenu);
    41604230    /* Clear contents: */
    41614231    pMenu->clear();
    41624232
    4163     /* Populate Snapshot-menu: */
    4164     pMenu->addAction(action(UIActionIndex_M_PerformanceMonitor_S_Export));
     4233    /* Populate Performance-menu: */
     4234    pMenu->addAction(action(UIActionIndex_M_Performance_S_Export));
    41654235
    41664236    /* Mark menu as valid: */
    4167     m_invalidations.remove(UIActionIndexST_M_Snapshot);
     4237    m_invalidations.remove(UIActionIndex_M_Performance);
    41684238}
    41694239
     
    42194289                    << action(UIActionIndexST_M_Group_M_Tools_T_Details)
    42204290                    << action(UIActionIndexST_M_Group_M_Tools_T_Snapshots)
    4221                     << action(UIActionIndexST_M_Group_M_Tools_T_Logs);
     4291                    << action(UIActionIndexST_M_Group_M_Tools_T_Logs)
     4292                    << action(UIActionIndexST_M_Group_M_Tools_T_Performance);
    42224293            break;
    42234294        }
     
    42574328                    << action(UIActionIndexST_M_Machine_M_Tools_T_Snapshots)
    42584329                    << action(UIActionIndexST_M_Machine_M_Tools_T_Logs)
    4259                     << action(UIActionIndexST_M_Machine_M_Tools_T_PerformanceMonitor);
     4330                    << action(UIActionIndexST_M_Machine_M_Tools_T_Performance);
    42604331            break;
    42614332        }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h

    r85426 r85434  
    8383    UIActionIndexST_M_Group_M_Tools_T_Snapshots,
    8484    UIActionIndexST_M_Group_M_Tools_T_Logs,
     85    UIActionIndexST_M_Group_M_Tools_T_Performance,
    8586    UIActionIndexST_M_Group_S_Discard,
    8687    UIActionIndexST_M_Group_S_ShowLogDialog,
     
    122123    UIActionIndexST_M_Machine_M_Tools_T_Snapshots,
    123124    UIActionIndexST_M_Machine_M_Tools_T_Logs,
    124     UIActionIndexST_M_Machine_M_Tools_T_PerformanceMonitor,
     125    UIActionIndexST_M_Machine_M_Tools_T_Performance,
    125126    UIActionIndexST_M_Machine_S_Discard,
    126127    UIActionIndexST_M_Machine_S_ShowLogDialog,
     
    145146    UIActionIndexST_M_Snapshot_T_Properties,
    146147    UIActionIndexST_M_Snapshot_S_Clone,
     148
     149    /* Performance Monitor actions: */
     150    UIActionIndex_M_Performance,
     151    UIActionIndex_M_Performance_S_Export,
    147152
    148153    /* Virtual Media Manager actions: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r85426 r85434  
    27872787                                     m_pWidget->currentMachineTool() == UIToolType_Logs;
    27882788    actionPool()->action(UIActionIndex_M_Log)->setVisible(fLogViewerMenuShown);
    2789 
    2790     const bool fPerformanceMenuShown = fMachineMenuShown &&
    2791         m_pWidget->currentMachineTool() == UIToolType_Performance;
    2792     actionPool()->action(UIActionIndex_M_PerformanceMonitor)->setVisible(fPerformanceMenuShown);
     2789    /* Determine whether Performance menu should be visible: */
     2790    const bool fPerformanceMenuShown = (fMachineMenuShown || fGroupMenuShown) &&
     2791                                       m_pWidget->currentMachineTool() == UIToolType_Performance;
     2792    actionPool()->action(UIActionIndex_M_Performance)->setVisible(fPerformanceMenuShown);
    27932793
    27942794    /* Hide action shortcuts: */
     
    29812981            case UIToolType_Performance:
    29822982            {
    2983                 actionPool()->action(UIActionIndexST_M_Machine_M_Tools_T_PerformanceMonitor)->setChecked(true);
     2983                actionPool()->action(UIActionIndexST_M_Group_M_Tools_T_Performance)->setChecked(true);
     2984                actionPool()->action(UIActionIndexST_M_Machine_M_Tools_T_Performance)->setChecked(true);
    29842985                break;
    29852986            }
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r85426 r85434  
    830830                case UIToolType_Performance:
    831831                {
    832                     m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_PerformanceMonitor_S_Export));
     832                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Performance_S_Export));
    833833                    m_pToolBar->addSeparator();
    834834                    m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings));
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