Changeset 86001 in vbox
- Timestamp:
- Sep 2, 2020 2:49:16 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/global
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.cpp
r85808 r86001 40 40 , m_ipv6rules(ipv6rules) 41 41 , m_pCheckboxNetwork(0) 42 , m_pWidgetSettings(0) 42 43 , m_pLabelNetworkName(0) 44 , m_pEditorNetworkName(0) 43 45 , m_pLabelNetworkCIDR(0) 44 , m_pLabelOptionsAdvanced(0)45 , m_pEditorNetworkName(0)46 46 , m_pEditorNetworkCIDR(0) 47 , m_pLabelExtended(0) 47 48 , m_pCheckboxSupportsDHCP(0) 48 49 , m_pCheckboxSupportsIPv6(0) 49 50 , m_pCheckboxAdvertiseDefaultIPv6Route(0) 50 51 , m_pButtonPortForwarding(0) 51 , m_pContainerOptions(0) 52 { 53 prepareWidgets(); 54 52 , m_pButtonBox(0) 53 { 54 prepare(); 55 } 56 57 void UIGlobalSettingsNetworkDetailsNAT::prepare() 58 { 55 59 /* Setup dialog: */ 56 60 setWindowIcon(QIcon(":/guesttools_16px.png")); 57 61 62 /* Prepare everything: */ 63 prepareWidgets(); 64 prepareConnections(); 65 58 66 /* Apply language settings: */ 59 67 retranslateUi(); … … 62 70 load(); 63 71 64 /* Fix minimum possible size: */ 65 resize(minimumSizeHint()); 66 setFixedSize(minimumSizeHint()); 72 /* Adjust dialog size: */ 73 adjustSize(); 74 75 #ifdef VBOX_WS_MAC 76 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 77 setFixedSize(minimumSize()); 78 #endif /* VBOX_WS_MAC */ 67 79 } 68 80 69 81 void UIGlobalSettingsNetworkDetailsNAT::prepareWidgets() 70 82 { 71 if (objectName().isEmpty()) 72 setObjectName(QStringLiteral("UIGlobalSettingsNetworkDetailsNAT")); 73 QGridLayout *pGridLayout = new QGridLayout(this); 74 pGridLayout->setObjectName(QStringLiteral("pGridLayout")); 75 m_pCheckboxNetwork = new QCheckBox(); 76 m_pCheckboxNetwork->setObjectName(QStringLiteral("m_pCheckboxNetwork")); 77 pGridLayout->addWidget(m_pCheckboxNetwork, 0, 0, 1, 1); 78 79 m_pContainerOptions = new QWidget(); 80 m_pContainerOptions->setObjectName(QStringLiteral("m_pContainerOptions")); 81 QGridLayout *pGridLayout1 = new QGridLayout(m_pContainerOptions); 82 pGridLayout1->setObjectName(QStringLiteral("pGridLayout1")); 83 pGridLayout1->setContentsMargins(0, 0, 0, 0); 84 QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum); 85 pGridLayout1->addItem(pSpacerItem, 0, 0, 1, 1); 86 87 m_pLabelNetworkName = new QLabel(m_pContainerOptions); 88 m_pLabelNetworkName->setObjectName(QStringLiteral("m_pLabelNetworkName")); 89 m_pLabelNetworkName->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 90 pGridLayout1->addWidget(m_pLabelNetworkName, 0, 1, 1, 1); 91 92 m_pEditorNetworkName = new QLineEdit(m_pContainerOptions); 93 m_pEditorNetworkName->setObjectName(QStringLiteral("m_pEditorNetworkName")); 94 pGridLayout1->addWidget(m_pEditorNetworkName, 0, 2, 1, 2); 95 96 m_pLabelNetworkCIDR = new QLabel(m_pContainerOptions); 97 m_pLabelNetworkCIDR->setObjectName(QStringLiteral("m_pLabelNetworkCIDR")); 98 m_pLabelNetworkCIDR->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 99 pGridLayout1->addWidget(m_pLabelNetworkCIDR, 1, 1, 1, 1); 100 101 m_pEditorNetworkCIDR = new QLineEdit(m_pContainerOptions); 102 m_pEditorNetworkCIDR->setObjectName(QStringLiteral("m_pEditorNetworkCIDR")); 103 pGridLayout1->addWidget(m_pEditorNetworkCIDR, 1, 2, 1, 2); 104 105 m_pLabelOptionsAdvanced = new QLabel(m_pContainerOptions); 106 m_pLabelOptionsAdvanced->setObjectName(QStringLiteral("m_pLabelOptionsAdvanced")); 107 m_pLabelOptionsAdvanced->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignTop); 108 pGridLayout1->addWidget(m_pLabelOptionsAdvanced, 2, 1, 1, 1); 109 110 m_pCheckboxSupportsDHCP = new QCheckBox(m_pContainerOptions); 111 m_pCheckboxSupportsDHCP->setObjectName(QStringLiteral("m_pCheckboxSupportsDHCP")); 112 pGridLayout1->addWidget(m_pCheckboxSupportsDHCP, 2, 2, 1, 1); 113 114 m_pCheckboxSupportsIPv6 = new QCheckBox(m_pContainerOptions); 115 m_pCheckboxSupportsIPv6->setObjectName(QStringLiteral("m_pCheckboxSupportsIPv6")); 116 pGridLayout1->addWidget(m_pCheckboxSupportsIPv6, 3, 2, 1, 1); 117 118 m_pCheckboxAdvertiseDefaultIPv6Route = new QCheckBox(m_pContainerOptions); 119 m_pCheckboxAdvertiseDefaultIPv6Route->setObjectName(QStringLiteral("m_pCheckboxAdvertiseDefaultIPv6Route")); 120 pGridLayout1->addWidget(m_pCheckboxAdvertiseDefaultIPv6Route, 4, 2, 1, 1); 121 122 m_pButtonPortForwarding = new QPushButton(m_pContainerOptions); 123 m_pButtonPortForwarding->setObjectName(QStringLiteral("m_pButtonPortForwarding")); 124 pGridLayout1->addWidget(m_pButtonPortForwarding, 5, 2, 1, 1); 125 pGridLayout->addWidget(m_pContainerOptions, 1, 0, 1, 2); 126 127 QSpacerItem *pSpacerItem1 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 128 pGridLayout->addItem(pSpacerItem1, 2, 0, 1, 2); 129 130 QIDialogButtonBox *pButtonBox = new QIDialogButtonBox(); 131 pButtonBox->setObjectName(QStringLiteral("pButtonBox")); 132 pButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok); 133 pGridLayout->addWidget(pButtonBox, 3, 0, 1, 2); 134 135 m_pLabelNetworkName->setBuddy(m_pEditorNetworkName); 136 m_pLabelNetworkCIDR->setBuddy(m_pEditorNetworkCIDR); 137 138 QObject::connect(m_pCheckboxNetwork, &QCheckBox::toggled, m_pContainerOptions, &QWidget::setEnabled); 139 QObject::connect(m_pCheckboxSupportsIPv6, &QCheckBox::toggled, m_pCheckboxAdvertiseDefaultIPv6Route, &QCheckBox::setEnabled); 140 QObject::connect(m_pButtonPortForwarding, &QPushButton::clicked, this, &UIGlobalSettingsNetworkDetailsNAT::sltEditPortForwarding); 141 QObject::connect(pButtonBox, &QIDialogButtonBox::accepted, this, &UIGlobalSettingsNetworkDetailsNAT::accept); 142 QObject::connect(pButtonBox, &QIDialogButtonBox::rejected, this, &UIGlobalSettingsNetworkDetailsNAT::reject); 143 83 /* Prepare main layout: */ 84 QGridLayout *pLayoutMain = new QGridLayout(this); 85 if (pLayoutMain) 86 { 87 pLayoutMain->setRowStretch(2, 1); 88 89 /* Prepare network check-box: */ 90 m_pCheckboxNetwork = new QCheckBox(this); 91 pLayoutMain->addWidget(m_pCheckboxNetwork, 0, 0, 1, 2); 92 93 /* Prepare 20-px shifting spacer: */ 94 QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum); 95 if (pSpacerItem) 96 pLayoutMain->addItem(pSpacerItem, 1, 0); 97 98 /* Prepare settings widget: */ 99 m_pWidgetSettings = new QWidget(this); 100 if (m_pWidgetSettings) 101 { 102 /* Prepare settings widget layout: */ 103 QGridLayout *pLayoutSettings = new QGridLayout(m_pWidgetSettings); 104 if (pLayoutSettings) 105 { 106 pLayoutSettings->setContentsMargins(0, 0, 0, 0); 107 pLayoutSettings->setColumnStretch(3, 1); 108 109 /* Prepare network name label: */ 110 m_pLabelNetworkName = new QLabel(m_pWidgetSettings); 111 if (m_pLabelNetworkName) 112 { 113 m_pLabelNetworkName->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 114 pLayoutSettings->addWidget(m_pLabelNetworkName, 0, 0); 115 } 116 /* Prepare network name editor: */ 117 m_pEditorNetworkName = new QLineEdit(m_pWidgetSettings); 118 if (m_pEditorNetworkName) 119 { 120 if (m_pLabelNetworkName) 121 m_pLabelNetworkName->setBuddy(m_pEditorNetworkName); 122 pLayoutSettings->addWidget(m_pEditorNetworkName, 0, 1, 1, 3); 123 } 124 125 /* Prepare network CIDR label: */ 126 m_pLabelNetworkCIDR = new QLabel(m_pWidgetSettings); 127 if (m_pLabelNetworkCIDR) 128 { 129 m_pLabelNetworkCIDR->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 130 pLayoutSettings->addWidget(m_pLabelNetworkCIDR, 1, 0); 131 } 132 /* Prepare network CIDR editor: */ 133 m_pEditorNetworkCIDR = new QLineEdit(m_pWidgetSettings); 134 if (m_pEditorNetworkCIDR) 135 { 136 if (m_pLabelNetworkCIDR) 137 m_pLabelNetworkCIDR->setBuddy(m_pEditorNetworkCIDR); 138 pLayoutSettings->addWidget(m_pEditorNetworkCIDR, 1, 1, 1, 3); 139 } 140 141 /* Prepare extended label: */ 142 m_pLabelExtended = new QLabel(m_pWidgetSettings); 143 if (m_pLabelExtended) 144 { 145 m_pLabelExtended->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 146 pLayoutSettings->addWidget(m_pLabelExtended, 2, 0); 147 } 148 /* Prepare 'supports DHCP' check-box: */ 149 m_pCheckboxSupportsDHCP = new QCheckBox(m_pWidgetSettings); 150 if (m_pCheckboxSupportsDHCP) 151 pLayoutSettings->addWidget(m_pCheckboxSupportsDHCP, 2, 1, 1, 2); 152 /* Prepare 'supports IPv6' check-box: */ 153 m_pCheckboxSupportsIPv6 = new QCheckBox(m_pWidgetSettings); 154 if (m_pCheckboxSupportsIPv6) 155 pLayoutSettings->addWidget(m_pCheckboxSupportsIPv6, 3, 1, 1, 2); 156 /* Prepare 'advertise default IPv6 route' check-box: */ 157 m_pCheckboxAdvertiseDefaultIPv6Route = new QCheckBox(m_pWidgetSettings); 158 if (m_pCheckboxAdvertiseDefaultIPv6Route) 159 pLayoutSettings->addWidget(m_pCheckboxAdvertiseDefaultIPv6Route, 4, 1, 1, 2); 160 161 /* Prepare port forwarding button: */ 162 m_pButtonPortForwarding = new QPushButton(m_pWidgetSettings); 163 if (m_pButtonPortForwarding) 164 pLayoutSettings->addWidget(m_pButtonPortForwarding, 5, 1); 165 } 166 167 pLayoutMain->addWidget(m_pWidgetSettings, 1, 1); 168 } 169 170 /* Prepare dialog button-box button: */ 171 m_pButtonBox = new QIDialogButtonBox(this); 172 if (m_pButtonBox) 173 { 174 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 175 pLayoutMain->addWidget(m_pButtonBox, 3, 0, 1, 2); 176 } 177 } 178 } 179 180 void UIGlobalSettingsNetworkDetailsNAT::prepareConnections() 181 { 182 connect(m_pCheckboxNetwork, &QCheckBox::toggled, m_pWidgetSettings, &QWidget::setEnabled); 183 connect(m_pCheckboxSupportsIPv6, &QCheckBox::toggled, m_pCheckboxAdvertiseDefaultIPv6Route, &QCheckBox::setEnabled); 184 connect(m_pButtonPortForwarding, &QPushButton::clicked, this, &UIGlobalSettingsNetworkDetailsNAT::sltEditPortForwarding); 185 connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UIGlobalSettingsNetworkDetailsNAT::accept); 186 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIGlobalSettingsNetworkDetailsNAT::reject); 144 187 } 145 188 … … 153 196 m_pLabelNetworkCIDR->setText(tr("Network &CIDR:")); 154 197 m_pEditorNetworkCIDR->setToolTip(tr("Holds the CIDR for this network.")); 155 m_pLabel OptionsAdvanced->setText(tr("Network Options:"));198 m_pLabelExtended->setText(tr("Network Options:")); 156 199 m_pCheckboxSupportsDHCP->setText(tr("Supports &DHCP")); 157 200 m_pCheckboxSupportsDHCP->setToolTip(tr("When checked, this network will support DHCP.")); … … 171 214 /* Update availability: */ 172 215 m_pCheckboxAdvertiseDefaultIPv6Route->setEnabled(m_pCheckboxSupportsIPv6->isChecked()); 173 m_p ContainerOptions->setEnabled(m_pCheckboxNetwork->isChecked());216 m_pWidgetSettings->setEnabled(m_pCheckboxNetwork->isChecked()); 174 217 } 175 218 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h
r85796 r86001 31 31 class QLabel; 32 32 class QLineEdit; 33 class QIDialogButtonBox; 33 34 34 35 /** Global settings: Network page: NAT network data structure. */ … … 110 111 private: 111 112 113 /* Prepares all. */ 114 void prepare(); 112 115 /* Prepares widgets. */ 113 116 void prepareWidgets(); 117 /* Prepares connections. */ 118 void prepareConnections(); 114 119 115 120 /* Helpers: Load/Save stuff: */ … … 127 132 /** @name Widgets 128 133 * @{ */ 129 QCheckBox *m_pCheckboxNetwork; 130 QLabel *m_pLabelNetworkName; 131 QLabel *m_pLabelNetworkCIDR; 132 QLabel *m_pLabelOptionsAdvanced; 133 QLineEdit *m_pEditorNetworkName; 134 QLineEdit *m_pEditorNetworkCIDR; 135 QCheckBox *m_pCheckboxSupportsDHCP; 136 QCheckBox *m_pCheckboxSupportsIPv6; 137 QCheckBox *m_pCheckboxAdvertiseDefaultIPv6Route; 138 QPushButton *m_pButtonPortForwarding; 139 QWidget *m_pContainerOptions; 134 /** Holds the network check-box instance. */ 135 QCheckBox *m_pCheckboxNetwork; 136 /** Holds the settings widget instance. */ 137 QWidget *m_pWidgetSettings; 138 /** Holds the network name label instance. */ 139 QLabel *m_pLabelNetworkName; 140 /** Holds the network name editor instance. */ 141 QLineEdit *m_pEditorNetworkName; 142 /** Holds the network CIDR label instance. */ 143 QLabel *m_pLabelNetworkCIDR; 144 /** Holds the network CIDR editor instance. */ 145 QLineEdit *m_pEditorNetworkCIDR; 146 /** Holds the extended label instance. */ 147 QLabel *m_pLabelExtended; 148 /** Holds the 'supports DHCP' check-box instance. */ 149 QCheckBox *m_pCheckboxSupportsDHCP; 150 /** Holds the 'supports IPv6' check-box instance. */ 151 QCheckBox *m_pCheckboxSupportsIPv6; 152 /** Holds the 'advertise default IPv6 route' check-box instance. */ 153 QCheckBox *m_pCheckboxAdvertiseDefaultIPv6Route; 154 /** Holds the port forwarding button instance. */ 155 QPushButton *m_pButtonPortForwarding; 156 /** Holds the dialog button-box instance. */ 157 QIDialogButtonBox *m_pButtonBox; 140 158 /** @} */ 141 159 };
Note:
See TracChangeset
for help on using the changeset viewer.