VirtualBox

Changeset 68199 in vbox


Ignore:
Timestamp:
Jul 31, 2017 12:32:17 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
117296
Message:

FE/Qt: bugref:8900: UISelectorWindow: A bit of cleanup/rework.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r68175 r68199  
    206206    UIVMItem *pItem = currentItem();
    207207
    208     /* Determine which menu to show: */
    209     m_pGroupMenuAction->setVisible(m_pPaneChooser->isSingleGroupSelected());
    210     m_pMachineMenuAction->setVisible(!m_pPaneChooser->isSingleGroupSelected());
    211     if (m_pGroupMenuAction->isVisible())
    212     {
    213         foreach (UIAction *pAction, m_machineActions)
    214             pAction->hideShortcut();
    215         foreach (UIAction *pAction, m_groupActions)
    216             pAction->showShortcut();
    217     }
    218     else if (m_pMachineMenuAction->isVisible())
    219     {
    220         foreach (UIAction *pAction, m_groupActions)
    221             pAction->hideShortcut();
    222         foreach (UIAction *pAction, m_machineActions)
    223             pAction->showShortcut();
    224     }
    225 
     208    /* Update action visibility: */
     209    updateActionsVisibility();
    226210    /* Update action appearance: */
    227211    updateActionsAppearance();
     
    16991683        m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
    17001684        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    1701         // TODO: Get red of hard-coded stuff:
     1685        // TODO: Get rid of hard-coded stuff:
    17021686        const QSize toolBarIconSize = m_pToolBar->iconSize();
    17031687        if (toolBarIconSize.width() < 32 || toolBarIconSize.height() < 32)
     
    19311915    connect(m_pPaneToolsMachine, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)),
    19321916            this, SLOT(sltOpenMachineSettingsDialog(const QString&, const QString&, const QString&)));
    1933 
    19341917
    19351918    /* Global event handlers: */
     
    20852068            vboxGlobal().launchMachine(machine, enmItemLaunchMode);
    20862069        }
     2070}
     2071
     2072void UISelectorWindow::updateActionsVisibility()
     2073{
     2074    /* Determine whether Machine or Group menu should be shown at all: */
     2075    const bool fMachineMenuShown = !m_pPaneChooser->isSingleGroupSelected();
     2076    m_pMachineMenuAction->setVisible(fMachineMenuShown);
     2077    m_pGroupMenuAction->setVisible(!fMachineMenuShown);
     2078
     2079    /* Hide action shortcuts: */
     2080    if (!fMachineMenuShown)
     2081        foreach (UIAction *pAction, m_machineActions)
     2082            pAction->hideShortcut();
     2083    if (fMachineMenuShown)
     2084        foreach (UIAction *pAction, m_groupActions)
     2085            pAction->hideShortcut();
     2086
     2087    /* Show what should be shown: */
     2088    if (fMachineMenuShown)
     2089        foreach (UIAction *pAction, m_machineActions)
     2090            pAction->showShortcut();
     2091    if (!fMachineMenuShown)
     2092        foreach (UIAction *pAction, m_groupActions)
     2093            pAction->showShortcut();
    20872094}
    20882095
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h

    r68175 r68199  
    267267    /** @name Action update stuff.
    268268      * @{ */
     269        /** Performs update of actions visibility. */
     270        void updateActionsVisibility();
    269271        /** Performs update of actions appearance. */
    270272        void updateActionsAppearance();
     
    325327    /** Holds the Chooser-pane instance. */
    326328    UIGChooser         *m_pPaneChooser;
    327     /** Holds the Tools-pane instance. */
     329    /** Holds the Machine Tools-pane instance. */
    328330    UIToolsPaneMachine *m_pPaneToolsMachine;
    329331
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