VirtualBox

Ignore:
Timestamp:
Jul 29, 2020 10:11:07 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9686, bugref:9510: Cleanup for an idea introduced in r139549.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp

    r85493 r85508  
    195195                    /* Configure pane: */
    196196                    m_pPaneResourceMonitor->setProperty("ToolType", QVariant::fromValue(UIToolType_Resources));
     197                    connect(m_pPaneResourceMonitor, &UIResourceMonitorWidget::sigSwitchToMachinePerformancePane,
     198                            this, &UIToolPaneGlobal::sigSwitchToMachinePerformancePane);
    197199
    198200                    /* Add into layout: */
    199201                    m_pLayout->addWidget(m_pPaneResourceMonitor);
    200202                    m_pLayout->setCurrentWidget(m_pPaneResourceMonitor);
    201                     connect(m_pPaneResourceMonitor, &UIResourceMonitorWidget::sigSwitchMachinePerformancePane,
    202                             this, &UIToolPaneGlobal::sigSwitchMachinePerformancePane);
    203203                }
    204204
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.h

    r85493 r85508  
    5151    /** Notifies listeners about Cloud Profile Manager change. */
    5252    void sigCloudProfileManagerChange();
    53     void sigSwitchMachinePerformancePane(const QUuid &machineUid);
     53
     54    /** Notifies listeners about request to switch to Performance pane of machine with @a uMachineId. */
     55    void sigSwitchToMachinePerformancePane(const QUuid &uMachineId);
    5456
    5557public:
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r85493 r85508  
    2828#include "UIExtraDataManager.h"
    2929#include "UIChooser.h"
    30 #include "UICommon.h"
    3130#include "UIVirtualBoxManager.h"
    3231#include "UIVirtualBoxManagerWidget.h"
     
    460459}
    461460
    462 void UIVirtualBoxManagerWidget::sltSwitchMachinePerformancePane(const QUuid &machineUid)
    463 {
    464     if (!m_pPaneToolsMachine)
    465         return;
    466     CVirtualBox comVBox = uiCommon().virtualBox();
    467 
    468     CMachine comMachine = comVBox.FindMachine(machineUid.toString());
    469     if (comMachine.isNull())
    470         return;
    471     m_pPaneToolsMachine->setActive(true);
    472     m_pPaneToolsGlobal->setActive(false);
    473     m_pPaneToolsMachine->setMachine(comMachine);
    474     switchToMachineTool(UIToolType_Performance);
     461void UIVirtualBoxManagerWidget::sltSwitchToMachinePerformancePane(const QUuid &uMachineId)
     462{
     463    AssertPtrReturnVoid(m_pPaneChooser);
     464    AssertPtrReturnVoid(m_pPaneTools);
     465    m_pPaneChooser->setCurrentMachine(uMachineId);
     466    m_pPaneTools->setToolsType(UIToolType_Performance);
    475467}
    476468
     
    572564                            connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCloudProfileManagerChange,
    573565                                    this, &UIVirtualBoxManagerWidget::sigCloudProfileManagerChange);
    574                             connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigSwitchMachinePerformancePane,
    575                                     this, &UIVirtualBoxManagerWidget::sltSwitchMachinePerformancePane);
     566                            connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigSwitchToMachinePerformancePane,
     567                                    this, &UIVirtualBoxManagerWidget::sltSwitchToMachinePerformancePane);
    576568
    577569                            /* Add into stack: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h

    r85493 r85508  
    251251        void sltHandleToolsPaneIndexChange();
    252252
    253         /** Handles signal requesting performance pane switch. */
    254         void sltSwitchMachinePerformancePane(const QUuid &machineUid);
     253        /** Handles signal requesting switch to Performance pane of machine with @a uMachineId. */
     254        void sltSwitchToMachinePerformancePane(const QUuid &uMachineId);
    255255    /** @} */
    256256
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp

    r84595 r85508  
    158158    AssertPtrReturnVoid(view());
    159159    view()->setSearchWidgetVisible(fVisible);
     160}
     161
     162void UIChooser::setCurrentMachine(const QUuid &uId)
     163{
     164    AssertPtrReturnVoid(model());
     165    model()->setCurrentMachineItem(uId);
    160166}
    161167
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h

    r84595 r85508  
    152152        /** Toggle machine search widget to be @a fVisible. */
    153153        void setMachineSearchWidgetVisibility(bool fVisible);
     154        /** Changes current machine to the one with certain @a uId. */
     155        void setCurrentMachine(const QUuid &uId);
    154156    /** @} */
    155157
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r85111 r85508  
    959959    /* Rebuild tree for main root: */
    960960    buildTreeForMainRoot(true /* preserve selection */);
     961}
     962
     963void UIChooserModel::setCurrentMachineItem(const QUuid &uId)
     964{
     965    /* Look whether we have such item at all: */
     966    UIChooserItem *pItem = root()->searchForItem(uId.toString(),
     967                                                 UIChooserItemSearchFlag_Machine |
     968                                                 UIChooserItemSearchFlag_ExactId);
     969
     970    /* Select item if exists: */
     971    if (pItem)
     972        setSelectedItem(pItem);
    961973}
    962974
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r85080 r85508  
    222222        /** Sorts selected [parent] group item. */
    223223        void sortSelectedGroupItem();
     224        /** Changes current machine item to the one with certain @a uId. */
     225        void setCurrentMachineItem(const QUuid &uId);
    224226
    225227        /** Defines current @a pDragObject. */
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.cpp

    r85493 r85508  
    14781478    if (!m_pTableView || !m_pModel)
    14791479        return;
    1480     QUuid machineId = m_pModel->itemUid(m_pTableView->selectedItemIndex());
    1481     if (machineId.isNull())
     1480    const QUuid uMachineId = m_pModel->itemUid(m_pTableView->selectedItemIndex());
     1481    if (uMachineId.isNull())
    14821482        return;
    1483     emit sigSwitchMachinePerformancePane(machineId);
     1483    emit sigSwitchToMachinePerformancePane(uMachineId);
    14841484}
    14851485
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.h

    r85493 r85508  
    5151signals:
    5252
    53     void sigSwitchMachinePerformancePane(const QUuid &machineId);
     53    void sigSwitchToMachinePerformancePane(const QUuid &uMachineId);
    5454
    5555public:
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