Changeset 30677 in vbox
- Timestamp:
- Jul 6, 2010 4:39:25 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 8 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r30637 r30677 252 252 src/VBoxVMInformationDlg.h \ 253 253 src/UIVMListView.h \ 254 src/UIVirtualBoxEventHandler.h \ 254 255 src/VBoxVMLogViewer.h \ 255 256 src/globals/VBoxGlobal.h \ 256 257 src/globals/VBoxProblemReporter.h \ 257 258 src/globals/VBoxUtils.h \ 259 src/globals/UIMainEventListener.h \ 260 src/globals/UIExtraDataEventHandler.h \ 258 261 src/extensions/QIAdvancedSlider.h \ 259 262 src/extensions/QIArrowButtonPress.h \ … … 332 335 src/runtime/UIMachineView.h \ 333 336 src/runtime/UIMultiScreenLayout.h \ 337 src/runtime/UIConsoleEventHandler.h \ 334 338 src/runtime/normal/UIKeyboardHandlerNormal.h \ 335 339 src/runtime/normal/UIMachineLogicNormal.h \ … … 360 364 src/runtime/UIMachineLogic.cpp \ 361 365 src/extensions/QISplitter.cpp \ 366 src/globals/UIExtraDataEventHandler.cpp 362 367 363 368 ifdef VBOX_WITH_XPCOM … … 390 395 src/VBoxVMInformationDlg.cpp \ 391 396 src/UIVMListView.cpp \ 397 src/UIVirtualBoxEventHandler.cpp \ 392 398 src/VBoxVMLogViewer.cpp \ 393 399 src/globals/COMDefs.cpp \ … … 396 402 src/globals/VBoxProblemReporter.cpp \ 397 403 src/globals/UIIconPool.cpp \ 404 src/globals/UIMainEventListener.cpp \ 405 src/globals/UIExtraDataEventHandler.cpp \ 398 406 src/extensions/QIAdvancedSlider.cpp \ 399 407 src/extensions/QIArrowButtonPress.cpp \ … … 476 484 src/runtime/UIMachineMenuBar.cpp \ 477 485 src/runtime/UIMultiScreenLayout.cpp \ 486 src/runtime/UIConsoleEventHandler.cpp \ 478 487 src/runtime/normal/UIKeyboardHandlerNormal.cpp \ 479 488 src/runtime/normal/UIMachineLogicNormal.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h
r28800 r30677 24 24 /* Qt includes */ 25 25 #include <QObject> 26 #include <QRect> 26 27 27 28 class CVirtualBox; … … 76 77 return *this; 77 78 } 79 80 static void writeExtraDataString(CVirtualBox &vbox, const QString &key, const QString &data); 81 static QString readExtraDataString(CVirtualBox &vbox, const QString &key); 82 static void writeExtraDataBool(CVirtualBox &vbox, const QString &key, bool data); 83 static bool readExtraDataBool(CVirtualBox &vbox, const QString &key); 84 static void writeExtraDataRect(CVirtualBox &vbox, const QString &key, const QRect &data); 85 static QRect readExtraDataRect(CVirtualBox &vbox, const QString &key); 86 static void writeExtraDataStringList(CVirtualBox &vbox, const QString &key, const QStringList &data); 87 static QStringList readExtraDataStringList(CVirtualBox &vbox, const QString &key); 88 static void writeExtraDataIntList(CVirtualBox &vbox, const QString &key, const QList<int> &data); 89 static QList<int> readExtraDataIntList(CVirtualBox &vbox, const QString &key); 78 90 79 91 // Properties -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxHelpActions.cpp
r30206 r30677 25 25 #include "VBoxProblemReporter.h" 26 26 #include "UIIconPool.h" 27 #include "UIExtraDataEventHandler.h" 27 28 28 29 /* Qt includes */ … … 67 68 &vboxProblem(), SLOT (showHelpAboutDialog())); 68 69 69 QObject::connect ( &vboxGlobal(), SIGNAL (canShowRegDlg(bool)),70 registerAction, SLOT (setEnabled(bool)));71 QObject::connect ( &vboxGlobal(), SIGNAL (canShowUpdDlg(bool)),72 updateAction, SLOT (setEnabled(bool)));70 QObject::connect (gEDataEvents, SIGNAL(sigCanShowRegistrationDlg(bool)), 71 registerAction, SLOT(setEnabled(bool))); 72 QObject::connect (gEDataEvents, SIGNAL(sigCanShowUpdateDlg(bool)), 73 updateAction, SLOT(setEnabled(bool))); 73 74 } 74 75 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r30192 r30677 43 43 #include "QILabel.h" 44 44 #include "UIIconPool.h" 45 #include "UIVirtualBoxEventHandler.h" 45 46 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 46 47 … … 517 518 /// @todo refreshAll() may be slow, so it may be better to analyze 518 519 // event details and update only what is changed */ 519 connect ( &vboxGlobal(), SIGNAL (machineDataChanged (const VBoxMachineDataChangeEvent &)),520 mModelessDialog, SLOT 521 connect ( &vboxGlobal(), SIGNAL (machineRegistered (const VBoxMachineRegisteredEvent &)),522 mModelessDialog, SLOT 523 connect ( &vboxGlobal(), SIGNAL (snapshotChanged (const VBoxSnapshotEvent &)),524 mModelessDialog, SLOT 520 connect (gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), 521 mModelessDialog, SLOT(refreshAll())); 522 connect (gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), 523 mModelessDialog, SLOT(refreshAll())); 524 connect (gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), 525 mModelessDialog, SLOT(refreshAll())); 525 526 } 526 527 … … 1443 1444 } 1444 1445 1445 void VBoxMediaManagerDlg::machineStateChanged (const VBoxMachineStateChangeEvent &aEvent)1446 { 1447 switch ( aEvent.state)1446 void VBoxMediaManagerDlg::machineStateChanged(QString /* strId */, KMachineState state) 1447 { 1448 switch (state) 1448 1449 { 1449 1450 case KMachineState_PoweredOff: -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.h
r28800 r30677 95 95 void showContextMenu (const QPoint &aPos); 96 96 97 void machineStateChanged (const VBoxMachineStateChangeEvent &aEvent);97 void machineStateChanged(QString strId, KMachineState state); 98 98 99 99 void makeRequestForAdjustTable(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r30357 r30677 38 38 #include "VBoxUtils.h" 39 39 #include "VBoxVMLogViewer.h" 40 #include "UIVirtualBoxEventHandler.h" 40 41 41 42 #include "UIDownloaderUserManual.h" … … 515 516 #endif /* MAC_LEOPARD_STYLE */ 516 517 517 /* VM tab widget containing details and snapshots tabs */518 /* VM tab widget containing details and snapshots tabs */ 518 519 mVmTabWidget = new QITabWidget(); 519 520 pSplitter->addWidget (mVmTabWidget); … … 722 723 723 724 connect (mVmDetailsView, SIGNAL (linkClicked (const QString &)), 724 this, SLOT (vmSettings(const QString &)));725 this, SLOT(vmSettings(const QString &))); 725 726 726 727 /* listen to media enumeration signals */ … … 730 731 this, SLOT (mediumEnumFinished (const VBoxMediaList &))); 731 732 732 /* connect VirtualBox callbackevents */733 connect ( &vboxGlobal(), SIGNAL (machineStateChanged (const VBoxMachineStateChangeEvent &)),734 this, SLOT (machineStateChanged (const VBoxMachineStateChangeEvent &)));735 connect ( &vboxGlobal(), SIGNAL (machineDataChanged (const VBoxMachineDataChangeEvent &)),736 this, SLOT (machineDataChanged (const VBoxMachineDataChangeEvent &)));737 connect ( &vboxGlobal(), SIGNAL (machineRegistered (const VBoxMachineRegisteredEvent &)),738 this, SLOT (machineRegistered (const VBoxMachineRegisteredEvent &)));739 connect ( &vboxGlobal(), SIGNAL (sessionStateChanged (const VBoxSessionStateChangeEvent &)),740 this, SLOT (sessionStateChanged (const VBoxSessionStateChangeEvent &)));741 connect ( &vboxGlobal(), SIGNAL (snapshotChanged (const VBoxSnapshotEvent &)),742 this, SLOT (snapshotChanged (const VBoxSnapshotEvent &)));733 /* connect VirtualBox events */ 734 connect (gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), 735 this, SLOT(machineStateChanged(QString, KMachineState))); 736 connect (gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), 737 this, SLOT(machineDataChanged(QString))); 738 connect (gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), 739 this, SLOT(machineRegistered(QString, bool))); 740 connect (gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), 741 this, SLOT(sessionStateChanged(QString, KSessionState))); 742 connect (gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), 743 this, SLOT(snapshotChanged(QString, QString))); 743 744 #ifdef VBOX_GUI_WITH_SYSTRAY 744 connect ( &vboxGlobal(), SIGNAL (mainWindowCountChanged (const VBoxMainWindowCountChangeEvent &)),745 this, SLOT (mainWindowCountChanged (const VBoxMainWindowCountChangeEvent &)));746 connect ( &vboxGlobal(), SIGNAL (trayIconCanShow (const VBoxCanShowTrayIconEvent &)),747 this, SLOT (trayIconCanShow (const VBoxCanShowTrayIconEvent &)));748 connect ( &vboxGlobal(), SIGNAL (trayIconShow (const VBoxShowTrayIconEvent &)),749 this, SLOT (trayIconShow (const VBoxShowTrayIconEvent &)));750 connect (&vboxGlobal(), SIGNAL (trayIconChanged (const VBoxChangeTrayIconEvent &)),751 this, SLOT (trayIconChanged (const VBoxChangeTrayIconEvent &)));745 connect (gEDataEvents, SIGNAL(sigMainWindowCountChange(int)), 746 this, SLOT(mainWindowCountChanged(int))); 747 connect (gEDataEvents, SIGNAL(sigCanShowTrayIcon(bool)), 748 this, SLOT(trayIconCanShow(bool))); 749 connect (gEDataEvents, SIGNAL(sigTrayIconChange(bool)), 750 this, SLOT(trayIconChanged(bool))); 751 connect (&vboxGlobal(), SIGNAL(sigTrayIconShow(bool)), 752 this, SLOT(trayIconShow(bool))); 752 753 #endif 753 754 … … 761 762 VBoxSelectorWnd::~VBoxSelectorWnd() 762 763 { 764 /* Destroy our event handlers */ 765 UIVirtualBoxEventHandler::destroy(); 766 763 767 CVirtualBox vbox = vboxGlobal().virtualBox(); 764 768 … … 1724 1728 } 1725 1729 1726 void VBoxSelectorWnd::machineStateChanged (const VBoxMachineStateChangeEvent &e)1730 void VBoxSelectorWnd::machineStateChanged(QString strId, KMachineState /* state */) 1727 1731 { 1728 1732 #ifdef VBOX_GUI_WITH_SYSTRAY … … 1739 1743 #endif 1740 1744 1741 refreshVMItem ( e.id,1745 refreshVMItem (strId, 1742 1746 false /* aDetails */, 1743 1747 false /* aSnapshots */, … … 1748 1752 } 1749 1753 1750 void VBoxSelectorWnd::machineDataChanged (const VBoxMachineDataChangeEvent &e)1751 { 1752 refreshVMItem ( e.id,1754 void VBoxSelectorWnd::machineDataChanged(QString strId) 1755 { 1756 refreshVMItem (strId, 1753 1757 true /* aDetails */, 1754 1758 false /* aSnapshots */, … … 1756 1760 } 1757 1761 1758 void VBoxSelectorWnd::machineRegistered (const VBoxMachineRegisteredEvent &e)1759 { 1760 if ( e.registered)1762 void VBoxSelectorWnd::machineRegistered(QString strId, bool fRegistered) 1763 { 1764 if (fRegistered) 1761 1765 { 1762 1766 CVirtualBox vbox = vboxGlobal().virtualBox(); 1763 CMachine m = vbox.GetMachine ( e.id);1767 CMachine m = vbox.GetMachine (strId); 1764 1768 if (!m.isNull()) 1765 1769 { … … 1777 1781 else 1778 1782 { 1779 UIVMItem *item = mVMModel->itemById ( e.id);1783 UIVMItem *item = mVMModel->itemById (strId); 1780 1784 if (item) 1781 1785 { … … 1791 1795 } 1792 1796 1793 void VBoxSelectorWnd::sessionStateChanged (const VBoxSessionStateChangeEvent &e)1794 { 1795 refreshVMItem ( e.id,1797 void VBoxSelectorWnd::sessionStateChanged(QString strId, KSessionState /* state */) 1798 { 1799 refreshVMItem (strId, 1796 1800 true /* aDetails */, 1797 1801 false /* aSnapshots */, … … 1802 1806 } 1803 1807 1804 void VBoxSelectorWnd::snapshotChanged (const VBoxSnapshotEvent &aEvent)1805 { 1806 refreshVMItem ( aEvent.machineId,1808 void VBoxSelectorWnd::snapshotChanged(QString strId, QString /* strSnapshotId */) 1809 { 1810 refreshVMItem (strId, 1807 1811 false /* aDetails */, 1808 1812 true /* aSnapshot */, … … 1812 1816 #ifdef VBOX_GUI_WITH_SYSTRAY 1813 1817 1814 void VBoxSelectorWnd::mainWindowCountChanged (const VBoxMainWindowCountChangeEvent &aEvent)1815 { 1816 if (vboxGlobal().isTrayMenu() && aEvent.mCount <= 1)1818 void VBoxSelectorWnd::mainWindowCountChanged(int count) 1819 { 1820 if (vboxGlobal().isTrayMenu() && count <= 1) 1817 1821 fileExit(); 1818 1822 } 1819 1823 1820 void VBoxSelectorWnd::trayIconCanShow (const VBoxCanShowTrayIconEvent &aEvent)1821 { 1822 emit trayIconChanged 1823 } 1824 1825 void VBoxSelectorWnd::trayIconShow (const VBoxShowTrayIconEvent &aEvent)1824 void VBoxSelectorWnd::trayIconCanShow(bool fEnabled) 1825 { 1826 emit trayIconChanged(VBoxChangeTrayIconEvent (vboxGlobal().settings().trayIconEnabled())); 1827 } 1828 1829 void VBoxSelectorWnd::trayIconShow(bool fEnabled) 1826 1830 { 1827 1831 if (vboxGlobal().isTrayMenu() && mTrayIcon) 1828 mTrayIcon->trayIconShow (aEvent.mShow);1829 } 1830 1831 void VBoxSelectorWnd::trayIconChanged (const VBoxChangeTrayIconEvent &aEvent)1832 mTrayIcon->trayIconShow(fEnabled); 1833 } 1834 1835 void VBoxSelectorWnd::trayIconChanged(bool fEnabled) 1832 1836 { 1833 1837 /* Not used yet. */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.h
r30022 r30677 34 34 #endif 35 35 36 /* Local forward declarations */ 37 class QITabWidget; 38 class UIVMItem; 39 class UIVMItemModel; 40 class UIVMListView; 36 41 class VBoxSnapshotsWgt; 42 class VBoxToolBar; 43 class VBoxTrayIcon; 44 class VBoxVMDescriptionPage; 37 45 class VBoxVMDetailsView; 38 class VBoxVMDescriptionPage;39 46 class VBoxVMLogViewer; 40 class UIVMListView; 41 class UIVMItemModel; 42 class UIVMItem; 43 class VBoxTrayIcon; 44 class VBoxToolBar; 45 class UIOSDMenu; 46 class QITabWidget; 47 47 48 /* Global forward declarations */ 49 class QEvent; 48 50 class QListView; 49 class QEvent;50 51 51 52 class VBoxSelectorWnd : public QIWithRetranslateUI2 <QMainWindow> … … 126 127 /* VirtualBox callback events we're interested in */ 127 128 128 void machineStateChanged (const VBoxMachineStateChangeEvent &e);129 void machineDataChanged (const VBoxMachineDataChangeEvent &e);130 void machineRegistered (const VBoxMachineRegisteredEvent &e);131 void sessionStateChanged (const VBoxSessionStateChangeEvent &e);132 void snapshotChanged (const VBoxSnapshotEvent &e);133 #ifdef VBOX_GUI_WITH_SYSTRAY 134 void mainWindowCountChanged (const VBoxMainWindowCountChangeEvent &aEvent);135 void trayIconCanShow (const VBoxCanShowTrayIconEvent &e);136 void trayIconShow (const VBoxShowTrayIconEvent &e);137 void trayIconChanged (const VBoxChangeTrayIconEvent &e);129 void machineStateChanged(QString strId, KMachineState state); 130 void machineDataChanged(QString strId); 131 void machineRegistered(QString strID, bool fRegistered); 132 void sessionStateChanged(QString strId, KSessionState state); 133 void snapshotChanged(QString strId, QString strSnapshotId); 134 #ifdef VBOX_GUI_WITH_SYSTRAY 135 void mainWindowCountChanged(int count); 136 void trayIconCanShow(bool fEnabled); 137 void trayIconShow(bool fEnabled); 138 void trayIconChanged(bool fEnabled); 138 139 #endif 139 140 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.cpp
r30192 r30677 28 28 #include "VBoxTakeSnapshotDlg.h" 29 29 #include "VBoxToolBar.h" 30 #include "UIVirtualBoxEventHandler.h" 30 31 31 32 /* Global includes */ … … 400 401 connect (mTakeSnapshotAction, SIGNAL (triggered()), this, SLOT (takeSnapshot())); 401 402 402 connect ( &vboxGlobal(), SIGNAL (machineDataChanged (const VBoxMachineDataChangeEvent&)),403 this, SLOT (machineDataChanged (const VBoxMachineDataChangeEvent&)));404 connect ( &vboxGlobal(), SIGNAL (machineStateChanged (const VBoxMachineStateChangeEvent&)),405 this, SLOT (machineStateChanged (const VBoxMachineStateChangeEvent&)));406 connect ( &vboxGlobal(), SIGNAL (sessionStateChanged (const VBoxSessionStateChangeEvent&)),407 this, SLOT (sessionStateChanged (const VBoxSessionStateChangeEvent&)));403 connect (gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), 404 this, SLOT(machineDataChanged(QString))); 405 connect (gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), 406 this, SLOT(machineStateChanged(QString, KMachineState))); 407 connect (gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), 408 this, SLOT(sessionStateChanged(QString, KSessionState))); 408 409 409 410 connect (&mAgeUpdateTimer, SIGNAL (timeout()), this, SLOT (updateSnapshotsAge())); … … 665 666 666 667 667 void VBoxSnapshotsWgt::machineDataChanged (const VBoxMachineDataChangeEvent &aEvent)668 void VBoxSnapshotsWgt::machineDataChanged(QString strId) 668 669 { 669 670 SnapshotEditBlocker guardBlock (mEditProtector); 670 671 671 if ( aEvent.id != mMachineId)672 if (strId != mMachineId) 672 673 return; 673 674 … … 675 676 } 676 677 677 void VBoxSnapshotsWgt::machineStateChanged (const VBoxMachineStateChangeEvent &aEvent)678 void VBoxSnapshotsWgt::machineStateChanged(QString strId, KMachineState state) 678 679 { 679 680 SnapshotEditBlocker guardBlock (mEditProtector); 680 681 681 if ( aEvent.id != mMachineId)682 if (strId != mMachineId) 682 683 return; 683 684 684 685 curStateItem()->recache(); 685 curStateItem()->updateCurrentState (aEvent.state);686 } 687 688 void VBoxSnapshotsWgt::sessionStateChanged (const VBoxSessionStateChangeEvent &aEvent)686 curStateItem()->updateCurrentState(state); 687 } 688 689 void VBoxSnapshotsWgt::sessionStateChanged(QString strId, KSessionState state) 689 690 { 690 691 SnapshotEditBlocker guardBlock (mEditProtector); 691 692 692 if ( aEvent.id != mMachineId)693 return; 694 695 mSessionState = aEvent.state;693 if (strId != mMachineId) 694 return; 695 696 mSessionState = state; 696 697 onCurrentChanged (mTreeWidget->currentItem()); 697 698 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.h
r28800 r30677 66 66 void takeSnapshot(); 67 67 68 void machineDataChanged (const VBoxMachineDataChangeEvent &aEvent);69 void machineStateChanged (const VBoxMachineStateChangeEvent &aEvent);70 void sessionStateChanged (const VBoxSessionStateChangeEvent &aEvent);68 void machineDataChanged(QString strId); 69 void machineStateChanged(QString strId, KMachineState state); 70 void sessionStateChanged(QString strId, KSessionState state); 71 71 72 72 void updateSnapshotsAge(); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp
r30288 r30677 40 40 const char* VBoxDefs::GUI_SuppressMessages = "GUI/SuppressMessages"; 41 41 const char* VBoxDefs::GUI_PermanentSharedFoldersAtRuntime = "GUI/PermanentSharedFoldersAtRuntime"; 42 const char* VBoxDefs::GUI_LanguageId = "GUI/LanguageID"; 42 43 #ifdef Q_WS_X11 43 44 const char* VBoxDefs::GUI_LicenseKey = "GUI/LicenseAgreed"; … … 53 54 #ifdef VBOX_GUI_WITH_SYSTRAY 54 55 const char* VBoxDefs::GUI_TrayIconWinID = "GUI/TrayIcon/WinID"; 56 const char* VBoxDefs::GUI_TrayIconEnabled = "GUI/TrayIcon/Enabled"; 55 57 const char* VBoxDefs::GUI_MainWindowCount = "GUI/MainWindowCount"; 56 58 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r30288 r30677 76 76 , RepaintEventType 77 77 , SetRegionEventType 78 , MouseCapabilityEventType79 , MousePointerChangeEventType80 , MachineStateChangeEventType81 , AdditionsStateChangeEventType82 , MediaDriveChangeEventType83 , MachineDataChangeEventType84 , MachineRegisteredEventType85 , SessionStateChangeEventType86 , SnapshotEventType87 , CanShowRegDlgEventType88 , CanShowUpdDlgEventType89 , NetworkAdapterChangeEventType90 , USBCtlStateChangeEventType91 , USBDeviceStateChangeEventType92 , SharedFolderChangeEventType93 , RuntimeErrorEventType94 78 , ModifierKeyChangeEventType 95 79 , MediaEnumEventType … … 97 81 , ShellExecuteEventType 98 82 #endif 99 , ActivateMenuEventType /* remove when new core is active */ 100 , ActivateActionEventType /* New name for new core */ 83 , ActivateActionEventType 101 84 #if defined (Q_WS_MAC) 102 85 , ShowWindowEventType 103 86 #endif 104 , ChangeGUILanguageEventType105 #if defined (VBOX_GUI_WITH_SYSTRAY)106 , CanShowTrayIconEventType107 , ShowTrayIconEventType108 , TrayIconChangeEventType109 , MainWindowCountChangeEventType110 #endif111 87 , AddVDMUrlsEventType 112 , ChangeDockIconUpdateEventType113 , ChangePresentationmodeEventType114 88 #ifdef VBOX_GUI_USE_QGL 115 89 , VHWACommandProcessType … … 144 118 static const char* GUI_SuppressMessages; 145 119 static const char* GUI_PermanentSharedFoldersAtRuntime; 120 static const char* GUI_LanguageId; 146 121 #ifdef Q_WS_X11 147 122 static const char* GUI_LicenseKey; … … 157 132 #ifdef VBOX_GUI_WITH_SYSTRAY 158 133 static const char* GUI_TrayIconWinID; 134 static const char* GUI_TrayIconEnabled; 159 135 static const char* GUI_MainWindowCount; 160 136 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r30208 r30677 29 29 #include "QIDialogButtonBox.h" 30 30 #include "UIIconPool.h" 31 #include "UIExtraDataEventHandler.h" 31 32 32 33 #include "UIMachine.h" … … 103 104 #include <iprt/ldr.h> 104 105 #include <iprt/system.h> 106 #include <iprt/stream.h> 105 107 106 108 #ifdef VBOX_GUI_WITH_SYSTRAY … … 157 159 const bool mLast; 158 160 }; 159 160 // VirtualBox callback class161 /////////////////////////////////////////////////////////////////////////////162 163 class VBoxCallback : VBOX_SCRIPTABLE_IMPL(IVirtualBoxCallback)164 {165 public:166 167 VBoxCallback (VBoxGlobal &aGlobal)168 : mGlobal (aGlobal)169 , mIsRegDlgOwner (false)170 , mIsUpdDlgOwner (false)171 #ifdef VBOX_GUI_WITH_SYSTRAY172 , mIsTrayIconOwner (false)173 #endif174 {175 #if defined (Q_OS_WIN32)176 refcnt = 0;177 #endif178 }179 180 virtual ~VBoxCallback() {}181 182 NS_DECL_ISUPPORTS183 184 #if defined (Q_OS_WIN32)185 STDMETHOD_(ULONG, AddRef)()186 {187 return ::InterlockedIncrement (&refcnt);188 }189 STDMETHOD_(ULONG, Release)()190 {191 long cnt = ::InterlockedDecrement (&refcnt);192 if (cnt == 0)193 delete this;194 return cnt;195 }196 #endif197 VBOX_SCRIPTABLE_DISPATCH_IMPL(IVirtualBoxCallback)198 199 // IVirtualBoxCallback methods200 201 // Note: we need to post custom events to the GUI event queue202 // instead of doing what we need directly from here because on Win32203 // these callback methods are never called on the main GUI thread.204 // Another reason to handle events asynchronously is that internally205 // most callback interface methods are called from under the initiator206 // object's lock, so accessing the initiator object (for example, reading207 // some property) directly from the callback method will definitely cause208 // a deadlock.209 210 STDMETHOD(OnMachineStateChange) (IN_BSTR id, MachineState_T state)211 {212 postEvent (new VBoxMachineStateChangeEvent (QString::fromUtf16(id),213 (KMachineState) state));214 return S_OK;215 }216 217 STDMETHOD(OnMachineDataChange) (IN_BSTR id)218 {219 postEvent (new VBoxMachineDataChangeEvent (QString::fromUtf16(id)));220 return S_OK;221 }222 223 STDMETHOD(OnExtraDataCanChange)(IN_BSTR id,224 IN_BSTR key, IN_BSTR value,225 BSTR *error, BOOL *allowChange)226 {227 if (!error || !allowChange)228 return E_INVALIDARG;229 230 if (com::asGuidStr(id).isEmpty())231 {232 /* it's a global extra data key someone wants to change */233 QString sKey = QString::fromUtf16 (key);234 QString sVal = QString::fromUtf16 (value);235 if (sKey.startsWith ("GUI/"))236 {237 if (sKey == VBoxDefs::GUI_RegistrationDlgWinID)238 {239 if (mIsRegDlgOwner)240 {241 if (sVal.isEmpty() ||242 sVal == QString ("%1")243 .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))244 *allowChange = TRUE;245 else246 *allowChange = FALSE;247 }248 else249 *allowChange = TRUE;250 return S_OK;251 }252 253 if (sKey == VBoxDefs::GUI_UpdateDlgWinID)254 {255 if (mIsUpdDlgOwner)256 {257 if (sVal.isEmpty() ||258 sVal == QString ("%1")259 .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))260 *allowChange = TRUE;261 else262 *allowChange = FALSE;263 }264 else265 *allowChange = TRUE;266 return S_OK;267 }268 #ifdef VBOX_GUI_WITH_SYSTRAY269 if (sKey == VBoxDefs::GUI_TrayIconWinID)270 {271 if (mIsTrayIconOwner)272 {273 if (sVal.isEmpty() ||274 sVal == QString ("%1")275 .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))276 *allowChange = TRUE;277 else278 *allowChange = FALSE;279 }280 else281 *allowChange = TRUE;282 return S_OK;283 }284 #endif285 /* try to set the global setting to check its syntax */286 VBoxGlobalSettings gs (false /* non-null */);287 if (gs.setPublicProperty (sKey, sVal))288 {289 /* this is a known GUI property key */290 if (!gs)291 {292 /* disallow the change when there is an error*/293 *error = SysAllocString ((const OLECHAR *)294 (gs.lastError().isNull() ? 0 : gs.lastError().utf16()));295 *allowChange = FALSE;296 }297 else298 *allowChange = TRUE;299 return S_OK;300 }301 }302 }303 304 /* not interested in this key -- never disagree */305 *allowChange = TRUE;306 return S_OK;307 }308 309 STDMETHOD(OnExtraDataChange) (IN_BSTR id,310 IN_BSTR key, IN_BSTR value)311 {312 if (com::asGuidStr(id).isEmpty())313 {314 QString sKey = QString::fromUtf16 (key);315 QString sVal = QString::fromUtf16 (value);316 if (sKey.startsWith ("GUI/"))317 {318 if (sKey == VBoxDefs::GUI_RegistrationDlgWinID)319 {320 if (sVal.isEmpty())321 {322 mIsRegDlgOwner = false;323 QApplication::postEvent (&mGlobal, new VBoxCanShowRegDlgEvent (true));324 }325 else if (sVal == QString ("%1")326 .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))327 {328 mIsRegDlgOwner = true;329 QApplication::postEvent (&mGlobal, new VBoxCanShowRegDlgEvent (true));330 }331 else332 QApplication::postEvent (&mGlobal, new VBoxCanShowRegDlgEvent (false));333 }334 if (sKey == VBoxDefs::GUI_UpdateDlgWinID)335 {336 if (sVal.isEmpty())337 {338 mIsUpdDlgOwner = false;339 QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (true));340 }341 else if (sVal == QString ("%1")342 .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))343 {344 mIsUpdDlgOwner = true;345 QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (true));346 }347 else348 QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (false));349 }350 if (sKey == "GUI/LanguageID")351 QApplication::postEvent (&mGlobal, new VBoxChangeGUILanguageEvent (sVal));352 #ifdef VBOX_GUI_WITH_SYSTRAY353 if (sKey == "GUI/MainWindowCount")354 QApplication::postEvent (&mGlobal, new VBoxMainWindowCountChangeEvent (sVal.toInt()));355 if (sKey == VBoxDefs::GUI_TrayIconWinID)356 {357 if (sVal.isEmpty())358 {359 mIsTrayIconOwner = false;360 QApplication::postEvent (&mGlobal, new VBoxCanShowTrayIconEvent (true));361 }362 else if (sVal == QString ("%1")363 .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))364 {365 mIsTrayIconOwner = true;366 QApplication::postEvent (&mGlobal, new VBoxCanShowTrayIconEvent (true));367 }368 else369 QApplication::postEvent (&mGlobal, new VBoxCanShowTrayIconEvent (false));370 }371 if (sKey == "GUI/TrayIcon/Enabled")372 QApplication::postEvent (&mGlobal, new VBoxChangeTrayIconEvent ((sVal.toLower() == "true") ? true : false));373 #endif374 #ifdef Q_WS_MAC375 if (sKey == VBoxDefs::GUI_PresentationModeEnabled)376 {377 /* Default to true if it is an empty value */378 QString testStr = sVal.toLower();379 bool f = (testStr.isEmpty() || testStr == "false");380 QApplication::postEvent (&mGlobal, new VBoxChangePresentationModeEvent (f));381 }382 #endif383 384 mMutex.lock();385 mGlobal.gset.setPublicProperty (sKey, sVal);386 mMutex.unlock();387 Assert (!!mGlobal.gset);388 }389 }390 #ifdef Q_WS_MAC391 else if (mGlobal.isVMConsoleProcess())392 {393 /* Check for the currently running machine */394 if (QString::fromUtf16(id) == mGlobal.vmUuid)395 {396 QString strKey = QString::fromUtf16(key);397 QString strVal = QString::fromUtf16(value);398 // TODO_NEW_CORE: we should cleanup399 // VBoxChangeDockIconUpdateEvent to have no parameters. So it400 // could really be use for both events and the consumer should401 // ask per GetExtraData how the current values are.402 if ( strKey == VBoxDefs::GUI_RealtimeDockIconUpdateEnabled403 || strKey == VBoxDefs::GUI_RealtimeDockIconUpdateMonitor)404 {405 /* Default to true if it is an empty value */406 bool f = strVal.toLower() == "false" ? false : true;407 QApplication::postEvent(&mGlobal, new VBoxChangeDockIconUpdateEvent(f));408 }409 }410 }411 #endif /* Q_WS_MAC */412 return S_OK;413 }414 415 STDMETHOD(OnMediumRegistered) (IN_BSTR id, DeviceType_T type,416 BOOL registered)417 {418 /** @todo */419 Q_UNUSED (id);420 Q_UNUSED (type);421 Q_UNUSED (registered);422 return VBOX_E_DONT_CALL_AGAIN;423 }424 425 STDMETHOD(OnMachineRegistered) (IN_BSTR id, BOOL registered)426 {427 postEvent (new VBoxMachineRegisteredEvent (QString::fromUtf16(id),428 registered));429 return S_OK;430 }431 432 STDMETHOD(OnSessionStateChange) (IN_BSTR id, SessionState_T state)433 {434 postEvent (new VBoxSessionStateChangeEvent (QString::fromUtf16(id),435 (KSessionState) state));436 return S_OK;437 }438 439 STDMETHOD(OnSnapshotTaken) (IN_BSTR aMachineId, IN_BSTR aSnapshotId)440 {441 postEvent (new VBoxSnapshotEvent (QString::fromUtf16(aMachineId),442 QString::fromUtf16(aSnapshotId),443 VBoxSnapshotEvent::Taken));444 return S_OK;445 }446 447 STDMETHOD(OnSnapshotDeleted) (IN_BSTR aMachineId, IN_BSTR aSnapshotId)448 {449 postEvent (new VBoxSnapshotEvent (QString::fromUtf16(aMachineId),450 QString::fromUtf16(aSnapshotId),451 VBoxSnapshotEvent::Deleted));452 return S_OK;453 }454 455 STDMETHOD(OnSnapshotChange) (IN_BSTR aMachineId, IN_BSTR aSnapshotId)456 {457 postEvent (new VBoxSnapshotEvent (QString::fromUtf16(aMachineId),458 QString::fromUtf16(aSnapshotId),459 VBoxSnapshotEvent::Changed));460 return S_OK;461 }462 463 STDMETHOD(OnGuestPropertyChange) (IN_BSTR /* id */,464 IN_BSTR /* key */,465 IN_BSTR /* value */,466 IN_BSTR /* flags */)467 {468 return VBOX_E_DONT_CALL_AGAIN;469 }470 471 private:472 473 void postEvent (QEvent *e)474 {475 // currently, we don't post events if we are in the VM execution476 // console mode, to save some CPU ticks (so far, there was no need477 // to handle VirtualBox callback events in the execution console mode)478 if (!mGlobal.isVMConsoleProcess())479 QApplication::postEvent (&mGlobal, e);480 }481 482 VBoxGlobal &mGlobal;483 484 /** protects #OnExtraDataChange() */485 QMutex mMutex;486 487 bool mIsRegDlgOwner;488 bool mIsUpdDlgOwner;489 #ifdef VBOX_GUI_WITH_SYSTRAY490 bool mIsTrayIconOwner;491 #endif492 493 #if defined (Q_OS_WIN32)494 private:495 long refcnt;496 #endif497 };498 499 #if !defined (Q_OS_WIN32)500 NS_DECL_CLASSINFO (VBoxCallback)501 NS_IMPL_THREADSAFE_ISUPPORTS1_CI (VBoxCallback, IVirtualBoxCallback)502 #endif503 161 504 162 // VBoxGlobal … … 703 361 * Sets the new global settings and saves them to the VirtualBox server. 704 362 */ 705 bool VBoxGlobal::setSettings ( constVBoxGlobalSettings &gs)363 bool VBoxGlobal::setSettings (VBoxGlobalSettings &gs) 706 364 { 707 365 gs.save (mVBox); … … 910 568 if (mVBox.isOk()) 911 569 { 912 emit trayIconShow (*(new VBoxShowTrayIconEvent (true)));570 emit sigTrayIconShow(true); 913 571 return true; 914 572 } … … 4660 4318 } 4661 4319 4320 void VBoxGlobal::sltGUILanguageChange(QString strLang) 4321 { 4322 loadLanguage(strLang); 4323 } 4324 4662 4325 // Protected members 4663 4326 //////////////////////////////////////////////////////////////////////////////// … … 4700 4363 } 4701 4364 4702 /* VirtualBox callback events */4703 4704 case VBoxDefs::MachineStateChangeEventType:4705 {4706 emit machineStateChanged (*(VBoxMachineStateChangeEvent *) e);4707 return true;4708 }4709 case VBoxDefs::MachineDataChangeEventType:4710 {4711 emit machineDataChanged (*(VBoxMachineDataChangeEvent *) e);4712 return true;4713 }4714 case VBoxDefs::MachineRegisteredEventType:4715 {4716 emit machineRegistered (*(VBoxMachineRegisteredEvent *) e);4717 return true;4718 }4719 case VBoxDefs::SessionStateChangeEventType:4720 {4721 emit sessionStateChanged (*(VBoxSessionStateChangeEvent *) e);4722 return true;4723 }4724 case VBoxDefs::SnapshotEventType:4725 {4726 emit snapshotChanged (*(VBoxSnapshotEvent *) e);4727 return true;4728 }4729 case VBoxDefs::CanShowRegDlgEventType:4730 {4731 emit canShowRegDlg (((VBoxCanShowRegDlgEvent *) e)->mCanShow);4732 return true;4733 }4734 case VBoxDefs::CanShowUpdDlgEventType:4735 {4736 emit canShowUpdDlg (((VBoxCanShowUpdDlgEvent *) e)->mCanShow);4737 return true;4738 }4739 case VBoxDefs::ChangeGUILanguageEventType:4740 {4741 loadLanguage (static_cast<VBoxChangeGUILanguageEvent*> (e)->mLangId);4742 return true;4743 }4744 #ifdef VBOX_GUI_WITH_SYSTRAY4745 case VBoxDefs::MainWindowCountChangeEventType:4746 4747 emit mainWindowCountChanged (*(VBoxMainWindowCountChangeEvent *) e);4748 return true;4749 4750 case VBoxDefs::CanShowTrayIconEventType:4751 {4752 emit trayIconCanShow (*(VBoxCanShowTrayIconEvent *) e);4753 return true;4754 }4755 case VBoxDefs::ShowTrayIconEventType:4756 {4757 emit trayIconShow (*(VBoxShowTrayIconEvent *) e);4758 return true;4759 }4760 case VBoxDefs::TrayIconChangeEventType:4761 {4762 emit trayIconChanged (*(VBoxChangeTrayIconEvent *) e);4763 return true;4764 }4765 #endif4766 #if defined(Q_WS_MAC)4767 case VBoxDefs::ChangeDockIconUpdateEventType:4768 {4769 emit dockIconUpdateChanged (*(VBoxChangeDockIconUpdateEvent *) e);4770 return true;4771 }4772 case VBoxDefs::ChangePresentationmodeEventType:4773 {4774 emit presentationModeChanged (*(VBoxChangePresentationModeEvent *) e);4775 return true;4776 }4777 #endif4778 4365 default: 4779 4366 break; … … 4849 4436 4850 4437 retranslateUi(); 4438 4439 connect(gEDataEvents, SIGNAL(sigGUILanguageChange(QString)), 4440 this, SLOT(sltGUILanguageChange(QString))); 4851 4441 4852 4442 #ifdef VBOX_GUI_WITH_SYSTRAY … … 5184 4774 vm_render_mode = vboxGetRenderMode (vm_render_mode_str); 5185 4775 5186 /* setup the callback */5187 callback = CVirtualBoxCallback (new VBoxCallback (*this));5188 mVBox.RegisterCallback (callback);5189 AssertWrapperOk (mVBox);5190 if (!mVBox.isOk())5191 return;5192 5193 4776 #ifdef VBOX_WITH_DEBUGGER_GUI 5194 4777 /* setup the debugger gui. */ … … 5244 4827 #endif 5245 4828 5246 if (!callback.isNull()) 5247 { 5248 mVBox.UnregisterCallback (callback); 5249 AssertWrapperOk (mVBox); 5250 callback.detach(); 5251 } 4829 /* Destroy our event handlers */ 4830 UIExtraDataEventHandler::destroy(); 5252 4831 5253 4832 if (mMediaEnumThread) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r30192 r30677 42 42 class QToolButton; 43 43 class UIMachine; 44 45 // VirtualBox callback events46 ////////////////////////////////////////////////////////////////////////////////47 48 class VBoxMachineStateChangeEvent : public QEvent49 {50 public:51 VBoxMachineStateChangeEvent (const QString &aId, KMachineState aState)52 : QEvent ((QEvent::Type) VBoxDefs::MachineStateChangeEventType)53 , id (aId), state (aState)54 {}55 56 const QString id;57 const KMachineState state;58 };59 60 class VBoxMachineDataChangeEvent : public QEvent61 {62 public:63 VBoxMachineDataChangeEvent (const QString &aId)64 : QEvent ((QEvent::Type) VBoxDefs::MachineDataChangeEventType)65 , id (aId)66 {}67 68 const QString id;69 };70 71 class VBoxMachineRegisteredEvent : public QEvent72 {73 public:74 VBoxMachineRegisteredEvent (const QString &aId, bool aRegistered)75 : QEvent ((QEvent::Type) VBoxDefs::MachineRegisteredEventType)76 , id (aId), registered (aRegistered)77 {}78 79 const QString id;80 const bool registered;81 };82 83 class VBoxSessionStateChangeEvent : public QEvent84 {85 public:86 VBoxSessionStateChangeEvent (const QString &aId, KSessionState aState)87 : QEvent ((QEvent::Type) VBoxDefs::SessionStateChangeEventType)88 , id (aId), state (aState)89 {}90 91 const QString id;92 const KSessionState state;93 };94 95 class VBoxSnapshotEvent : public QEvent96 {97 public:98 99 enum What { Taken, Deleted, Changed };100 101 VBoxSnapshotEvent (const QString &aMachineId, const QString &aSnapshotId,102 What aWhat)103 : QEvent ((QEvent::Type) VBoxDefs::SnapshotEventType)104 , what (aWhat)105 , machineId (aMachineId), snapshotId (aSnapshotId)106 {}107 108 const What what;109 110 const QString machineId;111 const QString snapshotId;112 };113 114 class VBoxCanShowRegDlgEvent : public QEvent115 {116 public:117 VBoxCanShowRegDlgEvent (bool aCanShow)118 : QEvent ((QEvent::Type) VBoxDefs::CanShowRegDlgEventType)119 , mCanShow (aCanShow)120 {}121 122 const bool mCanShow;123 };124 125 class VBoxCanShowUpdDlgEvent : public QEvent126 {127 public:128 VBoxCanShowUpdDlgEvent (bool aCanShow)129 : QEvent ((QEvent::Type) VBoxDefs::CanShowUpdDlgEventType)130 , mCanShow (aCanShow)131 {}132 133 const bool mCanShow;134 };135 136 class VBoxChangeGUILanguageEvent : public QEvent137 {138 public:139 VBoxChangeGUILanguageEvent (QString aLangId)140 : QEvent ((QEvent::Type) VBoxDefs::ChangeGUILanguageEventType)141 , mLangId (aLangId)142 {}143 144 const QString mLangId;145 };146 147 #ifdef VBOX_GUI_WITH_SYSTRAY148 class VBoxMainWindowCountChangeEvent : public QEvent149 {150 public:151 VBoxMainWindowCountChangeEvent (int aCount)152 : QEvent ((QEvent::Type) VBoxDefs::MainWindowCountChangeEventType)153 , mCount (aCount)154 {}155 156 const int mCount;157 };158 159 class VBoxCanShowTrayIconEvent : public QEvent160 {161 public:162 VBoxCanShowTrayIconEvent (bool aCanShow)163 : QEvent ((QEvent::Type) VBoxDefs::CanShowTrayIconEventType)164 , mCanShow (aCanShow)165 {}166 167 const bool mCanShow;168 };169 170 class VBoxShowTrayIconEvent : public QEvent171 {172 public:173 VBoxShowTrayIconEvent (bool aShow)174 : QEvent ((QEvent::Type) VBoxDefs::ShowTrayIconEventType)175 , mShow (aShow)176 {}177 178 const bool mShow;179 };180 181 class VBoxChangeTrayIconEvent : public QEvent182 {183 public:184 VBoxChangeTrayIconEvent (bool aChanged)185 : QEvent ((QEvent::Type) VBoxDefs::TrayIconChangeEventType)186 , mChanged (aChanged)187 {}188 189 const bool mChanged;190 };191 #endif192 193 class VBoxChangeDockIconUpdateEvent : public QEvent194 {195 public:196 VBoxChangeDockIconUpdateEvent (bool aChanged)197 : QEvent ((QEvent::Type) VBoxDefs::ChangeDockIconUpdateEventType)198 , mChanged (aChanged)199 {}200 201 const bool mChanged;202 };203 204 class VBoxChangePresentationModeEvent : public QEvent205 {206 public:207 VBoxChangePresentationModeEvent (bool aChanged)208 : QEvent ((QEvent::Type) VBoxDefs::ChangePresentationmodeEventType)209 , mChanged (aChanged)210 {}211 212 const bool mChanged;213 };214 44 215 45 class Process : public QProcess … … 301 131 CVirtualBox virtualBox() const { return mVBox; } 302 132 303 const VBoxGlobalSettings &settings() const{ return gset; }304 bool setSettings ( constVBoxGlobalSettings &gs);133 VBoxGlobalSettings &settings() { return gset; } 134 bool setSettings (VBoxGlobalSettings &gs); 305 135 306 136 VBoxSelectorWnd &selectorWnd(); … … 839 669 void mediumRemoved (VBoxDefs::MediumType, const QString &); 840 670 841 /* signals emitted when the VirtualBox callback is called by the server842 * (note that currently these signals are emitted only when the application843 * is the in the VM selector mode) */844 845 void machineStateChanged (const VBoxMachineStateChangeEvent &e);846 void machineDataChanged (const VBoxMachineDataChangeEvent &e);847 void machineRegistered (const VBoxMachineRegisteredEvent &e);848 void sessionStateChanged (const VBoxSessionStateChangeEvent &e);849 void snapshotChanged (const VBoxSnapshotEvent &e);850 671 #ifdef VBOX_GUI_WITH_SYSTRAY 851 void mainWindowCountChanged (const VBoxMainWindowCountChangeEvent &e); 852 void trayIconCanShow (const VBoxCanShowTrayIconEvent &e); 853 void trayIconShow (const VBoxShowTrayIconEvent &e); 854 void trayIconChanged (const VBoxChangeTrayIconEvent &e); 855 #endif 856 void dockIconUpdateChanged (const VBoxChangeDockIconUpdateEvent &e); 857 void presentationModeChanged (const VBoxChangePresentationModeEvent &e); 858 859 void canShowRegDlg (bool aCanShow); 860 void canShowUpdDlg (bool aCanShow); 672 void sigTrayIconShow(bool fEnabled); 673 #endif 861 674 862 675 public slots: … … 867 680 void showUpdateDialog (bool aForce = true); 868 681 void perDayNewVersionNotifier(); 682 void sltGUILanguageChange(QString strLang); 869 683 870 684 protected: … … 935 749 #endif 936 750 937 CVirtualBoxCallback callback;938 939 751 QString mVerString; 940 752 QString mBrandingConfig; … … 977 789 978 790 friend VBoxGlobal &vboxGlobal(); 979 friend class VBoxCallback;980 791 }; 981 792 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r30637 r30677 41 41 #ifdef Q_WS_MAC 42 42 # include "DockIconPreview.h" 43 # include "UIExtraDataEventHandler.h" 43 44 #endif /* Q_WS_MAC */ 44 45 … … 592 593 connect(pDockPreviewModeGroup, SIGNAL(triggered(QAction*)), 593 594 this, SLOT(sltDockPreviewModeChanged(QAction*))); 594 connect( &vboxGlobal(), SIGNAL(dockIconUpdateChanged(const VBoxChangeDockIconUpdateEvent &)),595 this, SLOT(sltChangeDockIconUpdate( const VBoxChangeDockIconUpdateEvent &)));595 connect(gEDataEvents, SIGNAL(sigDockIconAppearanceChange(bool)), 596 this, SLOT(sltChangeDockIconUpdate(bool))); 596 597 597 598 /* Monitor selection if there are more than one monitor */ … … 1569 1570 } 1570 1571 1571 void UIMachineLogic::sltChangeDockIconUpdate( const VBoxChangeDockIconUpdateEvent &event)1572 void UIMachineLogic::sltChangeDockIconUpdate(bool fEnabled) 1572 1573 { 1573 1574 if (isMachineWindowsCreated()) 1574 1575 { 1575 setDockIconPreviewEnabled( event.mChanged);1576 setDockIconPreviewEnabled(fEnabled); 1576 1577 if (m_pDockPreviewSelectMonitorGroup) 1577 1578 { 1578 m_pDockPreviewSelectMonitorGroup->setEnabled( event.mChanged);1579 m_pDockPreviewSelectMonitorGroup->setEnabled(fEnabled); 1579 1580 CMachine machine = session().GetMachine(); 1580 1581 m_DockIconPreviewMonitor = qMin(machine.GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateMonitor).toInt(), (int)machine.GetMonitorCount() - 1); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r30637 r30677 44 44 class UIMachineView; 45 45 class UIDockIconPreview; 46 class VBoxChangeDockIconUpdateEvent;47 46 48 47 class UIMachineLogic : public QIWithRetranslateUI3<QObject> … … 186 185 void sltDockPreviewModeChanged(QAction *pAction); 187 186 void sltDockPreviewMonitorChanged(QAction *pAction); 188 void sltChangeDockIconUpdate( const VBoxChangeDockIconUpdateEvent &event);187 void sltChangeDockIconUpdate(bool fEnabled); 189 188 #endif /* RT_OS_DARWIN */ 190 189 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r28800 r30677 24 24 #include "VBoxGlobal.h" 25 25 #include "VBoxProblemReporter.h" 26 #include "UIExtraDataEventHandler.h" 26 27 27 28 /* Global includes */ … … 248 249 249 250 #ifdef VBOX_WITH_REGISTRATION 250 VBoxGlobal::connect( &vboxGlobal(), SIGNAL (canShowRegDlg(bool)),251 VBoxGlobal::connect(gEDataEvents, SIGNAL(sigCanShowRegistrationDlg(bool)), 251 252 pActionsPool->action(UIActionIndex_Simple_Register), SLOT(setEnabled(bool))); 252 253 #endif /* VBOX_WITH_REGISTRATION */ 253 VBoxGlobal::connect( &vboxGlobal(), SIGNAL (canShowUpdDlg(bool)),254 VBoxGlobal::connect(gEDataEvents, SIGNAL(sigCanShowUpdateDlg(bool)), 254 255 pActionsPool->action(UIActionIndex_Simple_Update), SLOT(setEnabled(bool))); 255 256 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r30525 r30677 32 32 #include "VBoxProblemReporter.h" 33 33 #include "UIFirstRunWzd.h" 34 #include "UIConsoleEventHandler.h" 34 35 #ifdef VBOX_WITH_VIDEOHWACCEL 35 36 # include "VBoxFBOverlay.h" … … 46 47 #endif 47 48 48 #if defined (Q_WS_MAC)49 # include "VBoxUtils.h"50 #endif51 52 /* Guest mouse pointer shape change event: */53 class UIMousePointerShapeChangeEvent : public QEvent54 {55 public:56 57 UIMousePointerShapeChangeEvent(bool bIsVisible, bool bIsAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight, const QVector<uint8_t>& shape)58 : QEvent((QEvent::Type)UIConsoleEventType_MousePointerShapeChange)59 , m_bIsVisible(bIsVisible), m_bIsAlpha(bIsAlpha), m_uXHot(uXHot), m_uYHot(uYHot), m_uWidth(uWidth), m_uHeight(uHeight), m_shape(shape)60 {61 }62 63 virtual ~UIMousePointerShapeChangeEvent()64 {65 }66 67 bool isVisible() const { return m_bIsVisible; }68 bool hasAlpha() const { return m_bIsAlpha; }69 uint xHot() const { return m_uXHot; }70 uint yHot() const { return m_uYHot; }71 uint width() const { return m_uWidth; }72 uint height() const { return m_uHeight; }73 const uchar *shapeData() const { return m_shape.size() > 0 ? m_shape.data() : NULL; }74 75 private:76 77 bool m_bIsVisible, m_bIsAlpha;78 uint m_uXHot, m_uYHot, m_uWidth, m_uHeight;79 QVector<uint8_t> m_shape;80 };81 82 /* Guest mouse absolute positioning capability change event: */83 class UIMouseCapabilityChangeEvent : public QEvent84 {85 public:86 87 UIMouseCapabilityChangeEvent(bool bSupportsAbsolute, bool bSupportsRelative, bool bNeedsHostCursor)88 : QEvent((QEvent::Type)UIConsoleEventType_MouseCapabilityChange)89 , m_bSupportsAbsolute(bSupportsAbsolute), m_bSupportsRelative(bSupportsRelative), m_bNeedsHostCursor(bNeedsHostCursor) {}90 91 bool supportsAbsolute() const { return m_bSupportsAbsolute; }92 bool supportsRelative() const { return m_bSupportsRelative; }93 bool needsHostCursor() const { return m_bNeedsHostCursor; }94 95 private:96 97 bool m_bSupportsAbsolute;98 bool m_bSupportsRelative;99 bool m_bNeedsHostCursor;100 };101 102 /* Keyboard LEDs change event: */103 class UIKeyboardLedsChangeEvent : public QEvent104 {105 public:106 107 UIKeyboardLedsChangeEvent(bool bNumLock, bool bCapsLock, bool bScrollLock)108 : QEvent((QEvent::Type)UIConsoleEventType_KeyboardLedsChange)109 , m_bNumLock(bNumLock), m_bCapsLock(bCapsLock), m_bScrollLock(bScrollLock) {}110 111 bool numLock() const { return m_bNumLock; }112 bool capsLock() const { return m_bCapsLock; }113 bool scrollLock() const { return m_bScrollLock; }114 115 private:116 117 bool m_bNumLock;118 bool m_bCapsLock;119 bool m_bScrollLock;120 };121 122 /* Machine state change event: */123 class UIStateChangeEvent : public QEvent124 {125 public:126 127 UIStateChangeEvent(KMachineState machineState)128 : QEvent((QEvent::Type)UIConsoleEventType_StateChange)129 , m_machineState(machineState) {}130 131 KMachineState machineState() const { return m_machineState; }132 133 private:134 135 KMachineState m_machineState;136 };137 138 /* Guest Additions state change event: */139 class UIAdditionsStateChangeEvent : public QEvent140 {141 public:142 143 UIAdditionsStateChangeEvent()144 : QEvent((QEvent::Type)UIConsoleEventType_AdditionsStateChange) {}145 };146 147 /* Network adapter change event: */148 class UINetworkAdapterChangeEvent : public QEvent149 {150 public:151 152 UINetworkAdapterChangeEvent(const CNetworkAdapter &networkAdapter)153 : QEvent((QEvent::Type)UIConsoleEventType_NetworkAdapterChange)154 , m_networkAdapter(networkAdapter) {}155 156 const CNetworkAdapter& networkAdapter() { return m_networkAdapter; }157 158 private:159 160 const CNetworkAdapter m_networkAdapter;161 };162 163 /* Serial port change event: */164 /* Not used:165 class UISerialPortChangeEvent : public QEvent166 {167 public:168 169 UISerialPortChangeEvent(const CSerialPort &serialPort)170 : QEvent((QEvent::Type)UIConsoleEventType_SerialPortChange)171 , m_serialPort(serialPort) {}172 173 const CSerialPort& serialPort() { return m_serialPort; }174 175 private:176 177 const CSerialPort m_serialPort;178 };179 */180 181 /* Parallel port change event: */182 /* Not used:183 class UIParallelPortChangeEvent : public QEvent184 {185 public:186 187 UIParallelPortChangeEvent(const CParallelPort ¶llelPort)188 : QEvent((QEvent::Type)UIConsoleEventType_ParallelPortChange)189 , m_parallelPort(parallelPort) {}190 191 const CParallelPort& parallelPort() { return m_parallelPort; }192 193 private:194 195 const CParallelPort m_parallelPort;196 };197 */198 199 /* Storage controller change event: */200 /* Not used:201 class UIStorageControllerChangeEvent : public QEvent202 {203 public:204 205 UIStorageControllerChangeEvent()206 : QEvent((QEvent::Type)UIConsoleEventType_StorageControllerChange) {}207 };208 */209 210 /* Storage medium change event: */211 class UIMediumChangeEvent : public QEvent212 {213 public:214 215 UIMediumChangeEvent(const CMediumAttachment &mediumAttachment)216 : QEvent((QEvent::Type)UIConsoleEventType_MediumChange)217 , m_mediumAttachment(mediumAttachment) {}218 const CMediumAttachment& mediumAttachment() { return m_mediumAttachment; }219 220 private:221 222 const CMediumAttachment m_mediumAttachment;223 };224 225 /* CPU change event: */226 /* Not used:227 class UICPUChangeEvent : public QEvent228 {229 public:230 231 UICPUChangeEvent(ulong uCPU, bool bRemove)232 : QEvent((QEvent::Type)UIConsoleEventType_CPUChange)233 , m_uCPU(uCPU), m_bRemove(bRemove) {}234 235 ulong cpu() const { return m_uCPU; }236 bool remove() const { return m_bRemove; }237 238 private:239 240 ulong m_uCPU;241 bool m_bRemove;242 };243 */244 245 /* VRDP server change event: */246 /* Not used:247 class UIVRDPServerChangeEvent : public QEvent248 {249 public:250 251 UIVRDPServerChangeEvent()252 : QEvent((QEvent::Type)UIConsoleEventType_VRDPServerChange) {}253 };254 */255 256 /* Remote display info change event: */257 /* Not used:258 class UIRemoteDisplayInfoChangeEvent : public QEvent259 {260 public:261 262 UIRemoteDisplayInfoChangeEvent()263 : QEvent((QEvent::Type)UIConsoleEventType_RemoteDisplayInfoChange) {}264 };265 */266 267 /* USB controller change event: */268 class UIUSBControllerChangeEvent : public QEvent269 {270 public:271 272 UIUSBControllerChangeEvent()273 : QEvent((QEvent::Type)UIConsoleEventType_USBControllerChange) {}274 };275 276 /* USB device state change event: */277 class UIUSBDeviceUIStateChangeEvent : public QEvent278 {279 public:280 281 UIUSBDeviceUIStateChangeEvent(const CUSBDevice &device, bool bAttached, const CVirtualBoxErrorInfo &error)282 : QEvent((QEvent::Type)UIConsoleEventType_USBDeviceStateChange)283 , m_device(device), m_bAttached(bAttached), m_error(error) {}284 285 const CUSBDevice& device() const { return m_device; }286 bool attached() const { return m_bAttached; }287 const CVirtualBoxErrorInfo& error() const { return m_error; }288 289 private:290 291 const CUSBDevice m_device;292 bool m_bAttached;293 const CVirtualBoxErrorInfo m_error;294 };295 296 /* Shared folder change event: */297 class UISharedFolderChangeEvent : public QEvent298 {299 public:300 301 UISharedFolderChangeEvent()302 : QEvent((QEvent::Type)UIConsoleEventType_SharedFolderChange) {}303 };304 305 /* VM Runtime error event: */306 class UIRuntimeErrorEvent : public QEvent307 {308 public:309 310 UIRuntimeErrorEvent(bool bFatal, const QString &strErrorID, const QString &strMessage)311 : QEvent((QEvent::Type)UIConsoleEventType_RuntimeError)312 , m_bFatal(bFatal), m_strErrorID(strErrorID), m_strMessage(strMessage) {}313 314 bool fatal() const { return m_bFatal; }315 QString errorID() const { return m_strErrorID; }316 QString message() const { return m_strMessage; }317 318 private:319 320 bool m_bFatal;321 QString m_strErrorID;322 QString m_strMessage;323 };324 325 /* Can show window event: */326 /* Not used:327 class UICanUIShowWindowEvent : public QEvent328 {329 public:330 331 UICanUIShowWindowEvent()332 : QEvent((QEvent::Type)UIConsoleEventType_CanShowWindow) {}333 };334 */335 336 /* Show window event: */337 #ifdef Q_WS_MAC338 class UIShowWindowEvent : public QEvent339 {340 public:341 342 UIShowWindowEvent()343 : QEvent((QEvent::Type)UIConsoleEventType_ShowWindow) {}344 };345 #endif /* Q_WS_MAC */346 347 class UIConsoleCallback : VBOX_SCRIPTABLE_IMPL(IConsoleCallback)348 {349 public:350 351 UIConsoleCallback(UISession *pEventHandler)352 : m_pEventHandler(pEventHandler)353 #if defined (Q_WS_WIN)354 , m_iRefCount(0)355 #endif356 {357 }358 359 virtual ~UIConsoleCallback()360 {361 }362 363 NS_DECL_ISUPPORTS364 365 #if defined (Q_WS_WIN)366 STDMETHOD_(ULONG, AddRef)()367 {368 return ::InterlockedIncrement(&m_iRefCount);369 }370 STDMETHOD_(ULONG, Release)()371 {372 long iCount = ::InterlockedDecrement(&m_iRefCount);373 if (iCount == 0)374 delete this;375 return iCount;376 }377 #endif378 379 VBOX_SCRIPTABLE_DISPATCH_IMPL(IConsoleCallback)380 381 STDMETHOD(OnMousePointerShapeChange)(BOOL bIsVisible, BOOL bAlpha, ULONG uXHot, ULONG uYHot, ULONG uWidth, ULONG uHeight, ComSafeArrayIn(BYTE, pShape))382 {383 com::SafeArray<BYTE> aShape(ComSafeArrayInArg(pShape));384 QVector<uint8_t> shapeVec(static_cast<int>(aShape.size()));385 for (int i = 0; i < shapeVec.size(); ++i)386 shapeVec[i] = aShape[i];387 QApplication::postEvent(m_pEventHandler, new UIMousePointerShapeChangeEvent(bIsVisible, bAlpha, uXHot, uYHot, uWidth, uHeight, shapeVec));388 return S_OK;389 }390 391 STDMETHOD(OnMouseCapabilityChange)(BOOL bSupportsAbsolute, BOOL bSupportsRelative, BOOL bNeedHostCursor)392 {393 QApplication::postEvent(m_pEventHandler, new UIMouseCapabilityChangeEvent(bSupportsAbsolute, bSupportsRelative, bNeedHostCursor));394 return S_OK;395 }396 397 STDMETHOD(OnKeyboardLedsChange)(BOOL bNumLock, BOOL bCapsLock, BOOL bScrollLock)398 {399 QApplication::postEvent(m_pEventHandler, new UIKeyboardLedsChangeEvent(bNumLock, bCapsLock, bScrollLock));400 return S_OK;401 }402 403 STDMETHOD(OnStateChange)(MachineState_T machineState)404 {405 QApplication::postEvent(m_pEventHandler, new UIStateChangeEvent((KMachineState)machineState));406 return S_OK;407 }408 409 STDMETHOD(OnAdditionsStateChange)()410 {411 QApplication::postEvent(m_pEventHandler, new UIAdditionsStateChangeEvent);412 return S_OK;413 }414 415 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *pNetworkAdapter)416 {417 QApplication::postEvent(m_pEventHandler, new UINetworkAdapterChangeEvent(CNetworkAdapter(pNetworkAdapter)));418 return S_OK;419 }420 421 STDMETHOD(OnSerialPortChange)(ISerialPort * /* pSerialPort */)422 {423 /* Not used: QApplication::postEvent(m_pEventHandler, new UISerialPortChangeEvent(CSerialPort(pSerialPort))); */424 return VBOX_E_DONT_CALL_AGAIN;425 }426 427 STDMETHOD(OnParallelPortChange)(IParallelPort * /* pParallelPort */)428 {429 /* Not used: QApplication::postEvent(m_pEventHandler, new UIParallelPortChangeEvent(CParallelPort(pParallelPort))); */430 return VBOX_E_DONT_CALL_AGAIN;431 }432 433 STDMETHOD(OnStorageControllerChange)()434 {435 /* Not used: QApplication::postEvent(m_pEventHandler, new UIStorageControllerChangeEvent); */436 return VBOX_E_DONT_CALL_AGAIN;437 }438 439 STDMETHOD(OnMediumChange)(IMediumAttachment *pMediumAttachment)440 {441 QApplication::postEvent(m_pEventHandler, new UIMediumChangeEvent(CMediumAttachment(pMediumAttachment)));442 return S_OK;443 }444 445 STDMETHOD(OnCPUChange)(ULONG /* uCPU */, BOOL /* bRemove */)446 {447 /* Not used: QApplication::postEvent(m_pEventHandler, new UICPUChangeEvent(uCPU, bRemove)); */448 return VBOX_E_DONT_CALL_AGAIN;449 }450 451 STDMETHOD(OnVRDPServerChange)()452 {453 /* Not used: QApplication::postEvent(m_pEventHandler, new UIVRDPServerChangeEvent); */454 return VBOX_E_DONT_CALL_AGAIN;455 }456 457 STDMETHOD(OnRemoteDisplayInfoChange)()458 {459 /* Not used: QApplication::postEvent(m_pEventHandler, new UIRemoteDisplayInfoChangeEvent); */460 return VBOX_E_DONT_CALL_AGAIN;461 }462 463 STDMETHOD(OnUSBControllerChange)()464 {465 QApplication::postEvent(m_pEventHandler, new UIUSBControllerChangeEvent);466 return S_OK;467 }468 469 STDMETHOD(OnUSBDeviceStateChange)(IUSBDevice *pDevice, BOOL bAttached, IVirtualBoxErrorInfo *pError)470 {471 QApplication::postEvent(m_pEventHandler, new UIUSBDeviceUIStateChangeEvent(CUSBDevice(pDevice), bAttached, CVirtualBoxErrorInfo(pError)));472 return S_OK;473 }474 475 STDMETHOD(OnSharedFolderChange)(Scope_T scope)476 {477 NOREF(scope);478 QApplication::postEvent(m_pEventHandler, new UISharedFolderChangeEvent);479 return S_OK;480 }481 482 STDMETHOD(OnRuntimeError)(BOOL bFatal, IN_BSTR strId, IN_BSTR strMessage)483 {484 QApplication::postEvent(m_pEventHandler, new UIRuntimeErrorEvent(bFatal, QString::fromUtf16(strId), QString::fromUtf16(strMessage)));485 return S_OK;486 }487 488 STDMETHOD(OnCanShowWindow)(BOOL *pbCanShow)489 {490 if (!pbCanShow)491 return E_POINTER;492 493 *pbCanShow = TRUE;494 return S_OK;495 }496 497 STDMETHOD(OnShowWindow)(ULONG64 *puWinId)498 {499 if (!puWinId)500 return E_POINTER;501 502 #ifdef Q_WS_MAC503 /* Let's try the simple approach first - grab the focus.504 * Getting a window out of the dock (minimized or whatever it's called)505 * needs to be done on the GUI thread, so post it a note: */506 *puWinId = 0;507 if (!m_pEventHandler)508 return S_OK;509 510 if (::darwinSetFrontMostProcess())511 QApplication::postEvent(m_pEventHandler, new UIShowWindowEvent);512 else513 {514 /* It failed for some reason, send the other process our PSN so it can try.515 * (This is just a precaution should Mac OS X start imposing the same sensible516 * focus stealing restrictions that other window managers implement). */517 *puWinId = ::darwinGetCurrentProcessId();518 }519 #else /* Q_WS_MAC */520 /* Return the ID of the top-level console window. */521 *puWinId = (ULONG64)m_pEventHandler->winId();522 #endif /* !Q_WS_MAC */523 524 return S_OK;525 }526 527 private:528 529 UISession *m_pEventHandler;530 531 #if defined (Q_WS_WIN)532 long m_iRefCount;533 #endif534 };535 536 #if !defined (Q_WS_WIN)537 NS_DECL_CLASSINFO(UIConsoleCallback)538 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(UIConsoleCallback, IConsoleCallback)539 #endif540 541 49 UISession::UISession(UIMachine *pMachine, CSession &sessionReference) 542 50 : QObject(pMachine) … … 544 52 , m_pMachine(pMachine) 545 53 , m_session(sessionReference) 546 , m_callback(CConsoleCallback(new UIConsoleCallback(this)))547 54 /* Common variables: */ 548 55 , m_pMenuPool(0) … … 579 86 , m_fIsHidingHostPointer(true) 580 87 { 581 /* Register console callback: */ 582 session().GetConsole().RegisterCallback(m_callback); 88 /* Explicit initialize the console event handler */ 89 UIConsoleEventHandler::instance(this); 90 91 /* Add console event connections */ 92 connect(gConsoleEvents, SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)), 93 this, SLOT(sltMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>))); 94 95 connect(gConsoleEvents, SIGNAL(sigMouseCapabilityChange(bool, bool, bool)), 96 this, SLOT(sltMouseCapabilityChange(bool, bool, bool))); 97 98 connect(gConsoleEvents, SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)), 99 this, SLOT(sltKeyboardLedsChangeEvent(bool, bool, bool))); 100 101 connect(gConsoleEvents, SIGNAL(sigStateChange(KMachineState)), 102 this, SLOT(sltStateChange(KMachineState))); 103 104 connect(gConsoleEvents, SIGNAL(sigAdditionsChange()), 105 this, SLOT(sltAdditionsChange())); 106 107 connect(gConsoleEvents, SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)), 108 this, SIGNAL(sigNetworkAdapterChange(CNetworkAdapter))); 109 110 connect(gConsoleEvents, SIGNAL(sigMediumChange(CMediumAttachment)), 111 this, SIGNAL(sigMediumChange(CMediumAttachment))); 112 113 connect(gConsoleEvents, SIGNAL(sigUSBControllerChange()), 114 this, SIGNAL(sigUSBControllerChange())); 115 116 connect(gConsoleEvents, SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)), 117 this, SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo))); 118 119 connect(gConsoleEvents, SIGNAL(sigSharedFolderChange(Scope_T)), 120 this, SLOT(sltSharedFolderChange(Scope_T))); 121 122 connect(gConsoleEvents, SIGNAL(sigRuntimeError(bool, QString, QString)), 123 this, SIGNAL(sigRuntimeError(bool, QString, QString))); 124 125 #ifdef Q_WS_MAC 126 connect(gConsoleEvents, SIGNAL(sigShowWindow()), 127 this, SIGNAL(sigShowWindows()), 128 Qt::QueuedConnection); 129 #endif /* Q_WS_MAC */ 583 130 584 131 /* Prepare main menu: */ … … 597 144 cleanupMenuPool(); 598 145 599 /* Unregister console callback:*/600 session().GetConsole().UnregisterCallback(m_callback);146 /* Destroy the console event handler */ 147 UIConsoleEventHandler::destroy(); 601 148 602 149 #if defined(Q_WS_WIN) … … 922 469 } 923 470 924 bool UISession::event(QEvent *pEvent) 925 { 926 switch (pEvent->type()) 927 { 928 case UIConsoleEventType_MousePointerShapeChange: 929 { 930 /* Convert to mouse shape change event: */ 931 UIMousePointerShapeChangeEvent *pConsoleEvent = static_cast<UIMousePointerShapeChangeEvent*>(pEvent); 932 933 /* In case of shape data is present: */ 934 if (pConsoleEvent->shapeData()) 935 { 936 /* We are ignoring visibility flag: */ 937 m_fIsHidingHostPointer = false; 938 939 /* And updating current cursor shape: */ 940 setPointerShape(pConsoleEvent->shapeData(), pConsoleEvent->hasAlpha(), 941 pConsoleEvent->xHot(), pConsoleEvent->yHot(), 942 pConsoleEvent->width(), pConsoleEvent->height()); 943 } 944 /* In case of shape data is NOT present: */ 945 else 946 { 947 /* Remember if we should hide the cursor: */ 948 m_fIsHidingHostPointer = !pConsoleEvent->isVisible(); 949 } 950 951 /* Notify listeners about mouse capability changed: */ 952 emit sigMousePointerShapeChange(); 953 954 /* Accept event: */ 955 pEvent->accept(); 956 return true; 957 } 958 959 case UIConsoleEventType_MouseCapabilityChange: 960 { 961 /* Convert to mouse capability event: */ 962 UIMouseCapabilityChangeEvent *pConsoleEvent = static_cast<UIMouseCapabilityChangeEvent*>(pEvent); 963 964 /* Check if something had changed: */ 965 if (m_fIsMouseSupportsAbsolute != pConsoleEvent->supportsAbsolute() || 966 m_fIsMouseSupportsRelative != pConsoleEvent->supportsRelative() || 967 m_fIsMouseHostCursorNeeded != pConsoleEvent->needsHostCursor()) 968 { 969 /* Store new data: */ 970 m_fIsMouseSupportsAbsolute = pConsoleEvent->supportsAbsolute(); 971 m_fIsMouseSupportsRelative = pConsoleEvent->supportsRelative(); 972 m_fIsMouseHostCursorNeeded = pConsoleEvent->needsHostCursor(); 973 974 /* Notify listeners about mouse capability changed: */ 975 emit sigMouseCapabilityChange(); 976 } 977 978 /* Accept event: */ 979 pEvent->accept(); 980 return true; 981 } 982 983 case UIConsoleEventType_KeyboardLedsChange: 984 { 985 /* Convert to keyboard LEDs change event: */ 986 UIKeyboardLedsChangeEvent *pConsoleEvent = static_cast<UIKeyboardLedsChangeEvent*>(pEvent); 987 988 /* Check if something had changed: */ 989 if (m_fNumLock != pConsoleEvent->numLock() || 990 m_fCapsLock != pConsoleEvent->capsLock() || 991 m_fScrollLock != pConsoleEvent->scrollLock()) 992 { 993 /* Store new num lock data: */ 994 if (m_fNumLock != pConsoleEvent->numLock()) 995 { 996 m_fNumLock = pConsoleEvent->numLock(); 997 m_uNumLockAdaptionCnt = 2; 998 } 999 1000 /* Store new caps lock data: */ 1001 if (m_fCapsLock != pConsoleEvent->capsLock()) 1002 { 1003 m_fCapsLock = pConsoleEvent->capsLock(); 1004 m_uCapsLockAdaptionCnt = 2; 1005 } 1006 1007 /* Store new scroll lock data: */ 1008 if (m_fScrollLock != pConsoleEvent->scrollLock()) 1009 { 1010 m_fScrollLock = pConsoleEvent->scrollLock(); 1011 } 1012 1013 /* Notify listeners about mouse capability changed: */ 1014 emit sigKeyboardLedsChange(); 1015 } 1016 1017 /* Accept event: */ 1018 pEvent->accept(); 1019 return true; 1020 } 1021 1022 case UIConsoleEventType_StateChange: 1023 { 1024 /* Convert to machine state event: */ 1025 UIStateChangeEvent *pConsoleEvent = static_cast<UIStateChangeEvent*>(pEvent); 1026 1027 /* Check if something had changed: */ 1028 if (m_machineState != pConsoleEvent->machineState()) 1029 { 1030 /* Store new data: */ 1031 m_machineState = pConsoleEvent->machineState(); 1032 1033 /* Notify listeners about machine state changed: */ 1034 emit sigMachineStateChange(); 1035 } 1036 1037 /* Accept event: */ 1038 pEvent->accept(); 1039 return true; 1040 } 1041 1042 case UIConsoleEventType_AdditionsStateChange: 1043 { 1044 /* Get our guest: */ 1045 CGuest guest = session().GetConsole().GetGuest(); 1046 1047 /* Variable flags: */ 1048 bool fIsGuestAdditionsActive = guest.GetAdditionsActive(); 1049 bool fIsGuestSupportsGraphics = guest.GetSupportsGraphics(); 1050 bool fIsGuestSupportsSeamless = guest.GetSupportsSeamless(); 1051 1052 /* Check if something had changed: */ 1053 if (m_fIsGuestAdditionsActive != fIsGuestAdditionsActive || 1054 m_fIsGuestSupportsGraphics != fIsGuestSupportsGraphics || 1055 m_fIsGuestSupportsSeamless != fIsGuestSupportsSeamless) 1056 { 1057 /* Store new data: */ 1058 m_fIsGuestAdditionsActive = fIsGuestAdditionsActive; 1059 m_fIsGuestSupportsGraphics = fIsGuestSupportsGraphics; 1060 m_fIsGuestSupportsSeamless = fIsGuestSupportsSeamless; 1061 1062 /* Notify listeners about guest additions state changed: */ 1063 emit sigAdditionsStateChange(); 1064 } 1065 1066 /* Accept event: */ 1067 pEvent->accept(); 1068 return true; 1069 } 1070 1071 case UIConsoleEventType_NetworkAdapterChange: 1072 { 1073 UINetworkAdapterChangeEvent *pConsoleEvent = static_cast<UINetworkAdapterChangeEvent*>(pEvent); 1074 emit sigNetworkAdapterChange(pConsoleEvent->networkAdapter()); 1075 return true; 1076 } 1077 1078 /* Not used: 1079 case UIConsoleEventType_SerialPortChange: 1080 { 1081 UISerialPortChangeEvent *pConsoleEvent = static_cast<UISerialPortChangeEvent*>(pEvent); 1082 emit sigSerialPortChange(pConsoleEvent->serialPort()); 1083 return true; 1084 } 1085 */ 1086 1087 /* Not used: 1088 case UIConsoleEventType_ParallelPortChange: 1089 { 1090 UIParallelPortChangeEvent *pConsoleEvent = static_cast<UIParallelPortChangeEvent*>(pEvent); 1091 emit sigParallelPortChange(pConsoleEvent->parallelPort()); 1092 return true; 1093 } 1094 */ 1095 1096 /* Not used: 1097 case UIConsoleEventType_StorageControllerChange: 1098 { 1099 emit sigStorageControllerChange(); 1100 return true; 1101 } 1102 */ 1103 1104 case UIConsoleEventType_MediumChange: 1105 { 1106 UIMediumChangeEvent *pConsoleEvent = static_cast<UIMediumChangeEvent*>(pEvent); 1107 emit sigMediumChange(pConsoleEvent->mediumAttachment()); 1108 return true; 1109 } 1110 1111 /* Not used: 1112 case UIConsoleEventType_CPUChange: 1113 { 1114 UICPUChangeEvent *pConsoleEvent = static_cast<UICPUChangeEvent*>(pEvent); 1115 emit sigCPUChange(pConsoleEvent->cpu(), pConsoleEvent->remove()); 1116 return true; 1117 } 1118 */ 1119 1120 /* Not used: 1121 case UIConsoleEventType_VRDPServerChange: 1122 { 1123 emit sigVRDPServerChange(); 1124 return true; 1125 } 1126 */ 1127 1128 /* Not used: 1129 case UIConsoleEventType_RemoteDisplayInfoChange: 1130 { 1131 emit sigRemoteDisplayInfoChange(); 1132 return true; 1133 } 1134 */ 1135 1136 case UIConsoleEventType_USBControllerChange: 1137 { 1138 emit sigUSBControllerChange(); 1139 return true; 1140 } 1141 1142 case UIConsoleEventType_USBDeviceStateChange: 1143 { 1144 UIUSBDeviceUIStateChangeEvent *pConsoleEvent = static_cast<UIUSBDeviceUIStateChangeEvent*>(pEvent); 1145 emit sigUSBDeviceStateChange(pConsoleEvent->device(), pConsoleEvent->attached(), pConsoleEvent->error()); 1146 return true; 1147 } 1148 1149 case UIConsoleEventType_SharedFolderChange: 1150 { 1151 emit sigSharedFolderChange(); 1152 return true; 1153 } 1154 1155 case UIConsoleEventType_RuntimeError: 1156 { 1157 UIRuntimeErrorEvent *pConsoleEvent = static_cast<UIRuntimeErrorEvent*>(pEvent); 1158 emit sigRuntimeError(pConsoleEvent->fatal(), pConsoleEvent->errorID(), pConsoleEvent->message()); 1159 return true; 1160 } 1161 1162 #ifdef Q_WS_MAC 1163 case UIConsoleEventType_ShowWindow: 1164 { 1165 emit sigShowWindows(); 1166 /* Accept event: */ 1167 pEvent->accept(); 1168 return true; 1169 } 1170 #endif 1171 1172 default: 1173 break; 1174 } 1175 return QObject::event(pEvent); 471 void UISession::sltMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape) 472 { 473 /* In case of shape data is present: */ 474 if (shape.size() > 0) 475 { 476 /* We are ignoring visibility flag: */ 477 m_fIsHidingHostPointer = false; 478 479 /* And updating current cursor shape: */ 480 setPointerShape(shape.data(), fAlpha, 481 hotCorner.x(), hotCorner.y(), 482 size.width(), size.height()); 483 } 484 /* In case of shape data is NOT present: */ 485 else 486 { 487 /* Remember if we should hide the cursor: */ 488 m_fIsHidingHostPointer = !fVisible; 489 } 490 491 /* Notify listeners about mouse capability changed: */ 492 emit sigMousePointerShapeChange(); 493 494 } 495 496 void UISession::sltMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fNeedsHostCursor) 497 { 498 /* Check if something had changed: */ 499 if ( m_fIsMouseSupportsAbsolute != fSupportsAbsolute 500 || m_fIsMouseSupportsRelative != fSupportsRelative 501 || m_fIsMouseHostCursorNeeded != fNeedsHostCursor) 502 { 503 /* Store new data: */ 504 m_fIsMouseSupportsAbsolute = fSupportsAbsolute; 505 m_fIsMouseSupportsRelative = fSupportsRelative; 506 m_fIsMouseHostCursorNeeded = fNeedsHostCursor; 507 508 /* Notify listeners about mouse capability changed: */ 509 emit sigMouseCapabilityChange(); 510 } 511 } 512 513 void UISession::sltKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock) 514 { 515 /* Check if something had changed: */ 516 if ( m_fNumLock != fNumLock 517 || m_fCapsLock != fCapsLock 518 || m_fScrollLock != fScrollLock) 519 { 520 /* Store new num lock data: */ 521 if (m_fNumLock != fNumLock) 522 { 523 m_fNumLock = fNumLock; 524 m_uNumLockAdaptionCnt = 2; 525 } 526 527 /* Store new caps lock data: */ 528 if (m_fCapsLock != fCapsLock) 529 { 530 m_fCapsLock = fCapsLock; 531 m_uCapsLockAdaptionCnt = 2; 532 } 533 534 /* Store new scroll lock data: */ 535 if (m_fScrollLock != fScrollLock) 536 { 537 m_fScrollLock = fScrollLock; 538 } 539 540 /* Notify listeners about mouse capability changed: */ 541 emit sigKeyboardLedsChange(); 542 } 543 } 544 545 void UISession::sltStateChange(KMachineState state) 546 { 547 /* Check if something had changed: */ 548 if (m_machineState != state) 549 { 550 /* Store new data: */ 551 m_machineState = state; 552 553 /* Notify listeners about machine state changed: */ 554 emit sigMachineStateChange(); 555 } 556 } 557 558 void UISession::sltAdditionsChange() 559 { 560 /* Get our guest: */ 561 CGuest guest = session().GetConsole().GetGuest(); 562 563 /* Variable flags: */ 564 bool fIsGuestAdditionsActive = guest.GetAdditionsActive(); 565 bool fIsGuestSupportsGraphics = guest.GetSupportsGraphics(); 566 bool fIsGuestSupportsSeamless = guest.GetSupportsSeamless(); 567 568 /* Check if something had changed: */ 569 if (m_fIsGuestAdditionsActive != fIsGuestAdditionsActive || 570 m_fIsGuestSupportsGraphics != fIsGuestSupportsGraphics || 571 m_fIsGuestSupportsSeamless != fIsGuestSupportsSeamless) 572 { 573 /* Store new data: */ 574 m_fIsGuestAdditionsActive = fIsGuestAdditionsActive; 575 m_fIsGuestSupportsGraphics = fIsGuestSupportsGraphics; 576 m_fIsGuestSupportsSeamless = fIsGuestSupportsSeamless; 577 578 /* Notify listeners about guest additions state changed: */ 579 emit sigAdditionsStateChange(); 580 } 581 } 582 583 void UISession::sltSharedFolderChange(Scope_T /* scope */) 584 { 585 emit sigSharedFolderChange(); 1176 586 } 1177 587 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r30408 r30677 159 159 void sigAdditionsStateChange(); 160 160 void sigNetworkAdapterChange(const CNetworkAdapter &networkAdapter); 161 /* Not used: void sigSerialPortChange(const CSerialPort &serialPort); */162 /* Not used: void sigParallelPortChange(const CParallelPort ¶llelPort); */163 /* Not used: void sigStorageControllerChange(); */164 161 void sigMediumChange(const CMediumAttachment &mediumAttachment); 165 /* Not used: void sigCPUChange(ulong uCPU, bool bRemove); */166 /* Not used: void sigVRDPServerChange(); */167 /* Not used: void sigRemoteDisplayInfoChange(); */168 162 void sigUSBControllerChange(); 169 163 void sigUSBDeviceStateChange(const CUSBDevice &device, bool bIsAttached, const CVirtualBoxErrorInfo &error); … … 186 180 void sltCloseVirtualSession(); 187 181 182 /* Console events slots */ 183 void sltMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape); 184 void sltMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fNeedsHostCursor); 185 void sltKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock); 186 void sltStateChange(KMachineState state); 187 void sltAdditionsChange(); 188 void sltSharedFolderChange(Scope_T scope); 189 188 190 private: 189 191 190 192 /* Private getters: */ 191 193 UIMachine* uimachine() const { return m_pMachine; } 192 193 /* Event handlers: */194 bool event(QEvent *pEvent);195 194 196 195 /* Prepare helpers: */ … … 259 258 260 259 /* Friend classes: */ 261 friend class UIConsole Callback;260 friend class UIConsoleEventHandler; 262 261 }; 263 262 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r30542 r30677 34 34 #include "UISession.h" 35 35 36 37 # ifdef Q_WS_MAC36 #ifdef Q_WS_MAC 37 # include "UIExtraDataEventHandler.h" 38 38 # include "VBoxUtils.h" 39 39 # include <Carbon/Carbon.h> … … 168 168 { 169 169 /* Presentation mode connection */ 170 connect (&vboxGlobal(), SIGNAL(presentationModeChanged(const VBoxChangePresentationModeEvent &)),171 this, SLOT(sltChangePresentationMode(const VBoxChangePresentationModeEvent &)));170 connect(gEDataEvents, SIGNAL(sigPresentationModeChange(bool)), 171 this, SLOT(sltChangePresentationMode(bool))); 172 172 } 173 173 #endif /* Q_WS_MAC */ … … 245 245 246 246 #ifdef Q_WS_MAC 247 void UIMachineLogicFullscreen::sltChangePresentationMode( const VBoxChangePresentationModeEvent & /* event*/)247 void UIMachineLogicFullscreen::sltChangePresentationMode(bool /* fEnabled */) 248 248 { 249 249 setPresentationModeEnabled(true); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
r29069 r30677 26 26 class UIActionsPool; 27 27 class UIMultiScreenLayout; 28 class VBoxChangePresentationModeEvent;29 28 30 29 class UIMachineLogicFullscreen : public UIMachineLogic … … 48 47 49 48 #ifdef RT_OS_DARWIN 50 void sltChangePresentationMode( const VBoxChangePresentationModeEvent &event);49 void sltChangePresentationMode(bool fEnabled); 51 50 void sltScreenLayoutChanged(); 52 51 #endif /* RT_OS_DARWIN */
Note:
See TracChangeset
for help on using the changeset viewer.