Changeset 6364 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 16, 2008 4:28:15 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui
r5999 r6364 6 6 7 7 Copyright (C) 2006-2007 innotek GmbH 8 8 9 9 This file is part of VirtualBox Open Source Edition (OSE), as 10 10 available from http://www.virtualbox.org. This file is free software; … … 97 97 </property> 98 98 </widget> 99 <widget class="QLineEdit" row="2" column="1"> 99 <widget class="QLabel" row="2" column="0"> 100 <property name="name"> 101 <cstring>txInternalNetwork_WIN</cstring> 102 </property> 103 <property name="sizePolicy"> 104 <sizepolicy> 105 <hsizetype>0</hsizetype> 106 <vsizetype>5</vsizetype> 107 <horstretch>0</horstretch> 108 <verstretch>0</verstretch> 109 </sizepolicy> 110 </property> 111 <property name="text"> 112 <string>&Network Name</string> 113 </property> 114 <property name="buddy" stdset="0"> 115 <cstring>cbInternalNetworkName_WIN</cstring> 116 </property> 117 </widget> 118 <widget class="QLineEdit" row="3" column="1"> 100 119 <property name="name"> 101 120 <cstring>leMACAddress</cstring> … … 127 146 </property> 128 147 </widget> 129 <widget class="QToolButton" row=" 2" column="2">148 <widget class="QToolButton" row="3" column="2"> 130 149 <property name="name"> 131 150 <cstring>pbGenerateMAC</cstring> … … 168 187 </property> 169 188 </widget> 170 <widget class="QLabel" row=" 2" column="0">189 <widget class="QLabel" row="3" column="0"> 171 190 <property name="name"> 172 191 <cstring>txMACAddress</cstring> … … 193 212 <property name="whatsThis" stdset="0"> 194 213 <string>Displays the name of the host interface selected for this adapter.</string> 214 </property> 215 </widget> 216 <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="2"> 217 <property name="name"> 218 <cstring>cbInternalNetworkName_WIN</cstring> 219 </property> 220 <property name="editable"> 221 <bool>true</bool> 222 </property> 223 <property name="insertionPolicy"> 224 <enum>NoInsertion</enum> 225 </property> 226 <property name="autoCompletion"> 227 <bool>true</bool> 228 </property> 229 <property name="duplicatesEnabled"> 230 <bool>false</bool> 231 </property> 232 <property name="whatsThis" stdset="0"> 233 <string>Displays the name of the internal network selected for this adapter.</string> 195 234 </property> 196 235 </widget> … … 528 567 </vbox> 529 568 </widget> 569 <widget class="QGroupBox"> 570 <property name="name"> 571 <cstring>grbIntNet</cstring> 572 </property> 573 <property name="title"> 574 <string>Internal Network Settings</string> 575 </property> 576 <property name="flat"> 577 <bool>false</bool> 578 </property> 579 <hbox> 580 <property name="name"> 581 <cstring>unnamed</cstring> 582 </property> 583 <widget class="QLabel"> 584 <property name="name"> 585 <cstring>txInternalNetwork_X11</cstring> 586 </property> 587 <property name="text"> 588 <string>&Network Name</string> 589 </property> 590 <property name="buddy" stdset="0"> 591 <cstring>cbInternalNetworkName_X11</cstring> 592 </property> 593 </widget> 594 <widget class="QComboBox"> 595 <property name="name"> 596 <cstring>cbInternalNetworkName_X11</cstring> 597 </property> 598 <property name="editable"> 599 <bool>true</bool> 600 </property> 601 <property name="insertionPolicy"> 602 <enum>NoInsertion</enum> 603 </property> 604 <property name="autoCompletion"> 605 <bool>true</bool> 606 </property> 607 <property name="duplicatesEnabled"> 608 <bool>false</bool> 609 </property> 610 </widget> 611 </hbox> 612 </widget> 613 <spacer> 614 <property name="name"> 615 <cstring>spacer5</cstring> 616 </property> 617 <property name="orientation"> 618 <enum>Vertical</enum> 619 </property> 620 <property name="sizeType"> 621 <enum>Expanding</enum> 622 </property> 623 <property name="sizeHint"> 624 <size> 625 <width>0</width> 626 <height>0</height> 627 </size> 628 </property> 629 </spacer> 530 630 </vbox> 531 631 </widget> … … 559 659 <tabstop>cbNetworkAttachment</tabstop> 560 660 <tabstop>cbHostInterfaceName</tabstop> 661 <tabstop>cbInternalNetworkName_WIN</tabstop> 561 662 <tabstop>leMACAddress</tabstop> 562 663 </tabstops> … … 583 684 <functions> 584 685 <function access="private" specifier="non virtual">init()</function> 585 <function returnType="bool">isPageValid( const QStringList & )</function> 586 <function>loadList( const QStringList &, const QString & )</function> 686 <function returnType="int">checkPage( const QStringList & )</function> 687 <function>loadInterfaceList( const QStringList &, const QString & )</function> 688 <function>loadNetworksList( const QStringList & )</function> 587 689 <function>getFromAdapter( const CNetworkAdapter & )</function> 588 690 <function>putBackToAdapter()</function> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
r5999 r6364 50 50 /* disable unused interface name UI */ 51 51 grbTAP->setHidden (true); 52 grbIntNet->setHidden (true); 52 53 connect (grbEnabled, SIGNAL (toggled (bool)), 53 54 this, SLOT (grbEnabledToggled (bool))); … … 56 57 txHostInterface_WIN->setHidden (true); 57 58 cbHostInterfaceName->setHidden (true); 59 txInternalNetwork_WIN->setHidden (true); 60 cbInternalNetworkName_WIN->setHidden (true); 58 61 /* setup iconsets */ 59 62 pbTAPSetup->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png", … … 73 76 } 74 77 75 bool VBoxVMNetworkSettings::isPageValid (const QStringList &aList) 76 { 77 #if defined Q_WS_WIN 78 int VBoxVMNetworkSettings::checkPage (const QStringList &aList) 79 { 78 80 CEnums::NetworkAttachmentType type = 79 81 vboxGlobal().toNetworkAttachmentType (cbNetworkAttachment->currentText()); 80 81 return !(type == CEnums::HostInterfaceNetworkAttachment && 82 isInterfaceInvalid (aList, cbHostInterfaceName->currentText())); 82 #if defined Q_WS_WIN 83 if (type == CEnums::HostInterfaceNetworkAttachment && 84 isInterfaceInvalid (aList, cbHostInterfaceName->currentText())) 85 return 1; 86 else if (type == CEnums::InternalNetworkAttachment && 87 cbInternalNetworkName_WIN->currentText().isEmpty()) 88 return 2; 89 else 90 return 0; 83 91 #else 84 92 NOREF (aList); 85 return true; 86 #endif 87 } 88 89 void VBoxVMNetworkSettings::loadList (const QStringList &aList, 90 const QString &aNillItem) 93 if (type == CEnums::InternalNetworkAttachment && 94 cbInternalNetworkName_X11->currentText().isEmpty()) 95 return 2; 96 else 97 return 0; 98 #endif 99 } 100 101 void VBoxVMNetworkSettings::loadInterfaceList (const QStringList &aList, 102 const QString &aNillItem) 91 103 { 92 104 #if defined Q_WS_WIN … … 112 124 NOREF (aNillItem); 113 125 #endif 126 } 127 128 void VBoxVMNetworkSettings::loadNetworksList (const QStringList &aList) 129 { 130 QComboBox *cbNetworkName = 0; 131 #if defined Q_WS_WIN 132 cbNetworkName = cbInternalNetworkName_WIN; 133 #else 134 cbNetworkName = cbInternalNetworkName_X11; 135 #endif 136 Assert (cbNetworkName); 137 cbNetworkName->clear(); 138 cbNetworkName->clearEdit(); 139 cbNetworkName->insertStringList (aList); 114 140 } 115 141 … … 144 170 if (cbHostInterfaceName->currentItem() == -1) 145 171 cbHostInterfaceName->setCurrentText (name); 172 cbInternalNetworkName_WIN->setCurrentText (adapter.GetInternalNetwork()); 146 173 #else 147 174 leHostInterface->setText (adapter.GetHostInterface()); 175 cbInternalNetworkName_X11->setCurrentText (adapter.GetInternalNetwork()); 148 176 #endif 149 177 … … 201 229 #endif 202 230 } 231 else if (type == CEnums::InternalNetworkAttachment) 232 { 233 #if defined Q_WS_WIN 234 if (!cbInternalNetworkName_WIN->currentText().isEmpty()) 235 cadapter.SetInternalNetwork (cbInternalNetworkName_WIN->currentText()); 236 #else 237 if (!cbInternalNetworkName_X11->currentText().isEmpty()) 238 cadapter.SetInternalNetwork (cbInternalNetworkName_X11->currentText()); 239 #endif 240 } 203 241 } 204 242 … … 230 268 bool enableHostIf = vboxGlobal().toNetworkAttachmentType (aString) == 231 269 CEnums::HostInterfaceNetworkAttachment; 270 bool enableIntNet = vboxGlobal().toNetworkAttachmentType (aString) == 271 CEnums::InternalNetworkAttachment; 232 272 #if defined Q_WS_WIN 233 273 txHostInterface_WIN->setEnabled (enableHostIf); 234 274 cbHostInterfaceName->setEnabled (enableHostIf); 275 txInternalNetwork_WIN->setEnabled (enableIntNet); 276 cbInternalNetworkName_WIN->setEnabled (enableIntNet); 235 277 #else 236 278 grbTAP->setEnabled (enableHostIf); 279 grbIntNet->setEnabled (enableIntNet); 237 280 #endif 238 281 } -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r5999 r6364 6 6 7 7 Copyright (C) 2006-2007 innotek GmbH 8 8 9 9 This file is part of VirtualBox Open Source Edition (OSE), as 10 10 available from http://www.virtualbox.org. This file is free software; … … 3204 3204 <variable access="private">CMachine cmachine;</variable> 3205 3205 <variable access="private">QStringList mInterfaceList;</variable> 3206 <variable access="private">QStringList mNetworksList;</variable> 3206 3207 <variable access="private">QWidgetStack *wstUSBFilters;</variable> 3207 3208 <variable access="private">bool mUSBFilterListModified;</variable> … … 3274 3275 <function access="private" returnType="QString">getHdInfo( QGroupBox*, QUuid )</function> 3275 3276 <function access="private">loadInterfacesList()</function> 3277 <function access="private">loadNetworksList()</function> 3276 3278 </functions> 3277 3279 <pixmapinproject/> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r6076 r6364 878 878 879 879 loadInterfacesList(); 880 loadNetworksList(); 880 881 881 882 /* … … 1020 1021 } 1021 1022 1023 void VBoxVMSettingsDlg::loadNetworksList() 1024 { 1025 /* clear inner list */ 1026 mNetworksList.clear(); 1027 /* loading internal networks list */ 1028 CVirtualBox vbox = vboxGlobal().virtualBox(); 1029 ulong count = vbox.GetSystemProperties().GetNetworkAdapterCount(); 1030 CMachineEnumerator en = vbox.GetMachines().Enumerate(); 1031 while (en.HasMore()) 1032 { 1033 CMachine machine = en.GetNext(); 1034 for (ulong slot = 0; slot < count; ++ slot) 1035 { 1036 CNetworkAdapter adapter = machine.GetNetworkAdapter (slot); 1037 if (adapter.GetAttachmentType() == CEnums::InternalNetworkAttachment && 1038 !mNetworksList.contains (adapter.GetInternalNetwork())) 1039 mNetworksList << adapter.GetInternalNetwork(); 1040 } 1041 } 1042 } 1043 1022 1044 void VBoxVMSettingsDlg::hostInterfaceAdd() 1023 1045 { … … 1143 1165 #if defined Q_WS_WIN 1144 1166 VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (aWidget); 1145 set->load List (mInterfaceList, mNoInterfaces);1167 set->loadInterfaceList (mInterfaceList, mNoInterfaces); 1146 1168 set->revalidate(); 1147 1169 #endif … … 1495 1517 { 1496 1518 QWidget *tab = NULL; 1519 int error = 0; 1497 1520 for (int index = 0; index < tbwNetwork->count(); ++ index) 1498 1521 { … … 1500 1523 VBoxVMNetworkSettings *page = 1501 1524 static_cast <VBoxVMNetworkSettings *> (tab); 1502 valid = page->isPageValid (mInterfaceList); 1525 error = page->checkPage (mInterfaceList); 1526 valid = !error; 1503 1527 if (!valid) break; 1504 1528 } … … 1506 1530 { 1507 1531 Assert (tab); 1508 warningText = tr ("Incorrect host network interface is selected"); 1532 warningText = error == 1 ? 1533 tr ("Incorrect host network interface is selected") : error == 2 ? 1534 tr ("Internal network name should be defined") : QString::null; 1509 1535 pageTitle += ": " + tbwNetwork->tabLabel (tab); 1510 1536 } … … 2307 2333 { 2308 2334 VBoxVMNetworkSettings *page = new VBoxVMNetworkSettings(); 2309 page->loadList (mInterfaceList, mNoInterfaces); 2335 page->loadInterfaceList (mInterfaceList, mNoInterfaces); 2336 page->loadNetworksList (mNetworksList); 2310 2337 page->getFromAdapter (aAdapter); 2311 2338 QString pageTitle = QString (tr ("Adapter %1", "network")) … … 2319 2346 2320 2347 /* setup validation */ 2348 QComboBox *cbNetworkName = 0; 2349 #ifdef Q_WS_WIN 2350 cbNetworkName = page->cbInternalNetworkName_WIN; 2351 #else 2352 cbNetworkName = page->cbInternalNetworkName_X11; 2353 #endif 2354 Assert (cbNetworkName); 2355 2321 2356 QIWidgetValidator *wval = 2322 2357 new QIWidgetValidator (QString ("%1: %2") … … 2325 2360 connect (page->grbEnabled, SIGNAL (toggled (bool)), wval, SLOT (revalidate())); 2326 2361 connect (page->cbNetworkAttachment, SIGNAL (activated (const QString &)), 2362 wval, SLOT (revalidate())); 2363 connect (cbNetworkName, SIGNAL (activated (const QString &)), 2364 wval, SLOT (revalidate())); 2365 connect (cbNetworkName, SIGNAL (textChanged (const QString &)), 2327 2366 wval, SLOT (revalidate())); 2328 2367 connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)),
Note:
See TracChangeset
for help on using the changeset viewer.