VirtualBox

Changeset 83482 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 30, 2020 1:35:12 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9686: VirtualBox Manager: Handle change for current tool and active tool-pane allowing global and machine tools to be aware whether they are not just currently chosen but active as well.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager
Files:
5 edited

Legend:

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

    r83481 r83482  
    4545    , m_pPaneCloud(0)
    4646    , m_pPaneResourceMonitor(0)
     47    , m_fActive(false)
    4748{
    4849    /* Prepare: */
     
    5455    /* Cleanup: */
    5556    cleanup();
     57}
     58
     59void UIToolPaneGlobal::setActive(bool fActive)
     60{
     61    /* Save activity: */
     62    if (m_fActive != fActive)
     63    {
     64        m_fActive = fActive;
     65
     66        /* Handle token change: */
     67        handleTokenChange();
     68    }
    5669}
    5770
     
    194207        }
    195208    }
     209
     210    /* Handle token change: */
     211    handleTokenChange();
    196212}
    197213
     
    221237        delete pWidget;
    222238    }
     239
     240    /* Handle token change: */
     241    handleTokenChange();
    223242}
    224243
     
    242261    }
    243262}
     263
     264void UIToolPaneGlobal::handleTokenChange()
     265{
     266    // printf("UIToolPaneGlobal::handleTokenChange: Active = %d, current tool = %d\n", m_fActive, currentTool());
     267}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.h

    r83481 r83482  
    5959    virtual ~UIToolPaneGlobal() /* override */;
    6060
     61    /** Defines whether this pane is @a fActive. */
     62    void setActive(bool fActive);
     63    /** Returns whether this pane is active. */
     64    bool active() const { return m_fActive; }
     65
    6166    /** Returns type of tool currently opened. */
    6267    UIToolType currentTool() const;
     
    7782    void cleanup();
    7883
     84    /** Handles token change. */
     85    void handleTokenChange();
     86
    7987    /** Holds the action pool reference. */
    8088    UIActionPool *m_pActionPool;
     
    92100    /** Holds the VM Resource Monitor instance. */
    93101    UIResourceMonitorWidget     *m_pPaneResourceMonitor;
     102
     103    /** Holds whether this pane is active. */
     104    bool  m_fActive;
    94105};
    95106
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp

    r82968 r83482  
    4646    , m_pPaneSnapshots(0)
    4747    , m_pPaneLogViewer(0)
     48    , m_fActive(false)
    4849{
    4950    /* Prepare: */
     
    5556    /* Cleanup: */
    5657    cleanup();
     58}
     59
     60void UIToolPaneMachine::setActive(bool fActive)
     61{
     62    /* Save activity: */
     63    if (m_fActive != fActive)
     64    {
     65        m_fActive = fActive;
     66
     67        /* Handle token change: */
     68        handleTokenChange();
     69    }
    5770}
    5871
     
    175188        }
    176189    }
     190
     191    /* Handle token change: */
     192    handleTokenChange();
    177193}
    178194
     
    202218        delete pWidget;
    203219    }
     220
     221    /* Handle token change: */
     222    handleTokenChange();
    204223}
    205224
     
    278297    }
    279298}
     299
     300void UIToolPaneMachine::handleTokenChange()
     301{
     302    // printf("UIToolPaneMachine::handleTokenChange: Active = %d, current tool = %d\n", m_fActive, currentTool());
     303}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.h

    r82968 r83482  
    6868    virtual ~UIToolPaneMachine() /* override */;
    6969
     70    /** Defines whether this pane is @a fActive. */
     71    void setActive(bool fActive);
     72    /** Returns whether this pane is active. */
     73    bool active() const { return m_fActive; }
     74
    7075    /** Returns type of tool currently opened. */
    7176    UIToolType currentTool() const;
     
    101106    void cleanup();
    102107
     108    /** Handles token change. */
     109    void handleTokenChange();
     110
    103111    /** Holds the action pool reference. */
    104112    UIActionPool *m_pActionPool;
     
    118126    UIVMLogViewerWidget *m_pPaneLogViewer;
    119127
     128    /** Holds whether this pane is active. */
     129    bool  m_fActive;
     130
    120131    /** Holds the cache of passed items. */
    121132    QList<UIVirtualMachineItem*>  m_items;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r83480 r83482  
    270270            m_pPaneTools->setToolsClass(UIToolClass_Machine);
    271271            m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine);
     272            m_pPaneToolsGlobal->setActive(false);
     273            m_pPaneToolsMachine->setActive(true);
    272274            break;
    273275        }
     
    276278            m_pPaneTools->setToolsClass(UIToolClass_Global);
    277279            m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal);
     280            m_pPaneToolsMachine->setActive(false);
     281            m_pPaneToolsGlobal->setActive(true);
    278282            break;
    279283        }
     
    461465                        if (m_pPaneToolsGlobal)
    462466                        {
     467                            if (m_pPaneChooser->isGlobalItemSelected())
     468                                m_pPaneToolsGlobal->setActive(true);
    463469                            connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCloudProfileManagerChange,
    464470                                    this, &UIVirtualBoxManagerWidget::sigCloudProfileManagerChange);
     
    472478                        if (m_pPaneToolsMachine)
    473479                        {
     480                            if (!m_pPaneChooser->isGlobalItemSelected())
     481                                m_pPaneToolsMachine->setActive(true);
    474482                            connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigCurrentSnapshotItemChange,
    475483                                    this, &UIVirtualBoxManagerWidget::sigCurrentSnapshotItemChange);
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