Changeset 2394 in vbox
- Timestamp:
- Apr 27, 2007 11:39:11 AM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui
r2187 r2394 788 788 <functions> 789 789 <function access="private" specifier="non virtual">init()</function> 790 <function>loadList( const QStringList & )</function>790 <function>loadList( const QStringList &, int )</function> 791 791 <function>getFromAdapter( const CNetworkAdapter & )</function> 792 792 <function>putBackToAdapter()</function> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
r2309 r2394 152 152 153 153 #if defined Q_WS_MAC 154 /* no Host Interface Networking on the Mac yet */ 154 /* no Host Interface Networking on the Mac yet */ 155 155 grbTAP->setHidden (true); 156 156 #endif … … 171 171 } 172 172 173 void VBoxVMNetworkSettings::loadList (const QStringList &aList) 174 { 175 #if defined Q_WS_WIN 173 void VBoxVMNetworkSettings::loadList (const QStringList &aList, 174 int aInterfaceNumber) 175 { 176 #if defined Q_WS_WIN 177 mInterfaceNumber = aInterfaceNumber; 176 178 /* save current list item name */ 177 179 QString currentListItemName = leHostInterfaceName->text(); … … 188 190 #else 189 191 NOREF (aList); 192 NOREF (aInterfaceNumber); 190 193 #endif 191 194 } … … 393 396 /* creating add host interface dialog */ 394 397 VBoxAddNIDialog dlg (this, lbHostInterface->currentItem() != -1 ? 395 tr ("VirtualBox Host Interface %1").arg ( ++mInterfaceNumber) :398 tr ("VirtualBox Host Interface %1").arg (mInterfaceNumber) : 396 399 leHostInterfaceName->text()); 397 400 if (dlg.exec() != QDialog::Accepted) … … 408 411 if (progress.GetResultCode() == 0) 409 412 { 413 ++ mInterfaceNumber; 410 414 /* add&select newly created created interface */ 411 415 delete lbHostInterface->findItem (mNoInterfaces); -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r2240 r2394 2771 2771 <variable access="private">CMachine cmachine;</variable> 2772 2772 <variable access="private">QStringList mInterfaceList;</variable> 2773 <variable access="private">int mInterfaceNumber;</variable> 2773 2774 <variable access="private">QWidgetStack *wstUSBFilters;</variable> 2774 2775 <variable access="private">ulong mLastUSBFilterNum;</variable> 2775 2776 <variable access="private">bool mUSBFilterListModified;</variable> 2777 <variable access="private">QString mUSBFilterNamePrefix;</variable> 2776 2778 <variable access="private">QTabWidget* tbwNetwork;</variable> 2777 2779 <variable access="private">VBoxSharedFoldersSettings* mSharedFolders;</variable> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r2350 r2394 630 630 mLastUSBFilterNum = 0; 631 631 mUSBFilterListModified = false; 632 mUSBFilterNamePrefix = tr ("New Filter ", "usb"); 632 633 633 634 /* VRDP Page */ … … 850 851 set->revalidate(); 851 852 } 853 /* searching for max interface index */ 854 QString interfacePrefix = tr ("VirtualBox Host Interface "); 855 QRegExp regExp (QString ("%1(\\d+)").arg (interfacePrefix)); 856 QStringList list = mInterfaceList.grep (regExp); 857 int max = 0; 858 for (QStringList::Iterator it = list.begin(); it != list.end(); ++ it) 859 { 860 int pos = regExp.search (*it); 861 if (pos != -1) 862 max = regExp.cap (1).toInt() > max ? regExp.cap (1).toInt() : max; 863 } 864 mInterfaceNumber = ++ max; 852 865 #else 853 866 NOREF (aWidget); … … 861 874 updateInterfaces (0); 862 875 VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (aWidget); 863 set->loadList (mInterfaceList );876 set->loadList (mInterfaceList, mInterfaceNumber); 864 877 set->revalidate(); 865 878 #endif … … 1464 1477 1465 1478 CUSBDeviceFilterEnumerator en = ctl.GetDeviceFilters().Enumerate(); 1479 /* loading filters & searching for max filter index */ 1480 int max = 0; 1466 1481 while (en.HasMore()) 1467 addUSBFilter (en.GetNext(), false /* isNew */); 1482 { 1483 const CUSBDeviceFilter &filter = en.GetNext(); 1484 QRegExp regExp (QString ("%1(\\d+)").arg (mUSBFilterNamePrefix)); 1485 int pos = regExp.search (filter.GetName()); 1486 if (pos != -1) 1487 max = regExp.cap (1).toInt() > max ? 1488 regExp.cap (1).toInt() : max; 1489 addUSBFilter (filter, false /* isNew */); 1490 } 1491 mLastUSBFilterNum = max; 1468 1492 1469 1493 lvUSBFilters->setCurrentItem (lvUSBFilters->firstChild()); … … 1783 1807 { 1784 1808 VBoxVMNetworkSettings *page = new VBoxVMNetworkSettings(); 1785 page->loadList (mInterfaceList );1809 page->loadList (mInterfaceList, mInterfaceNumber); 1786 1810 page->getFromAdapter (aAdapter); 1787 1811 tbwNetwork->addTab (page, QString (tr ("Adapter %1", "network")) … … 1958 1982 { 1959 1983 CUSBDeviceFilter filter = cmachine.GetUSBController() 1960 .CreateDeviceFilter ( tr ("New Filter %1", "usb")1961 1984 .CreateDeviceFilter (QString ("%1%2") 1985 .arg (mUSBFilterNamePrefix).arg (++ mLastUSBFilterNum)); 1962 1986 1963 1987 filter.SetActive (true);
Note:
See TracChangeset
for help on using the changeset viewer.