VirtualBox

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

FE/Qt: bugref:8900: Selector UI: Global Tools are now there as well!

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
9 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r68175 r68200  
    380380        src/selector/UISnapshotDetailsWidget.h \
    381381        src/selector/UISnapshotPane.h \
     382        src/selector/UIToolsPaneGlobal.h \
    382383        src/selector/UIToolsPaneMachine.h \
    383384        src/selector/UIToolsToolbar.h \
     
    697698        src/selector/UISnapshotDetailsWidget.cpp \
    698699        src/selector/UISnapshotPane.cpp \
     700        src/selector/UIToolsPaneGlobal.cpp \
    699701        src/selector/UIToolsPaneMachine.cpp \
    700702        src/selector/UIToolsToolbar.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc

    r68175 r68200  
    186186        <file alias="statusbar_settings_16px.png">images/statusbar_settings_16px.png</file>
    187187        <file alias="statusbar_settings_disabled_16px.png">images/statusbar_settings_disabled_16px.png</file>
     188        <file alias="tools_global_32px.png">images/tools_global_32px.png</file>
    188189        <file alias="tools_machine_32px.png">images/tools_machine_32px.png</file>
    189190        <file alias="tpixel.png">images/tpixel.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc

    r68175 r68200  
    195195        <file alias="statusbar_settings_16px_hidpi.png">images/hidpi/statusbar_settings_16px_hidpi.png</file>
    196196        <file alias="statusbar_settings_disabled_16px_hidpi.png">images/hidpi/statusbar_settings_disabled_16px_hidpi.png</file>
     197        <file alias="tools_global_32px_hidpi.png">images/hidpi/tools_global_32px_hidpi.png</file>
    197198        <file alias="tools_machine_32px_hidpi.png">images/hidpi/tools_machine_32px_hidpi.png</file>
    198199        <file alias="usb_16px_hidpi.png">images/hidpi/usb_16px_hidpi.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp

    r68197 r68200  
    10211021        setName(QApplication::translate("UIActionPool", "&Snapshots"));
    10221022        setStatusTip(QApplication::translate("UIActionPool", "Open machine snapshots pane"));
     1023    }
     1024};
     1025
     1026
     1027class UIActionToggleToolsGlobal : public UIActionToggle
     1028{
     1029    Q_OBJECT;
     1030
     1031public:
     1032
     1033    UIActionToggleToolsGlobal(UIActionPool *pParent)
     1034        : UIActionToggle(pParent, ":/tools_global_32px.png") {}
     1035
     1036protected:
     1037
     1038    QString shortcutExtraDataID() const
     1039    {
     1040        return QString("ToolsGlobal");
     1041    }
     1042
     1043    void retranslateUi()
     1044    {
     1045        setName(QApplication::translate("UIActionPool", "&Global Tools"));
     1046        setStatusTip(QApplication::translate("UIActionPool", "Switch to global tools"));
     1047    }
     1048};
     1049
     1050class UIActionMenuToolsGlobal : public UIActionMenu
     1051{
     1052    Q_OBJECT;
     1053
     1054public:
     1055
     1056    UIActionMenuToolsGlobal(UIActionPool *pParent)
     1057        : UIActionMenu(pParent) {}
     1058
     1059protected:
     1060
     1061    QString shortcutExtraDataID() const
     1062    {
     1063        return QString("ToolsGlobalMenu");
     1064    }
     1065
     1066    void retranslateUi()
     1067    {
     1068        setName(QApplication::translate("UIActionPool", "&Global Tools Menu"));
     1069        setStatusTip(QApplication::translate("UIActionPool", "Open global tools menu"));
     1070    }
     1071};
     1072
     1073class UIActionSimpleToolsGlobalVirtualMediaManager : public UIActionSimple
     1074{
     1075    Q_OBJECT;
     1076
     1077public:
     1078
     1079    UIActionSimpleToolsGlobalVirtualMediaManager(UIActionPool *pParent)
     1080        : UIActionSimple(pParent,
     1081                         ":/diskimage_22px.png", ":/diskimage_16px.png",
     1082                         ":/diskimage_22px.png", ":/diskimage_16px.png") {}
     1083
     1084protected:
     1085
     1086    QString shortcutExtraDataID() const
     1087    {
     1088        return QString("ToolsGlobalVirtualMediaManager");
     1089    }
     1090
     1091    void retranslateUi()
     1092    {
     1093        setName(QApplication::translate("UIActionPool", "&Virtual Media Manager"));
     1094        setStatusTip(QApplication::translate("UIActionPool", "Open Virtual Media Manager"));
     1095    }
     1096};
     1097
     1098class UIActionSimpleToolsGlobalHostNetworkManager : public UIActionSimple
     1099{
     1100    Q_OBJECT;
     1101
     1102public:
     1103
     1104    UIActionSimpleToolsGlobalHostNetworkManager(UIActionPool *pParent)
     1105        : UIActionSimple(pParent,
     1106                         ":/host_iface_manager_22px.png", ":/host_iface_manager_16px.png",
     1107                         ":/host_iface_manager_22px.png", ":/host_iface_manager_16px.png") {}
     1108
     1109protected:
     1110
     1111    QString shortcutExtraDataID() const
     1112    {
     1113        return QString("ToolsGlobalHostNetworkManager");
     1114    }
     1115
     1116    void retranslateUi()
     1117    {
     1118        setName(QApplication::translate("UIActionPool", "&Host Network Manager"));
     1119        setStatusTip(QApplication::translate("UIActionPool", "Open Host Network Manager"));
    10231120    }
    10241121};
     
    12241321    m_pool[UIActionIndexST_M_Tools_M_Machine_Snapshots] = new UIActionSimpleToolsMachineSnapshots(this);
    12251322
     1323    /* Global Tools actions: */
     1324    m_pool[UIActionIndexST_M_Tools_T_Global] = new UIActionToggleToolsGlobal(this);
     1325    m_pool[UIActionIndexST_M_Tools_M_Global] = new UIActionMenuToolsGlobal(this);
     1326    m_pool[UIActionIndexST_M_Tools_M_Global_VirtualMediaManager] = new UIActionSimpleToolsGlobalVirtualMediaManager(this);
     1327    m_pool[UIActionIndexST_M_Tools_M_Global_HostNetworkManager] = new UIActionSimpleToolsGlobalHostNetworkManager(this);
     1328
    12261329    /* Call to base-class: */
    12271330    UIActionPool::preparePool();
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h

    r68168 r68200  
    9898    UIActionIndexST_M_Tools_M_Machine_Snapshots,
    9999
     100    /* Global Tools actions: */
     101    UIActionIndexST_M_Tools_T_Global,
     102    UIActionIndexST_M_Tools_M_Global,
     103    UIActionIndexST_M_Tools_M_Global_VirtualMediaManager,
     104    UIActionIndexST_M_Tools_M_Global_HostNetworkManager,
     105
    100106    /* Maximum index: */
    101107    UIActionIndexST_Max
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r68199 r68200  
    4444# include "UISelectorWindow.h"
    4545# include "UISettingsDialogSpecific.h"
     46# include "UISlidingWidget.h"
    4647# include "UISpacerWidgets.h"
    4748# include "UIToolBar.h"
     
    111112    , m_fWarningAboutInaccessibleMediaShown(false)
    112113    , m_pActionPool(0)
     114    , m_pSlidingWidget(0)
    113115    , m_pSplitter(0)
    114116#ifndef VBOX_WS_MAC
     
    119121    , m_pPaneChooser(0)
    120122    , m_pPaneToolsMachine(0)
     123    , m_pPaneToolsGlobal(0)
    121124    , m_pGroupMenuAction(0)
    122125    , m_pMachineMenuAction(0)
     
    279282
    280283    /* Make sure MM window is not opened: */
    281     if (m_pManagerVirtualMedia)
     284    if (   m_pManagerVirtualMedia
     285        || m_pPaneToolsGlobal->isToolOpened(ToolTypeGlobal_VirtualMedia))
    282286        return;
    283287
     
    384388void UISelectorWindow::sltOpenVirtualMediumManagerWindow()
    385389{
     390    /* First check if instance of widget opened embedded: */
     391    if (m_pPaneToolsGlobal->isToolOpened(ToolTypeGlobal_VirtualMedia))
     392    {
     393        m_pPaneToolsGlobal->openTool(ToolTypeGlobal_VirtualMedia);
     394        return;
     395    }
     396
    386397    /* Create instance if not yet created: */
    387398    if (!m_pManagerVirtualMedia)
     
    410421void UISelectorWindow::sltOpenHostNetworkManagerWindow()
    411422{
     423    /* First check if instance of widget opened embedded: */
     424    if (m_pPaneToolsGlobal->isToolOpened(ToolTypeGlobal_HostNetwork))
     425    {
     426        m_pPaneToolsGlobal->openTool(ToolTypeGlobal_HostNetwork);
     427        return;
     428    }
     429
    412430    /* Create instance if not yet created: */
    413431    if (!m_pManagerHostNetwork)
     
    10091027}
    10101028
     1029void UISelectorWindow::sltHandleToolsTypeSwitch()
     1030{
     1031    /* If Machine tool button is checked => go backward: */
     1032    if (actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->isChecked())
     1033        m_pSlidingWidget->moveBackward();
     1034
     1035    else
     1036
     1037    /* If Global tool button is checked => go forward: */
     1038    if (actionPool()->action(UIActionIndexST_M_Tools_T_Global)->isChecked())
     1039        m_pSlidingWidget->moveForward();
     1040
     1041    /* Update action visibility: */
     1042    updateActionsVisibility();
     1043}
     1044
    10111045void UISelectorWindow::sltHandleToolOpenedMachine(ToolTypeMachine enmType)
    10121046{
     
    10261060}
    10271061
     1062void UISelectorWindow::sltHandleToolOpenedGlobal(ToolTypeGlobal enmType)
     1063{
     1064    /* Open corresponding tool: */
     1065    m_pPaneToolsGlobal->openTool(enmType);
     1066}
     1067
    10281068void UISelectorWindow::sltHandleToolClosedMachine(ToolTypeMachine enmType)
    10291069{
    10301070    /* Close corresponding tool: */
    10311071    m_pPaneToolsMachine->closeTool(enmType);
     1072}
     1073
     1074void UISelectorWindow::sltHandleToolClosedGlobal(ToolTypeGlobal enmType)
     1075{
     1076    /* Close corresponding tool: */
     1077    m_pPaneToolsGlobal->closeTool(enmType);
    10321078}
    10331079
     
    10641110           "<p>The right part of this window represents a set of tools "
    10651111           "you have opened for the currently chosen machine. "
     1112           "For more tools check the corresponding menu at the right side "
     1113           "of the main tool bar located at the top of the window.</p>"
     1114           "<p>You can press the <b>%1</b> key to get instant help, "
     1115           "or visit "
     1116           "<a href=https://www.virtualbox.org>www.virtualbox.org</a> "
     1117           "for the latest information and news.</p>")
     1118           .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));
     1119
     1120    /* Translate Global Tools welcome screen: */
     1121    m_pPaneToolsGlobal->setDetailsText(
     1122        tr("<h3>Welcome to VirtualBox!</h3>"
     1123           "<p>This window represents a set of global tools "
     1124           "you have opened. They are not related to any particular machine "
     1125           "but to whole VirtualBox instead. This list will be extended with "
     1126           "new tools in the future releases. "
     1127           "<img src=:/welcome.png align=right/></p>"
    10661128           "For more tools check the corresponding menu at the right side "
    10671129           "of the main tool bar located at the top of the window.</p>"
     
    17131775                /* Add 'Tools' actions into action-group: */
    17141776                pActionGroupTools->addAction(actionPool()->action(UIActionIndexST_M_Tools_T_Machine));
     1777                pActionGroupTools->addAction(actionPool()->action(UIActionIndexST_M_Tools_T_Global));
    17151778            }
    17161779
     
    17791842#endif /* !VBOX_WS_MAC */
    17801843
    1781             /* Create splitter: */
    1782             m_pSplitter = new QISplitter;
    1783             AssertPtrReturnVoid(m_pSplitter);
     1844            /* Create sliding-widget: */
     1845            m_pSlidingWidget = new UISlidingWidget;
     1846            AssertPtrReturnVoid(m_pSlidingWidget);
    17841847            {
    1785                 /* Configure splitter: */
     1848                /* Create splitter: */
     1849                m_pSplitter = new QISplitter;
     1850                AssertPtrReturnVoid(m_pSplitter);
     1851                {
     1852                    /* Configure splitter: */
    17861853#ifdef VBOX_WS_X11
    1787                 m_pSplitter->setHandleType(QISplitter::Native);
     1854                    m_pSplitter->setHandleType(QISplitter::Native);
    17881855#endif
    17891856
    1790                 /* Prepare Chooser-pane: */
    1791                 m_pPaneChooser = new UIGChooser(this);
    1792                 AssertPtrReturnVoid(m_pPaneChooser);
    1793                 {
    1794                     /* Add into splitter: */
    1795                     m_pSplitter->addWidget(m_pPaneChooser);
     1857                    /* Prepare Chooser-pane: */
     1858                    m_pPaneChooser = new UIGChooser(this);
     1859                    AssertPtrReturnVoid(m_pPaneChooser);
     1860                    {
     1861                        /* Add into splitter: */
     1862                        m_pSplitter->addWidget(m_pPaneChooser);
     1863                    }
     1864
     1865                    /* Prepare Machine Tools-pane: */
     1866                    m_pPaneToolsMachine = new UIToolsPaneMachine(actionPool());
     1867                    AssertPtrReturnVoid(m_pPaneToolsMachine);
     1868                    {
     1869                        /* Add into splitter: */
     1870                        m_pSplitter->addWidget(m_pPaneToolsMachine);
     1871                    }
     1872
     1873                    /* Adjust splitter colors according to main widgets it splits: */
     1874                    m_pSplitter->configureColors(m_pPaneChooser->palette().color(QPalette::Active, QPalette::Window),
     1875                                                 m_pPaneToolsMachine->palette().color(QPalette::Active, QPalette::Window));
     1876                    /* Set the initial distribution. The right site is bigger. */
     1877                    m_pSplitter->setStretchFactor(0, 2);
     1878                    m_pSplitter->setStretchFactor(1, 3);
    17961879                }
    17971880
    1798                 /* Prepare Machine Tools-pane: */
    1799                 m_pPaneToolsMachine = new UIToolsPaneMachine(actionPool());
    1800                 AssertPtrReturnVoid(m_pPaneToolsMachine);
    1801                 {
    1802                     /* Add into splitter: */
    1803                     m_pSplitter->addWidget(m_pPaneToolsMachine);
    1804                 }
    1805 
    1806                 /* Adjust splitter colors according to main widgets it splits: */
    1807                 m_pSplitter->configureColors(m_pPaneChooser->palette().color(QPalette::Active, QPalette::Window),
    1808                                              m_pPaneToolsMachine->palette().color(QPalette::Active, QPalette::Window));
    1809                 /* Set the initial distribution. The right site is bigger. */
    1810                 m_pSplitter->setStretchFactor(0, 2);
    1811                 m_pSplitter->setStretchFactor(1, 3);
     1881                /* Prepare Global Tools-pane: */
     1882                m_pPaneToolsGlobal = new UIToolsPaneGlobal(actionPool());
     1883                AssertPtrReturnVoid(m_pPaneToolsGlobal);
     1884
     1885                /* Add left/right widgets into sliding widget: */
     1886                m_pSlidingWidget->setWidgets(m_pSplitter, m_pPaneToolsGlobal);
    18121887
    18131888                /* Add into layout: */
    1814                 pLayout->addWidget(m_pSplitter);
     1889                pLayout->addWidget(m_pSlidingWidget);
    18151890            }
    18161891        }
     
    18911966    connect(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff), SIGNAL(triggered()), this, SLOT(sltPerformPowerOffMachine()));
    18921967
     1968    /* 'Tools' actions connections: */
     1969    connect(actionPool()->action(UIActionIndexST_M_Tools_T_Machine), &UIAction::toggled,
     1970            this, &UISelectorWindow::sltHandleToolsTypeSwitch);
     1971    connect(actionPool()->action(UIActionIndexST_M_Tools_T_Global), &UIAction::toggled,
     1972            this, &UISelectorWindow::sltHandleToolsTypeSwitch);
     1973
    18931974    /* Status-bar connections: */
    18941975    connect(statusBar(), SIGNAL(customContextMenuRequested(const QPoint&)),
     
    19101991#endif /* VBOX_WS_MAC */
    19111992    connect(m_pToolbarTools, &UIToolsToolbar::sigToolOpenedMachine, this, &UISelectorWindow::sltHandleToolOpenedMachine);
     1993    connect(m_pToolbarTools, &UIToolsToolbar::sigToolOpenedGlobal,  this, &UISelectorWindow::sltHandleToolOpenedGlobal);
    19121994    connect(m_pToolbarTools, &UIToolsToolbar::sigToolClosedMachine, this, &UISelectorWindow::sltHandleToolClosedMachine);
     1995    connect(m_pToolbarTools, &UIToolsToolbar::sigToolClosedGlobal,  this, &UISelectorWindow::sltHandleToolClosedGlobal);
    19131996
    19141997    /* VM desktop connections: */
     
    20732156{
    20742157    /* Determine whether Machine or Group menu should be shown at all: */
     2158    const bool fMachineOrGroupMenuShown = actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->isChecked();
    20752159    const bool fMachineMenuShown = !m_pPaneChooser->isSingleGroupSelected();
    2076     m_pMachineMenuAction->setVisible(fMachineMenuShown);
    2077     m_pGroupMenuAction->setVisible(!fMachineMenuShown);
     2160    m_pMachineMenuAction->setVisible(fMachineOrGroupMenuShown && fMachineMenuShown);
     2161    m_pGroupMenuAction->setVisible(fMachineOrGroupMenuShown && !fMachineMenuShown);
    20782162
    20792163    /* Hide action shortcuts: */
     
    20842168        foreach (UIAction *pAction, m_groupActions)
    20852169            pAction->hideShortcut();
     2170
     2171    /* Update actions visibility: */
     2172    foreach (UIAction *pAction, m_machineActions)
     2173        pAction->setVisible(fMachineOrGroupMenuShown);
    20862174
    20872175    /* Show what should be shown: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h

    r68199 r68200  
    2525#include "QIMainWindow.h"
    2626#include "QIWithRetranslateUI.h"
     27#include "UIToolsPaneGlobal.h"
    2728#include "UIToolsPaneMachine.h"
    2829#include "VBoxGlobal.h"
     
    3839class UIMainBar;
    3940#endif
     41class UISlidingWidget;
    4042class UIToolBar;
    4143class UIToolsToolbar;
     
    183185    /** @} */
    184186
     187    /** @name Tools-toolbar stuff.
     188      * @{ */
     189        /** Handles tools type switch. */
     190        void sltHandleToolsTypeSwitch();
     191    /** @} */
     192
    185193    /** @name Tools-pane stuff.
    186194      * @{ */
    187195        /** Handles rquest to open Machine tool of passed @a enmType. */
    188196        void sltHandleToolOpenedMachine(ToolTypeMachine enmType);
     197        /** Handles rquest to open Global tool of passed @a enmType. */
     198        void sltHandleToolOpenedGlobal(ToolTypeGlobal enmType);
    189199
    190200        /** Handles rquest to close Machine tool of passed @a enmType. */
    191201        void sltHandleToolClosedMachine(ToolTypeMachine enmType);
     202        /** Handles rquest to close Global tool of passed @a enmType. */
     203        void sltHandleToolClosedGlobal(ToolTypeGlobal enmType);
    192204    /** @} */
    193205
     
    313325    UIActionPool *m_pActionPool;
    314326
     327    /** Holds the sliding-widget isntance. */
     328    UISlidingWidget *m_pSlidingWidget;
     329
    315330    /** Holds the central splitter instance. */
    316331    QISplitter *m_pSplitter;
     
    329344    /** Holds the Machine Tools-pane instance. */
    330345    UIToolsPaneMachine *m_pPaneToolsMachine;
     346    /** Holds the Global Tools-pane instance. */
     347    UIToolsPaneGlobal  *m_pPaneToolsGlobal;
    331348
    332349    /** Holds the list of Group menu actions. */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.cpp

    r68175 r68200  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIToolsPaneMachine class implementation.
     3 * VBox Qt GUI - UIToolsPaneGlobal class implementation.
    44 */
    55
     
    2626# include "UIActionPoolSelector.h"
    2727# include "UIDesktopPane.h"
    28 # include "UIGDetails.h"
    29 # include "UISnapshotPane.h"
    30 # include "UIToolsPaneMachine.h"
     28# include "UIMediumManager.h"
     29# include "UIHostNetworkManager.h"
     30# include "UIToolsPaneGlobal.h"
    3131
    3232/* Other VBox includes: */
     
    3636
    3737
    38 UIToolsPaneMachine::UIToolsPaneMachine(UIActionPool *pActionPool, QWidget *pParent /* = 0 */)
     38UIToolsPaneGlobal::UIToolsPaneGlobal(UIActionPool *pActionPool, QWidget *pParent /* = 0 */)
    3939    : QWidget(pParent)
    4040    , m_pActionPool(pActionPool)
    4141    , m_pLayout(0)
    4242    , m_pPaneDesktop(0)
    43     , m_pPaneDetails(0)
    44     , m_pPaneSnapshots(0)
     43    , m_pPaneMedia(0)
     44    , m_pPaneNetwork(0)
    4545{
    4646    /* Prepare: */
     
    4848}
    4949
    50 UIToolsPaneMachine::~UIToolsPaneMachine()
     50UIToolsPaneGlobal::~UIToolsPaneGlobal()
    5151{
    5252    /* Cleanup: */
     
    5454}
    5555
    56 bool UIToolsPaneMachine::isToolOpened(ToolTypeMachine enmType) const
     56bool UIToolsPaneGlobal::isToolOpened(ToolTypeGlobal enmType) const
    5757{
    5858    /* Search through the stacked widgets: */
    5959    for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex)
    60         if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeMachine>() == enmType)
     60        if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeGlobal>() == enmType)
    6161            return true;
    6262    return false;
    6363}
    6464
    65 void UIToolsPaneMachine::openTool(ToolTypeMachine enmType)
     65void UIToolsPaneGlobal::openTool(ToolTypeGlobal enmType)
    6666{
    6767    /* Search through the stacked widgets: */
    6868    int iActualIndex = -1;
    6969    for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex)
    70         if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeMachine>() == enmType)
     70        if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeGlobal>() == enmType)
    7171            iActualIndex = iIndex;
    7272
     
    8383        switch (enmType)
    8484        {
    85             case ToolTypeMachine_Desktop:
     85            case ToolTypeGlobal_Desktop:
    8686            {
    8787                /* Create Desktop pane: */
    88                 m_pPaneDesktop = new UIDesktopPane(m_pActionPool->action(UIActionIndexST_M_Group_S_Refresh));
     88                m_pPaneDesktop = new UIDesktopPane;
    8989                AssertPtrReturnVoid(m_pPaneDesktop);
    9090                {
    9191                    /* Configure pane: */
    92                     m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Desktop));
     92                    m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_Desktop));
    9393
    9494                    /* Add into layout: */
     
    9898                break;
    9999            }
    100             case ToolTypeMachine_Details:
     100            case ToolTypeGlobal_VirtualMedia:
    101101            {
    102                 /* Create Details pane: */
    103                 m_pPaneDetails = new UIGDetails;
    104                 AssertPtrReturnVoid(m_pPaneDetails);
     102                /* Create Virtual Media Manager: */
     103                m_pPaneMedia = new UIMediumManagerWidget(EmbedTo_Stack);
     104                AssertPtrReturnVoid(m_pPaneMedia);
    105105                {
    106106                    /* Configure pane: */
    107                     m_pPaneDetails->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Details));
    108                     connect(this, &UIToolsPaneMachine::sigSlidingStarted, m_pPaneDetails, &UIGDetails::sigSlidingStarted);
    109                     connect(this, &UIToolsPaneMachine::sigToggleStarted,  m_pPaneDetails, &UIGDetails::sigToggleStarted);
    110                     connect(this, &UIToolsPaneMachine::sigToggleFinished, m_pPaneDetails, &UIGDetails::sigToggleFinished);
    111                     connect(m_pPaneDetails, &UIGDetails::sigLinkClicked,  this, &UIToolsPaneMachine::sigLinkClicked);
     107                    m_pPaneMedia->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_VirtualMedia));
    112108
    113109                    /* Add into layout: */
    114                     m_pLayout->addWidget(m_pPaneDetails);
    115                     m_pLayout->setCurrentWidget(m_pPaneDetails);
     110                    m_pLayout->addWidget(m_pPaneMedia);
     111                    m_pLayout->setCurrentWidget(m_pPaneMedia);
    116112                }
    117113                break;
    118114            }
    119             case ToolTypeMachine_Snapshots:
     115            case ToolTypeGlobal_HostNetwork:
    120116            {
    121                 /* Create Snapshots pane: */
    122                 m_pPaneSnapshots = new UISnapshotPane;
    123                 AssertPtrReturnVoid(m_pPaneSnapshots);
     117                /* Create Host Network Manager: */
     118                m_pPaneNetwork = new UIHostNetworkManagerWidget(EmbedTo_Stack);
     119                AssertPtrReturnVoid(m_pPaneNetwork);
    124120                {
    125121                    /* Configure pane: */
    126                     m_pPaneSnapshots->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Snapshots));
     122                    m_pPaneNetwork->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_HostNetwork));
    127123
    128124                    /* Add into layout: */
    129                     m_pLayout->addWidget(m_pPaneSnapshots);
    130                     m_pLayout->setCurrentWidget(m_pPaneSnapshots);
     125                    m_pLayout->addWidget(m_pPaneNetwork);
     126                    m_pLayout->setCurrentWidget(m_pPaneNetwork);
    131127                }
    132128                break;
     
    138134}
    139135
    140 void UIToolsPaneMachine::closeTool(ToolTypeMachine enmType)
     136void UIToolsPaneGlobal::closeTool(ToolTypeGlobal enmType)
    141137{
    142138    /* Search through the stacked widgets: */
    143139    int iActualIndex = -1;
    144140    for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex)
    145         if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeMachine>() == enmType)
     141        if (m_pLayout->widget(iIndex)->property("ToolType").value<ToolTypeGlobal>() == enmType)
    146142            iActualIndex = iIndex;
    147143
     
    152148        switch (enmType)
    153149        {
    154             case ToolTypeMachine_Desktop:   m_pPaneDesktop = 0; break;
    155             case ToolTypeMachine_Details:   m_pPaneDetails = 0; break;
    156             case ToolTypeMachine_Snapshots: m_pPaneSnapshots = 0; break;
     150            case ToolTypeGlobal_Desktop:      m_pPaneDesktop = 0; break;
     151            case ToolTypeGlobal_VirtualMedia: m_pPaneMedia = 0; break;
     152            case ToolTypeGlobal_HostNetwork:  m_pPaneNetwork = 0; break;
    157153            default: break;
    158154        }
     
    164160}
    165161
    166 void UIToolsPaneMachine::setDetailsText(const QString &strText)
     162void UIToolsPaneGlobal::setDetailsText(const QString &strText)
    167163{
    168164    /* Update desktop pane: */
     
    171167}
    172168
    173 void UIToolsPaneMachine::setDetailsError(const QString &strError)
     169void UIToolsPaneGlobal::setDetailsError(const QString &strError)
    174170{
    175171    /* Update desktop pane: */
     
    178174}
    179175
    180 void UIToolsPaneMachine::setItems(const QList<UIVMItem*> &items)
    181 {
    182     /* Update details pane: */
    183     AssertPtrReturnVoid(m_pPaneDetails);
    184     m_pPaneDetails->setItems(items);
    185 }
    186 
    187 void UIToolsPaneMachine::setMachine(const CMachine &comMachine)
    188 {
    189     /* Update snapshots pane: */
    190     AssertPtrReturnVoid(m_pPaneSnapshots);
    191     m_pPaneSnapshots->setMachine(comMachine);
    192 }
    193 
    194 void UIToolsPaneMachine::prepare()
     176void UIToolsPaneGlobal::prepare()
    195177{
    196178    /* Create stacked-layout: */
     
    204186
    205187    /* Create desktop pane: */
    206     openTool(ToolTypeMachine_Desktop);
    207 }
    208 
    209 void UIToolsPaneMachine::cleanup()
     188    openTool(ToolTypeGlobal_Desktop);
     189}
     190
     191void UIToolsPaneGlobal::cleanup()
    210192{
    211193    /* Remove all widgets prematurelly: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.h

    r68175 r68200  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIToolsPaneMachine class declaration.
     3 * VBox Qt GUI - UIToolsPaneGlobal class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef ___UIToolsPaneMachine_h___
    19 #define ___UIToolsPaneMachine_h___
     18#ifndef ___UIToolsPaneGlobal_h___
     19#define ___UIToolsPaneGlobal_h___
    2020
    2121/* Qt includes: */
     
    2828class UIActionPool;
    2929class UIDesktopPane;
    30 class UIGDetails;
    31 class UISnapshotPane;
     30class UIHostNetworkManagerWidget;
     31class UIMediumManagerWidget;
    3232class UIVMItem;
    3333class CMachine;
    3434
    3535
    36 /** Machine tool types. */
    37 enum ToolTypeMachine
     36/** Global tool types. */
     37enum ToolTypeGlobal
    3838{
    39     ToolTypeMachine_Invalid,
    40     ToolTypeMachine_Desktop,
    41     ToolTypeMachine_Details,
    42     ToolTypeMachine_Snapshots,
     39    ToolTypeGlobal_Invalid,
     40    ToolTypeGlobal_Desktop,
     41    ToolTypeGlobal_VirtualMedia,
     42    ToolTypeGlobal_HostNetwork,
    4343};
    4444
    45 /* Make sure QVariant can eat ToolTypeMachine: */
    46 Q_DECLARE_METATYPE(ToolTypeMachine);
     45/* Make sure QVariant can eat ToolTypeGlobal: */
     46Q_DECLARE_METATYPE(ToolTypeGlobal);
    4747
    4848
    4949/** QWidget subclass representing container for tool panes. */
    50 class UIToolsPaneMachine : public QWidget
     50class UIToolsPaneGlobal : public QWidget
    5151{
    5252    Q_OBJECT;
    53 
    54 signals:
    55 
    56     /** Redirects signal from UISelectorWindow to UIGDetails. */
    57     void sigSlidingStarted();
    58     /** Redirects signal from UISelectorWindow to UIGDetails. */
    59     void sigToggleStarted();
    60     /** Redirects signal from UISelectorWindow to UIGDetails. */
    61     void sigToggleFinished();
    62     /** Redirects signal from UIGDetails to UISelectorWindow. */
    63     void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId);
    6453
    6554public:
    6655
    6756    /** Constructs tools pane passing @a pParent to the base-class. */
    68     UIToolsPaneMachine(UIActionPool *pActionPool, QWidget *pParent = 0);
     57    UIToolsPaneGlobal(UIActionPool *pActionPool, QWidget *pParent = 0);
    6958    /** Destructs tools pane. */
    70     virtual ~UIToolsPaneMachine() /* override */;
     59    virtual ~UIToolsPaneGlobal() /* override */;
    7160
    7261    /** Returns whether tool of particular @a enmType is opened. */
    73     bool isToolOpened(ToolTypeMachine enmType) const;
     62    bool isToolOpened(ToolTypeGlobal enmType) const;
    7463    /** Activates tool of passed @a enmType, creates new one if necessary. */
    75     void openTool(ToolTypeMachine enmType);
     64    void openTool(ToolTypeGlobal enmType);
    7665    /** Closes tool of passed @a enmType, deletes one if exists. */
    77     void closeTool(ToolTypeMachine enmType);
     66    void closeTool(ToolTypeGlobal enmType);
    7867
    7968    /** Defines @a strText and switches to text details pane. */
     
    8170    /** Defines @a strError and switches to error details pane. */
    8271    void setDetailsError(const QString &strError);
    83 
    84     /** Defines the machine @a items. */
    85     void setItems(const QList<UIVMItem*> &items);
    86 
    87     /** Defines the @a comMachine object. */
    88     void setMachine(const CMachine &comMachine);
    8972
    9073private:
     
    10184
    10285    /** Holds the stacked-layout instance. */
    103     QStackedLayout *m_pLayout;
     86    QStackedLayout             *m_pLayout;
    10487    /** Holds the Desktop pane instance. */
    105     UIDesktopPane  *m_pPaneDesktop;
    106     /** Holds the Details pane instance. */
    107     UIGDetails     *m_pPaneDetails;
    108     /** Holds the Snapshots pane instance. */
    109     UISnapshotPane *m_pPaneSnapshots;
     88    UIDesktopPane              *m_pPaneDesktop;
     89    /** Holds the Virtual Media Manager instance. */
     90    UIMediumManagerWidget      *m_pPaneMedia;
     91    /** Holds the Host Network Manager instance. */
     92    UIHostNetworkManagerWidget *m_pPaneNetwork;
    11093};
    11194
    112 #endif /* !___UIToolsPaneMachine_h___ */
     95#endif /* !___UIToolsPaneGlobal_h___ */
    11396
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.cpp

    r68196 r68200  
    4545    , m_pLayoutStacked(0)
    4646    , m_pTabBarMachine(0)
     47    , m_pTabBarGlobal(0)
    4748    , m_pToolBar(0)
    4849{
     
    7475}
    7576
     77void UIToolsToolbar::sltHandleOpenToolGlobal()
     78{
     79    /* Acquire sender action: */
     80    const QAction *pAction = sender() ? qobject_cast<const QAction*>(sender()) : 0;
     81    /* Acquire action type: */
     82    const ToolTypeGlobal enmType = pAction->property("ToolTypeGlobal").value<ToolTypeGlobal>();
     83
     84    /* Get corresponding tab id: */
     85    QUuid idTab;
     86    if (m_mapTabIdsGlobal.contains(enmType))
     87        idTab = m_mapTabIdsGlobal.value(enmType);
     88    else
     89    {
     90        idTab = m_pTabBarGlobal->addTab(pAction->icon(), pAction->text().remove('&'));
     91        m_mapTabIdsGlobal[enmType] = idTab;
     92    }
     93    /* And make it active: */
     94    m_pTabBarGlobal->setCurrent(idTab);
     95
     96    /* Notify listeners: */
     97    emit sigToolOpenedGlobal(enmType);
     98}
     99
    76100void UIToolsToolbar::sltHandleCloseToolMachine(const QUuid &uuid)
    77101{
     
    88112}
    89113
     114void UIToolsToolbar::sltHandleCloseToolGlobal(const QUuid &uuid)
     115{
     116    /* If the ID is registered: */
     117    if (m_mapTabIdsGlobal.values().contains(uuid))
     118    {
     119        /* Notify listeners: */
     120        emit sigToolClosedGlobal(m_mapTabIdsGlobal.key(uuid));
     121
     122        /* And remove the tab: */
     123        m_pTabBarGlobal->removeTab(uuid);
     124        m_mapTabIdsGlobal.remove(m_mapTabIdsGlobal.key(uuid));
     125    }
     126}
     127
    90128void UIToolsToolbar::sltHandleToolChosenMachine(const QUuid &uuid)
    91129{
     
    93131    if (m_mapTabIdsMachine.values().contains(uuid))
    94132        emit sigToolOpenedMachine(m_mapTabIdsMachine.key(uuid));
     133}
     134
     135void UIToolsToolbar::sltHandleToolChosenGlobal(const QUuid &uuid)
     136{
     137    /* If the ID is registered => Notify listeners: */
     138    if (m_mapTabIdsGlobal.values().contains(uuid))
     139        emit sigToolOpenedGlobal(m_mapTabIdsGlobal.key(uuid));
    95140}
    96141
     
    107152        if (pAction == m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine))
    108153            m_pLayoutStacked->setCurrentWidget(m_pTabBarMachine);
     154
     155        else
     156
     157        if (pAction == m_pActionPool->action(UIActionIndexST_M_Tools_T_Global))
     158            m_pLayoutStacked->setCurrentWidget(m_pTabBarGlobal);
    109159    }
    110160}
     
    143193    connect(m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine), &UIAction::toggled,
    144194            this, &UIToolsToolbar::sltHandleActionToggle);
     195
     196    /* Configure 'Global' menu: */
     197    UIMenu *pMenuGlobal = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global)->menu();
     198    AssertPtrReturnVoid(pMenuGlobal);
     199    {
     200        /* Add 'Virtual Media Manager' action: */
     201        pMenuGlobal->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager));
     202        connect(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager), &UIAction::triggered,
     203                this, &UIToolsToolbar::sltHandleOpenToolGlobal);
     204        m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager)
     205            ->setProperty("ToolTypeGlobal", QVariant::fromValue(ToolTypeGlobal_VirtualMedia));
     206
     207        /* Add 'Host Network Manager' action: */
     208        pMenuGlobal->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager));
     209        connect(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager), &UIAction::triggered,
     210                this, &UIToolsToolbar::sltHandleOpenToolGlobal);
     211        m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager)
     212            ->setProperty("ToolTypeGlobal", QVariant::fromValue(ToolTypeGlobal_HostNetwork));
     213    }
     214
     215    /* Configure 'Global' toggle action: */
     216    m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->setMenu(pMenuGlobal);
     217    connect(m_pActionPool->action(UIActionIndexST_M_Tools_T_Global), &UIAction::toggled,
     218            this, &UIToolsToolbar::sltHandleActionToggle);
     219
     220    /* By default 'Machine' toggle action is toggled: */
     221    m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->setChecked(true);
    145222}
    146223
     
    173250            }
    174251
     252            /* Create Global tab-bar: */
     253            m_pTabBarGlobal = new UITabBar;
     254            AssertPtrReturnVoid(m_pTabBarGlobal);
     255            {
     256                /* Configure tab-bar: */
     257                connect(m_pTabBarGlobal, &UITabBar::sigTabRequestForClosing,
     258                        this, &UIToolsToolbar::sltHandleCloseToolGlobal);
     259                connect(m_pTabBarGlobal, &UITabBar::sigCurrentTabChanged,
     260                        this, &UIToolsToolbar::sltHandleToolChosenGlobal);
     261
     262                /* Add into layout: */
     263                m_pLayoutStacked->addWidget(m_pTabBarGlobal);
     264            }
     265
    175266            /* Add into layout: */
    176267            m_pLayoutMain->addLayout(m_pLayoutStacked);
     
    189280
    190281            /* Add actions: */
    191             UIAction *pActionMachine = m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine);
    192             m_pToolBar->addAction(pActionMachine);
    193             QToolButton *pNamedMenuToolButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pActionMachine));
    194             pNamedMenuToolButton->setPopupMode(QToolButton::InstantPopup);
     282            m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine));
     283            m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_T_Global));
    195284
    196285            /* Add into layout: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.h

    r68196 r68200  
    2525
    2626/* GUI includes: */
     27#include "UIToolsPaneGlobal.h"
    2728#include "UIToolsPaneMachine.h"
    2829
     
    4748    /** Notify listeners about Machine tool of particular @a enmType opened. */
    4849    void sigToolOpenedMachine(const ToolTypeMachine enmType);
     50    /** Notify listeners about Global tool of particular @a enmType opened. */
     51    void sigToolOpenedGlobal(const ToolTypeGlobal enmType);
    4952
    5053    /** Notify listeners about Machine tool of particular @a enmType closed. */
    5154    void sigToolClosedMachine(const ToolTypeMachine enmType);
     55    /** Notify listeners about Global tool of particular @a enmType closed. */
     56    void sigToolClosedGlobal(const ToolTypeGlobal enmType);
    5257
    5358public:
     
    6166    /** Handles request to open Machine tool. */
    6267    void sltHandleOpenToolMachine();
     68    /** Handles request to open Global tool. */
     69    void sltHandleOpenToolGlobal();
    6370
    6471    /** Handles request to close Machine tool with passed @a uuid. */
    6572    void sltHandleCloseToolMachine(const QUuid &uuid);
     73    /** Handles request to close Global tool with passed @a uuid. */
     74    void sltHandleCloseToolGlobal(const QUuid &uuid);
    6675
    6776    /** Handles request to make Machine tool with passed @a uuid current one. */
    6877    void sltHandleToolChosenMachine(const QUuid &uuid);
     78    /** Handles request to make Global tool with passed @a uuid current one. */
     79    void sltHandleToolChosenGlobal(const QUuid &uuid);
    6980
    7081    /** Handles action toggle. */
     
    90101    /** Holds the Machine tab-bar instance. */
    91102    UITabBar *m_pTabBarMachine;
     103    /** Holds the Global tab-bar instance. */
     104    UITabBar *m_pTabBarGlobal;
    92105
    93106    /** Holds the toolbar instance. */
     
    96109    /** Holds the map of opened Machine tool IDs. */
    97110    QMap<ToolTypeMachine, QUuid>  m_mapTabIdsMachine;
     111    /** Holds the map of opened Global tool IDs. */
     112    QMap<ToolTypeGlobal, QUuid>   m_mapTabIdsGlobal;
    98113};
    99114
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