VirtualBox

Changeset 48458 in vbox


Ignore:
Timestamp:
Sep 12, 2013 4:26:07 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Global settings: Network page: 1. Full rework; 2. Added NAT network page with corresponding options.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
7 edited
3 copied
3 moved

Legend:

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

    r48273 r48458  
    351351        src/settings/global/UIGlobalSettingsDisplay.h \
    352352        src/settings/global/UIGlobalSettingsNetwork.h \
    353         src/settings/global/UIGlobalSettingsNetworkDetails.h \
     353        src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h \
     354        src/settings/global/UIGlobalSettingsNetworkDetailsHost.h \
    354355        src/settings/global/UIGlobalSettingsProxy.h \
    355356        src/settings/global/UIGlobalSettingsUpdate.h \
     
    604605        src/settings/global/UIGlobalSettingsDisplay.cpp \
    605606        src/settings/global/UIGlobalSettingsNetwork.cpp \
    606         src/settings/global/UIGlobalSettingsNetworkDetails.cpp \
     607        src/settings/global/UIGlobalSettingsNetworkDetailsNAT.cpp \
     608        src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp \
    607609        src/settings/global/UIGlobalSettingsProxy.cpp \
    608610        src/settings/global/UIGlobalSettingsUpdate.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r45212 r48458  
    3434    src/settings/global/UIGlobalSettingsDisplay.ui \
    3535    src/settings/global/UIGlobalSettingsNetwork.ui \
    36     src/settings/global/UIGlobalSettingsNetworkDetails.ui \
     36    src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui \
     37    src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui \
    3738    src/settings/global/UIGlobalSettingsExtension.ui \
    3839    src/settings/global/UIGlobalSettingsProxy.ui \
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r48316 r48458  
    884884}
    885885
    886 bool UIMessageCenter::confirmHostInterfaceRemoval(const QString &strName, QWidget *pParent /*= 0*/) const
     886bool UIMessageCenter::confirmNATNetworkRemoval(const QString &strName, QWidget *pParent /*= 0*/) const
     887{
     888    return questionBinary(pParent, MessageType_Question,
     889                          tr("<p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p>"
     890                             "<p><b>Note:</b> this network may be in use by one or more "
     891                             "virtual network adapters belonging to one of your VMs. "
     892                             "After it is removed, these adapters will no longer be usable until "
     893                             "you correct their settings by either choosing a different network "
     894                             "name or a different adapter attachment type.</p>")
     895                             .arg(strName),
     896                          0 /* auto-confirm id */,
     897                          tr("Remove"));
     898}
     899
     900bool UIMessageCenter::confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent /*= 0*/) const
    887901{
    888902    return questionBinary(pParent, MessageType_Question,
     
    898912                          0 /* auto-confirm id */,
    899913                          tr("Remove"));
     914}
     915
     916void UIMessageCenter::cannotCreateNATNetwork(const CVirtualBox &vbox, QWidget *pParent /*= 0*/)
     917{
     918    error(pParent, MessageType_Error,
     919          tr("Failed to create NAT network."),
     920          formatErrorInfo(vbox));
     921}
     922
     923void UIMessageCenter::cannotRemoveNATNetwork(const CVirtualBox &vbox, const QString &strNetworkName, QWidget *pParent /*= 0*/)
     924{
     925    error(pParent, MessageType_Error,
     926          tr("Failed to remove NAT network <b>%1</b>.")
     927             .arg(strNetworkName),
     928          formatErrorInfo(vbox));
     929}
     930
     931void UIMessageCenter::cannotCreateDHCPServer(const CVirtualBox &vbox, QWidget *pParent /*= 0*/)
     932{
     933    error(pParent, MessageType_Error,
     934          tr("Failed to create DHCP server."),
     935          formatErrorInfo(vbox));
     936}
     937
     938void UIMessageCenter::cannotRemoveDHCPServer(const CVirtualBox &vbox, const QString &strInterfaceName, QWidget *pParent /*= 0*/)
     939{
     940    error(pParent, MessageType_Error,
     941          tr("Failed to remove DHCP server for network interface <b>%1</b>.")
     942             .arg(strInterfaceName),
     943          formatErrorInfo(vbox));
    900944}
    901945
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r48022 r48458  
    211211
    212212    /* API: Global settings warnings: */
    213     bool confirmHostInterfaceRemoval(const QString &strName, QWidget *pParent = 0) const;
     213    bool confirmNATNetworkRemoval(const QString &strName, QWidget *pParent = 0) const;
     214    bool confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent = 0) const;
     215    void cannotCreateNATNetwork(const CVirtualBox &vbox, QWidget *pParent = 0);
     216    void cannotRemoveNATNetwork(const CVirtualBox &vbox, const QString &strNetworkName, QWidget *pParent = 0);
     217    void cannotCreateDHCPServer(const CVirtualBox &vbox, QWidget *pParent = 0);
     218    void cannotRemoveDHCPServer(const CVirtualBox &vbox, const QString &strInterfaceName, QWidget *pParent = 0);
    214219    void cannotCreateHostInterface(const CHost &host, QWidget *pParent = 0);
    215220    void cannotCreateHostInterface(const CProgress &progress, QWidget *pParent = 0);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp

    r47944 r48458  
    77
    88/*
    9  * Copyright (C) 2009-2012 Oracle Corporation
     9 * Copyright (C) 2009-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2323
    2424/* GUI includes: */
    25 #include "QIWidgetValidator.h"
     25#include "VBoxGlobal.h"
    2626#include "UIIconPool.h"
     27#include "UIMessageCenter.h"
    2728#include "UIGlobalSettingsNetwork.h"
    28 #include "UIGlobalSettingsNetworkDetails.h"
    29 #include "VBoxGlobal.h"
    30 #include "UIMessageCenter.h"
     29#include "UIGlobalSettingsNetworkDetailsNAT.h"
     30#include "UIGlobalSettingsNetworkDetailsHost.h"
    3131
    3232/* COM includes: */
     33#include "CNATNetwork.h"
    3334#include "CHostNetworkInterface.h"
    3435#include "CDHCPServer.h"
    3536
    36 /* Host-network item constructor: */
    37 UIHostInterfaceItem::UIHostInterfaceItem()
     37/* Other VBox includes: */
     38#include "iprt/cidr.h"
     39
     40
     41/* Global settings / Network page / NAT network item: */
     42class UIItemNetworkNAT : public QTreeWidgetItem
     43{
     44public:
     45
     46    /* Constructor: */
     47    UIItemNetworkNAT();
     48
     49    /* API: Get/return data to/form items: */
     50    void fetchNetworkData(const UIDataNetworkNAT &data);
     51    void uploadNetworkData(UIDataNetworkNAT &data);
     52
     53    /* API: Validation stuff: */
     54    bool validate(UIValidationMessage &message);
     55
     56    /* API: Update stuff: */
     57    void updateInfo();
     58
     59    /* API: Network item getters: */
     60    QString name() const { return m_data.m_strName; }
     61    QString newName() const { return m_data.m_strNewName; }
     62
     63private:
     64
     65    /* Variable: Network data: */
     66    UIDataNetworkNAT m_data;
     67};
     68
     69
     70/* Global settings / Network page / Host network item: */
     71class UIItemNetworkHost : public QTreeWidgetItem
     72{
     73public:
     74
     75    /* Constructor: */
     76    UIItemNetworkHost();
     77
     78    /* API: Get/return data to/form items: */
     79    void fetchNetworkData(const UIDataNetworkHost &data);
     80    void uploadNetworkData(UIDataNetworkHost &data);
     81
     82    /* API: Validation stuff: */
     83    bool validate(UIValidationMessage &message);
     84
     85    /* API: Update stuff: */
     86    void updateInfo();
     87
     88    /* API: Network item getters: */
     89    QString name() const { return m_data.m_interface.m_strName; }
     90
     91private:
     92
     93    /* Variable: Network data: */
     94    UIDataNetworkHost m_data;
     95};
     96
     97
     98UIItemNetworkNAT::UIItemNetworkNAT()
    3899    : QTreeWidgetItem()
    39100{
    40101}
    41102
    42 /* Get data to item: */
    43 void UIHostInterfaceItem::fetchNetworkData(const UIHostNetworkData &data)
    44 {
    45     /* Fetch from cache: */
     103void UIItemNetworkNAT::fetchNetworkData(const UIDataNetworkNAT &data)
     104{
     105    /* Get from cache: */
    46106    m_data = data;
    47107
    48     /* Update tool-tip: */
     108    /* Fetch info: */
    49109    updateInfo();
    50110}
    51111
    52 /* Return data from item: */
    53 void UIHostInterfaceItem::uploadNetworkData(UIHostNetworkData &data)
    54 {
    55     /* Upload to cache: */
     112void UIItemNetworkNAT::uploadNetworkData(UIDataNetworkNAT &data)
     113{
     114    /* Put to cache: */
    56115    data = m_data;
    57116}
    58117
    59 /* Validation stuff: */
    60 bool UIHostInterfaceItem::validate(QList<UIValidationMessage> &messages)
     118bool UIItemNetworkNAT::validate(UIValidationMessage &message)
    61119{
    62120    /* Pass by default: */
    63121    bool fPass = true;
    64122
    65     /* Prepare message: */
    66     UIValidationMessage message;
    67 
    68     /* Host-only interface validation: */
     123    /* NAT network name validation: */
     124    bool fNameValid = true;
     125    if (m_data.m_strNewName.isEmpty())
     126    {
     127        /* Emptiness validation: */
     128        message.second << UIGlobalSettingsNetwork::tr("The new name for NAT network previously called <b>%1</b> is empty.").arg(m_data.m_strName);
     129        fNameValid = false;
     130        fPass = false;
     131    }
     132
     133    /* NAT network CIDR validation: */
     134    if (m_data.m_strCIDR.isEmpty())
     135    {
     136        /* Emptiness validation: */
     137        if (fNameValid)
     138            message.second << UIGlobalSettingsNetwork::tr("The CIDR for NAT network <b>%1</b> is empty.").arg(m_data.m_strNewName);
     139        else
     140            message.second << UIGlobalSettingsNetwork::tr("The CIDR for NAT network previously called <b>%1</b> is empty.").arg(m_data.m_strName);
     141        fPass = false;
     142    }
     143    else
     144    {
     145        /* Correctness validation: */
     146        RTNETADDRIPV4 network, mask;
     147        int rc = RTCidrStrToIPv4(m_data.m_strCIDR.toAscii().constData(), &network, &mask);
     148        if (RT_FAILURE(rc))
     149        {
     150            if (fNameValid)
     151                message.second << UIGlobalSettingsNetwork::tr("The CIDR <i>%1</i> for NAT network <b>%2</b> is invalid.")
     152                                                              .arg(m_data.m_strCIDR, m_data.m_strNewName);
     153            else
     154                message.second << UIGlobalSettingsNetwork::tr("The CIDR <i>%1</i> for NAT network previously called <b>%2</b> is invalid.")
     155                                                              .arg(m_data.m_strCIDR, m_data.m_strName);
     156            fPass = false;
     157        }
     158    }
     159
     160    /* Return result: */
     161    return fPass;
     162}
     163
     164void UIItemNetworkNAT::updateInfo()
     165{
     166    /* Compose item name/tool-tip: */
     167    QString strHeader("<tr><td><nobr>%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
     168    QString strSubHeader("<tr><td><nobr>&nbsp;&nbsp;%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
     169    QString strToolTip;
     170
     171    /* Item name was not changed: */
     172    if (m_data.m_strNewName == m_data.m_strName)
     173    {
     174        /* Just use the old one: */
     175        setText(0, m_data.m_strName);
     176        strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("Network Name"), m_data.m_strName);
     177    }
     178    /* If name was changed: */
     179    else
     180    {
     181        /* We should explain that: */
     182        const QString oldName = m_data.m_strName;
     183        const QString newName = m_data.m_strNewName.isEmpty() ? UIGlobalSettingsNetwork::tr("[empty]") : m_data.m_strNewName;
     184        setText(0, UIGlobalSettingsNetwork::tr("%1 (renamed from %2)").arg(newName, oldName));
     185        strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("Old Network Name"), m_data.m_strName);
     186        strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("New Network Name"), m_data.m_strNewName);
     187    }
     188
     189    /* Other tool-tip information: */
     190    strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("Network CIDR"), m_data.m_strCIDR);
     191    strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("Supports DHCP"),
     192                                m_data.m_fSupportsDHCP ? UIGlobalSettingsNetwork::tr("yes") : UIGlobalSettingsNetwork::tr("no"));
     193    strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("Supports IPv6"),
     194                                m_data.m_fSupportsIPv6 ? UIGlobalSettingsNetwork::tr("yes") : UIGlobalSettingsNetwork::tr("no"));
     195    if (m_data.m_fSupportsIPv6 && m_data.m_fAdvertiseDefaultIPv6Route)
     196        strToolTip += strSubHeader.arg(UIGlobalSettingsNetwork::tr("Default IPv6 route"), UIGlobalSettingsNetwork::tr("yes"));
     197
     198    /* Assign tool-tip finally: */
     199    setToolTip(0, strToolTip);
     200}
     201
     202
     203UIItemNetworkHost::UIItemNetworkHost()
     204    : QTreeWidgetItem()
     205{
     206}
     207
     208void UIItemNetworkHost::fetchNetworkData(const UIDataNetworkHost &data)
     209{
     210    /* Get from cache: */
     211    m_data = data;
     212
     213    /* Fetch info: */
     214    updateInfo();
     215}
     216
     217void UIItemNetworkHost::uploadNetworkData(UIDataNetworkHost &data)
     218{
     219    /* Put to cache: */
     220    data = m_data;
     221}
     222
     223bool UIItemNetworkHost::validate(UIValidationMessage &message)
     224{
     225    /* Pass by default: */
     226    bool fPass = true;
     227
     228    /* Host interface validation: */
    69229    if (!m_data.m_interface.m_fDhcpClientEnabled)
    70230    {
     
    124284    }
    125285
    126     /* Serialize message: */
    127     if (!message.second.isEmpty())
    128         messages << message;
    129 
    130286    /* Return result: */
    131287    return fPass;
    132288}
    133289
    134 QString UIHostInterfaceItem::updateInfo()
    135 {
    136     /* Update text: */
     290void UIItemNetworkHost::updateInfo()
     291{
     292    /* Compose item name/tool-tip: */
    137293    setText(0, m_data.m_interface.m_strName);
    138 
    139     /* Update information label: */
    140294    QString strHeader("<tr><td><nobr>%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
    141295    QString strSubHeader("<tr><td><nobr>&nbsp;&nbsp;%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
    142     QString strData, strToolTip, strBuffer;
    143 
    144     /* Host-only interface information: */
    145     strBuffer = strHeader.arg(UIGlobalSettingsNetwork::tr("Adapter"))
    146                 .arg(m_data.m_interface.m_fDhcpClientEnabled ? UIGlobalSettingsNetwork::tr("Automatically configured", "interface")
    147                                                              : UIGlobalSettingsNetwork::tr("Manually configured", "interface"));
    148     strData += strBuffer;
    149     strToolTip += strBuffer;
     296    QString strToolTip;
     297
     298    /* Host interface information: */
     299    strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("Adapter"))
     300                           .arg(m_data.m_interface.m_fDhcpClientEnabled ?
     301                                UIGlobalSettingsNetwork::tr("Automatically configured", "interface") :
     302                                UIGlobalSettingsNetwork::tr("Manually configured", "interface"));
    150303    if (!m_data.m_interface.m_fDhcpClientEnabled)
    151304    {
    152         strBuffer = strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv4 Address"))
    153                                 .arg(m_data.m_interface.m_strInterfaceAddress.isEmpty() ?
    154                                      UIGlobalSettingsNetwork::tr ("Not set", "address") :
    155                                      m_data.m_interface.m_strInterfaceAddress) +
    156                     strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv4 Network Mask"))
    157                                 .arg(m_data.m_interface.m_strInterfaceMask.isEmpty() ?
    158                                      UIGlobalSettingsNetwork::tr ("Not set", "mask") :
    159                                      m_data.m_interface.m_strInterfaceMask);
    160         strToolTip += strBuffer;
     305        strToolTip += strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv4 Address"))
     306                                  .arg(m_data.m_interface.m_strInterfaceAddress.isEmpty() ?
     307                                       UIGlobalSettingsNetwork::tr ("Not set", "address") :
     308                                       m_data.m_interface.m_strInterfaceAddress) +
     309                      strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv4 Network Mask"))
     310                                  .arg(m_data.m_interface.m_strInterfaceMask.isEmpty() ?
     311                                       UIGlobalSettingsNetwork::tr ("Not set", "mask") :
     312                                       m_data.m_interface.m_strInterfaceMask);
    161313        if (m_data.m_interface.m_fIpv6Supported)
    162314        {
    163             strBuffer = strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv6 Address"))
    164                                     .arg(m_data.m_interface.m_strInterfaceAddress6.isEmpty() ?
    165                                          UIGlobalSettingsNetwork::tr("Not set", "address") :
    166                                          m_data.m_interface.m_strInterfaceAddress6) +
    167                         strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv6 Network Mask Length"))
    168                                     .arg(m_data.m_interface.m_strInterfaceMaskLength6.isEmpty() ?
    169                                          UIGlobalSettingsNetwork::tr("Not set", "length") :
    170                                          m_data.m_interface.m_strInterfaceMaskLength6);
    171             strToolTip += strBuffer;
     315            strToolTip += strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv6 Address"))
     316                                      .arg(m_data.m_interface.m_strInterfaceAddress6.isEmpty() ?
     317                                           UIGlobalSettingsNetwork::tr("Not set", "address") :
     318                                           m_data.m_interface.m_strInterfaceAddress6) +
     319                          strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv6 Network Mask Length"))
     320                                      .arg(m_data.m_interface.m_strInterfaceMaskLength6.isEmpty() ?
     321                                           UIGlobalSettingsNetwork::tr("Not set", "length") :
     322                                           m_data.m_interface.m_strInterfaceMaskLength6);
    172323        }
    173324    }
    174325
    175326    /* DHCP server information: */
    176     strBuffer = strHeader.arg(UIGlobalSettingsNetwork::tr("DHCP Server"))
    177                          .arg(m_data.m_dhcpserver.m_fDhcpServerEnabled ?
    178                               UIGlobalSettingsNetwork::tr("Enabled", "server") :
    179                               UIGlobalSettingsNetwork::tr("Disabled", "server"));
    180     strData += strBuffer;
    181     strToolTip += strBuffer;
     327    strToolTip += strHeader.arg(UIGlobalSettingsNetwork::tr("DHCP Server"))
     328                           .arg(m_data.m_dhcpserver.m_fDhcpServerEnabled ?
     329                                UIGlobalSettingsNetwork::tr("Enabled", "server") :
     330                                UIGlobalSettingsNetwork::tr("Disabled", "server"));
    182331    if (m_data.m_dhcpserver.m_fDhcpServerEnabled)
    183332    {
    184         strBuffer = strSubHeader.arg(UIGlobalSettingsNetwork::tr("Address"))
    185                                 .arg(m_data.m_dhcpserver.m_strDhcpServerAddress.isEmpty() ?
    186                                      UIGlobalSettingsNetwork::tr("Not set", "address") :
    187                                      m_data.m_dhcpserver.m_strDhcpServerAddress) +
    188                     strSubHeader.arg(UIGlobalSettingsNetwork::tr("Network Mask"))
    189                                 .arg(m_data.m_dhcpserver.m_strDhcpServerMask.isEmpty() ?
    190                                      UIGlobalSettingsNetwork::tr("Not set", "mask") :
    191                                      m_data.m_dhcpserver.m_strDhcpServerMask) +
    192                     strSubHeader.arg(UIGlobalSettingsNetwork::tr("Lower Bound"))
    193                                 .arg(m_data.m_dhcpserver.m_strDhcpLowerAddress.isEmpty() ?
    194                                      UIGlobalSettingsNetwork::tr("Not set", "bound") :
    195                                      m_data.m_dhcpserver.m_strDhcpLowerAddress) +
    196                     strSubHeader.arg(UIGlobalSettingsNetwork::tr("Upper Bound"))
    197                                 .arg(m_data.m_dhcpserver.m_strDhcpUpperAddress.isEmpty() ?
    198                                      UIGlobalSettingsNetwork::tr("Not set", "bound") :
    199                                      m_data.m_dhcpserver.m_strDhcpUpperAddress);
    200         strToolTip += strBuffer;
    201     }
    202 
     333        strToolTip += strSubHeader.arg(UIGlobalSettingsNetwork::tr("Address"))
     334                                  .arg(m_data.m_dhcpserver.m_strDhcpServerAddress.isEmpty() ?
     335                                       UIGlobalSettingsNetwork::tr("Not set", "address") :
     336                                       m_data.m_dhcpserver.m_strDhcpServerAddress) +
     337                      strSubHeader.arg(UIGlobalSettingsNetwork::tr("Network Mask"))
     338                                  .arg(m_data.m_dhcpserver.m_strDhcpServerMask.isEmpty() ?
     339                                       UIGlobalSettingsNetwork::tr("Not set", "mask") :
     340                                       m_data.m_dhcpserver.m_strDhcpServerMask) +
     341                      strSubHeader.arg(UIGlobalSettingsNetwork::tr("Lower Bound"))
     342                                  .arg(m_data.m_dhcpserver.m_strDhcpLowerAddress.isEmpty() ?
     343                                       UIGlobalSettingsNetwork::tr("Not set", "bound") :
     344                                       m_data.m_dhcpserver.m_strDhcpLowerAddress) +
     345                      strSubHeader.arg(UIGlobalSettingsNetwork::tr("Upper Bound"))
     346                                  .arg(m_data.m_dhcpserver.m_strDhcpUpperAddress.isEmpty() ?
     347                                       UIGlobalSettingsNetwork::tr("Not set", "bound") :
     348                                       m_data.m_dhcpserver.m_strDhcpUpperAddress);
     349    }
     350
     351    /* Assign tool-tip finally: */
    203352    setToolTip(0, strToolTip);
    204 
    205     return QString("<table>") + strData + QString("</table>");
    206 }
    207 
    208 /* Network page constructor: */
     353}
     354
     355
    209356UIGlobalSettingsNetwork::UIGlobalSettingsNetwork()
    210     : m_pAddAction(0), m_pDelAction(0), m_pEditAction(0)
     357    : m_pActionAddNetworkNAT(0), m_pActionDelNetworkNAT(0), m_pActionEditNetworkNAT(0)
     358    , m_pActionAddNetworkHost(0), m_pActionDelNetworkHost(0), m_pActionEditNetworkHost(0)
    211359    , m_fChanged(false)
    212360{
    213361    /* Apply UI decorations: */
    214     Ui::UIGlobalSettingsNetwork::setupUi (this);
    215 
    216     /* Setup tree-widget: */
    217     m_pInterfacesTree->header()->hide();
    218     m_pInterfacesTree->setContextMenuPolicy(Qt::CustomContextMenu);
    219 
    220     /* Prepare toolbar: */
    221     m_pAddAction = new QAction(m_pInterfacesTree);
    222     m_pDelAction = new QAction(m_pInterfacesTree);
    223     m_pEditAction = new QAction(m_pInterfacesTree);
    224 
    225     m_pAddAction->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
    226     m_pDelAction->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
    227     m_pEditAction->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2"));
    228 
    229     m_pAddAction->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png",
    230                                               ":/add_host_iface_disabled_16px.png"));
    231     m_pDelAction->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png",
    232                                               ":/remove_host_iface_disabled_16px.png"));
    233     m_pEditAction->setIcon(UIIconPool::iconSet(":/guesttools_16px.png",
    234                                                ":/guesttools_disabled_16px.png"));
    235 
    236     m_pActionsToolbar->setUsesTextLabel(false);
    237     m_pActionsToolbar->setIconSize(QSize(16, 16));
    238     m_pActionsToolbar->setOrientation(Qt::Vertical);
    239     m_pActionsToolbar->addAction(m_pAddAction);
    240     m_pActionsToolbar->addAction(m_pDelAction);
    241     m_pActionsToolbar->addAction(m_pEditAction);
    242 
    243     /* Setup connections: */
    244     connect(m_pAddAction, SIGNAL(triggered(bool)), this, SLOT(sltAddInterface()));
    245     connect(m_pDelAction, SIGNAL(triggered(bool)), this, SLOT(sltDelInterface()));
    246     connect(m_pEditAction, SIGNAL(triggered(bool)), this, SLOT(sltEditInterface()));
    247     connect(m_pInterfacesTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
    248             this, SLOT(sltUpdateCurrentItem()));
    249     connect(m_pInterfacesTree, SIGNAL(customContextMenuRequested(const QPoint&)),
    250             this, SLOT(sltChowContextMenu(const QPoint&)));
    251     connect(m_pInterfacesTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
    252             this, SLOT(sltEditInterface()));
     362    Ui::UIGlobalSettingsNetwork::setupUi(this);
     363
     364    /* Prepare NAT network tree-widget: */
     365    {
     366        m_pTreeNetworkNAT->header()->hide();
     367        m_pTreeNetworkNAT->setContextMenuPolicy(Qt::CustomContextMenu);
     368        connect(m_pTreeNetworkNAT, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
     369                this, SLOT(sltHandleCurrentItemChangeNetworkNAT()));
     370        connect(m_pTreeNetworkNAT, SIGNAL(customContextMenuRequested(const QPoint&)),
     371                this, SLOT(sltShowContextMenuNetworkNAT(const QPoint&)));
     372        connect(m_pTreeNetworkNAT, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
     373                this, SLOT(sltEditNetworkNAT()));
     374    }
     375    /* Prepare Host network tree-widget: */
     376    {
     377        m_pTreeNetworkHost->header()->hide();
     378        m_pTreeNetworkHost->setContextMenuPolicy(Qt::CustomContextMenu);
     379        connect(m_pTreeNetworkHost, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
     380                this, SLOT(sltHandleCurrentItemChangeNetworkHost()));
     381        connect(m_pTreeNetworkHost, SIGNAL(customContextMenuRequested(const QPoint&)),
     382                this, SLOT(sltShowContextMenuNetworkHost(const QPoint&)));
     383        connect(m_pTreeNetworkHost, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
     384                this, SLOT(sltEditNetworkHost()));
     385    }
     386
     387    /* Prepare actions: */
     388    m_pActionAddNetworkNAT = new QAction(m_pTreeNetworkNAT);
     389    {
     390        m_pActionAddNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut);
     391        m_pActionAddNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
     392        m_pActionAddNetworkNAT->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png",
     393                                                            ":/add_host_iface_disabled_16px.png"));
     394        connect(m_pActionAddNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltAddNetworkNAT()));
     395    }
     396    m_pActionDelNetworkNAT = new QAction(m_pTreeNetworkNAT);
     397    {
     398        m_pActionDelNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut);
     399        m_pActionDelNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
     400        m_pActionDelNetworkNAT->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png",
     401                                                            ":/remove_host_iface_disabled_16px.png"));
     402        connect(m_pActionDelNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltDelNetworkNAT()));
     403    }
     404    m_pActionEditNetworkNAT = new QAction(m_pTreeNetworkNAT);
     405    {
     406        m_pActionEditNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut);
     407        m_pActionEditNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2"));
     408        m_pActionEditNetworkNAT->setIcon(UIIconPool::iconSet(":/guesttools_16px.png",
     409                                                             ":/guesttools_disabled_16px.png"));
     410        connect(m_pActionEditNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltEditNetworkNAT()));
     411    }
     412    m_pActionAddNetworkHost = new QAction(m_pTreeNetworkHost);
     413    {
     414        m_pActionAddNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut);
     415        m_pActionAddNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
     416        m_pActionAddNetworkHost->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png",
     417                                                             ":/add_host_iface_disabled_16px.png"));
     418        connect(m_pActionAddNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltAddNetworkHost()));
     419    }
     420    m_pActionDelNetworkHost = new QAction(m_pTreeNetworkHost);
     421    {
     422        m_pActionDelNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut);
     423        m_pActionDelNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
     424        m_pActionDelNetworkHost->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png",
     425                                                             ":/remove_host_iface_disabled_16px.png"));
     426        connect(m_pActionDelNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltDelNetworkHost()));
     427    }
     428    m_pActionEditNetworkHost = new QAction(m_pTreeNetworkHost);
     429    {
     430        m_pActionEditNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut);
     431        m_pActionEditNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2"));
     432        m_pActionEditNetworkHost->setIcon(UIIconPool::iconSet(":/guesttools_16px.png",
     433                                                              ":/guesttools_disabled_16px.png"));
     434        connect(m_pActionEditNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltEditNetworkHost()));
     435    }
     436
     437    /* Prepare NAT network toolbar: */
     438    {
     439        m_pToolbarNetworkNAT->setUsesTextLabel(false);
     440        m_pToolbarNetworkNAT->setIconSize(QSize(16, 16));
     441        m_pToolbarNetworkNAT->setOrientation(Qt::Vertical);
     442        m_pToolbarNetworkNAT->addAction(m_pActionAddNetworkNAT);
     443        m_pToolbarNetworkNAT->addAction(m_pActionDelNetworkNAT);
     444        m_pToolbarNetworkNAT->addAction(m_pActionEditNetworkNAT);
     445    }
     446    /* Prepare Host network toolbar: */
     447    {
     448        m_pToolbarNetworkHost->setUsesTextLabel(false);
     449        m_pToolbarNetworkHost->setIconSize(QSize(16, 16));
     450        m_pToolbarNetworkHost->setOrientation(Qt::Vertical);
     451        m_pToolbarNetworkHost->addAction(m_pActionAddNetworkHost);
     452        m_pToolbarNetworkHost->addAction(m_pActionDelNetworkHost);
     453        m_pToolbarNetworkHost->addAction(m_pActionEditNetworkHost);
     454    }
    253455
    254456    /* Apply language settings: */
     
    256458}
    257459
    258 /* Load data to cache from corresponding external object(s),
    259  * this task COULD be performed in other than GUI thread: */
    260460void UIGlobalSettingsNetwork::loadToCacheFrom(QVariant &data)
    261461{
     
    263463    UISettingsPageGlobal::fetchData(data);
    264464
    265     /* Load to cache: */
     465    /* Load NAT networks to cache: */
     466    m_cache.m_networksNAT.clear();
     467    const CNATNetworkVector &networks = vboxGlobal().virtualBox().GetNATNetworks();
     468    foreach (const CNATNetwork &network, networks)
     469        m_cache.m_networksNAT << generateDataNetworkNAT(network);
     470
     471    /* Load Host networks to cache: */
     472    m_cache.m_networksHost.clear();
    266473    const CHostNetworkInterfaceVector &interfaces = vboxGlobal().host().GetNetworkInterfaces();
    267     for (int iNetworkIndex = 0; iNetworkIndex < interfaces.size(); ++iNetworkIndex)
    268     {
    269         const CHostNetworkInterface &iface = interfaces[iNetworkIndex];
     474    foreach (const CHostNetworkInterface &iface, interfaces)
    270475        if (iface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly)
    271             appendCacheItem(iface);
    272     }
     476            m_cache.m_networksHost << generateDataNetworkHost(iface);
    273477
    274478    /* Upload properties & settings to data: */
     
    276480}
    277481
    278 /* Load data to corresponding widgets from cache,
    279  * this task SHOULD be performed in GUI thread only: */
    280482void UIGlobalSettingsNetwork::getFromCache()
    281483{
    282     /* Fetch from cache: */
    283     for (int iNetworkIndex = 0; iNetworkIndex < m_cache.m_items.size(); ++iNetworkIndex)
    284         appendListItem(m_cache.m_items[iNetworkIndex]);
    285     /* Set first list item as current: */
    286     m_pInterfacesTree->setCurrentItem(m_pInterfacesTree->topLevelItem(0));
    287     sltUpdateCurrentItem();
     484    /* Fetch NAT networks from cache: */
     485    foreach (const UIDataNetworkNAT &network, m_cache.m_networksNAT)
     486        createTreeItemNetworkNAT(network);
     487    m_pTreeNetworkNAT->setCurrentItem(m_pTreeNetworkNAT->topLevelItem(0));
     488    sltHandleCurrentItemChangeNetworkNAT();
     489
     490    /* Fetch Host networks from cache: */
     491    foreach (const UIDataNetworkHost &network, m_cache.m_networksHost)
     492        createTreeItemNetworkHost(network);
     493    m_pTreeNetworkHost->setCurrentItem(m_pTreeNetworkHost->topLevelItem(0));
     494    sltHandleCurrentItemChangeNetworkHost();
    288495
    289496    /* Revalidate: */
     
    291498}
    292499
    293 /* Save data from corresponding widgets to cache,
    294  * this task SHOULD be performed in GUI thread only: */
    295500void UIGlobalSettingsNetwork::putToCache()
    296501{
    297     /* Eraze cache: */
    298     m_cache.m_items.clear();
    299     /* Upload to cache: */
    300     for (int iNetworkIndex = 0; iNetworkIndex < m_pInterfacesTree->topLevelItemCount(); ++iNetworkIndex)
    301     {
    302         UIHostNetworkData data;
    303         UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->topLevelItem(iNetworkIndex));
     502    /* Upload NAT networks to cache: */
     503    m_cache.m_networksNAT.clear();
     504    for (int iNetworkIndex = 0; iNetworkIndex < m_pTreeNetworkNAT->topLevelItemCount(); ++iNetworkIndex)
     505    {
     506        UIDataNetworkNAT data;
     507        UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->topLevelItem(iNetworkIndex));
    304508        pItem->uploadNetworkData(data);
    305         m_cache.m_items << data;
    306     }
    307 }
    308 
    309 /* Save data from cache to corresponding external object(s),
    310  * this task COULD be performed in other than GUI thread: */
     509        m_cache.m_networksNAT << data;
     510    }
     511
     512    /* Upload Host networks to cache: */
     513    m_cache.m_networksHost.clear();
     514    for (int iNetworkIndex = 0; iNetworkIndex < m_pTreeNetworkHost->topLevelItemCount(); ++iNetworkIndex)
     515    {
     516        UIDataNetworkHost data;
     517        UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->topLevelItem(iNetworkIndex));
     518        pItem->uploadNetworkData(data);
     519        m_cache.m_networksHost << data;
     520    }
     521}
     522
    311523void UIGlobalSettingsNetwork::saveFromCacheTo(QVariant &data)
    312524{
     
    318530    UISettingsPageGlobal::fetchData(data);
    319531
     532    /* Save NAT networks from cache: */
     533    foreach (const UIDataNetworkNAT &data, m_cache.m_networksNAT)
     534        saveCacheItemNetworkNAT(data);
     535
     536    /* Save Host networks from cache: */
     537    foreach (const UIDataNetworkHost &data, m_cache.m_networksHost)
     538        saveCacheItemNetworkHost(data);
     539
     540    /* Upload properties & settings to data: */
     541    UISettingsPageGlobal::uploadData(data);
     542}
     543
     544bool UIGlobalSettingsNetwork::validate(QList<UIValidationMessage> &messages)
     545{
     546    /* Pass by default: */
     547    bool fPass = true;
     548
     549    /* Validate NAT network items: */
     550    {
     551        /* Prepare message: */
     552        UIValidationMessage message;
     553        message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(0));
     554
     555        /* Validate items first: */
     556        for (int iNetworkIndex = 0; iNetworkIndex < m_pTreeNetworkNAT->topLevelItemCount(); ++iNetworkIndex)
     557        {
     558            UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->topLevelItem(iNetworkIndex));
     559            if (!pItem->validate(message))
     560                fPass = false;
     561        }
     562
     563        /* And make sure item names are unique: */
     564        QList<QString> names;
     565        for (int iItemIndex = 0; iItemIndex < m_pTreeNetworkNAT->topLevelItemCount(); ++iItemIndex)
     566        {
     567            UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->topLevelItem(iItemIndex));
     568            const QString strItemName(pItem->newName());
     569            if (strItemName.isEmpty())
     570                continue;
     571            if (!names.contains(strItemName))
     572                names << strItemName;
     573            else
     574            {
     575                message.second << UIGlobalSettingsNetwork::tr("The name <b>%1</b> for NAT network on position <b>%2</b> is already in use.")
     576                                                              .arg(strItemName).arg(iItemIndex + 1);
     577                fPass = false;
     578            }
     579        }
     580
     581        /* Serialize message: */
     582        if (!message.second.isEmpty())
     583            messages << message;
     584    }
     585
     586    /* Validate Host network items: */
     587    {
     588        /* Prepare message: */
     589        UIValidationMessage message;
     590        message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(1));
     591
     592        /* Validate items only: */
     593        for (int iNetworkIndex = 0; iNetworkIndex < m_pTreeNetworkHost->topLevelItemCount(); ++iNetworkIndex)
     594        {
     595            UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->topLevelItem(iNetworkIndex));
     596            if (!pItem->validate(message))
     597                fPass = false;
     598        }
     599
     600        /* Serialize message: */
     601        if (!message.second.isEmpty())
     602            messages << message;
     603    }
     604
     605    /* Return result: */
     606    return fPass;
     607}
     608
     609void UIGlobalSettingsNetwork::setOrderAfter(QWidget *pWidget)
     610{
     611    setTabOrder(pWidget, m_pTabWidget->focusProxy());
     612    setTabOrder(m_pTabWidget->focusProxy(), m_pTreeNetworkNAT);
     613    setTabOrder(m_pTreeNetworkNAT, m_pTreeNetworkHost);
     614}
     615
     616void UIGlobalSettingsNetwork::retranslateUi()
     617{
     618    /* Translate uic generated strings: */
     619    Ui::UIGlobalSettingsNetwork::retranslateUi(this);
     620
     621    /* NAT network actions: */
     622    {
     623        /* Translate text: */
     624        m_pActionAddNetworkNAT->setText(tr("&Add NAT network"));
     625        m_pActionDelNetworkNAT->setText(tr("&Remove NAT network"));
     626        m_pActionEditNetworkNAT->setText(tr("&Edit NAT network"));
     627
     628        /* Recompose tool-tips: */
     629        m_pActionAddNetworkNAT->setToolTip(m_pActionAddNetworkNAT->text().remove('&') +
     630            QString(" (%1)").arg(m_pActionAddNetworkNAT->shortcut().toString()));
     631        m_pActionDelNetworkNAT->setToolTip(m_pActionDelNetworkNAT->text().remove('&') +
     632            QString(" (%1)").arg(m_pActionDelNetworkNAT->shortcut().toString()));
     633        m_pActionEditNetworkNAT->setToolTip(m_pActionEditNetworkNAT->text().remove('&') +
     634            QString(" (%1)").arg(m_pActionEditNetworkNAT->shortcut().toString()));
     635    }
     636
     637    /* Host network actions: */
     638    {
     639        /* Translate text: */
     640        m_pActionAddNetworkHost->setText(tr("&Add host-only network"));
     641        m_pActionDelNetworkHost->setText(tr("&Remove host-only network"));
     642        m_pActionEditNetworkHost->setText(tr("&Edit host-only network"));
     643
     644        /* Recompose tool-tips: */
     645        m_pActionAddNetworkHost->setToolTip(m_pActionAddNetworkHost->text().remove('&') +
     646            QString(" (%1)").arg(m_pActionAddNetworkHost->shortcut().toString()));
     647        m_pActionDelNetworkHost->setToolTip(m_pActionDelNetworkHost->text().remove('&') +
     648            QString(" (%1)").arg(m_pActionDelNetworkHost->shortcut().toString()));
     649        m_pActionEditNetworkHost->setToolTip(m_pActionEditNetworkHost->text().remove('&') +
     650            QString(" (%1)").arg(m_pActionEditNetworkHost->shortcut().toString()));
     651    }
     652}
     653
     654void UIGlobalSettingsNetwork::sltAddNetworkNAT()
     655{
     656    /* Prepare useful variables: */
     657    CVirtualBox vbox = vboxGlobal().virtualBox();
     658
     659    /* Compose a pool of busy names: */
     660    QList<QString> names;
     661    for (int iItemIndex = 0; iItemIndex < m_pTreeNetworkNAT->topLevelItemCount(); ++iItemIndex)
     662    {
     663        UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->topLevelItem(iItemIndex));
     664        if (!names.contains(pItem->name()))
     665            names << pItem->name();
     666    }
     667    /* Search for the name with maximum index: */
     668    int iMaximumIndex = -1;
     669    const QString strNameTemplate("NatNetwork%1");
     670    foreach (const QString &strName, names)
     671    {
     672        QRegExp regExp(strNameTemplate.arg("([\\d]*)"));
     673        if (regExp.indexIn(strName) != -1)
     674            iMaximumIndex = qMax(iMaximumIndex, regExp.cap(1).toInt());
     675    }
     676
     677    /* Create NAT network: */
     678    QString strIndex(iMaximumIndex == -1 ? QString() : QString::number(iMaximumIndex + 1));
     679    CNATNetwork network = vbox.CreateNATNetwork(strNameTemplate.arg(strIndex));
     680    if (!vbox.isOk())
     681        return msgCenter().cannotCreateNATNetwork(vbox, this);
     682    AssertReturnVoid(!network.isNull());
     683
     684    /* Update tree: */
     685    createTreeItemNetworkNAT(generateDataNetworkNAT(network), true);
     686}
     687
     688void UIGlobalSettingsNetwork::sltDelNetworkNAT()
     689{
     690    /* Get network item: */
     691    UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->currentItem());
     692    AssertMsg(pItem, ("Current item should present!\n"));
     693    /* Get network name: */
     694    const QString strNetworkName(pItem->name());
     695
     696    /* Confirm NAT network removal: */
     697    if (!msgCenter().confirmNATNetworkRemoval(strNetworkName, this))
     698        return;
     699
     700    /* Prepare useful variables: */
     701    CVirtualBox vbox = vboxGlobal().virtualBox();
     702
     703    /* Find corresponding interface: */
     704    const CNATNetwork &network = vbox.FindNATNetworkByName(strNetworkName);
     705    AssertReturnVoid(vbox.isOk() && !network.isNull());
     706
     707    /* Remove NAT network: */
     708    vbox.RemoveNATNetwork(network);
     709    if (!vbox.isOk())
     710        return msgCenter().cannotRemoveNATNetwork(vbox, strNetworkName, this);
     711
     712    /* Update tree: */
     713    removeTreeItemNetworkNAT(pItem);
     714}
     715
     716void UIGlobalSettingsNetwork::sltEditNetworkNAT()
     717{
     718    /* Get network item: */
     719    UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->currentItem());
     720    AssertMsg(pItem, ("Current item should present!\n"));
     721
     722    /* Edit current item data: */
     723    UIDataNetworkNAT data;
     724    pItem->uploadNetworkData(data);
     725    UIGlobalSettingsNetworkDetailsNAT details(this, data);
     726    if (details.exec() == QDialog::Accepted)
     727    {
     728        /* Put data back: */
     729        pItem->fetchNetworkData(data);
     730        sltHandleCurrentItemChangeNetworkNAT();
     731        m_fChanged = true;
     732        /* Revalidate: */
     733        revalidate();
     734    }
     735}
     736
     737void UIGlobalSettingsNetwork::sltAddNetworkHost()
     738{
    320739    /* Prepare useful variables: */
    321740    CVirtualBox vbox = vboxGlobal().virtualBox();
    322741    CHost host = vboxGlobal().host();
    323742
    324     /* Update all the host-only interfaces: */
    325     for (int iNetworkIndex = 0; iNetworkIndex < m_cache.m_items.size(); ++iNetworkIndex)
    326     {
    327         /* Get iterated data: */
    328         const UIHostNetworkData &data = m_cache.m_items[iNetworkIndex];
    329         /* Find corresponding interface: */
    330         CHostNetworkInterface iface = host.FindHostNetworkInterfaceByName(data.m_interface.m_strName);
    331         if (!iface.isNull())
    332         {
    333             /* Host-only interface configuring: */
    334             if (data.m_interface.m_fDhcpClientEnabled)
    335             {
    336                 iface.EnableDynamicIPConfig();
    337             }
    338             else
    339             {
    340                 AssertMsg(data.m_interface.m_strInterfaceAddress.isEmpty() ||
    341                           QHostAddress(data.m_interface.m_strInterfaceAddress).protocol() == QAbstractSocket::IPv4Protocol,
    342                           ("Interface IPv4 address must be empty or IPv4-valid!\n"));
    343                 AssertMsg(data.m_interface.m_strInterfaceMask.isEmpty() ||
    344                           QHostAddress(data.m_interface.m_strInterfaceMask).protocol() == QAbstractSocket::IPv4Protocol,
    345                           ("Interface IPv4 network mask must be empty or IPv4-valid!\n"));
    346                 iface.EnableStaticIPConfig(data.m_interface.m_strInterfaceAddress, data.m_interface.m_strInterfaceMask);
    347                 if (iface.GetIPV6Supported())
    348                 {
    349                     AssertMsg(data.m_interface.m_strInterfaceAddress6.isEmpty() ||
    350                               QHostAddress(data.m_interface.m_strInterfaceAddress6).protocol() == QAbstractSocket::IPv6Protocol,
    351                               ("Interface IPv6 address must be empty or IPv6-valid!\n"));
    352                     iface.EnableStaticIPConfigV6(data.m_interface.m_strInterfaceAddress6, data.m_interface.m_strInterfaceMaskLength6.toULong());
    353                 }
    354             }
    355 
    356             /* Find corresponding DHCP server: */
    357             CDHCPServer dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
    358             if (!dhcp.isNull())
    359             {
    360                 /* DHCP server configuring: */
    361                 dhcp.SetEnabled(data.m_dhcpserver.m_fDhcpServerEnabled);
    362                 AssertMsg(QHostAddress(data.m_dhcpserver.m_strDhcpServerAddress).protocol() == QAbstractSocket::IPv4Protocol,
    363                           ("DHCP server IPv4 address must be IPv4-valid!\n"));
    364                 AssertMsg(QHostAddress(data.m_dhcpserver.m_strDhcpServerMask).protocol() == QAbstractSocket::IPv4Protocol,
    365                           ("DHCP server IPv4 network mask must be IPv4-valid!\n"));
    366                 AssertMsg(QHostAddress(data.m_dhcpserver.m_strDhcpLowerAddress).protocol() == QAbstractSocket::IPv4Protocol,
    367                           ("DHCP server IPv4 lower bound must be IPv4-valid!\n"));
    368                 AssertMsg(QHostAddress(data.m_dhcpserver.m_strDhcpUpperAddress).protocol() == QAbstractSocket::IPv4Protocol,
    369                           ("DHCP server IPv4 upper bound must be IPv4-valid!\n"));
    370                 if (QHostAddress(data.m_dhcpserver.m_strDhcpServerAddress).protocol() == QAbstractSocket::IPv4Protocol &&
    371                     QHostAddress(data.m_dhcpserver.m_strDhcpServerMask).protocol() == QAbstractSocket::IPv4Protocol &&
    372                     QHostAddress(data.m_dhcpserver.m_strDhcpLowerAddress).protocol() == QAbstractSocket::IPv4Protocol &&
    373                     QHostAddress(data.m_dhcpserver.m_strDhcpUpperAddress).protocol() == QAbstractSocket::IPv4Protocol)
    374                     dhcp.SetConfiguration(data.m_dhcpserver.m_strDhcpServerAddress, data.m_dhcpserver.m_strDhcpServerMask,
    375                                           data.m_dhcpserver.m_strDhcpLowerAddress, data.m_dhcpserver.m_strDhcpUpperAddress);
    376             }
    377         }
    378     }
    379 
    380     /* Upload properties & settings to data: */
    381     UISettingsPageGlobal::uploadData(data);
    382 }
    383 
    384 /* Validation processing: */
    385 bool UIGlobalSettingsNetwork::validate(QList<UIValidationMessage> &messages)
    386 {
    387     /* Redirect validation to items: */
    388     UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
    389     return pItem ? pItem->validate(messages) : true;
    390 }
    391 
    392 /* Navigation stuff: */
    393 void UIGlobalSettingsNetwork::setOrderAfter(QWidget *pWidget)
    394 {
    395     setTabOrder(pWidget, m_pInterfacesTree);
    396 }
    397 
    398 /* Translation stuff: */
    399 void UIGlobalSettingsNetwork::retranslateUi()
    400 {
    401     /* Translate uic generated strings: */
    402     Ui::UIGlobalSettingsNetwork::retranslateUi(this);
    403 
    404     /* Translate action tool-tips: */
    405     m_pAddAction->setText(tr("&Add host-only network"));
    406     m_pDelAction->setText(tr("&Remove host-only network"));
    407     m_pEditAction->setText(tr("&Edit host-only network"));
    408 
    409     /* Assign tool-tips: */
    410     m_pAddAction->setToolTip(m_pAddAction->text().remove('&') +
    411         QString(" (%1)").arg(m_pAddAction->shortcut().toString()));
    412     m_pDelAction->setToolTip(m_pDelAction->text().remove('&') +
    413         QString(" (%1)").arg(m_pDelAction->shortcut().toString()));
    414     m_pEditAction->setToolTip(m_pEditAction->text().remove('&') +
    415         QString(" (%1)").arg(m_pEditAction->shortcut().toString()));
    416 }
    417 
    418 /* Adds new network interface: */
    419 void UIGlobalSettingsNetwork::sltAddInterface()
    420 {
     743    /* Create Host interface: */
     744    CHostNetworkInterface iface;
     745    CProgress progress = host.CreateHostOnlyNetworkInterface(iface);
     746    if (!host.isOk())
     747        return msgCenter().cannotCreateHostInterface(host, this);
     748    msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/nw_32px.png", this, 0); // TODO: Change icon!
     749    if (!progress.isOk() || progress.GetResultCode() != 0)
     750        return msgCenter().cannotCreateHostInterface(progress, this);
     751
     752    /* Make sure DHCP server is created too: */
     753    CDHCPServer dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
     754    if (dhcp.isNull())
     755    {
     756        vbox.CreateDHCPServer(iface.GetNetworkName());
     757        if (!vbox.isOk())
     758            return msgCenter().cannotCreateDHCPServer(vbox, this);
     759        dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
     760    }
     761    AssertReturnVoid(!dhcp.isNull());
     762
     763    /* Update tree: */
     764    createTreeItemNetworkHost(generateDataNetworkHost(iface), true);
     765}
     766
     767void UIGlobalSettingsNetwork::sltDelNetworkHost()
     768{
     769    /* Get network item: */
     770    UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->currentItem());
     771    AssertMsg(pItem, ("Current item should present!\n"));
     772    /* Get interface name: */
     773    const QString strInterfaceName(pItem->name());
     774
     775    /* Confirm Host network removal: */
     776    if (!msgCenter().confirmHostOnlyInterfaceRemoval(strInterfaceName, this))
     777        return;
     778
    421779    /* Prepare useful variables: */
    422780    CVirtualBox vbox = vboxGlobal().virtualBox();
    423781    CHost host = vboxGlobal().host();
    424782
    425     /* Create new host-only interface: */
    426     CHostNetworkInterface iface;
    427     CProgress progress = host.CreateHostOnlyNetworkInterface(iface);
    428     if (host.isOk())
    429     {
    430         msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/nw_32px.png", this, 0);
    431         if (progress.isOk() && progress.GetResultCode() == 0)
    432         {
    433             /* Create DHCP server: */
    434             CDHCPServer dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
    435             if (dhcp.isNull())
    436             {
    437                 vbox.CreateDHCPServer(iface.GetNetworkName());
    438                 dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
    439             }
    440             AssertMsg(!dhcp.isNull(), ("DHCP server creation failed!\n"));
    441             /* Append cache with new item: */
    442             appendCacheItem(iface);
    443             /* Append list with new item: */
    444             appendListItem(m_cache.m_items.last(), true);
    445         }
    446         else
    447             msgCenter().cannotCreateHostInterface(progress, this);
    448     }
    449     else
    450         msgCenter().cannotCreateHostInterface(host, this);
    451 }
    452 
    453 /* Removes selected network interface: */
    454 void UIGlobalSettingsNetwork::sltDelInterface()
    455 {
    456     /* Get interface item: */
    457     UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
    458     AssertMsg(pItem, ("Current item should present!\n"));
    459     /* Get interface name: */
    460     QString strInterfaceName(pItem->name());
    461     /* Asking user about deleting selected network interface: */
    462     if (!msgCenter().confirmHostInterfaceRemoval(strInterfaceName, this))
    463         return;
    464 
    465     /* Prepare useful variables: */
    466     CVirtualBox vbox = vboxGlobal().virtualBox();
    467     CHost host = vboxGlobal().host();
    468 
    469783    /* Find corresponding interface: */
    470784    const CHostNetworkInterface &iface = host.FindHostNetworkInterfaceByName(strInterfaceName);
    471 
    472     /* Remove DHCP server first: */
    473     CDHCPServer dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName());
    474     if (!dhcp.isNull())
     785    AssertReturnVoid(host.isOk() && !iface.isNull());
     786
     787    /* Remove DHCP server if any: */
     788    CDHCPServer dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
     789    if (vbox.isOk() && !dhcp.isNull())
     790    {
    475791        vbox.RemoveDHCPServer(dhcp);
     792        if (!vbox.isOk())
     793            return msgCenter().cannotRemoveDHCPServer(vbox, strInterfaceName, this);
     794    }
    476795
    477796    /* Remove interface finally: */
    478797    CProgress progress = host.RemoveHostOnlyNetworkInterface(iface.GetId());
    479     if (host.isOk())
    480     {
    481         msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/nw_32px.png", this, 0);
    482         if (progress.isOk() && progress.GetResultCode() == 0)
    483         {
    484             /* Remove list item: */
    485             removeListItem(pItem);
    486             /* Remove cache item: */
    487             removeCacheItem(strInterfaceName);
    488         }
    489         else
    490             msgCenter().cannotRemoveHostInterface(progress, strInterfaceName, this);
    491     }
    492     else
    493         msgCenter().cannotRemoveHostInterface(host, strInterfaceName, this);
    494 }
    495 
    496 /* Edits selected network interface: */
    497 void UIGlobalSettingsNetwork::sltEditInterface()
    498 {
    499     /* Check interface presence */
    500     UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
    501     AssertMsg(pItem, ("Current item should be selected!\n"));
    502     /* Edit current item data */
    503     UIGlobalSettingsNetworkDetails details(this);
    504     details.getFromItem(pItem);
     798    if (!host.isOk())
     799        return msgCenter().cannotRemoveHostInterface(host, strInterfaceName, this);
     800    msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/nw_32px.png", this, 0); // TODO: Change icon!
     801    if (!progress.isOk() || progress.GetResultCode() != 0)
     802        return msgCenter().cannotRemoveHostInterface(progress, strInterfaceName, this);
     803
     804    /* Update tree: */
     805    removeTreeItemNetworkHost(pItem);
     806}
     807
     808void UIGlobalSettingsNetwork::sltEditNetworkHost()
     809{
     810    /* Get network item: */
     811    UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->currentItem());
     812    AssertMsg(pItem, ("Current item should present!\n"));
     813
     814    /* Edit current item data: */
     815    UIDataNetworkHost data;
     816    pItem->uploadNetworkData(data);
     817    UIGlobalSettingsNetworkDetailsHost details(this, data);
    505818    if (details.exec() == QDialog::Accepted)
    506819    {
    507         details.putBackToItem();
    508         pItem->updateInfo();
    509         sltUpdateCurrentItem();
     820        /* Put data back: */
     821        pItem->fetchNetworkData(data);
     822        sltHandleCurrentItemChangeNetworkHost();
    510823        m_fChanged = true;
    511 
    512824        /* Revalidate: */
    513825        revalidate();
     
    515827}
    516828
    517 /* Update current network interface data relations: */
    518 void UIGlobalSettingsNetwork::sltUpdateCurrentItem()
     829void UIGlobalSettingsNetwork::sltHandleCurrentItemChangeNetworkNAT()
    519830{
    520831    /* Get current item: */
    521     UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
     832    UIItemNetworkNAT *pItem = static_cast<UIItemNetworkNAT*>(m_pTreeNetworkNAT->currentItem());
    522833    /* Update availability: */
    523     m_pDelAction->setEnabled(pItem);
    524     m_pEditAction->setEnabled(pItem);
    525 }
    526 
    527 /* Show network interface context-menu: */
    528 void UIGlobalSettingsNetwork::sltChowContextMenu(const QPoint &pos)
    529 {
     834    m_pActionDelNetworkNAT->setEnabled(pItem);
     835    m_pActionEditNetworkNAT->setEnabled(pItem);
     836}
     837
     838void UIGlobalSettingsNetwork::sltHandleCurrentItemChangeNetworkHost()
     839{
     840    /* Get current item: */
     841    UIItemNetworkHost *pItem = static_cast<UIItemNetworkHost*>(m_pTreeNetworkHost->currentItem());
     842    /* Update availability: */
     843    m_pActionDelNetworkHost->setEnabled(pItem);
     844    m_pActionEditNetworkHost->setEnabled(pItem);
     845}
     846
     847void UIGlobalSettingsNetwork::sltShowContextMenuNetworkNAT(const QPoint &pos)
     848{
     849    /* Compose temporary context-menu: */
    530850    QMenu menu;
    531     if (m_pInterfacesTree->itemAt(pos))
    532     {
    533         menu.addAction(m_pEditAction);
    534         menu.addAction(m_pDelAction);
     851    if (m_pTreeNetworkNAT->itemAt(pos))
     852    {
     853        menu.addAction(m_pActionEditNetworkNAT);
     854        menu.addAction(m_pActionDelNetworkNAT);
    535855    }
    536856    else
    537857    {
    538         menu.addAction(m_pAddAction);
    539     }
    540     menu.exec(m_pInterfacesTree->mapToGlobal(pos));
    541 }
    542 
    543 void UIGlobalSettingsNetwork::appendCacheItem(const CHostNetworkInterface &iface)
    544 {
     858        menu.addAction(m_pActionAddNetworkNAT);
     859    }
     860    /* And show it: */
     861    menu.exec(m_pTreeNetworkNAT->mapToGlobal(pos));
     862}
     863
     864void UIGlobalSettingsNetwork::sltShowContextMenuNetworkHost(const QPoint &pos)
     865{
     866    /* Compose temporary context-menu: */
     867    QMenu menu;
     868    if (m_pTreeNetworkHost->itemAt(pos))
     869    {
     870        menu.addAction(m_pActionEditNetworkHost);
     871        menu.addAction(m_pActionDelNetworkHost);
     872    }
     873    else
     874    {
     875        menu.addAction(m_pActionAddNetworkHost);
     876    }
     877    /* And show it: */
     878    menu.exec(m_pTreeNetworkHost->mapToGlobal(pos));
     879}
     880
     881UIDataNetworkNAT UIGlobalSettingsNetwork::generateDataNetworkNAT(const CNATNetwork &network)
     882{
     883    /* Prepare data: */
     884    UIDataNetworkNAT data;
     885
     886    /* Load NAT network settings: */
     887    data.m_fEnabled = network.GetEnabled();
     888    data.m_strName = network.GetNetworkName();
     889    data.m_strNewName = data.m_strName;
     890    data.m_strCIDR = network.GetNetwork();
     891    data.m_fSupportsDHCP = network.GetNeedDhcpServer();
     892    data.m_fSupportsIPv6 = network.GetIPv6Enabled();
     893    data.m_fAdvertiseDefaultIPv6Route = network.GetAdvertiseDefaultIPv6RouteEnabled();
     894
     895    /* Return data: */
     896    return data;
     897}
     898
     899void UIGlobalSettingsNetwork::saveCacheItemNetworkNAT(const UIDataNetworkNAT &data)
     900{
     901    /* Make sure corresponding NAT network exists: */
     902    CVirtualBox vbox = vboxGlobal().virtualBox();
     903    CNATNetwork network = vbox.FindNATNetworkByName(data.m_strName);
     904    AssertReturnVoid(vbox.isOk() && !network.isNull());
     905
     906    /* Save NAT network options: */
     907    network.SetEnabled(data.m_fEnabled);
     908    network.SetNetworkName(data.m_strNewName);
     909    network.SetNetwork(data.m_strCIDR);
     910    network.SetNeedDhcpServer(data.m_fSupportsDHCP);
     911    network.SetIPv6Enabled(data.m_fSupportsIPv6);
     912    network.SetAdvertiseDefaultIPv6RouteEnabled(data.m_fAdvertiseDefaultIPv6Route);
     913}
     914
     915void UIGlobalSettingsNetwork::createTreeItemNetworkNAT(const UIDataNetworkNAT &data, bool fChooseItem)
     916{
     917    /* Add new item to the tree: */
     918    UIItemNetworkNAT *pItem = new UIItemNetworkNAT;
     919    pItem->fetchNetworkData(data);
     920    m_pTreeNetworkNAT->addTopLevelItem(pItem);
     921    /* And choose it as current if necessary: */
     922    if (fChooseItem)
     923        m_pTreeNetworkNAT->setCurrentItem(pItem);
     924}
     925
     926void UIGlobalSettingsNetwork::removeTreeItemNetworkNAT(UIItemNetworkNAT *pItem)
     927{
     928    /* Delete passed item: */
     929    delete pItem;
     930}
     931
     932UIDataNetworkHost UIGlobalSettingsNetwork::generateDataNetworkHost(const CHostNetworkInterface &iface)
     933{
     934    /* Prepare data: */
     935    UIDataNetworkHost data;
     936
    545937    /* Get DHCP server (create if necessary): */
    546938    CDHCPServer dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName());
    547939    if (dhcp.isNull())
    548940    {
    549         vboxGlobal().virtualBox().CreateDHCPServer(iface.GetNetworkName());
     941        CVirtualBox vbox = vboxGlobal().virtualBox();
     942        vbox.CreateDHCPServer(iface.GetNetworkName());
     943        if (!vbox.isOk())
     944        {
     945            msgCenter().cannotCreateDHCPServer(vbox, this);
     946            return data;
     947        }
    550948        dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName());
    551949    }
    552     AssertMsg(!dhcp.isNull(), ("DHCP server creation failed!\n"));
    553 
    554     /* Prepare cache item: */
    555     UIHostNetworkData data;
    556 
    557     /* Host-only interface settings */
     950    Assert(!dhcp.isNull());
     951    if (dhcp.isNull())
     952        return data;
     953
     954    /* Host interface settings: */
    558955    data.m_interface.m_strName = iface.GetName();
    559956    data.m_interface.m_fDhcpClientEnabled = iface.GetDHCPEnabled();
     
    571968    data.m_dhcpserver.m_strDhcpUpperAddress = dhcp.GetUpperIP();
    572969
    573     /* Append cache item: */
    574     m_cache.m_items << data;
    575 }
    576 
    577 void UIGlobalSettingsNetwork::removeCacheItem(const QString &strInterfaceName)
    578 {
    579     /* Search for invalidated cache item: */
    580     for (int iNetworkIndex = 0; iNetworkIndex < m_cache.m_items.size(); ++iNetworkIndex)
    581     {
    582         /* Get iterated data: */
    583         const UIHostNetworkData &data = m_cache.m_items[iNetworkIndex];
    584         if (data.m_interface.m_strName == strInterfaceName)
    585         {
    586             m_cache.m_items.removeAll(data);
    587             break;
    588         }
    589     }
    590 }
    591 
    592 void UIGlobalSettingsNetwork::appendListItem(const UIHostNetworkData &data, bool fChooseItem)
    593 {
    594     /* Add new item to the list: */
    595     UIHostInterfaceItem *pItem = new UIHostInterfaceItem;
     970    /* Return data: */
     971    return data;
     972}
     973
     974void UIGlobalSettingsNetwork::saveCacheItemNetworkHost(const UIDataNetworkHost &data)
     975{
     976    /* Make sure corresponding Host interface exists: */
     977    CHost host = vboxGlobal().host();
     978    CHostNetworkInterface iface = host.FindHostNetworkInterfaceByName(data.m_interface.m_strName);
     979    AssertReturnVoid(host.isOk() && !iface.isNull());
     980
     981    /* Automatic host interface configuration: */
     982    if (data.m_interface.m_fDhcpClientEnabled)
     983    {
     984        iface.EnableDynamicIPConfig();
     985    }
     986    /* Manual host interface configuration: */
     987    else
     988    {
     989        AssertMsg(data.m_interface.m_strInterfaceAddress.isEmpty() ||
     990                  QHostAddress(data.m_interface.m_strInterfaceAddress).protocol() == QAbstractSocket::IPv4Protocol,
     991                  ("Interface IPv4 address must be empty or IPv4-valid!\n"));
     992        AssertMsg(data.m_interface.m_strInterfaceMask.isEmpty() ||
     993                  QHostAddress(data.m_interface.m_strInterfaceMask).protocol() == QAbstractSocket::IPv4Protocol,
     994                  ("Interface IPv4 network mask must be empty or IPv4-valid!\n"));
     995        iface.EnableStaticIPConfig(data.m_interface.m_strInterfaceAddress, data.m_interface.m_strInterfaceMask);
     996        if (iface.GetIPV6Supported())
     997        {
     998            AssertMsg(data.m_interface.m_strInterfaceAddress6.isEmpty() ||
     999                      QHostAddress(data.m_interface.m_strInterfaceAddress6).protocol() == QAbstractSocket::IPv6Protocol,
     1000                      ("Interface IPv6 address must be empty or IPv6-valid!\n"));
     1001            iface.EnableStaticIPConfigV6(data.m_interface.m_strInterfaceAddress6, data.m_interface.m_strInterfaceMaskLength6.toULong());
     1002        }
     1003    }
     1004
     1005    /* Make sure corresponding DHCP server exists: */
     1006    CVirtualBox vbox = vboxGlobal().virtualBox();
     1007    CDHCPServer dhcp = vbox.FindDHCPServerByNetworkName(iface.GetNetworkName());
     1008    AssertReturnVoid(vbox.isOk() && !dhcp.isNull());
     1009
     1010    /* Save DHCP server configuration: */
     1011    dhcp.SetEnabled(data.m_dhcpserver.m_fDhcpServerEnabled);
     1012    AssertMsg(QHostAddress(data.m_dhcpserver.m_strDhcpServerAddress).protocol() == QAbstractSocket::IPv4Protocol,
     1013              ("DHCP server IPv4 address must be IPv4-valid!\n"));
     1014    AssertMsg(QHostAddress(data.m_dhcpserver.m_strDhcpServerMask).protocol() == QAbstractSocket::IPv4Protocol,
     1015              ("DHCP server IPv4 network mask must be IPv4-valid!\n"));
     1016    AssertMsg(QHostAddress(data.m_dhcpserver.m_strDhcpLowerAddress).protocol() == QAbstractSocket::IPv4Protocol,
     1017              ("DHCP server IPv4 lower bound must be IPv4-valid!\n"));
     1018    AssertMsg(QHostAddress(data.m_dhcpserver.m_strDhcpUpperAddress).protocol() == QAbstractSocket::IPv4Protocol,
     1019              ("DHCP server IPv4 upper bound must be IPv4-valid!\n"));
     1020    if (QHostAddress(data.m_dhcpserver.m_strDhcpServerAddress).protocol() == QAbstractSocket::IPv4Protocol &&
     1021        QHostAddress(data.m_dhcpserver.m_strDhcpServerMask).protocol() == QAbstractSocket::IPv4Protocol &&
     1022        QHostAddress(data.m_dhcpserver.m_strDhcpLowerAddress).protocol() == QAbstractSocket::IPv4Protocol &&
     1023        QHostAddress(data.m_dhcpserver.m_strDhcpUpperAddress).protocol() == QAbstractSocket::IPv4Protocol)
     1024        dhcp.SetConfiguration(data.m_dhcpserver.m_strDhcpServerAddress, data.m_dhcpserver.m_strDhcpServerMask,
     1025                              data.m_dhcpserver.m_strDhcpLowerAddress, data.m_dhcpserver.m_strDhcpUpperAddress);
     1026}
     1027
     1028void UIGlobalSettingsNetwork::createTreeItemNetworkHost(const UIDataNetworkHost &data, bool fChooseItem)
     1029{
     1030    /* Add new item to the tree: */
     1031    UIItemNetworkHost *pItem = new UIItemNetworkHost;
    5961032    pItem->fetchNetworkData(data);
    597     m_pInterfacesTree->addTopLevelItem(pItem);
     1033    m_pTreeNetworkHost->addTopLevelItem(pItem);
    5981034    /* And choose it as current if necessary: */
    5991035    if (fChooseItem)
    600         m_pInterfacesTree->setCurrentItem(pItem);
    601 }
    602 
    603 void UIGlobalSettingsNetwork::removeListItem(UIHostInterfaceItem *pItem)
     1036        m_pTreeNetworkHost->setCurrentItem(pItem);
     1037}
     1038
     1039void UIGlobalSettingsNetwork::removeTreeItemNetworkHost(UIItemNetworkHost *pItem)
    6041040{
    6051041    /* Delete passed item: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h

    r47944 r48458  
    66
    77/*
    8  * Copyright (C) 2009-2012 Oracle Corporation
     8 * Copyright (C) 2009-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#define __UIGlobalSettingsNetwork_h__
    2121
    22 /* Local includes */
     22/* GUI includes: */
    2323#include "UISettingsPage.h"
    2424#include "UIGlobalSettingsNetwork.gen.h"
    2525
     26/* Forward declarations: */
     27class UIItemNetworkNAT;
     28class UIItemNetworkHost;
     29
     30
     31/* Global settings / Network page / NAT network data: */
     32struct UIDataNetworkNAT
     33{
     34    /* NAT Network: */
     35    bool m_fEnabled;
     36    QString m_strName;
     37    QString m_strNewName;
     38    QString m_strCIDR;
     39    bool m_fSupportsDHCP;
     40    bool m_fSupportsIPv6;
     41    bool m_fAdvertiseDefaultIPv6Route;
     42    bool operator==(const UIDataNetworkNAT &other) const
     43    {
     44        return m_fEnabled == other.m_fEnabled &&
     45               m_strName == other.m_strName &&
     46               m_strNewName == other.m_strNewName &&
     47               m_strCIDR == other.m_strCIDR &&
     48               m_fSupportsDHCP == other.m_fSupportsDHCP &&
     49               m_fSupportsIPv6 == other.m_fSupportsIPv6 &&
     50               m_fAdvertiseDefaultIPv6Route == other.m_fAdvertiseDefaultIPv6Route;
     51    }
     52};
     53
     54
    2655/* Global settings / Network page / Host interface data: */
    27 struct UIHostInterfaceData
    28 {
    29     /* Host-only Interface: */
     56struct UIDataNetworkHostInterface
     57{
     58    /* Host Interface: */
    3059    QString m_strName;
    3160    bool m_fDhcpClientEnabled;
     
    3564    QString m_strInterfaceAddress6;
    3665    QString m_strInterfaceMaskLength6;
    37     bool operator==(const UIHostInterfaceData &other) const
     66    bool operator==(const UIDataNetworkHostInterface &other) const
    3867    {
    3968        return m_strName == other.m_strName &&
     
    4776};
    4877
    49 /* Global settings / Network page / DHCP server data: */
    50 struct UIDHCPServerData
    51 {
    52     /* DHCP Server */
     78/* Global settings / Network page / Host DHCP server data: */
     79struct UIDataNetworkDHCPServer
     80{
     81    /* DHCP Server: */
    5382    bool m_fDhcpServerEnabled;
    5483    QString m_strDhcpServerAddress;
     
    5685    QString m_strDhcpLowerAddress;
    5786    QString m_strDhcpUpperAddress;
    58     bool operator==(const UIDHCPServerData &other) const
     87    bool operator==(const UIDataNetworkDHCPServer &other) const
    5988    {
    6089        return m_fDhcpServerEnabled == other.m_fDhcpServerEnabled &&
     
    6695};
    6796
    68 /* Global settings / Network page / Full network data: */
    69 struct UIHostNetworkData
    70 {
    71     UIHostInterfaceData m_interface;
    72     UIDHCPServerData m_dhcpserver;
    73     bool operator==(const UIHostNetworkData &other) const
     97/* Global settings / Network page / Host network data: */
     98struct UIDataNetworkHost
     99{
     100    UIDataNetworkHostInterface m_interface;
     101    UIDataNetworkDHCPServer m_dhcpserver;
     102    bool operator==(const UIDataNetworkHost &other) const
    74103    {
    75104        return m_interface == other.m_interface &&
     
    78107};
    79108
    80 /* Global settings / Network page / Cache: */
     109
     110/* Global settings / Network page / Global network cache: */
    81111struct UISettingsCacheGlobalNetwork
    82112{
    83     QList<UIHostNetworkData> m_items;
    84 };
    85 
    86 /* Global settings / Network page / Host interface item: */
    87 class UIHostInterfaceItem : public QTreeWidgetItem
    88 {
     113    QList<UIDataNetworkNAT> m_networksNAT;
     114    QList<UIDataNetworkHost> m_networksHost;
     115};
     116
     117
     118/* Global settings / Network page: */
     119class UIGlobalSettingsNetwork : public UISettingsPageGlobal, public Ui::UIGlobalSettingsNetwork
     120{
     121    Q_OBJECT;
     122
    89123public:
    90124
    91125    /* Constructor: */
    92     UIHostInterfaceItem();
    93 
    94     /* API: Get/return data to/form items: */
    95     void fetchNetworkData(const UIHostNetworkData &data);
    96     void uploadNetworkData(UIHostNetworkData &data);
     126    UIGlobalSettingsNetwork();
     127
     128protected:
     129
     130    /* API:
     131     * Load data to cache from corresponding external object(s),
     132     * this task COULD be performed in other than GUI thread: */
     133    void loadToCacheFrom(QVariant &data);
     134    /* API:
     135     * Load data to corresponding widgets from cache,
     136     * this task SHOULD be performed in GUI thread only: */
     137    void getFromCache();
     138
     139    /* API:
     140     * Save data from corresponding widgets to cache,
     141     * this task SHOULD be performed in GUI thread only: */
     142    void putToCache();
     143    /* API:
     144     * Save data from cache to corresponding external object(s),
     145     * this task COULD be performed in other than GUI thread: */
     146    void saveFromCacheTo(QVariant &data);
    97147
    98148    /* API: Validation stuff: */
    99149    bool validate(QList<UIValidationMessage> &messages);
    100150
    101     /* API: Update stuff: */
    102     QString updateInfo();
    103 
    104     /* API: Network item getters: */
    105     QString name() const { return m_data.m_interface.m_strName; }
    106     bool isDhcpClientEnabled() const { return m_data.m_interface.m_fDhcpClientEnabled; }
    107     QString interfaceAddress() const { return m_data.m_interface.m_strInterfaceAddress; }
    108     QString interfaceMask() const { return m_data.m_interface.m_strInterfaceMask; }
    109     bool isIpv6Supported() const { return m_data.m_interface.m_fIpv6Supported; }
    110     QString interfaceAddress6() const { return m_data.m_interface.m_strInterfaceAddress6; }
    111     QString interfaceMaskLength6() const { return m_data.m_interface.m_strInterfaceMaskLength6; }
    112 
    113     bool isDhcpServerEnabled() const { return m_data.m_dhcpserver.m_fDhcpServerEnabled; }
    114     QString dhcpServerAddress() const { return m_data.m_dhcpserver.m_strDhcpServerAddress; }
    115     QString dhcpServerMask() const { return m_data.m_dhcpserver.m_strDhcpServerMask; }
    116     QString dhcpLowerAddress() const { return m_data.m_dhcpserver.m_strDhcpLowerAddress; }
    117     QString dhcpUpperAddress() const { return m_data.m_dhcpserver.m_strDhcpUpperAddress; }
    118 
    119     /* API: Network item setters */
    120     void setDhcpClientEnabled(bool fEnabled) { m_data.m_interface.m_fDhcpClientEnabled = fEnabled; }
    121     void setInterfaceAddress (const QString &strValue) { m_data.m_interface.m_strInterfaceAddress = strValue; }
    122     void setInterfaceMask (const QString &strValue) { m_data.m_interface.m_strInterfaceMask = strValue; }
    123     void setIp6Supported (bool fSupported) { m_data.m_interface.m_fIpv6Supported = fSupported; }
    124     void setInterfaceAddress6 (const QString &strValue) { m_data.m_interface.m_strInterfaceAddress6 = strValue; }
    125     void setInterfaceMaskLength6 (const QString &strValue) { m_data.m_interface.m_strInterfaceMaskLength6 = strValue; }
    126 
    127     void setDhcpServerEnabled (bool fEnabled) { m_data.m_dhcpserver.m_fDhcpServerEnabled = fEnabled; }
    128     void setDhcpServerAddress (const QString &sttValue) { m_data.m_dhcpserver.m_strDhcpServerAddress = sttValue; }
    129     void setDhcpServerMask (const QString &strValue) { m_data.m_dhcpserver.m_strDhcpServerMask = strValue; }
    130     void setDhcpLowerAddress (const QString &strValue) { m_data.m_dhcpserver.m_strDhcpLowerAddress = strValue; }
    131     void setDhcpUpperAddress (const QString &strValue) { m_data.m_dhcpserver.m_strDhcpUpperAddress = strValue; }
     151    /* API: Navigation stuff: */
     152    void setOrderAfter(QWidget *pWidget);
     153
     154    /* API: Translation stuff: */
     155    void retranslateUi();
     156
     157private slots:
     158
     159    /* Handlers: NAT network stuff: */
     160    void sltAddNetworkNAT();
     161    void sltDelNetworkNAT();
     162    void sltEditNetworkNAT();
     163    void sltHandleCurrentItemChangeNetworkNAT();
     164    void sltShowContextMenuNetworkNAT(const QPoint &pos);
     165
     166    /* Handlers: Host network stuff: */
     167    void sltAddNetworkHost();
     168    void sltDelNetworkHost();
     169    void sltEditNetworkHost();
     170    void sltHandleCurrentItemChangeNetworkHost();
     171    void sltShowContextMenuNetworkHost(const QPoint &pos);
    132172
    133173private:
    134174
    135     /* Network data: */
    136     UIHostNetworkData m_data;
    137 };
    138 
    139 /* Global settings / Network page: */
    140 class UIGlobalSettingsNetwork : public UISettingsPageGlobal, public Ui::UIGlobalSettingsNetwork
    141 {
    142     Q_OBJECT;
    143 
    144 public:
    145 
    146     /* Constructor: */
    147     UIGlobalSettingsNetwork();
    148 
    149 protected:
    150 
    151     /* Load data to cache from corresponding external object(s),
    152      * this task COULD be performed in other than GUI thread: */
    153     void loadToCacheFrom(QVariant &data);
    154     /* Load data to corresponding widgets from cache,
    155      * this task SHOULD be performed in GUI thread only: */
    156     void getFromCache();
    157 
    158     /* Save data from corresponding widgets to cache,
    159      * this task SHOULD be performed in GUI thread only: */
    160     void putToCache();
    161     /* Save data from cache to corresponding external object(s),
    162      * this task COULD be performed in other than GUI thread: */
    163     void saveFromCacheTo(QVariant &data);
    164 
    165     /* API: Validation stuff: */
    166     bool validate(QList<UIValidationMessage> &messages);
    167 
    168     /* Navigation stuff: */
    169     void setOrderAfter (QWidget *aWidget);
    170 
    171     /* Translation stuff: */
    172     void retranslateUi();
    173 
    174 private slots:
    175 
    176     /* Helper slots: */
    177     void sltAddInterface();
    178     void sltDelInterface();
    179     void sltEditInterface();
    180     void sltUpdateCurrentItem();
    181     void sltChowContextMenu(const QPoint &pos);
    182 
    183 private:
    184 
    185     /* Helper members: */
    186     void appendCacheItem(const CHostNetworkInterface &iface);
    187     void removeCacheItem(const QString &strInterfaceName);
    188     void appendListItem(const UIHostNetworkData &data, bool fChooseItem = false);
    189     void removeListItem(UIHostInterfaceItem *pItem);
    190 
    191     /* Helper actions: */
    192     QAction *m_pAddAction;
    193     QAction *m_pDelAction;
    194     QAction *m_pEditAction;
    195 
    196     /* Editness flag: */
     175    /* Helpers: NAT network cache stuff: */
     176    UIDataNetworkNAT generateDataNetworkNAT(const CNATNetwork &network);
     177    void saveCacheItemNetworkNAT(const UIDataNetworkNAT &data);
     178
     179    /* Helpers: NAT network tree stuff: */
     180    void createTreeItemNetworkNAT(const UIDataNetworkNAT &data, bool fChooseItem = false);
     181    void removeTreeItemNetworkNAT(UIItemNetworkNAT *pItem);
     182
     183    /* Helpers: Host network cache stuff: */
     184    UIDataNetworkHost generateDataNetworkHost(const CHostNetworkInterface &iface);
     185    void saveCacheItemNetworkHost(const UIDataNetworkHost &data);
     186
     187    /* Helpers: Host network tree stuff: */
     188    void createTreeItemNetworkHost(const UIDataNetworkHost &data, bool fChooseItem = false);
     189    void removeTreeItemNetworkHost(UIItemNetworkHost *pItem);
     190
     191    /* Variables: NAT network actions: */
     192    QAction *m_pActionAddNetworkNAT;
     193    QAction *m_pActionDelNetworkNAT;
     194    QAction *m_pActionEditNetworkNAT;
     195
     196    /* Variables: Host network actions: */
     197    QAction *m_pActionAddNetworkHost;
     198    QAction *m_pActionDelNetworkHost;
     199    QAction *m_pActionEditNetworkHost;
     200
     201    /* Variable: Editness flag: */
    197202    bool m_fChanged;
    198203
    199     /* Cache: */
     204    /* Variable: Cache: */
    200205    UISettingsCacheGlobalNetwork m_cache;
    201206};
    202207
    203208#endif // __UIGlobalSettingsNetwork_h__
    204 
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.ui

    r47193 r48458  
    1515 <class>UIGlobalSettingsNetwork</class>
    1616 <widget class="QWidget" name="UIGlobalSettingsNetwork">
    17   <layout class="QGridLayout">
    18    <property name="margin">
    19     <number>0</number>
    20    </property>
    21    <item row="0" column="0">
    22     <widget class="QILabelSeparator" native="1" name="m_pNetworkLabel">
    23      <property name="text">
    24      <string>&amp;Host-only Networks</string>
    25      </property>
    26      <property name="buddy">
    27       <cstring>m_pInterfacesTree</cstring>
    28      </property>
    29     </widget>
    30    </item>
    31    <item row="1" column="0">
    32     <widget class="QWidget" native="1" name="m_pNetworkSettingsContainer" >
    33      <layout class="QHBoxLayout" name="m_pLayout1">
    34       <property name="spacing">
    35        <number>3</number>
    36       </property>
    37       <property name="margin">
    38        <number>0</number>
    39       </property>
    40       <item>
    41        <widget class="QTreeWidget" name="m_pInterfacesTree">
    42         <property name="sizePolicy">
    43          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
    44           <horstretch>0</horstretch>
    45           <verstretch>0</verstretch>
    46          </sizepolicy>
    47         </property>
    48         <property name="minimumSize">
    49          <size>
    50           <width>0</width>
    51           <height>150</height>
    52          </size>
    53         </property>
    54         <property name="whatsThis">
    55          <string>Lists all available host-only networks.</string>
    56         </property>
    57         <property name="rootIsDecorated">
    58          <bool>false</bool>
    59         </property>
    60         <column>
    61          <property name="text">
    62           <string>Name</string>
     17  <layout class="QVBoxLayout">
     18   <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">
     25       <property name="margin">
     26        <number>0</number>
     27       </property>
     28       <property name="spacing">
     29        <number>3</number>
     30       </property>
     31       <item>
     32        <widget class="QTreeWidget" name="m_pTreeNetworkNAT">
     33         <property name="sizePolicy">
     34          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
     35           <horstretch>0</horstretch>
     36           <verstretch>0</verstretch>
     37          </sizepolicy>
    6338         </property>
    64         </column>
    65        </widget>
    66       </item>
    67       <item>
    68        <widget class="UIToolBar" name="m_pActionsToolbar"/>
    69       </item>
    70      </layout>
     39         <property name="minimumSize">
     40          <size>
     41           <width>0</width>
     42           <height>150</height>
     43          </size>
     44         </property>
     45         <property name="whatsThis">
     46          <string>Lists all available NAT networks.</string>
     47         </property>
     48         <property name="rootIsDecorated">
     49          <bool>false</bool>
     50         </property>
     51         <column>
     52          <property name="text">
     53           <string>Name</string>
     54          </property>
     55         </column>
     56        </widget>
     57       </item>
     58       <item>
     59        <widget class="UIToolBar" name="m_pToolbarNetworkNAT"/>
     60       </item>
     61      </layout>
     62     </widget>
     63     <widget class="QWidget" name="m_pTabHostOnly">
     64      <attribute name="title">
     65       <string>&amp;Host-only Networks</string>
     66      </attribute>
     67      <layout class="QHBoxLayout">
     68       <property name="margin">
     69        <number>0</number>
     70       </property>
     71       <property name="spacing">
     72        <number>3</number>
     73       </property>
     74       <item>
     75        <widget class="QTreeWidget" name="m_pTreeNetworkHost">
     76         <property name="sizePolicy">
     77          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
     78           <horstretch>0</horstretch>
     79           <verstretch>0</verstretch>
     80          </sizepolicy>
     81         </property>
     82         <property name="minimumSize">
     83          <size>
     84           <width>0</width>
     85           <height>150</height>
     86          </size>
     87         </property>
     88         <property name="whatsThis">
     89          <string>Lists all available host-only networks.</string>
     90         </property>
     91         <property name="rootIsDecorated">
     92          <bool>false</bool>
     93         </property>
     94         <column>
     95          <property name="text">
     96           <string>Name</string>
     97          </property>
     98         </column>
     99        </widget>
     100       </item>
     101       <item>
     102        <widget class="UIToolBar" name="m_pToolbarNetworkHost"/>
     103       </item>
     104      </layout>
     105     </widget>
    71106    </widget>
    72107   </item>
     
    75110 <customwidgets>
    76111  <customwidget>
    77    <class>QILabelSeparator</class>
    78    <extends>QLabel</extends>
    79    <header>QILabelSeparator.h</header>
    80   </customwidget>
    81   <customwidget>
    82112   <class>UIToolBar</class>
    83113   <extends>QToolBar</extends>
    84114   <header>UIToolBar.h</header>
     115  </customwidget>
     116  <customwidget>
     117   <class>QITabWidget</class>
     118   <extends>QTabWidget</extends>
     119   <header>QITabWidget.h</header>
    85120  </customwidget>
    86121 </customwidgets>
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp

    r48400 r48458  
    33 *
    44 * VBox frontends: Qt4 GUI ("VirtualBox"):
    5  * UIGlobalSettingsNetworkDetails class implementation
     5 * UIGlobalSettingsNetworkDetailsHost class implementation
    66 */
    77
    88/*
    9  * Copyright (C) 2009-2010 Oracle Corporation
     9 * Copyright (C) 2009-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818 */
    1919
    20 /* Global includes */
    21 #include <QHostAddress>
     20/* Qt includes: */
    2221#include <QRegExpValidator>
    2322
    24 /* Local includes */
     23/* GUI includes: */
    2524#include "UIGlobalSettingsNetwork.h"
    26 #include "UIGlobalSettingsNetworkDetails.h"
    27 
    28 /* Network page details constructor: */
    29 UIGlobalSettingsNetworkDetails::UIGlobalSettingsNetworkDetails(QWidget *pParent)
    30     : QIWithRetranslateUI2<QIDialog>(pParent
    31 #ifdef Q_WS_MAC
    32     ,Qt::Sheet
    33 #endif /* Q_WS_MAC */
    34     )
    35     , m_pItem(0)
     25#include "UIGlobalSettingsNetworkDetailsHost.h"
     26
     27UIGlobalSettingsNetworkDetailsHost::UIGlobalSettingsNetworkDetailsHost(QWidget *pParent, UIDataNetworkHost &data)
     28    : QIWithRetranslateUI2<QIDialog>(pParent)
     29    , m_data(data)
    3630{
    3731    /* Apply UI decorations: */
    38     Ui::UIGlobalSettingsNetworkDetails::setupUi(this);
     32    Ui::UIGlobalSettingsNetworkDetailsHost::setupUi(this);
    3933
    4034    /* Setup dialog: */
     
    4640                            "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\."
    4741                            "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])");
    48     QString strTemplateIPv6("[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
    49                             "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
    50                             "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
    51                             "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}");
     42    QString strTemplateIPv6("[0-9a-fA-F]{1,4}:{1,2}[0-9a-fA-F]{1,4}:{1,2}"
     43                            "[0-9a-fA-F]{1,4}:{1,2}[0-9a-fA-F]{1,4}:{1,2}"
     44                            "[0-9a-fA-F]{1,4}:{1,2}[0-9a-fA-F]{1,4}:{1,2}"
     45                            "[0-9a-fA-F]{1,4}:{1,2}[0-9a-fA-F]{1,4}");
    5246
    5347    m_pIPv4Editor->setValidator(new QRegExpValidator(QRegExp(strTemplateIPv4), this));
     
    9286    retranslateUi();
    9387
     88    /* Load: */
     89    load();
     90
    9491    /* Fix minimum possible size: */
    9592    resize(minimumSizeHint());
    96     qApp->processEvents();
    9793    setFixedSize(minimumSizeHint());
    9894}
    9995
    100 /* Get data to details sub-dialog: */
    101 void UIGlobalSettingsNetworkDetails::getFromItem(UIHostInterfaceItem *pItem)
    102 {
    103     m_pItem = pItem;
    104 
    105     /* Host-only Interface: */
    106     m_pEnableManualCheckbox->setChecked(!m_pItem->isDhcpClientEnabled());
     96void UIGlobalSettingsNetworkDetailsHost::retranslateUi()
     97{
     98    /* Translate uic generated strings: */
     99    Ui::UIGlobalSettingsNetworkDetailsHost::retranslateUi(this);
     100}
     101
     102void UIGlobalSettingsNetworkDetailsHost::accept()
     103{
     104    /* Save before accept: */
     105    save();
     106    /* Call to base-class: */
     107    QIDialog::accept();
     108}
     109
     110void UIGlobalSettingsNetworkDetailsHost::load()
     111{
     112    /* Host Interface: */
     113    m_pEnableManualCheckbox->setChecked(!m_data.m_interface.m_fDhcpClientEnabled);
    107114#if !0 /* !defined (Q_WS_WIN) */
    108115    /* Disable automatic for all hosts for now: */
     
    110117    m_pEnableManualCheckbox->setEnabled(false);
    111118#endif
    112     sltDhcpClientStatusChanged();
     119    loadClientStuff();
    113120
    114121    /* DHCP Server: */
    115     m_pEnabledDhcpServerCheckbox->setChecked(m_pItem->isDhcpServerEnabled());
    116     sltDhcpServerStatusChanged();
    117 }
    118 
    119 /* Return data from details sub-dialog: */
    120 void UIGlobalSettingsNetworkDetails::putBackToItem()
    121 {
    122     /* Host-only Interface: */
    123     m_pItem->setDhcpClientEnabled(!m_pEnableManualCheckbox->isChecked());
    124     if (m_pEnableManualCheckbox->isChecked())
    125     {
    126         m_pItem->setInterfaceAddress(m_pIPv4Editor->text());
    127         m_pItem->setInterfaceMask(m_pNMv4Editor->text());
    128         if (m_pItem->isIpv6Supported())
    129         {
    130             m_pItem->setInterfaceAddress6(m_pIPv6Editor->text());
    131             m_pItem->setInterfaceMaskLength6(m_pNMv6Editor->text());
    132         }
    133     }
    134 
    135     /* DHCP Server: */
    136     m_pItem->setDhcpServerEnabled(m_pEnabledDhcpServerCheckbox->isChecked());
    137     if (m_pEnabledDhcpServerCheckbox->isChecked())
    138     {
    139         m_pItem->setDhcpServerAddress(m_pDhcpAddressEditor->text());
    140         m_pItem->setDhcpServerMask(m_pDhcpMaskEditor->text());
    141         m_pItem->setDhcpLowerAddress(m_pDhcpLowerAddressEditor->text());
    142         m_pItem->setDhcpUpperAddress(m_pDhcpUpperAddressEditor->text());
    143     }
    144 }
    145 
    146 /* Validation stuff: */
    147 void UIGlobalSettingsNetworkDetails::retranslateUi()
    148 {
    149     /* Translate uic generated strings: */
    150     Ui::UIGlobalSettingsNetworkDetails::retranslateUi(this);
    151 }
    152 
    153 /* Handler for DHCP client settings change: */
    154 void UIGlobalSettingsNetworkDetails::sltDhcpClientStatusChanged()
    155 {
     122    m_pEnabledDhcpServerCheckbox->setChecked(m_data.m_dhcpserver.m_fDhcpServerEnabled);
     123    loadServerStuff();
     124}
     125
     126void UIGlobalSettingsNetworkDetailsHost::loadClientStuff()
     127{
     128    /* Adjust network interface fields: */
    156129    bool fIsManual = m_pEnableManualCheckbox->isChecked();
    157     bool fIsIpv6Supported = fIsManual && m_pItem->isIpv6Supported();
     130    bool fIsIpv6Supported = fIsManual && m_data.m_interface.m_fIpv6Supported;
    158131
    159132    m_pIPv4Editor->clear();
     
    173146    if (fIsManual)
    174147    {
    175         m_pIPv4Editor->setText(m_pItem->interfaceAddress());
    176         m_pNMv4Editor->setText(m_pItem->interfaceMask());
     148        m_pIPv4Editor->setText(m_data.m_interface.m_strInterfaceAddress);
     149        m_pNMv4Editor->setText(m_data.m_interface.m_strInterfaceMask);
    177150        if (fIsIpv6Supported)
    178151        {
    179             m_pIPv6Editor->setText(m_pItem->interfaceAddress6());
    180             m_pNMv6Editor->setText(m_pItem->interfaceMaskLength6());
     152            m_pIPv6Editor->setText(m_data.m_interface.m_strInterfaceAddress6);
     153            m_pNMv6Editor->setText(m_data.m_interface.m_strInterfaceMaskLength6);
    181154        }
    182155    }
    183156}
    184157
    185 /* Handler for DHCP server settings change: */
    186 void UIGlobalSettingsNetworkDetails::sltDhcpServerStatusChanged()
    187 {
     158void UIGlobalSettingsNetworkDetailsHost::loadServerStuff()
     159{
     160    /* Adjust dhcp server fields: */
    188161    bool fIsManual = m_pEnabledDhcpServerCheckbox->isChecked();
    189162
     
    204177    if (fIsManual)
    205178    {
    206         m_pDhcpAddressEditor->setText(m_pItem->dhcpServerAddress());
    207         m_pDhcpMaskEditor->setText(m_pItem->dhcpServerMask());
    208         m_pDhcpLowerAddressEditor->setText(m_pItem->dhcpLowerAddress());
    209         m_pDhcpUpperAddressEditor->setText(m_pItem->dhcpUpperAddress());
    210     }
    211 }
    212 
     179        m_pDhcpAddressEditor->setText(m_data.m_dhcpserver.m_strDhcpServerAddress);
     180        m_pDhcpMaskEditor->setText(m_data.m_dhcpserver.m_strDhcpServerMask);
     181        m_pDhcpLowerAddressEditor->setText(m_data.m_dhcpserver.m_strDhcpLowerAddress);
     182        m_pDhcpUpperAddressEditor->setText(m_data.m_dhcpserver.m_strDhcpUpperAddress);
     183    }
     184}
     185
     186void UIGlobalSettingsNetworkDetailsHost::save()
     187{
     188    /* Host Interface: */
     189    m_data.m_interface.m_fDhcpClientEnabled = !m_pEnableManualCheckbox->isChecked();
     190    if (m_pEnableManualCheckbox->isChecked())
     191    {
     192        m_data.m_interface.m_strInterfaceAddress = m_pIPv4Editor->text();
     193        m_data.m_interface.m_strInterfaceMask = m_pNMv4Editor->text();
     194        if (m_data.m_interface.m_fIpv6Supported)
     195        {
     196            m_data.m_interface.m_strInterfaceAddress6 = m_pIPv6Editor->text();
     197            m_data.m_interface.m_strInterfaceMaskLength6 = m_pNMv6Editor->text();
     198        }
     199    }
     200
     201    /* DHCP Server: */
     202    m_data.m_dhcpserver.m_fDhcpServerEnabled = m_pEnabledDhcpServerCheckbox->isChecked();
     203    if (m_pEnabledDhcpServerCheckbox->isChecked())
     204    {
     205        m_data.m_dhcpserver.m_strDhcpServerAddress = m_pDhcpAddressEditor->text();
     206        m_data.m_dhcpserver.m_strDhcpServerMask = m_pDhcpMaskEditor->text();
     207        m_data.m_dhcpserver.m_strDhcpLowerAddress = m_pDhcpLowerAddressEditor->text();
     208        m_data.m_dhcpserver.m_strDhcpUpperAddress = m_pDhcpUpperAddressEditor->text();
     209    }
     210}
     211
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.h

    r48400 r48458  
    22 *
    33 * VBox frontends: Qt4 GUI ("VirtualBox"):
    4  * UIGlobalSettingsNetworkDetails class declaration
     4 * UIGlobalSettingsNetworkDetailsHost class declaration
    55 */
    66
    77/*
    8  * Copyright (C) 2009-2010 Oracle Corporation
     8 * Copyright (C) 2009-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1717 */
    1818
    19 #ifndef __UIGlobalSettingsNetworkDetails_h__
    20 #define __UIGlobalSettingsNetworkDetails_h__
     19#ifndef __UIGlobalSettingsNetworkDetailsHost_h__
     20#define __UIGlobalSettingsNetworkDetailsHost_h__
    2121
    2222/* Local includes */
    2323#include "QIDialog.h"
    2424#include "QIWithRetranslateUI.h"
    25 #include "UIGlobalSettingsNetworkDetails.gen.h"
     25#include "UIGlobalSettingsNetworkDetailsHost.gen.h"
    2626
    2727/* Forward decalrations: */
    28 class UIHostInterfaceItem;
     28class UIDataNetworkHost;
    2929
    3030/* Global settings / Network page / Details sub-dialog: */
    31 class UIGlobalSettingsNetworkDetails : public QIWithRetranslateUI2<QIDialog>, public Ui::UIGlobalSettingsNetworkDetails
     31class UIGlobalSettingsNetworkDetailsHost : public QIWithRetranslateUI2<QIDialog>, public Ui::UIGlobalSettingsNetworkDetailsHost
    3232{
    3333    Q_OBJECT;
     
    3636
    3737    /* Constructor: */
    38     UIGlobalSettingsNetworkDetails(QWidget *pParent);
    39 
    40     /* Get/return data to/from details sub-dialog: */
    41     void getFromItem(UIHostInterfaceItem *aItem);
    42     void putBackToItem();
     38    UIGlobalSettingsNetworkDetailsHost(QWidget *pParent, UIDataNetworkHost &data);
    4339
    4440protected:
    4541
    46     /* Validation stuff: */
     42    /* Handler: Translation stuff: */
    4743    void retranslateUi();
    4844
    4945private slots:
    5046
    51     /* Various helper slots: */
    52     void sltDhcpClientStatusChanged();
    53     void sltDhcpServerStatusChanged();
     47    /* Handlers: [Re]load stuff: */
     48    void sltDhcpClientStatusChanged() { loadClientStuff(); }
     49    void sltDhcpServerStatusChanged() { loadServerStuff(); }
     50
     51    /* Handler: Dialog stuff: */
     52    void accept();
    5453
    5554private:
    5655
    57     UIHostInterfaceItem *m_pItem;
     56    /* Helpers: Load/Save stuff: */
     57    void load();
     58    void loadClientStuff();
     59    void loadServerStuff();
     60    void save();
     61
     62    /* Variable: External data reference: */
     63    UIDataNetworkHost &m_data;
    5864};
    5965
    60 #endif // __UIGlobalSettingsNetworkDetails_h__
    61 
     66#endif /* __UIGlobalSettingsNetworkDetailsHost_h__ */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui

    r48400 r48458  
    1313 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1414 </comment>
    15  <class>UIGlobalSettingsNetworkDetails</class>
    16  <widget class="QWidget" name="UIGlobalSettingsNetworkDetails">
     15 <class>UIGlobalSettingsNetworkDetailsHost</class>
     16 <widget class="QWidget" name="UIGlobalSettingsNetworkDetailsHost">
    1717  <property name="geometry">
    1818   <rect>
     
    342342   <sender>m_pButtonBox</sender>
    343343   <signal>accepted()</signal>
    344    <receiver>UIGlobalSettingsNetworkDetails</receiver>
     344   <receiver>UIGlobalSettingsNetworkDetailsHost</receiver>
    345345   <slot>accept()</slot>
    346346   <hints>
     
    358358   <sender>m_pButtonBox</sender>
    359359   <signal>rejected()</signal>
    360    <receiver>UIGlobalSettingsNetworkDetails</receiver>
     360   <receiver>UIGlobalSettingsNetworkDetailsHost</receiver>
    361361   <slot>reject()</slot>
    362362   <hints>
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.cpp

    r48400 r48458  
    33 *
    44 * VBox frontends: Qt4 GUI ("VirtualBox"):
    5  * UIGlobalSettingsNetworkDetails class implementation
     5 * UIGlobalSettingsNetworkDetailsNAT class implementation
    66 */
    77
    88/*
    9  * Copyright (C) 2009-2010 Oracle Corporation
     9 * Copyright (C) 2009-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818 */
    1919
    20 /* Global includes */
    21 #include <QHostAddress>
     20/* Qt includes: */
    2221#include <QRegExpValidator>
    2322
    24 /* Local includes */
     23/* GUI includes: */
    2524#include "UIGlobalSettingsNetwork.h"
    26 #include "UIGlobalSettingsNetworkDetails.h"
     25#include "UIGlobalSettingsNetworkDetailsNAT.h"
    2726
    28 /* Network page details constructor: */
    29 UIGlobalSettingsNetworkDetails::UIGlobalSettingsNetworkDetails(QWidget *pParent)
    30     : QIWithRetranslateUI2<QIDialog>(pParent
    31 #ifdef Q_WS_MAC
    32     ,Qt::Sheet
    33 #endif /* Q_WS_MAC */
    34     )
    35     , m_pItem(0)
     27UIGlobalSettingsNetworkDetailsNAT::UIGlobalSettingsNetworkDetailsNAT(QWidget *pParent, UIDataNetworkNAT &data)
     28    : QIWithRetranslateUI2<QIDialog>(pParent)
     29    , m_data(data)
    3630{
    3731    /* Apply UI decorations: */
    38     Ui::UIGlobalSettingsNetworkDetails::setupUi(this);
     32    Ui::UIGlobalSettingsNetworkDetailsNAT::setupUi(this);
    3933
    4034    /* Setup dialog: */
     
    4236
    4337    /* Setup validators: */
    44     QString strTemplateIPv4("([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\."
    45                             "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\."
    46                             "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\."
    47                             "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])");
    48     QString strTemplateIPv6("[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
    49                             "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
    50                             "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
    51                             "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}");
    52 
    53     m_pIPv4Editor->setValidator(new QRegExpValidator(QRegExp(strTemplateIPv4), this));
    54     m_pNMv4Editor->setValidator(new QRegExpValidator(QRegExp(strTemplateIPv4), this));
    55     m_pIPv6Editor->setValidator(new QRegExpValidator(QRegExp(strTemplateIPv6), this));
    56     m_pNMv6Editor->setValidator(new QRegExpValidator(QRegExp("[1-9][0-9]|1[0-1][0-9]|12[0-8]"), this));
    57     m_pDhcpAddressEditor->setValidator(new QRegExpValidator(QRegExp(strTemplateIPv4), this));
    58     m_pDhcpMaskEditor->setValidator(new QRegExpValidator(QRegExp(strTemplateIPv4), this));
    59     m_pDhcpLowerAddressEditor->setValidator(new QRegExpValidator(QRegExp(strTemplateIPv4), this));
    60     m_pDhcpUpperAddressEditor->setValidator(new QRegExpValidator(QRegExp(strTemplateIPv4), this));
    61 
    62     /* Setup widgets */
    63     m_pIPv6Editor->setFixedWidthByText(QString().fill('X', 32) + QString().fill(':', 7));
    64 
    65 #if 0 /* defined (Q_WS_WIN) */
    66     QStyleOption options1;
    67     options1.initFrom(m_pEnableManualCheckbox);
    68     QGridLayout *playout1 = qobject_cast<QGridLayout*>(m_pDetailsTabWidget->widget(0)->layout());
    69     int iWid1 = m_pEnableManualCheckbox->style()->pixelMetric(QStyle::PM_IndicatorWidth, &options1, m_pEnableManualCheckbox) +
    70                 m_pEnableManualCheckbox->style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, &options1, m_pEnableManualCheckbox) -
    71                 playout1->spacing() - 1;
    72     QSpacerItem *spacer1 = new QSpacerItem(iWid1, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    73     playout1->addItem(spacer1, 1, 0, 4);
    74 #else
    75     m_pEnableManualCheckbox->setVisible(false);
    76 #endif
    77 
    78     QStyleOption options2;
    79     options2.initFrom(m_pEnabledDhcpServerCheckbox);
    80     QGridLayout *pLayout2 = qobject_cast<QGridLayout*>(m_pDetailsTabWidget->widget(1)->layout());
    81     int wid2 = m_pEnabledDhcpServerCheckbox->style()->pixelMetric(QStyle::PM_IndicatorWidth, &options2, m_pEnabledDhcpServerCheckbox) +
    82                m_pEnabledDhcpServerCheckbox->style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, &options2, m_pEnabledDhcpServerCheckbox) -
    83                pLayout2->spacing() - 1;
    84     QSpacerItem *pSpacer2 = new QSpacerItem(wid2, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    85     pLayout2->addItem(pSpacer2, 1, 0, 4);
    86 
    87     /* Setup connections: */
    88     connect(m_pEnableManualCheckbox, SIGNAL(stateChanged(int)), this, SLOT (sltDhcpClientStatusChanged()));
    89     connect(m_pEnabledDhcpServerCheckbox, SIGNAL(stateChanged (int)), this, SLOT(sltDhcpServerStatusChanged()));
     38    const QString strTemplateName("\\S+");
     39    const QString strTemplateCIDRPrefix1("([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])");
     40    const QString strTemplateCIDRPrefix2("([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])");
     41    const QString strTemplateCIDRPostfix("([1-9]|1[0-9]|2[0-9]|3[0-2])");
     42    const QString strTemplateCIDR("%1(\\.%2(\\.%2(\\.%2)?)?)?/%3");
     43    const QString strTemplateCIDRFull = strTemplateCIDR.arg(strTemplateCIDRPrefix1, strTemplateCIDRPrefix2, strTemplateCIDRPostfix);
     44    m_pEditorNetworkName->setValidator(new QRegExpValidator(QRegExp(strTemplateName), this));
     45    m_pEditorNetworkCIDR->setValidator(new QRegExpValidator(QRegExp(strTemplateCIDRFull), this));
    9046
    9147    /* Apply language settings: */
    9248    retranslateUi();
    9349
     50    /* Load: */
     51    load();
     52
    9453    /* Fix minimum possible size: */
    9554    resize(minimumSizeHint());
    96     qApp->processEvents();
    9755    setFixedSize(minimumSizeHint());
    9856}
    9957
    100 /* Get data to details sub-dialog: */
    101 void UIGlobalSettingsNetworkDetails::getFromItem(UIHostInterfaceItem *pItem)
     58void UIGlobalSettingsNetworkDetailsNAT::retranslateUi()
    10259{
    103     m_pItem = pItem;
    104 
    105     /* Host-only Interface: */
    106     m_pEnableManualCheckbox->setChecked(!m_pItem->isDhcpClientEnabled());
    107 #if !0 /* !defined (Q_WS_WIN) */
    108     /* Disable automatic for all hosts for now: */
    109     m_pEnableManualCheckbox->setChecked(true);
    110     m_pEnableManualCheckbox->setEnabled(false);
    111 #endif
    112     sltDhcpClientStatusChanged();
    113 
    114     /* DHCP Server: */
    115     m_pEnabledDhcpServerCheckbox->setChecked(m_pItem->isDhcpServerEnabled());
    116     sltDhcpServerStatusChanged();
     60    /* Translate uic generated strings: */
     61    Ui::UIGlobalSettingsNetworkDetailsNAT::retranslateUi(this);
    11762}
    11863
    119 /* Return data from details sub-dialog: */
    120 void UIGlobalSettingsNetworkDetails::putBackToItem()
     64void UIGlobalSettingsNetworkDetailsNAT::polishEvent(QShowEvent*)
    12165{
    122     /* Host-only Interface: */
    123     m_pItem->setDhcpClientEnabled(!m_pEnableManualCheckbox->isChecked());
    124     if (m_pEnableManualCheckbox->isChecked())
    125     {
    126         m_pItem->setInterfaceAddress(m_pIPv4Editor->text());
    127         m_pItem->setInterfaceMask(m_pNMv4Editor->text());
    128         if (m_pItem->isIpv6Supported())
    129         {
    130             m_pItem->setInterfaceAddress6(m_pIPv6Editor->text());
    131             m_pItem->setInterfaceMaskLength6(m_pNMv6Editor->text());
    132         }
    133     }
    134 
    135     /* DHCP Server: */
    136     m_pItem->setDhcpServerEnabled(m_pEnabledDhcpServerCheckbox->isChecked());
    137     if (m_pEnabledDhcpServerCheckbox->isChecked())
    138     {
    139         m_pItem->setDhcpServerAddress(m_pDhcpAddressEditor->text());
    140         m_pItem->setDhcpServerMask(m_pDhcpMaskEditor->text());
    141         m_pItem->setDhcpLowerAddress(m_pDhcpLowerAddressEditor->text());
    142         m_pItem->setDhcpUpperAddress(m_pDhcpUpperAddressEditor->text());
    143     }
     66    /* Update availability: */
     67    m_pCheckboxAdvertiseDefaultIPv6Route->setEnabled(m_pCheckboxSupportsIPv6->isChecked());
     68    m_pContainerOptions->setEnabled(m_pCheckboxNetwork->isChecked());
    14469}
    14570
    146 /* Validation stuff: */
    147 void UIGlobalSettingsNetworkDetails::retranslateUi()
     71void UIGlobalSettingsNetworkDetailsNAT::accept()
    14872{
    149     /* Translate uic generated strings: */
    150     Ui::UIGlobalSettingsNetworkDetails::retranslateUi(this);
     73    /* Save before accept: */
     74    save();
     75    /* Call to base-class: */
     76    QIDialog::accept();
    15177}
    15278
    153 /* Handler for DHCP client settings change: */
    154 void UIGlobalSettingsNetworkDetails::sltDhcpClientStatusChanged()
     79void UIGlobalSettingsNetworkDetailsNAT::load()
    15580{
    156     bool fIsManual = m_pEnableManualCheckbox->isChecked();
    157     bool fIsIpv6Supported = fIsManual && m_pItem->isIpv6Supported();
    158 
    159     m_pIPv4Editor->clear();
    160     m_pNMv4Editor->clear();
    161     m_pIPv6Editor->clear();
    162     m_pNMv6Editor->clear();
    163 
    164     m_pIPv4Label->setEnabled(fIsManual);
    165     m_pNMv4Label->setEnabled(fIsManual);
    166     m_pIPv4Editor->setEnabled(fIsManual);
    167     m_pNMv4Editor->setEnabled(fIsManual);
    168     m_pIPv6Label->setEnabled(fIsIpv6Supported);
    169     m_pNMv6Label->setEnabled(fIsIpv6Supported);
    170     m_pIPv6Editor->setEnabled(fIsIpv6Supported);
    171     m_pNMv6Editor->setEnabled(fIsIpv6Supported);
    172 
    173     if (fIsManual)
    174     {
    175         m_pIPv4Editor->setText(m_pItem->interfaceAddress());
    176         m_pNMv4Editor->setText(m_pItem->interfaceMask());
    177         if (fIsIpv6Supported)
    178         {
    179             m_pIPv6Editor->setText(m_pItem->interfaceAddress6());
    180             m_pNMv6Editor->setText(m_pItem->interfaceMaskLength6());
    181         }
    182     }
     81    /* NAT Network: */
     82    m_pCheckboxNetwork->setChecked(m_data.m_fEnabled);
     83    m_pEditorNetworkName->setText(m_data.m_strNewName);
     84    m_pEditorNetworkCIDR->setText(m_data.m_strCIDR);
     85    m_pCheckboxSupportsDHCP->setChecked(m_data.m_fSupportsDHCP);
     86    m_pCheckboxSupportsIPv6->setChecked(m_data.m_fSupportsIPv6);
     87    m_pCheckboxAdvertiseDefaultIPv6Route->setChecked(m_data.m_fAdvertiseDefaultIPv6Route);
    18388}
    18489
    185 /* Handler for DHCP server settings change: */
    186 void UIGlobalSettingsNetworkDetails::sltDhcpServerStatusChanged()
     90void UIGlobalSettingsNetworkDetailsNAT::save()
    18791{
    188     bool fIsManual = m_pEnabledDhcpServerCheckbox->isChecked();
    189 
    190     m_pDhcpAddressEditor->clear();
    191     m_pDhcpMaskEditor->clear();
    192     m_pDhcpLowerAddressEditor->clear();
    193     m_pDhcpUpperAddressEditor->clear();
    194 
    195     m_pDhcpAddressLabel->setEnabled(fIsManual);
    196     m_pDhcpMaskLabel->setEnabled(fIsManual);
    197     m_pDhcpLowerAddressLabel->setEnabled(fIsManual);
    198     m_pDhcpUpperAddressLabel->setEnabled(fIsManual);
    199     m_pDhcpAddressEditor->setEnabled(fIsManual);
    200     m_pDhcpMaskEditor->setEnabled(fIsManual);
    201     m_pDhcpLowerAddressEditor->setEnabled(fIsManual);
    202     m_pDhcpUpperAddressEditor->setEnabled(fIsManual);
    203 
    204     if (fIsManual)
    205     {
    206         m_pDhcpAddressEditor->setText(m_pItem->dhcpServerAddress());
    207         m_pDhcpMaskEditor->setText(m_pItem->dhcpServerMask());
    208         m_pDhcpLowerAddressEditor->setText(m_pItem->dhcpLowerAddress());
    209         m_pDhcpUpperAddressEditor->setText(m_pItem->dhcpUpperAddress());
    210     }
     92    /* NAT Network: */
     93    m_data.m_fEnabled = m_pCheckboxNetwork->isChecked();
     94    m_data.m_strNewName = m_pEditorNetworkName->text();
     95    m_data.m_strCIDR = m_pEditorNetworkCIDR->text();
     96    m_data.m_fSupportsDHCP = m_pCheckboxSupportsDHCP->isChecked();
     97    m_data.m_fSupportsIPv6 = m_pCheckboxSupportsIPv6->isChecked();
     98    m_data.m_fAdvertiseDefaultIPv6Route = m_pCheckboxAdvertiseDefaultIPv6Route->isChecked();
    21199}
    212100
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h

    r48400 r48458  
    22 *
    33 * VBox frontends: Qt4 GUI ("VirtualBox"):
    4  * UIGlobalSettingsNetworkDetails class declaration
     4 * UIGlobalSettingsNetworkDetailsNAT class declaration
    55 */
    66
    77/*
    8  * Copyright (C) 2009-2010 Oracle Corporation
     8 * Copyright (C) 2009-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1717 */
    1818
    19 #ifndef __UIGlobalSettingsNetworkDetails_h__
    20 #define __UIGlobalSettingsNetworkDetails_h__
     19#ifndef __UIGlobalSettingsNetworkDetailsNAT_h__
     20#define __UIGlobalSettingsNetworkDetailsNAT_h__
    2121
    2222/* Local includes */
    2323#include "QIDialog.h"
    2424#include "QIWithRetranslateUI.h"
    25 #include "UIGlobalSettingsNetworkDetails.gen.h"
     25#include "UIGlobalSettingsNetworkDetailsNAT.gen.h"
    2626
    2727/* Forward decalrations: */
    28 class UIHostInterfaceItem;
     28struct UIDataNetworkNAT;
    2929
    3030/* Global settings / Network page / Details sub-dialog: */
    31 class UIGlobalSettingsNetworkDetails : public QIWithRetranslateUI2<QIDialog>, public Ui::UIGlobalSettingsNetworkDetails
     31class UIGlobalSettingsNetworkDetailsNAT : public QIWithRetranslateUI2<QIDialog>, public Ui::UIGlobalSettingsNetworkDetailsNAT
    3232{
    3333    Q_OBJECT;
     
    3636
    3737    /* Constructor: */
    38     UIGlobalSettingsNetworkDetails(QWidget *pParent);
    39 
    40     /* Get/return data to/from details sub-dialog: */
    41     void getFromItem(UIHostInterfaceItem *aItem);
    42     void putBackToItem();
     38    UIGlobalSettingsNetworkDetailsNAT(QWidget *pParent, UIDataNetworkNAT &data);
    4339
    4440protected:
    4541
    46     /* Validation stuff: */
     42    /* Handler: Translation stuff: */
    4743    void retranslateUi();
     44
     45    /* Handler: Polish event: */
     46    void polishEvent(QShowEvent *pEvent);
    4847
    4948private slots:
    5049
    51     /* Various helper slots: */
    52     void sltDhcpClientStatusChanged();
    53     void sltDhcpServerStatusChanged();
     50    /* Handler: Dialog stuff: */
     51    void accept();
    5452
    5553private:
    5654
    57     UIHostInterfaceItem *m_pItem;
     55    /* Helpers: Load/Save stuff: */
     56    void load();
     57    void save();
     58
     59    /* Variable: External data reference: */
     60    UIDataNetworkNAT &m_data;
    5861};
    5962
    60 #endif // __UIGlobalSettingsNetworkDetails_h__
    61 
     63#endif /* __UIGlobalSettingsNetworkDetailsNAT_h__ */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui

    r48400 r48458  
    33 VBox frontends: Qt4 GUI ("VirtualBox"):
    44
    5  Copyright (C) 2009-2012 Oracle Corporation
     5 Copyright (C) 2009-2013 Oracle Corporation
    66
    77 This file is part of VirtualBox Open Source Edition (OSE), as
     
    1313 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1414 </comment>
    15  <class>UIGlobalSettingsNetworkDetails</class>
    16  <widget class="QWidget" name="UIGlobalSettingsNetworkDetails">
    17   <property name="geometry">
    18    <rect>
    19     <x>0</x>
    20     <y>0</y>
    21     <width>402</width>
    22     <height>255</height>
    23    </rect>
     15 <class>UIGlobalSettingsNetworkDetailsNAT</class>
     16 <widget class="QWidget" name="UIGlobalSettingsNetworkDetailsNAT">
     17  <property name="windowTitle">
     18   <string>NAT Network Details</string>
    2419  </property>
    25   <property name="windowTitle">
    26    <string>Host-only Network Details</string>
    27   </property>
    28   <layout class="QVBoxLayout">
    29    <item>
    30     <widget class="QITabWidget" name="m_pDetailsTabWidget">
    31      <property name="sizePolicy">
    32       <sizepolicy vsizetype="Expanding" hsizetype="Preferred">
    33        <horstretch>0</horstretch>
    34        <verstretch>0</verstretch>
    35       </sizepolicy>
     20  <layout class="QGridLayout">
     21   <item row="0" column="0">
     22    <widget class="QCheckBox" name="m_pCheckboxNetwork">
     23     <property name="text">
     24      <string>Network &amp;Enabled</string>
    3625     </property>
    37      <property name="currentIndex">
    38       <number>0</number>
     26     <property name="toolTip">
     27      <string>Enable this NAT network.</string>
    3928     </property>
    40      <widget class="QWidget" name="m_pInterfaceTab">
    41       <attribute name="title">
    42        <string>&amp;Adapter</string>
    43       </attribute>
    44       <layout class="QGridLayout">
    45        <item row="0" column="0" colspan="3">
    46         <widget class="QCheckBox" name="m_pEnableManualCheckbox">
    47          <property name="text">
    48           <string>Manual &amp;Configuration</string>
    49          </property>
    50          <property name="checked">
    51           <bool>true</bool>
    52          </property>
    53          <property name="toolTip">
    54           <string>Use manual configuration for this host-only network adapter.</string>
    55          </property>
    56         </widget>
    57        </item>
    58        <item row="1" column="1">
    59         <widget class="QLabel" name="m_pIPv4Label">
    60          <property name="text">
    61           <string>&amp;IPv4 Address:</string>
    62          </property>
    63          <property name="alignment">
    64           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    65          </property>
    66          <property name="buddy">
    67           <cstring>m_pIPv4Editor</cstring>
    68          </property>
    69         </widget>
    70        </item>
    71        <item row="1" column="2">
    72         <widget class="QILineEdit" name="m_pIPv4Editor">
    73          <property name="sizePolicy">
    74           <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
    75            <horstretch>0</horstretch>
    76            <verstretch>0</verstretch>
    77           </sizepolicy>
    78          </property>
    79          <property name="toolTip">
    80           <string>Displays the host IPv4 address for this adapter.</string>
    81          </property>
    82         </widget>
    83        </item>
    84        <item row="2" column="1">
    85         <widget class="QLabel" name="m_pNMv4Label">
    86          <property name="text">
    87           <string>IPv4 Network &amp;Mask:</string>
    88          </property>
    89          <property name="alignment">
    90           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    91          </property>
    92          <property name="buddy">
    93           <cstring>m_pNMv4Editor</cstring>
    94          </property>
    95         </widget>
    96        </item>
    97        <item row="2" column="2">
    98         <widget class="QILineEdit" name="m_pNMv4Editor">
    99          <property name="sizePolicy">
    100           <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
    101            <horstretch>0</horstretch>
    102            <verstretch>0</verstretch>
    103           </sizepolicy>
    104          </property>
    105          <property name="toolTip">
    106           <string>Displays the host IPv4 network mask for this adapter.</string>
    107          </property>
    108         </widget>
    109        </item>
    110        <item row="3" column="1">
    111         <widget class="QLabel" name="m_pIPv6Label">
    112          <property name="text">
    113           <string>I&amp;Pv6 Address:</string>
    114          </property>
    115          <property name="alignment">
    116           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    117          </property>
    118          <property name="buddy">
    119           <cstring>m_pIPv6Editor</cstring>
    120          </property>
    121         </widget>
    122        </item>
    123        <item row="3" column="2">
    124         <widget class="QILineEdit" name="m_pIPv6Editor">
    125          <property name="sizePolicy">
    126           <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
    127            <horstretch>0</horstretch>
    128            <verstretch>0</verstretch>
    129           </sizepolicy>
    130          </property>
    131          <property name="toolTip">
    132           <string>Displays the host IPv6 address for this adapter if IPv6 is supported.</string>
    133          </property>
    134         </widget>
    135        </item>
    136        <item row="4" column="1">
    137         <widget class="QLabel" name="m_pNMv6Label">
    138          <property name="text">
    139           <string>IPv6 Network Mask &amp;Length:</string>
    140          </property>
    141          <property name="alignment">
    142           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    143          </property>
    144          <property name="buddy">
    145           <cstring>m_pNMv6Editor</cstring>
    146          </property>
    147         </widget>
    148        </item>
    149        <item row="4" column="2">
    150         <widget class="QILineEdit" name="m_pNMv6Editor">
    151          <property name="sizePolicy">
    152           <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
    153            <horstretch>0</horstretch>
    154            <verstretch>0</verstretch>
    155           </sizepolicy>
    156          </property>
    157          <property name="toolTip">
    158           <string>Displays the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</string>
    159          </property>
    160         </widget>
    161        </item>
    162        <item row="5" column="0" colspan="3">
    163         <spacer name="verticalSpacer1">
    164          <property name="orientation">
    165           <enum>Qt::Vertical</enum>
    166          </property>
    167          <property name="sizeHint" stdset="0">
    168           <size>
    169            <width>0</width>
    170            <height>0</height>
    171           </size>
    172          </property>
    173         </spacer>
    174        </item>
    175       </layout>
    176      </widget>
    177      <widget class="QWidget" name="m_pDhcpServerTab">
    178       <attribute name="title">
    179        <string>&amp;DHCP Server</string>
    180       </attribute>
    181       <layout class="QGridLayout">
    182        <item row="0" column="0" colspan="3">
    183         <widget class="QCheckBox" name="m_pEnabledDhcpServerCheckbox">
    184          <property name="text">
    185           <string>&amp;Enable Server</string>
    186          </property>
    187          <property name="toolTip">
    188           <string>Indicates whether the DHCP Server is enabled on machine startup or not.</string>
    189          </property>
    190         </widget>
    191        </item>
    192        <item row="1" column="1">
    193         <widget class="QLabel" name="m_pDhcpAddressLabel">
    194          <property name="text">
    195           <string>Server Add&amp;ress:</string>
    196          </property>
    197          <property name="alignment">
    198           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    199          </property>
    200          <property name="buddy">
    201           <cstring>m_pDhcpAddressEditor</cstring>
    202          </property>
    203         </widget>
    204        </item>
    205        <item row="1" column="2">
    206         <widget class="QILineEdit" name="m_pDhcpAddressEditor">
    207          <property name="sizePolicy">
    208           <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
    209            <horstretch>0</horstretch>
    210            <verstretch>0</verstretch>
    211           </sizepolicy>
    212          </property>
    213          <property name="toolTip">
    214           <string>Displays the address of the DHCP server servicing the network associated with this host-only adapter.</string>
    215          </property>
    216         </widget>
    217        </item>
    218        <item row="2" column="1">
    219         <widget class="QLabel" name="m_pDhcpMaskLabel">
    220          <property name="text">
    221           <string>Server &amp;Mask:</string>
    222          </property>
    223          <property name="alignment">
    224           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    225          </property>
    226          <property name="buddy">
    227           <cstring>m_pDhcpMaskEditor</cstring>
    228          </property>
    229         </widget>
    230        </item>
    231        <item row="2" column="2">
    232         <widget class="QILineEdit" name="m_pDhcpMaskEditor">
    233          <property name="sizePolicy">
    234           <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
    235            <horstretch>0</horstretch>
    236            <verstretch>0</verstretch>
    237           </sizepolicy>
    238          </property>
    239          <property name="toolTip">
    240           <string>Displays the network mask of the DHCP server servicing the network associated with this host-only adapter.</string>
    241          </property>
    242         </widget>
    243        </item>
    244        <item row="3" column="1">
    245         <widget class="QLabel" name="m_pDhcpLowerAddressLabel">
    246          <property name="text">
    247           <string>&amp;Lower Address Bound:</string>
    248          </property>
    249          <property name="alignment">
    250           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    251          </property>
    252          <property name="buddy">
    253           <cstring>m_pDhcpLowerAddressEditor</cstring>
    254          </property>
    255         </widget>
    256        </item>
    257        <item row="3" column="2">
    258         <widget class="QILineEdit" name="m_pDhcpLowerAddressEditor">
    259          <property name="sizePolicy">
    260           <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
    261            <horstretch>0</horstretch>
    262            <verstretch>0</verstretch>
    263           </sizepolicy>
    264          </property>
    265          <property name="toolTip">
    266           <string>Displays the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</string>
    267          </property>
    268         </widget>
    269        </item>
    270        <item row="4" column="1">
    271         <widget class="QLabel" name="m_pDhcpUpperAddressLabel">
    272          <property name="text">
    273           <string>&amp;Upper Address Bound:</string>
    274          </property>
    275          <property name="alignment">
    276           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    277          </property>
    278          <property name="buddy">
    279           <cstring>m_pDhcpUpperAddressEditor</cstring>
    280          </property>
    281         </widget>
    282        </item>
    283        <item row="4" column="2">
    284         <widget class="QILineEdit" name="m_pDhcpUpperAddressEditor">
    285          <property name="sizePolicy">
    286           <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
    287            <horstretch>0</horstretch>
    288            <verstretch>0</verstretch>
    289           </sizepolicy>
    290          </property>
    291          <property name="toolTip">
    292           <string>Displays the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</string>
    293          </property>
    294         </widget>
    295        </item>
    296        <item row="5" column="0" colspan="3">
    297         <spacer name="verticalSpacer2">
    298          <property name="orientation">
    299           <enum>Qt::Vertical</enum>
    300          </property>
    301          <property name="sizeHint" stdset="0">
    302           <size>
    303            <width>0</width>
    304            <height>0</height>
    305           </size>
    306          </property>
    307         </spacer>
    308        </item>
    309       </layout>
    310      </widget>
    31129    </widget>
    31230   </item>
    313    <item>
     31   <item row="1" column="0" colspan="2">
     32    <widget class="QWidget" name="m_pContainerOptions">
     33     <layout class="QGridLayout">
     34      <item row="0" column="0" rowspan="3">
     35       <spacer>
     36        <property name="orientation">
     37         <enum>Qt::Horizontal</enum>
     38        </property>
     39        <property name="sizeType">
     40         <enum>QSizePolicy::Fixed</enum>
     41        </property>
     42        <property name="sizeHint" stdset="0">
     43         <size>
     44          <width>20</width>
     45          <height>0</height>
     46         </size>
     47        </property>
     48       </spacer>
     49      </item>
     50      <item row="0" column="1">
     51       <widget class="QLabel" name="m_pLabelNetworkName">
     52        <property name="text">
     53         <string>Network &amp;Name:</string>
     54        </property>
     55        <property name="alignment">
     56         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     57        </property>
     58        <property name="buddy">
     59         <cstring>m_pEditorNetworkName</cstring>
     60        </property>
     61       </widget>
     62      </item>
     63      <item row="0" column="2" colspan="2">
     64       <widget class="QLineEdit" name="m_pEditorNetworkName">
     65        <property name="toolTip">
     66         <string>Displays the name for this network.</string>
     67        </property>
     68       </widget>
     69      </item>
     70      <item row="1" column="1">
     71       <widget class="QLabel" name="m_pLabelNetworkCIDR">
     72        <property name="text">
     73         <string>Network &amp;CIDR:</string>
     74        </property>
     75        <property name="alignment">
     76         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     77        </property>
     78        <property name="buddy">
     79         <cstring>m_pEditorNetworkCIDR</cstring>
     80        </property>
     81       </widget>
     82      </item>
     83      <item row="1" column="2" colspan="2">
     84       <widget class="QLineEdit" name="m_pEditorNetworkCIDR">
     85        <property name="toolTip">
     86         <string>Displays the CIDR for this network.</string>
     87        </property>
     88       </widget>
     89      </item>
     90      <item row="2" column="1">
     91       <widget class="QLabel" name="m_pLabelOptionsAdvanced">
     92        <property name="alignment">
     93         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignTop</set>
     94        </property>
     95        <property name="text">
     96         <string>Network Options:</string>
     97        </property>
     98       </widget>
     99      </item>
     100      <item row="2" column="2">
     101       <widget class="QCheckBox" name="m_pCheckboxSupportsDHCP">
     102        <property name="text">
     103         <string>Supports &amp;DHCP</string>
     104        </property>
     105        <property name="toolTip">
     106         <string>Determines whether this network supports DHCP.</string>
     107        </property>
     108       </widget>
     109      </item>
     110      <item row="3" column="2">
     111       <widget class="QCheckBox" name="m_pCheckboxSupportsIPv6">
     112        <property name="text">
     113         <string>Supports &amp;IPv6</string>
     114        </property>
     115        <property name="toolTip">
     116         <string>Determines whether this network supports IPv6.</string>
     117        </property>
     118       </widget>
     119      </item>
     120      <item row="4" column="2">
     121       <widget class="QCheckBox" name="m_pCheckboxAdvertiseDefaultIPv6Route">
     122        <property name="text">
     123         <string>Advertise Default IPv6 &amp;Route</string>
     124        </property>
     125        <property name="toolTip">
     126         <string>Determines whether default IPv6 route should be advertised for this network.</string>
     127        </property>
     128       </widget>
     129      </item>
     130     </layout>
     131    </widget>
     132   </item>
     133   <item row="2" column="0" colspan="2">
     134    <spacer>
     135     <property name="orientation">
     136      <enum>Qt::Vertical</enum>
     137     </property>
     138     <property name="sizeHint" stdset="0">
     139      <size>
     140       <width>0</width>
     141       <height>0</height>
     142      </size>
     143     </property>
     144    </spacer>
     145   </item>
     146   <item row="3" column="0" colspan="2">
    314147    <widget class="QIDialogButtonBox" name="m_pButtonBox">
    315148     <property name="standardButtons">
     
    322155 <customwidgets>
    323156  <customwidget>
    324    <class>QILineEdit</class>
    325    <extends>QLineEdit</extends>
    326    <header>QILineEdit.h</header>
    327   </customwidget>
    328   <customwidget>
    329157   <class>QIDialogButtonBox</class>
    330158   <extends>QDialogButtonBox</extends>
    331159   <header>QIDialogButtonBox.h</header>
    332   </customwidget>
    333   <customwidget>
    334    <class>QITabWidget</class>
    335    <extends>QTabWidget</extends>
    336    <header>QITabWidget.h</header>
    337160  </customwidget>
    338161 </customwidgets>
     
    340163 <connections>
    341164  <connection>
     165   <sender>m_pCheckboxNetwork</sender>
     166   <signal>toggled(bool)</signal>
     167   <receiver>m_pContainerOptions</receiver>
     168   <slot>setEnabled(bool)</slot>
     169  </connection>
     170  <connection>
     171   <sender>m_pCheckboxSupportsIPv6</sender>
     172   <signal>toggled(bool)</signal>
     173   <receiver>m_pCheckboxAdvertiseDefaultIPv6Route</receiver>
     174   <slot>setEnabled(bool)</slot>
     175  </connection>
     176  <connection>
    342177   <sender>m_pButtonBox</sender>
    343178   <signal>accepted()</signal>
    344    <receiver>UIGlobalSettingsNetworkDetails</receiver>
     179   <receiver>UIGlobalSettingsNetworkDetailsNAT</receiver>
    345180   <slot>accept()</slot>
    346    <hints>
    347     <hint type="sourcelabel">
    348      <x>162</x>
    349      <y>339</y>
    350     </hint>
    351     <hint type="destinationlabel">
    352      <x>162</x>
    353      <y>179</y>
    354     </hint>
    355    </hints>
    356181  </connection>
    357182  <connection>
    358183   <sender>m_pButtonBox</sender>
    359184   <signal>rejected()</signal>
    360    <receiver>UIGlobalSettingsNetworkDetails</receiver>
     185   <receiver>UIGlobalSettingsNetworkDetailsNAT</receiver>
    361186   <slot>reject()</slot>
    362    <hints>
    363     <hint type="sourcelabel">
    364      <x>162</x>
    365      <y>339</y>
    366     </hint>
    367     <hint type="destinationlabel">
    368      <x>162</x>
    369      <y>179</y>
    370     </hint>
    371    </hints>
    372187  </connection>
    373188 </connections>
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