VirtualBox

儲存庫 vbox 的更動 66761


忽略:
時間撮記:
2017-5-3 下午05:15:34 (8 年 以前)
作者:
vboxsync
訊息:

FE/Qt: bugref:8847: Wiping out host-only network related stuff from Global Preferences.

位置:
trunk/src/VBox/Frontends/VirtualBox
檔案:
刪除 3 筆資料
修改 7 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r66681 r66761  
    413413        src/settings/global/UIGlobalSettingsNetwork.h \
    414414        src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h \
    415         src/settings/global/UIGlobalSettingsNetworkDetailsHost.h \
    416415        src/settings/global/UIGlobalSettingsPortForwardingDlg.h \
    417416        src/settings/machine/UIMachineSettingsAudio.h \
     
    719718        src/settings/global/UIGlobalSettingsNetwork.cpp \
    720719        src/settings/global/UIGlobalSettingsNetworkDetailsNAT.cpp \
    721         src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp \
    722720        src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp \
    723721        src/settings/machine/UIMachineSettingsAudio.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r64683 r66761  
    3333    src/settings/global/UIGlobalSettingsNetwork.ui \
    3434    src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui \
    35     src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui \
    3635    src/settings/global/UIGlobalSettingsExtension.ui \
    3736    src/settings/global/UIGlobalSettingsProxy.ui \
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkDetailsDialog.cpp

    r66726 r66761  
    2323# include <QCheckBox>
    2424# include <QLabel>
     25# include <QStyleOption>
    2526# include <QRegExpValidator>
     27# include <QVBoxLayout>
    2628
    2729/* GUI includes: */
    2830# include "QILineEdit.h"
    29 # include "UIGlobalSettingsNetwork.h"
     31# include "QITabWidget.h"
    3032# include "UIHostNetworkDetailsDialog.h"
    3133# include "UIIconPool.h"
     34
     35/* Other VBox includes: */
     36# include "iprt/assert.h"
    3237
    3338#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
  • trunk/src/VBox/Frontends/VirtualBox/src/precomp.h

    r66755 r66761  
    484484#include "UIGlobalSettingsLanguage.h"
    485485#include "UIGlobalSettingsNetwork.h"
    486 #include "UIGlobalSettingsNetworkDetailsHost.h"
    487486#include "UIGlobalSettingsNetworkDetailsNAT.h"
    488487#include "UIGlobalSettingsPortForwardingDlg.h"
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp

    r66678 r66761  
    3030# include "UIGlobalSettingsNetwork.h"
    3131# include "UIGlobalSettingsNetworkDetailsNAT.h"
    32 # include "UIGlobalSettingsNetworkDetailsHost.h"
    3332
    3433/* COM includes: */
     
    10099
    101100
    102 /** Global settings: Network page: Host network tree-widget item. */
    103 class UIItemNetworkHost : public QITreeWidgetItem, public UIDataSettingsGlobalNetworkHost
    104 {
    105 public:
    106 
    107     /** Constructs item. */
    108     UIItemNetworkHost();
    109 
    110     /** Updates item fields from data. */
    111     void updateFields();
    112 
    113     /** Performs validation, updates @a messages list if something is wrong. */
    114     bool validate(UIValidationMessage &messages);
    115 
    116     /** Returns item name. */
    117     QString name() const { return m_interface.m_strName; }
    118 };
    119 
    120 
    121101/*********************************************************************************************************************************
    122102*   Class UIItemNetworkNAT implementation.                                                                                       *
     
    231211
    232212/*********************************************************************************************************************************
    233 *   Class UIItemNetworkHost implementation.                                                                                      *
     213*   Class UIGlobalSettingsNetwork implementation.                                                                                *
    234214*********************************************************************************************************************************/
    235215
    236 UIItemNetworkHost::UIItemNetworkHost()
    237     : QITreeWidgetItem()
    238 {
    239 }
    240 
    241 void UIItemNetworkHost::updateFields()
    242 {
    243     /* Compose item name/tool-tip: */
    244     setText(0, m_interface.m_strName);
    245     const QString strHeader("<tr><td><nobr>%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
    246     const QString strSubHeader("<tr><td><nobr>&nbsp;&nbsp;%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
    247     QString strToolTip;
    248 
    249     /* Host interface information: */
    250     strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("Adapter"))
    251                            .arg(m_interface.m_fDhcpClientEnabled ?
    252                                 UIGlobalSettingsNetwork::tr("Automatically configured", "interface") :
    253                                 UIGlobalSettingsNetwork::tr("Manually configured", "interface"));
    254     if (!m_interface.m_fDhcpClientEnabled)
    255     {
    256         strToolTip += strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv4 Address"))
    257                                   .arg(m_interface.m_strInterfaceAddress.isEmpty() ?
    258                                        UIGlobalSettingsNetwork::tr ("Not set", "address") :
    259                                        m_interface.m_strInterfaceAddress) +
    260                       strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv4 Network Mask"))
    261                                   .arg(m_interface.m_strInterfaceMask.isEmpty() ?
    262                                        UIGlobalSettingsNetwork::tr ("Not set", "mask") :
    263                                        m_interface.m_strInterfaceMask);
    264         if (m_interface.m_fIpv6Supported)
    265         {
    266             strToolTip += strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv6 Address"))
    267                                       .arg(m_interface.m_strInterfaceAddress6.isEmpty() ?
    268                                            UIGlobalSettingsNetwork::tr("Not set", "address") :
    269                                            m_interface.m_strInterfaceAddress6) +
    270                           strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv6 Network Mask Length"))
    271                                       .arg(m_interface.m_strInterfaceMaskLength6.isEmpty() ?
    272                                            UIGlobalSettingsNetwork::tr("Not set", "length") :
    273                                            m_interface.m_strInterfaceMaskLength6);
    274         }
    275     }
    276 
    277     /* DHCP server information: */
    278     strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("DHCP Server"))
    279                            .arg(m_dhcpserver.m_fDhcpServerEnabled ?
    280                                 UIGlobalSettingsNetwork::tr("Enabled", "server") :
    281                                 UIGlobalSettingsNetwork::tr("Disabled", "server"));
    282     if (m_dhcpserver.m_fDhcpServerEnabled)
    283     {
    284         strToolTip += strSubHeader.arg(UIGlobalSettingsNetwork::tr("Address"))
    285                                   .arg(m_dhcpserver.m_strDhcpServerAddress.isEmpty() ?
    286                                        UIGlobalSettingsNetwork::tr("Not set", "address") :
    287                                        m_dhcpserver.m_strDhcpServerAddress) +
    288                       strSubHeader.arg(UIGlobalSettingsNetwork::tr("Network Mask"))
    289                                   .arg(m_dhcpserver.m_strDhcpServerMask.isEmpty() ?
    290                                        UIGlobalSettingsNetwork::tr("Not set", "mask") :
    291                                        m_dhcpserver.m_strDhcpServerMask) +
    292                       strSubHeader.arg(UIGlobalSettingsNetwork::tr("Lower Bound"))
    293                                   .arg(m_dhcpserver.m_strDhcpLowerAddress.isEmpty() ?
    294                                        UIGlobalSettingsNetwork::tr("Not set", "bound") :
    295                                        m_dhcpserver.m_strDhcpLowerAddress) +
    296                       strSubHeader.arg(UIGlobalSettingsNetwork::tr("Upper Bound"))
    297                                   .arg(m_dhcpserver.m_strDhcpUpperAddress.isEmpty() ?
    298                                        UIGlobalSettingsNetwork::tr("Not set", "bound") :
    299                                        m_dhcpserver.m_strDhcpUpperAddress);
    300     }
    301 
    302     /* Assign tool-tip finally: */
    303     setToolTip(0, strToolTip);
    304 }
    305 
    306 bool UIItemNetworkHost::validate(UIValidationMessage &message)
     216UIGlobalSettingsNetwork::UIGlobalSettingsNetwork()
     217    : m_pActionAddNATNetwork(0), m_pActionRemoveNATNetwork(0), m_pActionEditNATNetwork(0)
     218    , m_pCache(0)
     219{
     220    /* Prepare: */
     221    prepare();
     222}
     223
     224UIGlobalSettingsNetwork::~UIGlobalSettingsNetwork()
     225{
     226    /* Cleanup: */
     227    cleanup();
     228}
     229
     230void UIGlobalSettingsNetwork::loadToCacheFrom(QVariant &data)
     231{
     232    /* Fetch data to properties: */
     233    UISettingsPageGlobal::fetchData(data);
     234
     235    /* Clear cache initially: */
     236    m_pCache->clear();
     237
     238    /* Prepare old network data: */
     239    UIDataSettingsGlobalNetwork oldNetworkData;
     240
     241    /* Gather old network data: */
     242    foreach (const CNATNetwork &network, vboxGlobal().virtualBox().GetNATNetworks())
     243        loadToCacheFromNATNetwork(network, m_pCache->child(network.GetNetworkName()));
     244
     245    /* Cache old network data: */
     246    m_pCache->cacheInitialData(oldNetworkData);
     247
     248    /* Upload properties to data: */
     249    UISettingsPageGlobal::uploadData(data);
     250}
     251
     252void UIGlobalSettingsNetwork::getFromCache()
     253{
     254    /* Load old network data from the cache: */
     255    for (int i = 0; i < m_pCache->childCount(); ++i)
     256        createTreeWidgetItemForNATNetwork(m_pCache->child(i));
     257    m_pTreeNetworkNAT->sortByColumn(1, Qt::AscendingOrder);
     258    m_pTreeNetworkNAT->setCurrentItem(m_pTreeNetworkNAT->topLevelItem(0));
     259    sltHandleCurrentItemChangeNATNetwork();
     260
     261    /* Revalidate: */
     262    revalidate();
     263}
     264
     265void UIGlobalSettingsNetwork::putToCache()
     266{
     267    /* Prepare new network data: */
     268    UIDataSettingsGlobalNetwork newNetworkData;
     269
     270    /* Gather new network data: */
     271    for (int i = 0; i < m_pTreeNetworkNAT->topLevelItemCount(); ++i)
     272    {
     273        const UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->topLevelItem(i));
     274        m_pCache->child(pItem->m_strName).cacheCurrentData(*pItem);
     275        foreach (const UIDataPortForwardingRule &rule, pItem->ipv4rules())
     276            m_pCache->child(pItem->m_strName).child1(rule.name).cacheCurrentData(rule);
     277        foreach (const UIDataPortForwardingRule &rule, pItem->ipv6rules())
     278            m_pCache->child(pItem->m_strName).child2(rule.name).cacheCurrentData(rule);
     279    }
     280
     281    /* Cache new network data: */
     282    m_pCache->cacheCurrentData(newNetworkData);
     283}
     284
     285void UIGlobalSettingsNetwork::saveFromCacheTo(QVariant &data)
     286{
     287    /* Fetch data to properties: */
     288    UISettingsPageGlobal::fetchData(data);
     289
     290    /* Update network data and failing state: */
     291    setFailed(!saveNetworkData());
     292
     293    /* Upload properties to data: */
     294    UISettingsPageGlobal::uploadData(data);
     295}
     296
     297bool UIGlobalSettingsNetwork::validate(QList<UIValidationMessage> &messages)
    307298{
    308299    /* Pass by default: */
    309300    bool fPass = true;
    310301
    311     /* Host interface validation: */
    312     if (!m_interface.m_fDhcpClientEnabled)
    313     {
    314         if (!m_interface.m_strInterfaceAddress.trimmed().isEmpty() &&
    315             (   !RTNetIsIPv4AddrStr(m_interface.m_strInterfaceAddress.toUtf8().constData())
    316              || RTNetStrIsIPv4AddrAny(m_interface.m_strInterfaceAddress.toUtf8().constData())))
    317         {
    318             message.second << UIGlobalSettingsNetwork::tr("Host interface <b>%1</b> does not currently have a valid IPv4 address.").arg(text(0));
    319             fPass = false;
    320         }
    321         if (!m_interface.m_strInterfaceMask.trimmed().isEmpty() &&
    322             (   !RTNetIsIPv4AddrStr(m_interface.m_strInterfaceMask.toUtf8().constData())
    323              || RTNetStrIsIPv4AddrAny(m_interface.m_strInterfaceMask.toUtf8().constData())))
    324         {
    325             message.second << UIGlobalSettingsNetwork::tr("Host interface <b>%1</b> does not currently have a valid IPv4 network mask.").arg(text(0));
    326             fPass = false;
    327         }
    328         if (m_interface.m_fIpv6Supported)
    329         {
    330             if (!m_interface.m_strInterfaceAddress6.trimmed().isEmpty() &&
    331                 (   !RTNetIsIPv6AddrStr(m_interface.m_strInterfaceAddress6.toUtf8().constData())
    332                  || RTNetStrIsIPv6AddrAny(m_interface.m_strInterfaceAddress6.toUtf8().constData())))
    333             {
    334                 message.second << UIGlobalSettingsNetwork::tr("Host interface <b>%1</b> does not currently have a valid IPv6 address.").arg(text(0));
    335                 fPass = false;
    336             }
    337             bool fIsMaskPrefixLengthNumber = false;
    338             const int iMaskPrefixLength = m_interface.m_strInterfaceMaskLength6.trimmed().toInt(&fIsMaskPrefixLengthNumber);
    339             if (   !fIsMaskPrefixLengthNumber
    340                 || iMaskPrefixLength < 0
    341                 || iMaskPrefixLength > 128)
    342             {
    343                 message.second << UIGlobalSettingsNetwork::tr("Host interface <b>%1</b> does not currently have a valid IPv6 network mask prefix length.").arg(text(0));
    344                 fPass = false;
    345             }
    346         }
    347     }
    348 
    349     /* DHCP server validation: */
    350     if (m_dhcpserver.m_fDhcpServerEnabled)
    351     {
    352         if (   !RTNetIsIPv4AddrStr(m_dhcpserver.m_strDhcpServerAddress.toUtf8().constData())
    353             || RTNetStrIsIPv4AddrAny(m_dhcpserver.m_strDhcpServerAddress.toUtf8().constData()))
    354         {
    355             message.second << UIGlobalSettingsNetwork::tr("Host interface <b>%1</b> does not currently have a valid DHCP server address.").arg(text(0));
    356             fPass = false;
    357         }
    358         if (   !RTNetIsIPv4AddrStr(m_dhcpserver.m_strDhcpServerMask.toUtf8().constData())
    359             || RTNetStrIsIPv4AddrAny(m_dhcpserver.m_strDhcpServerMask.toUtf8().constData()))
    360         {
    361             message.second << UIGlobalSettingsNetwork::tr("Host interface <b>%1</b> does not currently have a valid DHCP server mask.").arg(text(0));
    362             fPass = false;
    363         }
    364         if (   !RTNetIsIPv4AddrStr(m_dhcpserver.m_strDhcpLowerAddress.toUtf8().constData())
    365             || RTNetStrIsIPv4AddrAny(m_dhcpserver.m_strDhcpLowerAddress.toUtf8().constData()))
    366         {
    367             message.second << UIGlobalSettingsNetwork::tr("Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.").arg(text(0));
    368             fPass = false;
    369         }
    370         if (   !RTNetIsIPv4AddrStr(m_dhcpserver.m_strDhcpUpperAddress.toUtf8().constData())
    371             || RTNetStrIsIPv4AddrAny(m_dhcpserver.m_strDhcpUpperAddress.toUtf8().constData()))
    372         {
    373             message.second << UIGlobalSettingsNetwork::tr("Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.").arg(text(0));
    374             fPass = false;
    375         }
    376     }
    377 
    378     /* Return result: */
    379     return fPass;
    380 }
    381 
    382 
    383 /*********************************************************************************************************************************
    384 *   Class UIGlobalSettingsNetwork implementation.                                                                                *
    385 *********************************************************************************************************************************/
    386 
    387 UIGlobalSettingsNetwork::UIGlobalSettingsNetwork()
    388     : m_pActionAddNetworkNAT(0), m_pActionEditNetworkNAT(0), m_pActionRemoveNetworkNAT(0)
    389     , m_pActionAddNetworkHost(0), m_pActionEditNetworkHost(0), m_pActionRemoveNetworkHost(0)
    390     , m_pCache(0)
    391 {
    392     /* Prepare: */
    393     prepare();
    394 }
    395 
    396 UIGlobalSettingsNetwork::~UIGlobalSettingsNetwork()
    397 {
    398     /* Cleanup: */
    399     cleanup();
    400 }
    401 
    402 void UIGlobalSettingsNetwork::loadToCacheFrom(QVariant &data)
    403 {
    404     /* Fetch data to properties: */
    405     UISettingsPageGlobal::fetchData(data);
    406 
    407     /* Clear cache initially: */
    408     m_pCache->clear();
    409 
    410     /* Prepare old network data: */
    411     UIDataSettingsGlobalNetwork oldNetworkData;
    412 
    413     /* Gather old network data: */
    414     foreach (const CNATNetwork &network, vboxGlobal().virtualBox().GetNATNetworks())
    415         loadToCacheFromNetworkNAT(network, m_pCache->child1(network.GetNetworkName()));
    416     foreach (const CHostNetworkInterface &iface, vboxGlobal().host().GetNetworkInterfaces())
    417         if (iface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly)
    418             loadToCacheFromNetworkHost(iface, m_pCache->child2(iface.GetName()));
    419 
    420     /* Cache old network data: */
    421     m_pCache->cacheInitialData(oldNetworkData);
    422 
    423     /* Upload properties to data: */
    424     UISettingsPageGlobal::uploadData(data);
    425 }
    426 
    427 void UIGlobalSettingsNetwork::getFromCache()
    428 {
    429     /* Load old network data from the cache: */
    430     for (int i = 0; i < m_pCache->childCount1(); ++i)
    431         createTreeWidgetItemForNetworkNAT(m_pCache->child1(i));
    432     m_pTreeNetworkNAT->sortByColumn(1, Qt::AscendingOrder);
    433     m_pTreeNetworkNAT->setCurrentItem(m_pTreeNetworkNAT->topLevelItem(0));
    434     sltHandleCurrentItemChangeNetworkNAT();
    435     for (int i = 0; i < m_pCache->childCount2(); ++i)
    436         createTreeWidgetItemForNetworkHost(m_pCache->child2(i));
    437     m_pTreeNetworkHost->sortByColumn(0, Qt::AscendingOrder);
    438     m_pTreeNetworkHost->setCurrentItem(m_pTreeNetworkHost->topLevelItem(0));
    439     sltHandleCurrentItemChangeNetworkHost();
    440 
    441     /* Revalidate: */
    442     revalidate();
    443 }
    444 
    445 void UIGlobalSettingsNetwork::putToCache()
    446 {
    447     /* Prepare new network data: */
    448     UIDataSettingsGlobalNetwork newNetworkData;
    449 
    450     /* Gather new network data: */
    451     for (int i = 0; i < m_pTreeNetworkNAT->topLevelItemCount(); ++i)
    452     {
    453         const UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->topLevelItem(i));
    454         m_pCache->child1(pItem->m_strName).cacheCurrentData(*pItem);
    455         foreach (const UIDataPortForwardingRule &rule, pItem->ipv4rules())
    456             m_pCache->child1(pItem->m_strName).child1(rule.name).cacheCurrentData(rule);
    457         foreach (const UIDataPortForwardingRule &rule, pItem->ipv6rules())
    458             m_pCache->child1(pItem->m_strName).child2(rule.name).cacheCurrentData(rule);
    459     }
    460     for (int i = 0; i < m_pTreeNetworkHost->topLevelItemCount(); ++i)
    461     {
    462         const UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->topLevelItem(i));
    463         m_pCache->child2(pItem->m_interface.m_strName).cacheCurrentData(*pItem);
    464     }
    465 
    466     /* Cache new network data: */
    467     m_pCache->cacheCurrentData(newNetworkData);
    468 }
    469 
    470 void UIGlobalSettingsNetwork::saveFromCacheTo(QVariant &data)
    471 {
    472     /* Fetch data to properties: */
    473     UISettingsPageGlobal::fetchData(data);
    474 
    475     /* Update network data and failing state: */
    476     setFailed(!saveNetworkData());
    477 
    478     /* Upload properties to data: */
    479     UISettingsPageGlobal::uploadData(data);
    480 }
    481 
    482 bool UIGlobalSettingsNetwork::validate(QList<UIValidationMessage> &messages)
    483 {
    484     /* Pass by default: */
    485     bool fPass = true;
    486 
    487302    /* Validate NAT network items: */
    488303    {
    489304        /* Prepare message: */
    490305        UIValidationMessage message;
    491         message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(0));
    492306
    493307        /* Validate items first: */
     
    522336    }
    523337
    524     /* Validate Host network items: */
    525     {
    526         /* Prepare message: */
    527         UIValidationMessage message;
    528         message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(1));
    529 
    530         /* Validate items only: */
    531         for (int i = 0; i < m_pTreeNetworkHost->topLevelItemCount(); ++i)
    532         {
    533             UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->topLevelItem(i));
    534             if (!pItem->validate(message))
    535                 fPass = false;
    536         }
    537 
    538         /* Serialize message: */
    539         if (!message.second.isEmpty())
    540             messages << message;
    541     }
    542 
    543338    /* Return result: */
    544339    return fPass;
    545340}
    546341
    547 void UIGlobalSettingsNetwork::setOrderAfter(QWidget *pWidget)
    548 {
    549     setTabOrder(pWidget, m_pTabWidget->focusProxy());
    550     setTabOrder(m_pTabWidget->focusProxy(), m_pTreeNetworkNAT);
    551     setTabOrder(m_pTreeNetworkNAT, m_pTreeNetworkHost);
    552 }
    553 
    554342void UIGlobalSettingsNetwork::retranslateUi()
    555343{
     
    557345    Ui::UIGlobalSettingsNetwork::retranslateUi(this);
    558346
    559     /* NAT networks: */
    560     {
    561         /* Translate tree-widget columns: */
    562         m_pTreeNetworkNAT->setHeaderLabels(QStringList()
    563                                            << tr("Active", "NAT network")
    564                                            << tr("Name"));
    565 
    566         /* Translate action text: */
    567         m_pActionAddNetworkNAT->setText(tr("Add NAT Network"));
    568         m_pActionRemoveNetworkNAT->setText(tr("Remove NAT Network"));
    569         m_pActionEditNetworkNAT->setText(tr("Edit NAT Network"));
    570 
    571         m_pActionAddNetworkNAT->setWhatsThis(tr("Adds new NAT network."));
    572         m_pActionRemoveNetworkNAT->setWhatsThis(tr("Removes selected NAT network."));
    573         m_pActionEditNetworkNAT->setWhatsThis(tr("Edits selected NAT network."));
    574 
    575         m_pActionAddNetworkNAT->setToolTip(m_pActionAddNetworkNAT->whatsThis());
    576         m_pActionRemoveNetworkNAT->setToolTip(m_pActionRemoveNetworkNAT->whatsThis());
    577         m_pActionEditNetworkNAT->setToolTip(m_pActionEditNetworkNAT->whatsThis());
    578     }
    579 
    580     /* Host networks: */
    581     {
    582         /* Translate action text: */
    583         m_pActionAddNetworkHost->setText(tr("Add Host-only Network"));
    584         m_pActionRemoveNetworkHost->setText(tr("Remove Host-only Network"));
    585         m_pActionEditNetworkHost->setText(tr("Edit Host-only Network"));
    586 
    587         m_pActionAddNetworkHost->setWhatsThis(tr("Adds new host-only network."));
    588         m_pActionRemoveNetworkHost->setWhatsThis(tr("Removes selected host-only network."));
    589         m_pActionEditNetworkHost->setWhatsThis(tr("Edits selected host-only network."));
    590 
    591         m_pActionAddNetworkHost->setToolTip(m_pActionAddNetworkHost->whatsThis());
    592         m_pActionRemoveNetworkHost->setToolTip(m_pActionRemoveNetworkHost->whatsThis());
    593         m_pActionEditNetworkHost->setToolTip(m_pActionEditNetworkHost->whatsThis());
    594     }
    595 }
    596 
    597 void UIGlobalSettingsNetwork::sltAddNetworkNAT()
     347    /* Translate tree-widget columns: */
     348    m_pTreeNetworkNAT->setHeaderLabels(QStringList()
     349                                       << tr("Active", "NAT network")
     350                                       << tr("Name"));
     351
     352    /* Translate action text: */
     353    m_pActionAddNATNetwork->setText(tr("Add NAT Network"));
     354    m_pActionRemoveNATNetwork->setText(tr("Remove NAT Network"));
     355    m_pActionEditNATNetwork->setText(tr("Edit NAT Network"));
     356
     357    m_pActionAddNATNetwork->setWhatsThis(tr("Adds new NAT network."));
     358    m_pActionRemoveNATNetwork->setWhatsThis(tr("Removes selected NAT network."));
     359    m_pActionEditNATNetwork->setWhatsThis(tr("Edits selected NAT network."));
     360
     361    m_pActionAddNATNetwork->setToolTip(m_pActionAddNATNetwork->whatsThis());
     362    m_pActionRemoveNATNetwork->setToolTip(m_pActionRemoveNATNetwork->whatsThis());
     363    m_pActionEditNATNetwork->setToolTip(m_pActionEditNATNetwork->whatsThis());
     364}
     365
     366void UIGlobalSettingsNetwork::sltAddNATNetwork()
    598367{
    599368    /* Compose a set of busy names: */
     
    630399
    631400    /* Create tree-widget item: */
    632     createTreeWidgetItemForNetworkNAT(data, UIPortForwardingDataList(), UIPortForwardingDataList(), true);
     401    createTreeWidgetItemForNATNetwork(data, UIPortForwardingDataList(), UIPortForwardingDataList(), true);
    633402    m_pTreeNetworkNAT->sortByColumn(1, Qt::AscendingOrder);
    634403}
    635404
    636 void UIGlobalSettingsNetwork::sltEditNetworkNAT()
     405void UIGlobalSettingsNetwork::sltRemoveNATNetwork()
     406{
     407    /* Get network item: */
     408    UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->currentItem());
     409    AssertPtrReturnVoid(pItem);
     410
     411    /* Confirm network removal: */
     412    if (!msgCenter().confirmNATNetworkRemoval(pItem->name(), this))
     413        return;
     414
     415    /* Remove tree-widget item: */
     416    removeTreeWidgetItemOfNATNetwork(pItem);
     417}
     418
     419void UIGlobalSettingsNetwork::sltEditNATNetwork()
    637420{
    638421    /* Get network item: */
     
    652435        pItem->setIpv6rules(ipv6rules);
    653436        pItem->updateFields();
    654         sltHandleCurrentItemChangeNetworkNAT();
     437        sltHandleCurrentItemChangeNATNetwork();
    655438        /* Revalidate: */
    656439        revalidate();
     
    658441}
    659442
    660 void UIGlobalSettingsNetwork::sltRemoveNetworkNAT()
    661 {
    662     /* Get network item: */
    663     UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->currentItem());
    664     AssertPtrReturnVoid(pItem);
    665 
    666     /* Confirm network removal: */
    667     if (!msgCenter().confirmNATNetworkRemoval(pItem->name(), this))
    668         return;
    669 
    670     /* Remove tree-widget item: */
    671     removeTreeWidgetItemOfNetworkNAT(pItem);
    672 }
    673 
    674 void UIGlobalSettingsNetwork::sltHandleItemChangeNetworkNAT(QTreeWidgetItem *pChangedItem)
     443void UIGlobalSettingsNetwork::sltHandleItemChangeNATNetwork(QTreeWidgetItem *pChangedItem)
    675444{
    676445    /* Get network item: */
    677446    UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(pChangedItem);
    678     AssertMsg(pItem, ("Changed item should present!\n"));
     447    AssertPtrReturnVoid(pItem);
    679448
    680449    /* Update item data: */
     
    682451}
    683452
    684 void UIGlobalSettingsNetwork::sltHandleCurrentItemChangeNetworkNAT()
     453void UIGlobalSettingsNetwork::sltHandleCurrentItemChangeNATNetwork()
    685454{
    686455    /* Get current item: */
    687456    UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->currentItem());
     457
    688458    /* Update availability: */
    689     m_pActionRemoveNetworkNAT->setEnabled(pItem);
    690     m_pActionEditNetworkNAT->setEnabled(pItem);
    691 }
    692 
    693 void UIGlobalSettingsNetwork::sltHandleContextMenuRequestNetworkNAT(const QPoint &pos)
     459    m_pActionRemoveNATNetwork->setEnabled(pItem);
     460    m_pActionEditNATNetwork->setEnabled(pItem);
     461}
     462
     463void UIGlobalSettingsNetwork::sltHandleContextMenuRequestNATNetwork(const QPoint &position)
    694464{
    695465    /* Compose temporary context-menu: */
    696466    QMenu menu;
    697     if (m_pTreeNetworkNAT->itemAt(pos))
    698     {
    699         menu.addAction(m_pActionEditNetworkNAT);
    700         menu.addAction(m_pActionRemoveNetworkNAT);
     467    if (m_pTreeNetworkNAT->itemAt(position))
     468    {
     469        menu.addAction(m_pActionEditNATNetwork);
     470        menu.addAction(m_pActionRemoveNATNetwork);
    701471    }
    702472    else
    703473    {
    704         menu.addAction(m_pActionAddNetworkNAT);
     474        menu.addAction(m_pActionAddNATNetwork);
    705475    }
    706476    /* And show it: */
    707     menu.exec(m_pTreeNetworkNAT->mapToGlobal(pos));
    708 }
    709 
    710 void UIGlobalSettingsNetwork::sltAddNetworkHost()
    711 {
    712     /* Prepare useful variables: */
    713     CVirtualBox vbox = vboxGlobal().virtualBox();
    714     CHost host = vboxGlobal().host();
    715 
    716     /* Create Host interface: */
    717     CHostNetworkInterface iface;
    718     CProgress progress = host.CreateHostOnlyNetworkInterface(iface);
    719     if (!host.isOk())
    720         return msgCenter().cannotCreateHostNetworkInterface(host, this);
    721     msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/progress_network_interface_90px.png", this, 0);
    722     if (!progress.isOk() || progress.GetResultCode() != 0)
    723         return msgCenter().cannotCreateHostNetworkInterface(progress, this);
    724 
    725     /* Make sure DHCP server is created too: */
    726     CDHCPServer dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
    727     if (dhcp.isNull())
    728     {
    729         vbox.CreateDHCPServer(iface.GetNetworkName());
    730         if (!vbox.isOk())
    731             return msgCenter().cannotCreateDHCPServer(vbox, iface.GetNetworkName(), this);
    732         dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
    733     }
    734     AssertReturnVoid(!dhcp.isNull());
    735 
    736     /* Update tree: */
    737     const QString strCacheKey = iface.GetName();
    738     loadToCacheFromNetworkHost(iface, m_pCache->child2(strCacheKey));
    739     createTreeWidgetItemForNetworkHost(m_pCache->child2(strCacheKey), true);
    740     m_pTreeNetworkHost->sortByColumn(0, Qt::AscendingOrder);
    741 }
    742 
    743 void UIGlobalSettingsNetwork::sltEditNetworkHost()
    744 {
    745     /* Get network item: */
    746     UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->currentItem());
    747     AssertMsg(pItem, ("Current item should present!\n"));
    748 
    749     /* Edit current item data: */
    750     UIDataSettingsGlobalNetworkHost data = *pItem;
    751     UIGlobalSettingsNetworkDetailsHost details(this, data);
    752     if (details.exec() == QDialog::Accepted)
    753     {
    754         /* Put data back: */
    755         pItem->UIDataSettingsGlobalNetworkHost::operator=(data);
    756         pItem->updateFields();
    757         sltHandleCurrentItemChangeNetworkHost();
    758         /* Revalidate: */
    759         revalidate();
    760     }
    761 }
    762 
    763 void UIGlobalSettingsNetwork::sltRemoveNetworkHost()
    764 {
    765     /* Get network item: */
    766     UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->currentItem());
    767     AssertMsg(pItem, ("Current item should present!\n"));
    768     /* Get interface name: */
    769     const QString strInterfaceName(pItem->name());
    770 
    771     /* Confirm Host network removal: */
    772     if (!msgCenter().confirmHostOnlyInterfaceRemoval(strInterfaceName, this))
    773         return;
    774 
    775     /* Prepare useful variables: */
    776     CVirtualBox vbox = vboxGlobal().virtualBox();
    777     CHost host = vboxGlobal().host();
    778 
    779     /* Find corresponding interface: */
    780     const CHostNetworkInterface &iface = host.FindHostNetworkInterfaceByName(strInterfaceName);
    781     AssertReturnVoid(host.isOk() && !iface.isNull());
    782 
    783     /* Remove DHCP server if any: */
    784     const CDHCPServer &dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
    785     if (vbox.isOk() && !dhcp.isNull())
    786     {
    787         vbox.RemoveDHCPServer(dhcp);
    788         if (!vbox.isOk())
    789             return msgCenter().cannotRemoveDHCPServer(vbox, strInterfaceName, this);
    790     }
    791 
    792     /* Remove interface finally: */
    793     CProgress progress = host.RemoveHostOnlyNetworkInterface(iface.GetId());
    794     if (!host.isOk())
    795         return msgCenter().cannotRemoveHostNetworkInterface(host, strInterfaceName, this);
    796     msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/progress_network_interface_90px.png", this, 0);
    797     if (!progress.isOk() || progress.GetResultCode() != 0)
    798         return msgCenter().cannotRemoveHostNetworkInterface(progress, strInterfaceName, this);
    799 
    800     /* Update tree: */
    801     removeTreeWidgetItemOfNetworkHost(pItem);
    802 }
    803 
    804 void UIGlobalSettingsNetwork::sltHandleCurrentItemChangeNetworkHost()
    805 {
    806     /* Get current item: */
    807     UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->currentItem());
    808     /* Update availability: */
    809     m_pActionRemoveNetworkHost->setEnabled(pItem);
    810     m_pActionEditNetworkHost->setEnabled(pItem);
    811 }
    812 
    813 void UIGlobalSettingsNetwork::sltHandleContextMenuRequestNetworkHost(const QPoint &pos)
    814 {
    815     /* Compose temporary context-menu: */
    816     QMenu menu;
    817     if (m_pTreeNetworkHost->itemAt(pos))
    818     {
    819         menu.addAction(m_pActionEditNetworkHost);
    820         menu.addAction(m_pActionRemoveNetworkHost);
    821     }
    822     else
    823     {
    824         menu.addAction(m_pActionAddNetworkHost);
    825     }
    826     /* And show it: */
    827     menu.exec(m_pTreeNetworkHost->mapToGlobal(pos));
     477    menu.exec(m_pTreeNetworkNAT->mapToGlobal(position));
    828478}
    829479
     
    837487    AssertPtrReturnVoid(m_pCache);
    838488
    839     /* Tree-widget created in the .ui file. */
    840     {
    841         /* Prepare 'NAT Network' tab: */
    842         prepareTabNAT();
    843         /* Prepare 'Host Network' tab: */
    844         prepareTabHost();
     489    /* NAT Network layout created in the .ui file. */
     490    AssertPtrReturnVoid(m_pLayoutNAT);
     491    {
     492        /* Prepare network tree: */
     493        prepareNATNetworkTree();
     494        /* Prepare network toolbar: */
     495        prepareNATNetworkToolbar();
    845496        /* Prepare connections: */
    846497        prepareConnections();
     
    851502}
    852503
    853 void UIGlobalSettingsNetwork::prepareTabNAT()
    854 {
    855     /* Tab and it's layout created in the .ui file. */
    856     {
    857 #ifdef VBOX_WS_MAC
    858         /* On macOS we can do a bit of smoothness: */
    859         m_pLayoutNAT->setContentsMargins(0, 0, 0, 0);
    860 #endif
    861 
    862         /* NAT Network tree-widget created in the .ui file. */
    863         AssertPtrReturnVoid(m_pTreeNetworkNAT);
    864         {
    865             /* Configure tree-widget: */
    866             m_pTreeNetworkNAT->setColumnCount(2);
    867             m_pTreeNetworkNAT->header()->setStretchLastSection(false);
    868             m_pTreeNetworkNAT->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
    869             m_pTreeNetworkNAT->header()->setSectionResizeMode(1, QHeaderView::Stretch);
    870             m_pTreeNetworkNAT->setContextMenuPolicy(Qt::CustomContextMenu);
    871         }
    872 
    873         /* NAT Network toolbar created in the .ui file. */
    874         AssertPtrReturnVoid(m_pToolbarNetworkNAT);
    875         {
    876             /* Configure toolbar: */
    877             const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
    878             m_pToolbarNetworkNAT->setIconSize(QSize(iIconMetric, iIconMetric));
    879             m_pToolbarNetworkNAT->setOrientation(Qt::Vertical);
    880 
    881             /* Create' Add NAT Network' action: */
    882             m_pActionAddNetworkNAT = m_pToolbarNetworkNAT->addAction(UIIconPool::iconSet(":/add_host_iface_16px.png",
    883                                                                                          ":/add_host_iface_disabled_16px.png"),
    884                                                                      QString(), this, SLOT(sltAddNetworkNAT()));
    885             AssertPtrReturnVoid(m_pActionAddNetworkNAT);
    886             {
    887                 /* Configure action: */
    888                 m_pActionAddNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
    889             }
    890 
    891             /* Create 'Edit NAT Network' action: */
    892             m_pActionEditNetworkNAT = m_pToolbarNetworkNAT->addAction(UIIconPool::iconSet(":/edit_host_iface_16px.png",
    893                                                                                           ":/edit_host_iface_disabled_16px.png"),
    894                                                                       QString(), this, SLOT(sltEditNetworkNAT()));
    895             AssertPtrReturnVoid(m_pActionEditNetworkNAT);
    896             {
    897                 /* Configure action: */
    898                 m_pActionEditNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2"));
    899             }
    900 
    901             /* Create 'Remove NAT Network' action: */
    902             m_pActionRemoveNetworkNAT = m_pToolbarNetworkNAT->addAction(UIIconPool::iconSet(":/remove_host_iface_16px.png",
    903                                                                                             ":/remove_host_iface_disabled_16px.png"),
    904                                                                         QString(), this, SLOT(sltRemoveNetworkNAT()));
    905             AssertPtrReturnVoid(m_pActionRemoveNetworkNAT);
    906             {
    907                 /* Configure action: */
    908                 m_pActionRemoveNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
    909             }
    910         }
    911     }
    912 }
    913 
    914 void UIGlobalSettingsNetwork::prepareTabHost()
    915 {
    916     /* Tab and it's layout created in the .ui file. */
    917     {
    918 #ifdef VBOX_WS_MAC
    919         /* On macOS we can do a bit of smoothness: */
    920         m_pLayoutHostOnly->setContentsMargins(0, 0, 0, 0);
    921 #endif
    922 
    923         /* Host Network tree-widget created in the .ui file. */
    924         AssertPtrReturnVoid(m_pTreeNetworkHost);
    925         {
    926             /* Configure tree-widget: */
    927             m_pTreeNetworkHost->header()->hide();
    928             m_pTreeNetworkHost->setContextMenuPolicy(Qt::CustomContextMenu);
    929         }
    930 
    931         /* Host Network toolbar created in the .ui file. */
    932         AssertPtrReturnVoid(m_pToolbarNetworkHost);
    933         {
    934             /* Configure toolbar: */
    935             const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
    936             m_pToolbarNetworkHost->setIconSize(QSize(iIconMetric, iIconMetric));
    937             m_pToolbarNetworkHost->setOrientation(Qt::Vertical);
    938 
    939             /* Create 'Add Host Network' action: */
    940             m_pActionAddNetworkHost = m_pToolbarNetworkHost->addAction(UIIconPool::iconSet(":/add_host_iface_16px.png",
    941                                                                                            ":/add_host_iface_disabled_16px.png"),
    942                                                                        QString(), this, SLOT(sltAddNetworkHost()));
    943             AssertPtrReturnVoid(m_pActionAddNetworkHost);
    944             {
    945                 /* Configure action: */
    946                 m_pActionAddNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
    947             }
    948 
    949             /* Create 'Edit Host Network' action: */
    950             m_pActionEditNetworkHost = m_pToolbarNetworkHost->addAction(UIIconPool::iconSet(":/edit_host_iface_16px.png",
    951                                                                                             ":/edit_host_iface_disabled_16px.png"),
    952                                                                         QString(), this, SLOT(sltEditNetworkHost()));
    953             AssertPtrReturnVoid(m_pActionEditNetworkHost);
    954             {
    955                 /* Configure action: */
    956                 m_pActionEditNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2"));
    957             }
    958 
    959             /* Create 'Remove Host Network' action: */
    960             m_pActionRemoveNetworkHost = m_pToolbarNetworkHost->addAction(UIIconPool::iconSet(":/remove_host_iface_16px.png",
    961                                                                                               ":/remove_host_iface_disabled_16px.png"),
    962                                                                           QString(), this, SLOT(sltRemoveNetworkHost()));
    963             AssertPtrReturnVoid(m_pActionRemoveNetworkHost);
    964             {
    965                 /* Configure action: */
    966                 m_pActionRemoveNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
    967             }
     504void UIGlobalSettingsNetwork::prepareNATNetworkTree()
     505{
     506    /* NAT Network tree-widget created in the .ui file. */
     507    AssertPtrReturnVoid(m_pTreeNetworkNAT);
     508    {
     509        /* Configure tree-widget: */
     510        m_pTreeNetworkNAT->setColumnCount(2);
     511        m_pTreeNetworkNAT->header()->setStretchLastSection(false);
     512        m_pTreeNetworkNAT->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
     513        m_pTreeNetworkNAT->header()->setSectionResizeMode(1, QHeaderView::Stretch);
     514        m_pTreeNetworkNAT->setContextMenuPolicy(Qt::CustomContextMenu);
     515    }
     516}
     517
     518void UIGlobalSettingsNetwork::prepareNATNetworkToolbar()
     519{
     520    /* NAT Network toolbar created in the .ui file. */
     521    AssertPtrReturnVoid(m_pToolbarNetworkNAT);
     522    {
     523        /* Configure toolbar: */
     524        const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
     525        m_pToolbarNetworkNAT->setIconSize(QSize(iIconMetric, iIconMetric));
     526        m_pToolbarNetworkNAT->setOrientation(Qt::Vertical);
     527
     528        /* Create' Add NAT Network' action: */
     529        m_pActionAddNATNetwork = m_pToolbarNetworkNAT->addAction(UIIconPool::iconSet(":/add_host_iface_16px.png",
     530                                                                                     ":/add_host_iface_disabled_16px.png"),
     531                                                                 QString(), this, SLOT(sltAddNATNetwork()));
     532        AssertPtrReturnVoid(m_pActionAddNATNetwork);
     533        {
     534            /* Configure action: */
     535            m_pActionAddNATNetwork->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
     536        }
     537
     538        /* Create 'Remove NAT Network' action: */
     539        m_pActionRemoveNATNetwork = m_pToolbarNetworkNAT->addAction(UIIconPool::iconSet(":/remove_host_iface_16px.png",
     540                                                                                        ":/remove_host_iface_disabled_16px.png"),
     541                                                                    QString(), this, SLOT(sltRemoveNATNetwork()));
     542        AssertPtrReturnVoid(m_pActionRemoveNATNetwork);
     543        {
     544            /* Configure action: */
     545            m_pActionRemoveNATNetwork->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
     546        }
     547
     548        /* Create 'Edit NAT Network' action: */
     549        m_pActionEditNATNetwork = m_pToolbarNetworkNAT->addAction(UIIconPool::iconSet(":/edit_host_iface_16px.png",
     550                                                                                      ":/edit_host_iface_disabled_16px.png"),
     551                                                                  QString(), this, SLOT(sltEditNATNetwork()));
     552        AssertPtrReturnVoid(m_pActionEditNATNetwork);
     553        {
     554            /* Configure action: */
     555            m_pActionEditNATNetwork->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2"));
    968556        }
    969557    }
     
    974562    /* Configure 'NAT Network' connections: */
    975563    connect(m_pTreeNetworkNAT, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
    976             this, SLOT(sltHandleCurrentItemChangeNetworkNAT()));
     564            this, SLOT(sltHandleCurrentItemChangeNATNetwork()));
    977565    connect(m_pTreeNetworkNAT, SIGNAL(customContextMenuRequested(const QPoint &)),
    978             this, SLOT(sltHandleContextMenuRequestNetworkNAT(const QPoint &)));
     566            this, SLOT(sltHandleContextMenuRequestNATNetwork(const QPoint &)));
    979567    connect(m_pTreeNetworkNAT, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
    980             this, SLOT(sltEditNetworkNAT()));
     568            this, SLOT(sltEditNATNetwork()));
    981569    connect(m_pTreeNetworkNAT, SIGNAL(itemChanged(QTreeWidgetItem *, int)),
    982             this, SLOT(sltHandleItemChangeNetworkNAT(QTreeWidgetItem *)));
    983 
    984     /* Configure 'Host Network' connections: */
    985     connect(m_pTreeNetworkHost, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
    986             this, SLOT(sltHandleCurrentItemChangeNetworkHost()));
    987     connect(m_pTreeNetworkHost, SIGNAL(customContextMenuRequested(const QPoint &)),
    988             this, SLOT(sltHandleContextMenuRequestNetworkHost(const QPoint &)));
    989     connect(m_pTreeNetworkHost, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
    990             this, SLOT(sltEditNetworkHost()));
     570            this, SLOT(sltHandleItemChangeNATNetwork(QTreeWidgetItem *)));
    991571}
    992572
     
    1008588        // We need to separately remove NAT networks first because
    1009589        // there could be name collisions with the existing NAT networks.
    1010         for (int i = 0; fSuccess && i < m_pCache->childCount1(); ++i)
     590        for (int i = 0; fSuccess && i < m_pCache->childCount(); ++i)
    1011591        {
    1012592            /* Get NAT network cache: */
    1013             const UISettingsCacheGlobalNetworkNAT &cache = m_pCache->child1(i);
     593            const UISettingsCacheGlobalNetworkNAT &cache = m_pCache->child(i);
    1014594
    1015595            /* Remove NAT network marked for 'remove' or 'update' (if it can't be updated): */
    1016596            if (cache.wasRemoved() || (cache.wasUpdated() && !isNetworkCouldBeUpdated(cache)))
    1017                 fSuccess = removeNetworkNAT(cache);
     597                fSuccess = removeNATNetwork(cache);
    1018598        }
    1019599        /* For each NAT network ('creating' step): */
    1020         for (int i = 0; fSuccess && i < m_pCache->childCount1(); ++i)
     600        for (int i = 0; fSuccess && i < m_pCache->childCount(); ++i)
    1021601        {
    1022602            /* Get NAT network cache: */
    1023             const UISettingsCacheGlobalNetworkNAT &cache = m_pCache->child1(i);
     603            const UISettingsCacheGlobalNetworkNAT &cache = m_pCache->child(i);
    1024604
    1025605            /* Create NAT network marked for 'create' or 'update' (if it can't be updated): */
    1026606            if (cache.wasCreated() || (cache.wasUpdated() && !isNetworkCouldBeUpdated(cache)))
    1027                 fSuccess = createNetworkNAT(cache);
     607                fSuccess = createNATNetwork(cache);
    1028608
    1029609            else
     
    1031611            /* Update NAT network marked for 'update' (if it can be updated): */
    1032612            if (cache.wasUpdated() && isNetworkCouldBeUpdated(cache))
    1033                 fSuccess = updateNetworkNAT(cache);
    1034         }
    1035 
    1036         /* For each Host network ('updating' step): */
    1037         for (int i = 0; fSuccess && i < m_pCache->childCount2(); ++i)
    1038         {
    1039             const UISettingsCacheGlobalNetworkHost &cache = m_pCache->child2(i);
    1040             if (cache.wasUpdated())
    1041                 fSuccess = saveDataNetworkHost(m_pCache->child2(i));
     613                fSuccess = updateNATNetwork(cache);
    1042614        }
    1043615    }
     
    1046618}
    1047619
    1048 void UIGlobalSettingsNetwork::loadToCacheFromNetworkNAT(const CNATNetwork &network, UISettingsCacheGlobalNetworkNAT &cache)
     620void UIGlobalSettingsNetwork::loadToCacheFromNATNetwork(const CNATNetwork &network, UISettingsCacheGlobalNetworkNAT &cache)
    1049621{
    1050622    /* Prepare old NAT data: */
     
    1110682}
    1111683
    1112 bool UIGlobalSettingsNetwork::removeNetworkNAT(const UISettingsCacheGlobalNetworkNAT &cache)
     684bool UIGlobalSettingsNetwork::removeNATNetwork(const UISettingsCacheGlobalNetworkNAT &cache)
    1113685{
    1114686    /* Prepare result: */
     
    1143715}
    1144716
    1145 bool UIGlobalSettingsNetwork::createNetworkNAT(const UISettingsCacheGlobalNetworkNAT &cache)
     717bool UIGlobalSettingsNetwork::createNATNetwork(const UISettingsCacheGlobalNetworkNAT &cache)
    1146718{
    1147719    /* Prepare result: */
     
    1246818}
    1247819
    1248 bool UIGlobalSettingsNetwork::updateNetworkNAT(const UISettingsCacheGlobalNetworkNAT &cache)
     820bool UIGlobalSettingsNetwork::updateNATNetwork(const UISettingsCacheGlobalNetworkNAT &cache)
    1249821{
    1250822    /* Prepare result: */
     
    1375947}
    1376948
    1377 void UIGlobalSettingsNetwork::createTreeWidgetItemForNetworkNAT(const UISettingsCacheGlobalNetworkNAT &cache)
     949void UIGlobalSettingsNetwork::createTreeWidgetItemForNATNetwork(const UISettingsCacheGlobalNetworkNAT &cache)
    1378950{
    1379951    /* Get old NAT data: */
     
    1389961
    1390962    /* Pass to wrapper below: */
    1391     createTreeWidgetItemForNetworkNAT(oldNATData, ipv4rules, ipv6rules, false /* choose item? */);
    1392 }
    1393 
    1394 void UIGlobalSettingsNetwork::createTreeWidgetItemForNetworkNAT(const UIDataSettingsGlobalNetworkNAT &data,
     963    createTreeWidgetItemForNATNetwork(oldNATData, ipv4rules, ipv6rules, false /* choose item? */);
     964}
     965
     966void UIGlobalSettingsNetwork::createTreeWidgetItemForNATNetwork(const UIDataSettingsGlobalNetworkNAT &data,
    1395967                                                                const UIPortForwardingDataList &ipv4rules,
    1396968                                                                const UIPortForwardingDataList &ipv6rules,
     
    1416988}
    1417989
    1418 void UIGlobalSettingsNetwork::removeTreeWidgetItemOfNetworkNAT(UIItemNetworkNAT *pItem)
     990void UIGlobalSettingsNetwork::removeTreeWidgetItemOfNATNetwork(UIItemNetworkNAT *pItem)
    1419991{
    1420992    /* Delete passed item: */
     
    14361008}
    14371009
    1438 void UIGlobalSettingsNetwork::loadToCacheFromNetworkHost(const CHostNetworkInterface &iface, UISettingsCacheGlobalNetworkHost &cache)
    1439 {
    1440     /* Prepare old NAT data: */
    1441     UIDataSettingsGlobalNetworkHost oldHostData;
    1442 
    1443     /* Get DHCP server (create if necessary): */
    1444     CDHCPServer dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName());
    1445     if (dhcp.isNull())
    1446     {
    1447         CVirtualBox vbox = vboxGlobal().virtualBox();
    1448         vbox.CreateDHCPServer(iface.GetNetworkName());
    1449         if (!vbox.isOk())
    1450         {
    1451             msgCenter().cannotCreateDHCPServer(vbox, iface.GetNetworkName(), this);
    1452             return;
    1453         }
    1454         dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName());
    1455     }
    1456     Assert(!dhcp.isNull());
    1457     if (dhcp.isNull())
    1458         return;
    1459 
    1460     /* Host interface settings: */
    1461     oldHostData.m_interface.m_strName = iface.GetName();
    1462     oldHostData.m_interface.m_fDhcpClientEnabled = iface.GetDHCPEnabled();
    1463     oldHostData.m_interface.m_strInterfaceAddress = iface.GetIPAddress();
    1464     oldHostData.m_interface.m_strInterfaceMask = iface.GetNetworkMask();
    1465     oldHostData.m_interface.m_fIpv6Supported = iface.GetIPV6Supported();
    1466     oldHostData.m_interface.m_strInterfaceAddress6 = iface.GetIPV6Address();
    1467     oldHostData.m_interface.m_strInterfaceMaskLength6 = QString::number(iface.GetIPV6NetworkMaskPrefixLength());
    1468 
    1469     /* DHCP server settings: */
    1470     oldHostData.m_dhcpserver.m_fDhcpServerEnabled = dhcp.GetEnabled();
    1471     oldHostData.m_dhcpserver.m_strDhcpServerAddress = dhcp.GetIPAddress();
    1472     oldHostData.m_dhcpserver.m_strDhcpServerMask = dhcp.GetNetworkMask();
    1473     oldHostData.m_dhcpserver.m_strDhcpLowerAddress = dhcp.GetLowerIP();
    1474     oldHostData.m_dhcpserver.m_strDhcpUpperAddress = dhcp.GetUpperIP();
    1475 
    1476     /* Cache old NAT data: */
    1477     cache.cacheInitialData(oldHostData);
    1478 }
    1479 
    1480 bool UIGlobalSettingsNetwork::saveDataNetworkHost(const UISettingsCacheGlobalNetworkHost &cache)
    1481 {
    1482     /* Prepare result: */
    1483     bool fSuccess = true;
    1484     /* Save host-only settings from the cache: */
    1485     if (fSuccess)
    1486     {
    1487         /* Get old host-only data from the cache: */
    1488         const UIDataSettingsGlobalNetworkHost &oldHostOnlyData = cache.base();
    1489         /* Get new host-only data from the cache: */
    1490         const UIDataSettingsGlobalNetworkHost &newHostOnlyData = cache.data();
    1491 
    1492         /* Get VBox for further activities: */
    1493         CHost comHost = vboxGlobal().host();
    1494         /* Search for a host-only interface with the same name: */
    1495         CHostNetworkInterface comInterface = comHost.FindHostNetworkInterfaceByName(newHostOnlyData.m_interface.m_strName);
    1496         fSuccess = comHost.isOk() && comInterface.isNotNull();
    1497 
    1498         /* Show error message if necessary: */
    1499         if (!fSuccess)
    1500             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comHost));
    1501         else
    1502         {
    1503             /* Automatic host interface configuration: */
    1504             if (   fSuccess
    1505                 && newHostOnlyData.m_interface.m_fDhcpClientEnabled
    1506                 && newHostOnlyData.m_interface.m_fDhcpClientEnabled != oldHostOnlyData.m_interface.m_fDhcpClientEnabled)
    1507             {
    1508                 comInterface.EnableDynamicIPConfig();
    1509                 fSuccess = comInterface.isOk();
    1510             }
    1511 
    1512             else
    1513 
    1514             /* Manual host interface configuration: */
    1515             if (   fSuccess
    1516                 && !newHostOnlyData.m_interface.m_fDhcpClientEnabled)
    1517             {
    1518                 if (   fSuccess
    1519                     && (   newHostOnlyData.m_interface.m_fDhcpClientEnabled != oldHostOnlyData.m_interface.m_fDhcpClientEnabled
    1520                         || newHostOnlyData.m_interface.m_strInterfaceAddress != oldHostOnlyData.m_interface.m_strInterfaceAddress
    1521                         || newHostOnlyData.m_interface.m_strInterfaceMask != oldHostOnlyData.m_interface.m_strInterfaceMask))
    1522                 {
    1523                     comInterface.EnableStaticIPConfig(newHostOnlyData.m_interface.m_strInterfaceAddress, newHostOnlyData.m_interface.m_strInterfaceMask);
    1524                     fSuccess = comInterface.isOk();
    1525                 }
    1526 
    1527                 if (   fSuccess
    1528                     && newHostOnlyData.m_interface.m_fIpv6Supported
    1529                     && (   newHostOnlyData.m_interface.m_fDhcpClientEnabled != oldHostOnlyData.m_interface.m_fDhcpClientEnabled
    1530                         || newHostOnlyData.m_interface.m_strInterfaceAddress6 != oldHostOnlyData.m_interface.m_strInterfaceAddress6
    1531                         || newHostOnlyData.m_interface.m_strInterfaceMaskLength6 != oldHostOnlyData.m_interface.m_strInterfaceMaskLength6))
    1532                 {
    1533                     comInterface.EnableStaticIPConfigV6(newHostOnlyData.m_interface.m_strInterfaceAddress6, newHostOnlyData.m_interface.m_strInterfaceMaskLength6.toULong());
    1534                     fSuccess = comInterface.isOk();
    1535                 }
    1536             }
    1537 
    1538             /* Get network name for further activities: */
    1539             QString strNetworkName;
    1540             if (fSuccess)
    1541             {
    1542                 strNetworkName = comInterface.GetNetworkName();
    1543                 fSuccess = comInterface.isOk();
    1544             }
    1545 
    1546             /* Show error message if necessary: */
    1547             if (!fSuccess)
    1548                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comInterface));
    1549             else
    1550             {
    1551                 /* Get VBox for further activities: */
    1552                 CVirtualBox comVBox = vboxGlobal().virtualBox();
    1553                 /* Search for a DHCP server with the same name: */
    1554                 CDHCPServer comServer = comVBox.FindDHCPServerByNetworkName(strNetworkName);
    1555                 fSuccess = comVBox.isOk() && comServer.isNotNull();
    1556 
    1557                 /* Show error message if necessary: */
    1558                 if (!fSuccess)
    1559                     notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comVBox));
    1560                 else
    1561                 {
    1562                     /* Save whether DHCP server is enabled: */
    1563                     if (fSuccess && newHostOnlyData.m_dhcpserver.m_fDhcpServerEnabled != oldHostOnlyData.m_dhcpserver.m_fDhcpServerEnabled)
    1564                     {
    1565                         comServer.SetEnabled(newHostOnlyData.m_dhcpserver.m_fDhcpServerEnabled);
    1566                         fSuccess = comServer.isOk();
    1567                     }
    1568                     if (   fSuccess
    1569                         && newHostOnlyData.m_dhcpserver.m_fDhcpServerEnabled
    1570                         && (   newHostOnlyData.m_dhcpserver.m_strDhcpServerAddress != oldHostOnlyData.m_dhcpserver.m_strDhcpServerAddress
    1571                             || newHostOnlyData.m_dhcpserver.m_strDhcpServerMask != oldHostOnlyData.m_dhcpserver.m_strDhcpServerMask
    1572                             || newHostOnlyData.m_dhcpserver.m_strDhcpLowerAddress != oldHostOnlyData.m_dhcpserver.m_strDhcpLowerAddress
    1573                             || newHostOnlyData.m_dhcpserver.m_strDhcpUpperAddress != oldHostOnlyData.m_dhcpserver.m_strDhcpUpperAddress))
    1574                     {
    1575                         comServer.SetConfiguration(newHostOnlyData.m_dhcpserver.m_strDhcpServerAddress, newHostOnlyData.m_dhcpserver.m_strDhcpServerMask,
    1576                                                    newHostOnlyData.m_dhcpserver.m_strDhcpLowerAddress, newHostOnlyData.m_dhcpserver.m_strDhcpUpperAddress);
    1577                         fSuccess = comServer.isOk();
    1578                     }
    1579 
    1580                     /* Show error message if necessary: */
    1581                     if (!fSuccess)
    1582                         notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comServer));
    1583                 }
    1584             }
    1585         }
    1586     }
    1587     /* Return result: */
    1588     return fSuccess;
    1589 }
    1590 
    1591 void UIGlobalSettingsNetwork::createTreeWidgetItemForNetworkHost(const UISettingsCacheGlobalNetworkHost &cache, bool fChooseItem)
    1592 {
    1593     /* Add new item to the tree: */
    1594     UIItemNetworkHost *pItem = new UIItemNetworkHost;
    1595     pItem->UIDataSettingsGlobalNetworkHost::operator=(cache.base());
    1596     pItem->updateFields();
    1597     m_pTreeNetworkHost->addTopLevelItem(pItem);
    1598     /* And choose it as current if necessary: */
    1599     if (fChooseItem)
    1600         m_pTreeNetworkHost->setCurrentItem(pItem);
    1601 }
    1602 
    1603 void UIGlobalSettingsNetwork::removeTreeWidgetItemOfNetworkHost(UIItemNetworkHost *pItem)
    1604 {
    1605     /* Delete passed item: */
    1606     delete pItem;
    1607 }
    1608 
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h

    r66644 r66761  
    2626/* Forward declarations: */
    2727class UIItemNetworkNAT;
    28 class UIItemNetworkHost;
    2928struct UIDataSettingsGlobalNetwork;
    3029struct UIDataSettingsGlobalNetworkNAT;
    31 struct UIDataSettingsGlobalNetworkHost;
    3230typedef UISettingsCache<UIDataPortForwardingRule> UISettingsCachePortForwardingRule;
    3331typedef UISettingsCachePoolOfTwo<UIDataSettingsGlobalNetworkNAT, UISettingsCachePortForwardingRule, UISettingsCachePortForwardingRule> UISettingsCacheGlobalNetworkNAT;
    34 typedef UISettingsCache<UIDataSettingsGlobalNetworkHost> UISettingsCacheGlobalNetworkHost;
    35 typedef UISettingsCachePoolOfTwo<UIDataSettingsGlobalNetwork, UISettingsCacheGlobalNetworkNAT, UISettingsCacheGlobalNetworkHost> UISettingsCacheGlobalNetwork;
     32typedef UISettingsCachePool<UIDataSettingsGlobalNetwork, UISettingsCacheGlobalNetworkNAT> UISettingsCacheGlobalNetwork;
    3633
    3734
     
    6865    virtual bool validate(QList<UIValidationMessage> &messages) /* override */;
    6966
    70     /** Defines TAB order for passed @a pWidget. */
    71     virtual void setOrderAfter(QWidget *pWidget) /* override */;
    72 
    7367    /** Handles translation event. */
    7468    virtual void retranslateUi() /* override */;
     
    7771
    7872    /** Handles command to add NAT network. */
    79     void sltAddNetworkNAT();
     73    void sltAddNATNetwork();
     74    /** Handles command to remove NAT network. */
     75    void sltRemoveNATNetwork();
    8076    /** Handles command to edit NAT network. */
    81     void sltEditNetworkNAT();
    82     /** Handles command to remove NAT network. */
    83     void sltRemoveNetworkNAT();
     77    void sltEditNATNetwork();
     78
    8479    /** Handles @a pChangedItem change for NAT network tree. */
    85     void sltHandleItemChangeNetworkNAT(QTreeWidgetItem *pChangedItem);
     80    void sltHandleItemChangeNATNetwork(QTreeWidgetItem *pChangedItem);
    8681    /** Handles NAT network tree current item change. */
    87     void sltHandleCurrentItemChangeNetworkNAT();
     82    void sltHandleCurrentItemChangeNATNetwork();
    8883    /** Handles context menu request for @a position of NAT network tree. */
    89     void sltHandleContextMenuRequestNetworkNAT(const QPoint &position);
    90 
    91     /** Handles command to add host network. */
    92     void sltAddNetworkHost();
    93     /** Handles command to edit host network. */
    94     void sltEditNetworkHost();
    95     /** Handles command to remove host network. */
    96     void sltRemoveNetworkHost();
    97     /** Handles host network tree current item change. */
    98     void sltHandleCurrentItemChangeNetworkHost();
    99     /** Handles context menu request for @a position of host network tree. */
    100     void sltHandleContextMenuRequestNetworkHost(const QPoint &position);
     84    void sltHandleContextMenuRequestNATNetwork(const QPoint &position);
    10185
    10286private:
     
    10488    /** Prepares all. */
    10589    void prepare();
    106     /** Prepares 'NAT Network' tab. */
    107     void prepareTabNAT();
    108     /** Prepares 'Host Network' tab. */
    109     void prepareTabHost();
     90    /** Prepares NAT network tree. */
     91    void prepareNATNetworkTree();
     92    /** Prepares NAT network toolbar. */
     93    void prepareNATNetworkToolbar();
    11094    /** Prepares connections. */
    11195    void prepareConnections();
     
    117101
    118102    /** Uploads NAT @a network data into passed @a cache storage unit. */
    119     void loadToCacheFromNetworkNAT(const CNATNetwork &network, UISettingsCacheGlobalNetworkNAT &cache);
     103    void loadToCacheFromNATNetwork(const CNATNetwork &network, UISettingsCacheGlobalNetworkNAT &cache);
    120104    /** Removes corresponding NAT network on the basis of @a cache. */
    121     bool removeNetworkNAT(const UISettingsCacheGlobalNetworkNAT &cache);
     105    bool removeNATNetwork(const UISettingsCacheGlobalNetworkNAT &cache);
    122106    /** Creates corresponding NAT network on the basis of @a cache. */
    123     bool createNetworkNAT(const UISettingsCacheGlobalNetworkNAT &cache);
     107    bool createNATNetwork(const UISettingsCacheGlobalNetworkNAT &cache);
    124108    /** Updates @a cache of corresponding NAT network. */
    125     bool updateNetworkNAT(const UISettingsCacheGlobalNetworkNAT &cache);
     109    bool updateNATNetwork(const UISettingsCacheGlobalNetworkNAT &cache);
    126110    /** Creates a new item in the NAT network tree on the basis of passed @a cache. */
    127     void createTreeWidgetItemForNetworkNAT(const UISettingsCacheGlobalNetworkNAT &cache);
    128     /** Creates a new item in the NAT network tree on the basis of passed @a data, @a ipv4rules, @a ipv6rules, @a fChooseItem if requested. */
    129     void createTreeWidgetItemForNetworkNAT(const UIDataSettingsGlobalNetworkNAT &data,
     111    void createTreeWidgetItemForNATNetwork(const UISettingsCacheGlobalNetworkNAT &cache);
     112    /** Creates a new item in the NAT network tree on the basis of passed
     113      * @a data, @a ipv4rules, @a ipv6rules, @a fChooseItem if requested. */
     114    void createTreeWidgetItemForNATNetwork(const UIDataSettingsGlobalNetworkNAT &data,
    130115                                           const UIPortForwardingDataList &ipv4rules,
    131116                                           const UIPortForwardingDataList &ipv6rules,
    132117                                           bool fChooseItem = false);
    133118    /** Removes existing @a pItem from the NAT network tree. */
    134     void removeTreeWidgetItemOfNetworkNAT(UIItemNetworkNAT *pItem);
     119    void removeTreeWidgetItemOfNATNetwork(UIItemNetworkNAT *pItem);
    135120    /** Returns whether the NAT network described by the @a cache could be updated or recreated otherwise. */
    136121    bool isNetworkCouldBeUpdated(const UISettingsCacheGlobalNetworkNAT &cache) const;
    137122
    138     /** Uploads host @a network data into passed @a data storage unit. */
    139     void loadToCacheFromNetworkHost(const CHostNetworkInterface &iface, UISettingsCacheGlobalNetworkHost &cache);
    140     /** Saves @a data to corresponding host network. */
    141     bool saveDataNetworkHost(const UISettingsCacheGlobalNetworkHost &cache);
    142     /** Creates a new item in the host network tree on the basis of passed @a data, @a fChooseItem if requested. */
    143     void createTreeWidgetItemForNetworkHost(const UISettingsCacheGlobalNetworkHost &cache, bool fChooseItem = false);
    144     /** Removes existing @a pItem from the host network tree. */
    145     void removeTreeWidgetItemOfNetworkHost(UIItemNetworkHost *pItem);
    146 
    147123    /** Holds the Add NAT network action instance. */
    148     QAction *m_pActionAddNetworkNAT;
     124    QAction *m_pActionAddNATNetwork;
     125    /** Holds the Remove NAT network action instance. */
     126    QAction *m_pActionRemoveNATNetwork;
    149127    /** Holds the Edit NAT network action instance. */
    150     QAction *m_pActionEditNetworkNAT;
    151     /** Holds the Remove NAT network action instance. */
    152     QAction *m_pActionRemoveNetworkNAT;
    153 
    154     /** Holds the Add host network action instance. */
    155     QAction *m_pActionAddNetworkHost;
    156     /** Holds the Edit host network action instance. */
    157     QAction *m_pActionEditNetworkHost;
    158     /** Holds the Remove host network action instance. */
    159     QAction *m_pActionRemoveNetworkHost;
     128    QAction *m_pActionEditNATNetwork;
    160129
    161130    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.ui

    r64303 r66761  
    33 VBox frontends: Qt4 GUI ("VirtualBox"):
    44
    5  Copyright (C) 2009-2016 Oracle Corporation
     5 Copyright (C) 2009-2017 Oracle Corporation
    66
    77 This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 <widget class="QWidget" name="UIGlobalSettingsNetwork">
    1717  <layout class="QVBoxLayout">
     18   <property name="margin">
     19    <number>0</number>
     20   </property>
    1821   <item>
    19     <widget class="QITabWidget" name="m_pTabWidget">
    20      <widget class="QWidget" name="m_pTabNAT">
    21       <attribute name="title">
    22        <string>&amp;NAT Networks</string>
    23       </attribute>
    24       <layout class="QHBoxLayout" name="m_pLayoutNAT">
    25        <property name="spacing">
    26         <number>3</number>
    27        </property>
    28        <item>
    29         <widget class="QITreeWidget" name="m_pTreeNetworkNAT">
    30          <property name="sizePolicy">
    31           <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
    32            <horstretch>0</horstretch>
    33            <verstretch>0</verstretch>
    34           </sizepolicy>
    35          </property>
    36          <property name="minimumSize">
    37           <size>
    38            <width>0</width>
    39            <height>150</height>
    40           </size>
    41          </property>
    42          <property name="whatsThis">
    43           <string>Lists all available NAT networks.</string>
    44          </property>
    45          <property name="rootIsDecorated">
    46           <bool>false</bool>
    47          </property>
    48         </widget>
    49        </item>
    50        <item>
    51         <widget class="UIToolBar" name="m_pToolbarNetworkNAT"/>
    52        </item>
    53       </layout>
    54      </widget>
    55      <widget class="QWidget" name="m_pTabHostOnly">
    56       <attribute name="title">
    57        <string>&amp;Host-only Networks</string>
    58       </attribute>
    59       <layout class="QHBoxLayout" name="m_pLayoutHostOnly">
    60        <property name="spacing">
    61         <number>3</number>
    62        </property>
    63        <item>
    64         <widget class="QITreeWidget" name="m_pTreeNetworkHost">
    65          <property name="sizePolicy">
    66           <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
    67            <horstretch>0</horstretch>
    68            <verstretch>0</verstretch>
    69           </sizepolicy>
    70          </property>
    71          <property name="minimumSize">
    72           <size>
    73            <width>0</width>
    74            <height>150</height>
    75           </size>
    76          </property>
    77          <property name="whatsThis">
    78           <string>Lists all available host-only networks.</string>
    79          </property>
    80          <property name="rootIsDecorated">
    81           <bool>false</bool>
    82          </property>
    83          <column>
    84           <property name="text">
    85            <string>Name</string>
    86           </property>
    87          </column>
    88         </widget>
    89        </item>
    90        <item>
    91         <widget class="UIToolBar" name="m_pToolbarNetworkHost"/>
    92        </item>
    93       </layout>
    94      </widget>
     22    <widget class="QILabelSeparator" native="1" name="m_pNetworkLabel">
     23     <property name="text">
     24     <string>&amp;NAT Networks</string>
     25     </property>
     26     <property name="buddy">
     27      <cstring>m_pTreeNetworkNAT</cstring>
     28     </property>
    9529    </widget>
    9630   </item>
    97   </layout>
    98  </widget>
     31   <item>
     32    <layout class="QHBoxLayout" name="m_pLayoutNAT">
     33     <property name="spacing">
     34      <number>3</number>
     35     </property>
     36     <item>
     37      <widget class="QITreeWidget" name="m_pTreeNetworkNAT">
     38       <property name="sizePolicy">
     39        <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
     40         <horstretch>0</horstretch>
     41         <verstretch>0</verstretch>
     42        </sizepolicy>
     43       </property>
     44       <property name="minimumSize">
     45        <size>
     46         <width>0</width>
     47         <height>150</height>
     48        </size>
     49       </property>
     50       <property name="whatsThis">
     51        <string>Lists all available NAT networks.</string>
     52       </property>
     53       <property name="rootIsDecorated">
     54        <bool>false</bool>
     55       </property>
     56      </widget>
     57     </item>
     58     <item>
     59      <widget class="UIToolBar" name="m_pToolbarNetworkNAT"/>
     60     </item>
     61    </layout>
     62   </item>
     63</layout>
     64</widget>
    9965 <customwidgets>
     66  <customwidget>
     67   <class>QILabelSeparator</class>
     68   <extends>QLabel</extends>
     69   <header>QILabelSeparator.h</header>
     70  </customwidget>
    10071  <customwidget>
    10172   <class>UIToolBar</class>
    10273   <extends>QToolBar</extends>
    10374   <header>UIToolBar.h</header>
    104   </customwidget>
    105   <customwidget>
    106    <class>QITabWidget</class>
    107    <extends>QTabWidget</extends>
    108    <header>QITabWidget.h</header>
    10975  </customwidget>
    11076  <customwidget>
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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