Changeset 41591 in vbox
- Timestamp:
- Jun 6, 2012 7:04:53 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r41590 r41591 421 421 src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp \ 422 422 src/settings/machine/UIMachineSettingsStorage.cpp \ 423 src/settings/machine/UIMachineSettingsUSB.cpp \ 423 424 src/wizards/importappliance/UIWizardImportApp.cpp 424 425 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r41587 r41591 34 34 35 35 /* COM includes: */ 36 #include "CConsole.h" 36 37 #include "CDisplay.h" 37 38 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp
r41587 r41591 37 37 /* COM includes: */ 38 38 #include "COMEnums.h" 39 #include "CConsole.h" 39 40 #include "CSystemProperties.h" 40 41 #include "CMachineDebugger.h" -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r41590 r41591 50 50 51 51 /* COM includes: */ 52 #include "CConsole.h" 52 53 #include "CSystemProperties.h" 53 54 #include "CVirtualBoxErrorInfo.h" -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r41590 r41591 32 32 #include <QTimer> 33 33 #include <QDir> 34 #include <QHelpEvent>35 34 #include <QLocale> 36 35 #include <QNetworkProxy> … … 5461 5460 */ 5462 5461 5463 /**5464 * USB Popup Menu class methods5465 * This class provides the list of USB devices attached to the host.5466 */5467 VBoxUSBMenu::VBoxUSBMenu (QWidget *aParent) : QMenu (aParent)5468 {5469 connect (this, SIGNAL (aboutToShow()),5470 this, SLOT (processAboutToShow()));5471 // connect (this, SIGNAL (hovered (QAction *)),5472 // this, SLOT (processHighlighted (QAction *)));5473 }5474 5475 const CUSBDevice& VBoxUSBMenu::getUSB (QAction *aAction)5476 {5477 return mUSBDevicesMap [aAction];5478 }5479 5480 void VBoxUSBMenu::setConsole (const CConsole &aConsole)5481 {5482 mConsole = aConsole;5483 }5484 5485 void VBoxUSBMenu::processAboutToShow()5486 {5487 clear();5488 mUSBDevicesMap.clear();5489 5490 CHost host = vboxGlobal().host();5491 5492 bool isUSBEmpty = host.GetUSBDevices().size() == 0;5493 if (isUSBEmpty)5494 {5495 QAction *action = addAction (tr ("<no devices available>", "USB devices"));5496 action->setEnabled (false);5497 action->setToolTip (tr ("No supported devices connected to the host PC",5498 "USB device tooltip"));5499 }5500 else5501 {5502 CHostUSBDeviceVector devvec = host.GetUSBDevices();5503 for (int i = 0; i < devvec.size(); ++i)5504 {5505 CHostUSBDevice dev = devvec[i];5506 CUSBDevice usb (dev);5507 QAction *action = addAction (vboxGlobal().details (usb));5508 action->setCheckable (true);5509 mUSBDevicesMap [action] = usb;5510 /* check if created item was already attached to this session */5511 if (!mConsole.isNull())5512 {5513 CUSBDevice attachedUSB =5514 mConsole.FindUSBDeviceById (usb.GetId());5515 action->setChecked (!attachedUSB.isNull());5516 action->setEnabled (dev.GetState() !=5517 KUSBDeviceState_Unavailable);5518 }5519 }5520 }5521 }5522 5523 bool VBoxUSBMenu::event(QEvent *aEvent)5524 {5525 /* We provide dynamic tooltips for the usb devices */5526 if (aEvent->type() == QEvent::ToolTip)5527 {5528 QHelpEvent *helpEvent = static_cast<QHelpEvent *> (aEvent);5529 QAction *action = actionAt (helpEvent->pos());5530 if (action)5531 {5532 CUSBDevice usb = mUSBDevicesMap [action];5533 if (!usb.isNull())5534 {5535 QToolTip::showText (helpEvent->globalPos(), vboxGlobal().toolTip (usb));5536 return true;5537 }5538 }5539 }5540 return QMenu::event (aEvent);5541 }5542 5543 /**5544 * Enable/Disable Menu class.5545 * This class provides enable/disable menu items.5546 */5547 VBoxSwitchMenu::VBoxSwitchMenu (QWidget *aParent, QAction *aAction,5548 bool aInverted)5549 : QMenu (aParent), mAction (aAction), mInverted (aInverted)5550 {5551 /* this menu works only with toggle action */5552 Assert (aAction->isCheckable());5553 addAction(aAction);5554 connect (this, SIGNAL (aboutToShow()),5555 this, SLOT (processAboutToShow()));5556 }5557 5558 void VBoxSwitchMenu::setToolTip (const QString &aTip)5559 {5560 mAction->setToolTip (aTip);5561 }5562 5563 void VBoxSwitchMenu::processAboutToShow()5564 {5565 QString text = mAction->isChecked() ^ mInverted ? tr ("Disable") : tr ("Enable");5566 mAction->setText (text);5567 }5568 5569 5462 bool VBoxGlobal::switchToMachine(CMachine &machine) 5570 5463 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r41590 r41591 38 38 #include "CVirtualBox.h" 39 39 #include "CSession.h" 40 #include "CConsole.h"41 40 #include "CMachine.h" 42 41 #include "CMedium.h" … … 891 890 inline VBoxGlobal &vboxGlobal() { return VBoxGlobal::instance(); } 892 891 893 // Helper classes894 ////////////////////////////////////////////////////////////////////////////////895 896 /**897 * USB Popup Menu class.898 * This class provides the list of USB devices attached to the host.899 */900 class VBoxUSBMenu : public QMenu901 {902 Q_OBJECT903 904 public:905 906 VBoxUSBMenu (QWidget *);907 908 const CUSBDevice& getUSB (QAction *aAction);909 910 void setConsole (const CConsole &);911 912 private slots:913 914 void processAboutToShow();915 916 private:917 bool event(QEvent *aEvent);918 919 QMap <QAction *, CUSBDevice> mUSBDevicesMap;920 CConsole mConsole;921 };922 923 /**924 * Enable/Disable Menu class.925 * This class provides enable/disable menu items.926 */927 class VBoxSwitchMenu : public QMenu928 {929 Q_OBJECT930 931 public:932 933 VBoxSwitchMenu (QWidget *, QAction *, bool aInverted = false);934 935 void setToolTip (const QString &);936 937 private slots:938 939 void processAboutToShow();940 941 private:942 943 QAction *mAction;944 bool mInverted;945 };946 947 892 #endif /* __VBoxGlobal_h__ */ 948 893 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
r41587 r41591 28 28 29 29 /* COM includes: */ 30 #include "CConsole.h" 30 31 #include "CEventSource.h" 31 32 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r41587 r41591 28 28 29 29 /* COM includes: */ 30 #include "CConsole.h" 30 31 #include "CSystemProperties.h" 31 32 #include "CMachineDebugger.h" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r41107 r41591 18 18 */ 19 19 20 /* Global includes*/20 /* Qt includes: */ 21 21 #include <QKeyEvent> 22 23 /* Local includes */ 22 #ifdef Q_WS_X11 23 # include <QX11Info> 24 #endif /* Q_WS_X11 */ 25 26 /* GUI includes: */ 24 27 #include "VBoxGlobal.h" 25 28 #include "UIMessageCenter.h" … … 36 39 #include "UIHotKeyEditor.h" 37 40 41 /* Other VBox includes: */ 38 42 #ifdef Q_WS_X11 39 # include <QX11Info>40 43 # include <X11/XKBlib.h> 41 44 # include <X11/keysym.h> … … 59 62 # include <Carbon/Carbon.h> 60 63 #endif /* Q_WS_MAC */ 64 65 /* COM includes: */ 66 #include "CConsole.h" 61 67 62 68 /* Enums representing different keyboard-states: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r41587 r41591 56 56 /* COM includes: */ 57 57 #include "CSession.h" 58 #include "CConsole.h" 58 59 #include "CDisplay.h" 59 60 #include "CFramebuffer.h" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r41590 r41591 39 39 40 40 /* COM includes: */ 41 #include "CConsole.h" 41 42 #include "CSnapshot.h" 42 43 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r41587 r41591 56 56 57 57 /* COM includes: */ 58 #include "CConsole.h" 58 59 #include "CMouse.h" 59 60 #include "CFramebuffer.h" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r41587 r41591 54 54 55 55 /* COM includes: */ 56 #include "CConsole.h" 56 57 #include "CSystemProperties.h" 57 58 #include "CMachineDebugger.h" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r41587 r41591 44 44 45 45 /* COM includes: */ 46 #include "CConsole.h" 46 47 #include "CMediumAttachment.h" 47 48 #include "CUSBController.h" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
r41587 r41591 36 36 37 37 /* COM includes: */ 38 #include "CConsole.h" 38 39 #include "CDisplay.h" 39 40 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r41587 r41591 36 36 37 37 /* COM includes: */ 38 #include "CConsole.h" 38 39 #include "CDisplay.h" 39 40 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMPreviewWindow.cpp
r41587 r41591 31 31 32 32 /* COM includes: */ 33 #include "CConsole.h" 33 34 #include "CDisplay.h" 34 35 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
r40870 r41591 21 21 # include "precomp.h" 22 22 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 23 /* Local includes */ 23 24 /* Qt includes: */ 25 #include <QDateTime> 26 #include <QHeaderView> 27 #include <QMenu> 28 #include <QScrollBar> 29 #include <QWindowsStyle> 30 31 /* GUI includes: */ 24 32 #include "UIIconPool.h" 25 33 #include "UIMessageCenter.h" … … 32 40 #include "UISelectorShortcuts.h" 33 41 34 /* Global includes */ 35 #include <QDateTime> 36 #include <QHeaderView> 37 #include <QMenu> 38 #include <QScrollBar> 39 #include <QWindowsStyle> 42 /* COM includes: */ 43 #include "CConsole.h" 40 44 41 45 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r41587 r41591 20 20 /* Qt includes: */ 21 21 #include <QHeaderView> 22 #include <QHelpEvent> 23 #include <QToolTip> 22 24 23 25 /* GUI includes: */ … … 32 34 33 35 /* COM includes: */ 36 #include "CConsole.h" 34 37 #include "CUSBController.h" 35 38 #include "CUSBDevice.h" … … 42 45 /* Using declarations: */ 43 46 using namespace VBoxGlobalDefs; 47 48 /** 49 * USB popup menu class. 50 * This class provides the list of USB devices attached to the host. 51 */ 52 class VBoxUSBMenu : public QMenu 53 { 54 Q_OBJECT; 55 56 public: 57 58 /* Constructor: */ 59 VBoxUSBMenu(QWidget *) 60 { 61 connect(this, SIGNAL(aboutToShow()), this, SLOT(processAboutToShow())); 62 } 63 64 /* Returns USB device related to passed action: */ 65 const CUSBDevice& getUSB(QAction *pAction) 66 { 67 return m_usbDeviceMap[pAction]; 68 } 69 70 /* Console setter: */ 71 void setConsole(const CConsole &console) 72 { 73 m_console = console; 74 } 75 76 private slots: 77 78 /* Prepare menu appearance: */ 79 void processAboutToShow() 80 { 81 clear(); 82 m_usbDeviceMap.clear(); 83 84 CHost host = vboxGlobal().host(); 85 86 bool fIsUSBEmpty = host.GetUSBDevices().size() == 0; 87 if (fIsUSBEmpty) 88 { 89 QAction *pAction = addAction(tr("<no devices available>", "USB devices")); 90 pAction->setEnabled(false); 91 pAction->setToolTip(tr("No supported devices connected to the host PC", "USB device tooltip")); 92 } 93 else 94 { 95 CHostUSBDeviceVector devvec = host.GetUSBDevices(); 96 for (int i = 0; i < devvec.size(); ++i) 97 { 98 CHostUSBDevice dev = devvec[i]; 99 CUSBDevice usb(dev); 100 QAction *pAction = addAction(vboxGlobal().details(usb)); 101 pAction->setCheckable(true); 102 m_usbDeviceMap[pAction] = usb; 103 /* Check if created item was already attached to this session: */ 104 if (!m_console.isNull()) 105 { 106 CUSBDevice attachedUSB = m_console.FindUSBDeviceById(usb.GetId()); 107 pAction->setChecked(!attachedUSB.isNull()); 108 pAction->setEnabled(dev.GetState() != KUSBDeviceState_Unavailable); 109 } 110 } 111 } 112 } 113 114 private: 115 116 /* Event handler: */ 117 bool event(QEvent *pEvent) 118 { 119 /* We provide dynamic tooltips for the usb devices: */ 120 if (pEvent->type() == QEvent::ToolTip) 121 { 122 QHelpEvent *pHelpEvent = static_cast<QHelpEvent*>(pEvent); 123 QAction *pAction = actionAt(pHelpEvent->pos()); 124 if (pAction) 125 { 126 CUSBDevice usb = m_usbDeviceMap[pAction]; 127 if (!usb.isNull()) 128 { 129 QToolTip::showText(pHelpEvent->globalPos(), vboxGlobal().toolTip(usb)); 130 return true; 131 } 132 } 133 } 134 /* Call to base-class: */ 135 return QMenu::event(pEvent); 136 } 137 138 QMap<QAction*, CUSBDevice> m_usbDeviceMap; 139 CConsole m_console; 140 }; 44 141 45 142 UIMachineSettingsUSB::UIMachineSettingsUSB(UISettingsPageType type) … … 939 1036 } 940 1037 1038 #include "UIMachineSettingsUSB.moc" 1039 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
r41415 r41591 18 18 */ 19 19 20 /* Localincludes: */20 /* GUI includes: */ 21 21 #include "UIWizardCloneVM.h" 22 22 #include "UIWizardCloneVMPageBasic1.h" … … 26 26 #include "VBoxGlobal.h" 27 27 #include "UIMessageCenter.h" 28 29 /* COM includes: */ 30 #include "CConsole.h" 28 31 29 32 UIWizardCloneVM::UIWizardCloneVM(QWidget *pParent, const CMachine &machine, CSnapshot snapshot /* = CSnapshot() */)
Note:
See TracChangeset
for help on using the changeset viewer.