Changeset 34162 in vbox for trunk/src/VBox
- Timestamp:
- Nov 18, 2010 12:04:47 PM (14 years ago)
- 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 18 18 */ 19 19 20 /* Global includes */ 21 #include <QHeaderView> 22 #include <QHostAddress> 23 20 24 /* Local includes */ 21 25 #include "QIWidgetValidator.h" … … 26 30 #include "VBoxProblemReporter.h" 27 31 28 /* Qt includes */ 29 #include <QHeaderView> 30 #include <QHostAddress> 31 32 NetworkItem::NetworkItem() 32 /* Host-network item constructor: */ 33 UIHostInterfaceItem::UIHostInterfaceItem() 33 34 : QTreeWidgetItem() 34 35 { 35 36 } 36 37 37 void NetworkItem::fetchNetworkData(const UIHostNetworkData &data) 38 /* Get data to item: */ 39 void UIHostInterfaceItem::fetchNetworkData(const UIHostNetworkData &data) 38 40 { 39 41 /* Fetch from cache: */ … … 44 46 } 45 47 46 void NetworkItem::uploadNetworkData(UIHostNetworkData &data) 48 /* Return data from item: */ 49 void UIHostInterfaceItem::uploadNetworkData(UIHostNetworkData &data) 47 50 { 48 51 /* Upload to cache: */ … … 50 53 } 51 54 52 bool NetworkItem::revalidate (QString &aWarning, QString & /* aTitle */) 53 { 54 /* Host-only Interface validation */ 55 /* Validation stuff: */ 56 bool UIHostInterfaceItem::revalidate(QString &strWarning, QString & /* strTitle */) 57 { 58 /* Host-only interface validation: */ 55 59 if (!m_data.m_interface.m_fDhcpClientEnabled) 56 60 { 57 61 if (m_data.m_interface.m_strInterfaceAddress.isEmpty() && 58 (QHostAddress 59 QHostAddress 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)); 62 66 return false; 63 67 } 64 68 if (!m_data.m_interface.m_strInterfaceMask.isEmpty() && 65 (QHostAddress 66 QHostAddress 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)); 69 73 return false; 70 74 } … … 72 76 { 73 77 if (!m_data.m_interface.m_strInterfaceAddress6.isEmpty() && 74 (QHostAddress 75 QHostAddress 78 (QHostAddress(m_data.m_interface.m_strInterfaceAddress6) == QHostAddress::AnyIPv6 || 79 QHostAddress(m_data.m_interface.m_strInterfaceAddress6).protocol() != QAbstractSocket::IPv6Protocol)) 76 80 { 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)); 78 82 return false; 79 83 } … … 81 85 } 82 86 83 /* DHCP Server settings*/87 /* DHCP server validation: */ 84 88 if (m_data.m_dhcpserver.m_fDhcpServerEnabled) 85 89 { 86 if (QHostAddress 87 QHostAddress 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)); 90 94 return false; 91 95 } 92 if (QHostAddress 93 QHostAddress 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)); 96 100 return false; 97 101 } 98 if (QHostAddress 99 QHostAddress 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)); 102 106 return false; 103 107 } 104 if (QHostAddress 105 QHostAddress 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)); 108 112 return false; 109 113 } … … 112 116 } 113 117 114 QString NetworkItem::updateInfo()118 QString UIHostInterfaceItem::updateInfo() 115 119 { 116 120 /* Update text: */ 117 121 setText(0, m_data.m_interface.m_strName); 118 122 119 /* Update information label */ 120 QString hdr ("<tr><td><nobr>%1: </nobr></td>" 121 "<td><nobr>%2</nobr></td></tr>"); 122 QString sub ("<tr><td><nobr> %1: </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: </nobr></td><td><nobr>%2</nobr></td></tr>"); 125 QString strSubHeader("<tr><td><nobr> %1: </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; 133 134 if (!m_data.m_interface.m_fDhcpClientEnabled) 134 135 { 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; 143 145 if (m_data.m_interface.m_fIpv6Supported) 144 146 { 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; 162 166 if (m_data.m_dhcpserver.m_fDhcpServerEnabled) 163 167 { 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: */ 184 193 UIGlobalSettingsNetwork::UIGlobalSettingsNetwork() 185 : m Validator(0)186 , m AddInterface(0), mRemInterface(0), mEditInterface(0)194 : m_pValidator(0) 195 , m_pAddAction(0), m_pDelAction(0), m_pEditAction(0) 187 196 , m_fChanged(false) 188 197 { 189 /* Apply UI decorations */198 /* Apply UI decorations: */ 190 199 Ui::UIGlobalSettingsNetwork::setupUi (this); 191 200 192 201 #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: */ 249 249 retranslateUi(); 250 250 } … … 301 301 { 302 302 const UIHostNetworkData &data = m_cache.m_items[iNetworkIndex]; 303 NetworkItem *pItem = new NetworkItem;303 UIHostInterfaceItem *pItem = new UIHostInterfaceItem; 304 304 pItem->fetchNetworkData(data); 305 m TwInterfaces->addTopLevelItem(pItem);306 } 307 m TwInterfaces->setCurrentItem(mTwInterfaces->topLevelItem(0));308 updateCurrentItem();305 m_pInterfacesTree->addTopLevelItem(pItem); 306 } 307 m_pInterfacesTree->setCurrentItem(m_pInterfacesTree->topLevelItem(0)); 308 sltUpdateCurrentItem(); 309 309 #ifdef Q_WS_MAC 310 int width = qMax(static_cast<QAbstractItemView*>(m TwInterfaces)->sizeHintForColumn(0) +311 2 * m TwInterfaces->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), 312 312 220); 313 m TwInterfaces->setFixedWidth(width);314 m TwInterfaces->resizeColumnToContents(0);313 m_pInterfacesTree->setFixedWidth(width); 314 m_pInterfacesTree->resizeColumnToContents(0); 315 315 #endif /* Q_WS_MAC */ 316 316 } … … 322 322 /* Upload to cache: */ 323 323 m_cache.m_items.clear(); 324 for (int iNetworkIndex = 0; iNetworkIndex < m TwInterfaces->topLevelItemCount(); ++iNetworkIndex)324 for (int iNetworkIndex = 0; iNetworkIndex < m_pInterfacesTree->topLevelItemCount(); ++iNetworkIndex) 325 325 { 326 326 UIHostNetworkData data; 327 NetworkItem *pItem = static_cast<NetworkItem*>(mTwInterfaces->topLevelItem(iNetworkIndex));327 UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->topLevelItem(iNetworkIndex)); 328 328 pItem->uploadNetworkData(data); 329 329 m_cache.m_items << data; … … 450 450 } 451 451 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: */ 453 void UIGlobalSettingsNetwork::setValidator(QIWidgetValidator *pValidator) 454 { 455 m_pValidator = pValidator; 456 } 457 458 /* Validation processing: */ 459 bool 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: */ 466 void UIGlobalSettingsNetwork::setOrderAfter(QWidget *pWidget) 467 { 468 setTabOrder(pWidget, m_pInterfacesTree); 469 } 470 471 /* Translation stuff: */ 468 472 void UIGlobalSettingsNetwork::retranslateUi() 469 473 { 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: */ 492 void UIGlobalSettingsNetwork::sltAddInterface() 487 493 { 488 494 /* Creating interface item: */ 489 NetworkItem *pItem = new NetworkItem;495 UIHostInterfaceItem *pItem = new UIHostInterfaceItem; 490 496 /* Fill item's data: */ 491 497 UIHostNetworkData data; … … 500 506 pItem->fetchNetworkData(data); 501 507 /* Add new top-level item: */ 502 m TwInterfaces->addTopLevelItem(pItem);503 m TwInterfaces->sortItems(0, Qt::AscendingOrder);504 m TwInterfaces->setCurrentItem(pItem);508 m_pInterfacesTree->addTopLevelItem(pItem); 509 m_pInterfacesTree->sortItems(0, Qt::AscendingOrder); 510 m_pInterfacesTree->setCurrentItem(pItem); 505 511 /* Mark dialog as edited: */ 506 512 m_fChanged = true; 507 513 } 508 514 509 void UIGlobalSettingsNetwork::remInterface() 515 /* Removes selected network interface: */ 516 void UIGlobalSettingsNetwork::sltDelInterface() 510 517 { 511 518 /* Get interface item: */ 512 NetworkItem *pItem = static_cast<NetworkItem*>(mTwInterfaces->currentItem());519 UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem()); 513 520 AssertMsg(pItem, ("Current item should present!\n")); 514 521 /* Get interface name: */ … … 523 530 } 524 531 525 void UIGlobalSettingsNetwork::editInterface() 532 /* Edits selected network interface: */ 533 void UIGlobalSettingsNetwork::sltEditInterface() 526 534 { 527 535 /* 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")); 530 538 /* Edit current item data */ 531 UIGlobalSettingsNetworkDetails details 532 details.getFromItem (item);539 UIGlobalSettingsNetworkDetails details(this); 540 details.getFromItem(pItem); 533 541 if (details.exec() == QDialog::Accepted) 534 542 { 535 543 details.putBackToItem(); 536 item->updateInfo();537 } 538 updateCurrentItem();539 m Validator->revalidate();544 pItem->updateInfo(); 545 } 546 sltUpdateCurrentItem(); 547 m_pValidator->revalidate(); 540 548 /* Mark dialog as edited: */ 541 549 m_fChanged = true; 542 550 } 543 551 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: */ 553 void 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: */ 565 void UIGlobalSettingsNetwork::sltChowContextMenu(const QPoint &pos) 556 566 { 557 567 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); 563 572 } 564 573 else 565 574 { 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 20 20 #define __UIGlobalSettingsNetwork_h__ 21 21 22 /* Local includes */ 22 23 #include "UISettingsPage.h" 23 24 #include "UIGlobalSettingsNetwork.gen.h" 24 25 25 /* Host interface data: */26 /* Global settings / Network page / Host interface data: */ 26 27 struct UIHostInterfaceData 27 28 { … … 36 37 }; 37 38 38 /* DHCP server data: */39 /* Global settings / Network page / DHCP server data: */ 39 40 struct UIDHCPServerData 40 41 { … … 47 48 }; 48 49 49 /* Global network data: */50 /* Global settings / Network page / Full network data: */ 50 51 struct UIHostNetworkData 51 52 { … … 60 61 }; 61 62 62 class NetworkItem : public QTreeWidgetItem 63 /* Global settings / Network page / Host interface item: */ 64 class UIHostInterfaceItem : public QTreeWidgetItem 63 65 { 64 66 public: 65 67 66 NetworkItem(); 68 /* Constructor: */ 69 UIHostInterfaceItem(); 67 70 71 /* Get/return data to/form items: */ 68 72 void fetchNetworkData(const UIHostNetworkData &data); 69 73 void uploadNetworkData(UIHostNetworkData &data); 70 74 71 bool revalidate (QString &aWarning, QString &aTitle); 75 /* Validation stuff: */ 76 bool revalidate(QString &strWarning, QString &strTitle); 72 77 78 /* Helpers: */ 73 79 QString updateInfo(); 74 80 75 /* Page getters*/81 /* Network item getters: */ 76 82 QString name() const { return m_data.m_interface.m_strName; } 77 83 bool isDhcpClientEnabled() const { return m_data.m_interface.m_fDhcpClientEnabled; } … … 88 94 QString dhcpUpperAddress() const { return m_data.m_dhcpserver.m_strDhcpUpperAddress; } 89 95 90 /* Pagesetters */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; } 97 103 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; } 103 109 104 110 private: … … 109 115 110 116 /* Global settings / Network page: */ 111 class UIGlobalSettingsNetwork : public UISettingsPageGlobal, 112 public Ui::UIGlobalSettingsNetwork 117 class UIGlobalSettingsNetwork : public UISettingsPageGlobal, public Ui::UIGlobalSettingsNetwork 113 118 { 114 119 Q_OBJECT; … … 116 121 public: 117 122 123 /* Constructor: */ 118 124 UIGlobalSettingsNetwork(); 119 125 … … 134 140 void saveFromCacheTo(QVariant &data); 135 141 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); 138 145 146 /* Navigation stuff: */ 139 147 void setOrderAfter (QWidget *aWidget); 140 148 149 /* Translation stuff: */ 141 150 void retranslateUi(); 142 151 143 152 private slots: 144 153 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); 150 160 151 161 private: 152 162 153 QIWidgetValidator *mValidator; 163 /* Validator: */ 164 QIWidgetValidator *m_pValidator; 154 165 155 QAction *mAddInterface; 156 QAction *mRemInterface; 157 QAction *mEditInterface; 166 /* Helper actions: */ 167 QAction *m_pAddAction; 168 QAction *m_pDelAction; 169 QAction *m_pEditAction; 158 170 171 /* Editness flag: */ 159 172 bool m_fChanged; 160 173 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.ui
r33882 r34162 1 <?xml version="1.0" encoding="UTF-8"?>2 1 <ui version="4.0"> 3 2 <comment> 4 VBox frontends: Qt4 GUI ( "VirtualBox"):3 VBox frontends: Qt4 GUI ("VirtualBox"): 5 4 6 5 Copyright (C) 2009-2010 Oracle Corporation … … 24 23 </rect> 25 24 </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"> 28 30 <spacer> 29 31 <property name="orientation"> … … 41 43 </spacer> 42 44 </item> 43 <item row="0" column="1" colspan=" 3">44 <widget class="QLabel" name="m LbPageName">45 <item row="0" column="1" colspan="2"> 46 <widget class="QLabel" name="m_pPageNameLabel"> 45 47 <property name="text"> 46 48 <string>&Host-only Networks:</string> 47 49 </property> 48 50 <property name="buddy"> 49 <cstring>m TwInterfaces</cstring>51 <cstring>m_pInterfacesTree</cstring> 50 52 </property> 51 53 </widget> 52 54 </item> 53 55 <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> 78 86 </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> 107 98 </item> 108 <item row="1" column="1" rowspan="2">99 <item row="1" column="1"> 109 100 <spacer> 110 101 <property name="orientation"> … … 117 108 <size> 118 109 <width>20</width> 119 <height> 20</height>110 <height>0</height> 120 111 </size> 121 112 </property> 122 113 </spacer> 123 114 </item> 124 <item row="2" column="2" colspan="2">125 <widget class="QLabel" name="m LbInfo">115 <item row="2" column="2"> 116 <widget class="QLabel" name="m_pInfoLabel"> 126 117 <property name="sizePolicy"> 127 118 <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetails.cpp
r33882 r34162 7 7 8 8 /* 9 * Copyright (C) 2009 Oracle Corporation9 * Copyright (C) 2009-2010 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 18 18 */ 19 19 20 /* VBox Includes */ 20 /* Global includes */ 21 #include <QHostAddress> 22 #include <QRegExpValidator> 23 24 /* Local includes */ 21 25 #include "UIGlobalSettingsNetwork.h" 22 26 #include "UIGlobalSettingsNetworkDetails.h" 23 27 24 /* Qt Includes */ 25 #include <QHostAddress> 26 #include <QRegExpValidator> 27 28 UIGlobalSettingsNetworkDetails::UIGlobalSettingsNetworkDetails (QWidget *aParent) 29 : QIWithRetranslateUI2 <QIDialog> (aParent 28 /* Network page details constructor: */ 29 UIGlobalSettingsNetworkDetails::UIGlobalSettingsNetworkDetails(QWidget *pParent) 30 : QIWithRetranslateUI2<QIDialog>(pParent 30 31 #ifdef Q_WS_MAC 31 32 ,Qt::Sheet 32 33 #endif /* Q_WS_MAC */ 33 34 ) 34 , m Item(0)35 { 36 /* Apply UI decorations */37 Ui::UIGlobalSettingsNetworkDetails::setupUi 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 m LeIPv4->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));53 m LeNMv4->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));54 m LeIPv6->setValidator (new QRegExpValidator (QRegExp (templateIPv6), this));55 m LeNMv6->setValidator (new QRegExpValidator (QRegExp("[1-9][0-9]|1[0-1][0-9]|12[0-8]"), this));56 m LeDhcpAddress->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));57 m LeDhcpMask->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));58 m LeDhcpLowerAddress->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));59 m LeDhcpUpperAddress->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)); 60 61 61 62 /* Setup widgets */ 62 m LeIPv6->setFixedWidthByText (QString().fill ('X', 32) + QString().fill(':', 7));63 64 #if 0 /* defined (Q_WS_WIN 32) */63 m_pIPv6Editor->setFixedWidthByText(QString().fill('X', 32) + QString().fill(':', 7)); 64 65 #if 0 /* defined (Q_WS_WIN) */ 65 66 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); 73 74 #else 74 m CbManual->setVisible(false);75 m_pEnableManualCheckbox->setVisible(false); 75 76 #endif 76 77 77 78 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: */ 93 92 retranslateUi(); 94 93 95 /* Fix minimum possible size */96 resize 94 /* Fix minimum possible size: */ 95 resize(minimumSizeHint()); 97 96 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: */ 101 void 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); 111 111 #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: */ 119 120 void UIGlobalSettingsNetworkDetails::putBackToItem() 120 121 { 121 /* Host-only Interface */122 m Item->setDhcpClientEnabled (!mCbManual->isChecked());123 if (m CbManual->isChecked())124 { 125 m Item->setInterfaceAddress (mLeIPv4->text());126 m Item->setInterfaceMask (mLeNMv4->text());127 if (m Item->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()) 128 129 { 129 m Item->setInterfaceAddress6 (mLeIPv6->text());130 m Item->setInterfaceMaskLength6 (mLeNMv6->text());130 m_pItem->setInterfaceAddress6(m_pIPv6Editor->text()); 131 m_pItem->setInterfaceMaskLength6(m_pNMv6Editor->text()); 131 132 } 132 133 } 133 134 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: */ 145 147 void UIGlobalSettingsNetworkDetails::retranslateUi() 146 148 { 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: */ 154 void 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) 175 178 { 176 m LeIPv6->setText (mItem->interfaceAddress6());177 m LeNMv6->setText (mItem->interfaceMaskLength6());179 m_pIPv6Editor->setText(m_pItem->interfaceAddress6()); 180 m_pNMv6Editor->setText(m_pItem->interfaceMaskLength6()); 178 181 } 179 182 } 180 183 } 181 184 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: */ 186 void 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 6 6 7 7 /* 8 * Copyright (C) 2009 Oracle Corporation8 * Copyright (C) 2009-2010 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 #define __UIGlobalSettingsNetworkDetails_h__ 21 21 22 /* VBoxincludes */22 /* Local includes */ 23 23 #include "QIDialog.h" 24 24 #include "QIWithRetranslateUI.h" 25 25 #include "UIGlobalSettingsNetworkDetails.gen.h" 26 26 27 /* VBox forwards*/28 class NetworkItem;27 /* Forward decalrations: */ 28 class UIHostInterfaceItem; 29 29 30 class UIGlobalSettingsNetworkDetails : public QIWithRetranslateUI2 <QIDialog>, 31 30 /* Global settings / Network page / Details sub-dialog: */ 31 class UIGlobalSettingsNetworkDetails : public QIWithRetranslateUI2<QIDialog>, public Ui::UIGlobalSettingsNetworkDetails 32 32 { 33 33 Q_OBJECT; … … 35 35 public: 36 36 37 UIGlobalSettingsNetworkDetails (QWidget *aParent); 37 /* Constructor: */ 38 UIGlobalSettingsNetworkDetails(QWidget *pParent); 38 39 39 void getFromItem (NetworkItem *aItem); 40 /* Get/return data to/from details sub-dialog: */ 41 void getFromItem(UIHostInterfaceItem *aItem); 40 42 void putBackToItem(); 41 43 42 44 protected: 43 45 46 /* Validation stuff: */ 44 47 void retranslateUi(); 45 48 46 49 private slots: 47 50 48 void dhcpClientStatusChanged(); 49 void dhcpServerStatusChanged(); 51 /* Various helper slots: */ 52 void sltDhcpClientStatusChanged(); 53 void sltDhcpServerStatusChanged(); 50 54 51 55 private: 52 56 53 NetworkItem *mItem;57 UIHostInterfaceItem *m_pItem; 54 58 }; 55 59 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetails.ui
r33882 r34162 1 <ui version="4.0" 1 <ui version="4.0"> 2 2 <comment> 3 3 VBox frontends: Qt4 GUI ("VirtualBox"): 4 4 5 Copyright (C) 2009 Oracle Corporation5 Copyright (C) 2009-2010 Oracle Corporation 6 6 7 7 This file is part of VirtualBox Open Source Edition (OSE), as … … 14 14 </comment> 15 15 <class>UIGlobalSettingsNetworkDetails</class> 16 <widget class="QWidget" name="UIGlobalSettingsNetworkDetails" 17 <property name="geometry" 16 <widget class="QWidget" name="UIGlobalSettingsNetworkDetails"> 17 <property name="geometry"> 18 18 <rect> 19 19 <x>0</x> … … 23 23 </rect> 24 24 </property> 25 <property name="windowTitle" 25 <property name="windowTitle"> 26 26 <string>Host-only Network Details</string> 27 27 </property> 28 <layout class="QVBoxLayout" 28 <layout class="QVBoxLayout"> 29 29 <item> 30 <widget class="QITabWidget" name="m TwDetails">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"> 33 33 <horstretch>0</horstretch> 34 34 <verstretch>0</verstretch> 35 35 </sizepolicy> 36 36 </property> 37 <property name="currentIndex" 37 <property name="currentIndex"> 38 38 <number>0</number> 39 39 </property> 40 <widget class="QWidget" name="m TabInterface">41 <attribute name="title" 40 <widget class="QWidget" name="m_pInterfaceTab"> 41 <attribute name="title"> 42 42 <string>&Adapter</string> 43 43 </attribute> 44 <layout class="QGridLayout" 45 <item row="0" column="0" colspan="3" 46 <widget class="QCheckBox" name="m CbManual">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"> 48 48 <string>Manual &Configuration</string> 49 49 </property> 50 <property name="checked" 50 <property name="checked"> 51 51 <bool>true</bool> 52 52 </property> 53 <property name="toolTip" 53 <property name="toolTip"> 54 54 <string>Use manual configuration for this host-only network adapter.</string> 55 55 </property> 56 56 </widget> 57 57 </item> 58 <item row="1" column="1" 59 <widget class="QLabel" name="m LbIPv4">60 <property name="text" 58 <item row="1" column="1"> 59 <widget class="QLabel" name="m_pIPv4Label"> 60 <property name="text"> 61 61 <string>&IPv4 Address:</string> 62 62 </property> 63 <property name="alignment" 64 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 65 </property> 66 <property name="buddy" 67 <cstring>m LeIPv4</cstring>68 </property> 69 </widget> 70 </item> 71 <item row="1" column="2" 72 <widget class="QILineEdit" name="m LeIPv4">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"> 80 80 <string>Displays the host IPv4 address for this adapter.</string> 81 81 </property> 82 82 </widget> 83 83 </item> 84 <item row="2" column="1" 85 <widget class="QLabel" name="m LbNMv4">86 <property name="text" 84 <item row="2" column="1"> 85 <widget class="QLabel" name="m_pNMv4Label"> 86 <property name="text"> 87 87 <string>IPv4 Network &Mask:</string> 88 88 </property> 89 <property name="alignment" 90 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 91 </property> 92 <property name="buddy" 93 <cstring>m LeNMv4</cstring>94 </property> 95 </widget> 96 </item> 97 <item row="2" column="2" 98 <widget class="QILineEdit" name="m LeNMv4">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"> 106 106 <string>Displays the host IPv4 network mask for this adapter.</string> 107 107 </property> 108 108 </widget> 109 109 </item> 110 <item row="3" column="1" 111 <widget class="QLabel" name="m LbIPv6">112 <property name="text" 110 <item row="3" column="1"> 111 <widget class="QLabel" name="m_pIPv6Label"> 112 <property name="text"> 113 113 <string>I&Pv6 Address:</string> 114 114 </property> 115 <property name="alignment" 116 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 117 </property> 118 <property name="buddy" 119 <cstring>m LeIPv6</cstring>120 </property> 121 </widget> 122 </item> 123 <item row="3" column="2" 124 <widget class="QILineEdit" name="m LeIPv6">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"> 132 132 <string>Displays the host IPv6 address for this adapter if IPv6 is supported.</string> 133 133 </property> 134 134 </widget> 135 135 </item> 136 <item row="4" column="1" 137 <widget class="QLabel" name="m LbNMv6">138 <property name="text" 136 <item row="4" column="1"> 137 <widget class="QLabel" name="m_pNMv6Label"> 138 <property name="text"> 139 139 <string>IPv6 Network Mask &Length:</string> 140 140 </property> 141 <property name="alignment" 142 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 143 </property> 144 <property name="buddy" 145 <cstring>m LeNMv6</cstring>146 </property> 147 </widget> 148 </item> 149 <item row="4" column="2" 150 <widget class="QILineEdit" name="m LeNMv6">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"> 158 158 <string>Displays the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</string> 159 159 </property> 160 160 </widget> 161 161 </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"> 165 165 <enum>Qt::Vertical</enum> 166 166 </property> 167 <property name="sizeHint" stdset="0" 167 <property name="sizeHint" stdset="0"> 168 168 <size> 169 169 <width>0</width> … … 175 175 </layout> 176 176 </widget> 177 <widget class="QWidget" name="m TabDhcpServer">178 <attribute name="title" 177 <widget class="QWidget" name="m_pDhcpServerTab"> 178 <attribute name="title"> 179 179 <string>&DHCP Server</string> 180 180 </attribute> 181 <layout class="QGridLayout" 182 <item row="0" column="0" colspan="3" 183 <widget class="QCheckBox" name="m CbDhcpServerEnabled">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"> 185 185 <string>&Enable Server</string> 186 186 </property> 187 <property name="toolTip" 187 <property name="toolTip"> 188 188 <string>Indicates whether the DHCP Server is enabled on machine startup or not.</string> 189 189 </property> 190 190 </widget> 191 191 </item> 192 <item row="1" column="1" 193 <widget class="QLabel" name="m LbDhcpAddress">194 <property name="text" 192 <item row="1" column="1"> 193 <widget class="QLabel" name="m_pDhcpAddressLabel"> 194 <property name="text"> 195 195 <string>Server Add&ress:</string> 196 196 </property> 197 <property name="alignment" 198 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 199 </property> 200 <property name="buddy" 201 <cstring>m LeDhcpAddress</cstring>202 </property> 203 </widget> 204 </item> 205 <item row="1" column="2" 206 <widget class="QILineEdit" name="m LeDhcpAddress">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"> 214 214 <string>Displays the address of the DHCP server servicing the network associated with this host-only adapter.</string> 215 215 </property> 216 216 </widget> 217 217 </item> 218 <item row="2" column="1" 219 <widget class="QLabel" name="m LbDhcpMask">220 <property name="text" 218 <item row="2" column="1"> 219 <widget class="QLabel" name="m_pDhcpMaskLabel"> 220 <property name="text"> 221 221 <string>Server &Mask:</string> 222 222 </property> 223 <property name="alignment" 224 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 225 </property> 226 <property name="buddy" 227 <cstring>m LeDhcpMask</cstring>228 </property> 229 </widget> 230 </item> 231 <item row="2" column="2" 232 <widget class="QILineEdit" name="m LeDhcpMask">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"> 240 240 <string>Displays the network mask of the DHCP server servicing the network associated with this host-only adapter.</string> 241 241 </property> 242 242 </widget> 243 243 </item> 244 <item row="3" column="1" 245 <widget class="QLabel" name="m LbDhcpLowerAddress">246 <property name="text" 244 <item row="3" column="1"> 245 <widget class="QLabel" name="m_pDhcpLowerAddressLabel"> 246 <property name="text"> 247 247 <string>&Lower Address Bound:</string> 248 248 </property> 249 <property name="alignment" 250 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 251 </property> 252 <property name="buddy" 253 <cstring>m LeDhcpLowerAddress</cstring>254 </property> 255 </widget> 256 </item> 257 <item row="3" column="2" 258 <widget class="QILineEdit" name="m LeDhcpLowerAddress">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"> 266 266 <string>Displays the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</string> 267 267 </property> 268 268 </widget> 269 269 </item> 270 <item row="4" column="1" 271 <widget class="QLabel" name="m LbDhcpUpperAddress">272 <property name="text" 270 <item row="4" column="1"> 271 <widget class="QLabel" name="m_pDhcpUpperAddressLabel"> 272 <property name="text"> 273 273 <string>&Upper Address Bound:</string> 274 274 </property> 275 <property name="alignment" 276 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 277 </property> 278 <property name="buddy" 279 <cstring>m LeDhcpUpperAddress</cstring>280 </property> 281 </widget> 282 </item> 283 <item row="4" column="2" 284 <widget class="QILineEdit" name="m LeDhcpUpperAddress">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"> 292 292 <string>Displays the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</string> 293 293 </property> 294 294 </widget> 295 295 </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"> 299 299 <enum>Qt::Vertical</enum> 300 300 </property> 301 <property name="sizeHint" stdset="0" 301 <property name="sizeHint" stdset="0"> 302 302 <size> 303 303 <width>0</width> … … 312 312 </item> 313 313 <item> 314 <widget class="QIDialogButtonBox" name="m ButtonBox">315 <property name="standardButtons" 314 <widget class="QIDialogButtonBox" name="m_pButtonBox"> 315 <property name="standardButtons"> 316 316 <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> 317 317 </property> … … 340 340 <connections> 341 341 <connection> 342 <sender>m ButtonBox</sender>342 <sender>m_pButtonBox</sender> 343 343 <signal>accepted()</signal> 344 344 <receiver>UIGlobalSettingsNetworkDetails</receiver> 345 345 <slot>accept()</slot> 346 346 <hints> 347 <hint type="sourcelabel" 347 <hint type="sourcelabel"> 348 348 <x>162</x> 349 349 <y>339</y> 350 350 </hint> 351 <hint type="destinationlabel" 351 <hint type="destinationlabel"> 352 352 <x>162</x> 353 353 <y>179</y> … … 356 356 </connection> 357 357 <connection> 358 <sender>m ButtonBox</sender>358 <sender>m_pButtonBox</sender> 359 359 <signal>rejected()</signal> 360 360 <receiver>UIGlobalSettingsNetworkDetails</receiver> 361 361 <slot>reject()</slot> 362 362 <hints> 363 <hint type="sourcelabel" 363 <hint type="sourcelabel"> 364 364 <x>162</x> 365 365 <y>339</y> 366 366 </hint> 367 <hint type="destinationlabel" 367 <hint type="destinationlabel"> 368 368 <x>162</x> 369 369 <y>179</y>
Note:
See TracChangeset
for help on using the changeset viewer.