VirtualBox

Changeset 102760 in vbox for trunk/src


Ignore:
Timestamp:
Jan 4, 2024 2:05:36 PM (13 months ago)
Author:
vboxsync
Message:

FE/Qt: UIVirtualBoxManager: A bit of refactoring for Tool switch code; Mostly moving code to approprivate places, needs for further improvements.

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

Legend:

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

    r102744 r102760  
    11861186    /* Remove instance if exist: */
    11871187    delete m_settings.take(UIAdvancedSettingsDialog::Type_Global);
     1188}
     1189
     1190void UIVirtualBoxManager::sltPerformShowGlobalTool(QAction *pAction)
     1191{
     1192    /* Sanity checks: */
     1193    AssertPtrReturnVoid(pAction);
     1194    AssertPtrReturnVoid(m_pWidget);
     1195
     1196    /* Acquire tool type: */
     1197    const UIToolType enmType = pAction->property("UIToolType").value<UIToolType>();
     1198    AssertReturnVoid(enmType != UIToolType_Invalid);
     1199
     1200    /* Make sure global item is selected: */
     1201    m_pWidget->switchToGlobalItem();
     1202
     1203    /* Make sure corresponding manager window is closed (if any): */
     1204    sltCloseManagerWindow(enmType);
     1205
     1206    /* Open the tool finally: */
     1207    m_pWidget->setToolsTypeGlobal(enmType);
    11881208}
    11891209
     
    22502270}
    22512271
    2252 void UIVirtualBoxManager::sltPerformShowGlobalTool(QAction *pAction)
    2253 {
    2254     /* Sanity checks: */
    2255     AssertPtrReturnVoid(pAction);
    2256     AssertPtrReturnVoid(m_pWidget);
    2257 
    2258     /* Acquire tool type: */
    2259     const UIToolType enmType = pAction->property("UIToolType").value<UIToolType>();
    2260     AssertReturnVoid(enmType != UIToolType_Invalid);
    2261 
    2262     /* Make sure global item is selected: */
    2263     m_pWidget->switchToGlobalItem();
    2264 
    2265     /* Make sure corresponding manager window is closed (if any): */
    2266     sltCloseManagerWindow(enmType);
    2267 
    2268     /* Open the tool finally: */
    2269     m_pWidget->setToolsTypeGlobal(enmType);
    2270 }
    2271 
    22722272void UIVirtualBoxManager::sltPerformShowMachineTool(QAction *pAction)
    22732273{
     
    25622562    connect(actionPool()->action(UIActionIndexMN_M_File_S_Close), &UIAction::triggered,
    25632563            this, &UIVirtualBoxManager::sltPerformExit);
     2564
     2565    /* 'File/Tools' menu connections: */
    25642566    connect(actionPool()->actionGroup(UIActionIndexMN_M_File_M_Tools), &QActionGroup::triggered,
    25652567            this, &UIVirtualBoxManager::sltPerformShowGlobalTool);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r102731 r102760  
    216216        /** Handles call to close Preferences dialog. */
    217217        void sltClosePreferencesDialog();
     218
     219        /** Handles call to show global tool corresponding to passed @a pAction. */
     220        void sltPerformShowGlobalTool(QAction *pAction);
    218221
    219222        /** Handles call to exit application. */
     
    322325        void sltHandlePoweredOffMachine(bool fSuccess, bool fIncludingDiscard);
    323326
    324         /** Handles call to show global tool corresponding to passed @a pAction. */
    325         void sltPerformShowGlobalTool(QAction *pAction);
    326327        /** Handles call to show machine tool corresponding to passed @a pAction. */
    327328        void sltPerformShowMachineTool(QAction *pAction);
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