VirtualBox

Ignore:
Timestamp:
Dec 18, 2024 1:58:06 PM (3 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
166397
Message:

FE/Qt: bugref:10814: VBox Manager: Huge rework actually; Reworking advanced architecture widget to utilize Global and Machine tool managers.

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

Legend:

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

    r107299 r107359  
    2828/* Qt includes: */
    2929#include <QApplication>
    30 #include <QHBoxLayout>
    31 #include <QStackedWidget>
    3230#include <QStyle>
    33 #include <QTimer>
    3431#include <QToolButton>
    3532#include <QVBoxLayout>
    3633
    3734/* GUI includes: */
    38 #include "QISplitter.h"
    3935#include "QIToolBar.h"
    4036#include "UIActionPoolManager.h"
    4137#include "UIChooser.h"
    4238#include "UICommon.h"
    43 #include "UIDesktopWidgetWatchdog.h"
    4439#include "UIExtraDataManager.h"
    45 #include "UIGlobalSession.h"
    46 #include "UILoggingDefs.h"
    47 #include "UIMessageCenter.h"
     40#include "UIGlobalToolsManagerWidget.h"
     41#include "UIMachineManagerWidget.h"
    4842#include "UINotificationCenter.h"
    49 #include "UISlidingAnimation.h"
    50 #include "UITabBar.h"
    5143#include "UIToolPaneGlobal.h"
    5244#include "UIToolPaneMachine.h"
    53 #include "UITools.h"
    54 #include "UITranslationEventListener.h"
    55 #include "UIVirtualBoxEventHandler.h"
    5645#include "UIVirtualBoxManager.h"
    5746#include "UIVirtualBoxManagerAdvancedWidget.h"
    58 #include "UIVirtualMachineItemCloud.h"
    59 #include "UIVirtualMachineItemLocal.h"
    6047#if defined(VBOX_WS_MAC) && (defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32))
    6148# include "UIIconPool.h"
    6249# include "UIVersion.h"
    6350#endif /* VBOX_WS_MAC && (RT_ARCH_ARM64 || RT_ARCH_ARM32) */
    64 #ifndef VBOX_WS_MAC
    65 # include "UIMenuBar.h"
    66 #endif
    6751
    6852/* COM includes: */
     
    7458UIVirtualBoxManagerAdvancedWidget::UIVirtualBoxManagerAdvancedWidget(UIVirtualBoxManager *pParent)
    7559    : m_pActionPool(pParent->actionPool())
    76     , m_pSplitter(0)
    7760    , m_pToolBar(0)
    78     , m_pPaneChooser(0)
    79     , m_pStackedWidget(0)
    80     , m_pPaneToolsGlobal(0)
    81     , m_pPaneToolsMachine(0)
    82     , m_pMenuToolsGlobal(0)
    83     , m_pMenuToolsMachine(0)
    84     , m_enmSelectionType(SelectionType_Invalid)
    85     , m_fSelectedMachineItemAccessible(false)
    86     , m_pSplitterSettingsSaveTimer(0)
     61    , m_pGlobalToolManager(0)
    8762{
    8863    prepare();
     
    9671void UIVirtualBoxManagerAdvancedWidget::updateToolBarMenuButtons(bool fSeparateMenuSection)
    9772{
    98     QToolButton *pButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)));
     73    QAction *pAction = actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow);
     74    AssertPtrReturnVoid(pAction);
     75    QToolButton *pButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pAction));
    9976    if (pButton)
    10077        pButton->setPopupMode(fSeparateMenuSection ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup);
     
    10380UIVirtualMachineItem *UIVirtualBoxManagerAdvancedWidget::currentItem() const
    10481{
    105     return m_pPaneChooser->currentItem();
     82    AssertPtrReturn(chooser(), 0);
     83    return chooser()->currentItem();
    10684}
    10785
    10886QList<UIVirtualMachineItem*> UIVirtualBoxManagerAdvancedWidget::currentItems() const
    10987{
    110     return m_pPaneChooser->currentItems();
    111 }
    112 
    113 bool UIVirtualBoxManagerAdvancedWidget::isItemAccessible(UIVirtualMachineItem *pItem /* = 0 */) const
    114 {
    115     if (!pItem)
    116         pItem = currentItem();
    117     return pItem && pItem->accessible();
     88    AssertPtrReturn(chooser(), QList<UIVirtualMachineItem*>());
     89    return chooser()->currentItems();
    11890}
    11991
    12092bool UIVirtualBoxManagerAdvancedWidget::isGroupItemSelected() const
    12193{
    122     return m_pPaneChooser->isGroupItemSelected();
     94    AssertPtrReturn(chooser(), false);
     95    return chooser()->isGroupItemSelected();
    12396}
    12497
    12598bool UIVirtualBoxManagerAdvancedWidget::isGlobalItemSelected() const
    12699{
    127     return m_pPaneChooser->isGlobalItemSelected();
     100    AssertPtrReturn(chooser(), false);
     101    return chooser()->isGlobalItemSelected();
    128102}
    129103
    130104bool UIVirtualBoxManagerAdvancedWidget::isMachineItemSelected() const
    131105{
    132     return m_pPaneChooser->isMachineItemSelected();
     106    AssertPtrReturn(chooser(), false);
     107    return chooser()->isMachineItemSelected();
    133108}
    134109
    135110bool UIVirtualBoxManagerAdvancedWidget::isLocalMachineItemSelected() const
    136111{
    137     return m_pPaneChooser->isLocalMachineItemSelected();
     112    AssertPtrReturn(chooser(), false);
     113    return chooser()->isLocalMachineItemSelected();
    138114}
    139115
    140116bool UIVirtualBoxManagerAdvancedWidget::isCloudMachineItemSelected() const
    141117{
    142     return m_pPaneChooser->isCloudMachineItemSelected();
     118    AssertPtrReturn(chooser(), false);
     119    return chooser()->isCloudMachineItemSelected();
    143120}
    144121
    145122bool UIVirtualBoxManagerAdvancedWidget::isSingleGroupSelected() const
    146123{
    147     return m_pPaneChooser->isSingleGroupSelected();
     124    AssertPtrReturn(chooser(), false);
     125    return chooser()->isSingleGroupSelected();
    148126}
    149127
    150128bool UIVirtualBoxManagerAdvancedWidget::isSingleLocalGroupSelected() const
    151129{
    152     return m_pPaneChooser->isSingleLocalGroupSelected();
     130    AssertPtrReturn(chooser(), false);
     131    return chooser()->isSingleLocalGroupSelected();
    153132}
    154133
    155134bool UIVirtualBoxManagerAdvancedWidget::isSingleCloudProviderGroupSelected() const
    156135{
    157     return m_pPaneChooser->isSingleCloudProviderGroupSelected();
     136    AssertPtrReturn(chooser(), false);
     137    return chooser()->isSingleCloudProviderGroupSelected();
    158138}
    159139
    160140bool UIVirtualBoxManagerAdvancedWidget::isSingleCloudProfileGroupSelected() const
    161141{
    162     return m_pPaneChooser->isSingleCloudProfileGroupSelected();
     142    AssertPtrReturn(chooser(), false);
     143    return chooser()->isSingleCloudProfileGroupSelected();
    163144}
    164145
    165146bool UIVirtualBoxManagerAdvancedWidget::isAllItemsOfOneGroupSelected() const
    166147{
    167     return m_pPaneChooser->isAllItemsOfOneGroupSelected();
    168 }
    169 
    170 UIVirtualBoxManagerAdvancedWidget::SelectionType UIVirtualBoxManagerAdvancedWidget::selectionType() const
    171 {
    172     return   isSingleLocalGroupSelected()
    173            ? SelectionType_SingleLocalGroupItem
    174            : isSingleCloudProviderGroupSelected() || isSingleCloudProfileGroupSelected()
    175            ? SelectionType_SingleCloudGroupItem
    176            : isGlobalItemSelected()
    177            ? SelectionType_FirstIsGlobalItem
    178            : isLocalMachineItemSelected()
    179            ? SelectionType_FirstIsLocalMachineItem
    180            : isCloudMachineItemSelected()
    181            ? SelectionType_FirstIsCloudMachineItem
    182            : SelectionType_Invalid;
     148    AssertPtrReturn(chooser(), false);
     149    return chooser()->isAllItemsOfOneGroupSelected();
    183150}
    184151
    185152QString UIVirtualBoxManagerAdvancedWidget::fullGroupName() const
    186153{
    187     return m_pPaneChooser->fullGroupName();
     154    AssertPtrReturn(chooser(), QString());
     155    return chooser()->fullGroupName();
    188156}
    189157
    190158bool UIVirtualBoxManagerAdvancedWidget::isGroupSavingInProgress() const
    191159{
    192     return m_pPaneChooser->isGroupSavingInProgress();
     160    AssertPtrReturn(chooser(), false);
     161    return chooser()->isGroupSavingInProgress();
    193162}
    194163
    195164bool UIVirtualBoxManagerAdvancedWidget::isCloudProfileUpdateInProgress() const
    196165{
    197     return m_pPaneChooser->isCloudProfileUpdateInProgress();
     166    AssertPtrReturn(chooser(), false);
     167    return chooser()->isCloudProfileUpdateInProgress();
    198168}
    199169
    200170void UIVirtualBoxManagerAdvancedWidget::openGroupNameEditor()
    201171{
    202     m_pPaneChooser->openGroupNameEditor();
     172    AssertPtrReturnVoid(chooser());
     173    chooser()->openGroupNameEditor();
    203174}
    204175
    205176void UIVirtualBoxManagerAdvancedWidget::disbandGroup()
    206177{
    207     m_pPaneChooser->disbandGroup();
     178    AssertPtrReturnVoid(chooser());
     179    chooser()->disbandGroup();
    208180}
    209181
    210182void UIVirtualBoxManagerAdvancedWidget::removeMachine()
    211183{
    212     m_pPaneChooser->removeMachine();
     184    AssertPtrReturnVoid(chooser());
     185    chooser()->removeMachine();
    213186}
    214187
    215188void UIVirtualBoxManagerAdvancedWidget::moveMachineToGroup(const QString &strName /* = QString() */)
    216189{
    217     m_pPaneChooser->moveMachineToGroup(strName);
     190    AssertPtrReturnVoid(chooser());
     191    chooser()->moveMachineToGroup(strName);
    218192}
    219193
    220194QStringList UIVirtualBoxManagerAdvancedWidget::possibleGroupsForMachineToMove(const QUuid &uId)
    221195{
    222     return m_pPaneChooser->possibleGroupsForMachineToMove(uId);
     196    AssertPtrReturn(chooser(), QStringList());
     197    return chooser()->possibleGroupsForMachineToMove(uId);
    223198}
    224199
    225200QStringList UIVirtualBoxManagerAdvancedWidget::possibleGroupsForGroupToMove(const QString &strFullName)
    226201{
    227     return m_pPaneChooser->possibleGroupsForGroupToMove(strFullName);
     202    AssertPtrReturn(chooser(), QStringList());
     203    return chooser()->possibleGroupsForGroupToMove(strFullName);
    228204}
    229205
    230206void UIVirtualBoxManagerAdvancedWidget::refreshMachine()
    231207{
    232     m_pPaneChooser->refreshMachine();
     208    AssertPtrReturnVoid(chooser());
     209    chooser()->refreshMachine();
    233210}
    234211
    235212void UIVirtualBoxManagerAdvancedWidget::sortGroup()
    236213{
    237     m_pPaneChooser->sortGroup();
     214    AssertPtrReturnVoid(chooser());
     215    chooser()->sortGroup();
    238216}
    239217
    240218void UIVirtualBoxManagerAdvancedWidget::setMachineSearchWidgetVisibility(bool fVisible)
    241219{
    242     m_pPaneChooser->setMachineSearchWidgetVisibility(fVisible);
    243 }
    244 
    245 void UIVirtualBoxManagerAdvancedWidget::setToolsTypeGlobal(UIToolType enmType, bool fMakeSureItsVisible /* = false */)
    246 {
    247     /* Make sure global item is selected if requested: */
    248     if (fMakeSureItsVisible)
    249     {
    250         AssertPtrReturnVoid(m_pPaneChooser);
    251         m_pPaneChooser->setCurrentGlobal();
    252     }
    253 
    254     /* Change the tool to requested type: */
    255     AssertPtrReturnVoid(m_pMenuToolsGlobal);
    256     m_pMenuToolsGlobal->setToolsType(enmType);
     220    AssertPtrReturnVoid(chooser());
     221    chooser()->setMachineSearchWidgetVisibility(fVisible);
     222}
     223
     224void UIVirtualBoxManagerAdvancedWidget::setToolsTypeGlobal(UIToolType enmType, bool)
     225{
     226    AssertPtrReturnVoid(globalToolManager());
     227    globalToolManager()->setMenuToolType(enmType);
    257228}
    258229
    259230UIToolType UIVirtualBoxManagerAdvancedWidget::toolsTypeGlobal() const
    260231{
    261     return m_pMenuToolsGlobal ? m_pMenuToolsGlobal->toolsType() : UIToolType_Invalid;
     232    AssertPtrReturn(globalToolManager(), UIToolType_Invalid);
     233    return globalToolManager()->menuToolType();
    262234}
    263235
    264236void UIVirtualBoxManagerAdvancedWidget::setToolsTypeMachine(UIToolType enmType)
    265237{
    266     /* Change the tool to requested type: */
    267     AssertPtrReturnVoid(m_pMenuToolsMachine);
    268     m_pMenuToolsMachine->setToolsType(enmType);
     238    AssertPtrReturnVoid(machineToolManager());
     239    machineToolManager()->setMenuToolType(enmType);
    269240}
    270241
    271242UIToolType UIVirtualBoxManagerAdvancedWidget::toolsTypeMachine() const
    272243{
    273     return m_pMenuToolsMachine ? m_pMenuToolsMachine->toolsType() : UIToolType_Invalid;
     244    AssertPtrReturn(machineToolManager(), UIToolType_Invalid);
     245    return machineToolManager()->menuToolType();
    274246}
    275247
    276248UIToolType UIVirtualBoxManagerAdvancedWidget::currentGlobalTool() const
    277249{
    278     return m_pPaneToolsGlobal ? m_pPaneToolsGlobal->currentTool() : UIToolType_Invalid;
     250    AssertPtrReturn(globalToolManager(), UIToolType_Invalid);
     251    return globalToolManager()->toolType();
    279252}
    280253
    281254UIToolType UIVirtualBoxManagerAdvancedWidget::currentMachineTool() const
    282255{
    283     return m_pPaneToolsMachine ? m_pPaneToolsMachine->currentTool() : UIToolType_Invalid;
     256    AssertPtrReturn(machineToolManager(), UIToolType_Invalid);
     257    return machineToolManager()->toolType();
    284258}
    285259
    286260bool UIVirtualBoxManagerAdvancedWidget::isGlobalToolOpened(UIToolType enmType) const
    287261{
    288     return m_pPaneToolsGlobal ? m_pPaneToolsGlobal->isToolOpened(enmType) : false;
     262    AssertPtrReturn(globalToolManager(), false);
     263    return globalToolManager()->isToolOpened(enmType);
    289264}
    290265
    291266bool UIVirtualBoxManagerAdvancedWidget::isMachineToolOpened(UIToolType enmType) const
    292267{
    293     return m_pPaneToolsMachine ? m_pPaneToolsMachine->isToolOpened(enmType) : false;
    294 }
    295 
    296 void UIVirtualBoxManagerAdvancedWidget::switchGlobalToolTo(UIToolType enmType)
    297 {
    298     /* Open corresponding tool: */
    299     m_pPaneToolsGlobal->openTool(enmType);
    300 
    301     /* Let the parent know: */
    302     emit sigToolTypeChangeGlobal();
    303 
    304     /* Update toolbar: */
    305     updateToolbar();
    306 
    307     /* Handle current tool type change: */
    308     handleCurrentToolTypeChange(enmType);
    309 }
    310 
    311 void UIVirtualBoxManagerAdvancedWidget::switchMachineToolTo(UIToolType enmType)
    312 {
    313     /* Open corresponding tool: */
    314     m_pPaneToolsMachine->openTool(enmType);
    315 
    316     /* Let the parent know: */
    317     emit sigToolTypeChangeMachine();
    318 
    319     /* Update toolbar: */
    320     updateToolbar();
    321 
    322     /* Handle current tool type change: */
    323     handleCurrentToolTypeChange(enmType);
     268    AssertPtrReturn(machineToolManager(), false);
     269    return machineToolManager()->isToolOpened(enmType);
    324270}
    325271
    326272void UIVirtualBoxManagerAdvancedWidget::closeGlobalTool(UIToolType enmType)
    327273{
    328     m_pPaneToolsGlobal->closeTool(enmType);
     274    AssertPtrReturnVoid(globalToolManager());
     275    globalToolManager()->closeTool(enmType);
    329276}
    330277
    331278void UIVirtualBoxManagerAdvancedWidget::closeMachineTool(UIToolType enmType)
    332279{
    333     m_pPaneToolsMachine->closeTool(enmType);
     280    AssertPtrReturnVoid(machineToolManager());
     281    machineToolManager()->closeTool(enmType);
    334282}
    335283
    336284bool UIVirtualBoxManagerAdvancedWidget::isCurrentStateItemSelected() const
    337285{
    338     return m_pPaneToolsMachine->isCurrentStateItemSelected();
     286    AssertPtrReturn(machineToolPane(), false);
     287    return machineToolPane()->isCurrentStateItemSelected();
    339288}
    340289
    341290QUuid UIVirtualBoxManagerAdvancedWidget::currentSnapshotId()
    342291{
    343     return m_pPaneToolsMachine->currentSnapshotId();
     292    AssertPtrReturn(machineToolPane(), QUuid());
     293    return machineToolPane()->currentSnapshotId();
    344294}
    345295
    346296QString UIVirtualBoxManagerAdvancedWidget::currentHelpKeyword() const
    347297{
    348     QString strHelpKeyword;
    349     if (isGlobalItemSelected())
    350         strHelpKeyword = m_pPaneToolsGlobal->currentHelpKeyword();
    351     else if (isMachineItemSelected())
    352         strHelpKeyword = m_pPaneToolsMachine->currentHelpKeyword();
    353     return strHelpKeyword;
     298    AssertPtrReturn(globalToolManager(), QString());
     299    return globalToolManager()->currentHelpKeyword();
    354300}
    355301
     
    384330}
    385331
    386 void UIVirtualBoxManagerAdvancedWidget::sltRetranslateUI()
    387 {
    388     /* Make sure chosen item fetched: */
    389     sltHandleChooserPaneIndexChange();
    390 }
    391 
    392332void UIVirtualBoxManagerAdvancedWidget::sltHandleCommitData()
    393333{
    394     // WORKAROUND:
    395     // This will be fixed proper way during session management cleanup for Qt6.
    396     // But for now we will just cleanup connections which is Ok anyway.
    397334    cleanupConnections();
    398335}
    399336
    400 void UIVirtualBoxManagerAdvancedWidget::sltHandleMachineStateChange(const QUuid &uId)
    401 {
    402     // WORKAROUND:
    403     // In certain intermediate states VM info can be NULL which
    404     // causing annoying assertions, such updates can be ignored?
    405     CVirtualBox comVBox = gpGlobalSession->virtualBox();
    406     CMachine comMachine = comVBox.FindMachine(uId.toString());
    407     if (comVBox.isOk() && comMachine.isNotNull())
    408     {
    409         switch (comMachine.GetState())
    410         {
    411             case KMachineState_DeletingSnapshot:
    412                 return;
    413             default:
    414                 break;
    415         }
    416     }
    417 
    418     /* Recache current machine item information: */
    419     recacheCurrentMachineItemInformation();
    420 }
    421 
    422 void UIVirtualBoxManagerAdvancedWidget::sltHandleSettingsExpertModeChange()
     337void UIVirtualBoxManagerAdvancedWidget::sltUpdateToolbar()
    423338{
    424339    /* Update toolbar to show/hide corresponding actions: */
    425340    updateToolbar();
    426 
    427     /* Update tools restrictions for currently selected item: */
    428     if (currentItem())
    429         updateToolsMenuMachine(currentItem());
    430     else
    431         updateToolsMenuGlobal();
    432 }
    433 
    434 void UIVirtualBoxManagerAdvancedWidget::sltHandleSplitterMove()
    435 {
    436     /* Create timer if isn't exist already: */
    437     if (!m_pSplitterSettingsSaveTimer)
    438     {
    439         m_pSplitterSettingsSaveTimer = new QTimer(this);
    440         if (m_pSplitterSettingsSaveTimer)
    441         {
    442             m_pSplitterSettingsSaveTimer->setInterval(300);
    443             m_pSplitterSettingsSaveTimer->setSingleShot(true);
    444             connect(m_pSplitterSettingsSaveTimer, &QTimer::timeout,
    445                     this, &UIVirtualBoxManagerAdvancedWidget::sltSaveSplitterSettings);
    446         }
    447     }
    448     /* [Re]start timer finally: */
    449     m_pSplitterSettingsSaveTimer->start();
    450 }
    451 
    452 void UIVirtualBoxManagerAdvancedWidget::sltSaveSplitterSettings()
    453 {
    454     const QList<int> splitterSizes = m_pSplitter->sizes();
    455     LogRel2(("GUI: UIVirtualBoxManagerAdvancedWidget: Saving splitter as: Size=%d,%d\n",
    456              splitterSizes.at(0), splitterSizes.at(1)));
    457     gEDataManager->setSelectorWindowSplitterHints(splitterSizes);
    458 }
    459 
    460 void UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarResize(const QSize &newSize)
    461 {
    462     emit sigToolBarHeightChange(newSize.height());
    463 }
    464 
    465 void UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneIndexChange()
    466 {
    467     /* Let the parent know: */
    468     emit sigChooserPaneIndexChange();
    469 
    470     /* If global item is selected and we are on machine tools pane => switch to global tools pane: */
    471     if (   isGlobalItemSelected()
    472         && m_pStackedWidget->currentWidget() != m_pPaneToolsGlobal)
    473     {
    474         m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal);
    475         m_pPaneToolsMachine->setActive(false);
    476         m_pPaneToolsGlobal->setActive(true);
    477         /* Handle current tool type change: */
    478         handleCurrentToolTypeChange(m_pMenuToolsGlobal->toolsType());
    479     }
    480 
    481     else
    482 
    483     /* If machine or group item is selected and we are on global tools pane => switch to machine tools pane: */
    484     if (   (isMachineItemSelected() || isGroupItemSelected())
    485         && m_pStackedWidget->currentWidget() != m_pPaneToolsMachine)
    486     {
    487         m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine);
    488         m_pPaneToolsGlobal->setActive(false);
    489         m_pPaneToolsMachine->setActive(true);
    490         /* Handle current tool type change: */
    491         handleCurrentToolTypeChange(m_pMenuToolsMachine->toolsType());
    492     }
    493 
    494     /* Update tools restrictions for currently selected item: */
    495     UIVirtualMachineItem *pItem = currentItem();
    496     if (pItem)
    497         updateToolsMenuMachine(pItem);
    498     else
    499         updateToolsMenuGlobal();
    500 
    501     /* Recache current machine item information: */
    502     recacheCurrentMachineItemInformation();
    503 
    504     /* Calculate new selection type and item accessibility status: */
    505     const SelectionType enmSelectedItemType = selectionType();
    506     const bool fCurrentItemIsOk = isItemAccessible();
    507 
    508     /* Update toolbar if selection type or item accessibility status got changed: */
    509     if (   m_enmSelectionType != enmSelectedItemType
    510         || m_fSelectedMachineItemAccessible != fCurrentItemIsOk)
    511         updateToolbar();
    512 
    513     /* Remember selection type and item accessibility status: */
    514     m_enmSelectionType = enmSelectedItemType;
    515     m_fSelectedMachineItemAccessible = fCurrentItemIsOk;
    516 }
    517 
    518 void UIVirtualBoxManagerAdvancedWidget::sltHandleCloudProfileStateChange(const QString &strProviderShortName,
    519                                                                          const QString &strProfileName)
    520 {
    521     RT_NOREF(strProviderShortName, strProfileName);
    522 
    523     /* If Global Activity Overview tool is currently chosen: */
    524     if (   m_pStackedWidget->currentWidget() == m_pPaneToolsGlobal
    525         && m_pPaneToolsGlobal->currentTool() == UIToolType_Activities)
    526         m_pPaneToolsGlobal->setCloudMachineItems(m_pPaneChooser->cloudMachineItems());
    527 }
    528 
    529 void UIVirtualBoxManagerAdvancedWidget::sltHandleCloudMachineStateChange(const QUuid &uId)
    530 {
    531     /* Not for global items: */
    532     if (isGlobalItemSelected())
    533         return;
    534 
    535     /* Acquire current item: */
    536     UIVirtualMachineItem *pItem = currentItem();
    537     const bool fCurrentItemIsOk = isItemAccessible(pItem);
    538 
    539     /* If current item is Ok: */
    540     if (fCurrentItemIsOk)
    541     {
    542         /* If Error-pane is chosen currently => switch to tool currently chosen in Tools-menu: */
    543         if (m_pPaneToolsMachine->currentTool() == UIToolType_Error)
    544             switchMachineToolTo(m_pMenuToolsMachine->toolsType());
    545 
    546         /* If we still have same item selected: */
    547         if (pItem && pItem->id() == uId)
    548         {
    549             /* Propagate current items to update the Details-pane: */
    550             m_pPaneToolsMachine->setItems(currentItems());
    551         }
    552     }
    553     else
    554     {
    555         /* Make sure Error pane raised: */
    556         if (m_pPaneToolsMachine->currentTool() != UIToolType_Error)
    557             m_pPaneToolsMachine->openTool(UIToolType_Error);
    558 
    559         /* If we still have same item selected: */
    560         if (pItem && pItem->id() == uId)
    561         {
    562             /* Propagate current items to update the Details-pane (in any case): */
    563             m_pPaneToolsMachine->setItems(currentItems());
    564             /* Propagate last access error to update the Error-pane (if machine selected but inaccessible): */
    565             m_pPaneToolsMachine->setErrorDetails(pItem->accessError());
    566         }
    567     }
    568 
    569     /* Pass the signal further: */
    570     emit sigCloudMachineStateChange(uId);
    571 }
    572 
    573 void UIVirtualBoxManagerAdvancedWidget::sltHandleToolMenuRequested(const QPoint &position, UIVirtualMachineItem *pItem)
    574 {
    575     /* Update tools menu beforehand: */
    576     UITools *pMenu = pItem ? m_pMenuToolsMachine : m_pMenuToolsGlobal;
    577     AssertPtrReturnVoid(pMenu);
    578     if (pItem)
    579         updateToolsMenuMachine(pItem);
    580     else
    581         updateToolsMenuGlobal();
    582 
    583     /* Compose popup-menu geometry first of all: */
    584     QRect ourGeo = QRect(position, pMenu->minimumSizeHint());
    585     /* Adjust location only to properly fit into available geometry space: */
    586     const QRect availableGeo = gpDesktop->availableGeometry(position);
    587     ourGeo = gpDesktop->normalizeGeometry(ourGeo, availableGeo, false /* resize? */);
    588 
    589     /* Move, resize and show: */
    590     pMenu->move(ourGeo.topLeft());
    591     pMenu->show();
    592     // WORKAROUND:
    593     // Don't want even to think why, but for Qt::Popup resize to
    594     // smaller size often being ignored until it is actually shown.
    595     pMenu->resize(ourGeo.size());
    596 }
    597 
    598 void UIVirtualBoxManagerAdvancedWidget::sltSwitchToMachineActivityPane(const QUuid &uMachineId)
    599 {
    600     AssertPtrReturnVoid(m_pPaneChooser);
    601     AssertPtrReturnVoid(m_pMenuToolsMachine);
    602     m_pPaneChooser->setCurrentMachine(uMachineId);
    603     m_pMenuToolsMachine->setToolsType(UIToolType_VMActivity);
    604 }
    605 
    606 void UIVirtualBoxManagerAdvancedWidget::sltSwitchToActivityOverviewPane()
    607 {
    608     AssertPtrReturnVoid(m_pPaneChooser);
    609     AssertPtrReturnVoid(m_pMenuToolsGlobal);
    610     m_pMenuToolsGlobal->setToolsType(UIToolType_Activities);
    611     m_pPaneChooser->setCurrentGlobal();
    612341}
    613342
     
    620349    /* Load settings: */
    621350    loadSettings();
    622 
    623     /* Translate UI: */
    624     sltRetranslateUI();
    625     connect(&translationEventListener(), &UITranslationEventListener::sigRetranslateUI,
    626             this, &UIVirtualBoxManagerAdvancedWidget::sltRetranslateUI);
    627 
    628     /* Make sure current Chooser-pane index fetched: */
    629     sltHandleChooserPaneIndexChange();
    630351}
    631352
    632353void UIVirtualBoxManagerAdvancedWidget::prepareWidgets()
    633354{
    634     /* Create main-layout: */
    635     QHBoxLayout *pLayoutMain = new QHBoxLayout(this);
    636     if (pLayoutMain)
     355    /* Create layout: */
     356    QVBoxLayout *pLayout = new QVBoxLayout(this);
     357    if(pLayout)
    637358    {
    638359        /* Configure layout: */
    639         pLayoutMain->setSpacing(0);
    640         pLayoutMain->setContentsMargins(0, 0, 0, 0);
    641 
    642         /* Create splitter: */
    643         m_pSplitter = new QISplitter;
    644         if (m_pSplitter)
    645         {
    646             /* Create Chooser-pane: */
    647             m_pPaneChooser = new UIChooser(this, actionPool());
    648             if (m_pPaneChooser)
     360        pLayout->setContentsMargins(0, 0, 0, 0);
     361
     362        /* Create Main toolbar: */
     363        m_pToolBar = new QIToolBar(this);
     364        if (m_pToolBar)
     365        {
     366            /* Configure toolbar: */
     367            const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
     368            m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
     369            m_pToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
     370            m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
     371            m_pToolBar->setUseTextLabels(true);
     372
     373#if defined(VBOX_WS_MAC) && (defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32))
     374            /* Check whether we should show Dev Preview tag: */
     375            bool fShowDevPreviewTag = false;
     376            const CVirtualBox comVBox = gpGlobalSession->virtualBox();
     377            if (comVBox.isNotNull())
    649378            {
    650                 /* Add into splitter: */
    651                 m_pSplitter->addWidget(m_pPaneChooser);
     379                const CSystemProperties comSystemProps = comVBox.GetSystemProperties();
     380                if (comVBox.isOk() && comSystemProps.isNotNull())
     381                    fShowDevPreviewTag =
     382                        comSystemProps.GetSupportedPlatformArchitectures().contains(KPlatformArchitecture_x86);
    652383            }
    653 
    654             /* Create right widget: */
    655             QWidget *pWidgetRight = new QWidget;
    656             if (pWidgetRight)
     384            /* Enable Dev Preview tag: */
     385            if (fShowDevPreviewTag)
    657386            {
    658                 /* Create right-layout: */
    659                 QVBoxLayout *pLayoutRight = new QVBoxLayout(pWidgetRight);
    660                 if(pLayoutRight)
    661                 {
    662                     /* Configure layout: */
    663                     pLayoutRight->setSpacing(0);
    664                     pLayoutRight->setContentsMargins(0, 0, 0, 0);
    665 
    666                     /* Create Main toolbar: */
    667                     m_pToolBar = new QIToolBar;
    668                     if (m_pToolBar)
    669                     {
    670                         /* Configure toolbar: */
    671                         const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
    672                         m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    673                         m_pToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    674                         m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
    675                         m_pToolBar->setUseTextLabels(true);
    676 
    677 #if defined(VBOX_WS_MAC) && (defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32))
    678                         /* Check whether we should show Dev Preview tag: */
    679                         bool fShowDevPreviewTag = false;
    680                         const CVirtualBox comVBox = gpGlobalSession->virtualBox();
    681                         if (comVBox.isNotNull())
    682                         {
    683                             const CSystemProperties comSystemProps = comVBox.GetSystemProperties();
    684                             if (comVBox.isOk() && comSystemProps.isNotNull())
    685                                 fShowDevPreviewTag =
    686                                     comSystemProps.GetSupportedPlatformArchitectures().contains(KPlatformArchitecture_x86);
    687                         }
    688                         /* Enable Dev Preview tag: */
    689                         if (fShowDevPreviewTag)
    690                         {
    691                             m_pToolBar->emulateMacToolbar();
    692                             m_pToolBar->enableBranding(UIIconPool::iconSet(":/explosion_hazard_32px.png"),
    693                                                        "Dev Preview", // do we need to make it NLS?
    694                                                        QColor(246, 179, 0),
    695                                                        74 /* width of BETA label */);
    696                         }
     387                m_pToolBar->emulateMacToolbar();
     388                m_pToolBar->enableBranding(UIIconPool::iconSet(":/explosion_hazard_32px.png"),
     389                                           "Dev Preview", // do we need to make it NLS?
     390                                           QColor(246, 179, 0),
     391                                           74 /* width of BETA label */);
     392            }
    697393#endif /* VBOX_WS_MAC && (RT_ARCH_ARM64 || RT_ARCH_ARM32) */
    698394
    699                         /* Add toolbar into layout: */
    700                         pLayoutRight->addWidget(m_pToolBar);
    701                     }
    702 
    703                     /* Create stacked-widget: */
    704                     m_pStackedWidget = new QStackedWidget;
    705                     if (m_pStackedWidget)
    706                     {
    707                         /* Create Global Tools-pane: */
    708                         m_pPaneToolsGlobal = new UIToolPaneGlobal(actionPool());
    709                         if (m_pPaneToolsGlobal)
    710                         {
    711                             if (m_pPaneChooser->isGlobalItemSelected())
    712                                 m_pPaneToolsGlobal->setActive(true);
    713                             connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCreateMedium,
    714                                     this, &UIVirtualBoxManagerAdvancedWidget::sigCreateMedium);
    715                             connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCopyMedium,
    716                                     this, &UIVirtualBoxManagerAdvancedWidget::sigCopyMedium);
    717                             connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigSwitchToMachineActivityPane,
    718                                     this, &UIVirtualBoxManagerAdvancedWidget::sltSwitchToMachineActivityPane);
    719 
    720                             /* Add into stack: */
    721                             m_pStackedWidget->addWidget(m_pPaneToolsGlobal);
    722                         }
    723 
    724                         /* Create Machine Tools-pane: */
    725                         m_pPaneToolsMachine = new UIToolPaneMachine(actionPool());
    726                         if (m_pPaneToolsMachine)
    727                         {
    728                             if (!m_pPaneChooser->isGlobalItemSelected())
    729                                 m_pPaneToolsMachine->setActive(true);
    730                             connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigCurrentSnapshotItemChange,
    731                                     this, &UIVirtualBoxManagerAdvancedWidget::sigCurrentSnapshotItemChange);
    732                             connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigSwitchToActivityOverviewPane,
    733                                     this, &UIVirtualBoxManagerAdvancedWidget::sltSwitchToActivityOverviewPane);
    734                             connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigDetachToolPane,
    735                                     this, &UIVirtualBoxManagerAdvancedWidget::sigDetachToolPane);
    736 
    737                             /* Add into stack: */
    738                             m_pStackedWidget->addWidget(m_pPaneToolsMachine);
    739                         }
    740 
    741                         /* Choose which pane should be active initially: */
    742                         if (m_pPaneChooser->isGlobalItemSelected())
    743                             m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal);
    744                         else
    745                             m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine);
    746 
    747                         /* Add into layout: */
    748                         pLayoutRight->addWidget(m_pStackedWidget, 1);
    749                     }
    750                 }
    751 
    752                 /* Add into splitter: */
    753                 m_pSplitter->addWidget(pWidgetRight);
    754             }
    755 
    756             /* Set the initial distribution. The right site is bigger. */
    757             m_pSplitter->setStretchFactor(0, 2);
    758             m_pSplitter->setStretchFactor(1, 3);
    759 
     395            /* Add toolbar into layout: */
     396            pLayout->addWidget(m_pToolBar);
     397        }
     398
     399        /* Create Global Tool Manager: */
     400        m_pGlobalToolManager = new UIGlobalToolsManagerWidget(this, actionPool());
     401        if (globalToolManager())
     402        {
    760403            /* Add into layout: */
    761             pLayoutMain->addWidget(m_pSplitter);
    762         }
    763 
    764         /* Create Global Tools-menu: */
    765         m_pMenuToolsGlobal = new UITools(this, UIToolClass_Global, actionPool());
    766         /* Create Machine Tools-menu: */
    767         m_pMenuToolsMachine = new UITools(this, UIToolClass_Machine, actionPool());
     404            pLayout->addWidget(globalToolManager());
     405        }
    768406    }
    769407
     
    775413
    776414    /* Bring the VM list to the focus: */
    777     m_pPaneChooser->setFocus();
     415    chooser()->setFocus();
    778416}
    779417
     
    784422            this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCommitData);
    785423
    786     /* Global VBox event handlers: */
    787     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange,
    788             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleMachineStateChange);
    789 
    790     /* Global VBox extra-data event handlers: */
     424    /* Global COM event handlers: */
    791425    connect(gEDataManager, &UIExtraDataManager::sigSettingsExpertModeChange,
    792             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleSettingsExpertModeChange);
    793 
    794     /* Splitter connections: */
    795     connect(m_pSplitter, &QISplitter::splitterMoved,
    796             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleSplitterMove);
     426            this, &UIVirtualBoxManagerAdvancedWidget::sltUpdateToolbar);
    797427
    798428    /* Tool-bar connections: */
    799429    connect(m_pToolBar, &QIToolBar::customContextMenuRequested,
    800430            this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarContextMenuRequest);
    801     connect(m_pToolBar, &QIToolBar::sigResized,
    802             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarResize);
     431
     432    /* Global Tool Manager connections: */
     433    connect(globalToolManager(), &UIGlobalToolsManagerWidget::sigToolTypeChange,
     434            this, &UIVirtualBoxManagerAdvancedWidget::sltUpdateToolbar);
     435    connect(globalToolManager(), &UIGlobalToolsManagerWidget::sigToolTypeChange,
     436            this, &UIVirtualBoxManagerAdvancedWidget::sigToolTypeChangeGlobal);
     437    /* Global Tool Pane connections: */
     438    connect(globalToolPane(), &UIToolPaneGlobal::sigCreateMedium,
     439            this, &UIVirtualBoxManagerAdvancedWidget::sigCreateMedium);
     440    connect(globalToolPane(), &UIToolPaneGlobal::sigCopyMedium,
     441            this, &UIVirtualBoxManagerAdvancedWidget::sigCopyMedium);
     442
     443    /* Machine Tool Manager connections: */
     444    connect(machineToolManager(), &UIMachineManagerWidget::sigToolTypeChange,
     445            this, &UIVirtualBoxManagerAdvancedWidget::sigToolTypeChangeMachine);
     446    connect(machineToolManager(), &UIMachineManagerWidget::sigChooserPaneIndexChange,
     447            this, &UIVirtualBoxManagerAdvancedWidget::sigChooserPaneIndexChange);
     448    connect(machineToolManager(), &UIMachineManagerWidget::sigChooserPaneSelectionChange,
     449            this, &UIVirtualBoxManagerAdvancedWidget::sltUpdateToolbar);
     450    connect(machineToolManager(), &UIMachineManagerWidget::sigCloudMachineStateChange,
     451            this, &UIVirtualBoxManagerAdvancedWidget::sigCloudMachineStateChange);
     452    /* Machine Tool Pane connections: */
     453    connect(machineToolPane(), &UIToolPaneMachine::sigLinkClicked,
     454            this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSettingsLinkClicked);
     455    connect(machineToolPane(), &UIToolPaneMachine::sigCurrentSnapshotItemChange,
     456            this, &UIVirtualBoxManagerAdvancedWidget::sigCurrentSnapshotItemChange);
     457    connect(machineToolPane(), &UIToolPaneMachine::sigDetachToolPane,
     458            this, &UIVirtualBoxManagerAdvancedWidget::sigDetachToolPane);
    803459
    804460    /* Chooser-pane connections: */
    805     connect(m_pPaneChooser, &UIChooser::sigSelectionChanged,
    806             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneIndexChange);
    807     connect(m_pPaneChooser, &UIChooser::sigSelectionInvalidated,
    808             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneSelectionInvalidated);
    809     connect(m_pPaneChooser, &UIChooser::sigToggleStarted,
    810             m_pPaneToolsMachine, &UIToolPaneMachine::sigToggleStarted);
    811     connect(m_pPaneChooser, &UIChooser::sigToggleFinished,
    812             m_pPaneToolsMachine, &UIToolPaneMachine::sigToggleFinished);
    813     connect(m_pPaneChooser, &UIChooser::sigGroupSavingStateChanged,
     461    connect(chooser(), &UIChooser::sigGroupSavingStateChanged,
    814462            this, &UIVirtualBoxManagerAdvancedWidget::sigGroupSavingStateChanged);
    815     connect(m_pPaneChooser, &UIChooser::sigCloudUpdateStateChanged,
     463    connect(chooser(), &UIChooser::sigCloudUpdateStateChanged,
    816464            this, &UIVirtualBoxManagerAdvancedWidget::sigCloudUpdateStateChanged);
    817     connect(m_pPaneChooser, &UIChooser::sigToolMenuRequested,
    818             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolMenuRequested);
    819     connect(m_pPaneChooser, &UIChooser::sigCloudProfileStateChange,
    820             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCloudProfileStateChange);
    821     connect(m_pPaneChooser, &UIChooser::sigCloudMachineStateChange,
    822             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCloudMachineStateChange);
    823     connect(m_pPaneChooser, &UIChooser::sigStartOrShowRequest,
     465    connect(chooser(), &UIChooser::sigStartOrShowRequest,
    824466            this, &UIVirtualBoxManagerAdvancedWidget::sigStartOrShowRequest);
    825     connect(m_pPaneChooser, &UIChooser::sigMachineSearchWidgetVisibilityChanged,
     467    connect(chooser(), &UIChooser::sigMachineSearchWidgetVisibilityChanged,
    826468            this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSearchWidgetVisibilityChanged);
    827 
    828     /* Details-pane connections: */
    829     connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigLinkClicked,
    830             this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSettingsLinkClicked);
    831 
    832     /* Tools-pane connections: */
    833     connect(m_pMenuToolsGlobal, &UITools::sigSelectionChanged,
    834             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleGlobalToolsMenuIndexChange);
    835     connect(m_pMenuToolsMachine, &UITools::sigSelectionChanged,
    836             this, &UIVirtualBoxManagerAdvancedWidget::sltHandleMachineToolsMenuIndexChange);
    837469}
    838470
    839471void UIVirtualBoxManagerAdvancedWidget::loadSettings()
    840472{
    841     /* Restore splitter handle position: */
     473    /* Make sure stuff exists: */
     474    AssertPtrReturnVoid(m_pToolBar);
     475    m_pToolBar->setUseTextLabels(gEDataManager->selectorWindowToolBarTextVisible());
     476}
     477
     478void UIVirtualBoxManagerAdvancedWidget::updateToolbar()
     479{
     480    /* Make sure stuff exists: */
     481    AssertPtrReturnVoid(m_pToolBar);
     482    AssertPtrReturnVoid(globalToolManager());
     483    AssertPtrReturnVoid(machineToolManager());
     484
     485    /* Clear toolbar initially: */
     486    m_pToolBar->clear();
     487
     488    switch (globalToolManager()->toolType())
    842489    {
    843         QList<int> sizes = gEDataManager->selectorWindowSplitterHints();
    844         /* If both hints are zero, we have the 'default' case: */
    845         if (sizes.at(0) == 0 && sizes.at(1) == 0)
    846         {
    847             sizes[0] = (int)(width() * .9 * (1.0 / 3));
    848             sizes[1] = (int)(width() * .9 * (2.0 / 3));
    849         }
    850         LogRel2(("GUI: UIVirtualBoxManagerAdvancedWidget: Restoring splitter to: Size=%d,%d\n",
    851                  sizes.at(0), sizes.at(1)));
    852         m_pSplitter->setSizes(sizes);
    853     }
    854 
    855     /* Restore toolbar settings: */
    856     {
    857         m_pToolBar->setUseTextLabels(gEDataManager->selectorWindowToolBarTextVisible());
    858     }
    859 
    860     /* Open tools last chosen in Tools-menu: */
    861     switchGlobalToolTo(m_pMenuToolsGlobal->toolsType());
    862     switchMachineToolTo(m_pMenuToolsMachine->toolsType());
    863 }
    864 
    865 void UIVirtualBoxManagerAdvancedWidget::updateToolbar()
    866 {
    867     /* Make sure toolbar exists: */
    868     AssertPtrReturnVoid(m_pToolBar);
    869 
    870     /* Clear initially: */
    871     m_pToolBar->clear();
    872 
    873     /* If global item selected: */
    874     if (isGlobalItemSelected())
    875     {
    876         switch (currentGlobalTool())
    877         {
    878             case UIToolType_Welcome:
     490        case UIToolType_Welcome:
     491        {
     492            m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences));
     493            m_pToolBar->addSeparator();
     494            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_File_S_ImportAppliance));
     495            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_File_S_ExportAppliance));
     496            m_pToolBar->addSeparator();
     497            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Welcome_S_New));
     498            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Welcome_S_Add));
     499            break;
     500        }
     501        case UIToolType_Extensions:
     502        {
     503            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Extension_S_Install));
     504            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Extension_S_Uninstall));
     505            break;
     506        }
     507        case UIToolType_Media:
     508        {
     509            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Add));
     510            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Create));
     511            m_pToolBar->addSeparator();
     512            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Copy));
     513            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Move));
     514            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Remove));
     515            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Release));
     516            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Clear));
     517            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_T_Search));
     518            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_T_Details));
     519            m_pToolBar->addSeparator();
     520            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Refresh));
     521            break;
     522        }
     523        case UIToolType_Network:
     524        {
     525            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Create));
     526            m_pToolBar->addSeparator();
     527            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Remove));
     528            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_T_Details));
     529            //m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Refresh));
     530            break;
     531        }
     532        case UIToolType_Cloud:
     533        {
     534            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Add));
     535            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Import));
     536            m_pToolBar->addSeparator();
     537            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Remove));
     538            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_T_Details));
     539            m_pToolBar->addSeparator();
     540            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_TryPage));
     541            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Help));
     542            break;
     543        }
     544        case UIToolType_Activities:
     545        {
     546            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_M_Columns));
     547            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_S_SwitchToMachineActivity));
     548            QToolButton *pButton =
     549                qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_M_Columns)));
     550            if (pButton)
    879551            {
    880                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences));
    881                 m_pToolBar->addSeparator();
    882                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_File_S_ImportAppliance));
    883                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_File_S_ExportAppliance));
    884                 m_pToolBar->addSeparator();
    885                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Welcome_S_New));
    886                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Welcome_S_Add));
    887                 break;
     552                pButton->setPopupMode(QToolButton::InstantPopup);
     553                pButton->setAutoRaise(true);
    888554            }
    889             case UIToolType_Extensions:
     555            break;
     556        }
     557        case UIToolType_Machines:
     558        {
     559            switch (machineToolManager()->toolType())
    890560            {
    891                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Extension_S_Install));
    892                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Extension_S_Uninstall));
    893                 break;
    894             }
    895             case UIToolType_Media:
    896             {
    897                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Add));
    898                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Create));
    899                 m_pToolBar->addSeparator();
    900                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Copy));
    901                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Move));
    902                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Remove));
    903                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Release));
    904                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Clear));
    905                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_T_Search));
    906                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_T_Details));
    907                 m_pToolBar->addSeparator();
    908                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Refresh));
    909                 break;
    910             }
    911             case UIToolType_Network:
    912             {
    913                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Create));
    914                 m_pToolBar->addSeparator();
    915                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Remove));
    916                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_T_Details));
    917                 //m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Refresh));
    918                 break;
    919             }
    920             case UIToolType_Cloud:
    921             {
    922                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Add));
    923                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Import));
    924                 m_pToolBar->addSeparator();
    925                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Remove));
    926                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_T_Details));
    927                 m_pToolBar->addSeparator();
    928                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_TryPage));
    929                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Help));
    930                 break;
    931             }
    932             case UIToolType_Activities:
    933             {
    934                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_M_Columns));
    935                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_S_SwitchToMachineActivity));
    936                 QToolButton *pButton =
    937                     qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_M_Columns)));
    938                 if (pButton)
     561                case UIToolType_Details:
    939562                {
    940                     pButton->setPopupMode(QToolButton::InstantPopup);
    941                     pButton->setAutoRaise(true);
     563                    if (isSingleGroupSelected())
     564                    {
     565                        m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_New));
     566                        m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Add));
     567                        m_pToolBar->addSeparator();
     568                        if (isSingleLocalGroupSelected())
     569                            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard));
     570                        else if (   isSingleCloudProviderGroupSelected()
     571                                 || isSingleCloudProfileGroupSelected())
     572                            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_Stop_S_Terminate));
     573                        m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow));
     574                    }
     575                    else
     576                    {
     577                        m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_New));
     578                        m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Add));
     579                        m_pToolBar->addSeparator();
     580                        m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
     581                        if (isLocalMachineItemSelected())
     582                            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
     583                        else if (isCloudMachineItemSelected())
     584                            m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_Stop_S_Terminate));
     585                        m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     586                    }
     587                    break;
    942588                }
    943                 break;
    944             }
    945 
    946             default:
    947                 break;
    948         }
    949     }
    950 
    951     else
    952 
    953     /* If machine or group item selected: */
    954     if (isMachineItemSelected() || isGroupItemSelected())
    955     {
    956         switch (currentMachineTool())
    957         {
    958             case UIToolType_Details:
    959             {
    960                 if (isSingleGroupSelected())
     589                case UIToolType_Snapshots:
    961590                {
    962                     m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_New));
    963                     m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Add));
     591                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Take));
     592                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Delete));
     593                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Restore));
     594                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_T_Properties));
     595                    if (gEDataManager->isSettingsInExpertMode())
     596                        m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Clone));
    964597                    m_pToolBar->addSeparator();
    965                     if (isSingleLocalGroupSelected())
    966                         m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard));
    967                     else if (   isSingleCloudProviderGroupSelected()
    968                              || isSingleCloudProfileGroupSelected())
    969                         m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_Stop_S_Terminate));
    970                     m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow));
     598                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
     599                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
     600                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     601                    break;
    971602                }
    972                 else
     603                case UIToolType_Logs:
     604                {
     605                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Save));
     606                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Find));
     607                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Filter));
     608                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Bookmark));
     609                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Preferences));
     610                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Refresh));
     611                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Reload));
     612                    m_pToolBar->addSeparator();
     613                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
     614                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
     615                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     616                    break;
     617                }
     618                case UIToolType_VMActivity:
     619                {
     620                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_S_Export));
     621                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_S_ToVMActivityOverview));
     622                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_T_Preferences));
     623                    m_pToolBar->addSeparator();
     624                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
     625                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
     626                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     627                    break;
     628                }
     629                case UIToolType_FileManager:
     630                {
     631                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Preferences));
     632                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Operations));
     633                    m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Log));
     634                    m_pToolBar->addSeparator();
     635                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
     636                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
     637                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     638                    break;
     639                }
     640                case UIToolType_Error:
    973641                {
    974642                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_New));
    975643                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Add));
    976644                    m_pToolBar->addSeparator();
    977                     m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
    978                     if (isLocalMachineItemSelected())
    979                         m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
    980                     else if (isCloudMachineItemSelected())
    981                         m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_Stop_S_Terminate));
    982                     m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     645                    m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh));
     646                    break;
    983647                }
    984                 break;
     648                default:
     649                    break;
    985650            }
    986             case UIToolType_Snapshots:
    987             {
    988                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Take));
    989                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Delete));
    990                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Restore));
    991                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_T_Properties));
    992                 if (gEDataManager->isSettingsInExpertMode())
    993                     m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Clone));
    994                 m_pToolBar->addSeparator();
    995                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
    996                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
    997                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
    998                 break;
    999             }
    1000             case UIToolType_Logs:
    1001             {
    1002                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Save));
    1003                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Find));
    1004                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Filter));
    1005                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Bookmark));
    1006                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Preferences));
    1007                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Refresh));
    1008                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Reload));
    1009                 m_pToolBar->addSeparator();
    1010                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
    1011                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
    1012                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
    1013                 break;
    1014             }
    1015             case UIToolType_VMActivity:
    1016             {
    1017                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_S_Export));
    1018                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_S_ToVMActivityOverview));
    1019                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_T_Preferences));
    1020                 m_pToolBar->addSeparator();
    1021                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
    1022                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
    1023                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
    1024                 break;
    1025             }
    1026             case UIToolType_FileManager:
    1027             {
    1028                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Preferences));
    1029                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Operations));
    1030                 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Log));
    1031                 m_pToolBar->addSeparator();
    1032                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
    1033                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
    1034                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
    1035                 break;
    1036             }
    1037             case UIToolType_Error:
    1038             {
    1039                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_New));
    1040                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Add));
    1041                 m_pToolBar->addSeparator();
    1042                 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh));
    1043                 break;
    1044             }
    1045             default:
    1046                 break;
    1047         }
     651            break;
     652        }
     653        default:
     654            break;
    1048655    }
    1049656}
     
    1051658void UIVirtualBoxManagerAdvancedWidget::cleanupConnections()
    1052659{
     660    /* Global COM event handlers: */
     661    disconnect(gEDataManager, &UIExtraDataManager::sigSettingsExpertModeChange,
     662               this, &UIVirtualBoxManagerAdvancedWidget::sltUpdateToolbar);
     663
    1053664    /* Tool-bar connections: */
    1054665    disconnect(m_pToolBar, &QIToolBar::customContextMenuRequested,
    1055666               this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarContextMenuRequest);
    1056     disconnect(m_pToolBar, &QIToolBar::sigResized,
    1057                this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarResize);
     667
     668    /* Global Tool Manager connections: */
     669    disconnect(globalToolManager(), &UIGlobalToolsManagerWidget::sigToolTypeChange,
     670               this, &UIVirtualBoxManagerAdvancedWidget::sltUpdateToolbar);
     671    disconnect(globalToolManager(), &UIGlobalToolsManagerWidget::sigToolTypeChange,
     672               this, &UIVirtualBoxManagerAdvancedWidget::sigToolTypeChangeGlobal);
     673    /* Global Tool Pane connections: */
     674    disconnect(globalToolPane(), &UIToolPaneGlobal::sigCreateMedium,
     675               this, &UIVirtualBoxManagerAdvancedWidget::sigCreateMedium);
     676    disconnect(globalToolPane(), &UIToolPaneGlobal::sigCopyMedium,
     677               this, &UIVirtualBoxManagerAdvancedWidget::sigCopyMedium);
     678
     679    /* Machine Tool Manager connections: */
     680    disconnect(machineToolManager(), &UIMachineManagerWidget::sigToolTypeChange,
     681               this, &UIVirtualBoxManagerAdvancedWidget::sigToolTypeChangeMachine);
     682    disconnect(machineToolManager(), &UIMachineManagerWidget::sigChooserPaneIndexChange,
     683               this, &UIVirtualBoxManagerAdvancedWidget::sigChooserPaneIndexChange);
     684    disconnect(machineToolManager(), &UIMachineManagerWidget::sigChooserPaneSelectionChange,
     685               this, &UIVirtualBoxManagerAdvancedWidget::sltUpdateToolbar);
     686    disconnect(machineToolManager(), &UIMachineManagerWidget::sigCloudMachineStateChange,
     687               this, &UIVirtualBoxManagerAdvancedWidget::sigCloudMachineStateChange);
     688    /* Machine Tool Pane connections: */
     689    disconnect(machineToolPane(), &UIToolPaneMachine::sigLinkClicked,
     690               this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSettingsLinkClicked);
     691    disconnect(machineToolPane(), &UIToolPaneMachine::sigCurrentSnapshotItemChange,
     692               this, &UIVirtualBoxManagerAdvancedWidget::sigCurrentSnapshotItemChange);
     693    disconnect(machineToolPane(), &UIToolPaneMachine::sigDetachToolPane,
     694               this, &UIVirtualBoxManagerAdvancedWidget::sigDetachToolPane);
    1058695
    1059696    /* Chooser-pane connections: */
    1060     disconnect(m_pPaneChooser, &UIChooser::sigSelectionChanged,
    1061                this, &UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneIndexChange);
    1062     disconnect(m_pPaneChooser, &UIChooser::sigSelectionInvalidated,
    1063                this, &UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneSelectionInvalidated);
    1064     disconnect(m_pPaneChooser, &UIChooser::sigToggleStarted,
    1065                m_pPaneToolsMachine, &UIToolPaneMachine::sigToggleStarted);
    1066     disconnect(m_pPaneChooser, &UIChooser::sigToggleFinished,
    1067                m_pPaneToolsMachine, &UIToolPaneMachine::sigToggleFinished);
    1068     disconnect(m_pPaneChooser, &UIChooser::sigGroupSavingStateChanged,
     697    disconnect(chooser(), &UIChooser::sigGroupSavingStateChanged,
    1069698               this, &UIVirtualBoxManagerAdvancedWidget::sigGroupSavingStateChanged);
    1070     disconnect(m_pPaneChooser, &UIChooser::sigCloudUpdateStateChanged,
     699    disconnect(chooser(), &UIChooser::sigCloudUpdateStateChanged,
    1071700               this, &UIVirtualBoxManagerAdvancedWidget::sigCloudUpdateStateChanged);
    1072     disconnect(m_pPaneChooser, &UIChooser::sigToolMenuRequested,
    1073                this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolMenuRequested);
    1074     disconnect(m_pPaneChooser, &UIChooser::sigCloudProfileStateChange,
    1075                this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCloudProfileStateChange);
    1076     disconnect(m_pPaneChooser, &UIChooser::sigCloudMachineStateChange,
    1077                this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCloudMachineStateChange);
    1078     disconnect(m_pPaneChooser, &UIChooser::sigStartOrShowRequest,
     701    disconnect(chooser(), &UIChooser::sigStartOrShowRequest,
    1079702               this, &UIVirtualBoxManagerAdvancedWidget::sigStartOrShowRequest);
    1080     disconnect(m_pPaneChooser, &UIChooser::sigMachineSearchWidgetVisibilityChanged,
     703    disconnect(chooser(), &UIChooser::sigMachineSearchWidgetVisibilityChanged,
    1081704               this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSearchWidgetVisibilityChanged);
    1082 
    1083     /* Details-pane connections: */
    1084     disconnect(m_pPaneToolsMachine, &UIToolPaneMachine::sigLinkClicked,
    1085                this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSettingsLinkClicked);
    1086 
    1087     /* Tools-pane connections: */
    1088     disconnect(m_pMenuToolsGlobal, &UITools::sigSelectionChanged,
    1089                this, &UIVirtualBoxManagerAdvancedWidget::sltHandleGlobalToolsMenuIndexChange);
    1090     disconnect(m_pMenuToolsMachine, &UITools::sigSelectionChanged,
    1091                this, &UIVirtualBoxManagerAdvancedWidget::sltHandleMachineToolsMenuIndexChange);
    1092 }
    1093 
    1094 void UIVirtualBoxManagerAdvancedWidget::cleanupWidgets()
    1095 {
     705}
     706
     707void UIVirtualBoxManagerAdvancedWidget::cleanup()
     708{
     709    /* Destroy notification-center: */
    1096710    UINotificationCenter::destroy();
    1097711}
    1098712
    1099 void UIVirtualBoxManagerAdvancedWidget::cleanup()
    1100 {
    1101     /* Ask sub-dialogs to commit data: */
    1102     sltHandleCommitData();
    1103 
    1104     /* Cleanup everything: */
    1105     cleanupWidgets();
    1106 }
    1107 
    1108 void UIVirtualBoxManagerAdvancedWidget::recacheCurrentMachineItemInformation(bool fDontRaiseErrorPane /* = false */)
    1109 {
    1110     /* Sanity check, this method is for machine or group of machine items: */
    1111     if (!isMachineItemSelected() && !isGroupItemSelected())
    1112         return;
    1113 
    1114     /* Get current item: */
    1115     UIVirtualMachineItem *pItem = currentItem();
    1116     const bool fCurrentItemIsOk = isItemAccessible(pItem);
    1117 
    1118     /* If current item is Ok: */
    1119     if (fCurrentItemIsOk)
    1120     {
    1121         /* If Error-pane is chosen currently => switch to tool currently chosen in Tools-menu: */
    1122         if (m_pPaneToolsMachine->currentTool() == UIToolType_Error)
    1123             switchMachineToolTo(m_pMenuToolsMachine->toolsType());
    1124 
    1125         /* Propagate current items to the Tools pane: */
    1126         m_pPaneToolsMachine->setItems(currentItems());
    1127     }
    1128     /* Otherwise if we were not asked separately to calm down: */
    1129     else if (!fDontRaiseErrorPane)
    1130     {
    1131         /* Make sure Error pane raised: */
    1132         if (m_pPaneToolsMachine->currentTool() != UIToolType_Error)
    1133             m_pPaneToolsMachine->openTool(UIToolType_Error);
    1134 
    1135         /* Propagate last access error to the Error-pane: */
    1136         if (pItem)
    1137             m_pPaneToolsMachine->setErrorDetails(pItem->accessError());
    1138     }
    1139 }
    1140 
    1141 void UIVirtualBoxManagerAdvancedWidget::updateToolsMenuGlobal()
    1142 {
    1143     /* Update global tools restrictions: */
    1144     QSet<UIToolType> restrictedTypes;
    1145     const bool fExpertMode = gEDataManager->isSettingsInExpertMode();
    1146     if (!fExpertMode)
    1147         restrictedTypes << UIToolType_Media
    1148                         << UIToolType_Network;
    1149     if (restrictedTypes.contains(m_pMenuToolsGlobal->toolsType()))
    1150         m_pMenuToolsGlobal->setToolsType(UIToolType_Welcome);
    1151     const QList restrictions(restrictedTypes.begin(), restrictedTypes.end());
    1152     m_pMenuToolsGlobal->setRestrictedToolTypes(restrictions);
    1153 
    1154     /* Take restrictions into account, closing all restricted tools: */
    1155     foreach (const UIToolType &enmRestrictedType, restrictedTypes)
    1156         m_pPaneToolsGlobal->closeTool(enmRestrictedType);
    1157 }
    1158 
    1159 void UIVirtualBoxManagerAdvancedWidget::updateToolsMenuMachine(UIVirtualMachineItem *pItem)
    1160 {
    1161     /* Get current item state: */
    1162     const bool fCurrentItemIsOk = isItemAccessible(pItem);
    1163 
    1164     /* Update machine tools restrictions: */
    1165     QSet<UIToolType> restrictedTypes;
    1166     const bool fExpertMode = gEDataManager->isSettingsInExpertMode();
    1167     if (!fExpertMode)
    1168         restrictedTypes << UIToolType_FileManager;
    1169     if (pItem && pItem->itemType() != UIVirtualMachineItemType_Local)
    1170         restrictedTypes << UIToolType_Snapshots
    1171                         << UIToolType_Logs
    1172                         << UIToolType_FileManager;
    1173     if (restrictedTypes.contains(m_pMenuToolsMachine->toolsType()))
    1174         m_pMenuToolsMachine->setToolsType(UIToolType_Details);
    1175     const QList restrictions(restrictedTypes.begin(), restrictedTypes.end());
    1176     m_pMenuToolsMachine->setRestrictedToolTypes(restrictions);
    1177     /* Update machine menu items availability: */
    1178     m_pMenuToolsMachine->setItemsEnabled(fCurrentItemIsOk);
    1179 
    1180     /* Take restrictions into account, closing all restricted tools: */
    1181     foreach (const UIToolType &enmRestrictedType, restrictedTypes)
    1182         m_pPaneToolsMachine->closeTool(enmRestrictedType);
    1183 }
    1184 
    1185 void UIVirtualBoxManagerAdvancedWidget::handleCurrentToolTypeChange(UIToolType enmType)
    1186 {
    1187     /* This method's behavior depends first of all of currently selected tool class.
    1188      * But keep in mind, it is called for both Global and Machine type changes. */
    1189 
    1190     /* If Global tools currently chosen: */
    1191     if (m_pStackedWidget->currentWidget() == m_pPaneToolsGlobal)
    1192     {
    1193         /* For the Global tool type changes,
    1194          * start unconditionally updating all cloud VMs,
    1195          * if Activity Overview tool currently chosen (even if VMs are not selected): */
    1196         if (UIToolStuff::isTypeOfClass(enmType, UIToolClass_Global))
    1197         {
    1198             bool fActivityOverviewActive = enmType == UIToolType_Activities;
    1199             m_pPaneChooser->setKeepCloudNodesUpdated(fActivityOverviewActive);
    1200             if (fActivityOverviewActive)
    1201                 m_pPaneToolsGlobal->setCloudMachineItems(m_pPaneChooser->cloudMachineItems());
    1202         }
    1203     }
    1204     /* If Machine tools currently chosen: */
    1205     else
    1206     {
    1207         /* Stop unconditionally updating all cloud VMs,
    1208          * (tho they will still be updated if selected): */
    1209         m_pPaneChooser->setKeepCloudNodesUpdated(false);
    1210     }
    1211 }
     713UIGlobalToolsManagerWidget *UIVirtualBoxManagerAdvancedWidget::globalToolManager() const
     714{
     715    return m_pGlobalToolManager;
     716}
     717
     718UIToolPaneGlobal *UIVirtualBoxManagerAdvancedWidget::globalToolPane() const
     719{
     720    return globalToolManager()->toolPane();
     721}
     722
     723UIMachineManagerWidget *UIVirtualBoxManagerAdvancedWidget::machineToolManager() const
     724{
     725    return globalToolManager()->machineManager();
     726}
     727
     728UIToolPaneMachine *UIVirtualBoxManagerAdvancedWidget::machineToolPane() const
     729{
     730    return machineToolManager()->toolPane();
     731}
     732
     733UIChooser *UIVirtualBoxManagerAdvancedWidget::chooser() const
     734{
     735    return machineToolManager()->chooser();
     736}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerAdvancedWidget.h

    r107288 r107359  
    4040
    4141/* Forward declarations: */
    42 class QStackedWidget;
    43 class QTimer;
    44 class QISplitter;
    4542class QIToolBar;
    4643class UIActionPool;
    4744class UIChooser;
     45class UIGlobalToolsManagerWidget;
     46class UIMachineManagerWidget;
    4847class UIToolPaneGlobal;
    4948class UIToolPaneMachine;
    50 class UITools;
    5149class UIVirtualBoxManager;
    5250class UIVirtualMachineItem;
     
    5755    Q_OBJECT;
    5856
    59     /** Possible selection types. */
    60     enum SelectionType
    61     {
    62         SelectionType_Invalid,
    63         SelectionType_SingleLocalGroupItem,
    64         SelectionType_SingleCloudGroupItem,
    65         SelectionType_FirstIsGlobalItem,
    66         SelectionType_FirstIsLocalMachineItem,
    67         SelectionType_FirstIsCloudMachineItem
    68     };
    69 
    7057signals:
    71 
    72     /** @name Tool-bar stuff.
    73       * @{ */
    74         /* Notifies listeners about tool-bar height change. */
    75         void sigToolBarHeightChange(int iHeight);
    76     /** @} */
    7758
    7859    /** @name Chooser pane stuff.
     
    153134        /** Returns a list of current-items. */
    154135        QList<UIVirtualMachineItem*> currentItems() const;
    155 
    156         /** Returns whether passed @a pItem accessible, by default it's the current one. */
    157         bool isItemAccessible(UIVirtualMachineItem *pItem = 0) const;
    158136
    159137        /** Returns whether group item is selected. */
     
    178156        /** Returns whether all items of one group are selected. */
    179157        bool isAllItemsOfOneGroupSelected() const;
    180 
    181         /** Returns current selection type. */
    182         SelectionType selectionType() const;
    183158
    184159        /** Returns full name of currently selected group. */
     
    230205        /** Returns whether Machine tool of passed @a enmType is opened. */
    231206        bool isMachineToolOpened(UIToolType enmType) const;
    232         /** Switches Global tool to passed @a enmType. */
    233         void switchGlobalToolTo(UIToolType enmType);
    234         /** Switches Machine tool to passed @a enmType. */
    235         void switchMachineToolTo(UIToolType enmType);
    236207        /** Closes Global tool of passed @a enmType. */
    237208        void closeGlobalTool(UIToolType enmType);
     
    265236private slots:
    266237
    267     /** @name Event handling stuff.
    268       * @{ */
    269         /** Handles translation event. */
    270         void sltRetranslateUI();
    271     /** @} */
    272 
    273238    /** @name General stuff.
    274239      * @{ */
     
    277242    /** @} */
    278243
    279     /** @name CVirtualBox event handling stuff.
    280       * @{ */
    281         /** Handles CVirtualBox event about state change for machine with @a uId. */
    282         void sltHandleMachineStateChange(const QUuid &uId);
    283     /** @} */
    284 
    285     /** @name CVirtualBox extra-data event handling stuff.
    286       * @{ */
    287         /** Handles signal about settings expert mode change. */
    288         void sltHandleSettingsExpertModeChange();
    289     /** @} */
    290 
    291     /** @name Splitter stuff.
    292       * @{ */
    293         /** Handles signal about splitter move. */
    294         void sltHandleSplitterMove();
    295         /** Handles request to save splitter settings. */
    296         void sltSaveSplitterSettings();
    297     /** @} */
    298 
    299244    /** @name Tool-bar stuff.
    300245      * @{ */
    301         /** Handles signal about tool-bar resize to @a newSize. */
    302         void sltHandleToolBarResize(const QSize &newSize);
    303     /** @} */
    304 
    305     /** @name Chooser pane stuff.
    306       * @{ */
    307         /** Handles signal about Chooser-pane index change. */
    308         void sltHandleChooserPaneIndexChange();
    309 
    310         /** Handles signal about Chooser-pane selection invalidated. */
    311         void sltHandleChooserPaneSelectionInvalidated() { recacheCurrentMachineItemInformation(true /* fDontRaiseErrorPane */); }
    312 
    313         /** Handles state change for cloud profile with certain @a strProviderShortName and @a strProfileName. */
    314         void sltHandleCloudProfileStateChange(const QString &strProviderShortName,
    315                                               const QString &strProfileName);
    316         /** Handles state change for cloud machine with certain @a uId. */
    317         void sltHandleCloudMachineStateChange(const QUuid &uId);
    318     /** @} */
    319 
    320     /** @name Tools pane stuff.
    321       * @{ */
    322         /** Handles tool popup-menu request. */
    323         void sltHandleToolMenuRequested(const QPoint &position, UIVirtualMachineItem *pItem);
    324 
    325         /** Handles signal about global Tools-menu index change.
    326           * @param  enmType  Brings current tool type. */
    327         void sltHandleGlobalToolsMenuIndexChange(UIToolType enmType) { switchGlobalToolTo(enmType); }
    328         /** Handles signal about machine Tools-menu index change.
    329           * @param  enmType  Brings current tool type. */
    330         void sltHandleMachineToolsMenuIndexChange(UIToolType enmType) { switchMachineToolTo(enmType); }
    331 
    332         /** Handles signal requesting switch to Activity pane of machine with @a uMachineId. */
    333         void sltSwitchToMachineActivityPane(const QUuid &uMachineId);
    334         /** Handles signal requesting switch to Resources pane. */
    335         void sltSwitchToActivityOverviewPane();
     246        /** Updates tool-bar. */
     247        void sltUpdateToolbar();
    336248    /** @} */
    337249
     
    354266        /** Cleanups connections. */
    355267        void cleanupConnections();
    356         /** Cleanups widgets. */
    357         void cleanupWidgets();
    358268        /** Cleanups all. */
    359269        void cleanup();
     
    362272    /** @name Tools stuff.
    363273      * @{ */
    364         /** Recaches current machine item information.
    365           * @param  fDontRaiseErrorPane  Brings whether we should not raise error-pane. */
    366         void recacheCurrentMachineItemInformation(bool fDontRaiseErrorPane = false);
    367 
    368         /** Updates Global tools menu. */
    369         void updateToolsMenuGlobal();
    370         /** Updates Machine tools menu for @a pItem specified. */
    371         void updateToolsMenuMachine(UIVirtualMachineItem *pItem);
    372 
    373         /** Handles current tool @a enmType change. */
    374         void handleCurrentToolTypeChange(UIToolType enmType);
    375     /** @} */
    376 
    377     /** Holds the action-pool instance. */
     274        /** Returns Global Tool Manager instance. */
     275        UIGlobalToolsManagerWidget *globalToolManager() const;
     276        /** Returns Global Tool Pane reference. */
     277        UIToolPaneGlobal *globalToolPane() const;
     278
     279        /** Returns Machine Tool Manager reference. */
     280        UIMachineManagerWidget *machineToolManager() const;
     281        /** Returns Machine Tool Pane reference. */
     282        UIToolPaneMachine *machineToolPane() const;
     283        /** Returns Machine Chooser Pane reference. */
     284        UIChooser *chooser() const;
     285    /** @} */
     286
     287    /** Holds the action-pool reference. */
    378288    UIActionPool *m_pActionPool;
    379 
    380     /** Holds the central splitter instance. */
    381     QISplitter *m_pSplitter;
    382289
    383290    /** Holds the main toolbar instance. */
    384291    QIToolBar *m_pToolBar;
    385292
    386     /** Holds the Chooser-pane instance. */
    387     UIChooser          *m_pPaneChooser;
    388     /** Holds the stacked-widget. */
    389     QStackedWidget     *m_pStackedWidget;
    390     /** Holds the Global Tools-pane instance. */
    391     UIToolPaneGlobal   *m_pPaneToolsGlobal;
    392     /** Holds the Machine Tools-pane instance. */
    393     UIToolPaneMachine  *m_pPaneToolsMachine;
    394     /** Holds the Global Tools-menu instance. */
    395     UITools            *m_pMenuToolsGlobal;
    396     /** Holds the Machine Tools-menu instance. */
    397     UITools            *m_pMenuToolsMachine;
    398 
    399     /** Holds the last selection type. */
    400     SelectionType  m_enmSelectionType;
    401     /** Holds whether the last selected item was accessible. */
    402     bool           m_fSelectedMachineItemAccessible;
    403 
    404     /** Holds the splitter settings save timer. */
    405     QTimer *m_pSplitterSettingsSaveTimer;
     293    /** Holds the Global Tool Manager instance. */
     294    UIGlobalToolsManagerWidget *m_pGlobalToolManager;
    406295};
    407296
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