Changeset 2400 in vbox for trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
- Timestamp:
- Apr 27, 2007 2:42:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
r2394 r2400 104 104 void VBoxVMNetworkSettings::init() 105 105 { 106 mInterfaceNumber = 0;107 106 mNoInterfaces = tr ("<No suitable interfaces>"); 108 107 … … 171 170 } 172 171 173 void VBoxVMNetworkSettings::loadList (const QStringList &aList, 174 int aInterfaceNumber) 175 { 176 #if defined Q_WS_WIN 177 mInterfaceNumber = aInterfaceNumber; 172 void VBoxVMNetworkSettings::loadList (const QStringList &aList) 173 { 174 #if defined Q_WS_WIN 178 175 /* save current list item name */ 179 176 QString currentListItemName = leHostInterfaceName->text(); … … 190 187 #else 191 188 NOREF (aList); 192 NOREF (aInterfaceNumber);193 189 #endif 194 190 } … … 394 390 AllowSetForegroundWindow (ASFW_ANY); 395 391 392 /* search for the max available interface index */ 393 int ifaceNumber = 0; 394 QString ifaceName = tr ("VirtualBox Host Interface %1"); 395 QRegExp regExp (QString ("^") + ifaceName.arg ("([0-9]+)") + QString ("$")); 396 for (uint index = 0; index < lbHostInterface->count(); ++ index) 397 { 398 QString iface = lbHostInterface->text (index); 399 int pos = regExp.search (iface); 400 if (pos != -1) 401 ifaceNumber = regExp.cap (1).toInt() > ifaceNumber ? 402 regExp.cap (1).toInt() : ifaceNumber; 403 } 404 396 405 /* creating add host interface dialog */ 397 VBoxAddNIDialog dlg (this, lbHostInterface->currentItem() != -1 ? 398 tr ("VirtualBox Host Interface %1").arg (mInterfaceNumber) : 399 leHostInterfaceName->text()); 406 VBoxAddNIDialog dlg (this, ifaceName.arg (ifaceNumber + 1)); 400 407 if (dlg.exec() != QDialog::Accepted) 401 408 return; … … 411 418 if (progress.GetResultCode() == 0) 412 419 { 413 ++ mInterfaceNumber;414 420 /* add&select newly created created interface */ 415 421 delete lbHostInterface->findItem (mNoInterfaces); 416 422 lbHostInterface->insertItem (iName); 417 423 selectListItem (iName); 424 pbHostRemove->setEnabled (true); 418 425 emit listChanged (this); 419 426 } … … 469 476 { 470 477 if (lbHostInterface->count() == 1) 478 { 471 479 lbHostInterface->insertItem (mNoInterfaces); 480 pbHostRemove->setEnabled (false); 481 } 472 482 delete lbHostInterface->findItem (iName); 473 483 emit listChanged (this);
Note:
See TracChangeset
for help on using the changeset viewer.