Changeset 98377 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 1, 2023 12:26:59 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo
-
old new 19 19 /branches/dsen/gui2:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 20 20 /branches/dsen/gui3:79645-79692 21 /branches/dsen/gui4:155183-15518 4,15519821 /branches/dsen/gui4:155183-155185,155187,155198 22 22 /trunk/src:92342,154921
-
- Property svn:mergeinfo
-
trunk/src/VBox
- Property svn:mergeinfo
-
old new 19 19 /branches/dsen/gui2/src/VBox:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 20 20 /branches/dsen/gui3/src/VBox:79645-79692 21 /branches/dsen/gui4/src/VBox:155183-15518 4,15519821 /branches/dsen/gui4/src/VBox:155183-155185,155187,155198
-
- Property svn:mergeinfo
-
trunk/src/VBox/Frontends
- Property svn:mergeinfo
-
old new 16 16 /branches/dsen/gui2/src/VBox/Frontends:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 17 17 /branches/dsen/gui3/src/VBox/Frontends:79645-79692 18 /branches/dsen/gui4/src/VBox/Frontends:155183-15518 4,15519818 /branches/dsen/gui4/src/VBox/Frontends:155183-155185,155187,155198
-
- Property svn:mergeinfo
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
r98103 r98377 44 44 45 45 46 /** Private QObject extension46 /** Private QObject subclass 47 47 * providing UIConsoleEventHandler with the CConsole event-source. */ 48 48 class UIConsoleEventHandlerProxy : public QObject … … 90 90 /** Notifies about Runtime error with @a strErrorId which is @a fFatal and have @a strMessage. */ 91 91 void sigRuntimeError(bool fFatal, QString strErrorId, QString strMessage); 92 #ifdef RT_OS_DARWIN92 #ifdef VBOX_WS_MAC 93 93 /** Notifies about VM window should be shown. */ 94 94 void sigShowWindow(); 95 #endif /* RT_OS_DARWIN*/95 #endif /* VBOX_WS_MAC */ 96 96 /** Notifies about audio adapter state change. */ 97 97 void sigAudioAdapterChange(); … … 125 125 126 126 /** Cleanups connections. */ 127 void cleanupConnections() ;127 void cleanupConnections() {} 128 128 /** Cleanups listener. */ 129 129 void cleanupListener(); … … 255 255 Qt::DirectConnection); 256 256 connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigStateChange, 257 this, &UIConsoleEventHandlerProxy::sigStateChange,257 this, &UIConsoleEventHandlerProxy::sigStateChange, 258 258 Qt::DirectConnection); 259 259 connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigAdditionsChange, … … 302 302 this, &UIConsoleEventHandlerProxy::sigAudioAdapterChange, 303 303 Qt::DirectConnection); 304 connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigClipboardModeChange,304 connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigClipboardModeChange, 305 305 this, &UIConsoleEventHandlerProxy::sigClipboardModeChange, 306 306 Qt::DirectConnection); 307 connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigDnDModeChange,307 connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigDnDModeChange, 308 308 this, &UIConsoleEventHandlerProxy::sigDnDModeChange, 309 309 Qt::DirectConnection); 310 }311 312 void UIConsoleEventHandlerProxy::cleanupConnections()313 {314 /* Nothing for now. */315 310 } 316 311 … … 346 341 *********************************************************************************************************************************/ 347 342 348 /* static */349 UIConsoleEventHandler *UIConsoleEventHandler::s_pInstance = 0;350 351 /* static */352 void UIConsoleEventHandler::create(UISession *pSession)353 {354 if (!s_pInstance)355 s_pInstance = new UIConsoleEventHandler(pSession);356 }357 358 /* static */359 void UIConsoleEventHandler::destroy()360 {361 if (s_pInstance)362 {363 delete s_pInstance;364 s_pInstance = 0;365 }366 }367 368 343 UIConsoleEventHandler::UIConsoleEventHandler(UISession *pSession) 369 344 : m_pProxy(new UIConsoleEventHandlerProxy(this, pSession)) … … 373 348 374 349 void UIConsoleEventHandler::prepare() 375 {376 prepareConnections();377 }378 379 void UIConsoleEventHandler::prepareConnections()380 350 { 381 351 /* Create queued (async) connections for signals of event proxy object: */ … … 431 401 this, &UIConsoleEventHandler::sigRuntimeError, 432 402 Qt::QueuedConnection); 433 #ifdef RT_OS_DARWIN403 #ifdef VBOX_WS_MAC 434 404 connect(m_pProxy, &UIConsoleEventHandlerProxy::sigShowWindow, 435 405 this, &UIConsoleEventHandler::sigShowWindow, 436 406 Qt::QueuedConnection); 437 #endif /* RT_OS_DARWIN*/407 #endif /* VBOX_WS_MAC */ 438 408 connect(m_pProxy, &UIConsoleEventHandlerProxy::sigAudioAdapterChange, 439 409 this, &UIConsoleEventHandler::sigAudioAdapterChange, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h
r98103 r98377 49 49 50 50 51 /** Singleton QObject extension51 /** QObject subclass 52 52 * providing GUI with the CConsole event-source. */ 53 53 class UIConsoleEventHandler : public QObject … … 60 60 void sigMousePointerShapeChange(const UIMousePointerShapeData &shapeData); 61 61 /** Notifies about mouse capability change to @a fSupportsAbsolute, @a fSupportsRelative, 62 * @a fSupportsTouchScreen, @a fSupportsTouchPad and @a fNeedsHostCursor. */62 * @a fSupportsTouchScreen, @a fSupportsTouchPad and @a fNeedsHostCursor. */ 63 63 void sigMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, 64 64 bool fSupportsTouchScreen, bool fSupportsTouchPad, … … 95 95 /** Notifies about Runtime error with @a strErrorId which is @a fFatal and have @a strMessage. */ 96 96 void sigRuntimeError(bool fFatal, QString strErrorId, QString strMessage); 97 #ifdef RT_OS_DARWIN97 #ifdef VBOX_WS_MAC 98 98 /** Notifies about VM window should be shown. */ 99 99 void sigShowWindow(); 100 #endif /* RT_OS_DARWIN*/100 #endif /* VBOX_WS_MAC */ 101 101 /** Notifies about audio adapter state change. */ 102 102 void sigAudioAdapterChange(); … … 108 108 public: 109 109 110 /** Returns singleton instance created by the factory. */111 static UIConsoleEventHandler *instance() { return s_pInstance; }112 /** Creates singleton instance created by the factory. */113 static void create(UISession *pSession);114 /** Destroys singleton instance created by the factory. */115 static void destroy();116 117 protected:118 119 110 /** Constructs console event handler for passed @a pSession. */ 120 111 UIConsoleEventHandler(UISession *pSession); 121 112 113 private: 114 122 115 /** Prepares all. */ 123 116 void prepare(); 124 /** Prepares connections. */125 void prepareConnections();126 127 private:128 129 /** Holds the singleton static console event handler instance. */130 static UIConsoleEventHandler *s_pInstance;131 117 132 118 /** Holds the console event proxy instance. */ … … 134 120 }; 135 121 136 /** Defines the globally known name for the console event handler instance. */137 #define gConsoleEvents UIConsoleEventHandler::instance()138 139 122 #endif /* !FEQT_INCLUDED_SRC_runtime_UIConsoleEventHandler_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98376 r98377 884 884 /* Base variables: */ 885 885 , m_pMachine(pMachine) 886 , m_pConsoleEventhandler(0) 886 887 , m_pActionPool(0) 887 888 #ifdef VBOX_WS_MAC … … 1021 1022 { 1022 1023 /* Create console event-handler: */ 1023 UIConsoleEventHandler::create(this);1024 m_pConsoleEventhandler = new UIConsoleEventHandler(this); 1024 1025 1025 1026 /* Add console event connections: */ 1026 connect( gConsoleEvents, &UIConsoleEventHandler::sigMousePointerShapeChange,1027 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigMousePointerShapeChange, 1027 1028 this, &UISession::sltMousePointerShapeChange); 1028 connect( gConsoleEvents, &UIConsoleEventHandler::sigMouseCapabilityChange,1029 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigMouseCapabilityChange, 1029 1030 this, &UISession::sltMouseCapabilityChange); 1030 connect( gConsoleEvents, &UIConsoleEventHandler::sigCursorPositionChange,1031 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigCursorPositionChange, 1031 1032 this, &UISession::sltCursorPositionChange); 1032 connect( gConsoleEvents, &UIConsoleEventHandler::sigKeyboardLedsChangeEvent,1033 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigKeyboardLedsChangeEvent, 1033 1034 this, &UISession::sltKeyboardLedsChangeEvent); 1034 connect( gConsoleEvents, &UIConsoleEventHandler::sigStateChange,1035 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigStateChange, 1035 1036 this, &UISession::sltStateChange); 1036 connect( gConsoleEvents, &UIConsoleEventHandler::sigAdditionsChange,1037 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigAdditionsChange, 1037 1038 this, &UISession::sltAdditionsChange); 1038 connect( gConsoleEvents, &UIConsoleEventHandler::sigVRDEChange,1039 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigVRDEChange, 1039 1040 this, &UISession::sltVRDEChange); 1040 connect( gConsoleEvents, &UIConsoleEventHandler::sigRecordingChange,1041 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigRecordingChange, 1041 1042 this, &UISession::sltRecordingChange); 1042 connect( gConsoleEvents, &UIConsoleEventHandler::sigNetworkAdapterChange,1043 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigNetworkAdapterChange, 1043 1044 this, &UISession::sigNetworkAdapterChange); 1044 connect( gConsoleEvents, &UIConsoleEventHandler::sigStorageDeviceChange,1045 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigStorageDeviceChange, 1045 1046 this, &UISession::sltHandleStorageDeviceChange); 1046 connect( gConsoleEvents, &UIConsoleEventHandler::sigMediumChange,1047 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigMediumChange, 1047 1048 this, &UISession::sigMediumChange); 1048 connect( gConsoleEvents, &UIConsoleEventHandler::sigUSBControllerChange,1049 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigUSBControllerChange, 1049 1050 this, &UISession::sigUSBControllerChange); 1050 connect( gConsoleEvents, &UIConsoleEventHandler::sigUSBDeviceStateChange,1051 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigUSBDeviceStateChange, 1051 1052 this, &UISession::sigUSBDeviceStateChange); 1052 connect( gConsoleEvents, &UIConsoleEventHandler::sigSharedFolderChange,1053 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigSharedFolderChange, 1053 1054 this, &UISession::sigSharedFolderChange); 1054 connect( gConsoleEvents, &UIConsoleEventHandler::sigRuntimeError,1055 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigRuntimeError, 1055 1056 this, &UISession::sigRuntimeError); 1056 1057 #ifdef VBOX_WS_MAC 1057 connect( gConsoleEvents, &UIConsoleEventHandler::sigShowWindow,1058 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigShowWindow, 1058 1059 this, &UISession::sigShowWindows, Qt::QueuedConnection); 1059 1060 #endif /* VBOX_WS_MAC */ 1060 connect( gConsoleEvents, &UIConsoleEventHandler::sigCPUExecutionCapChange,1061 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigCPUExecutionCapChange, 1061 1062 this, &UISession::sigCPUExecutionCapChange); 1062 connect( gConsoleEvents, &UIConsoleEventHandler::sigGuestMonitorChange,1063 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigGuestMonitorChange, 1063 1064 this, &UISession::sltGuestMonitorChange); 1064 connect( gConsoleEvents, &UIConsoleEventHandler::sigAudioAdapterChange,1065 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigAudioAdapterChange, 1065 1066 this, &UISession::sltAudioAdapterChange); 1066 connect( gConsoleEvents, &UIConsoleEventHandler::sigClipboardModeChange,1067 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigClipboardModeChange, 1067 1068 this, &UISession::sltClipboardModeChange); 1068 connect( gConsoleEvents, &UIConsoleEventHandler::sigDnDModeChange,1069 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigDnDModeChange, 1069 1070 this, &UISession::sltDnDModeChange); 1070 1071 } … … 1328 1329 void UISession::cleanupConsoleEventHandlers() 1329 1330 { 1330 /* Destroy console event-handler if necessary: */1331 if (gConsoleEvents)1332 UIConsoleEventHandler::destroy();1331 /* Destroy console event-handler: */ 1332 delete m_pConsoleEventhandler; 1333 m_pConsoleEventhandler = 0; 1333 1334 } 1334 1335 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98376 r98377 58 58 /* Forward declarations: */ 59 59 class QMenu; 60 class UIConsoleEventHandler; 60 61 class UIFrameBuffer; 61 62 class UIMachine; … … 75 76 { 76 77 Q_OBJECT; 77 78 public:79 80 /** Factory constructor. */81 static bool create(UISession *&pSession, UIMachine *pMachine);82 /** Factory destructor. */83 static void destroy(UISession *&pSession);84 85 /* API: Runtime UI stuff: */86 bool initialize();87 /** Powers VM up. */88 bool powerUp();89 /** Detaches and closes Runtime UI. */90 void detachUi();91 /** Saves VM state, then closes Runtime UI. */92 void saveState();93 /** Calls for guest shutdown to close Runtime UI. */94 void shutdown();95 /** Powers VM off, then closes Runtime UI. */96 void powerOff(bool fIncludingDiscard);97 98 /** Returns the session instance. */99 CSession& session() { return m_session; }100 /** Returns the session's machine instance. */101 CMachine& machine() { return m_machine; }102 /** Returns the session's console instance. */103 CConsole& console() { return m_console; }104 /** Returns the console's display instance. */105 CDisplay& display() { return m_display; }106 /** Returns the console's guest instance. */107 CGuest& guest() { return m_guest; }108 /** Returns the console's mouse instance. */109 CMouse& mouse() { return m_mouse; }110 /** Returns the console's keyboard instance. */111 CKeyboard& keyboard() { return m_keyboard; }112 /** Returns the console's debugger instance. */113 CMachineDebugger& debugger() { return m_debugger; }114 115 /** Returns the machine name. */116 const QString& machineName() const { return m_strMachineName; }117 118 UIActionPool* actionPool() const { return m_pActionPool; }119 KMachineState machineStatePrevious() const { return m_machineStatePrevious; }120 KMachineState machineState() const { return m_machineState; }121 UIMachineLogic* machineLogic() const;122 QWidget* mainMachineWindow() const;123 WId mainMachineWindowId() const;124 UIMachineWindow *activeMachineWindow() const;125 126 /** Returns currently cached mouse cursor shape pixmap. */127 QPixmap cursorShapePixmap() const { return m_cursorShapePixmap; }128 /** Returns currently cached mouse cursor mask pixmap. */129 QPixmap cursorMaskPixmap() const { return m_cursorMaskPixmap; }130 /** Returns currently cached mouse cursor size. */131 QSize cursorSize() const { return m_cursorSize; }132 /** Returns currently cached mouse cursor hotspot. */133 QPoint cursorHotspot() const { return m_cursorHotspot; }134 /** Returns currently cached mouse cursor position. */135 QPoint cursorPosition() const { return m_cursorPosition; }136 137 /** @name Host-screen configuration variables.138 ** @{ */139 /** Returns the list of host-screen geometries we currently have. */140 QList<QRect> hostScreens() const { return m_hostScreens; }141 /** @} */142 143 /** @name Application Close configuration stuff.144 * @{ */145 /** Defines @a defaultCloseAction. */146 void setDefaultCloseAction(MachineCloseAction defaultCloseAction) { m_defaultCloseAction = defaultCloseAction; }147 /** Returns default close action. */148 MachineCloseAction defaultCloseAction() const { return m_defaultCloseAction; }149 /** Returns merged restricted close actions. */150 MachineCloseAction restrictedCloseActions() const { return m_restrictedCloseActions; }151 /** Returns whether all the close actions are restricted. */152 bool isAllCloseActionsRestricted() const { return m_fAllCloseActionsRestricted; }153 /** @} */154 155 /** Returns whether visual @a state is allowed. */156 bool isVisualStateAllowed(UIVisualStateType state) const;157 /** Requests visual-state change. */158 void changeVisualState(UIVisualStateType visualStateType);159 /** Requests visual-state to be entered when possible. */160 void setRequestedVisualState(UIVisualStateType visualStateType);161 /** Returns requested visual-state to be entered when possible. */162 UIVisualStateType requestedVisualState() const;163 164 bool isSaved() const { return machineState() == KMachineState_Saved ||165 machineState() == KMachineState_AbortedSaved; }166 bool isTurnedOff() const { return machineState() == KMachineState_PoweredOff ||167 machineState() == KMachineState_Saved ||168 machineState() == KMachineState_Teleported ||169 machineState() == KMachineState_Aborted ||170 machineState() == KMachineState_AbortedSaved; }171 bool isPaused() const { return machineState() == KMachineState_Paused ||172 machineState() == KMachineState_TeleportingPausedVM; }173 bool isRunning() const { return machineState() == KMachineState_Running ||174 machineState() == KMachineState_Teleporting ||175 machineState() == KMachineState_LiveSnapshotting; }176 bool isStuck() const { return machineState() == KMachineState_Stuck; }177 bool wasPaused() const { return machineStatePrevious() == KMachineState_Paused ||178 machineStatePrevious() == KMachineState_TeleportingPausedVM; }179 bool isInitialized() const { return m_fInitialized; }180 bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; }181 bool isAutoCaptureDisabled() const { return m_fIsAutoCaptureDisabled; }182 183 /** Returns whether VM is in 'manual-override' mode.184 * @note S.a. #m_fIsManualOverride description for more information. */185 bool isManualOverrideMode() const { return m_fIsManualOverride; }186 /** Defines whether VM is in 'manual-override' mode.187 * @note S.a. #m_fIsManualOverride description for more information. */188 void setManualOverrideMode(bool fIsManualOverride) { m_fIsManualOverride = fIsManualOverride; }189 190 /* Guest additions state getters: */191 bool isGuestAdditionsActive() const { return (m_ulGuestAdditionsRunLevel > KAdditionsRunLevelType_None); }192 bool isGuestSupportsGraphics() const { return m_fIsGuestSupportsGraphics; }193 /* The double check below is correct, even though it is an implementation194 * detail of the Additions which the GUI should not ideally have to know. */195 bool isGuestSupportsSeamless() const { return isGuestSupportsGraphics() && m_fIsGuestSupportsSeamless; }196 197 /* Keyboard getters: */198 /** Returns keyboard-state. */199 int keyboardState() const { return m_iKeyboardState; }200 bool isNumLock() const { return m_fNumLock; }201 bool isCapsLock() const { return m_fCapsLock; }202 bool isScrollLock() const { return m_fScrollLock; }203 uint numLockAdaptionCnt() const { return m_uNumLockAdaptionCnt; }204 uint capsLockAdaptionCnt() const { return m_uCapsLockAdaptionCnt; }205 206 /* Mouse getters: */207 /** Returns mouse-state. */208 int mouseState() const { return m_iMouseState; }209 bool isMouseSupportsAbsolute() const { return m_fIsMouseSupportsAbsolute; }210 bool isMouseSupportsRelative() const { return m_fIsMouseSupportsRelative; }211 bool isMouseSupportsTouchScreen() const { return m_fIsMouseSupportsTouchScreen; }212 bool isMouseSupportsTouchPad() const { return m_fIsMouseSupportsTouchPad; }213 bool isMouseHostCursorNeeded() const { return m_fIsMouseHostCursorNeeded; }214 bool isMouseCaptured() const { return m_fIsMouseCaptured; }215 bool isMouseIntegrated() const { return m_fIsMouseIntegrated; }216 bool isValidPointerShapePresent() const { return m_fIsValidPointerShapePresent; }217 bool isHidingHostPointer() const { return m_fIsHidingHostPointer; }218 /** Returns whether the @a cursorPosition() is valid and could be used by the GUI now. */219 bool isValidCursorPositionPresent() const { return m_fIsValidCursorPositionPresent; }220 221 /* Common setters: */222 bool pause() { return setPause(true); }223 bool unpause() { return setPause(false); }224 bool setPause(bool fOn);225 void setGuestResizeIgnored(bool fIsGuestResizeIgnored) { m_fIsGuestResizeIgnored = fIsGuestResizeIgnored; }226 void setAutoCaptureDisabled(bool fIsAutoCaptureDisabled) { m_fIsAutoCaptureDisabled = fIsAutoCaptureDisabled; }227 void forgetPreviousMachineState() { m_machineStatePrevious = m_machineState; }228 229 /* Keyboard setters: */230 void setNumLockAdaptionCnt(uint uNumLockAdaptionCnt) { m_uNumLockAdaptionCnt = uNumLockAdaptionCnt; }231 void setCapsLockAdaptionCnt(uint uCapsLockAdaptionCnt) { m_uCapsLockAdaptionCnt = uCapsLockAdaptionCnt; }232 233 /* Mouse setters: */234 void setMouseCaptured(bool fIsMouseCaptured) { m_fIsMouseCaptured = fIsMouseCaptured; }235 void setMouseIntegrated(bool fIsMouseIntegrated) { m_fIsMouseIntegrated = fIsMouseIntegrated; }236 237 /* Screen visibility status for host-desires: */238 bool isScreenVisibleHostDesires(ulong uScreenId) const;239 void setScreenVisibleHostDesires(ulong uScreenId, bool fIsMonitorVisible);240 241 /* Screen visibility status: */242 bool isScreenVisible(ulong uScreenId) const;243 void setScreenVisible(ulong uScreenId, bool fIsMonitorVisible);244 245 /* Last screen full-screen size: */246 QSize lastFullScreenSize(ulong uScreenId) const;247 void setLastFullScreenSize(ulong uScreenId, QSize size);248 249 /** Returns whether guest-screen is undrawable.250 * @todo: extend this method to all the states when guest-screen is undrawable. */251 bool isGuestScreenUnDrawable() const { return machineState() == KMachineState_Stopping ||252 machineState() == KMachineState_Saving; }253 254 /* Returns existing framebuffer for the given screen-number;255 * Returns 0 (asserts) if screen-number attribute is out of bounds: */256 UIFrameBuffer* frameBuffer(ulong uScreenId) const;257 /* Sets framebuffer for the given screen-number;258 * Ignores (asserts) if screen-number attribute is out of bounds: */259 void setFrameBuffer(ulong uScreenId, UIFrameBuffer* pFrameBuffer);260 /** Returns existing frame-buffer vector. */261 const QVector<UIFrameBuffer*>& frameBuffers() const { return m_frameBufferVector; }262 263 /** Updates VRDE Server action state. */264 void updateStatusVRDE() { sltVRDEChange(); }265 /** Updates Recording action state. */266 void updateStatusRecording() { sltRecordingChange(); }267 /** Updates Audio output action state. */268 void updateAudioOutput() { sltAudioAdapterChange(); }269 /** Updates Audio input action state. */270 void updateAudioInput() { sltAudioAdapterChange(); }271 272 /** @name CPU hardware virtualization features for VM.273 ** @{ */274 /** Returns whether CPU hardware virtualization extension is enabled. */275 KVMExecutionEngine getVMExecutionEngine() const { return m_enmVMExecutionEngine; }276 /** Returns whether nested-paging CPU hardware virtualization extension is enabled. */277 bool isHWVirtExNestedPagingEnabled() const { return m_fIsHWVirtExNestedPagingEnabled; }278 /** Returns whether the VM is currently making use of the unrestricted execution feature of VT-x. */279 bool isHWVirtExUXEnabled() const { return m_fIsHWVirtExUXEnabled; }280 /** @} */281 282 /** Returns VM's effective paravirtualization provider. */283 KParavirtProvider paraVirtProvider() const { return m_paraVirtProvider; }284 285 /** Returns the list of visible guest windows. */286 QList<int> listOfVisibleWindows() const;287 288 /** Returns a vector of media attached to the machine. */289 CMediumVector machineMedia() const;290 78 291 79 signals: … … 338 126 void sigInitialized(); 339 127 128 public: 129 130 /** Factory constructor. */ 131 static bool create(UISession *&pSession, UIMachine *pMachine); 132 /** Factory destructor. */ 133 static void destroy(UISession *&pSession); 134 135 /* API: Runtime UI stuff: */ 136 bool initialize(); 137 /** Powers VM up. */ 138 bool powerUp(); 139 /** Detaches and closes Runtime UI. */ 140 void detachUi(); 141 /** Saves VM state, then closes Runtime UI. */ 142 void saveState(); 143 /** Calls for guest shutdown to close Runtime UI. */ 144 void shutdown(); 145 /** Powers VM off, then closes Runtime UI. */ 146 void powerOff(bool fIncludingDiscard); 147 148 /** Returns the session instance. */ 149 CSession& session() { return m_session; } 150 /** Returns the session's machine instance. */ 151 CMachine& machine() { return m_machine; } 152 /** Returns the session's console instance. */ 153 CConsole& console() { return m_console; } 154 /** Returns the console's display instance. */ 155 CDisplay& display() { return m_display; } 156 /** Returns the console's guest instance. */ 157 CGuest& guest() { return m_guest; } 158 /** Returns the console's mouse instance. */ 159 CMouse& mouse() { return m_mouse; } 160 /** Returns the console's keyboard instance. */ 161 CKeyboard& keyboard() { return m_keyboard; } 162 /** Returns the console's debugger instance. */ 163 CMachineDebugger& debugger() { return m_debugger; } 164 165 /** Returns the machine name. */ 166 const QString& machineName() const { return m_strMachineName; } 167 168 UIActionPool* actionPool() const { return m_pActionPool; } 169 KMachineState machineStatePrevious() const { return m_machineStatePrevious; } 170 KMachineState machineState() const { return m_machineState; } 171 UIMachineLogic* machineLogic() const; 172 QWidget* mainMachineWindow() const; 173 WId mainMachineWindowId() const; 174 UIMachineWindow *activeMachineWindow() const; 175 176 /** Returns currently cached mouse cursor shape pixmap. */ 177 QPixmap cursorShapePixmap() const { return m_cursorShapePixmap; } 178 /** Returns currently cached mouse cursor mask pixmap. */ 179 QPixmap cursorMaskPixmap() const { return m_cursorMaskPixmap; } 180 /** Returns currently cached mouse cursor size. */ 181 QSize cursorSize() const { return m_cursorSize; } 182 /** Returns currently cached mouse cursor hotspot. */ 183 QPoint cursorHotspot() const { return m_cursorHotspot; } 184 /** Returns currently cached mouse cursor position. */ 185 QPoint cursorPosition() const { return m_cursorPosition; } 186 187 /** @name Host-screen configuration variables. 188 ** @{ */ 189 /** Returns the list of host-screen geometries we currently have. */ 190 QList<QRect> hostScreens() const { return m_hostScreens; } 191 /** @} */ 192 193 /** @name Application Close configuration stuff. 194 * @{ */ 195 /** Defines @a defaultCloseAction. */ 196 void setDefaultCloseAction(MachineCloseAction defaultCloseAction) { m_defaultCloseAction = defaultCloseAction; } 197 /** Returns default close action. */ 198 MachineCloseAction defaultCloseAction() const { return m_defaultCloseAction; } 199 /** Returns merged restricted close actions. */ 200 MachineCloseAction restrictedCloseActions() const { return m_restrictedCloseActions; } 201 /** Returns whether all the close actions are restricted. */ 202 bool isAllCloseActionsRestricted() const { return m_fAllCloseActionsRestricted; } 203 /** @} */ 204 205 /** Returns whether visual @a state is allowed. */ 206 bool isVisualStateAllowed(UIVisualStateType state) const; 207 /** Requests visual-state change. */ 208 void changeVisualState(UIVisualStateType visualStateType); 209 /** Requests visual-state to be entered when possible. */ 210 void setRequestedVisualState(UIVisualStateType visualStateType); 211 /** Returns requested visual-state to be entered when possible. */ 212 UIVisualStateType requestedVisualState() const; 213 214 bool isSaved() const { return machineState() == KMachineState_Saved || 215 machineState() == KMachineState_AbortedSaved; } 216 bool isTurnedOff() const { return machineState() == KMachineState_PoweredOff || 217 machineState() == KMachineState_Saved || 218 machineState() == KMachineState_Teleported || 219 machineState() == KMachineState_Aborted || 220 machineState() == KMachineState_AbortedSaved; } 221 bool isPaused() const { return machineState() == KMachineState_Paused || 222 machineState() == KMachineState_TeleportingPausedVM; } 223 bool isRunning() const { return machineState() == KMachineState_Running || 224 machineState() == KMachineState_Teleporting || 225 machineState() == KMachineState_LiveSnapshotting; } 226 bool isStuck() const { return machineState() == KMachineState_Stuck; } 227 bool wasPaused() const { return machineStatePrevious() == KMachineState_Paused || 228 machineStatePrevious() == KMachineState_TeleportingPausedVM; } 229 bool isInitialized() const { return m_fInitialized; } 230 bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; } 231 bool isAutoCaptureDisabled() const { return m_fIsAutoCaptureDisabled; } 232 233 /** Returns whether VM is in 'manual-override' mode. 234 * @note S.a. #m_fIsManualOverride description for more information. */ 235 bool isManualOverrideMode() const { return m_fIsManualOverride; } 236 /** Defines whether VM is in 'manual-override' mode. 237 * @note S.a. #m_fIsManualOverride description for more information. */ 238 void setManualOverrideMode(bool fIsManualOverride) { m_fIsManualOverride = fIsManualOverride; } 239 240 /* Guest additions state getters: */ 241 bool isGuestAdditionsActive() const { return (m_ulGuestAdditionsRunLevel > KAdditionsRunLevelType_None); } 242 bool isGuestSupportsGraphics() const { return m_fIsGuestSupportsGraphics; } 243 /* The double check below is correct, even though it is an implementation 244 * detail of the Additions which the GUI should not ideally have to know. */ 245 bool isGuestSupportsSeamless() const { return isGuestSupportsGraphics() && m_fIsGuestSupportsSeamless; } 246 247 /* Keyboard getters: */ 248 /** Returns keyboard-state. */ 249 int keyboardState() const { return m_iKeyboardState; } 250 bool isNumLock() const { return m_fNumLock; } 251 bool isCapsLock() const { return m_fCapsLock; } 252 bool isScrollLock() const { return m_fScrollLock; } 253 uint numLockAdaptionCnt() const { return m_uNumLockAdaptionCnt; } 254 uint capsLockAdaptionCnt() const { return m_uCapsLockAdaptionCnt; } 255 256 /* Mouse getters: */ 257 /** Returns mouse-state. */ 258 int mouseState() const { return m_iMouseState; } 259 bool isMouseSupportsAbsolute() const { return m_fIsMouseSupportsAbsolute; } 260 bool isMouseSupportsRelative() const { return m_fIsMouseSupportsRelative; } 261 bool isMouseSupportsTouchScreen() const { return m_fIsMouseSupportsTouchScreen; } 262 bool isMouseSupportsTouchPad() const { return m_fIsMouseSupportsTouchPad; } 263 bool isMouseHostCursorNeeded() const { return m_fIsMouseHostCursorNeeded; } 264 bool isMouseCaptured() const { return m_fIsMouseCaptured; } 265 bool isMouseIntegrated() const { return m_fIsMouseIntegrated; } 266 bool isValidPointerShapePresent() const { return m_fIsValidPointerShapePresent; } 267 bool isHidingHostPointer() const { return m_fIsHidingHostPointer; } 268 /** Returns whether the @a cursorPosition() is valid and could be used by the GUI now. */ 269 bool isValidCursorPositionPresent() const { return m_fIsValidCursorPositionPresent; } 270 271 /* Common setters: */ 272 bool pause() { return setPause(true); } 273 bool unpause() { return setPause(false); } 274 bool setPause(bool fOn); 275 void setGuestResizeIgnored(bool fIsGuestResizeIgnored) { m_fIsGuestResizeIgnored = fIsGuestResizeIgnored; } 276 void setAutoCaptureDisabled(bool fIsAutoCaptureDisabled) { m_fIsAutoCaptureDisabled = fIsAutoCaptureDisabled; } 277 void forgetPreviousMachineState() { m_machineStatePrevious = m_machineState; } 278 279 /* Keyboard setters: */ 280 void setNumLockAdaptionCnt(uint uNumLockAdaptionCnt) { m_uNumLockAdaptionCnt = uNumLockAdaptionCnt; } 281 void setCapsLockAdaptionCnt(uint uCapsLockAdaptionCnt) { m_uCapsLockAdaptionCnt = uCapsLockAdaptionCnt; } 282 283 /* Mouse setters: */ 284 void setMouseCaptured(bool fIsMouseCaptured) { m_fIsMouseCaptured = fIsMouseCaptured; } 285 void setMouseIntegrated(bool fIsMouseIntegrated) { m_fIsMouseIntegrated = fIsMouseIntegrated; } 286 287 /* Screen visibility status for host-desires: */ 288 bool isScreenVisibleHostDesires(ulong uScreenId) const; 289 void setScreenVisibleHostDesires(ulong uScreenId, bool fIsMonitorVisible); 290 291 /* Screen visibility status: */ 292 bool isScreenVisible(ulong uScreenId) const; 293 void setScreenVisible(ulong uScreenId, bool fIsMonitorVisible); 294 295 /* Last screen full-screen size: */ 296 QSize lastFullScreenSize(ulong uScreenId) const; 297 void setLastFullScreenSize(ulong uScreenId, QSize size); 298 299 /** Returns whether guest-screen is undrawable. 300 * @todo: extend this method to all the states when guest-screen is undrawable. */ 301 bool isGuestScreenUnDrawable() const { return machineState() == KMachineState_Stopping || 302 machineState() == KMachineState_Saving; } 303 304 /* Returns existing framebuffer for the given screen-number; 305 * Returns 0 (asserts) if screen-number attribute is out of bounds: */ 306 UIFrameBuffer* frameBuffer(ulong uScreenId) const; 307 /* Sets framebuffer for the given screen-number; 308 * Ignores (asserts) if screen-number attribute is out of bounds: */ 309 void setFrameBuffer(ulong uScreenId, UIFrameBuffer* pFrameBuffer); 310 /** Returns existing frame-buffer vector. */ 311 const QVector<UIFrameBuffer*>& frameBuffers() const { return m_frameBufferVector; } 312 313 /** Updates VRDE Server action state. */ 314 void updateStatusVRDE() { sltVRDEChange(); } 315 /** Updates Recording action state. */ 316 void updateStatusRecording() { sltRecordingChange(); } 317 /** Updates Audio output action state. */ 318 void updateAudioOutput() { sltAudioAdapterChange(); } 319 /** Updates Audio input action state. */ 320 void updateAudioInput() { sltAudioAdapterChange(); } 321 322 /** @name CPU hardware virtualization features for VM. 323 ** @{ */ 324 /** Returns whether CPU hardware virtualization extension is enabled. */ 325 KVMExecutionEngine getVMExecutionEngine() const { return m_enmVMExecutionEngine; } 326 /** Returns whether nested-paging CPU hardware virtualization extension is enabled. */ 327 bool isHWVirtExNestedPagingEnabled() const { return m_fIsHWVirtExNestedPagingEnabled; } 328 /** Returns whether the VM is currently making use of the unrestricted execution feature of VT-x. */ 329 bool isHWVirtExUXEnabled() const { return m_fIsHWVirtExUXEnabled; } 330 /** @} */ 331 332 /** Returns VM's effective paravirtualization provider. */ 333 KParavirtProvider paraVirtProvider() const { return m_paraVirtProvider; } 334 335 /** Returns the list of visible guest windows. */ 336 QList<int> listOfVisibleWindows() const; 337 338 /** Returns a vector of media attached to the machine. */ 339 CMediumVector machineMedia() const; 340 340 341 public slots: 341 342 … … 475 476 /* Check if GA can be upgraded. */ 476 477 bool guestAdditionsUpgradable(); 478 477 479 /* Private variables: */ 478 480 UIMachine *m_pMachine; 481 482 /** Holds the CConsole event handler instance. */ 483 UIConsoleEventHandler *m_pConsoleEventhandler; 479 484 480 485 /** Holds the session instance. */
Note:
See TracChangeset
for help on using the changeset viewer.