VirtualBox

Changeset 84084 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 29, 2020 2:15:52 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137666
Message:

FE/Qt: bugref:9729: VirtualBox Manager: Make sure main toolbar is updated when switching between chooser item types and accessible/inaccessible items.

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

Legend:

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

    r84083 r84084  
    5050    , m_pSlidingAnimation(0)
    5151    , m_pPaneTools(0)
    52     , m_fSingleGroupSelected(false)
     52    , m_enmSelectionType(SelectionType_Invalid)
     53    , m_fSelectedMachineItemAccessible(false)
    5354{
    5455    prepare();
     
    257258    }
    258259
    259     /* If that was machine or group item selected: */
     260    /* Recache current item info if machine or group item selected: */
    260261    if (isMachineItemSelected() || isGroupItemSelected())
    261     {
    262         /* Recache current item info: */
    263262        recacheCurrentItemInformation();
    264263
    265         /* Update toolbar if we are switching beween single group item and rest of possible items: */
    266         if (m_fSingleGroupSelected != isSingleGroupSelected())
    267             updateToolbar();
    268     }
    269 
    270     /* Remember whether single group item was selected: */
    271     m_fSingleGroupSelected = isSingleGroupSelected();
     264    /* Calculate selection type: */
     265    const SelectionType enmSelectedItemType = isSingleGroupSelected()
     266                                            ? SelectionType_SingleGroupItem
     267                                            : isGlobalItemSelected()
     268                                            ? SelectionType_FirstIsGlobalItem
     269                                            : isMachineItemSelected()
     270                                            ? SelectionType_FirstIsMachineItem
     271                                            : SelectionType_Invalid;
     272    /* Acquire current item: */
     273    UIVirtualMachineItem *pItem = currentItem();
     274    const bool fCurrentItemIsOk = pItem && pItem->accessible();
     275
     276    /* Update toolbar if selection type or item accessibility got changed: */
     277    if (   m_enmSelectionType != enmSelectedItemType
     278        || m_fSelectedMachineItemAccessible != fCurrentItemIsOk)
     279        updateToolbar();
     280
     281    /* Remember the last selection type: */
     282    m_enmSelectionType = enmSelectedItemType;
     283    /* Remember whether the last selected item was accessible: */
     284    m_fSelectedMachineItemAccessible = fCurrentItemIsOk;
    272285}
    273286
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h

    r84083 r84084  
    4646{
    4747    Q_OBJECT;
     48
     49    /** Possible selection types. */
     50    enum SelectionType
     51    {
     52        SelectionType_Invalid,
     53        SelectionType_SingleGroupItem,
     54        SelectionType_FirstIsGlobalItem,
     55        SelectionType_FirstIsMachineItem
     56    };
    4857
    4958signals:
     
    226235    UITools            *m_pPaneTools;
    227236
    228     /** Holds whether last time single group item was selected exclusively. */
    229     bool  m_fSingleGroupSelected;
     237    /** Holds the last selection type. */
     238    SelectionType  m_enmSelectionType;
     239    /** Holds whether the last selected item was accessible. */
     240    bool           m_fSelectedMachineItemAccessible;
    230241};
    231242
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