VirtualBox

Changeset 34162 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 18, 2010 12:04:47 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: Global settings / Network page refactoring.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/global
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp

    r33882 r34162  
    1818 */
    1919
     20/* Global includes */
     21#include <QHeaderView>
     22#include <QHostAddress>
     23
    2024/* Local includes */
    2125#include "QIWidgetValidator.h"
     
    2630#include "VBoxProblemReporter.h"
    2731
    28 /* Qt includes */
    29 #include <QHeaderView>
    30 #include <QHostAddress>
    31 
    32 NetworkItem::NetworkItem()
     32/* Host-network item constructor: */
     33UIHostInterfaceItem::UIHostInterfaceItem()
    3334    : QTreeWidgetItem()
    3435{
    3536}
    3637
    37 void NetworkItem::fetchNetworkData(const UIHostNetworkData &data)
     38/* Get data to item: */
     39void UIHostInterfaceItem::fetchNetworkData(const UIHostNetworkData &data)
    3840{
    3941    /* Fetch from cache: */
     
    4446}
    4547
    46 void NetworkItem::uploadNetworkData(UIHostNetworkData &data)
     48/* Return data from item: */
     49void UIHostInterfaceItem::uploadNetworkData(UIHostNetworkData &data)
    4750{
    4851    /* Upload to cache: */
     
    5053}
    5154
    52 bool NetworkItem::revalidate (QString &aWarning, QString & /* aTitle */)
    53 {
    54     /* Host-only Interface validation */
     55/* Validation stuff: */
     56bool UIHostInterfaceItem::revalidate(QString &strWarning, QString & /* strTitle */)
     57{
     58    /* Host-only interface validation: */
    5559    if (!m_data.m_interface.m_fDhcpClientEnabled)
    5660    {
    5761        if (m_data.m_interface.m_strInterfaceAddress.isEmpty() &&
    58             (QHostAddress (m_data.m_interface.m_strInterfaceAddress) == QHostAddress::Any ||
    59              QHostAddress (m_data.m_interface.m_strInterfaceAddress).protocol() != QAbstractSocket::IPv4Protocol))
    60         {
    61             aWarning = UIGlobalSettingsNetwork::tr ("host IPv4 address of <b>%1</b> is wrong").arg (text (0));
     62            (QHostAddress(m_data.m_interface.m_strInterfaceAddress) == QHostAddress::Any ||
     63             QHostAddress(m_data.m_interface.m_strInterfaceAddress).protocol() != QAbstractSocket::IPv4Protocol))
     64        {
     65            strWarning = UIGlobalSettingsNetwork::tr("host IPv4 address of <b>%1</b> is wrong").arg(text(0));
    6266            return false;
    6367        }
    6468        if (!m_data.m_interface.m_strInterfaceMask.isEmpty() &&
    65             (QHostAddress (m_data.m_interface.m_strInterfaceMask) == QHostAddress::Any ||
    66              QHostAddress (m_data.m_interface.m_strInterfaceMask).protocol() != QAbstractSocket::IPv4Protocol))
    67         {
    68             aWarning = UIGlobalSettingsNetwork::tr ("host IPv4 network mask of <b>%1</b> is wrong").arg (text (0));
     69            (QHostAddress(m_data.m_interface.m_strInterfaceMask) == QHostAddress::Any ||
     70             QHostAddress(m_data.m_interface.m_strInterfaceMask).protocol() != QAbstractSocket::IPv4Protocol))
     71        {
     72            strWarning = UIGlobalSettingsNetwork::tr("host IPv4 network mask of <b>%1</b> is wrong").arg(text(0));
    6973            return false;
    7074        }
     
    7276        {
    7377            if (!m_data.m_interface.m_strInterfaceAddress6.isEmpty() &&
    74                 (QHostAddress (m_data.m_interface.m_strInterfaceAddress6) == QHostAddress::AnyIPv6 ||
    75                  QHostAddress (m_data.m_interface.m_strInterfaceAddress6).protocol() != QAbstractSocket::IPv6Protocol))
     78                (QHostAddress(m_data.m_interface.m_strInterfaceAddress6) == QHostAddress::AnyIPv6 ||
     79                 QHostAddress(m_data.m_interface.m_strInterfaceAddress6).protocol() != QAbstractSocket::IPv6Protocol))
    7680            {
    77                 aWarning = UIGlobalSettingsNetwork::tr ("host IPv6 address of <b>%1</b> is wrong").arg (text (0));
     81                strWarning = UIGlobalSettingsNetwork::tr("host IPv6 address of <b>%1</b> is wrong").arg(text(0));
    7882                return false;
    7983            }
     
    8185    }
    8286
    83     /* DHCP Server settings */
     87    /* DHCP server validation: */
    8488    if (m_data.m_dhcpserver.m_fDhcpServerEnabled)
    8589    {
    86         if (QHostAddress (m_data.m_dhcpserver.m_strDhcpServerAddress) == QHostAddress::Any ||
    87             QHostAddress (m_data.m_dhcpserver.m_strDhcpServerAddress).protocol() != QAbstractSocket::IPv4Protocol)
    88         {
    89             aWarning = UIGlobalSettingsNetwork::tr ("DHCP server address of <b>%1</b> is wrong").arg (text (0));
     90        if (QHostAddress(m_data.m_dhcpserver.m_strDhcpServerAddress) == QHostAddress::Any ||
     91            QHostAddress(m_data.m_dhcpserver.m_strDhcpServerAddress).protocol() != QAbstractSocket::IPv4Protocol)
     92        {
     93            strWarning = UIGlobalSettingsNetwork::tr("DHCP server address of <b>%1</b> is wrong").arg(text(0));
    9094            return false;
    9195        }
    92         if (QHostAddress (m_data.m_dhcpserver.m_strDhcpServerMask) == QHostAddress::Any ||
    93             QHostAddress (m_data.m_dhcpserver.m_strDhcpServerMask).protocol() != QAbstractSocket::IPv4Protocol)
    94         {
    95             aWarning = UIGlobalSettingsNetwork::tr ("DHCP server network mask of <b>%1</b> is wrong").arg (text (0));
     96        if (QHostAddress(m_data.m_dhcpserver.m_strDhcpServerMask) == QHostAddress::Any ||
     97            QHostAddress(m_data.m_dhcpserver.m_strDhcpServerMask).protocol() != QAbstractSocket::IPv4Protocol)
     98        {
     99            strWarning = UIGlobalSettingsNetwork::tr("DHCP server network mask of <b>%1</b> is wrong").arg(text(0));
    96100            return false;
    97101        }
    98         if (QHostAddress (m_data.m_dhcpserver.m_strDhcpLowerAddress) == QHostAddress::Any ||
    99             QHostAddress (m_data.m_dhcpserver.m_strDhcpLowerAddress).protocol() != QAbstractSocket::IPv4Protocol)
    100         {
    101             aWarning = UIGlobalSettingsNetwork::tr ("DHCP lower address bound of <b>%1</b> is wrong").arg (text (0));
     102        if (QHostAddress(m_data.m_dhcpserver.m_strDhcpLowerAddress) == QHostAddress::Any ||
     103            QHostAddress(m_data.m_dhcpserver.m_strDhcpLowerAddress).protocol() != QAbstractSocket::IPv4Protocol)
     104        {
     105            strWarning = UIGlobalSettingsNetwork::tr("DHCP lower address bound of <b>%1</b> is wrong").arg(text(0));
    102106            return false;
    103107        }
    104         if (QHostAddress (m_data.m_dhcpserver.m_strDhcpUpperAddress) == QHostAddress::Any ||
    105             QHostAddress (m_data.m_dhcpserver.m_strDhcpUpperAddress).protocol() != QAbstractSocket::IPv4Protocol)
    106         {
    107             aWarning = UIGlobalSettingsNetwork::tr ("DHCP upper address bound of <b>%1</b> is wrong").arg (text (0));
     108        if (QHostAddress(m_data.m_dhcpserver.m_strDhcpUpperAddress) == QHostAddress::Any ||
     109            QHostAddress(m_data.m_dhcpserver.m_strDhcpUpperAddress).protocol() != QAbstractSocket::IPv4Protocol)
     110        {
     111            strWarning = UIGlobalSettingsNetwork::tr("DHCP upper address bound of <b>%1</b> is wrong").arg(text(0));
    108112            return false;
    109113        }
     
    112116}
    113117
    114 QString NetworkItem::updateInfo()
     118QString UIHostInterfaceItem::updateInfo()
    115119{
    116120    /* Update text: */
    117121    setText(0, m_data.m_interface.m_strName);
    118122
    119     /* Update information label */
    120     QString hdr ("<tr><td><nobr>%1:&nbsp;</nobr></td>"
    121                  "<td><nobr>%2</nobr></td></tr>");
    122     QString sub ("<tr><td><nobr>&nbsp;&nbsp;%1:&nbsp;</nobr></td>"
    123                  "<td><nobr>%2</nobr></td></tr>");
    124     QString data, tip, buffer;
    125 
    126     /* Host-only Interface information */
    127     buffer = hdr.arg (UIGlobalSettingsNetwork::tr ("Adapter"))
    128                 .arg (m_data.m_interface.m_fDhcpClientEnabled ? UIGlobalSettingsNetwork::tr ("Automatically configured", "interface")
    129                                                               : UIGlobalSettingsNetwork::tr ("Manually configured", "interface"));
    130     data += buffer;
    131     tip += buffer;
    132 
     123    /* Update information label: */
     124    QString strHeader("<tr><td><nobr>%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
     125    QString strSubHeader("<tr><td><nobr>&nbsp;&nbsp;%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>");
     126    QString strData, strToolTip, strBuffer;
     127
     128    /* Host-only interface information: */
     129    strBuffer = strHeader.arg(UIGlobalSettingsNetwork::tr("Adapter"))
     130                .arg(m_data.m_interface.m_fDhcpClientEnabled ? UIGlobalSettingsNetwork::tr("Automatically configured", "interface")
     131                                                             : UIGlobalSettingsNetwork::tr("Manually configured", "interface"));
     132    strData += strBuffer;
     133    strToolTip += strBuffer;
    133134    if (!m_data.m_interface.m_fDhcpClientEnabled)
    134135    {
    135         buffer = sub.arg (UIGlobalSettingsNetwork::tr ("IPv4 Address"))
    136                     .arg (m_data.m_interface.m_strInterfaceAddress.isEmpty() ? UIGlobalSettingsNetwork::tr ("Not set", "address")
    137                                                                              : m_data.m_interface.m_strInterfaceAddress) +
    138                  sub.arg (UIGlobalSettingsNetwork::tr ("IPv4 Network Mask"))
    139                     .arg (m_data.m_interface.m_strInterfaceMask.isEmpty() ? UIGlobalSettingsNetwork::tr ("Not set", "mask")
    140                                                                           : m_data.m_interface.m_strInterfaceMask);
    141         tip += buffer;
    142 
     136        strBuffer = strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv4 Address"))
     137                                .arg(m_data.m_interface.m_strInterfaceAddress.isEmpty() ?
     138                                     UIGlobalSettingsNetwork::tr ("Not set", "address") :
     139                                     m_data.m_interface.m_strInterfaceAddress) +
     140                    strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv4 Network Mask"))
     141                                .arg(m_data.m_interface.m_strInterfaceMask.isEmpty() ?
     142                                     UIGlobalSettingsNetwork::tr ("Not set", "mask") :
     143                                     m_data.m_interface.m_strInterfaceMask);
     144        strToolTip += strBuffer;
    143145        if (m_data.m_interface.m_fIpv6Supported)
    144146        {
    145             buffer = sub.arg (UIGlobalSettingsNetwork::tr ("IPv6 Address"))
    146                         .arg (m_data.m_interface.m_strInterfaceAddress6.isEmpty() ? UIGlobalSettingsNetwork::tr ("Not set", "address")
    147                                                                                   : m_data.m_interface.m_strInterfaceAddress6) +
    148                      sub.arg (UIGlobalSettingsNetwork::tr ("IPv6 Network Mask Length"))
    149                         .arg (m_data.m_interface.m_strInterfaceMaskLength6.isEmpty() ? UIGlobalSettingsNetwork::tr ("Not set", "length")
    150                                                               : m_data.m_interface.m_strInterfaceMaskLength6);
    151             tip += buffer;
    152         }
    153     }
    154 
    155     /* DHCP Server information */
    156     buffer = hdr.arg (UIGlobalSettingsNetwork::tr ("DHCP Server"))
    157                 .arg (m_data.m_dhcpserver.m_fDhcpServerEnabled ? UIGlobalSettingsNetwork::tr ("Enabled", "server")
    158                                                                : UIGlobalSettingsNetwork::tr ("Disabled", "server"));
    159     data += buffer;
    160     tip += buffer;
    161 
     147            strBuffer = strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv6 Address"))
     148                                    .arg(m_data.m_interface.m_strInterfaceAddress6.isEmpty() ?
     149                                         UIGlobalSettingsNetwork::tr("Not set", "address") :
     150                                         m_data.m_interface.m_strInterfaceAddress6) +
     151                        strSubHeader.arg(UIGlobalSettingsNetwork::tr("IPv6 Network Mask Length"))
     152                                    .arg(m_data.m_interface.m_strInterfaceMaskLength6.isEmpty() ?
     153                                         UIGlobalSettingsNetwork::tr("Not set", "length") :
     154                                         m_data.m_interface.m_strInterfaceMaskLength6);
     155            strToolTip += strBuffer;
     156        }
     157    }
     158
     159    /* DHCP server information: */
     160    strBuffer = strHeader.arg(UIGlobalSettingsNetwork::tr("DHCP Server"))
     161                         .arg(m_data.m_dhcpserver.m_fDhcpServerEnabled ?
     162                              UIGlobalSettingsNetwork::tr("Enabled", "server") :
     163                              UIGlobalSettingsNetwork::tr("Disabled", "server"));
     164    strData += strBuffer;
     165    strToolTip += strBuffer;
    162166    if (m_data.m_dhcpserver.m_fDhcpServerEnabled)
    163167    {
    164         buffer = sub.arg (UIGlobalSettingsNetwork::tr ("Address"))
    165                     .arg (m_data.m_dhcpserver.m_strDhcpServerAddress.isEmpty() ? UIGlobalSettingsNetwork::tr ("Not set", "address")
    166                                                                                : m_data.m_dhcpserver.m_strDhcpServerAddress) +
    167                  sub.arg (UIGlobalSettingsNetwork::tr ("Network Mask"))
    168                     .arg (m_data.m_dhcpserver.m_strDhcpServerMask.isEmpty() ? UIGlobalSettingsNetwork::tr ("Not set", "mask")
    169                                                                             : m_data.m_dhcpserver.m_strDhcpServerMask) +
    170                  sub.arg (UIGlobalSettingsNetwork::tr ("Lower Bound"))
    171                     .arg (m_data.m_dhcpserver.m_strDhcpLowerAddress.isEmpty() ? UIGlobalSettingsNetwork::tr ("Not set", "bound")
    172                                                                               : m_data.m_dhcpserver.m_strDhcpLowerAddress) +
    173                  sub.arg (UIGlobalSettingsNetwork::tr ("Upper Bound"))
    174                     .arg (m_data.m_dhcpserver.m_strDhcpUpperAddress.isEmpty() ? UIGlobalSettingsNetwork::tr ("Not set", "bound")
    175                                                                               : m_data.m_dhcpserver.m_strDhcpUpperAddress);
    176         tip += buffer;
    177     }
    178 
    179     setToolTip (0, tip);
    180 
    181     return QString ("<table>") + data + QString ("</table>");
    182 }
    183 
     168        strBuffer = strSubHeader.arg(UIGlobalSettingsNetwork::tr("Address"))
     169                                .arg(m_data.m_dhcpserver.m_strDhcpServerAddress.isEmpty() ?
     170                                     UIGlobalSettingsNetwork::tr("Not set", "address") :
     171                                     m_data.m_dhcpserver.m_strDhcpServerAddress) +
     172                    strSubHeader.arg(UIGlobalSettingsNetwork::tr("Network Mask"))
     173                                .arg(m_data.m_dhcpserver.m_strDhcpServerMask.isEmpty() ?
     174                                     UIGlobalSettingsNetwork::tr("Not set", "mask") :
     175                                     m_data.m_dhcpserver.m_strDhcpServerMask) +
     176                    strSubHeader.arg(UIGlobalSettingsNetwork::tr("Lower Bound"))
     177                                .arg(m_data.m_dhcpserver.m_strDhcpLowerAddress.isEmpty() ?
     178                                     UIGlobalSettingsNetwork::tr("Not set", "bound") :
     179                                     m_data.m_dhcpserver.m_strDhcpLowerAddress) +
     180                    strSubHeader.arg(UIGlobalSettingsNetwork::tr("Upper Bound"))
     181                                .arg(m_data.m_dhcpserver.m_strDhcpUpperAddress.isEmpty() ?
     182                                     UIGlobalSettingsNetwork::tr("Not set", "bound") :
     183                                     m_data.m_dhcpserver.m_strDhcpUpperAddress);
     184        strToolTip += strBuffer;
     185    }
     186
     187    setToolTip(0, strToolTip);
     188
     189    return QString("<table>") + strData + QString("</table>");
     190}
     191
     192/* Network page constructor: */
    184193UIGlobalSettingsNetwork::UIGlobalSettingsNetwork()
    185     : mValidator(0)
    186     , mAddInterface(0), mRemInterface(0), mEditInterface(0)
     194    : m_pValidator(0)
     195    , m_pAddAction(0), m_pDelAction(0), m_pEditAction(0)
    187196    , m_fChanged(false)
    188197{
    189     /* Apply UI decorations */
     198    /* Apply UI decorations: */
    190199    Ui::UIGlobalSettingsNetwork::setupUi (this);
    191200
    192201#ifdef Q_WS_MAC
    193     /* Make shifting spacer for MAC as we have fixed-size networks list */
    194     QSpacerItem *shiftSpacer =
    195         new QSpacerItem (0, 1, QSizePolicy::Expanding, QSizePolicy::Preferred);
    196     QGridLayout *mainLayout = static_cast <QGridLayout*> (layout());
    197     mainLayout->addItem (shiftSpacer, 1, 4);
    198     //static_cast <QHBoxLayout*> (mWtActions->layout())->addStretch();
    199 #endif
    200 
    201     /* Setup tree-widget */
    202     mTwInterfaces->header()->hide();
    203     mTwInterfaces->setContextMenuPolicy (Qt::CustomContextMenu);
    204 
    205     /* Prepare toolbar */
    206     mAddInterface = new QAction (mTwInterfaces);
    207     mRemInterface = new QAction (mTwInterfaces);
    208     mEditInterface = new QAction (mTwInterfaces);
    209 
    210     mAddInterface->setShortcuts (QList <QKeySequence> ()
    211                                  << QKeySequence ("Ins")
    212                                  << QKeySequence ("Ctrl+N"));
    213     mRemInterface->setShortcuts (QList <QKeySequence> ()
    214                                  << QKeySequence ("Del")
    215                                  << QKeySequence ("Ctrl+R"));
    216     mEditInterface->setShortcuts (QList <QKeySequence> ()
    217                                   << QKeySequence ("Space")
    218                                   << QKeySequence ("F2"));
    219 
    220     mAddInterface->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png",
    221                                                ":/add_host_iface_disabled_16px.png"));
    222     mRemInterface->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png",
    223                                                ":/remove_host_iface_disabled_16px.png"));
    224     mEditInterface->setIcon(UIIconPool::iconSet(":/guesttools_16px.png",
    225                                                 ":/guesttools_disabled_16px.png"));
    226 
    227     mTbActions->setUsesTextLabel (false);
    228     mTbActions->setIconSize (QSize (16, 16));
    229     mTbActions->setOrientation (Qt::Vertical);
    230     mTbActions->addAction (mAddInterface);
    231     mTbActions->addAction (mRemInterface);
    232     mTbActions->addAction (mEditInterface);
    233     mTbActions->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
    234     mTbActions->updateGeometry();
    235     mTbActions->setMinimumHeight (mTbActions->sizeHint().height());
    236 
    237     /* Setup connections */
    238     connect (mAddInterface, SIGNAL (triggered (bool)), this, SLOT (addInterface()));
    239     connect (mRemInterface, SIGNAL (triggered (bool)), this, SLOT (remInterface()));
    240     connect (mEditInterface, SIGNAL (triggered (bool)), this, SLOT (editInterface()));
    241     connect (mTwInterfaces, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)),
    242              this, SLOT (updateCurrentItem()));
    243     connect (mTwInterfaces, SIGNAL (customContextMenuRequested (const QPoint &)),
    244              this, SLOT (showContextMenu (const QPoint &)));
    245     connect (mTwInterfaces, SIGNAL (itemDoubleClicked (QTreeWidgetItem*, int)),
    246              this, SLOT (editInterface()));
    247 
    248     /* Applying language settings */
     202    /* Make shifting spacer for MAC as we have fixed-size networks list: */
     203    QSpacerItem *pShiftSpacer = new QSpacerItem(0, 1, QSizePolicy::Expanding, QSizePolicy::Preferred);
     204    m_pLayout1->addItem(pShiftSpacer);
     205#endif /* Q_WS_MAC */
     206
     207    /* Setup tree-widget: */
     208    m_pInterfacesTree->header()->hide();
     209    m_pInterfacesTree->setContextMenuPolicy(Qt::CustomContextMenu);
     210
     211    /* Prepare toolbar: */
     212    m_pAddAction = new QAction(m_pInterfacesTree);
     213    m_pDelAction = new QAction(m_pInterfacesTree);
     214    m_pEditAction = new QAction(m_pInterfacesTree);
     215
     216    m_pAddAction->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
     217    m_pDelAction->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
     218    m_pEditAction->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2"));
     219
     220    m_pAddAction->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png",
     221                                              ":/add_host_iface_disabled_16px.png"));
     222    m_pDelAction->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png",
     223                                              ":/remove_host_iface_disabled_16px.png"));
     224    m_pEditAction->setIcon(UIIconPool::iconSet(":/guesttools_16px.png",
     225                                               ":/guesttools_disabled_16px.png"));
     226
     227    m_pActionsToolbar->setUsesTextLabel(false);
     228    m_pActionsToolbar->setIconSize(QSize(16, 16));
     229    m_pActionsToolbar->setOrientation(Qt::Vertical);
     230    m_pActionsToolbar->addAction(m_pAddAction);
     231    m_pActionsToolbar->addAction(m_pDelAction);
     232    m_pActionsToolbar->addAction(m_pEditAction);
     233    m_pActionsToolbar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
     234    m_pActionsToolbar->updateGeometry();
     235    m_pActionsToolbar->setMinimumHeight(m_pActionsToolbar->sizeHint().height());
     236
     237    /* Setup connections: */
     238    connect(m_pAddAction, SIGNAL(triggered(bool)), this, SLOT(sltAddInterface()));
     239    connect(m_pDelAction, SIGNAL(triggered(bool)), this, SLOT(sltDelInterface()));
     240    connect(m_pEditAction, SIGNAL(triggered(bool)), this, SLOT(sltEditInterface()));
     241    connect(m_pInterfacesTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
     242            this, SLOT(sltUpdateCurrentItem()));
     243    connect(m_pInterfacesTree, SIGNAL(customContextMenuRequested(const QPoint&)),
     244            this, SLOT(sltChowContextMenu(const QPoint&)));
     245    connect(m_pInterfacesTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
     246            this, SLOT(sltEditInterface()));
     247
     248    /* Apply language settings: */
    249249    retranslateUi();
    250250}
     
    301301    {
    302302        const UIHostNetworkData &data = m_cache.m_items[iNetworkIndex];
    303         NetworkItem *pItem = new NetworkItem;
     303        UIHostInterfaceItem *pItem = new UIHostInterfaceItem;
    304304        pItem->fetchNetworkData(data);
    305         mTwInterfaces->addTopLevelItem(pItem);
    306     }
    307     mTwInterfaces->setCurrentItem(mTwInterfaces->topLevelItem(0));
    308     updateCurrentItem();
     305        m_pInterfacesTree->addTopLevelItem(pItem);
     306    }
     307    m_pInterfacesTree->setCurrentItem(m_pInterfacesTree->topLevelItem(0));
     308    sltUpdateCurrentItem();
    309309#ifdef Q_WS_MAC
    310     int width = qMax(static_cast<QAbstractItemView*>(mTwInterfaces)->sizeHintForColumn(0) +
    311                      2 * mTwInterfaces->frameWidth() + QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent),
     310    int width = qMax(static_cast<QAbstractItemView*>(m_pInterfacesTree)->sizeHintForColumn(0) +
     311                     2 * m_pInterfacesTree->frameWidth() + QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent),
    312312                     220);
    313     mTwInterfaces->setFixedWidth(width);
    314     mTwInterfaces->resizeColumnToContents(0);
     313    m_pInterfacesTree->setFixedWidth(width);
     314    m_pInterfacesTree->resizeColumnToContents(0);
    315315#endif /* Q_WS_MAC */
    316316}
     
    322322    /* Upload to cache: */
    323323    m_cache.m_items.clear();
    324     for (int iNetworkIndex = 0; iNetworkIndex < mTwInterfaces->topLevelItemCount(); ++iNetworkIndex)
     324    for (int iNetworkIndex = 0; iNetworkIndex < m_pInterfacesTree->topLevelItemCount(); ++iNetworkIndex)
    325325    {
    326326        UIHostNetworkData data;
    327         NetworkItem *pItem = static_cast<NetworkItem*>(mTwInterfaces->topLevelItem(iNetworkIndex));
     327        UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->topLevelItem(iNetworkIndex));
    328328        pItem->uploadNetworkData(data);
    329329        m_cache.m_items << data;
     
    450450}
    451451
    452 void UIGlobalSettingsNetwork::setValidator (QIWidgetValidator *aValidator)
    453 {
    454     mValidator = aValidator;
    455 }
    456 
    457 bool UIGlobalSettingsNetwork::revalidate (QString &aWarning, QString &aTitle)
    458 {
    459     NetworkItem *item = static_cast <NetworkItem*> (mTwInterfaces->currentItem());
    460     return item ? item->revalidate (aWarning, aTitle) : true;
    461 }
    462 
    463 void UIGlobalSettingsNetwork::setOrderAfter (QWidget *aWidget)
    464 {
    465     setTabOrder (aWidget, mTwInterfaces);
    466 }
    467 
     452/* Validation assignments: */
     453void UIGlobalSettingsNetwork::setValidator(QIWidgetValidator *pValidator)
     454{
     455    m_pValidator = pValidator;
     456}
     457
     458/* Validation processing: */
     459bool UIGlobalSettingsNetwork::revalidate(QString &strWarning, QString &strTitle)
     460{
     461    UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
     462    return pItem ? pItem->revalidate(strWarning, strTitle) : true;
     463}
     464
     465/* Navigation stuff: */
     466void UIGlobalSettingsNetwork::setOrderAfter(QWidget *pWidget)
     467{
     468    setTabOrder(pWidget, m_pInterfacesTree);
     469}
     470
     471/* Translation stuff: */
    468472void UIGlobalSettingsNetwork::retranslateUi()
    469473{
    470     /* Translate uic generated strings */
    471     Ui::UIGlobalSettingsNetwork::retranslateUi (this);
    472 
    473     /* Translate action tool-tips */
    474     mAddInterface->setText (tr ("&Add host-only network"));
    475     mRemInterface->setText (tr ("&Remove host-only network"));
    476     mEditInterface->setText (tr ("&Edit host-only network"));
    477 
    478     mAddInterface->setToolTip (mAddInterface->text().remove ('&') +
    479         QString (" (%1)").arg (mAddInterface->shortcut().toString()));
    480     mRemInterface->setToolTip (mRemInterface->text().remove ('&') +
    481         QString (" (%1)").arg (mRemInterface->shortcut().toString()));
    482     mEditInterface->setToolTip (mEditInterface->text().remove ('&') +
    483         QString (" (%1)").arg (mEditInterface->shortcut().toString()));
    484 }
    485 
    486 void UIGlobalSettingsNetwork::addInterface()
     474    /* Translate uic generated strings: */
     475    Ui::UIGlobalSettingsNetwork::retranslateUi(this);
     476
     477    /* Translate action tool-tips: */
     478    m_pAddAction->setText(tr("&Add host-only network"));
     479    m_pDelAction->setText(tr("&Remove host-only network"));
     480    m_pEditAction->setText(tr("&Edit host-only network"));
     481
     482    /* Assign tool-tips: */
     483    m_pAddAction->setToolTip(m_pAddAction->text().remove('&') +
     484        QString(" (%1)").arg(m_pAddAction->shortcut().toString()));
     485    m_pDelAction->setToolTip(m_pDelAction->text().remove('&') +
     486        QString(" (%1)").arg(m_pDelAction->shortcut().toString()));
     487    m_pEditAction->setToolTip(m_pEditAction->text().remove('&') +
     488        QString(" (%1)").arg(m_pEditAction->shortcut().toString()));
     489}
     490
     491/* Adds new network interface: */
     492void UIGlobalSettingsNetwork::sltAddInterface()
    487493{
    488494    /* Creating interface item: */
    489     NetworkItem *pItem = new NetworkItem;
     495    UIHostInterfaceItem *pItem = new UIHostInterfaceItem;
    490496    /* Fill item's data: */
    491497    UIHostNetworkData data;
     
    500506    pItem->fetchNetworkData(data);
    501507    /* Add new top-level item: */
    502     mTwInterfaces->addTopLevelItem(pItem);
    503     mTwInterfaces->sortItems(0, Qt::AscendingOrder);
    504     mTwInterfaces->setCurrentItem(pItem);
     508    m_pInterfacesTree->addTopLevelItem(pItem);
     509    m_pInterfacesTree->sortItems(0, Qt::AscendingOrder);
     510    m_pInterfacesTree->setCurrentItem(pItem);
    505511    /* Mark dialog as edited: */
    506512    m_fChanged = true;
    507513}
    508514
    509 void UIGlobalSettingsNetwork::remInterface()
     515/* Removes selected network interface: */
     516void UIGlobalSettingsNetwork::sltDelInterface()
    510517{
    511518    /* Get interface item: */
    512     NetworkItem *pItem = static_cast<NetworkItem*>(mTwInterfaces->currentItem());
     519    UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
    513520    AssertMsg(pItem, ("Current item should present!\n"));
    514521    /* Get interface name: */
     
    523530}
    524531
    525 void UIGlobalSettingsNetwork::editInterface()
     532/* Edits selected network interface: */
     533void UIGlobalSettingsNetwork::sltEditInterface()
    526534{
    527535    /* Check interface presence */
    528     NetworkItem *item = static_cast <NetworkItem*> (mTwInterfaces->currentItem());
    529     AssertMsg (item, ("Current item should be selected!\n"));
     536    UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
     537    AssertMsg(pItem, ("Current item should be selected!\n"));
    530538    /* Edit current item data */
    531     UIGlobalSettingsNetworkDetails details (this);
    532     details.getFromItem (item);
     539    UIGlobalSettingsNetworkDetails details(this);
     540    details.getFromItem(pItem);
    533541    if (details.exec() == QDialog::Accepted)
    534542    {
    535543        details.putBackToItem();
    536         item->updateInfo();
    537     }
    538     updateCurrentItem();
    539     mValidator->revalidate();
     544        pItem->updateInfo();
     545    }
     546    sltUpdateCurrentItem();
     547    m_pValidator->revalidate();
    540548    /* Mark dialog as edited: */
    541549    m_fChanged = true;
    542550}
    543551
    544 void UIGlobalSettingsNetwork::updateCurrentItem()
    545 {
    546     /* Get current item */
    547     NetworkItem *item = static_cast <NetworkItem*> (mTwInterfaces->currentItem());
    548     /* Set the final label text */
    549     mLbInfo->setText (item ? item->updateInfo() : QString());
    550     /* Update availability */
    551     mRemInterface->setEnabled (item);
    552     mEditInterface->setEnabled (item);
    553 }
    554 
    555 void UIGlobalSettingsNetwork::showContextMenu (const QPoint &aPos)
     552/* Update current network interface data relations: */
     553void UIGlobalSettingsNetwork::sltUpdateCurrentItem()
     554{
     555    /* Get current item: */
     556    UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
     557    /* Set the final label text: */
     558    m_pInfoLabel->setText(pItem ? pItem->updateInfo() : QString());
     559    /* Update availability: */
     560    m_pDelAction->setEnabled(pItem);
     561    m_pEditAction->setEnabled(pItem);
     562}
     563
     564/* Show network interface context-menu: */
     565void UIGlobalSettingsNetwork::sltChowContextMenu(const QPoint &pos)
    556566{
    557567    QMenu menu;
    558 
    559     if (mTwInterfaces->itemAt (aPos))
    560     {
    561         menu.addAction (mEditInterface);
    562         menu.addAction (mRemInterface);
     568    if (m_pInterfacesTree->itemAt(pos))
     569    {
     570        menu.addAction(m_pEditAction);
     571        menu.addAction(m_pDelAction);
    563572    }
    564573    else
    565574    {
    566         menu.addAction (mAddInterface);
    567     }
    568 
    569     menu.exec (mTwInterfaces->mapToGlobal (aPos));
    570 }
    571 
     575        menu.addAction(m_pAddAction);
     576    }
     577
     578    menu.exec(m_pInterfacesTree->mapToGlobal(pos));
     579}
     580
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h

    r33882 r34162  
    2020#define __UIGlobalSettingsNetwork_h__
    2121
     22/* Local includes */
    2223#include "UISettingsPage.h"
    2324#include "UIGlobalSettingsNetwork.gen.h"
    2425
    25 /* Host interface data: */
     26/* Global settings / Network page / Host interface data: */
    2627struct UIHostInterfaceData
    2728{
     
    3637};
    3738
    38 /* DHCP server data: */
     39/* Global settings / Network page / DHCP server data: */
    3940struct UIDHCPServerData
    4041{
     
    4748};
    4849
    49 /* Global network data: */
     50/* Global settings / Network page / Full network data: */
    5051struct UIHostNetworkData
    5152{
     
    6061};
    6162
    62 class NetworkItem : public QTreeWidgetItem
     63/* Global settings / Network page / Host interface item: */
     64class UIHostInterfaceItem : public QTreeWidgetItem
    6365{
    6466public:
    6567
    66     NetworkItem();
     68    /* Constructor: */
     69    UIHostInterfaceItem();
    6770
     71    /* Get/return data to/form items: */
    6872    void fetchNetworkData(const UIHostNetworkData &data);
    6973    void uploadNetworkData(UIHostNetworkData &data);
    7074
    71     bool revalidate (QString &aWarning, QString &aTitle);
     75    /* Validation stuff: */
     76    bool revalidate(QString &strWarning, QString &strTitle);
    7277
     78    /* Helpers: */
    7379    QString updateInfo();
    7480
    75     /* Page getters */
     81    /* Network item getters: */
    7682    QString name() const { return m_data.m_interface.m_strName; }
    7783    bool isDhcpClientEnabled() const { return m_data.m_interface.m_fDhcpClientEnabled; }
     
    8894    QString dhcpUpperAddress() const { return m_data.m_dhcpserver.m_strDhcpUpperAddress; }
    8995
    90     /* Page setters */
    91     void setDhcpClientEnabled (bool aEnabled) { m_data.m_interface.m_fDhcpClientEnabled = aEnabled; }
    92     void setInterfaceAddress (const QString &aValue) { m_data.m_interface.m_strInterfaceAddress = aValue; }
    93     void setInterfaceMask (const QString &aValue) { m_data.m_interface.m_strInterfaceMask = aValue; }
    94     void setIp6Supported (bool aSupported) { m_data.m_interface.m_fIpv6Supported = aSupported; }
    95     void setInterfaceAddress6 (const QString &aValue) { m_data.m_interface.m_strInterfaceAddress6 = aValue; }
    96     void setInterfaceMaskLength6 (const QString &aValue) { m_data.m_interface.m_strInterfaceMaskLength6 = aValue; }
     96    /* Network item setters */
     97    void setDhcpClientEnabled(bool fEnabled) { m_data.m_interface.m_fDhcpClientEnabled = fEnabled; }
     98    void setInterfaceAddress (const QString &strValue) { m_data.m_interface.m_strInterfaceAddress = strValue; }
     99    void setInterfaceMask (const QString &strValue) { m_data.m_interface.m_strInterfaceMask = strValue; }
     100    void setIp6Supported (bool fSupported) { m_data.m_interface.m_fIpv6Supported = fSupported; }
     101    void setInterfaceAddress6 (const QString &strValue) { m_data.m_interface.m_strInterfaceAddress6 = strValue; }
     102    void setInterfaceMaskLength6 (const QString &strValue) { m_data.m_interface.m_strInterfaceMaskLength6 = strValue; }
    97103
    98     void setDhcpServerEnabled (bool aEnabled) { m_data.m_dhcpserver.m_fDhcpServerEnabled = aEnabled; }
    99     void setDhcpServerAddress (const QString &aValue) { m_data.m_dhcpserver.m_strDhcpServerAddress = aValue; }
    100     void setDhcpServerMask (const QString &aValue) { m_data.m_dhcpserver.m_strDhcpServerMask = aValue; }
    101     void setDhcpLowerAddress (const QString &aValue) { m_data.m_dhcpserver.m_strDhcpLowerAddress = aValue; }
    102     void setDhcpUpperAddress (const QString &aValue) { m_data.m_dhcpserver.m_strDhcpUpperAddress = aValue; }
     104    void setDhcpServerEnabled (bool fEnabled) { m_data.m_dhcpserver.m_fDhcpServerEnabled = fEnabled; }
     105    void setDhcpServerAddress (const QString &sttValue) { m_data.m_dhcpserver.m_strDhcpServerAddress = sttValue; }
     106    void setDhcpServerMask (const QString &strValue) { m_data.m_dhcpserver.m_strDhcpServerMask = strValue; }
     107    void setDhcpLowerAddress (const QString &strValue) { m_data.m_dhcpserver.m_strDhcpLowerAddress = strValue; }
     108    void setDhcpUpperAddress (const QString &strValue) { m_data.m_dhcpserver.m_strDhcpUpperAddress = strValue; }
    103109
    104110private:
     
    109115
    110116/* Global settings / Network page: */
    111 class UIGlobalSettingsNetwork : public UISettingsPageGlobal,
    112                               public Ui::UIGlobalSettingsNetwork
     117class UIGlobalSettingsNetwork : public UISettingsPageGlobal, public Ui::UIGlobalSettingsNetwork
    113118{
    114119    Q_OBJECT;
     
    116121public:
    117122
     123    /* Constructor: */
    118124    UIGlobalSettingsNetwork();
    119125
     
    134140    void saveFromCacheTo(QVariant &data);
    135141
    136     void setValidator (QIWidgetValidator *aVal);
    137     bool revalidate (QString &aWarning, QString &aTitle);
     142    /* Validation stuff: */
     143    void setValidator(QIWidgetValidator *pValidator);
     144    bool revalidate(QString &strWarning, QString &strTitle);
    138145
     146    /* Navigation stuff: */
    139147    void setOrderAfter (QWidget *aWidget);
    140148
     149    /* Translation stuff: */
    141150    void retranslateUi();
    142151
    143152private slots:
    144153
    145     void addInterface();
    146     void remInterface();
    147     void editInterface();
    148     void updateCurrentItem();
    149     void showContextMenu (const QPoint &aPos);
     154    /* Helper slots: */
     155    void sltAddInterface();
     156    void sltDelInterface();
     157    void sltEditInterface();
     158    void sltUpdateCurrentItem();
     159    void sltChowContextMenu(const QPoint &pos);
    150160
    151161private:
    152162
    153     QIWidgetValidator *mValidator;
     163    /* Validator: */
     164    QIWidgetValidator *m_pValidator;
    154165
    155     QAction *mAddInterface;
    156     QAction *mRemInterface;
    157     QAction *mEditInterface;
     166    /* Helper actions: */
     167    QAction *m_pAddAction;
     168    QAction *m_pDelAction;
     169    QAction *m_pEditAction;
    158170
     171    /* Editness flag: */
    159172    bool m_fChanged;
    160173
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.ui

    r33882 r34162  
    1 <?xml version="1.0" encoding="UTF-8"?>
    21<ui version="4.0">
    32 <comment>
    4  VBox frontends: Qt4 GUI (&quot;VirtualBox&quot;):
     3 VBox frontends: Qt4 GUI ("VirtualBox"):
    54
    65     Copyright (C) 2009-2010 Oracle Corporation
     
    2423   </rect>
    2524  </property>
    26   <layout class="QGridLayout" name="gridLayout">
    27    <item row="0" column="0" rowspan="4">
     25  <layout class="QGridLayout">
     26   <property name="margin">
     27    <number>0</number>
     28   </property>
     29   <item row="0" column="0">
    2830    <spacer>
    2931     <property name="orientation">
     
    4143    </spacer>
    4244   </item>
    43    <item row="0" column="1" colspan="3">
    44     <widget class="QLabel" name="mLbPageName">
     45   <item row="0" column="1" colspan="2">
     46    <widget class="QLabel" name="m_pPageNameLabel">
    4547     <property name="text">
    4648      <string>&amp;Host-only Networks:</string>
    4749     </property>
    4850     <property name="buddy">
    49       <cstring>mTwInterfaces</cstring>
     51      <cstring>m_pInterfacesTree</cstring>
    5052     </property>
    5153    </widget>
    5254   </item>
    5355   <item row="1" column="2">
    54     <widget class="QWidget" native="1" name="m_pWidNetwork" >
    55      <layout class="QHBoxLayout" >
    56       <property name="leftMargin" >
    57        <number>0</number>
    58       </property>
    59       <property name="topMargin" >
    60        <number>0</number>
    61       </property>
    62       <property name="rightMargin" >
    63        <number>0</number>
    64       </property>
    65       <property name="bottomMargin" >
    66        <number>0</number>
    67       </property>
    68       <property name="spacing" >
    69        <number>1</number>
    70       </property>
    71       <item>
    72        <widget class="QTreeWidget" name="mTwInterfaces">
    73         <property name="sizePolicy">
    74          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
    75           <horstretch>0</horstretch>
    76           <verstretch>0</verstretch>
    77          </sizepolicy>
     56    <layout class="QHBoxLayout" name="m_pLayout1">
     57     <property name="spacing">
     58      <number>1</number>
     59     </property>
     60     <property name="margin">
     61      <number>0</number>
     62     </property>
     63     <item>
     64      <widget class="QTreeWidget" name="m_pInterfacesTree">
     65       <property name="sizePolicy">
     66        <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
     67         <horstretch>0</horstretch>
     68         <verstretch>0</verstretch>
     69        </sizepolicy>
     70       </property>
     71       <property name="minimumSize">
     72        <size>
     73         <width>0</width>
     74         <height>150</height>
     75        </size>
     76       </property>
     77       <property name="whatsThis">
     78        <string>Lists all available host-only networks.</string>
     79       </property>
     80       <property name="rootIsDecorated">
     81        <bool>false</bool>
     82       </property>
     83       <column>
     84        <property name="text">
     85         <string>Name</string>
    7886        </property>
    79         <property name="minimumSize">
    80          <size>
    81           <width>0</width>
    82           <height>150</height>
    83          </size>
    84         </property>
    85         <property name="whatsThis">
    86          <string>Lists all available host-only networks.</string>
    87         </property>
    88         <property name="rootIsDecorated">
    89          <bool>false</bool>
    90         </property>
    91         <column>
    92          <property name="text">
    93           <string>Name</string>
    94          </property>
    95         </column>
    96        </widget>
    97       </item>
    98       <item>
    99        <widget class="UIToolBar" name="mTbActions">
    100         <property name="orientation">
    101          <enum>Qt::Horizontal</enum>
    102         </property>
    103        </widget>
    104       </item>
    105      </layout>
    106     </widget>
     87       </column>
     88      </widget>
     89     </item>
     90     <item>
     91      <widget class="UIToolBar" name="m_pActionsToolbar">
     92       <property name="orientation">
     93        <enum>Qt::Horizontal</enum>
     94       </property>
     95      </widget>
     96     </item>
     97    </layout>
    10798   </item>
    108    <item row="1" column="1" rowspan="2">
     99   <item row="1" column="1">
    109100    <spacer>
    110101     <property name="orientation">
     
    117108      <size>
    118109       <width>20</width>
    119        <height>20</height>
     110       <height>0</height>
    120111      </size>
    121112     </property>
    122113    </spacer>
    123114   </item>
    124    <item row="2" column="2" colspan="2">
    125     <widget class="QLabel" name="mLbInfo">
     115   <item row="2" column="2">
     116    <widget class="QLabel" name="m_pInfoLabel">
    126117     <property name="sizePolicy">
    127118      <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetails.cpp

    r33882 r34162  
    77
    88/*
    9  * Copyright (C) 2009 Oracle Corporation
     9 * Copyright (C) 2009-2010 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818 */
    1919
    20 /* VBox Includes */
     20/* Global includes */
     21#include <QHostAddress>
     22#include <QRegExpValidator>
     23
     24/* Local includes */
    2125#include "UIGlobalSettingsNetwork.h"
    2226#include "UIGlobalSettingsNetworkDetails.h"
    2327
    24 /* Qt Includes */
    25 #include <QHostAddress>
    26 #include <QRegExpValidator>
    27 
    28 UIGlobalSettingsNetworkDetails::UIGlobalSettingsNetworkDetails (QWidget *aParent)
    29     : QIWithRetranslateUI2 <QIDialog> (aParent
     28/* Network page details constructor: */
     29UIGlobalSettingsNetworkDetails::UIGlobalSettingsNetworkDetails(QWidget *pParent)
     30    : QIWithRetranslateUI2<QIDialog>(pParent
    3031#ifdef Q_WS_MAC
    3132    ,Qt::Sheet
    3233#endif /* Q_WS_MAC */
    3334    )
    34     , mItem(0)
    35 {
    36     /* Apply UI decorations */
    37     Ui::UIGlobalSettingsNetworkDetails::setupUi (this);
    38 
    39     /* Setup dialog */
    40     setWindowIcon (QIcon (":/guesttools_16px.png"));
    41 
    42     /* Setup validators */
    43     QString templateIPv4 ("([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\."
    44                           "([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     QString templateIPv6 ("[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
    48                           "[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}");
    51 
    52     mLeIPv4->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
    53     mLeNMv4->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
    54     mLeIPv6->setValidator (new QRegExpValidator (QRegExp (templateIPv6), this));
    55     mLeNMv6->setValidator (new QRegExpValidator (QRegExp ("[1-9][0-9]|1[0-1][0-9]|12[0-8]"), this));
    56     mLeDhcpAddress->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
    57     mLeDhcpMask->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
    58     mLeDhcpLowerAddress->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
    59     mLeDhcpUpperAddress->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
     35    , m_pItem(0)
     36{
     37    /* Apply UI decorations: */
     38    Ui::UIGlobalSettingsNetworkDetails::setupUi(this);
     39
     40    /* Setup dialog: */
     41    setWindowIcon(QIcon(":/guesttools_16px.png"));
     42
     43    /* 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));
    6061
    6162    /* Setup widgets */
    62     mLeIPv6->setFixedWidthByText (QString().fill ('X', 32) + QString().fill (':', 7));
    63 
    64 #if 0 /* defined (Q_WS_WIN32) */
     63    m_pIPv6Editor->setFixedWidthByText(QString().fill('X', 32) + QString().fill(':', 7));
     64
     65#if 0 /* defined (Q_WS_WIN) */
    6566    QStyleOption options1;
    66     options1.initFrom (mCbManual);
    67     QGridLayout *layout1 = qobject_cast <QGridLayout*> (mTwDetails->widget (0)->layout());
    68     int wid1 = mCbManual->style()->pixelMetric (QStyle::PM_IndicatorWidth, &options1, mCbManual) +
    69                mCbManual->style()->pixelMetric (QStyle::PM_CheckBoxLabelSpacing, &options1, mCbManual) -
    70                layout1->spacing() - 1;
    71     QSpacerItem *spacer1 = new QSpacerItem (wid1, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    72     layout1->addItem (spacer1, 1, 0, 4);
     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);
    7374#else
    74     mCbManual->setVisible (false);
     75    m_pEnableManualCheckbox->setVisible(false);
    7576#endif
    7677
    7778    QStyleOption options2;
    78     options2.initFrom (mCbDhcpServerEnabled);
    79     QGridLayout *layout2 = qobject_cast <QGridLayout*> (mTwDetails->widget (1)->layout());
    80     int wid2 = mCbDhcpServerEnabled->style()->pixelMetric (QStyle::PM_IndicatorWidth, &options2, mCbDhcpServerEnabled) +
    81                mCbDhcpServerEnabled->style()->pixelMetric (QStyle::PM_CheckBoxLabelSpacing, &options2, mCbDhcpServerEnabled) -
    82                layout2->spacing() - 1;
    83     QSpacerItem *spacer2 = new QSpacerItem (wid2, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    84     layout2->addItem (spacer2, 1, 0, 4);
    85 
    86     /* Setup connections */
    87     connect (mCbManual, SIGNAL (stateChanged (int)),
    88              this, SLOT (dhcpClientStatusChanged()));
    89     connect (mCbDhcpServerEnabled, SIGNAL (stateChanged (int)),
    90              this, SLOT (dhcpServerStatusChanged()));
    91 
    92     /* Applying language settings */
     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()));
     90
     91    /* Apply language settings: */
    9392    retranslateUi();
    9493
    95     /* Fix minimum possible size */
    96     resize (minimumSizeHint());
     94    /* Fix minimum possible size: */
     95    resize(minimumSizeHint());
    9796    qApp->processEvents();
    98     setFixedSize (minimumSizeHint());
    99 }
    100 
    101 void UIGlobalSettingsNetworkDetails::getFromItem (NetworkItem *aItem)
    102 {
    103     mItem = aItem;
    104 
    105     /* Host-only Interface */
    106     mCbManual->setChecked (!mItem->isDhcpClientEnabled());
    107 #if !0 /* !defined (Q_WS_WIN32) */
    108     /* Disable automatic for all hosts for now */
    109     mCbManual->setChecked (true);
    110     mCbManual->setEnabled (false);
     97    setFixedSize(minimumSizeHint());
     98}
     99
     100/* Get data to details sub-dialog: */
     101void UIGlobalSettingsNetworkDetails::getFromItem(UIHostInterfaceItem *pItem)
     102{
     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);
    111111#endif
    112     dhcpClientStatusChanged();
    113 
    114     /* DHCP Server */
    115     mCbDhcpServerEnabled->setChecked (mItem->isDhcpServerEnabled());
    116     dhcpServerStatusChanged();
    117 }
    118 
     112    sltDhcpClientStatusChanged();
     113
     114    /* DHCP Server: */
     115    m_pEnabledDhcpServerCheckbox->setChecked(m_pItem->isDhcpServerEnabled());
     116    sltDhcpServerStatusChanged();
     117}
     118
     119/* Return data from details sub-dialog: */
    119120void UIGlobalSettingsNetworkDetails::putBackToItem()
    120121{
    121     /* Host-only Interface */
    122     mItem->setDhcpClientEnabled (!mCbManual->isChecked());
    123     if (mCbManual->isChecked())
    124     {
    125         mItem->setInterfaceAddress (mLeIPv4->text());
    126         mItem->setInterfaceMask (mLeNMv4->text());
    127         if (mItem->isIpv6Supported())
     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())
    128129        {
    129             mItem->setInterfaceAddress6 (mLeIPv6->text());
    130             mItem->setInterfaceMaskLength6 (mLeNMv6->text());
     130            m_pItem->setInterfaceAddress6(m_pIPv6Editor->text());
     131            m_pItem->setInterfaceMaskLength6(m_pNMv6Editor->text());
    131132        }
    132133    }
    133134
    134     /* DHCP Server */
    135     mItem->setDhcpServerEnabled (mCbDhcpServerEnabled->isChecked());
    136     if (mCbDhcpServerEnabled->isChecked())
    137     {
    138         mItem->setDhcpServerAddress (mLeDhcpAddress->text());
    139         mItem->setDhcpServerMask (mLeDhcpMask->text());
    140         mItem->setDhcpLowerAddress (mLeDhcpLowerAddress->text());
    141         mItem->setDhcpUpperAddress (mLeDhcpUpperAddress->text());
    142     }
    143 }
    144 
     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: */
    145147void UIGlobalSettingsNetworkDetails::retranslateUi()
    146148{
    147     /* Translate uic generated strings */
    148     Ui::UIGlobalSettingsNetworkDetails::retranslateUi (this);
    149 }
    150 
    151 void UIGlobalSettingsNetworkDetails::dhcpClientStatusChanged()
    152 {
    153     bool isManual = mCbManual->isChecked();
    154     bool isIpv6Supported = isManual && mItem->isIpv6Supported();
    155 
    156     mLeIPv4->clear();
    157     mLeNMv4->clear();
    158     mLeIPv6->clear();
    159     mLeNMv6->clear();
    160 
    161     mLbIPv4->setEnabled (isManual);
    162     mLbNMv4->setEnabled (isManual);
    163     mLeIPv4->setEnabled (isManual);
    164     mLeNMv4->setEnabled (isManual);
    165     mLbIPv6->setEnabled (isIpv6Supported);
    166     mLbNMv6->setEnabled (isIpv6Supported);
    167     mLeIPv6->setEnabled (isIpv6Supported);
    168     mLeNMv6->setEnabled (isIpv6Supported);
    169 
    170     if (isManual)
    171     {
    172         mLeIPv4->setText (mItem->interfaceAddress());
    173         mLeNMv4->setText (mItem->interfaceMask());
    174         if (isIpv6Supported)
     149    /* Translate uic generated strings: */
     150    Ui::UIGlobalSettingsNetworkDetails::retranslateUi(this);
     151}
     152
     153/* Handler for DHCP client settings change: */
     154void UIGlobalSettingsNetworkDetails::sltDhcpClientStatusChanged()
     155{
     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)
    175178        {
    176             mLeIPv6->setText (mItem->interfaceAddress6());
    177             mLeNMv6->setText (mItem->interfaceMaskLength6());
     179            m_pIPv6Editor->setText(m_pItem->interfaceAddress6());
     180            m_pNMv6Editor->setText(m_pItem->interfaceMaskLength6());
    178181        }
    179182    }
    180183}
    181184
    182 void UIGlobalSettingsNetworkDetails::dhcpServerStatusChanged()
    183 {
    184     bool isEnabled = mCbDhcpServerEnabled->isChecked();
    185 
    186     mLeDhcpAddress->clear();
    187     mLeDhcpMask->clear();
    188     mLeDhcpLowerAddress->clear();
    189     mLeDhcpUpperAddress->clear();
    190 
    191     mLbDhcpAddress->setEnabled (isEnabled);
    192     mLbDhcpMask->setEnabled (isEnabled);
    193     mLbDhcpLowerAddress->setEnabled (isEnabled);
    194     mLbDhcpUpperAddress->setEnabled (isEnabled);
    195     mLeDhcpAddress->setEnabled (isEnabled);
    196     mLeDhcpMask->setEnabled (isEnabled);
    197     mLeDhcpLowerAddress->setEnabled (isEnabled);
    198     mLeDhcpUpperAddress->setEnabled (isEnabled);
    199 
    200     if (isEnabled)
    201     {
    202         mLeDhcpAddress->setText (mItem->dhcpServerAddress());
    203         mLeDhcpMask->setText (mItem->dhcpServerMask());
    204         mLeDhcpLowerAddress->setText (mItem->dhcpLowerAddress());
    205         mLeDhcpUpperAddress->setText (mItem->dhcpUpperAddress());
    206     }
    207 }
    208 
     185/* Handler for DHCP server settings change: */
     186void UIGlobalSettingsNetworkDetails::sltDhcpServerStatusChanged()
     187{
     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    }
     211}
     212
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetails.h

    r33882 r34162  
    66
    77/*
    8  * Copyright (C) 2009 Oracle Corporation
     8 * Copyright (C) 2009-2010 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#define __UIGlobalSettingsNetworkDetails_h__
    2121
    22 /* VBox includes */
     22/* Local includes */
    2323#include "QIDialog.h"
    2424#include "QIWithRetranslateUI.h"
    2525#include "UIGlobalSettingsNetworkDetails.gen.h"
    2626
    27 /* VBox forwards */
    28 class NetworkItem;
     27/* Forward decalrations: */
     28class UIHostInterfaceItem;
    2929
    30 class UIGlobalSettingsNetworkDetails : public QIWithRetranslateUI2 <QIDialog>,
    31                                     public Ui::UIGlobalSettingsNetworkDetails
     30/* Global settings / Network page / Details sub-dialog: */
     31class UIGlobalSettingsNetworkDetails : public QIWithRetranslateUI2<QIDialog>, public Ui::UIGlobalSettingsNetworkDetails
    3232{
    3333    Q_OBJECT;
     
    3535public:
    3636
    37     UIGlobalSettingsNetworkDetails (QWidget *aParent);
     37    /* Constructor: */
     38    UIGlobalSettingsNetworkDetails(QWidget *pParent);
    3839
    39     void getFromItem (NetworkItem *aItem);
     40    /* Get/return data to/from details sub-dialog: */
     41    void getFromItem(UIHostInterfaceItem *aItem);
    4042    void putBackToItem();
    4143
    4244protected:
    4345
     46    /* Validation stuff: */
    4447    void retranslateUi();
    4548
    4649private slots:
    4750
    48     void dhcpClientStatusChanged();
    49     void dhcpServerStatusChanged();
     51    /* Various helper slots: */
     52    void sltDhcpClientStatusChanged();
     53    void sltDhcpServerStatusChanged();
    5054
    5155private:
    5256
    53     NetworkItem *mItem;
     57    UIHostInterfaceItem *m_pItem;
    5458};
    5559
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetails.ui

    r33882 r34162  
    1 <ui version="4.0" >
     1<ui version="4.0">
    22 <comment>
    33 VBox frontends: Qt4 GUI ("VirtualBox"):
    44
    5      Copyright (C) 2009 Oracle Corporation
     5     Copyright (C) 2009-2010 Oracle Corporation
    66
    77     This file is part of VirtualBox Open Source Edition (OSE), as
     
    1414 </comment>
    1515 <class>UIGlobalSettingsNetworkDetails</class>
    16  <widget class="QWidget" name="UIGlobalSettingsNetworkDetails" >
    17   <property name="geometry" >
     16 <widget class="QWidget" name="UIGlobalSettingsNetworkDetails">
     17  <property name="geometry">
    1818   <rect>
    1919    <x>0</x>
     
    2323   </rect>
    2424  </property>
    25   <property name="windowTitle" >
     25  <property name="windowTitle">
    2626   <string>Host-only Network Details</string>
    2727  </property>
    28   <layout class="QVBoxLayout" >
     28  <layout class="QVBoxLayout">
    2929   <item>
    30     <widget class="QITabWidget" name="mTwDetails" >
    31      <property name="sizePolicy" >
    32       <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
     30    <widget class="QITabWidget" name="m_pDetailsTabWidget">
     31     <property name="sizePolicy">
     32      <sizepolicy vsizetype="Expanding" hsizetype="Preferred">
    3333       <horstretch>0</horstretch>
    3434       <verstretch>0</verstretch>
    3535      </sizepolicy>
    3636     </property>
    37      <property name="currentIndex" >
     37     <property name="currentIndex">
    3838      <number>0</number>
    3939     </property>
    40      <widget class="QWidget" name="mTabInterface" >
    41       <attribute name="title" >
     40     <widget class="QWidget" name="m_pInterfaceTab">
     41      <attribute name="title">
    4242       <string>&amp;Adapter</string>
    4343      </attribute>
    44       <layout class="QGridLayout" >
    45        <item row="0" column="0" colspan="3" >
    46         <widget class="QCheckBox" name="mCbManual" >
    47          <property name="text" >
     44      <layout class="QGridLayout">
     45       <item row="0" column="0" colspan="3">
     46        <widget class="QCheckBox" name="m_pEnableManualCheckbox">
     47         <property name="text">
    4848          <string>Manual &amp;Configuration</string>
    4949         </property>
    50          <property name="checked" >
     50         <property name="checked">
    5151          <bool>true</bool>
    5252         </property>
    53          <property name="toolTip" >
     53         <property name="toolTip">
    5454          <string>Use manual configuration for this host-only network adapter.</string>
    5555         </property>
    5656        </widget>
    5757       </item>
    58        <item row="1" column="1" >
    59         <widget class="QLabel" name="mLbIPv4" >
    60          <property name="text" >
     58       <item row="1" column="1">
     59        <widget class="QLabel" name="m_pIPv4Label">
     60         <property name="text">
    6161          <string>&amp;IPv4 Address:</string>
    6262         </property>
    63          <property name="alignment" >
    64           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    65          </property>
    66          <property name="buddy" >
    67           <cstring>mLeIPv4</cstring>
    68          </property>
    69         </widget>
    70        </item>
    71        <item row="1" column="2" >
    72         <widget class="QILineEdit" name="mLeIPv4" >
    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" >
     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">
    8080          <string>Displays the host IPv4 address for this adapter.</string>
    8181         </property>
    8282        </widget>
    8383       </item>
    84        <item row="2" column="1" >
    85         <widget class="QLabel" name="mLbNMv4" >
    86          <property name="text" >
     84       <item row="2" column="1">
     85        <widget class="QLabel" name="m_pNMv4Label">
     86         <property name="text">
    8787          <string>IPv4 Network &amp;Mask:</string>
    8888         </property>
    89          <property name="alignment" >
    90           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    91          </property>
    92          <property name="buddy" >
    93           <cstring>mLeNMv4</cstring>
    94          </property>
    95         </widget>
    96        </item>
    97        <item row="2" column="2" >
    98         <widget class="QILineEdit" name="mLeNMv4" >
    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" >
     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">
    106106          <string>Displays the host IPv4 network mask for this adapter.</string>
    107107         </property>
    108108        </widget>
    109109       </item>
    110        <item row="3" column="1" >
    111         <widget class="QLabel" name="mLbIPv6" >
    112          <property name="text" >
     110       <item row="3" column="1">
     111        <widget class="QLabel" name="m_pIPv6Label">
     112         <property name="text">
    113113          <string>I&amp;Pv6 Address:</string>
    114114         </property>
    115          <property name="alignment" >
    116           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    117          </property>
    118          <property name="buddy" >
    119           <cstring>mLeIPv6</cstring>
    120          </property>
    121         </widget>
    122        </item>
    123        <item row="3" column="2" >
    124         <widget class="QILineEdit" name="mLeIPv6" >
    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" >
     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">
    132132          <string>Displays the host IPv6 address for this adapter if IPv6 is supported.</string>
    133133         </property>
    134134        </widget>
    135135       </item>
    136        <item row="4" column="1" >
    137         <widget class="QLabel" name="mLbNMv6" >
    138          <property name="text" >
     136       <item row="4" column="1">
     137        <widget class="QLabel" name="m_pNMv6Label">
     138         <property name="text">
    139139          <string>IPv6 Network Mask &amp;Length:</string>
    140140         </property>
    141          <property name="alignment" >
    142           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    143          </property>
    144          <property name="buddy" >
    145           <cstring>mLeNMv6</cstring>
    146          </property>
    147         </widget>
    148        </item>
    149        <item row="4" column="2" >
    150         <widget class="QILineEdit" name="mLeNMv6" >
    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" >
     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">
    158158          <string>Displays the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</string>
    159159         </property>
    160160        </widget>
    161161       </item>
    162        <item row="5" column="0" colspan="3" >
    163         <spacer name="verticalSpacer1" >
    164          <property name="orientation" >
     162       <item row="5" column="0" colspan="3">
     163        <spacer name="verticalSpacer1">
     164         <property name="orientation">
    165165          <enum>Qt::Vertical</enum>
    166166         </property>
    167          <property name="sizeHint" stdset="0" >
     167         <property name="sizeHint" stdset="0">
    168168          <size>
    169169           <width>0</width>
     
    175175      </layout>
    176176     </widget>
    177      <widget class="QWidget" name="mTabDhcpServer" >
    178       <attribute name="title" >
     177     <widget class="QWidget" name="m_pDhcpServerTab">
     178      <attribute name="title">
    179179       <string>&amp;DHCP Server</string>
    180180      </attribute>
    181       <layout class="QGridLayout" >
    182        <item row="0" column="0" colspan="3" >
    183         <widget class="QCheckBox" name="mCbDhcpServerEnabled" >
    184          <property name="text" >
     181      <layout class="QGridLayout">
     182       <item row="0" column="0" colspan="3">
     183        <widget class="QCheckBox" name="m_pEnabledDhcpServerCheckbox">
     184         <property name="text">
    185185          <string>&amp;Enable Server</string>
    186186         </property>
    187          <property name="toolTip" >
     187         <property name="toolTip">
    188188          <string>Indicates whether the DHCP Server is enabled on machine startup or not.</string>
    189189         </property>
    190190        </widget>
    191191       </item>
    192        <item row="1" column="1" >
    193         <widget class="QLabel" name="mLbDhcpAddress" >
    194          <property name="text" >
     192       <item row="1" column="1">
     193        <widget class="QLabel" name="m_pDhcpAddressLabel">
     194         <property name="text">
    195195          <string>Server Add&amp;ress:</string>
    196196         </property>
    197          <property name="alignment" >
    198           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    199          </property>
    200          <property name="buddy" >
    201           <cstring>mLeDhcpAddress</cstring>
    202          </property>
    203         </widget>
    204        </item>
    205        <item row="1" column="2" >
    206         <widget class="QILineEdit" name="mLeDhcpAddress" >
    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" >
     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">
    214214          <string>Displays the address of the DHCP server servicing the network associated with this host-only adapter.</string>
    215215         </property>
    216216        </widget>
    217217       </item>
    218        <item row="2" column="1" >
    219         <widget class="QLabel" name="mLbDhcpMask" >
    220          <property name="text" >
     218       <item row="2" column="1">
     219        <widget class="QLabel" name="m_pDhcpMaskLabel">
     220         <property name="text">
    221221          <string>Server &amp;Mask:</string>
    222222         </property>
    223          <property name="alignment" >
    224           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    225          </property>
    226          <property name="buddy" >
    227           <cstring>mLeDhcpMask</cstring>
    228          </property>
    229         </widget>
    230        </item>
    231        <item row="2" column="2" >
    232         <widget class="QILineEdit" name="mLeDhcpMask" >
    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" >
     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">
    240240          <string>Displays the network mask of the DHCP server servicing the network associated with this host-only adapter.</string>
    241241         </property>
    242242        </widget>
    243243       </item>
    244        <item row="3" column="1" >
    245         <widget class="QLabel" name="mLbDhcpLowerAddress" >
    246          <property name="text" >
     244       <item row="3" column="1">
     245        <widget class="QLabel" name="m_pDhcpLowerAddressLabel">
     246         <property name="text">
    247247          <string>&amp;Lower Address Bound:</string>
    248248         </property>
    249          <property name="alignment" >
    250           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    251          </property>
    252          <property name="buddy" >
    253           <cstring>mLeDhcpLowerAddress</cstring>
    254          </property>
    255         </widget>
    256        </item>
    257        <item row="3" column="2" >
    258         <widget class="QILineEdit" name="mLeDhcpLowerAddress" >
    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" >
     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">
    266266          <string>Displays the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</string>
    267267         </property>
    268268        </widget>
    269269       </item>
    270        <item row="4" column="1" >
    271         <widget class="QLabel" name="mLbDhcpUpperAddress" >
    272          <property name="text" >
     270       <item row="4" column="1">
     271        <widget class="QLabel" name="m_pDhcpUpperAddressLabel">
     272         <property name="text">
    273273          <string>&amp;Upper Address Bound:</string>
    274274         </property>
    275          <property name="alignment" >
    276           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    277          </property>
    278          <property name="buddy" >
    279           <cstring>mLeDhcpUpperAddress</cstring>
    280          </property>
    281         </widget>
    282        </item>
    283        <item row="4" column="2" >
    284         <widget class="QILineEdit" name="mLeDhcpUpperAddress" >
    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" >
     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">
    292292          <string>Displays the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</string>
    293293         </property>
    294294        </widget>
    295295       </item>
    296        <item row="5" column="0" colspan="3" >
    297         <spacer name="verticalSpacer2" >
    298          <property name="orientation" >
     296       <item row="5" column="0" colspan="3">
     297        <spacer name="verticalSpacer2">
     298         <property name="orientation">
    299299          <enum>Qt::Vertical</enum>
    300300         </property>
    301          <property name="sizeHint" stdset="0" >
     301         <property name="sizeHint" stdset="0">
    302302          <size>
    303303           <width>0</width>
     
    312312   </item>
    313313   <item>
    314     <widget class="QIDialogButtonBox" name="mButtonBox" >
    315      <property name="standardButtons" >
     314    <widget class="QIDialogButtonBox" name="m_pButtonBox">
     315     <property name="standardButtons">
    316316      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
    317317     </property>
     
    340340 <connections>
    341341  <connection>
    342    <sender>mButtonBox</sender>
     342   <sender>m_pButtonBox</sender>
    343343   <signal>accepted()</signal>
    344344   <receiver>UIGlobalSettingsNetworkDetails</receiver>
    345345   <slot>accept()</slot>
    346346   <hints>
    347     <hint type="sourcelabel" >
     347    <hint type="sourcelabel">
    348348     <x>162</x>
    349349     <y>339</y>
    350350    </hint>
    351     <hint type="destinationlabel" >
     351    <hint type="destinationlabel">
    352352     <x>162</x>
    353353     <y>179</y>
     
    356356  </connection>
    357357  <connection>
    358    <sender>mButtonBox</sender>
     358   <sender>m_pButtonBox</sender>
    359359   <signal>rejected()</signal>
    360360   <receiver>UIGlobalSettingsNetworkDetails</receiver>
    361361   <slot>reject()</slot>
    362362   <hints>
    363     <hint type="sourcelabel" >
     363    <hint type="sourcelabel">
    364364     <x>162</x>
    365365     <y>339</y>
    366366    </hint>
    367     <hint type="destinationlabel" >
     367    <hint type="destinationlabel">
    368368     <x>162</x>
    369369     <y>179</y>
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