儲存庫 vbox 的更動 66781
- 時間撮記:
- 2017-5-4 上午10:58:22 (8 年 以前)
- 位置:
- trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork
- 檔案:
-
- 修改 3 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkDetailsDialog.cpp
r66761 r66781 23 23 # include <QCheckBox> 24 24 # include <QLabel> 25 # include <QRadioButton> 26 # include <QRegExpValidator> 25 27 # include <QStyleOption> 26 # include <QRegExpValidator>27 28 # include <QVBoxLayout> 28 29 … … 42 43 : QIWithRetranslateUI2<QWidget>(pParent) 43 44 , m_pTabWidget(0) 45 , m_pButtonAutomatic(0), m_pButtonManual(0) 44 46 , m_pLabelIPv4(0), m_pEditorIPv4(0), m_pLabelNMv4(0), m_pEditorNMv4(0) 45 47 , m_pLabelIPv6(0), m_pEditorIPv6(0), m_pLabelNMv6(0), m_pEditorNMv6(0) … … 106 108 107 109 /* Translate 'Interface' tab content: */ 110 m_pButtonAutomatic->setText(tr("Configure Adapter &Automatically")); 111 m_pButtonManual->setText(tr("Configure Adapter &Manually")); 108 112 m_pLabelIPv4->setText(tr("&IPv4 Address:")); 109 113 m_pEditorIPv4->setToolTip(tr("Holds the host IPv4 address for this adapter.")); … … 179 183 pLayoutInterface->setContentsMargins(10, 10, 10, 10); 180 184 #endif 185 /* Create automatic interface configuration radio-button: */ 186 m_pButtonAutomatic = new QRadioButton; 187 AssertPtrReturnVoid(m_pButtonAutomatic); 188 { 189 /* Configure radio-button: */ 190 connect(m_pButtonAutomatic, &QRadioButton::toggled, 191 this, &UIHostNetworkDetailsDialog::sltToggledButtonAutomatic); 192 /* Add into layout: */ 193 pLayoutInterface->addWidget(m_pButtonAutomatic, 0, 0, 1, 3); 194 } 195 /* Create manual interface configuration radio-button: */ 196 m_pButtonManual = new QRadioButton; 197 AssertPtrReturnVoid(m_pButtonManual); 198 { 199 /* Configure radio-button: */ 200 connect(m_pButtonManual, &QRadioButton::toggled, 201 this, &UIHostNetworkDetailsDialog::sltToggledButtonManual); 202 /* Add into layout: */ 203 pLayoutInterface->addWidget(m_pButtonManual, 1, 0, 1, 3); 204 } 181 205 /* Create IPv4 address label: */ 182 206 m_pLabelIPv4 = new QLabel; … … 186 210 m_pLabelIPv4->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 187 211 /* Add into layout: */ 188 pLayoutInterface->addWidget(m_pLabelIPv4, 0, 0);212 pLayoutInterface->addWidget(m_pLabelIPv4, 2, 1); 189 213 } 190 214 /* Create IPv4 address editor: */ … … 197 221 this, &UIHostNetworkDetailsDialog::sltTextChangedIPv4); 198 222 /* Add into layout: */ 199 pLayoutInterface->addWidget(m_pEditorIPv4, 0, 1);223 pLayoutInterface->addWidget(m_pEditorIPv4, 2, 2); 200 224 } 201 225 /* Create IPv4 network mask label: */ … … 206 230 m_pLabelNMv4->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 207 231 /* Add into layout: */ 208 pLayoutInterface->addWidget(m_pLabelNMv4, 1, 0);232 pLayoutInterface->addWidget(m_pLabelNMv4, 3, 1); 209 233 } 210 234 /* Create IPv4 network mask editor: */ … … 217 241 this, &UIHostNetworkDetailsDialog::sltTextChangedNMv4); 218 242 /* Add into layout: */ 219 pLayoutInterface->addWidget(m_pEditorNMv4, 1, 1);243 pLayoutInterface->addWidget(m_pEditorNMv4, 3, 2); 220 244 } 221 245 /* Create IPv6 address label: */ … … 226 250 m_pLabelIPv6->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 227 251 /* Add into layout: */ 228 pLayoutInterface->addWidget(m_pLabelIPv6, 2, 0);252 pLayoutInterface->addWidget(m_pLabelIPv6, 4, 1); 229 253 } 230 254 /* Create IPv6 address editor: */ … … 237 261 this, &UIHostNetworkDetailsDialog::sltTextChangedIPv6); 238 262 /* Add into layout: */ 239 pLayoutInterface->addWidget(m_pEditorIPv6, 2, 1);263 pLayoutInterface->addWidget(m_pEditorIPv6, 4, 2); 240 264 } 241 265 /* Create IPv6 network mask label: */ … … 246 270 m_pLabelNMv6->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 247 271 /* Add into layout: */ 248 pLayoutInterface->addWidget(m_pLabelNMv6, 3, 0);272 pLayoutInterface->addWidget(m_pLabelNMv6, 5, 1); 249 273 } 250 274 /* Create IPv6 network mask editor: */ … … 257 281 this, &UIHostNetworkDetailsDialog::sltTextChangedNMv6); 258 282 /* Add into layout: */ 259 pLayoutInterface->addWidget(m_pEditorNMv6, 3, 1); 283 pLayoutInterface->addWidget(m_pEditorNMv6, 5, 2); 284 } 285 /* Create indent: */ 286 QStyleOption options; 287 options.initFrom(m_pButtonManual); 288 const int iWidth = m_pButtonManual->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, &options, m_pButtonManual) + 289 m_pButtonManual->style()->pixelMetric(QStyle::PM_RadioButtonLabelSpacing, &options, m_pButtonManual) - 290 pLayoutInterface->spacing() - 1; 291 QSpacerItem *pSpacer1 = new QSpacerItem(iWidth, 0, QSizePolicy::Fixed, QSizePolicy::Expanding); 292 AssertPtrReturnVoid(pSpacer1); 293 { 294 /* Add into layout: */ 295 pLayoutInterface->addItem(pSpacer1, 2, 0, 4); 260 296 } 261 297 /* Create stretch: */ 262 QSpacerItem *pSpacer 1= new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);263 AssertPtrReturnVoid(pSpacer 1);264 { 265 /* Add into layout: */ 266 pLayoutInterface->addItem(pSpacer 1, 4, 0, 1, 2);298 QSpacerItem *pSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 299 AssertPtrReturnVoid(pSpacer2); 300 { 301 /* Add into layout: */ 302 pLayoutInterface->addItem(pSpacer2, 6, 0, 1, 3); 267 303 } 268 304 } … … 379 415 QStyleOption options; 380 416 options.initFrom(m_pCheckBoxDHCP); 381 const int iWidth2 = m_pCheckBoxDHCP->style()->pixelMetric(QStyle::PM_IndicatorWidth, &options, m_pCheckBoxDHCP) + 382 m_pCheckBoxDHCP->style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, &options, m_pCheckBoxDHCP) - 383 pLayoutDHCPServer->spacing() - 1; 384 QSpacerItem *pSpacer2 = new QSpacerItem(iWidth2, 0, QSizePolicy::Fixed, QSizePolicy::Expanding); 417 const int iWidth = m_pCheckBoxDHCP->style()->pixelMetric(QStyle::PM_IndicatorWidth, &options, m_pCheckBoxDHCP) + 418 m_pCheckBoxDHCP->style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, &options, m_pCheckBoxDHCP) - 419 pLayoutDHCPServer->spacing() - 1; 420 QSpacerItem *pSpacer1 = new QSpacerItem(iWidth, 0, QSizePolicy::Fixed, QSizePolicy::Expanding); 421 AssertPtrReturnVoid(pSpacer1); 422 { 423 /* Add into layout: */ 424 pLayoutDHCPServer->addItem(pSpacer1, 1, 0, 4); 425 } 426 /* Create stretch: */ 427 QSpacerItem *pSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 385 428 AssertPtrReturnVoid(pSpacer2); 386 429 { 387 430 /* Add into layout: */ 388 pLayoutDHCPServer->addItem(pSpacer2, 1, 0, 4); 389 } 390 /* Create stretch: */ 391 QSpacerItem *pSpacer3 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 392 AssertPtrReturnVoid(pSpacer3); 393 { 394 /* Add into layout: */ 395 pLayoutDHCPServer->addItem(pSpacer3, 5, 0, 1, 3); 431 pLayoutDHCPServer->addItem(pSpacer2, 5, 0, 1, 3); 396 432 } 397 433 } … … 403 439 void UIHostNetworkDetailsDialog::loadDataForInterface() 404 440 { 441 /* Toggle IPv4 & IPv6 interface fields availability: */ 442 const bool fIsInterfaceConfigurable = !m_newData.m_interface.m_fDHCPEnabled; 443 m_pLabelIPv4->setEnabled(fIsInterfaceConfigurable); 444 m_pLabelNMv4->setEnabled(fIsInterfaceConfigurable); 445 m_pEditorIPv4->setEnabled(fIsInterfaceConfigurable); 446 m_pEditorNMv4->setEnabled(fIsInterfaceConfigurable); 447 405 448 /* Load IPv4 interface fields: */ 449 m_pButtonAutomatic->setChecked(!fIsInterfaceConfigurable); 450 m_pButtonManual->setChecked(fIsInterfaceConfigurable); 406 451 m_pEditorIPv4->setText(m_newData.m_interface.m_strAddress); 407 452 m_pEditorNMv4->setText(m_newData.m_interface.m_strMask); 408 453 409 454 /* Toggle IPv6 interface fields availability: */ 410 const bool fIsIpv6 Supported =m_newData.m_interface.m_fSupportedIPv6;411 m_pLabelIPv6->setEnabled(fIsIpv6 Supported);412 m_pLabelNMv6->setEnabled(fIsIpv6 Supported);413 m_pEditorIPv6->setEnabled(fIsIpv6 Supported);414 m_pEditorNMv6->setEnabled(fIsIpv6 Supported);455 const bool fIsIpv6Configurable = fIsInterfaceConfigurable && m_newData.m_interface.m_fSupportedIPv6; 456 m_pLabelIPv6->setEnabled(fIsIpv6Configurable); 457 m_pLabelNMv6->setEnabled(fIsIpv6Configurable); 458 m_pEditorIPv6->setEnabled(fIsIpv6Configurable); 459 m_pEditorNMv6->setEnabled(fIsIpv6Configurable); 415 460 416 461 /* Load IPv6 interface fields: */ -
trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkDetailsDialog.h
r66726 r66781 28 28 class QCheckBox; 29 29 class QLabel; 30 class QRadioButton; 30 31 class QILineEdit; 31 32 class QITabWidget; … … 38 39 UIDataHostNetworkInterface() 39 40 : m_strName(QString()) 41 , m_fDHCPEnabled(false) 40 42 , m_strAddress(QString()) 41 43 , m_strMask(QString()) … … 50 52 return true 51 53 && (m_strName == other.m_strName) 54 && (m_fDHCPEnabled == other.m_fDHCPEnabled) 52 55 && (m_strAddress == other.m_strAddress) 53 56 && (m_strMask == other.m_strMask) … … 65 68 /** Holds interface name. */ 66 69 QString m_strName; 70 /** Holds whether DHCP is enabled for that interface. */ 71 bool m_fDHCPEnabled; 67 72 /** Holds IPv4 interface address. */ 68 73 QString m_strAddress; … … 181 186 /** @name Change handling stuff. 182 187 * @{ */ 188 /** Handles interface automatic configuration choice change. */ 189 void sltToggledButtonAutomatic(bool fChecked) { m_newData.m_interface.m_fDHCPEnabled = fChecked; loadDataForInterface(); notify(); } 190 /** Handles interface manual configuration choice change. */ 191 void sltToggledButtonManual(bool fChecked) { m_newData.m_interface.m_fDHCPEnabled = !fChecked; loadDataForInterface(); notify(); } 183 192 /** Handles interface IPv4 text change. */ 184 193 void sltTextChangedIPv4(const QString &strText) { m_newData.m_interface.m_strAddress = strText; notify(); } … … 252 261 /** @name Interface variables. 253 262 * @{ */ 263 /** Holds the automatic interface configuration button. */ 264 QRadioButton *m_pButtonAutomatic; 265 /** Holds the manual interface configuration button. */ 266 QRadioButton *m_pButtonManual; 254 267 /** Holds the IPv4 address label. */ 255 QLabel *m_pLabelIPv4;268 QLabel *m_pLabelIPv4; 256 269 /** Holds the IPv4 address editor. */ 257 QILineEdit *m_pEditorIPv4;270 QILineEdit *m_pEditorIPv4; 258 271 /** Holds the IPv4 network mask label. */ 259 QLabel *m_pLabelNMv4;272 QLabel *m_pLabelNMv4; 260 273 /** Holds the IPv4 network mask editor. */ 261 QILineEdit *m_pEditorNMv4;274 QILineEdit *m_pEditorNMv4; 262 275 /** Holds the IPv6 address label. */ 263 QLabel *m_pLabelIPv6;276 QLabel *m_pLabelIPv6; 264 277 /** Holds the IPv6 address editor. */ 265 QILineEdit *m_pEditorIPv6;278 QILineEdit *m_pEditorIPv6; 266 279 /** Holds the IPv6 network mask label. */ 267 QLabel *m_pLabelNMv6;280 QLabel *m_pLabelNMv6; 268 281 /** Holds the IPv6 network mask editor. */ 269 QILineEdit *m_pEditorNMv6;282 QILineEdit *m_pEditorNMv6; 270 283 /** @} */ 271 284 -
trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.cpp
r66729 r66781 102 102 /* Interface information: */ 103 103 strToolTip += strHeader.arg(UIHostNetworkManager::tr("Adapter")) 104 .arg(UIHostNetworkManager::tr("Manually configured", "interface")); 104 .arg(m_interface.m_fDHCPEnabled ? 105 UIHostNetworkManager::tr("Automatically configured", "interface") : 106 UIHostNetworkManager::tr("Manually configured", "interface")); 105 107 strToolTip += strSubHeader.arg(UIHostNetworkManager::tr("IPv4 Address")) 106 108 .arg(m_interface.m_strAddress.isEmpty() ? … … 477 479 else 478 480 { 479 /* Save IPv4 interface configuration: */ 480 if ( comInterface.isOk() 481 && ( newData.m_interface.m_strAddress != oldData.m_interface.m_strAddress 482 || newData.m_interface.m_strMask != oldData.m_interface.m_strMask)) 483 comInterface.EnableStaticIPConfig(newData.m_interface.m_strAddress, newData.m_interface.m_strMask); 484 /* Save IPv6 interface configuration: */ 485 if ( comInterface.isOk() 486 && newData.m_interface.m_fSupportedIPv6 487 && ( newData.m_interface.m_strAddress6 != oldData.m_interface.m_strAddress6 488 || newData.m_interface.m_strMaskLength6 != oldData.m_interface.m_strMaskLength6)) 489 comInterface.EnableStaticIPConfigV6(newData.m_interface.m_strAddress6, newData.m_interface.m_strMaskLength6.toULong()); 481 /* Save automatic interface configuration: */ 482 if (newData.m_interface.m_fDHCPEnabled) 483 { 484 if ( comInterface.isOk() 485 && !oldData.m_interface.m_fDHCPEnabled) 486 comInterface.EnableDynamicIPConfig(); 487 } 488 /* Save manual interface configuration: */ 489 else 490 { 491 /* Save IPv4 interface configuration: */ 492 if ( comInterface.isOk() 493 && ( oldData.m_interface.m_fDHCPEnabled 494 || newData.m_interface.m_strAddress != oldData.m_interface.m_strAddress 495 || newData.m_interface.m_strMask != oldData.m_interface.m_strMask)) 496 comInterface.EnableStaticIPConfig(newData.m_interface.m_strAddress, newData.m_interface.m_strMask); 497 /* Save IPv6 interface configuration: */ 498 if ( comInterface.isOk() 499 && newData.m_interface.m_fSupportedIPv6 500 && ( oldData.m_interface.m_fDHCPEnabled 501 || newData.m_interface.m_strAddress6 != oldData.m_interface.m_strAddress6 502 || newData.m_interface.m_strMaskLength6 != oldData.m_interface.m_strMaskLength6)) 503 comInterface.EnableStaticIPConfigV6(newData.m_interface.m_strAddress6, newData.m_interface.m_strMaskLength6.toULong()); 504 } 490 505 491 506 /* Show error message if necessary: */ … … 976 991 data.m_interface.m_strName = comInterface.GetName(); 977 992 if (comInterface.isOk()) 993 data.m_interface.m_fDHCPEnabled = comInterface.GetDHCPEnabled(); 994 if (comInterface.isOk()) 978 995 data.m_interface.m_strAddress = comInterface.GetIPAddress(); 979 996 if (comInterface.isOk())
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器