Changeset 22965 in vbox
- Timestamp:
- Sep 11, 2009 9:34:14 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp
r22964 r22965 44 44 45 45 /* Setup widgets */ 46 mCb Name->setInsertPolicy (QComboBox::NoInsert);46 mCbAdapterName->setInsertPolicy (QComboBox::NoInsert); 47 47 mLeMAC->setValidator (new QRegExpValidator (QRegExp ( 48 48 "[0-9A-Fa-f][02468ACEace][0-9A-Fa-f]{10}"), this)); … … 78 78 79 79 /* Load adapter activity state */ 80 m GbAdapter->setChecked (aAdapter.GetEnabled());80 mCbEnableAdapter->setChecked (aAdapter.GetEnabled()); 81 81 82 82 /* Load adapter type */ … … 109 109 110 110 mLeMAC->setText (mAdapter.GetMACAddress()); 111 mCbCable ->setChecked (mAdapter.GetCableConnected());111 mCbCableConnected->setChecked (mAdapter.GetCableConnected()); 112 112 } 113 113 … … 115 115 { 116 116 /* Save adapter activity state */ 117 mAdapter.SetEnabled (m GbAdapter->isChecked());117 mAdapter.SetEnabled (mCbEnableAdapter->isChecked()); 118 118 119 119 /* Save adapter type */ … … 148 148 149 149 mAdapter.SetMACAddress (mLeMAC->text().isEmpty() ? QString::null : mLeMAC->text()); 150 mAdapter.SetCableConnected (mCbCable ->isChecked());150 mAdapter.SetCableConnected (mCbCableConnected->isChecked()); 151 151 } 152 152 … … 155 155 mValidator = aValidator; 156 156 157 connect (m GbAdapter, SIGNAL (toggled (bool)),157 connect (mCbEnableAdapter, SIGNAL (toggled (bool)), 158 158 mValidator, SLOT (revalidate())); 159 159 connect (mCbAttachmentType, SIGNAL (activated (const QString&)), 160 160 this, SLOT (updateAttachmentAlternative())); 161 connect (mCb Name, SIGNAL (activated (const QString&)),161 connect (mCbAdapterName, SIGNAL (activated (const QString&)), 162 162 this, SLOT (updateAlternativeName())); 163 connect (mCb Name, SIGNAL (editTextChanged (const QString&)),163 connect (mCbAdapterName, SIGNAL (editTextChanged (const QString&)), 164 164 this, SLOT (updateAlternativeName())); 165 165 … … 170 170 { 171 171 /* 'True' for disabled adapter */ 172 if (!m GbAdapter->isChecked())172 if (!mCbEnableAdapter->isChecked()) 173 173 return true; 174 174 … … 210 210 QWidget* VBoxVMSettingsNetwork::setOrderAfter (QWidget *aAfter) 211 211 { 212 setTabOrder (aAfter, m GbAdapter);213 setTabOrder (m GbAdapter, mCbAttachmentType);214 setTabOrder (mCbAttachmentType, mCb Name);215 setTabOrder (mCb Name, mAbsAdvanced);212 setTabOrder (aAfter, mCbEnableAdapter); 213 setTabOrder (mCbEnableAdapter, mCbAttachmentType); 214 setTabOrder (mCbAttachmentType, mCbAdapterName); 215 setTabOrder (mCbAdapterName, mAbsAdvanced); 216 216 setTabOrder (mAbsAdvanced, mCbAdapterType); 217 217 setTabOrder (mCbAdapterType, mLeMAC); 218 218 setTabOrder (mLeMAC, mTbMAC); 219 setTabOrder (mTbMAC, mCbCable );220 return mCbCable ;219 setTabOrder (mTbMAC, mCbCableConnected); 220 return mCbCableConnected; 221 221 } 222 222 … … 275 275 { 276 276 /* Blocking signals to change content manually */ 277 mCb Name->blockSignals (true);277 mCbAdapterName->blockSignals (true); 278 278 279 279 /* Update alternative-name combo-box availability */ 280 mLb Name->setEnabled (attachmentType() != KNetworkAttachmentType_Null &&281 attachmentType() != KNetworkAttachmentType_NAT);282 mCb Name->setEnabled (attachmentType() != KNetworkAttachmentType_Null &&283 attachmentType() != KNetworkAttachmentType_NAT);280 mLbAdapterName->setEnabled (attachmentType() != KNetworkAttachmentType_Null && 281 attachmentType() != KNetworkAttachmentType_NAT); 282 mCbAdapterName->setEnabled (attachmentType() != KNetworkAttachmentType_Null && 283 attachmentType() != KNetworkAttachmentType_NAT); 284 284 285 285 /* Refresh list */ 286 mCb Name->clear();286 mCbAdapterName->clear(); 287 287 switch (attachmentType()) 288 288 { 289 289 case KNetworkAttachmentType_Bridged: 290 mCb Name->insertItems (0, mParent->brgList());291 mCb Name->setEditable (false);290 mCbAdapterName->insertItems (0, mParent->brgList()); 291 mCbAdapterName->setEditable (false); 292 292 break; 293 293 case KNetworkAttachmentType_Internal: 294 mCb Name->insertItems (0, mParent->intList());295 mCb Name->setEditable (true);296 mCb Name->setCompleter (0);294 mCbAdapterName->insertItems (0, mParent->intList()); 295 mCbAdapterName->setEditable (true); 296 mCbAdapterName->setCompleter (0); 297 297 break; 298 298 case KNetworkAttachmentType_HostOnly: 299 mCb Name->insertItems (0, mParent->hoiList());300 mCb Name->setEditable (false);299 mCbAdapterName->insertItems (0, mParent->hoiList()); 300 mCbAdapterName->setEditable (false); 301 301 break; 302 302 default: … … 305 305 306 306 /* Prepend 'empty' or 'default' item */ 307 if (mCb Name->count() == 0)307 if (mCbAdapterName->count() == 0) 308 308 { 309 309 switch (attachmentType()) … … 313 313 { 314 314 /* Adapters list 'empty' */ 315 int pos = mCb Name->findData (emptyItemCode);315 int pos = mCbAdapterName->findData (emptyItemCode); 316 316 if (pos == -1) 317 mCb Name->insertItem (0, tr ("Not selected", "network adapter name"), emptyItemCode);317 mCbAdapterName->insertItem (0, tr ("Not selected", "network adapter name"), emptyItemCode); 318 318 else 319 mCb Name->setItemText (pos, tr ("Not selected", "network adapter name"));319 mCbAdapterName->setItemText (pos, tr ("Not selected", "network adapter name")); 320 320 break; 321 321 } … … 323 323 { 324 324 /* Internal network 'default' name */ 325 if (mCb Name->findText ("intnet") == -1)326 mCb Name->insertItem (0, "intnet");325 if (mCbAdapterName->findText ("intnet") == -1) 326 mCbAdapterName->insertItem (0, "intnet"); 327 327 break; 328 328 } … … 338 338 case KNetworkAttachmentType_HostOnly: 339 339 { 340 int pos = mCb Name->findText (alternativeName());341 mCb Name->setCurrentIndex (pos == -1 ? 0 : pos);340 int pos = mCbAdapterName->findText (alternativeName()); 341 mCbAdapterName->setCurrentIndex (pos == -1 ? 0 : pos); 342 342 break; 343 343 } 344 344 case KNetworkAttachmentType_Internal: 345 345 { 346 int pos = mCb Name->findText (alternativeName());347 mCb Name->setCurrentIndex (pos == -1 ? 0 : pos);346 int pos = mCbAdapterName->findText (alternativeName()); 347 mCbAdapterName->setCurrentIndex (pos == -1 ? 0 : pos); 348 348 break; 349 349 } … … 356 356 357 357 /* Unblocking signals as content is changed already */ 358 mCb Name->blockSignals (false);358 mCbAdapterName->blockSignals (false); 359 359 } 360 360 … … 365 365 case KNetworkAttachmentType_Bridged: 366 366 { 367 QString newName (mCb Name->itemData (mCbName->currentIndex()).toString() ==367 QString newName (mCbAdapterName->itemData (mCbAdapterName->currentIndex()).toString() == 368 368 QString (emptyItemCode) || 369 mCb Name->currentText().isEmpty() ?370 QString::null : mCb Name->currentText());369 mCbAdapterName->currentText().isEmpty() ? 370 QString::null : mCbAdapterName->currentText()); 371 371 if (mBrgName != newName) 372 372 mBrgName = newName; … … 375 375 case KNetworkAttachmentType_Internal: 376 376 { 377 QString newName ((mCb Name->itemData (mCbName->currentIndex()).toString() ==377 QString newName ((mCbAdapterName->itemData (mCbAdapterName->currentIndex()).toString() == 378 378 QString (emptyItemCode) && 379 mCb Name->currentText() ==380 mCb Name->itemText (mCbName->currentIndex())) ||381 mCb Name->currentText().isEmpty() ?382 QString::null : mCb Name->currentText());379 mCbAdapterName->currentText() == 380 mCbAdapterName->itemText (mCbAdapterName->currentIndex())) || 381 mCbAdapterName->currentText().isEmpty() ? 382 QString::null : mCbAdapterName->currentText()); 383 383 if (mIntName != newName) 384 384 { … … 391 391 case KNetworkAttachmentType_HostOnly: 392 392 { 393 QString newName (mCb Name->itemData (mCbName->currentIndex()).toString() ==393 QString newName (mCbAdapterName->itemData (mCbAdapterName->currentIndex()).toString() == 394 394 QString (emptyItemCode) || 395 mCb Name->currentText().isEmpty() ?396 QString::null : mCb Name->currentText());395 mCbAdapterName->currentText().isEmpty() ? 396 QString::null : mCbAdapterName->currentText()); 397 397 if (mHoiName != newName) 398 398 mHoiName = newName; … … 409 409 void VBoxVMSettingsNetwork::toggleAdvanced() 410 410 { 411 mLbA Type->setVisible (mAbsAdvanced->isExpanded());411 mLbAdapterType->setVisible (mAbsAdvanced->isExpanded()); 412 412 mCbAdapterType->setVisible (mAbsAdvanced->isExpanded()); 413 413 mLbMAC->setVisible (mAbsAdvanced->isExpanded()); 414 414 mLeMAC->setVisible (mAbsAdvanced->isExpanded()); 415 415 mTbMAC->setVisible (mAbsAdvanced->isExpanded()); 416 mCbCable ->setVisible (mAbsAdvanced->isExpanded());416 mCbCableConnected->setVisible (mAbsAdvanced->isExpanded()); 417 417 } 418 418 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsNetwork.ui
r22964 r22965 29 29 <layout class="QGridLayout" name="VBoxVMSettingsNetworkGridLayout"> 30 30 <item row="0" column="0" colspan="2"> 31 <widget class="QCheckBox" name="m GbAdapter" >31 <widget class="QCheckBox" name="mCbEnableAdapter" > 32 32 <property name="whatsThis" > 33 33 <string>When checked, plugs this virtual network adapter into the virtual machine.</string> … … 64 64 </property> 65 65 <item row="0" column="0" > 66 <widget class="QLabel" name="mLb NAType">66 <widget class="QLabel" name="mLbAttachmentType"> 67 67 <property name="text" > 68 68 <string>&Attached to:</string> … … 79 79 <widget class="QComboBox" name="mCbAttachmentType"> 80 80 <property name="sizePolicy"> 81 <sizepolicy hsizetype=" Preferred" vsizetype="Fixed">81 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 82 82 <horstretch>0</horstretch> 83 83 <verstretch>0</verstretch> … … 90 90 </item> 91 91 <item row="1" column="0" > 92 <widget class="QLabel" name="mLb Name">92 <widget class="QLabel" name="mLbAdapterName"> 93 93 <property name="text" > 94 94 <string>&Name:</string> … … 98 98 </property> 99 99 <property name="buddy" > 100 <cstring>mCb Name</cstring>101 </property> 102 </widget> 103 </item> 104 <item row="1" column="1" >105 <widget class="QComboBox" name="mCb Name">106 <property name="sizePolicy"> 107 <sizepolicy hsizetype=" Preferred" vsizetype="Fixed">108 <horstretch> 0</horstretch>100 <cstring>mCbAdapterName</cstring> 101 </property> 102 </widget> 103 </item> 104 <item row="1" column="1" colspan="3"> 105 <widget class="QComboBox" name="mCbAdapterName"> 106 <property name="sizePolicy"> 107 <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> 108 <horstretch>1</horstretch> 109 109 <verstretch>0</verstretch> 110 110 </sizepolicy> … … 116 116 </item> 117 117 <item row="2" column="0"> 118 <widget class="QIArrowButtonSwitch" native="1" name="mAbsAdvanced"> 119 <property name="text"> 120 <string>A&dvanced</string> 121 </property> 122 <property name="whatsThis" > 123 <string>Shows/hide additional network adapter options.</string> 124 </property> 125 </widget> 118 <layout class="QHBoxLayout" name="mLtAdvancedBtn"> 119 <property name="margin"> 120 <number>0</number> 121 </property> 122 <item> 123 <spacer name="horizontalSpacer2"> 124 <property name="orientation"> 125 <enum>Qt::Horizontal</enum> 126 </property> 127 <property name="sizeHint" stdset="0"> 128 <size> 129 <width>0</width> 130 <height>0</height> 131 </size> 132 </property> 133 </spacer> 134 </item> 135 <item> 136 <widget class="QIArrowButtonSwitch" native="1" name="mAbsAdvanced"> 137 <property name="text"> 138 <string>A&dvanced</string> 139 </property> 140 <property name="whatsThis" > 141 <string>Shows/hide additional network adapter options.</string> 142 </property> 143 </widget> 144 </item> 145 </layout> 126 146 </item> 127 147 <item row="3" column="0"> 128 <widget class="QLabel" name="mLbA Type">148 <widget class="QLabel" name="mLbAdapterType"> 129 149 <property name="text"> 130 150 <string>Adapter &Type:</string> … … 141 161 <widget class="QComboBox" name="mCbAdapterType"> 142 162 <property name="sizePolicy"> 143 <sizepolicy hsizetype=" Preferred" vsizetype="Fixed">144 <horstretch> 0</horstretch>163 <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> 164 <horstretch>1</horstretch> 145 165 <verstretch>0</verstretch> 146 166 </sizepolicy> … … 168 188 <property name="sizePolicy"> 169 189 <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> 170 <horstretch> 0</horstretch>190 <horstretch>1</horstretch> 171 191 <verstretch>0</verstretch> 172 192 </sizepolicy> … … 174 194 <property name="whatsThis"> 175 195 <string>Displays the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</string> 176 </property>177 <property name="frame">178 <bool>true</bool>179 196 </property> 180 197 </widget> … … 195 212 </item> 196 213 <item row="5" column="1" colspan="3"> 197 <widget class="QCheckBox" name="mCbCable ">214 <widget class="QCheckBox" name="mCbCableConnected"> 198 215 <property name="whatsThis"> 199 216 <string>Indicates whether the virtual network cable is plugged in on machine startup or not.</string> … … 204 221 </widget> 205 222 </item> 206 <item rowspan="2" row="0" column="2" colspan="2">207 <spacer name="horizontalSpacer3">208 <property name="orientation">209 <enum>Qt::Horizontal</enum>210 </property>211 <property name="sizeHint" stdset="0">212 <size>213 <width>40</width>214 <height>20</height>215 </size>216 </property>217 </spacer>218 </item>219 223 </layout> 220 224 </widget> 221 225 </item> 222 <item row="1" column="2"> 223 <spacer name="horizontalSpacer2"> 224 <property name="orientation"> 225 <enum>Qt::Horizontal</enum> 226 </property> 227 <property name="sizeHint" stdset="0"> 228 <size> 229 <width>0</width> 230 <height>0</height> 231 </size> 232 </property> 233 </spacer> 234 </item> 235 <item row="4" column="0" colspan="3"> 226 <item row="4" column="0" colspan="2"> 236 227 <spacer name="verticalSpacer"> 237 228 <property name="orientation"> … … 266 257 <connections> 267 258 <connection> 268 <sender>m GbAdapter</sender>259 <sender>mCbEnableAdapter</sender> 269 260 <signal>toggled(bool)</signal> 270 261 <receiver>mNetworkChild</receiver>
Note:
See TracChangeset
for help on using the changeset viewer.