Changeset 16927 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 18, 2009 6:27:52 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 43063
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetwork.h
r16090 r16927 106 106 bool isWrongInterface() const; 107 107 void setCurrentInterface (const QString &aName); 108 108 #if defined (Q_WS_WIN) && defined(VBOX_WITH_NETFLT) 109 void updateInterfacesList(KNetworkAttachmentType enmAttachmentType); 110 #endif 109 111 signals: 110 112 … … 123 125 124 126 private: 125 127 #if defined (Q_WS_WIN) && defined(VBOX_WITH_NETFLT) 128 void populateInterfacesList(KNetworkAttachmentType enmAttachmentType); 129 #else 126 130 void populateInterfacesList(); 127 131 #endif 128 132 QILabelSeparator *mLbTitle; 129 133 QTreeWidget *mList; 130 134 131 # if defined (Q_WS_WIN) && !defined(VBOX_WITH_NETFLT)135 # if defined (Q_WS_WIN) 132 136 QAction *mAddAction; 133 137 QAction *mDelAction; 138 # ifdef VBOX_WITH_NETFLT 139 KNetworkAttachmentType mEnmAttachmentType; 140 # endif 134 141 # endif 135 142 }; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp
r16854 r16927 456 456 457 457 /* Prepare actions */ 458 # if defined (Q_WS_WIN) && !defined (VBOX_WITH_NETFLT)458 # if defined (Q_WS_WIN) 459 459 mAddAction = new QAction (mList); 460 460 mDelAction = new QAction (mList); … … 467 467 mDelAction->setIcon (VBoxGlobal::iconSet (":/remove_host_iface_16px.png", 468 468 ":/remove_host_iface_disabled_16px.png")); 469 # endif /* Q_WS_WIN && !VBOX_WITH_NETFLT*/470 471 # if defined (Q_WS_WIN) && !defined (VBOX_WITH_NETFLT)469 # endif /* Q_WS_WIN */ 470 471 # if defined (Q_WS_WIN) 472 472 /* Prepare toolbar */ 473 473 VBoxToolBar *toolBar = new VBoxToolBar (this); … … 478 478 toolBar->addAction (mDelAction); 479 479 layout->addWidget (toolBar); 480 # endif /* Q_WS_WIN && !VBOX_WITH_NETFLT*/480 # endif /* Q_WS_WIN */ 481 481 482 482 /* Setup connections */ 483 483 connect (mList, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), 484 484 this, SLOT (onCurrentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *))); 485 # if defined (Q_WS_WIN) && !defined (VBOX_WITH_NETFLT)485 # if defined (Q_WS_WIN) 486 486 connect (mAddAction, SIGNAL (triggered (bool)), 487 487 this, SLOT (addHostInterface())); 488 488 connect (mDelAction, SIGNAL (triggered (bool)), 489 489 this, SLOT (delHostInterface())); 490 # endif /* Q_WS_WIN && !VBOX_WITH_NETFLT */ 491 490 # endif /* Q_WS_WIN */ 491 492 #if !defined(Q_WS_WIN) && !defined(VBOX_WITH_NETFLT) 492 493 /* Populating interface list */ 493 494 populateInterfacesList(); 495 #endif 494 496 495 497 /* Applying language settings */ … … 549 551 QTreeWidgetItem *) 550 552 { 551 # if defined (Q_WS_WIN) && !defined (VBOX_WITH_NETFLT) 552 VBoxNIListItem *item = aCurrent && 553 aCurrent->type() == VBoxNIListItem::typeId ? 554 static_cast<VBoxNIListItem*> (aCurrent) : 0; 555 mDelAction->setEnabled (item && !item->isWrong()); 553 # if defined (Q_WS_WIN) 554 # if defined (VBOX_WITH_NETFLT) 555 if(mEnmAttachmentType == KNetworkAttachmentType_HostOnly) 556 # endif 557 { 558 VBoxNIListItem *item = aCurrent && 559 aCurrent->type() == VBoxNIListItem::typeId ? 560 static_cast<VBoxNIListItem*> (aCurrent) : 0; 561 mDelAction->setEnabled (item && !item->isWrong()); 562 } 563 # if defined (VBOX_WITH_NETFLT) 564 else 565 { 566 mDelAction->setEnabled (false); 567 } 568 # endif 556 569 # else 557 570 NOREF (aCurrent); … … 564 577 void VBoxNIList::addHostInterface() 565 578 { 566 # if defined (Q_WS_WIN) && !defined (VBOX_WITH_NETFLT)579 # if defined (Q_WS_WIN) 567 580 /* Allow the started helper process to make itself the foreground window */ 568 581 AllowSetForegroundWindow (ASFW_ANY); … … 607 620 /* Allow the started helper process to make itself the foreground window */ 608 621 AllowSetForegroundWindow (ASFW_ANY); 609 # endif /* Q_WS_WIN && !VBOX_WITH_NETFLT*/622 # endif /* Q_WS_WIN */ 610 623 } 611 624 … … 614 627 Assert (mList->currentItem()); 615 628 616 # if defined (Q_WS_WIN) && !defined (VBOX_WITH_NETFLT)629 # if defined (Q_WS_WIN) 617 630 /* Allow the started helper process to make itself the foreground window */ 618 631 AllowSetForegroundWindow (ASFW_ANY); … … 664 677 665 678 emit listChanged(); 666 # endif /* Q_WS_WIN && !VBOX_WITH_NETFLT*/679 # endif /* Q_WS_WIN */ 667 680 } 668 681 … … 673 686 mList->setWhatsThis (tr ("Lists all available host interfaces.")); 674 687 675 # if defined (Q_WS_WIN) && !defined (VBOX_WITH_NETFLT)688 # if defined (Q_WS_WIN) 676 689 mAddAction->setText (tr ("A&dd New Host Interface")); 677 690 mDelAction->setText (tr ("&Remove Selected Host Interface")); … … 682 695 mDelAction->setToolTip (mDelAction->text().remove ('&') + 683 696 QString (" (%1)").arg (mDelAction->shortcut().toString())); 684 # endif /* Q_WS_WIN && !VBOX_WITH_NETFLT */ 685 } 686 697 # endif /* Q_WS_WIN */ 698 } 699 700 #if defined(Q_WS_WIN) && defined(VBOX_WITH_NETFLT) 701 void VBoxNIList::updateInterfacesList(KNetworkAttachmentType enmAttachmentType) 702 { 703 bool bHostOnly = enmAttachmentType == KNetworkAttachmentType_HostOnly; 704 mEnmAttachmentType = enmAttachmentType; 705 mAddAction->setEnabled(bHostOnly); 706 mDelAction->setEnabled(bHostOnly); 707 populateInterfacesList(enmAttachmentType); 708 } 709 710 void VBoxNIList::populateInterfacesList(KNetworkAttachmentType enmAttachmentType) 711 #else 687 712 void VBoxNIList::populateInterfacesList() 713 #endif 688 714 { 689 715 /* Load current inner list */ 690 716 QList<QTreeWidgetItem*> itemsList; 691 717 CHostNetworkInterfaceVector interfaces = 692 vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces(); 718 #if defined(Q_WS_WIN) && defined(VBOX_WITH_NETFLT) 719 enmAttachmentType == KNetworkAttachmentType_HostOnly ? 720 vboxGlobal().virtualBox().GetHost().GetTapInterfaces() 721 : 722 #endif 723 vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces(); 693 724 for (CHostNetworkInterfaceVector::ConstIterator it = interfaces.begin(); 694 725 it != interfaces.end(); ++it) … … 897 928 VBoxVMSettingsNetwork *page = 898 929 static_cast <VBoxVMSettingsNetwork*> (mTwAdapters->currentWidget()); 899 900 bool isHostInterfaceAttached = vboxGlobal().toNetworkAttachmentType ( 901 page->mCbNAType->currentText())== KNetworkAttachmentType_HostInterface;930 KNetworkAttachmentType enmType = vboxGlobal().toNetworkAttachmentType (page->mCbNAType->currentText()); 931 932 bool isHostInterfaceAttached = enmType == KNetworkAttachmentType_HostInterface; 902 933 903 934 mNIList->setEnabled (isHostInterfaceAttached); 935 # ifdef Q_WS_WIN 936 if(!isHostInterfaceAttached) 937 { 938 mNIList->setEnabled (enmType == KNetworkAttachmentType_HostOnly); 939 } 940 mNIList->updateInterfacesList(enmType); 941 # endif 904 942 } 905 943 #endif
Note:
See TracChangeset
for help on using the changeset viewer.