VirtualBox

Changeset 73735 in vbox


Ignore:
Timestamp:
Aug 17, 2018 12:57:53 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: UIActionPool* and UIMediumManager classes: Move Network Manager to action-pool rails which means it is configurable via shortcut-pool now.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp

    r73734 r73735  
    20842084        setStatusTip(QApplication::translate("UIActionPool", "Refresh the list of disk image files"));
    20852085        setToolTip(tr("Refresh Disk Image Files (%1)").arg(shortcut().toString()));
     2086    }
     2087};
     2088
     2089
     2090/** Menu action extension, used as 'Network' menu class. */
     2091class UIActionMenuSelectorNetwork : public UIActionMenu
     2092{
     2093    Q_OBJECT;
     2094
     2095public:
     2096
     2097    /** Constructs action passing @a pParent to the base-class. */
     2098    UIActionMenuSelectorNetwork(UIActionPool *pParent)
     2099        : UIActionMenu(pParent)
     2100    {}
     2101
     2102protected:
     2103
     2104    /** Returns shortcut extra-data ID. */
     2105    virtual QString shortcutExtraDataID() const /* override */
     2106    {
     2107        return QString("NetworkMenu");
     2108    }
     2109
     2110    /** Handles translation event. */
     2111    virtual void retranslateUi() /* override */
     2112    {
     2113        setName(QApplication::translate("UIActionPool", "&Network"));
     2114        setStatusTip(QApplication::translate("UIActionPool", "Open the network menu"));
     2115    }
     2116};
     2117
     2118/** Simple action extension, used as 'Perform Create' action class. */
     2119class UIActionMenuSelectorNetworkPerformCreate : public UIActionSimple
     2120{
     2121    Q_OBJECT;
     2122
     2123public:
     2124
     2125    /** Constructs action passing @a pParent to the base-class. */
     2126    UIActionMenuSelectorNetworkPerformCreate(UIActionPool *pParent)
     2127        : UIActionSimple(pParent,
     2128                         ":/host_iface_add_22px.png",          ":/host_iface_add_16px.png",
     2129                         ":/host_iface_add_disabled_22px.png", ":/host_iface_add_disabled_16px.png")
     2130    {}
     2131
     2132protected:
     2133
     2134    /** Returns shortcut extra-data ID. */
     2135    virtual QString shortcutExtraDataID() const /* override */
     2136    {
     2137        return QString("CreateNetwork");
     2138    }
     2139
     2140    /** Returns default shortcut. */
     2141    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     2142    {
     2143        return QKeySequence("Ctrl+Shift+C");
     2144    }
     2145
     2146    /** Handles translation event. */
     2147    virtual void retranslateUi() /* override */
     2148    {
     2149        setName(QApplication::translate("UIActionPool", "&Create..."));
     2150        setStatusTip(QApplication::translate("UIActionPool", "Create new host-only network"));
     2151        setToolTip(tr("Create Host-only Network (%1)").arg(shortcut().toString()));
     2152    }
     2153};
     2154
     2155/** Simple action extension, used as 'Perform Remove' action class. */
     2156class UIActionMenuSelectorNetworkPerformRemove : public UIActionSimple
     2157{
     2158    Q_OBJECT;
     2159
     2160public:
     2161
     2162    /** Constructs action passing @a pParent to the base-class. */
     2163    UIActionMenuSelectorNetworkPerformRemove(UIActionPool *pParent)
     2164        : UIActionSimple(pParent,
     2165                         ":/host_iface_remove_22px.png",          ":/host_iface_remove_16px.png",
     2166                         ":/host_iface_remove_disabled_22px.png", ":/host_iface_remove_disabled_16px.png")
     2167    {}
     2168
     2169protected:
     2170
     2171    /** Returns shortcut extra-data ID. */
     2172    virtual QString shortcutExtraDataID() const /* override */
     2173    {
     2174        return QString("RemoveNetwork");
     2175    }
     2176
     2177    /** Returns default shortcut. */
     2178    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     2179    {
     2180        return QKeySequence("Ctrl+Shift+R");
     2181    }
     2182
     2183    /** Handles translation event. */
     2184    virtual void retranslateUi() /* override */
     2185    {
     2186        setName(QApplication::translate("UIActionPool", "&Remove..."));
     2187        setStatusTip(QApplication::translate("UIActionPool", "Remove selected host-only network"));
     2188        setToolTip(tr("Remove Host-only Network (%1)").arg(shortcut().toString()));
     2189    }
     2190};
     2191
     2192/** Toggle action extension, used as 'Toggle Network Properties' action class. */
     2193class UIActionMenuSelectorNetworkToggleProperties : public UIActionToggle
     2194{
     2195    Q_OBJECT;
     2196
     2197public:
     2198
     2199    /** Constructs action passing @a pParent to the base-class. */
     2200    UIActionMenuSelectorNetworkToggleProperties(UIActionPool *pParent)
     2201        : UIActionToggle(pParent,
     2202                         ":/host_iface_edit_22px.png",          ":/host_iface_edit_16px.png",
     2203                         ":/host_iface_edit_disabled_22px.png", ":/host_iface_edit_disabled_16px.png")
     2204    {}
     2205
     2206protected:
     2207
     2208    /** Returns shortcut extra-data ID. */
     2209    virtual QString shortcutExtraDataID() const /* override */
     2210    {
     2211        return QString("ToggleNetworkProperties");
     2212    }
     2213
     2214    /** Returns default shortcut. */
     2215    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     2216    {
     2217        return QKeySequence("Ctrl+Space");
     2218    }
     2219
     2220    /** Handles translation event. */
     2221    virtual void retranslateUi() /* override */
     2222    {
     2223        setName(QApplication::translate("UIActionPool", "&Properties"));
     2224        setStatusTip(QApplication::translate("UIActionPool", "Open pane with selected host-only network properties"));
     2225        setToolTip(tr("Open Host-only Network Properties (%1)").arg(shortcut().toString()));
     2226    }
     2227};
     2228
     2229/** Simple action extension, used as 'Perform Refresh' action class. */
     2230class UIActionMenuSelectorNetworkPerformRefresh : public UIActionSimple
     2231{
     2232    Q_OBJECT;
     2233
     2234public:
     2235
     2236    /** Constructs action passing @a pParent to the base-class. */
     2237    UIActionMenuSelectorNetworkPerformRefresh(UIActionPool *pParent)
     2238        : UIActionSimple(pParent,
     2239                         ":/refresh_22px.png",          ":/refresh_16px.png",
     2240                         ":/refresh_disabled_22px.png", ":/refresh_disabled_16px.png")
     2241    {}
     2242
     2243protected:
     2244
     2245    /** Returns shortcut extra-data ID. */
     2246    virtual QString shortcutExtraDataID() const /* override */
     2247    {
     2248        return QString("RefreshNetworks");
     2249    }
     2250
     2251    /** Returns default shortcut. */
     2252    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     2253    {
     2254        return QKeySequence("Ctrl+Shift+F");
     2255    }
     2256
     2257    /** Handles translation event. */
     2258    virtual void retranslateUi() /* override */
     2259    {
     2260        setName(QApplication::translate("UIActionPool", "Re&fresh..."));
     2261        setStatusTip(QApplication::translate("UIActionPool", "Refresh the list of host-only networks"));
     2262        setToolTip(tr("Refresh Host-only Networks (%1)").arg(shortcut().toString()));
    20862263    }
    20872264};
     
    21922369    m_pool[UIActionIndexST_M_Medium_S_Refresh] = new UIActionMenuSelectorMediumPerformRefresh(this);
    21932370
     2371    /* Host Network Manager actions: */
     2372    m_pool[UIActionIndexST_M_Network] = new UIActionMenuSelectorNetwork(this);
     2373    m_pool[UIActionIndexST_M_Network_S_Create] = new UIActionMenuSelectorNetworkPerformCreate(this);
     2374    m_pool[UIActionIndexST_M_Network_S_Remove] = new UIActionMenuSelectorNetworkPerformRemove(this);
     2375    m_pool[UIActionIndexST_M_Network_T_Details] = new UIActionMenuSelectorNetworkToggleProperties(this);
     2376    m_pool[UIActionIndexST_M_Network_S_Refresh] = new UIActionMenuSelectorNetworkPerformRefresh(this);
     2377
    21942378    /* Prepare update-handlers for known menus: */
    21952379    m_menuUpdateHandlers[UIActionIndexST_M_Medium].ptfs = &UIActionPoolSelector::updateMenuMedium;
     2380    m_menuUpdateHandlers[UIActionIndexST_M_Network].ptfs = &UIActionPoolSelector::updateMenuNetwork;
    21962381
    21972382    /* Call to base-class: */
     
    22192404    /* 'Virtual Media Manager' menu: */
    22202405    updateMenuMedium();
     2406    /* 'Host Network Manager' menu: */
     2407    updateMenuNetwork();
    22212408}
    22222409
     
    22662453}
    22672454
     2455void UIActionPoolSelector::updateMenuNetwork()
     2456{
     2457    /* Get corresponding menu: */
     2458    UIMenu *pMenu = action(UIActionIndexST_M_Network)->menu();
     2459    /* Clear contents: */
     2460    pMenu->clear();
     2461
     2462    /* Separator? */
     2463    bool fSeparator = false;
     2464
     2465    /* 'Create' action: */
     2466    fSeparator = addAction(pMenu, action(UIActionIndexST_M_Network_S_Create)) || fSeparator;
     2467    /* 'Remove' action: */
     2468    fSeparator = addAction(pMenu, action(UIActionIndexST_M_Network_S_Remove)) || fSeparator;
     2469
     2470    /* Separator? */
     2471    if (fSeparator)
     2472    {
     2473        pMenu->addSeparator();
     2474        fSeparator = false;
     2475    }
     2476
     2477    /* 'Properties' action: */
     2478    fSeparator = addAction(pMenu, action(UIActionIndexST_M_Network_T_Details)) || fSeparator;
     2479
     2480//    /* Separator? */
     2481//    if (fSeparator)
     2482//    {
     2483//        pMenu->addSeparator();
     2484//        fSeparator = false;
     2485//    }
     2486
     2487//    /* 'Refresh' action: */
     2488//    fSeparator = addAction(pMenu, action(UIActionIndexST_M_Network_S_Refresh)) || fSeparator;;
     2489
     2490    /* Mark menu as valid: */
     2491    m_invalidations.remove(UIActionIndexST_M_Network);
     2492}
     2493
    22682494void UIActionPoolSelector::updateShortcuts()
    22692495{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.h

    r73717 r73735  
    126126    UIActionIndexST_M_Medium_S_Refresh,
    127127
     128    /* Host Network Manager actions: */
     129    UIActionIndexST_M_Network,
     130    UIActionIndexST_M_Network_S_Create,
     131    UIActionIndexST_M_Network_S_Remove,
     132    UIActionIndexST_M_Network_T_Details,
     133    UIActionIndexST_M_Network_S_Refresh,
     134
    128135    /* Maximum index: */
    129136    UIActionIndexST_Max
     
    154161    /** Updates 'Medium' menu. */
    155162    void updateMenuMedium();
     163    /** Updates 'Network' menu. */
     164    void updateMenuNetwork();
    156165
    157166    /** Updates shortcuts. */
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.cpp

    r72696 r73735  
    2929# include "QIDialogButtonBox.h"
    3030# include "QITreeWidget.h"
     31# include "UIActionPoolSelector.h"
    3132# include "UIExtraDataManager.h"
    3233# include "UIIconPool.h"
     
    192193*********************************************************************************************************************************/
    193194
    194 UIHostNetworkManagerWidget::UIHostNetworkManagerWidget(EmbedTo enmEmbedding, QWidget *pParent /* = 0 */)
     195UIHostNetworkManagerWidget::UIHostNetworkManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, QWidget *pParent /* = 0 */)
    195196    : QIWithRetranslateUI<QWidget>(pParent)
    196197    , m_enmEmbedding(enmEmbedding)
     198    , m_pActionPool(pActionPool)
    197199    , m_pToolBar(0)
    198     , m_pMenu(0)
    199     , m_pActionAdd(0)
    200     , m_pActionRemove(0)
    201     , m_pActionDetails(0)
    202     , m_pActionRefresh(0)
    203200    , m_pTreeWidget(0)
    204201    , m_pDetailsWidget(0)
     
    208205}
    209206
     207QMenu *UIHostNetworkManagerWidget::menu() const
     208{
     209    return m_pActionPool->action(UIActionIndexST_M_Network)->menu();
     210}
     211
    210212void UIHostNetworkManagerWidget::retranslateUi()
    211213{
    212     /* Translate menu: */
    213     if (m_pMenu)
    214         m_pMenu->setTitle(UIHostNetworkManager::tr("&Network"));
    215 
    216     /* Translate actions: */
    217     if (m_pActionAdd)
    218     {
    219         m_pActionAdd->setText(UIHostNetworkManager::tr("&Create"));
    220         m_pActionAdd->setToolTip(UIHostNetworkManager::tr("Create Host-only Network (%1)").arg(m_pActionAdd->shortcut().toString()));
    221         m_pActionAdd->setStatusTip(UIHostNetworkManager::tr("Create new host-only network"));
    222     }
    223     if (m_pActionRemove)
    224     {
    225         m_pActionRemove->setText(UIHostNetworkManager::tr("&Remove..."));
    226         m_pActionRemove->setToolTip(UIHostNetworkManager::tr("Remove Host-only Network (%1)").arg(m_pActionRemove->shortcut().toString()));
    227         m_pActionRemove->setStatusTip(UIHostNetworkManager::tr("Remove selected host-only network"));
    228     }
    229     if (m_pActionDetails)
    230     {
    231         m_pActionDetails->setText(UIHostNetworkManager::tr("&Properties..."));
    232         m_pActionDetails->setToolTip(UIHostNetworkManager::tr("Open Host-only Network Properties (%1)").arg(m_pActionDetails->shortcut().toString()));
    233         m_pActionDetails->setStatusTip(UIHostNetworkManager::tr("Open pane with selected host-only network properties"));
    234     }
    235     if (m_pActionRefresh)
    236     {
    237         m_pActionRefresh->setText(UIHostNetworkManager::tr("&Refresh..."));
    238         m_pActionRefresh->setToolTip(UIHostNetworkManager::tr("Refresh Host-only Networks (%1)").arg(m_pActionRefresh->shortcut().toString()));
    239         m_pActionRefresh->setStatusTip(UIHostNetworkManager::tr("Refresh the list of host-only networks"));
    240     }
    241 
    242214    /* Adjust toolbar: */
    243215#ifdef VBOX_WS_MAC
     
    404376}
    405377
    406 void UIHostNetworkManagerWidget::sltAddHostNetwork()
     378void UIHostNetworkManagerWidget::sltCreateHostNetwork()
    407379{
    408380    /* Get host for further activities: */
     
    668640
    669641    /* Update actions availability: */
    670     if (m_pActionRemove)
    671         m_pActionRemove->setEnabled(pItem);
    672     if (m_pActionDetails)
    673         m_pActionDetails->setEnabled(pItem);
     642    m_pActionPool->action(UIActionIndexST_M_Network_S_Remove)->setEnabled(pItem);
     643    m_pActionPool->action(UIActionIndexST_M_Network_T_Details)->setEnabled(pItem);
    674644
    675645    /* If there is an item => update details data: */
     
    684654}
    685655
    686 void UIHostNetworkManagerWidget::sltHandleContextMenuRequest(const QPoint &pos)
     656void UIHostNetworkManagerWidget::sltHandleContextMenuRequest(const QPoint &position)
    687657{
    688658    /* Compose temporary context-menu: */
    689659    QMenu menu;
    690     if (m_pTreeWidget->itemAt(pos))
    691     {
    692         if (m_pActionRemove)
    693             menu.addAction(m_pActionRemove);
    694         if (m_pActionDetails)
    695             menu.addAction(m_pActionDetails);
     660    if (m_pTreeWidget->itemAt(position))
     661    {
     662        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Network_S_Remove));
     663        menu.addSeparator();
     664        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Network_T_Details));
    696665    }
    697666    else
    698667    {
    699         if (m_pActionAdd)
    700             menu.addAction(m_pActionAdd);
     668        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Network_S_Create));
     669//        menu.addSeparator();
     670//        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Network_S_Refresh));
    701671    }
    702672    /* And show it: */
    703     menu.exec(m_pTreeWidget->mapToGlobal(pos));
     673    menu.exec(m_pTreeWidget->mapToGlobal(position));
    704674}
    705675
     
    729699void UIHostNetworkManagerWidget::prepareActions()
    730700{
    731     /* Create 'Add' action: */
    732     m_pActionAdd = new QAction(this);
    733     AssertPtrReturnVoid(m_pActionAdd);
    734     {
    735         /* Configure 'Add' action: */
    736         m_pActionAdd->setShortcut(QKeySequence("Ctrl+A"));
    737         m_pActionAdd->setIcon(UIIconPool::iconSetFull(":/host_iface_add_22px.png",
    738                                                       ":/host_iface_add_16px.png",
    739                                                       ":/host_iface_add_disabled_22px.png",
    740                                                       ":/host_iface_add_disabled_16px.png"));
    741         connect(m_pActionAdd, &QAction::triggered, this, &UIHostNetworkManagerWidget::sltAddHostNetwork);
    742     }
    743 
    744     /* Create 'Remove' action: */
    745     m_pActionRemove = new QAction(this);
    746     AssertPtrReturnVoid(m_pActionRemove);
    747     {
    748         /* Configure 'Remove' action: */
    749         m_pActionRemove->setShortcut(QKeySequence("Del"));
    750         m_pActionRemove->setIcon(UIIconPool::iconSetFull(":/host_iface_remove_22px.png",
    751                                                          ":/host_iface_remove_16px.png",
    752                                                          ":/host_iface_remove_disabled_22px.png",
    753                                                          ":/host_iface_remove_disabled_16px.png"));
    754         connect(m_pActionRemove, &QAction::triggered, this, &UIHostNetworkManagerWidget::sltRemoveHostNetwork);
    755     }
    756 
    757     /* Create 'Details' action: */
    758     m_pActionDetails = new QAction(this);
    759     AssertPtrReturnVoid(m_pActionDetails);
    760     {
    761         /* Configure 'Details' action: */
    762         m_pActionDetails->setCheckable(true);
    763         m_pActionDetails->setShortcut(QKeySequence("Ctrl+Space"));
    764         m_pActionDetails->setIcon(UIIconPool::iconSetFull(":/host_iface_edit_22px.png",
    765                                                           ":/host_iface_edit_16px.png",
    766                                                           ":/host_iface_edit_disabled_22px.png",
    767                                                           ":/host_iface_edit_disabled_16px.png"));
    768         connect(m_pActionDetails, &QAction::toggled, this, &UIHostNetworkManagerWidget::sltToggleHostNetworkDetailsVisibility);
    769     }
    770 
    771     /* Create 'Refresh' action: */
    772     m_pActionRefresh = new QAction(this);
    773     AssertPtrReturnVoid(m_pActionRefresh);
    774     {
    775         /* Configure 'Details' action: */
    776         m_pActionRefresh->setCheckable(true);
    777         m_pActionRefresh->setShortcut(QKeySequence(QKeySequence::Refresh));
    778         m_pActionRefresh->setIcon(UIIconPool::iconSetFull(":/refresh_22px.png",
    779                                                           ":/refresh_16px.png",
    780                                                           ":/refresh_disabled_22px.png",
    781                                                           ":/refresh_disabled_16px.png"));
    782         connect(m_pActionRefresh, &QAction::toggled, this, &UIHostNetworkManagerWidget::sltRefreshHostNetworks);
    783     }
    784 
    785     /* Prepare menu: */
    786     prepareMenu();
    787 }
    788 
    789 void UIHostNetworkManagerWidget::prepareMenu()
    790 {
    791     /* Create 'Network' menu: */
    792     m_pMenu = new QMenu(this);
    793     AssertPtrReturnVoid(m_pMenu);
    794     {
    795         /* Configure menu: */
    796         if (m_pActionAdd)
    797             m_pMenu->addAction(m_pActionAdd);
    798         if (m_pActionRemove)
    799             m_pMenu->addAction(m_pActionRemove);
    800         if (m_pActionDetails)
    801             m_pMenu->addAction(m_pActionDetails);
    802 //        if (m_pActionRefresh)
    803 //            m_pMenu->addAction(m_pActionRefresh);
    804     }
     701    /* Connect actions: */
     702    connect(m_pActionPool->action(UIActionIndexST_M_Network_S_Create), &QAction::triggered,
     703            this, &UIHostNetworkManagerWidget::sltCreateHostNetwork);
     704    connect(m_pActionPool->action(UIActionIndexST_M_Network_S_Remove), &QAction::triggered,
     705            this, &UIHostNetworkManagerWidget::sltRemoveHostNetwork);
     706    connect(m_pActionPool->action(UIActionIndexST_M_Network_T_Details), &QAction::toggled,
     707            this, &UIHostNetworkManagerWidget::sltToggleHostNetworkDetailsVisibility);
     708    connect(m_pActionPool->action(UIActionIndexST_M_Network_S_Refresh), &QAction::triggered,
     709            this, &UIHostNetworkManagerWidget::sltRefreshHostNetworks);
    805710}
    806711
     
    839744        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    840745        /* Add toolbar actions: */
    841         if (m_pActionAdd)
    842             m_pToolBar->addAction(m_pActionAdd);
    843         if (m_pActionRemove)
    844             m_pToolBar->addAction(m_pActionRemove);
    845         if ((m_pActionAdd || m_pActionRemove) && m_pActionDetails)
    846             m_pToolBar->addSeparator();
    847         if (m_pActionDetails)
    848             m_pToolBar->addAction(m_pActionDetails);
    849 //        if (m_pActionDetails && m_pActionRefresh)
    850 //            m_pToolBar->addSeparator();
    851 //        if (m_pActionRefresh)
    852 //            m_pToolBar->addAction(m_pActionRefresh);
     746        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Network_S_Create));
     747        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Network_S_Remove));
     748        m_pToolBar->addSeparator();
     749        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Network_T_Details));
     750//        m_pToolBar->addSeparator();
     751//        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Network_S_Refresh));
    853752#ifdef VBOX_WS_MAC
    854753        /* Check whether we are embedded into a stack: */
     
    886785        connect(m_pTreeWidget, &QITreeWidget::itemChanged,
    887786                this, &UIHostNetworkManagerWidget::sltHandleItemChange);
    888         if (m_pActionDetails)
    889             connect(m_pTreeWidget, &QITreeWidget::itemDoubleClicked,
    890                     m_pActionDetails, &QAction::setChecked);
     787        connect(m_pTreeWidget, &QITreeWidget::itemDoubleClicked,
     788                m_pActionPool->action(UIActionIndexST_M_Network_T_Details), &QAction::setChecked);
    891789
    892790        /* Add into layout: */
     
    919817{
    920818    /* Details action/widget: */
    921     m_pActionDetails->setChecked(gEDataManager->hostNetworkManagerDetailsExpanded());
     819    m_pActionPool->action(UIActionIndexST_M_Network_T_Details)->setChecked(gEDataManager->hostNetworkManagerDetailsExpanded());
    922820}
    923821
     
    1050948*********************************************************************************************************************************/
    1051949
     950UIHostNetworkManagerFactory::UIHostNetworkManagerFactory(UIActionPool *pActionPool /* = 0 */)
     951    : m_pActionPool(pActionPool)
     952{
     953}
     954
    1052955void UIHostNetworkManagerFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget)
    1053956{
    1054     pDialog = new UIHostNetworkManager(pCenterWidget);
     957    pDialog = new UIHostNetworkManager(pCenterWidget, m_pActionPool);
    1055958}
    1056959
     
    1060963*********************************************************************************************************************************/
    1061964
    1062 UIHostNetworkManager::UIHostNetworkManager(QWidget *pCenterWidget)
     965UIHostNetworkManager::UIHostNetworkManager(QWidget *pCenterWidget, UIActionPool *pActionPool)
    1063966    : QIWithRetranslateUI<QIManagerDialog>(pCenterWidget)
     967    , m_pActionPool(pActionPool)
    1064968{
    1065969}
     
    11081012{
    11091013    /* Create widget: */
    1110     UIHostNetworkManagerWidget *pWidget = new UIHostNetworkManagerWidget(EmbedTo_Dialog, this);
     1014    UIHostNetworkManagerWidget *pWidget = new UIHostNetworkManagerWidget(EmbedTo_Dialog, m_pActionPool, this);
    11111015    AssertPtrReturnVoid(pWidget);
    11121016    {
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.h

    r68962 r73735  
    3232class QIDialogButtonBox;
    3333class QITreeWidget;
     34class UIActionPool;
    3435class UIHostNetworkDetailsWidget;
    3536class UIItemHostNetwork;
     
    5354
    5455    /** Constructs Host Network Manager widget. */
    55     UIHostNetworkManagerWidget(EmbedTo enmEmbedding, QWidget *pParent = 0);
     56    UIHostNetworkManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, QWidget *pParent = 0);
    5657
    5758    /** Returns the menu. */
    58     QMenu *menu() const { return m_pMenu; }
     59    QMenu *menu() const;
    5960
    6061#ifdef VBOX_WS_MAC
     
    9192    /** @name Menu/action stuff.
    9293      * @{ */
    93         /** Handles command to add host network. */
    94         void sltAddHostNetwork();
     94        /** Handles command to create host network. */
     95        void sltCreateHostNetwork();
    9596        /** Handles command to remove host network. */
    9697        void sltRemoveHostNetwork();
     
    124125        /** Prepares actions. */
    125126        void prepareActions();
    126         /** Prepares menu. */
    127         void prepareMenu();
    128127        /** Prepares widgets. */
    129128        void prepareWidgets();
     
    158157        /** Holds the widget embedding type. */
    159158        const EmbedTo m_enmEmbedding;
     159        /** Holds the action-pool reference. */
     160        UIActionPool *m_pActionPool;
    160161    /** @} */
    161162
     
    164165        /** Holds the toolbar instance. */
    165166        UIToolBar *m_pToolBar;
    166         /** Holds menu-bar menu object instance. */
    167         QMenu     *m_pMenu;
    168         /** Holds the Add action instance. */
    169         QAction   *m_pActionAdd;
    170         /** Holds the Remove action instance. */
    171         QAction   *m_pActionRemove;
    172         /** Holds the Details action instance. */
    173         QAction   *m_pActionDetails;
    174         /** Holds the Refresh action instance. */
    175         QAction   *m_pActionRefresh;
    176167    /** @} */
    177168
     
    189180class UIHostNetworkManagerFactory : public QIManagerDialogFactory
    190181{
     182public:
     183
     184    /** Constructs Media Manager factory acquiring additional arguments.
     185      * @param  pActionPool  Brings the action-pool reference. */
     186    UIHostNetworkManagerFactory(UIActionPool *pActionPool = 0);
     187
    191188protected:
    192189
     
    194191      * @param  pCenterWidget  Brings the widget reference to center according to. */
    195192    virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) /* override */;
     193
     194    /** Holds the action-pool reference. */
     195    UIActionPool *m_pActionPool;
    196196};
    197197
     
    220220
    221221    /** Constructs Host Network Manager dialog.
    222       * @param  pCenterWidget  Brings the widget reference to center according to. */
    223     UIHostNetworkManager(QWidget *pCenterWidget);
     222      * @param  pCenterWidget  Brings the widget reference to center according to.
     223      * @param  pActionPool    Brings the action-pool reference. */
     224    UIHostNetworkManager(QWidget *pCenterWidget, UIActionPool *pActionPool);
    224225
    225226    /** @name Event-handling stuff.
     
    247248    /** @} */
    248249
     250    /** @name Action related variables.
     251      * @{ */
     252        /** Holds the action-pool reference. */
     253        UIActionPool *m_pActionPool;
     254    /** @} */
     255
    249256    /** Allow factory access to private/protected members: */
    250257    friend class UIHostNetworkManagerFactory;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp

    r73721 r73735  
    131131            {
    132132                /* Create Host Network Manager: */
    133                 m_pPaneNetwork = new UIHostNetworkManagerWidget(EmbedTo_Stack);
     133                m_pPaneNetwork = new UIHostNetworkManagerWidget(EmbedTo_Stack, m_pActionPool);
    134134                AssertPtrReturnVoid(m_pPaneNetwork);
    135135                {
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r73721 r73735  
    428428    if (!m_pManagerHostNetwork)
    429429    {
    430         UIHostNetworkManagerFactory().prepare(m_pManagerHostNetwork, this);
     430        UIHostNetworkManagerFactory(m_pActionPool).prepare(m_pManagerHostNetwork, this);
    431431        connect(m_pManagerHostNetwork, &QIManagerDialog::sigClose,
    432432                this, &UIVirtualBoxManager::sltCloseHostNetworkManagerWindow);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r73717 r73735  
    484484    if (!m_pManagerHostNetwork)
    485485    {
    486         UIHostNetworkManagerFactory().prepare(m_pManagerHostNetwork, this);
     486        UIHostNetworkManagerFactory(m_pActionPool).prepare(m_pManagerHostNetwork, this);
    487487        connect(m_pManagerHostNetwork, &QIManagerDialog::sigClose,
    488488                this, &UISelectorWindow::sltCloseHostNetworkManagerWindow);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.cpp

    r73717 r73735  
    123123            {
    124124                /* Create Host Network Manager: */
    125                 m_pPaneNetwork = new UIHostNetworkManagerWidget(EmbedTo_Stack);
     125                m_pPaneNetwork = new UIHostNetworkManagerWidget(EmbedTo_Stack, m_pActionPool);
    126126                AssertPtrReturnVoid(m_pPaneNetwork);
    127127                {
Note: See TracChangeset for help on using the changeset viewer.

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