VirtualBox

Ignore:
Timestamp:
Jan 2, 2024 3:33:52 PM (12 months ago)
Author:
vboxsync
Message:

FE/Qt: UIVirtualBoxManagerWidget: Simplify reaction for the tools pane index change; This can go easier now since r160219.

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

Legend:

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

    r102723 r102743  
    519519            /* If Error-pane is chosen currently => open tool currently chosen in Tools-pane: */
    520520            if (m_pPaneToolsMachine->currentTool() == UIToolType_Error)
    521                 sltHandleToolsPaneIndexChange();
     521                sltHandleMachineToolsPaneIndexChange();
    522522
    523523            /* If we still have same item selected: */
     
    574574}
    575575
    576 void UIVirtualBoxManagerWidget::sltHandleToolsPaneIndexChange()
    577 {
    578     /* Determine sender: */
    579     UITools *pMenu = qobject_cast<UITools*>(sender());
    580     if (!pMenu)
    581         pMenu = m_pMenuToolsMachine;
    582 
    583     /* Acquire current class/type: */
    584     UIToolClass enmCurrentClass = UIToolClass_Invalid;
    585     if (pMenu == m_pMenuToolsGlobal)
    586         enmCurrentClass = UIToolClass_Global;
    587     else if (pMenu == m_pMenuToolsMachine)
    588         enmCurrentClass = UIToolClass_Machine;
    589     AssertReturnVoid(enmCurrentClass != UIToolClass_Invalid);
    590     const UIToolType enmCurrentType = pMenu->toolsType();
    591 
    592     /* Invent default for fallback case: */
    593     const UIToolType enmDefaultType = enmCurrentClass == UIToolClass_Global ? UIToolType_Welcome
    594                                     : enmCurrentClass == UIToolClass_Machine ? UIToolType_Details
    595                                     : UIToolType_Invalid;
    596     AssertReturnVoid(enmDefaultType != UIToolType_Invalid);
    597 
    598     /* Calculate new type to choose: */
    599     const UIToolType enmNewType = UIToolStuff::isTypeOfClass(enmCurrentType, enmCurrentClass)
    600                                 ? enmCurrentType : enmDefaultType;
    601 
    602     /* Choose new type: */
    603     switch (enmCurrentClass)
    604     {
    605         case UIToolClass_Global: switchToGlobalTool(enmNewType); break;
    606         case UIToolClass_Machine: switchToMachineTool(enmNewType); break;
    607         default: break;
    608     }
     576void UIVirtualBoxManagerWidget::sltHandleGlobalToolsPaneIndexChange()
     577{
     578    switchToGlobalTool(m_pMenuToolsGlobal->toolsType());
     579}
     580
     581void UIVirtualBoxManagerWidget::sltHandleMachineToolsPaneIndexChange()
     582{
     583    switchToMachineTool(m_pMenuToolsMachine->toolsType());
    609584}
    610585
     
    845820    /* Tools-pane connections: */
    846821    connect(m_pMenuToolsGlobal, &UITools::sigSelectionChanged,
    847             this, &UIVirtualBoxManagerWidget::sltHandleToolsPaneIndexChange);
     822            this, &UIVirtualBoxManagerWidget::sltHandleGlobalToolsPaneIndexChange);
    848823    connect(m_pMenuToolsMachine, &UITools::sigSelectionChanged,
    849             this, &UIVirtualBoxManagerWidget::sltHandleToolsPaneIndexChange);
     824            this, &UIVirtualBoxManagerWidget::sltHandleMachineToolsPaneIndexChange);
    850825}
    851826
     
    10991074    /* Tools-pane connections: */
    11001075    disconnect(m_pMenuToolsGlobal, &UITools::sigSelectionChanged,
    1101                this, &UIVirtualBoxManagerWidget::sltHandleToolsPaneIndexChange);
     1076               this, &UIVirtualBoxManagerWidget::sltHandleGlobalToolsPaneIndexChange);
    11021077    disconnect(m_pMenuToolsMachine, &UITools::sigSelectionChanged,
    1103                this, &UIVirtualBoxManagerWidget::sltHandleToolsPaneIndexChange);
     1078               this, &UIVirtualBoxManagerWidget::sltHandleMachineToolsPaneIndexChange);
    11041079}
    11051080
     
    11771152        /* If Error-pane is chosen currently => open tool currently chosen in Tools-pane: */
    11781153        if (m_pPaneToolsMachine->currentTool() == UIToolType_Error)
    1179             sltHandleToolsPaneIndexChange();
     1154            sltHandleMachineToolsPaneIndexChange();
    11801155
    11811156        /* Propagate current items to the Tools pane: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h

    r102723 r102743  
    324324        void sltHandleToolMenuRequested(const QPoint &position, UIVirtualMachineItem *pItem);
    325325
    326         /** Handles signal about Tools-pane index change. */
    327         void sltHandleToolsPaneIndexChange();
     326        /** Handles signal about global Tools-pane index change. */
     327        void sltHandleGlobalToolsPaneIndexChange();
     328        /** Handles signal about machine Tools-pane index change. */
     329        void sltHandleMachineToolsPaneIndexChange();
    328330
    329331        /** Handles signal requesting switch to Activity pane of machine with @a uMachineId. */
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