VirtualBox

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


Ignore:
Timestamp:
Dec 17, 2020 2:30:07 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9510. Adding a tool bar action to jump to Resources pane from machine Performance Monitor in the manager UI.

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

Legend:

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

    r87022 r87101  
    22642264};
    22652265
     2266/** Simple action extension, used as 'To Resources' action class. */
     2267class UIActionMenuSelectorPerformanceToResources : public UIActionSimple
     2268{
     2269    Q_OBJECT;
     2270
     2271public:
     2272
     2273    /** Constructs action passing @a pParent to the base-class. */
     2274    UIActionMenuSelectorPerformanceToResources(UIActionPool *pParent)
     2275        : UIActionSimple(pParent,
     2276                         ":/resources_monitor_24px.png", ":/resource_monitor_16px.png",
     2277                         ":/resource_monitor_disabled_24px.png", ":/resource_monitor_disabled_16px.png")
     2278    {
     2279        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2280    }
     2281
     2282protected:
     2283
     2284    /** Returns shortcut extra-data ID. */
     2285    virtual QString shortcutExtraDataID() const /* override */
     2286    {
     2287        return QString("ToResources");
     2288    }
     2289
     2290    /** Handles translation event. */
     2291    virtual void retranslateUi() /* override */
     2292    {
     2293        setName(QApplication::translate("UIActionPool", "&To Resurces..."));
     2294        setShortcutScope(QApplication::translate("UIActionPool", "Performance Monitor"));
     2295        setStatusTip(QApplication::translate("UIActionPool", "Navigate to the resources widget"));
     2296        setToolTip(  QApplication::translate("UIActionPool", "Navigate to Resources Widget")
     2297                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2298    }
     2299};
     2300
    22662301
    22672302/*********************************************************************************************************************************
     
    25092544    m_pool[UIActionIndex_M_Performance] = new UIActionMenuSelectorPerformance(this);
    25102545    m_pool[UIActionIndex_M_Performance_S_Export] = new UIActionMenuSelectorPerformancePerformExport(this);
     2546    m_pool[UIActionIndex_M_Performance_S_ToResources] = new UIActionMenuSelectorPerformanceToResources(this);
    25112547
    25122548    /* Create 'File Manager' actions: */
     
    29392975    /* 'Export' action: */
    29402976    pMenu->addAction(action(UIActionIndex_M_Performance_S_Export));
     2977    pMenu->addAction(action(UIActionIndex_M_Performance_S_ToResources));
    29412978
    29422979    /* Mark menu as valid: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r85661 r87101  
    101101    UIActionIndex_M_Performance,
    102102    UIActionIndex_M_Performance_S_Export,
     103    UIActionIndex_M_Performance_S_ToResources,
    103104
    104105    /* File Manager actions: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp

    r87022 r87101  
    208208                m_pLayout->setCurrentWidget(m_pPanePerformanceMonitor);
    209209
     210                connect(m_pPanePerformanceMonitor, &UIPerformanceMonitor::sigSwitchToResourcesPane,
     211                        this, &UIToolPaneMachine::sigSwitchToResourcesPane);
    210212                break;
    211213            }
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.h

    r87022 r87101  
    6161    /** Notifies listeners about current Snapshot pane item change. */
    6262    void sigCurrentSnapshotItemChange();
     63
     64    /** Notifies listeners about request to switch to Resources pane. */
     65    void sigSwitchToResourcesPane();
    6366
    6467public:
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r87022 r87101  
    508508}
    509509
     510void UIVirtualBoxManagerWidget::sltSwitchToResourcesPane()
     511{
     512    AssertPtrReturnVoid(m_pPaneTools);
     513    m_pPaneToolsGlobal->setActive(true);
     514    switchToGlobalTool(UIToolType_Resources);
     515    m_pPaneTools->setToolsType(UIToolType_Resources);
     516}
     517
    510518void UIVirtualBoxManagerWidget::prepare()
    511519{
     
    618626                            connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigCurrentSnapshotItemChange,
    619627                                    this, &UIVirtualBoxManagerWidget::sigCurrentSnapshotItemChange);
     628                            connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigSwitchToResourcesPane,
     629                                    this, &UIVirtualBoxManagerWidget::sltSwitchToResourcesPane);
    620630
    621631                            /* Add into stack: */
     
    901911                {
    902912                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Performance_S_Export));
     913                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Performance_S_ToResources));
    903914                    m_pToolBar->addSeparator();
    904915                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h

    r87022 r87101  
    271271        /** Handles signal requesting switch to Performance pane of machine with @a uMachineId. */
    272272        void sltSwitchToMachinePerformancePane(const QUuid &uMachineId);
     273        /** Handles signal requesting switch to Resources pane. */
     274        void sltSwitchToResourcesPane();
    273275    /** @} */
    274276
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/performance/UIPerformanceMonitor.cpp

    r86233 r87101  
    10961096void UIPerformanceMonitor::prepareActions()
    10971097{
    1098     QAction *pAction =
     1098    QAction *pExportAction =
    10991099        m_pActionPool->action(UIActionIndex_M_Performance_S_Export);
    1100     if (pAction)
    1101         connect(pAction, &QAction::triggered, this, &UIPerformanceMonitor::sltExportMetricsToFile);
     1100    if (pExportAction)
     1101        connect(pExportAction, &QAction::triggered, this, &UIPerformanceMonitor::sltExportMetricsToFile);
     1102
     1103    QAction *pToResourcesAction =
     1104        m_pActionPool->action(UIActionIndex_M_Performance_S_ToResources);
     1105    if (pToResourcesAction)
     1106        connect(pToResourcesAction, &QAction::triggered, this, &UIPerformanceMonitor::sigSwitchToResourcesPane);
    11021107}
    11031108
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/performance/UIPerformanceMonitor.h

    r86233 r87101  
    111111{
    112112    Q_OBJECT;
     113
     114 signals:
     115
     116    void sigSwitchToResourcesPane();
    113117
    114118public:
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