- Timestamp:
- Jan 15, 2021 12:50:01 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UIDetailsWidgetHostNetwork.cpp
r87219 r87268 75 75 { 76 76 /* Translate tab-widget: */ 77 m_pTabWidget->setTabText(0, tr("&Adapter")); 78 m_pTabWidget->setTabText(1, tr("&DHCP Server")); 77 if (m_pTabWidget) 78 { 79 m_pTabWidget->setTabText(0, tr("&Adapter")); 80 m_pTabWidget->setTabText(1, tr("&DHCP Server")); 81 } 79 82 80 83 /* Translate 'Interface' tab content: */ 81 m_pButtonAutomatic->setText(tr("Configure Adapter &Automatically")); 82 m_pButtonManual->setText(tr("Configure Adapter &Manually")); 83 m_pLabelIPv4->setText(tr("&IPv4 Address:")); 84 m_pEditorIPv4->setToolTip(tr("Holds the host IPv4 address for this adapter.")); 85 m_pLabelNMv4->setText(tr("IPv4 Network &Mask:")); 86 m_pEditorNMv4->setToolTip(tr("Holds the host IPv4 network mask for this adapter.")); 87 m_pLabelIPv6->setText(tr("I&Pv6 Address:")); 88 m_pEditorIPv6->setToolTip(tr("Holds the host IPv6 address for this adapter if IPv6 is supported.")); 89 m_pLabelNMv6->setText(tr("IPv6 Prefix &Length:")); 90 m_pEditorNMv6->setToolTip(tr("Holds the host IPv6 prefix length for this adapter if IPv6 is supported.")); 84 if (m_pButtonAutomatic) 85 m_pButtonAutomatic->setText(tr("Configure Adapter &Automatically")); 86 if (m_pButtonManual) 87 m_pButtonManual->setText(tr("Configure Adapter &Manually")); 88 if (m_pLabelIPv4) 89 m_pLabelIPv4->setText(tr("&IPv4 Address:")); 90 if (m_pEditorIPv4) 91 m_pEditorIPv4->setToolTip(tr("Holds the host IPv4 address for this adapter.")); 92 if (m_pLabelNMv4) 93 m_pLabelNMv4->setText(tr("IPv4 Network &Mask:")); 94 if (m_pEditorNMv4) 95 m_pEditorNMv4->setToolTip(tr("Holds the host IPv4 network mask for this adapter.")); 96 if (m_pLabelIPv6) 97 m_pLabelIPv6->setText(tr("I&Pv6 Address:")); 98 if (m_pEditorIPv6) 99 m_pEditorIPv6->setToolTip(tr("Holds the host IPv6 address for this adapter if IPv6 is supported.")); 100 if (m_pLabelNMv6) 101 m_pLabelNMv6->setText(tr("IPv6 Prefix &Length:")); 102 if (m_pEditorNMv6) 103 m_pEditorNMv6->setToolTip(tr("Holds the host IPv6 prefix length for this adapter if IPv6 is supported.")); 91 104 if (m_pButtonBoxInterface) 92 105 { … … 104 117 105 118 /* Translate 'DHCP server' tab content: */ 106 m_pCheckBoxDHCP->setText(tr("&Enable Server")); 107 m_pCheckBoxDHCP->setToolTip(tr("When checked, the DHCP Server will be enabled for this network on machine start-up.")); 108 m_pLabelDHCPAddress->setText(tr("Server Add&ress:")); 109 m_pEditorDHCPAddress->setToolTip(tr("Holds the address of the DHCP server servicing the network associated with this host-only adapter.")); 110 m_pLabelDHCPMask->setText(tr("Server &Mask:")); 111 m_pEditorDHCPMask->setToolTip(tr("Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.")); 112 m_pLabelDHCPLowerAddress->setText(tr("&Lower Address Bound:")); 113 m_pEditorDHCPLowerAddress->setToolTip(tr("Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.")); 114 m_pLabelDHCPUpperAddress->setText(tr("&Upper Address Bound:")); 115 m_pEditorDHCPUpperAddress->setToolTip(tr("Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.")); 119 if (m_pCheckBoxDHCP) 120 { 121 m_pCheckBoxDHCP->setText(tr("&Enable Server")); 122 m_pCheckBoxDHCP->setToolTip(tr("When checked, the DHCP Server will be enabled for this network on machine start-up.")); 123 } 124 if (m_pLabelDHCPAddress) 125 m_pLabelDHCPAddress->setText(tr("Server Add&ress:")); 126 if (m_pEditorDHCPAddress) 127 m_pEditorDHCPAddress->setToolTip(tr("Holds the address of the DHCP server servicing the network associated with this host-only adapter.")); 128 if (m_pLabelDHCPMask) 129 m_pLabelDHCPMask->setText(tr("Server &Mask:")); 130 if (m_pEditorDHCPMask) 131 m_pEditorDHCPMask->setToolTip(tr("Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.")); 132 if (m_pLabelDHCPLowerAddress) 133 m_pLabelDHCPLowerAddress->setText(tr("&Lower Address Bound:")); 134 if (m_pEditorDHCPLowerAddress) 135 m_pEditorDHCPLowerAddress->setToolTip(tr("Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.")); 136 if (m_pLabelDHCPUpperAddress) 137 m_pLabelDHCPUpperAddress->setText(tr("&Upper Address Bound:")); 138 if (m_pEditorDHCPUpperAddress) 139 m_pEditorDHCPUpperAddress->setToolTip(tr("Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.")); 116 140 if (m_pButtonBoxServer) 117 141 { … … 214 238 void UIDetailsWidgetHostNetwork::sltHandleButtonBoxClick(QAbstractButton *pButton) 215 239 { 216 /* Make sure button-box exists: */217 AssertPtrReturnVoid(m_pButtonBoxInterface);218 AssertPtrReturnVoid(m_pButtonBoxServer);240 /* Make sure button-boxes exist: */ 241 if (!m_pButtonBoxInterface || !m_pButtonBoxServer) 242 return; 219 243 220 244 /* Disable buttons first of all: */ … … 250 274 /* Create layout: */ 251 275 QVBoxLayout *pLayout = new QVBoxLayout(this); 252 AssertPtrReturnVoid(pLayout);276 if (pLayout) 253 277 { 254 278 /* Configure layout: */ … … 264 288 /* Create tab-widget: */ 265 289 m_pTabWidget = new QITabWidget; 266 AssertPtrReturnVoid(m_pTabWidget);290 if (m_pTabWidget) 267 291 { 268 292 /* Prepare 'Interface' tab: */ … … 280 304 /* Create 'Interface' tab: */ 281 305 QWidget *pTabInterface = new QWidget; 282 AssertPtrReturnVoid(pTabInterface);306 if (pTabInterface) 283 307 { 284 308 /* Create 'Interface' layout: */ 285 309 QGridLayout *pLayoutInterface = new QGridLayout(pTabInterface); 286 AssertPtrReturnVoid(pLayoutInterface);310 if (pLayoutInterface) 287 311 { 288 312 #ifdef VBOX_WS_MAC … … 297 321 /* Create automatic interface configuration layout: */ 298 322 QHBoxLayout *pLayoutAutomatic = new QHBoxLayout; 299 AssertPtrReturnVoid(pLayoutAutomatic);323 if (pLayoutAutomatic) 300 324 { 301 325 /* Configure layout: */ … … 304 328 /* Create automatic interface configuration radio-button: */ 305 329 m_pButtonAutomatic = new QRadioButton; 306 AssertPtrReturnVoid(m_pButtonAutomatic);330 if (m_pButtonAutomatic) 307 331 { 308 332 /* Configure radio-button: */ … … 314 338 /* Create automatic interface configuration error pane: */ 315 339 m_pErrorPaneAutomatic = new QLabel; 316 AssertPtrReturnVoid(m_pErrorPaneAutomatic);340 if (m_pErrorPaneAutomatic) 317 341 { 318 342 /* Configure label: */ … … 333 357 /* Create manual interface configuration layout: */ 334 358 QHBoxLayout *pLayoutManual = new QHBoxLayout; 335 AssertPtrReturnVoid(pLayoutManual);359 if (pLayoutManual) 336 360 { 337 361 /* Configure layout: */ … … 339 363 /* Create manual interface configuration radio-button: */ 340 364 m_pButtonManual = new QRadioButton; 341 AssertPtrReturnVoid(m_pButtonManual);365 if (m_pButtonManual) 342 366 { 343 367 /* Configure radio-button: */ … … 349 373 /* Create manual interface configuration error pane: */ 350 374 m_pErrorPaneManual = new QLabel; 351 AssertPtrReturnVoid(m_pErrorPaneManual);375 if (m_pErrorPaneManual) 352 376 { 353 377 /* Configure label: */ … … 368 392 /* Create IPv4 address label: */ 369 393 m_pLabelIPv4 = new QLabel; 370 AssertPtrReturnVoid(m_pLabelIPv4);394 if (m_pLabelIPv4) 371 395 { 372 396 /* Configure label: */ … … 377 401 /* Create IPv4 layout: */ 378 402 QHBoxLayout *pLayoutIPv4 = new QHBoxLayout; 379 AssertPtrReturnVoid(pLayoutIPv4);403 if (pLayoutIPv4) 380 404 { 381 405 /* Configure layout: */ … … 383 407 /* Create IPv4 address editor: */ 384 408 m_pEditorIPv4 = new QILineEdit; 385 AssertPtrReturnVoid(m_pEditorIPv4);409 if (m_pEditorIPv4) 386 410 { 387 411 /* Configure editor: */ … … 394 418 /* Create IPv4 error pane: */ 395 419 m_pErrorPaneIPv4 = new QLabel; 396 AssertPtrReturnVoid(m_pErrorPaneIPv4);420 if (m_pErrorPaneIPv4) 397 421 { 398 422 /* Configure label: */ … … 409 433 /* Create NMv4 network mask label: */ 410 434 m_pLabelNMv4 = new QLabel; 411 AssertPtrReturnVoid(m_pLabelNMv4);435 if (m_pLabelNMv4) 412 436 { 413 437 /* Configure label: */ … … 418 442 /* Create NMv4 layout: */ 419 443 QHBoxLayout *pLayoutNMv4 = new QHBoxLayout; 420 AssertPtrReturnVoid(pLayoutNMv4);444 if (pLayoutNMv4) 421 445 { 422 446 /* Configure layout: */ … … 424 448 /* Create NMv4 network mask editor: */ 425 449 m_pEditorNMv4 = new QILineEdit; 426 AssertPtrReturnVoid(m_pEditorNMv4);450 if (m_pEditorNMv4) 427 451 { 428 452 /* Configure editor: */ … … 435 459 /* Create NMv4 error pane: */ 436 460 m_pErrorPaneNMv4 = new QLabel; 437 AssertPtrReturnVoid(m_pErrorPaneNMv4);461 if (m_pErrorPaneNMv4) 438 462 { 439 463 /* Configure label: */ … … 450 474 /* Create IPv6 address label: */ 451 475 m_pLabelIPv6 = new QLabel; 452 AssertPtrReturnVoid(m_pLabelIPv6);476 if (m_pLabelIPv6) 453 477 { 454 478 /* Configure label: */ … … 459 483 /* Create IPv6 layout: */ 460 484 QHBoxLayout *pLayoutIPv6 = new QHBoxLayout; 461 AssertPtrReturnVoid(pLayoutIPv6);485 if (pLayoutIPv6) 462 486 { 463 487 /* Configure layout: */ … … 465 489 /* Create IPv6 address editor: */ 466 490 m_pEditorIPv6 = new QILineEdit; 467 AssertPtrReturnVoid(m_pEditorIPv6);491 if (m_pEditorIPv6) 468 492 { 469 493 /* Configure editor: */ … … 476 500 /* Create IPv4 error pane: */ 477 501 m_pErrorPaneIPv6 = new QLabel; 478 AssertPtrReturnVoid(m_pErrorPaneIPv6);502 if (m_pErrorPaneIPv6) 479 503 { 480 504 /* Configure label: */ … … 491 515 /* Create NMv6 network mask label: */ 492 516 m_pLabelNMv6 = new QLabel; 493 AssertPtrReturnVoid(m_pLabelNMv6);517 if (m_pLabelNMv6) 494 518 { 495 519 /* Configure label: */ … … 500 524 /* Create NMv6 layout: */ 501 525 QHBoxLayout *pLayoutNMv6 = new QHBoxLayout; 502 AssertPtrReturnVoid(pLayoutNMv6);526 if (pLayoutNMv6) 503 527 { 504 528 /* Configure layout: */ … … 506 530 /* Create NMv6 network mask editor: */ 507 531 m_pEditorNMv6 = new QILineEdit; 508 AssertPtrReturnVoid(m_pEditorNMv6);532 if (m_pEditorNMv6) 509 533 { 510 534 /* Configure editor: */ … … 517 541 /* Create NMv6 error pane: */ 518 542 m_pErrorPaneNMv6 = new QLabel; 519 AssertPtrReturnVoid(m_pErrorPaneNMv6);543 if (m_pErrorPaneNMv6) 520 544 { 521 545 /* Configure label: */ … … 537 561 pLayoutInterface->spacing() - 1; 538 562 QSpacerItem *pSpacer1 = new QSpacerItem(iWidth, 0, QSizePolicy::Fixed, QSizePolicy::Expanding); 539 AssertPtrReturnVoid(pSpacer1);563 if (pSpacer1) 540 564 { 541 565 /* Add into layout: */ … … 544 568 /* Create stretch: */ 545 569 QSpacerItem *pSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 546 AssertPtrReturnVoid(pSpacer2);570 if (pSpacer2) 547 571 { 548 572 /* Add into layout: */ … … 555 579 /* Create button-box: */ 556 580 m_pButtonBoxInterface = new QIDialogButtonBox; 557 AssertPtrReturnVoid(m_pButtonBoxInterface); 558 /* Configure button-box: */ 559 m_pButtonBoxInterface->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 560 connect(m_pButtonBoxInterface, &QIDialogButtonBox::clicked, this, &UIDetailsWidgetHostNetwork::sltHandleButtonBoxClick); 561 562 /* Add into layout: */ 563 pLayoutInterface->addWidget(m_pButtonBoxInterface, 7, 0, 1, 3); 581 if (m_pButtonBoxInterface) 582 { 583 /* Configure button-box: */ 584 m_pButtonBoxInterface->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 585 connect(m_pButtonBoxInterface, &QIDialogButtonBox::clicked, this, &UIDetailsWidgetHostNetwork::sltHandleButtonBoxClick); 586 587 /* Add into layout: */ 588 pLayoutInterface->addWidget(m_pButtonBoxInterface, 7, 0, 1, 3); 589 } 564 590 } 565 591 } … … 573 599 /* Create 'DHCP server' tab: */ 574 600 QWidget *pTabDHCPServer = new QWidget; 575 AssertPtrReturnVoid(pTabDHCPServer);601 if (pTabDHCPServer) 576 602 { 577 603 /* Create 'DHCP server' layout: */ 578 604 QGridLayout *pLayoutDHCPServer = new QGridLayout(pTabDHCPServer); 579 AssertPtrReturnVoid(pLayoutDHCPServer);605 if (pLayoutDHCPServer) 580 606 { 581 607 #ifdef VBOX_WS_MAC … … 590 616 /* Create DHCP server status check-box: */ 591 617 m_pCheckBoxDHCP = new QCheckBox; 592 AssertPtrReturnVoid(m_pCheckBoxDHCP);618 if (m_pCheckBoxDHCP) 593 619 { 594 620 /* Configure check-box: */ … … 604 630 /* Create DHCP address label: */ 605 631 m_pLabelDHCPAddress = new QLabel; 606 AssertPtrReturnVoid(m_pLabelDHCPAddress);632 if (m_pLabelDHCPAddress) 607 633 { 608 634 /* Configure label: */ … … 613 639 /* Create DHCP address layout: */ 614 640 QHBoxLayout *pLayoutDHCPAddress = new QHBoxLayout; 615 AssertPtrReturnVoid(pLayoutDHCPAddress);641 if (pLayoutDHCPAddress) 616 642 { 617 643 /* Configure layout: */ … … 619 645 /* Create DHCP address editor: */ 620 646 m_pEditorDHCPAddress = new QILineEdit; 621 AssertPtrReturnVoid(m_pEditorDHCPAddress);647 if (m_pEditorDHCPAddress) 622 648 { 623 649 /* Configure editor: */ … … 630 656 /* Create DHCP address error pane: */ 631 657 m_pErrorPaneDHCPAddress = new QLabel; 632 AssertPtrReturnVoid(m_pErrorPaneDHCPAddress);658 if (m_pErrorPaneDHCPAddress) 633 659 { 634 660 /* Configure label: */ … … 645 671 /* Create DHCP network mask label: */ 646 672 m_pLabelDHCPMask = new QLabel; 647 AssertPtrReturnVoid(m_pLabelDHCPMask);673 if (m_pLabelDHCPMask) 648 674 { 649 675 /* Configure label: */ … … 654 680 /* Create DHCP mask layout: */ 655 681 QHBoxLayout *pLayoutDHCPMask = new QHBoxLayout; 656 AssertPtrReturnVoid(pLayoutDHCPMask);682 if (pLayoutDHCPMask) 657 683 { 658 684 /* Configure layout: */ … … 660 686 /* Create DHCP network mask editor: */ 661 687 m_pEditorDHCPMask = new QILineEdit; 662 AssertPtrReturnVoid(m_pEditorDHCPMask);688 if (m_pEditorDHCPMask) 663 689 { 664 690 /* Configure editor: */ … … 671 697 /* Create DHCP mask error pane: */ 672 698 m_pErrorPaneDHCPMask = new QLabel; 673 AssertPtrReturnVoid(m_pErrorPaneDHCPMask);699 if (m_pErrorPaneDHCPMask) 674 700 { 675 701 /* Configure label: */ … … 686 712 /* Create DHCP lower address label: */ 687 713 m_pLabelDHCPLowerAddress = new QLabel; 688 AssertPtrReturnVoid(m_pLabelDHCPLowerAddress);714 if (m_pLabelDHCPLowerAddress) 689 715 { 690 716 /* Configure label: */ … … 695 721 /* Create DHCP lower address layout: */ 696 722 QHBoxLayout *pLayoutDHCPLowerAddress = new QHBoxLayout; 697 AssertPtrReturnVoid(pLayoutDHCPLowerAddress);723 if (pLayoutDHCPLowerAddress) 698 724 { 699 725 /* Configure layout: */ … … 701 727 /* Create DHCP lower address editor: */ 702 728 m_pEditorDHCPLowerAddress = new QILineEdit; 703 AssertPtrReturnVoid(m_pEditorDHCPLowerAddress);729 if (m_pEditorDHCPLowerAddress) 704 730 { 705 731 /* Configure editor: */ … … 712 738 /* Create DHCP lower address error pane: */ 713 739 m_pErrorPaneDHCPLowerAddress = new QLabel; 714 AssertPtrReturnVoid(m_pErrorPaneDHCPLowerAddress);740 if (m_pErrorPaneDHCPLowerAddress) 715 741 { 716 742 /* Configure label: */ … … 727 753 /* Create DHCP upper address label: */ 728 754 m_pLabelDHCPUpperAddress = new QLabel; 729 AssertPtrReturnVoid(m_pLabelDHCPUpperAddress);755 if (m_pLabelDHCPUpperAddress) 730 756 { 731 757 /* Configure label: */ … … 736 762 /* Create DHCP upper address layout: */ 737 763 QHBoxLayout *pLayoutDHCPUpperAddress = new QHBoxLayout; 738 AssertPtrReturnVoid(pLayoutDHCPUpperAddress);764 if (pLayoutDHCPUpperAddress) 739 765 { 740 766 /* Configure layout: */ … … 742 768 /* Create DHCP upper address editor: */ 743 769 m_pEditorDHCPUpperAddress = new QILineEdit; 744 AssertPtrReturnVoid(m_pEditorDHCPUpperAddress);770 if (m_pEditorDHCPUpperAddress) 745 771 { 746 772 /* Configure editor: */ … … 753 779 /* Create DHCP upper address error pane: */ 754 780 m_pErrorPaneDHCPUpperAddress = new QLabel; 755 AssertPtrReturnVoid(m_pErrorPaneDHCPUpperAddress);781 if (m_pErrorPaneDHCPUpperAddress) 756 782 { 757 783 /* Configure label: */ … … 773 799 pLayoutDHCPServer->spacing() - 1; 774 800 QSpacerItem *pSpacer1 = new QSpacerItem(iWidth, 0, QSizePolicy::Fixed, QSizePolicy::Expanding); 775 AssertPtrReturnVoid(pSpacer1);801 if (pSpacer1) 776 802 { 777 803 /* Add into layout: */ … … 780 806 /* Create stretch: */ 781 807 QSpacerItem *pSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 782 AssertPtrReturnVoid(pSpacer2);808 if (pSpacer2) 783 809 { 784 810 /* Add into layout: */ … … 791 817 /* Create button-box: */ 792 818 m_pButtonBoxServer = new QIDialogButtonBox; 793 AssertPtrReturnVoid(m_pButtonBoxServer); 794 /* Configure button-box: */ 795 m_pButtonBoxServer->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 796 connect(m_pButtonBoxServer, &QIDialogButtonBox::clicked, this, &UIDetailsWidgetHostNetwork::sltHandleButtonBoxClick); 797 798 /* Add into layout: */ 799 pLayoutDHCPServer->addWidget(m_pButtonBoxServer, 6, 0, 1, 3); 819 if (m_pButtonBoxServer) 820 { 821 /* Configure button-box: */ 822 m_pButtonBoxServer->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 823 connect(m_pButtonBoxServer, &QIDialogButtonBox::clicked, this, &UIDetailsWidgetHostNetwork::sltHandleButtonBoxClick); 824 825 /* Add into layout: */ 826 pLayoutDHCPServer->addWidget(m_pButtonBoxServer, 6, 0, 1, 3); 827 } 800 828 } 801 829 } … … 809 837 /* Toggle IPv4 & IPv6 interface fields availability: */ 810 838 const bool fIsInterfaceConfigurable = !m_newData.m_interface.m_fDHCPEnabled; 811 m_pLabelIPv4->setEnabled(fIsInterfaceConfigurable); 812 m_pLabelNMv4->setEnabled(fIsInterfaceConfigurable); 813 m_pEditorIPv4->setEnabled(fIsInterfaceConfigurable); 814 m_pEditorNMv4->setEnabled(fIsInterfaceConfigurable); 839 if (m_pLabelIPv4) 840 m_pLabelIPv4->setEnabled(fIsInterfaceConfigurable); 841 if (m_pLabelNMv4) 842 m_pLabelNMv4->setEnabled(fIsInterfaceConfigurable); 843 if (m_pEditorIPv4) 844 m_pEditorIPv4->setEnabled(fIsInterfaceConfigurable); 845 if (m_pEditorNMv4) 846 m_pEditorNMv4->setEnabled(fIsInterfaceConfigurable); 815 847 816 848 /* Load IPv4 interface fields: */ 817 m_pButtonAutomatic->setChecked(!fIsInterfaceConfigurable); 818 m_pButtonManual->setChecked(fIsInterfaceConfigurable); 819 m_pEditorIPv4->setText(m_newData.m_interface.m_strAddress); 820 m_pEditorNMv4->setText(m_newData.m_interface.m_strMask); 849 if (m_pButtonAutomatic) 850 m_pButtonAutomatic->setChecked(!fIsInterfaceConfigurable); 851 if (m_pButtonManual) 852 m_pButtonManual->setChecked(fIsInterfaceConfigurable); 853 if (m_pEditorIPv4) 854 m_pEditorIPv4->setText(m_newData.m_interface.m_strAddress); 855 if (m_pEditorNMv4) 856 m_pEditorNMv4->setText(m_newData.m_interface.m_strMask); 821 857 822 858 /* Toggle IPv6 interface fields availability: */ 823 859 const bool fIsIpv6Configurable = fIsInterfaceConfigurable && m_newData.m_interface.m_fSupportedIPv6; 824 m_pLabelIPv6->setEnabled(fIsIpv6Configurable); 825 m_pLabelNMv6->setEnabled(fIsIpv6Configurable); 826 m_pEditorIPv6->setEnabled(fIsIpv6Configurable); 827 m_pEditorNMv6->setEnabled(fIsIpv6Configurable); 860 if (m_pLabelIPv6) 861 m_pLabelIPv6->setEnabled(fIsIpv6Configurable); 862 if (m_pLabelNMv6) 863 m_pLabelNMv6->setEnabled(fIsIpv6Configurable); 864 if (m_pEditorIPv6) 865 m_pEditorIPv6->setEnabled(fIsIpv6Configurable); 866 if (m_pEditorNMv6) 867 m_pEditorNMv6->setEnabled(fIsIpv6Configurable); 828 868 829 869 /* Load IPv6 interface fields: */ 830 m_pEditorIPv6->setText(m_newData.m_interface.m_strAddress6); 831 m_pEditorNMv6->setText(m_newData.m_interface.m_strPrefixLength6); 870 if (m_pEditorIPv6) 871 m_pEditorIPv6->setText(m_newData.m_interface.m_strAddress6); 872 if (m_pEditorNMv6) 873 m_pEditorNMv6->setText(m_newData.m_interface.m_strPrefixLength6); 832 874 } 833 875 … … 836 878 /* Toggle DHCP server fields availability: */ 837 879 const bool fIsDHCPServerEnabled = m_newData.m_dhcpserver.m_fEnabled; 838 m_pLabelDHCPAddress->setEnabled(fIsDHCPServerEnabled); 839 m_pLabelDHCPMask->setEnabled(fIsDHCPServerEnabled); 840 m_pLabelDHCPLowerAddress->setEnabled(fIsDHCPServerEnabled); 841 m_pLabelDHCPUpperAddress->setEnabled(fIsDHCPServerEnabled); 842 m_pEditorDHCPAddress->setEnabled(fIsDHCPServerEnabled); 843 m_pEditorDHCPMask->setEnabled(fIsDHCPServerEnabled); 844 m_pEditorDHCPLowerAddress->setEnabled(fIsDHCPServerEnabled); 845 m_pEditorDHCPUpperAddress->setEnabled(fIsDHCPServerEnabled); 880 if (m_pLabelDHCPAddress) 881 m_pLabelDHCPAddress->setEnabled(fIsDHCPServerEnabled); 882 if (m_pLabelDHCPMask) 883 m_pLabelDHCPMask->setEnabled(fIsDHCPServerEnabled); 884 if (m_pLabelDHCPLowerAddress) 885 m_pLabelDHCPLowerAddress->setEnabled(fIsDHCPServerEnabled); 886 if (m_pLabelDHCPUpperAddress) 887 m_pLabelDHCPUpperAddress->setEnabled(fIsDHCPServerEnabled); 888 if (m_pEditorDHCPAddress) 889 m_pEditorDHCPAddress->setEnabled(fIsDHCPServerEnabled); 890 if (m_pEditorDHCPMask) 891 m_pEditorDHCPMask->setEnabled(fIsDHCPServerEnabled); 892 if (m_pEditorDHCPLowerAddress) 893 m_pEditorDHCPLowerAddress->setEnabled(fIsDHCPServerEnabled); 894 if (m_pEditorDHCPUpperAddress) 895 m_pEditorDHCPUpperAddress->setEnabled(fIsDHCPServerEnabled); 846 896 847 897 /* Load DHCP server fields: */ 848 m_pCheckBoxDHCP->setChecked(fIsDHCPServerEnabled); 849 m_pEditorDHCPAddress->setText(m_newData.m_dhcpserver.m_strAddress); 850 m_pEditorDHCPMask->setText(m_newData.m_dhcpserver.m_strMask); 851 m_pEditorDHCPLowerAddress->setText(m_newData.m_dhcpserver.m_strLowerAddress); 852 m_pEditorDHCPUpperAddress->setText(m_newData.m_dhcpserver.m_strUpperAddress); 898 if (m_pCheckBoxDHCP) 899 m_pCheckBoxDHCP->setChecked(fIsDHCPServerEnabled); 900 if (m_pEditorDHCPAddress) 901 m_pEditorDHCPAddress->setText(m_newData.m_dhcpserver.m_strAddress); 902 if (m_pEditorDHCPMask) 903 m_pEditorDHCPMask->setText(m_newData.m_dhcpserver.m_strMask); 904 if (m_pEditorDHCPLowerAddress) 905 m_pEditorDHCPLowerAddress->setText(m_newData.m_dhcpserver.m_strLowerAddress); 906 if (m_pEditorDHCPUpperAddress) 907 m_pEditorDHCPUpperAddress->setText(m_newData.m_dhcpserver.m_strUpperAddress); 853 908 854 909 /* Invent default values if server was enabled 855 910 * but at least one current value is invalid: */ 856 911 if ( fIsDHCPServerEnabled 912 && m_pEditorDHCPAddress 913 && m_pEditorDHCPMask 914 && m_pEditorDHCPLowerAddress 915 && m_pEditorDHCPUpperAddress 857 916 && ( m_pEditorDHCPAddress->text().isEmpty() 858 917 || m_pEditorDHCPAddress->text() == "0.0.0.0" … … 876 935 { 877 936 /* Validate 'Interface' tab content: */ 878 if ( !pWidget || pWidget == m_pErrorPaneAutomatic)937 if (m_pErrorPaneAutomatic && (!pWidget || pWidget == m_pErrorPaneAutomatic)) 879 938 { 880 939 const bool fError = m_newData.m_interface.m_fDHCPEnabled … … 882 941 m_pErrorPaneAutomatic->setVisible(fError); 883 942 } 884 if ( !pWidget || pWidget == m_pErrorPaneManual)943 if (m_pErrorPaneManual && (!pWidget || pWidget == m_pErrorPaneManual)) 885 944 { 886 945 const bool fError = false; 887 946 m_pErrorPaneManual->setVisible(fError); 888 947 } 889 if ( !pWidget || pWidget == m_pErrorPaneIPv4)948 if (m_pErrorPaneIPv4 && (!pWidget || pWidget == m_pErrorPaneIPv4)) 890 949 { 891 950 const bool fError = !m_newData.m_interface.m_fDHCPEnabled … … 895 954 m_pErrorPaneIPv4->setVisible(fError); 896 955 } 897 if ( !pWidget || pWidget == m_pErrorPaneNMv4)956 if (m_pErrorPaneNMv4 && (!pWidget || pWidget == m_pErrorPaneNMv4)) 898 957 { 899 958 const bool fError = !m_newData.m_interface.m_fDHCPEnabled … … 903 962 m_pErrorPaneNMv4->setVisible(fError); 904 963 } 905 if ( !pWidget || pWidget == m_pErrorPaneIPv6)964 if (m_pErrorPaneIPv6 && (!pWidget || pWidget == m_pErrorPaneIPv6)) 906 965 { 907 966 const bool fError = !m_newData.m_interface.m_fDHCPEnabled … … 912 971 m_pErrorPaneIPv6->setVisible(fError); 913 972 } 914 if ( !pWidget || pWidget == m_pErrorPaneNMv6)973 if (m_pErrorPaneNMv6 && (!pWidget || pWidget == m_pErrorPaneNMv6)) 915 974 { 916 975 bool fIsMaskPrefixLengthNumber = false; … … 925 984 926 985 /* Validate 'DHCP server' tab content: */ 927 if ( !pWidget || pWidget == m_pErrorPaneDHCPAddress)986 if (m_pErrorPaneDHCPAddress && (!pWidget || pWidget == m_pErrorPaneDHCPAddress)) 928 987 { 929 988 const bool fError = m_newData.m_dhcpserver.m_fEnabled … … 932 991 m_pErrorPaneDHCPAddress->setVisible(fError); 933 992 } 934 if ( !pWidget || pWidget == m_pErrorPaneDHCPMask)993 if (m_pErrorPaneDHCPMask && (!pWidget || pWidget == m_pErrorPaneDHCPMask)) 935 994 { 936 995 const bool fError = m_newData.m_dhcpserver.m_fEnabled … … 939 998 m_pErrorPaneDHCPMask->setVisible(fError); 940 999 } 941 if ( !pWidget || pWidget == m_pErrorPaneDHCPLowerAddress)1000 if (m_pErrorPaneDHCPLowerAddress && (!pWidget || pWidget == m_pErrorPaneDHCPLowerAddress)) 942 1001 { 943 1002 const bool fError = m_newData.m_dhcpserver.m_fEnabled … … 946 1005 m_pErrorPaneDHCPLowerAddress->setVisible(fError); 947 1006 } 948 if ( !pWidget || pWidget == m_pErrorPaneDHCPUpperAddress)1007 if (m_pErrorPaneDHCPUpperAddress && (!pWidget || pWidget == m_pErrorPaneDHCPUpperAddress)) 949 1008 { 950 1009 const bool fError = m_newData.m_dhcpserver.m_fEnabled … … 961 1020 { 962 1021 /* Translate 'Interface' tab content: */ 963 if ( !pWidget || pWidget == m_pErrorPaneAutomatic)1022 if (m_pErrorPaneAutomatic && (!pWidget || pWidget == m_pErrorPaneAutomatic)) 964 1023 m_pErrorPaneAutomatic->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> is set to obtain the address automatically " 965 1024 "but the corresponding DHCP server is not enabled.").arg(m_newData.m_interface.m_strName)); 966 if ( !pWidget || pWidget == m_pErrorPaneIPv4)1025 if (m_pErrorPaneIPv4 && (!pWidget || pWidget == m_pErrorPaneIPv4)) 967 1026 m_pErrorPaneIPv4->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> does not currently have a valid " 968 1027 "IPv4 address.").arg(m_newData.m_interface.m_strName)); 969 if ( !pWidget || pWidget == m_pErrorPaneNMv4)1028 if (m_pErrorPaneNMv4 && (!pWidget || pWidget == m_pErrorPaneNMv4)) 970 1029 m_pErrorPaneNMv4->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> does not currently have a valid " 971 1030 "IPv4 network mask.").arg(m_newData.m_interface.m_strName)); 972 if ( !pWidget || pWidget == m_pErrorPaneIPv6)1031 if (m_pErrorPaneIPv6 && (!pWidget || pWidget == m_pErrorPaneIPv6)) 973 1032 m_pErrorPaneIPv6->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> does not currently have a valid " 974 1033 "IPv6 address.").arg(m_newData.m_interface.m_strName)); 975 if ( !pWidget || pWidget == m_pErrorPaneNMv6)1034 if (m_pErrorPaneNMv6 && (!pWidget || pWidget == m_pErrorPaneNMv6)) 976 1035 m_pErrorPaneNMv6->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> does not currently have a valid " 977 1036 "IPv6 prefix length.").arg(m_newData.m_interface.m_strName)); 978 1037 979 1038 /* Translate 'DHCP server' tab content: */ 980 if ( !pWidget || pWidget == m_pErrorPaneDHCPAddress)1039 if (m_pErrorPaneDHCPAddress && (!pWidget || pWidget == m_pErrorPaneDHCPAddress)) 981 1040 m_pErrorPaneDHCPAddress->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> does not currently have a valid " 982 1041 "DHCP server address.").arg(m_newData.m_interface.m_strName)); 983 if ( !pWidget || pWidget == m_pErrorPaneDHCPMask)1042 if (m_pErrorPaneDHCPMask && (!pWidget || pWidget == m_pErrorPaneDHCPMask)) 984 1043 m_pErrorPaneDHCPMask->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> does not currently have a valid " 985 1044 "DHCP server mask.").arg(m_newData.m_interface.m_strName)); 986 if ( !pWidget || pWidget == m_pErrorPaneDHCPLowerAddress)1045 if (m_pErrorPaneDHCPLowerAddress && (!pWidget || pWidget == m_pErrorPaneDHCPLowerAddress)) 987 1046 m_pErrorPaneDHCPLowerAddress->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> does not currently have a valid " 988 1047 "DHCP server lower address bound.").arg(m_newData.m_interface.m_strName)); 989 if ( !pWidget || pWidget == m_pErrorPaneDHCPUpperAddress)1048 if (m_pErrorPaneDHCPUpperAddress && (!pWidget || pWidget == m_pErrorPaneDHCPUpperAddress)) 990 1049 m_pErrorPaneDHCPUpperAddress->setToolTip(tr("Host interface <nobr><b>%1</b></nobr> does not currently have a valid " 991 1050 "DHCP server upper address bound.").arg(m_newData.m_interface.m_strName)); … … 1021 1080 emit sigDataChanged(m_oldData != m_newData); 1022 1081 } 1023
Note:
See TracChangeset
for help on using the changeset viewer.