VirtualBox

Changeset 108177 in vbox


Ignore:
Timestamp:
Feb 12, 2025 12:15:35 PM (3 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167492
Message:

FE/Qt: bugref:10814: VBox Manager / Tool-pane: Update global tool menu restrictions when the Chooser-pane selection got changed; That is required to hide/show Machines tool accordingly, we are not going to show it if there are no VMs.

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

Legend:

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

    r108175 r108177  
    181181}
    182182
     183void UIGlobalToolsManagerWidget::sltHandleChooserPaneSelectionChange()
     184{
     185    updateToolsMenu();
     186}
     187
    183188void UIGlobalToolsManagerWidget::sltHandleCloudProfileStateChange(const QString &, const QString &)
    184189{
     
    254259
    255260    /* Chooser-pane connections: */
     261    connect(chooser(), &UIChooser::sigSelectionChanged,
     262            this, &UIGlobalToolsManagerWidget::sltHandleChooserPaneSelectionChange);
    256263    connect(chooser(), &UIChooser::sigCloudProfileStateChange,
    257264            this, &UIGlobalToolsManagerWidget::sltHandleCloudProfileStateChange);
     
    282289
    283290    /* Chooser-pane connections: */
     291    disconnect(chooser(), &UIChooser::sigSelectionChanged,
     292               this, &UIGlobalToolsManagerWidget::sltHandleChooserPaneSelectionChange);
    284293    disconnect(chooser(), &UIChooser::sigCloudProfileStateChange,
    285294               this, &UIGlobalToolsManagerWidget::sltHandleCloudProfileStateChange);
     
    311320void UIGlobalToolsManagerWidget::updateToolsMenu()
    312321{
    313     /* Update global tools restrictions: */
     322    /* Prepare tool restrictions: */
    314323    QSet<UIToolType> restrictedTypes;
     324
    315325    /* Restrict some types for Basic mode: */
    316326    const bool fExpertMode = gEDataManager->isSettingsInExpertMode();
     
    318328        restrictedTypes << UIToolType_Media
    319329                        << UIToolType_Network;
     330
     331    /* Make sure Machines tool is hidden for empty Chooser-pane: */
     332    if (!chooser()->currentItem())
     333        restrictedTypes << UIToolType_Machines;
     334
     335    /* Make sure no restricted tool is selected: */
    320336    if (restrictedTypes.contains(toolMenu()->toolsType()))
    321337        setMenuToolType(UIToolType_Home);
     338
     339    /* Hide restricted tools in the menu: */
    322340    const QList restrictions(restrictedTypes.begin(), restrictedTypes.end());
    323341    toolMenu()->setRestrictedToolTypes(restrictions);
    324342
    325     /* Take restrictions into account, closing all restricted tools: */
     343    /* Close all restricted tools (besides the Machines): */
    326344    foreach (const UIToolType &enmRestrictedType, restrictedTypes)
    327         toolPane()->closeTool(enmRestrictedType);
    328 }
     345        if (enmRestrictedType != UIToolType_Machines)
     346            toolPane()->closeTool(enmRestrictedType);
     347}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIGlobalToolsManagerWidget.h

    r108173 r108177  
    124124    /** @name Chooser pane stuff.
    125125      * @{ */
     126        /** Handles Chooser-pane selection change. */
     127        void sltHandleChooserPaneSelectionChange();
     128
    126129        /** Handles state change for cloud profile with certain @a strProviderShortName and @a strProfileName. */
    127130        void sltHandleCloudProfileStateChange(const QString &strProviderShortName,
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette