1 | /* $Id: UISession.h 82032 2019-11-20 16:21:59Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UISession class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef FEQT_INCLUDED_SRC_runtime_UISession_h
|
---|
19 | #define FEQT_INCLUDED_SRC_runtime_UISession_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QObject>
|
---|
26 | #include <QCursor>
|
---|
27 | #include <QEvent>
|
---|
28 | #include <QMap>
|
---|
29 | #include <QPixmap>
|
---|
30 |
|
---|
31 | /* GUI includes: */
|
---|
32 | #include "UIExtraDataDefs.h"
|
---|
33 | #include "UIMediumDefs.h"
|
---|
34 | #include "UIMousePointerShapeData.h"
|
---|
35 |
|
---|
36 | /* COM includes: */
|
---|
37 | #include "COMEnums.h"
|
---|
38 | #include "CSession.h"
|
---|
39 | #include "CMachine.h"
|
---|
40 | #include "CConsole.h"
|
---|
41 | #include "CDisplay.h"
|
---|
42 | #include "CGuest.h"
|
---|
43 | #include "CMouse.h"
|
---|
44 | #include "CKeyboard.h"
|
---|
45 | #include "CMachineDebugger.h"
|
---|
46 | #include "CMedium.h"
|
---|
47 |
|
---|
48 | /* Forward declarations: */
|
---|
49 | class QMenu;
|
---|
50 | class UIFrameBuffer;
|
---|
51 | class UIMachine;
|
---|
52 | class UIMachineLogic;
|
---|
53 | class UIMachineWindow;
|
---|
54 | class UIActionPool;
|
---|
55 | class CUSBDevice;
|
---|
56 | class CNetworkAdapter;
|
---|
57 | class CMediumAttachment;
|
---|
58 | #ifdef VBOX_WS_MAC
|
---|
59 | class QMenuBar;
|
---|
60 | #else /* !VBOX_WS_MAC */
|
---|
61 | class QIcon;
|
---|
62 | #endif /* !VBOX_WS_MAC */
|
---|
63 |
|
---|
64 | /* CConsole callback event types: */
|
---|
65 | enum UIConsoleEventType
|
---|
66 | {
|
---|
67 | UIConsoleEventType_MousePointerShapeChange = QEvent::User + 1,
|
---|
68 | UIConsoleEventType_MouseCapabilityChange,
|
---|
69 | UIConsoleEventType_KeyboardLedsChange,
|
---|
70 | UIConsoleEventType_StateChange,
|
---|
71 | UIConsoleEventType_AdditionsStateChange,
|
---|
72 | UIConsoleEventType_NetworkAdapterChange,
|
---|
73 | /* Not used: UIConsoleEventType_SerialPortChange, */
|
---|
74 | /* Not used: UIConsoleEventType_ParallelPortChange, */
|
---|
75 | /* Not used: UIConsoleEventType_StorageControllerChange, */
|
---|
76 | UIConsoleEventType_MediumChange,
|
---|
77 | /* Not used: UIConsoleEventType_CPUChange, */
|
---|
78 | UIConsoleEventType_VRDEServerChange,
|
---|
79 | UIConsoleEventType_VRDEServerInfoChange,
|
---|
80 | UIConsoleEventType_USBControllerChange,
|
---|
81 | UIConsoleEventType_USBDeviceStateChange,
|
---|
82 | UIConsoleEventType_SharedFolderChange,
|
---|
83 | UIConsoleEventType_RuntimeError,
|
---|
84 | UIConsoleEventType_CanShowWindow,
|
---|
85 | UIConsoleEventType_ShowWindow,
|
---|
86 | UIConsoleEventType_MAX
|
---|
87 | };
|
---|
88 |
|
---|
89 | class UISession : public QObject
|
---|
90 | {
|
---|
91 | Q_OBJECT;
|
---|
92 |
|
---|
93 | public:
|
---|
94 |
|
---|
95 | /** Factory constructor. */
|
---|
96 | static bool create(UISession *&pSession, UIMachine *pMachine);
|
---|
97 | /** Factory destructor. */
|
---|
98 | static void destroy(UISession *&pSession);
|
---|
99 |
|
---|
100 | /* API: Runtime UI stuff: */
|
---|
101 | bool initialize();
|
---|
102 | bool powerUp();
|
---|
103 | bool detach();
|
---|
104 | bool saveState();
|
---|
105 | bool shutdown();
|
---|
106 | bool powerOff(bool fIncludingDiscard, bool &fServerCrashed);
|
---|
107 | bool restoreCurrentSnapshot();
|
---|
108 |
|
---|
109 | /** Returns the session instance. */
|
---|
110 | CSession& session() { return m_session; }
|
---|
111 | /** Returns the session's machine instance. */
|
---|
112 | CMachine& machine() { return m_machine; }
|
---|
113 | /** Returns the session's console instance. */
|
---|
114 | CConsole& console() { return m_console; }
|
---|
115 | /** Returns the console's display instance. */
|
---|
116 | CDisplay& display() { return m_display; }
|
---|
117 | /** Returns the console's guest instance. */
|
---|
118 | CGuest& guest() { return m_guest; }
|
---|
119 | /** Returns the console's mouse instance. */
|
---|
120 | CMouse& mouse() { return m_mouse; }
|
---|
121 | /** Returns the console's keyboard instance. */
|
---|
122 | CKeyboard& keyboard() { return m_keyboard; }
|
---|
123 | /** Returns the console's debugger instance. */
|
---|
124 | CMachineDebugger& debugger() { return m_debugger; }
|
---|
125 |
|
---|
126 | /** Returns the machine name. */
|
---|
127 | const QString& machineName() const { return m_strMachineName; }
|
---|
128 |
|
---|
129 | UIActionPool* actionPool() const { return m_pActionPool; }
|
---|
130 | KMachineState machineStatePrevious() const { return m_machineStatePrevious; }
|
---|
131 | KMachineState machineState() const { return m_machineState; }
|
---|
132 | UIMachineLogic* machineLogic() const;
|
---|
133 | QWidget* mainMachineWindow() const;
|
---|
134 | WId mainMachineWindowId() const;
|
---|
135 | UIMachineWindow *activeMachineWindow() const;
|
---|
136 |
|
---|
137 | /** Returns currently cached mouse cursor shape pixmap. */
|
---|
138 | QPixmap cursorShapePixmap() const { return m_cursorShapePixmap; }
|
---|
139 | /** Returns currently cached mouse cursor mask pixmap. */
|
---|
140 | QPixmap cursorMaskPixmap() const { return m_cursorMaskPixmap; }
|
---|
141 | /** Returns currently cached mouse cursor size. */
|
---|
142 | QSize cursorSize() const { return m_cursorSize; }
|
---|
143 | /** Returns currently cached mouse cursor hotspot. */
|
---|
144 | QPoint cursorHotspot() const { return m_cursorHotspot; }
|
---|
145 | /** Returns currently cached mouse cursor position. */
|
---|
146 | QPoint cursorPosition() const { return m_cursorPosition; }
|
---|
147 |
|
---|
148 | /** @name Branding stuff.
|
---|
149 | ** @{ */
|
---|
150 | /** Returns the cached machine-window icon. */
|
---|
151 | QIcon *machineWindowIcon() const { return m_pMachineWindowIcon; }
|
---|
152 | #ifndef VBOX_WS_MAC
|
---|
153 | /** Returns redefined machine-window name postfix. */
|
---|
154 | QString machineWindowNamePostfix() const { return m_strMachineWindowNamePostfix; }
|
---|
155 | #endif
|
---|
156 | /** @} */
|
---|
157 |
|
---|
158 | /** @name Host-screen configuration variables.
|
---|
159 | ** @{ */
|
---|
160 | /** Returns the list of host-screen geometries we currently have. */
|
---|
161 | QList<QRect> hostScreens() const { return m_hostScreens; }
|
---|
162 | /** @} */
|
---|
163 |
|
---|
164 | /** @name Application Close configuration stuff.
|
---|
165 | * @{ */
|
---|
166 | /** Defines @a defaultCloseAction. */
|
---|
167 | void setDefaultCloseAction(MachineCloseAction defaultCloseAction) { m_defaultCloseAction = defaultCloseAction; }
|
---|
168 | /** Returns default close action. */
|
---|
169 | MachineCloseAction defaultCloseAction() const { return m_defaultCloseAction; }
|
---|
170 | /** Returns merged restricted close actions. */
|
---|
171 | MachineCloseAction restrictedCloseActions() const { return m_restrictedCloseActions; }
|
---|
172 | /** Returns whether all the close actions are restricted. */
|
---|
173 | bool isAllCloseActionsRestricted() const { return m_fAllCloseActionsRestricted; }
|
---|
174 | /** @} */
|
---|
175 |
|
---|
176 | /** Returns whether visual @a state is allowed. */
|
---|
177 | bool isVisualStateAllowed(UIVisualStateType state) const;
|
---|
178 | /** Requests visual-state change. */
|
---|
179 | void changeVisualState(UIVisualStateType visualStateType);
|
---|
180 | /** Requests visual-state to be entered when possible. */
|
---|
181 | void setRequestedVisualState(UIVisualStateType visualStateType) { m_requestedVisualStateType = visualStateType; }
|
---|
182 | /** Returns requested visual-state to be entered when possible. */
|
---|
183 | UIVisualStateType requestedVisualState() const { return m_requestedVisualStateType; }
|
---|
184 |
|
---|
185 | bool isSaved() const { return machineState() == KMachineState_Saved; }
|
---|
186 | bool isTurnedOff() const { return machineState() == KMachineState_PoweredOff ||
|
---|
187 | machineState() == KMachineState_Saved ||
|
---|
188 | machineState() == KMachineState_Teleported ||
|
---|
189 | machineState() == KMachineState_Aborted; }
|
---|
190 | bool isPaused() const { return machineState() == KMachineState_Paused ||
|
---|
191 | machineState() == KMachineState_TeleportingPausedVM; }
|
---|
192 | bool isRunning() const { return machineState() == KMachineState_Running ||
|
---|
193 | machineState() == KMachineState_Teleporting ||
|
---|
194 | machineState() == KMachineState_LiveSnapshotting; }
|
---|
195 | bool isStuck() const { return machineState() == KMachineState_Stuck; }
|
---|
196 | bool wasPaused() const { return machineStatePrevious() == KMachineState_Paused ||
|
---|
197 | machineStatePrevious() == KMachineState_TeleportingPausedVM; }
|
---|
198 | bool isInitialized() const { return m_fInitialized; }
|
---|
199 | bool isFirstTimeStarted() const { return m_fIsFirstTimeStarted; }
|
---|
200 | bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; }
|
---|
201 | bool isAutoCaptureDisabled() const { return m_fIsAutoCaptureDisabled; }
|
---|
202 |
|
---|
203 | /* Guest additions state getters: */
|
---|
204 | bool isGuestAdditionsActive() const { return (m_ulGuestAdditionsRunLevel > KAdditionsRunLevelType_None); }
|
---|
205 | bool isGuestSupportsGraphics() const { return m_fIsGuestSupportsGraphics; }
|
---|
206 | /* The double check below is correct, even though it is an implementation
|
---|
207 | * detail of the Additions which the GUI should not ideally have to know. */
|
---|
208 | bool isGuestSupportsSeamless() const { return isGuestSupportsGraphics() && m_fIsGuestSupportsSeamless; }
|
---|
209 |
|
---|
210 | /* Keyboard getters: */
|
---|
211 | /** Returns keyboard-state. */
|
---|
212 | int keyboardState() const { return m_iKeyboardState; }
|
---|
213 | bool isNumLock() const { return m_fNumLock; }
|
---|
214 | bool isCapsLock() const { return m_fCapsLock; }
|
---|
215 | bool isScrollLock() const { return m_fScrollLock; }
|
---|
216 | uint numLockAdaptionCnt() const { return m_uNumLockAdaptionCnt; }
|
---|
217 | uint capsLockAdaptionCnt() const { return m_uCapsLockAdaptionCnt; }
|
---|
218 |
|
---|
219 | /* Mouse getters: */
|
---|
220 | /** Returns mouse-state. */
|
---|
221 | int mouseState() const { return m_iMouseState; }
|
---|
222 | bool isMouseSupportsAbsolute() const { return m_fIsMouseSupportsAbsolute; }
|
---|
223 | bool isMouseSupportsRelative() const { return m_fIsMouseSupportsRelative; }
|
---|
224 | bool isMouseSupportsMultiTouch() const { return m_fIsMouseSupportsMultiTouch; }
|
---|
225 | bool isMouseHostCursorNeeded() const { return m_fIsMouseHostCursorNeeded; }
|
---|
226 | bool isMouseCaptured() const { return m_fIsMouseCaptured; }
|
---|
227 | bool isMouseIntegrated() const { return m_fIsMouseIntegrated; }
|
---|
228 | bool isValidPointerShapePresent() const { return m_fIsValidPointerShapePresent; }
|
---|
229 | bool isHidingHostPointer() const { return m_fIsHidingHostPointer; }
|
---|
230 | /** Returns whether the @a cursorPosition() is valid and could be used by the GUI now. */
|
---|
231 | bool isValidCursorPositionPresent() const { return m_fIsValidCursorPositionPresent; }
|
---|
232 |
|
---|
233 | /* Common setters: */
|
---|
234 | bool pause() { return setPause(true); }
|
---|
235 | bool unpause() { return setPause(false); }
|
---|
236 | bool setPause(bool fOn);
|
---|
237 | void setGuestResizeIgnored(bool fIsGuestResizeIgnored) { m_fIsGuestResizeIgnored = fIsGuestResizeIgnored; }
|
---|
238 | void setAutoCaptureDisabled(bool fIsAutoCaptureDisabled) { m_fIsAutoCaptureDisabled = fIsAutoCaptureDisabled; }
|
---|
239 | void forgetPreviousMachineState() { m_machineStatePrevious = m_machineState; }
|
---|
240 |
|
---|
241 | /* Keyboard setters: */
|
---|
242 | void setNumLockAdaptionCnt(uint uNumLockAdaptionCnt) { m_uNumLockAdaptionCnt = uNumLockAdaptionCnt; }
|
---|
243 | void setCapsLockAdaptionCnt(uint uCapsLockAdaptionCnt) { m_uCapsLockAdaptionCnt = uCapsLockAdaptionCnt; }
|
---|
244 |
|
---|
245 | /* Mouse setters: */
|
---|
246 | void setMouseCaptured(bool fIsMouseCaptured) { m_fIsMouseCaptured = fIsMouseCaptured; }
|
---|
247 | void setMouseIntegrated(bool fIsMouseIntegrated) { m_fIsMouseIntegrated = fIsMouseIntegrated; }
|
---|
248 |
|
---|
249 | /* Screen visibility status for host-desires: */
|
---|
250 | bool isScreenVisibleHostDesires(ulong uScreenId) const;
|
---|
251 | void setScreenVisibleHostDesires(ulong uScreenId, bool fIsMonitorVisible);
|
---|
252 |
|
---|
253 | /* Screen visibility status: */
|
---|
254 | bool isScreenVisible(ulong uScreenId) const;
|
---|
255 | void setScreenVisible(ulong uScreenId, bool fIsMonitorVisible);
|
---|
256 |
|
---|
257 | /* Last screen full-screen size: */
|
---|
258 | QSize lastFullScreenSize(ulong uScreenId) const;
|
---|
259 | void setLastFullScreenSize(ulong uScreenId, QSize size);
|
---|
260 |
|
---|
261 | /** Returns whether guest-screen is undrawable.
|
---|
262 | * @todo: extend this method to all the states when guest-screen is undrawable. */
|
---|
263 | bool isGuestScreenUnDrawable() const { return machineState() == KMachineState_Stopping ||
|
---|
264 | machineState() == KMachineState_Saving; }
|
---|
265 |
|
---|
266 | /* Returns existing framebuffer for the given screen-number;
|
---|
267 | * Returns 0 (asserts) if screen-number attribute is out of bounds: */
|
---|
268 | UIFrameBuffer* frameBuffer(ulong uScreenId) const;
|
---|
269 | /* Sets framebuffer for the given screen-number;
|
---|
270 | * Ignores (asserts) if screen-number attribute is out of bounds: */
|
---|
271 | void setFrameBuffer(ulong uScreenId, UIFrameBuffer* pFrameBuffer);
|
---|
272 | /** Returns existing frame-buffer vector. */
|
---|
273 | const QVector<UIFrameBuffer*>& frameBuffers() const { return m_frameBufferVector; }
|
---|
274 |
|
---|
275 | /** Updates VRDE Server action state. */
|
---|
276 | void updateStatusVRDE() { sltVRDEChange(); }
|
---|
277 | /** Updates Recording action state. */
|
---|
278 | void updateStatusRecording() { sltRecordingChange(); }
|
---|
279 | /** Updates Audio output action state. */
|
---|
280 | void updateAudioOutput() { sltAudioAdapterChange(); }
|
---|
281 | /** Updates Audio input action state. */
|
---|
282 | void updateAudioInput() { sltAudioAdapterChange(); }
|
---|
283 |
|
---|
284 | /** @name CPU hardware virtualization features for VM.
|
---|
285 | ** @{ */
|
---|
286 | /** Returns whether CPU hardware virtualization extension is enabled. */
|
---|
287 | KVMExecutionEngine getVMExecutionEngine() const { return m_enmVMExecutionEngine; }
|
---|
288 | /** Returns whether nested-paging CPU hardware virtualization extension is enabled. */
|
---|
289 | bool isHWVirtExNestedPagingEnabled() const { return m_fIsHWVirtExNestedPagingEnabled; }
|
---|
290 | /** Returns whether the VM is currently making use of the unrestricted execution feature of VT-x. */
|
---|
291 | bool isHWVirtExUXEnabled() const { return m_fIsHWVirtExUXEnabled; }
|
---|
292 | /** @} */
|
---|
293 |
|
---|
294 | /** Returns VM's effective paravirtualization provider. */
|
---|
295 | KParavirtProvider paraVirtProvider() const { return m_paraVirtProvider; }
|
---|
296 |
|
---|
297 | /** Returns the list of visible guest windows. */
|
---|
298 | QList<int> listOfVisibleWindows() const;
|
---|
299 |
|
---|
300 | /** Returns a vector of media attached to the machine. */
|
---|
301 | CMediumVector machineMedia() const;
|
---|
302 |
|
---|
303 | signals:
|
---|
304 |
|
---|
305 | /** Notifies about frame-buffer resize. */
|
---|
306 | void sigFrameBufferResize();
|
---|
307 |
|
---|
308 | /* Console callback signals: */
|
---|
309 | /** Notifies listeners about keyboard state-change. */
|
---|
310 | void sigKeyboardStateChange(int iState);
|
---|
311 | /** Notifies listeners about mouse state-change. */
|
---|
312 | void sigMouseStateChange(int iState);
|
---|
313 | /** Notifies listeners about mouse pointer shape change. */
|
---|
314 | void sigMousePointerShapeChange();
|
---|
315 | /** Notifies listeners about mouse capability change. */
|
---|
316 | void sigMouseCapabilityChange();
|
---|
317 | /** Notifies listeners about cursor position change. */
|
---|
318 | void sigCursorPositionChange();
|
---|
319 | void sigKeyboardLedsChange();
|
---|
320 | void sigMachineStateChange();
|
---|
321 | void sigAdditionsStateChange();
|
---|
322 | void sigAdditionsStateActualChange();
|
---|
323 | void sigNetworkAdapterChange(const CNetworkAdapter &networkAdapter);
|
---|
324 | /** Notifies about storage device change for @a attachment, which was @a fRemoved and it was @a fSilent for guest. */
|
---|
325 | void sigStorageDeviceChange(const CMediumAttachment &attachment, bool fRemoved, bool fSilent);
|
---|
326 | void sigMediumChange(const CMediumAttachment &mediumAttachment);
|
---|
327 | void sigVRDEChange();
|
---|
328 | void sigRecordingChange();
|
---|
329 | void sigUSBControllerChange();
|
---|
330 | void sigUSBDeviceStateChange(const CUSBDevice &device, bool bIsAttached, const CVirtualBoxErrorInfo &error);
|
---|
331 | void sigSharedFolderChange();
|
---|
332 | void sigRuntimeError(bool bIsFatal, const QString &strErrorId, const QString &strMessage);
|
---|
333 | #ifdef RT_OS_DARWIN
|
---|
334 | void sigShowWindows();
|
---|
335 | #endif /* RT_OS_DARWIN */
|
---|
336 | void sigCPUExecutionCapChange();
|
---|
337 | void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
|
---|
338 | void sigAudioAdapterChange();
|
---|
339 | void sigClipboardModeChange(KClipboardMode enmMode);
|
---|
340 | void sigDnDModeChange(KDnDMode enmMode);
|
---|
341 |
|
---|
342 | /** Notifies about host-screen count change. */
|
---|
343 | void sigHostScreenCountChange();
|
---|
344 | /** Notifies about host-screen geometry change. */
|
---|
345 | void sigHostScreenGeometryChange();
|
---|
346 | /** Notifies about host-screen available-area change. */
|
---|
347 | void sigHostScreenAvailableAreaChange();
|
---|
348 |
|
---|
349 | /* Session signals: */
|
---|
350 | void sigInitialized();
|
---|
351 |
|
---|
352 | public slots:
|
---|
353 |
|
---|
354 | void sltInstallGuestAdditionsFrom(const QString &strSource);
|
---|
355 |
|
---|
356 | /** Defines @a iKeyboardState. */
|
---|
357 | void setKeyboardState(int iKeyboardState) { m_iKeyboardState = iKeyboardState; emit sigKeyboardStateChange(m_iKeyboardState); }
|
---|
358 |
|
---|
359 | /** Defines @a iMouseState. */
|
---|
360 | void setMouseState(int iMouseState) { m_iMouseState = iMouseState; emit sigMouseStateChange(m_iMouseState); }
|
---|
361 |
|
---|
362 | private slots:
|
---|
363 |
|
---|
364 | /** Marks machine started. */
|
---|
365 | void sltMarkInitialized() { m_fInitialized = true; }
|
---|
366 |
|
---|
367 | /** Close Runtime UI. */
|
---|
368 | void sltCloseRuntimeUI();
|
---|
369 |
|
---|
370 | #ifdef RT_OS_DARWIN
|
---|
371 | /** Mac OS X: Handles menu-bar configuration-change. */
|
---|
372 | void sltHandleMenuBarConfigurationChange(const QUuid &uMachineID);
|
---|
373 | #endif /* RT_OS_DARWIN */
|
---|
374 |
|
---|
375 | /* Console events slots */
|
---|
376 | /** Handles signal about mouse pointer @a shapeData change. */
|
---|
377 | void sltMousePointerShapeChange(const UIMousePointerShapeData &shapeData);
|
---|
378 | /** Handles signal about mouse capability change to @a fSupportsAbsolute, @a fSupportsRelative, @a fSupportsMultiTouch and @a fNeedsHostCursor. */
|
---|
379 | void sltMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fSupportsMultiTouch, bool fNeedsHostCursor);
|
---|
380 | /** Handles signal about guest request to change the cursor position to @a uX * @a uY.
|
---|
381 | * @param fContainsData Brings whether the @a uX and @a uY values are valid and could be used by the GUI now. */
|
---|
382 | void sltCursorPositionChange(bool fContainsData, unsigned long uX, unsigned long uY);
|
---|
383 | void sltKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock);
|
---|
384 | void sltStateChange(KMachineState state);
|
---|
385 | void sltAdditionsChange();
|
---|
386 | void sltVRDEChange();
|
---|
387 | void sltRecordingChange();
|
---|
388 | void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
|
---|
389 | /** Handles storage device change for @a attachment, which was @a fRemoved and it was @a fSilent for guest. */
|
---|
390 | void sltHandleStorageDeviceChange(const CMediumAttachment &attachment, bool fRemoved, bool fSilent);
|
---|
391 | /** Handles audio adapter change. */
|
---|
392 | void sltAudioAdapterChange();
|
---|
393 | /** Handles clip board mode change. */
|
---|
394 | void sltClipboardModeChange(KClipboardMode enmMode);
|
---|
395 | /** Handles drag and drop mode change. */
|
---|
396 | void sltDnDModeChange(KDnDMode enmMode);
|
---|
397 |
|
---|
398 | /* Handlers: Display reconfiguration stuff: */
|
---|
399 | #ifdef RT_OS_DARWIN
|
---|
400 | void sltHandleHostDisplayAboutToChange();
|
---|
401 | void sltCheckIfHostDisplayChanged();
|
---|
402 | #endif /* RT_OS_DARWIN */
|
---|
403 |
|
---|
404 | /** Handles host-screen count change. */
|
---|
405 | void sltHandleHostScreenCountChange();
|
---|
406 | /** Handles host-screen geometry change. */
|
---|
407 | void sltHandleHostScreenGeometryChange();
|
---|
408 | /** Handles host-screen available-area change. */
|
---|
409 | void sltHandleHostScreenAvailableAreaChange();
|
---|
410 |
|
---|
411 | private:
|
---|
412 |
|
---|
413 | /** Constructor. */
|
---|
414 | UISession(UIMachine *pMachine);
|
---|
415 | /** Destructor. */
|
---|
416 | ~UISession();
|
---|
417 |
|
---|
418 | /* Private getters: */
|
---|
419 | UIMachine* uimachine() const { return m_pMachine; }
|
---|
420 |
|
---|
421 | /* Prepare helpers: */
|
---|
422 | bool prepare();
|
---|
423 | bool prepareSession();
|
---|
424 | void prepareActions();
|
---|
425 | void prepareConnections();
|
---|
426 | void prepareConsoleEventHandlers();
|
---|
427 | void prepareScreens();
|
---|
428 | void prepareFramebuffers();
|
---|
429 | void loadSessionSettings();
|
---|
430 |
|
---|
431 | /* Cleanup helpers: */
|
---|
432 | void saveSessionSettings();
|
---|
433 | void cleanupFramebuffers();
|
---|
434 | //void cleanupScreens() {}
|
---|
435 | void cleanupConsoleEventHandlers();
|
---|
436 | void cleanupConnections();
|
---|
437 | void cleanupActions();
|
---|
438 | void cleanupSession();
|
---|
439 | void cleanup();
|
---|
440 |
|
---|
441 | #ifdef VBOX_WS_MAC
|
---|
442 | /** Mac OS X: Updates menu-bar content. */
|
---|
443 | void updateMenu();
|
---|
444 | #endif /* VBOX_WS_MAC */
|
---|
445 |
|
---|
446 | /** Updates mouse pointer shape. */
|
---|
447 | void updateMousePointerShape();
|
---|
448 |
|
---|
449 | /* Common helpers: */
|
---|
450 | bool preprocessInitialization();
|
---|
451 | bool mountAdHocImage(KDeviceType enmDeviceType, UIMediumDeviceType enmMediumType, const QString &strMediumName);
|
---|
452 | bool postprocessInitialization();
|
---|
453 | int countOfVisibleWindows();
|
---|
454 | /** Loads VM settings. */
|
---|
455 | void loadVMSettings();
|
---|
456 |
|
---|
457 | /** Update host-screen data. */
|
---|
458 | void updateHostScreenData();
|
---|
459 |
|
---|
460 | /** Updates action restrictions. */
|
---|
461 | void updateActionRestrictions();
|
---|
462 |
|
---|
463 | /* Private variables: */
|
---|
464 | UIMachine *m_pMachine;
|
---|
465 |
|
---|
466 | /** Holds the session instance. */
|
---|
467 | CSession m_session;
|
---|
468 | /** Holds the session's machine instance. */
|
---|
469 | CMachine m_machine;
|
---|
470 | /** Holds the session's console instance. */
|
---|
471 | CConsole m_console;
|
---|
472 | /** Holds the console's display instance. */
|
---|
473 | CDisplay m_display;
|
---|
474 | /** Holds the console's guest instance. */
|
---|
475 | CGuest m_guest;
|
---|
476 | /** Holds the console's mouse instance. */
|
---|
477 | CMouse m_mouse;
|
---|
478 | /** Holds the console's keyboard instance. */
|
---|
479 | CKeyboard m_keyboard;
|
---|
480 | /** Holds the console's debugger instance. */
|
---|
481 | CMachineDebugger m_debugger;
|
---|
482 |
|
---|
483 | /** Holds the machine name. */
|
---|
484 | QString m_strMachineName;
|
---|
485 |
|
---|
486 | /** Holds the action-pool instance. */
|
---|
487 | UIActionPool *m_pActionPool;
|
---|
488 |
|
---|
489 | #ifdef VBOX_WS_MAC
|
---|
490 | /** Holds the menu-bar instance. */
|
---|
491 | QMenuBar *m_pMenuBar;
|
---|
492 | #endif /* VBOX_WS_MAC */
|
---|
493 |
|
---|
494 | /* Screen visibility vector: */
|
---|
495 | QVector<bool> m_monitorVisibilityVector;
|
---|
496 |
|
---|
497 | /* Screen visibility vector for host-desires: */
|
---|
498 | QVector<bool> m_monitorVisibilityVectorHostDesires;
|
---|
499 |
|
---|
500 | /* Screen last full-screen size vector: */
|
---|
501 | QVector<QSize> m_monitorLastFullScreenSizeVector;
|
---|
502 |
|
---|
503 | /* Frame-buffers vector: */
|
---|
504 | QVector<UIFrameBuffer*> m_frameBufferVector;
|
---|
505 |
|
---|
506 | /* Common variables: */
|
---|
507 | KMachineState m_machineStatePrevious;
|
---|
508 | KMachineState m_machineState;
|
---|
509 |
|
---|
510 | /** Holds cached mouse cursor shape pixmap. */
|
---|
511 | QPixmap m_cursorShapePixmap;
|
---|
512 | /** Holds cached mouse cursor mask pixmap. */
|
---|
513 | QPixmap m_cursorMaskPixmap;
|
---|
514 | /** Holds cached mouse cursor size. */
|
---|
515 | QSize m_cursorSize;
|
---|
516 | /** Holds cached mouse cursor hotspot. */
|
---|
517 | QPoint m_cursorHotspot;
|
---|
518 | /** Holds cached mouse cursor position. */
|
---|
519 | QPoint m_cursorPosition;
|
---|
520 |
|
---|
521 | /** @name Branding variables.
|
---|
522 | ** @{ */
|
---|
523 | /** Holds the cached machine-window icon. */
|
---|
524 | QIcon *m_pMachineWindowIcon;
|
---|
525 | #ifndef VBOX_WS_MAC
|
---|
526 | /** Holds redefined machine-window name postfix. */
|
---|
527 | QString m_strMachineWindowNamePostfix;
|
---|
528 | #endif
|
---|
529 | /** @} */
|
---|
530 |
|
---|
531 | /** @name Visual-state configuration variables.
|
---|
532 | ** @{ */
|
---|
533 | /** Determines which visual-state should be entered when possible. */
|
---|
534 | UIVisualStateType m_requestedVisualStateType;
|
---|
535 | /** @} */
|
---|
536 |
|
---|
537 | #if defined(VBOX_WS_WIN)
|
---|
538 | HCURSOR m_alphaCursor;
|
---|
539 | #endif
|
---|
540 |
|
---|
541 | /** @name Host-screen configuration variables.
|
---|
542 | * @{ */
|
---|
543 | /** Holds the list of host-screen geometries we currently have. */
|
---|
544 | QList<QRect> m_hostScreens;
|
---|
545 | #ifdef VBOX_WS_MAC
|
---|
546 | /** Mac OS X: Watchdog timer looking for display reconfiguration. */
|
---|
547 | QTimer *m_pWatchdogDisplayChange;
|
---|
548 | #endif /* VBOX_WS_MAC */
|
---|
549 | /** @} */
|
---|
550 |
|
---|
551 | /** @name Application Close configuration variables.
|
---|
552 | * @{ */
|
---|
553 | /** Default close action. */
|
---|
554 | MachineCloseAction m_defaultCloseAction;
|
---|
555 | /** Merged restricted close actions. */
|
---|
556 | MachineCloseAction m_restrictedCloseActions;
|
---|
557 | /** Determines whether all the close actions are restricted. */
|
---|
558 | bool m_fAllCloseActionsRestricted;
|
---|
559 | /** @} */
|
---|
560 |
|
---|
561 | /* Common flags: */
|
---|
562 | bool m_fInitialized : 1;
|
---|
563 | bool m_fIsFirstTimeStarted : 1;
|
---|
564 | bool m_fIsGuestResizeIgnored : 1;
|
---|
565 | bool m_fIsAutoCaptureDisabled : 1;
|
---|
566 |
|
---|
567 | /* Guest additions flags: */
|
---|
568 | ULONG m_ulGuestAdditionsRunLevel;
|
---|
569 | bool m_fIsGuestSupportsGraphics : 1;
|
---|
570 | bool m_fIsGuestSupportsSeamless : 1;
|
---|
571 |
|
---|
572 | /* Keyboard flags: */
|
---|
573 | /** Holds the keyboard-state. */
|
---|
574 | int m_iKeyboardState;
|
---|
575 | bool m_fNumLock : 1;
|
---|
576 | bool m_fCapsLock : 1;
|
---|
577 | bool m_fScrollLock : 1;
|
---|
578 | uint m_uNumLockAdaptionCnt;
|
---|
579 | uint m_uCapsLockAdaptionCnt;
|
---|
580 |
|
---|
581 | /* Mouse flags: */
|
---|
582 | /** Holds the mouse-state. */
|
---|
583 | int m_iMouseState;
|
---|
584 | bool m_fIsMouseSupportsAbsolute : 1;
|
---|
585 | bool m_fIsMouseSupportsRelative : 1;
|
---|
586 | bool m_fIsMouseSupportsMultiTouch: 1;
|
---|
587 | bool m_fIsMouseHostCursorNeeded : 1;
|
---|
588 | bool m_fIsMouseCaptured : 1;
|
---|
589 | bool m_fIsMouseIntegrated : 1;
|
---|
590 | bool m_fIsValidPointerShapePresent : 1;
|
---|
591 | bool m_fIsHidingHostPointer : 1;
|
---|
592 | /** Holds whether the @a m_cursorPosition is valid and could be used by the GUI now. */
|
---|
593 | bool m_fIsValidCursorPositionPresent : 1;
|
---|
594 | /** Holds the mouse pointer shape data. */
|
---|
595 | UIMousePointerShapeData m_shapeData;
|
---|
596 |
|
---|
597 | /** Copy of IMachineDebugger::ExecutionEngine */
|
---|
598 | KVMExecutionEngine m_enmVMExecutionEngine;
|
---|
599 |
|
---|
600 | /** @name CPU hardware virtualization features for VM.
|
---|
601 | ** @{ */
|
---|
602 | /** Holds whether nested-paging CPU hardware virtualization extension is enabled. */
|
---|
603 | bool m_fIsHWVirtExNestedPagingEnabled;
|
---|
604 | /** Holds whether the VM is currently making use of the unrestricted execution feature of VT-x. */
|
---|
605 | bool m_fIsHWVirtExUXEnabled;
|
---|
606 | /** @} */
|
---|
607 |
|
---|
608 | /** Holds VM's effective paravirtualization provider. */
|
---|
609 | KParavirtProvider m_paraVirtProvider;
|
---|
610 | };
|
---|
611 |
|
---|
612 | #endif /* !FEQT_INCLUDED_SRC_runtime_UISession_h */
|
---|