1 | /* $Id: UIMachine.h 103803 2024-03-12 11:15:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIMachine class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_runtime_UIMachine_h
|
---|
29 | #define FEQT_INCLUDED_SRC_runtime_UIMachine_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QObject>
|
---|
36 | #include <QPixmap>
|
---|
37 |
|
---|
38 | /* GUI includes: */
|
---|
39 | #include "UIAddDiskEncryptionPasswordDialog.h"
|
---|
40 | #include "UIExtraDataDefs.h"
|
---|
41 | #include "UIMachineDefs.h"
|
---|
42 | #include "UIMediumDefs.h"
|
---|
43 | #include "UIMousePointerShapeData.h"
|
---|
44 | #include "UITextTable.h"
|
---|
45 |
|
---|
46 | /* COM includes: */
|
---|
47 | #include "KBitmapFormat.h"
|
---|
48 | #include "KChipsetType.h"
|
---|
49 | #include "KClipboardMode.h"
|
---|
50 | #include "KDeviceActivity.h"
|
---|
51 | #include "KDnDMode.h"
|
---|
52 | #include "KGraphicsControllerType.h"
|
---|
53 | #include "KGuestMonitorChangedEventType.h"
|
---|
54 | #include "KGuestMonitorStatus.h"
|
---|
55 | #include "KMachineState.h"
|
---|
56 | #include "KParavirtProvider.h"
|
---|
57 | #include "KPlatformArchitecture.h"
|
---|
58 | #include "KVMExecutionEngine.h"
|
---|
59 |
|
---|
60 | /* Forward declarations: */
|
---|
61 | class QWidget;
|
---|
62 | class UIActionPool;
|
---|
63 | class UIFrameBuffer;
|
---|
64 | class UIMachineLogic;
|
---|
65 | class UISession;
|
---|
66 | class CMediumAttachment;
|
---|
67 | class CNetworkAdapter;
|
---|
68 | class CUSBDevice;
|
---|
69 | class CVirtualBoxErrorInfo;
|
---|
70 | #ifdef VBOX_WS_MAC
|
---|
71 | class QMenuBar;
|
---|
72 | class QTimer;
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | /** Singleton QObject extension
|
---|
76 | * used as virtual machine (VM) singleton instance. */
|
---|
77 | class UIMachine : public QObject
|
---|
78 | {
|
---|
79 | Q_OBJECT;
|
---|
80 |
|
---|
81 | signals:
|
---|
82 |
|
---|
83 | /** Notifies listeners about machine initialized. */
|
---|
84 | void sigInitialized();
|
---|
85 |
|
---|
86 | /** Requests async visual-state change. */
|
---|
87 | void sigRequestAsyncVisualStateChange(UIVisualStateType enmVisualStateType);
|
---|
88 |
|
---|
89 | /** @name COM events stuff.
|
---|
90 | ** @{ */
|
---|
91 | /** Notifies about additions state change. */
|
---|
92 | void sigAdditionsStateChange();
|
---|
93 | /** Notifies about additions state actually change. */
|
---|
94 | void sigAdditionsStateActualChange();
|
---|
95 | /** Notifies about audio adapter change. */
|
---|
96 | void sigAudioAdapterChange();
|
---|
97 | /** Notifies about clipboard mode change. */
|
---|
98 | void sigClipboardModeChange(KClipboardMode enmMode);
|
---|
99 | /** Notifies about a clipboard error. */
|
---|
100 | void sigClipboardError(QString strId, QString strMsg, long rcError);
|
---|
101 | /** Notifies about CPU execution cap change. */
|
---|
102 | void sigCPUExecutionCapChange();
|
---|
103 | /** Notifies about DnD mode change. */
|
---|
104 | void sigDnDModeChange(KDnDMode enmMode);
|
---|
105 | /** Notifies about guest monitor change. */
|
---|
106 | void sigGuestMonitorChange(KGuestMonitorChangedEventType emnChangeType, ulong uScreenId, QRect screenGeo);
|
---|
107 | /** Notifies about machine change. */
|
---|
108 | void sigMachineStateChange();
|
---|
109 | /** Notifies about medium change. */
|
---|
110 | void sigMediumChange(const CMediumAttachment &comMediumAttachment);
|
---|
111 | /** Notifies about network adapter change. */
|
---|
112 | void sigNetworkAdapterChange(const CNetworkAdapter &comNetworkAdapter);
|
---|
113 | /** Notifies about recording change. */
|
---|
114 | void sigRecordingChange();
|
---|
115 | /** Notifies about shared folder change. */
|
---|
116 | void sigSharedFolderChange();
|
---|
117 | /** Handles storage device change signal. */
|
---|
118 | void sigStorageDeviceChange(const CMediumAttachment &comAttachment, bool fRemoved, bool fSilent);
|
---|
119 | /** Handles USB controller change signal. */
|
---|
120 | void sigUSBControllerChange();
|
---|
121 | /** Handles USB device state change signal. */
|
---|
122 | void sigUSBDeviceStateChange(const CUSBDevice &comDevice, bool fAttached, const CVirtualBoxErrorInfo &comError);
|
---|
123 | /** Notifies about VRDE change. */
|
---|
124 | void sigVRDEChange();
|
---|
125 |
|
---|
126 | /** Notifies about runtime error happened. */
|
---|
127 | void sigRuntimeError(bool bIsFatal, const QString &strErrorId, const QString &strMessage);
|
---|
128 |
|
---|
129 | #ifdef VBOX_WS_MAC
|
---|
130 | /** macOS X: Notifies about VM window should be shown. */
|
---|
131 | void sigShowWindows();
|
---|
132 | #endif
|
---|
133 | /** @} */
|
---|
134 |
|
---|
135 | /** @name Keyboard stuff.
|
---|
136 | ** @{ */
|
---|
137 | /** Notifies about keyboard LEDs change. */
|
---|
138 | void sigKeyboardLedsChange();
|
---|
139 |
|
---|
140 | /** Notifies listeners about keyboard state-change. */
|
---|
141 | void sigKeyboardStateChange(int iState);
|
---|
142 | /** @} */
|
---|
143 |
|
---|
144 | /** @name Mouse stuff.
|
---|
145 | ** @{ */
|
---|
146 | /** Notifies listeners about mouse pointer shape change. */
|
---|
147 | void sigMousePointerShapeChange();
|
---|
148 | /** Notifies listeners about mouse capability change. */
|
---|
149 | void sigMouseCapabilityChange();
|
---|
150 | /** Notifies listeners about cursor position change. */
|
---|
151 | void sigCursorPositionChange();
|
---|
152 |
|
---|
153 | /** Notifies listeners about mouse state-change. */
|
---|
154 | void sigMouseStateChange(int iState);
|
---|
155 | /** @} */
|
---|
156 |
|
---|
157 | /** @name Host-screen stuff.
|
---|
158 | ** @{ */
|
---|
159 | /** Notifies about host-screen count change. */
|
---|
160 | void sigHostScreenCountChange();
|
---|
161 | /** Notifies about host-screen geometry change. */
|
---|
162 | void sigHostScreenGeometryChange();
|
---|
163 | /** Notifies about host-screen available-area change. */
|
---|
164 | void sigHostScreenAvailableAreaChange();
|
---|
165 | /** @} */
|
---|
166 |
|
---|
167 | public:
|
---|
168 |
|
---|
169 | /** Static factory to start machine. */
|
---|
170 | static bool startMachine();
|
---|
171 | /** Static constructor. */
|
---|
172 | static bool create();
|
---|
173 | /** Static destructor. */
|
---|
174 | static void destroy();
|
---|
175 | /** Static instance. */
|
---|
176 | static UIMachine *instance() { return s_pInstance; }
|
---|
177 |
|
---|
178 | /** Returns whether machine is initialized. */
|
---|
179 | bool isInitialized() const { return m_fInitialized; }
|
---|
180 |
|
---|
181 | /** Returns session UI instance. */
|
---|
182 | UISession *uisession() const { return m_pSession; }
|
---|
183 | /** Returns machine-logic instance. */
|
---|
184 | UIMachineLogic *machineLogic() const { return m_pMachineLogic; }
|
---|
185 | /** Returns frame-buffer reference for screen with @a uScreenId specified. */
|
---|
186 | UIFrameBuffer *frameBuffer(ulong uScreenId);
|
---|
187 | /** Returns active machine-window reference (if possible). */
|
---|
188 | QWidget *activeWindow() const;
|
---|
189 |
|
---|
190 | /** Returns whether session UI is valid. */
|
---|
191 | bool isSessionValid() const;
|
---|
192 |
|
---|
193 | /** Returns whether requested visual @a state allowed. */
|
---|
194 | bool isVisualStateAllowed(UIVisualStateType state) const { return m_enmAllowedVisualStates & state; }
|
---|
195 |
|
---|
196 | /** Requests async visual-state change. */
|
---|
197 | void asyncChangeVisualState(UIVisualStateType enmVisualStateType);
|
---|
198 |
|
---|
199 | /** Requests visual-state to be entered when possible. */
|
---|
200 | void setRequestedVisualState(UIVisualStateType enmVisualStateType);
|
---|
201 | /** Returns requested visual-state to be entered when possible. */
|
---|
202 | UIVisualStateType requestedVisualState() const;
|
---|
203 |
|
---|
204 | /** @name General stuff.
|
---|
205 | ** @{ */
|
---|
206 | /** Returns the machine name. */
|
---|
207 | QString machineName() const;
|
---|
208 | /** Returns the OS type id. */
|
---|
209 | QString osTypeId() const;
|
---|
210 |
|
---|
211 | /** Acquire machine pixmap. */
|
---|
212 | void acquireMachinePixmap(const QSize &size, QPixmap &pixmap);
|
---|
213 | /** Acquire user machine icon. */
|
---|
214 | void acquireUserMachineIcon(QIcon &icon);
|
---|
215 |
|
---|
216 | /** Acquires architecture type. */
|
---|
217 | bool acquireArchitectureType(KPlatformArchitecture &enmType);
|
---|
218 | /** Acquires chipset type. */
|
---|
219 | bool acquireChipsetType(KChipsetType &enmType);
|
---|
220 | /** @} */
|
---|
221 |
|
---|
222 | /** @name Branding stuff.
|
---|
223 | ** @{ */
|
---|
224 | /** Returns the cached machine-window icon. */
|
---|
225 | QIcon *machineWindowIcon() const { return m_pMachineWindowIcon; }
|
---|
226 | #ifndef VBOX_WS_MAC
|
---|
227 | /** Returns redefined machine-window name postfix. */
|
---|
228 | QString machineWindowNamePostfix() const { return m_strMachineWindowNamePostfix; }
|
---|
229 | #endif
|
---|
230 | /** @} */
|
---|
231 |
|
---|
232 | /** @name Actions stuff.
|
---|
233 | ** @{ */
|
---|
234 | /** Returns the action-pool instance. */
|
---|
235 | UIActionPool *actionPool() const { return m_pActionPool; }
|
---|
236 |
|
---|
237 | /** Updates additions actions state. */
|
---|
238 | void updateStateAdditionsActions();
|
---|
239 | /** Updates Audio action state. */
|
---|
240 | void updateStateAudioActions();
|
---|
241 | /** Updates Recording action state. */
|
---|
242 | void updateStateRecordingAction();
|
---|
243 | /** Updates VRDE server action state. */
|
---|
244 | void updateStateVRDEServerAction();
|
---|
245 | /** @} */
|
---|
246 |
|
---|
247 | /** @name Machine-state stuff.
|
---|
248 | ** @{ */
|
---|
249 | /** Returns previous machine state. */
|
---|
250 | KMachineState machineStatePrevious() const;
|
---|
251 | /** Returns cached machine state. */
|
---|
252 | KMachineState machineState() const;
|
---|
253 |
|
---|
254 | /** Resets previous state to be the same as current one. */
|
---|
255 | void forgetPreviousMachineState();
|
---|
256 |
|
---|
257 | /** Acquire live machine state. */
|
---|
258 | bool acquireLiveMachineState(KMachineState &enmState);
|
---|
259 |
|
---|
260 | /** Returns whether VM is in one of turned off states. */
|
---|
261 | bool isTurnedOff() const;
|
---|
262 | /** Returns whether VM is in one of paused states. */
|
---|
263 | bool isPaused() const;
|
---|
264 | /** Returns whether VM was in one of paused states. */
|
---|
265 | bool wasPaused() const;
|
---|
266 | /** Returns whether VM is in one of running states. */
|
---|
267 | bool isRunning() const;
|
---|
268 | /** Returns whether VM is in one of stuck states. */
|
---|
269 | bool isStuck() const;
|
---|
270 | /** Returns whether VM is one of states where guest-screen is undrawable. */
|
---|
271 | bool isGuestScreenUnDrawable() const;
|
---|
272 |
|
---|
273 | /** Resets VM. */
|
---|
274 | bool reset();
|
---|
275 | /** Performes VM pausing. */
|
---|
276 | bool pause();
|
---|
277 | /** Performes VM resuming. */
|
---|
278 | bool unpause();
|
---|
279 | /** Performes VM pausing/resuming depending on @a fPause state. */
|
---|
280 | bool setPause(bool fPause);
|
---|
281 | /** @} */
|
---|
282 |
|
---|
283 | /** @name Machine-data stuff.
|
---|
284 | ** @{ */
|
---|
285 | /** Acquires settings file path. */
|
---|
286 | bool acquireSettingsFilePath(QString &strPath);
|
---|
287 |
|
---|
288 | /** Saves machine data. */
|
---|
289 | bool saveSettings();
|
---|
290 | /** @} */
|
---|
291 |
|
---|
292 | /** @name Snapshot stuff.
|
---|
293 | ** @{ */
|
---|
294 | /** Acquires snapshot count. */
|
---|
295 | bool acquireSnapshotCount(ulong &uCount);
|
---|
296 | /** Acquires current snapshot name. */
|
---|
297 | bool acquireCurrentSnapshotName(QString &strName);
|
---|
298 |
|
---|
299 | /** Recursively searches for a first snapshot matching name template conditions. */
|
---|
300 | bool acquireMaxSnapshotIndex(const QString &strNameTemplate, ulong &uIndex);
|
---|
301 |
|
---|
302 | /** Takes snapshot with name & description specified. */
|
---|
303 | void takeSnapshot(const QString &strName, const QString &strDescription);
|
---|
304 | /** @} */
|
---|
305 |
|
---|
306 | /** @name Audio stuff.
|
---|
307 | ** @{ */
|
---|
308 | /** Acquires whether audio adapter is present. */
|
---|
309 | bool acquireWhetherAudioAdapterPresent(bool &fPresent);
|
---|
310 | /** Acquires whether audio adapter is enabled. */
|
---|
311 | bool acquireWhetherAudioAdapterEnabled(bool &fEnabled);
|
---|
312 | /** Acquires whether audio adapter output is enabled. */
|
---|
313 | bool acquireWhetherAudioAdapterOutputEnabled(bool &fEnabled);
|
---|
314 | /** Acquires whether audio adapter input is enabled. */
|
---|
315 | bool acquireWhetherAudioAdapterInputEnabled(bool &fEnabled);
|
---|
316 | /** Defines whether audio adapter output is enabled. */
|
---|
317 | bool setAudioAdapterOutputEnabled(bool fEnabled);
|
---|
318 | /** Defines whether audio adapter input is enabled. */
|
---|
319 | bool setAudioAdapterInputEnabled(bool fEnabled);
|
---|
320 | /** @} */
|
---|
321 |
|
---|
322 | /** @name Host-screen stuff.
|
---|
323 | ** @{ */
|
---|
324 | /** Returns the list of host-screen geometries we currently have. */
|
---|
325 | QList<QRect> hostScreens() const { return m_hostScreens; }
|
---|
326 | /** @} */
|
---|
327 |
|
---|
328 | /** @name Guest-screen stuff.
|
---|
329 | ** @{ */
|
---|
330 | /** Returns whether guest-screen with @a uScreenId specified is expected to be visible. */
|
---|
331 | bool isScreenVisibleHostDesires(ulong uScreenId) const;
|
---|
332 | /** Defines whether guest-screen with @a uScreenId specified is expected to be @a fVisible. */
|
---|
333 | void setScreenVisibleHostDesires(ulong uScreenId, bool fVisible);
|
---|
334 |
|
---|
335 | /** Returns whether guest-screen with @a uScreenId specified is actually visible. */
|
---|
336 | bool isScreenVisible(ulong uScreenId) const;
|
---|
337 | /** Defines whether guest-screen with @a uScreenId specified is actually @a fVisible. */
|
---|
338 | void setScreenVisible(ulong uScreenId, bool fIsMonitorVisible);
|
---|
339 |
|
---|
340 | /** Returns a number of visible guest-windows. */
|
---|
341 | int countOfVisibleWindows();
|
---|
342 | /** Returns the list of visible guest-windows. */
|
---|
343 | QList<int> listOfVisibleWindows() const;
|
---|
344 |
|
---|
345 | /** Returns size for guest-screen with index @a uScreenId. */
|
---|
346 | QSize guestScreenSize(ulong uScreenId) const;
|
---|
347 |
|
---|
348 | /** Returns last full-screen size for guest-screen with index @a uScreenId. */
|
---|
349 | QSize lastFullScreenSize(ulong uScreenId) const;
|
---|
350 | /** Defines last full-screen @a size for guest-screen with index @a uScreenId. */
|
---|
351 | void setLastFullScreenSize(ulong uScreenId, QSize size);
|
---|
352 |
|
---|
353 | /** Returns whether guest screen resize should be ignored. */
|
---|
354 | bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; }
|
---|
355 | /** Defines whether guest screen resize should be @a fIgnored. */
|
---|
356 | void setGuestResizeIgnored(bool fIgnored) { m_fIsGuestResizeIgnored = fIgnored; }
|
---|
357 |
|
---|
358 | /** Acquires graphics controller type. */
|
---|
359 | bool acquireGraphicsControllerType(KGraphicsControllerType &enmType);
|
---|
360 | /** Acquires VRAM size. */
|
---|
361 | bool acquireVRAMSize(ulong &uSize);
|
---|
362 | /** Acquires whether accelerate 3D is enabled. */
|
---|
363 | bool acquireWhetherAccelerate3DEnabled(bool &fEnabled);
|
---|
364 | /** Acquires monitor count. */
|
---|
365 | bool acquireMonitorCount(ulong &uCount);
|
---|
366 |
|
---|
367 | /** Acquires parameters for guest-screen with passed uScreenId. */
|
---|
368 | bool acquireGuestScreenParameters(ulong uScreenId,
|
---|
369 | ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
|
---|
370 | long &xOrigin, long &yOrigin, KGuestMonitorStatus &enmMonitorStatus);
|
---|
371 | /** Acquires saved info for guest-screen with passed uScreenId. */
|
---|
372 | bool acquireSavedGuestScreenInfo(ulong uScreenId,
|
---|
373 | long &xOrigin, long &yOrigin,
|
---|
374 | ulong &uWidth, ulong &uHeight, bool &fEnabled);
|
---|
375 | /** Defines video mode hint for guest-screen with passed uScreenId. */
|
---|
376 | bool setVideoModeHint(ulong uScreenId, bool fEnabled, bool fChangeOrigin,
|
---|
377 | long xOrigin, long yOrigin, ulong uWidth, ulong uHeight,
|
---|
378 | ulong uBitsPerPixel, bool fNotify);
|
---|
379 | /** Acquires video mode hint for guest-screen with passed uScreenId. */
|
---|
380 | bool acquireVideoModeHint(ulong uScreenId, bool &fEnabled, bool &fChangeOrigin,
|
---|
381 | long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight,
|
---|
382 | ulong &uBitsPerPixel);
|
---|
383 | /** Acquires screen-shot for guest-screen with passed uScreenId. */
|
---|
384 | bool acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits);
|
---|
385 | /** Acquires saved screen-shot info for guest-screen with passed uScreenId. */
|
---|
386 | bool acquireSavedScreenshotInfo(ulong uScreenId, ulong &uWidth, ulong &uHeight, QVector<KBitmapFormat> &formats);
|
---|
387 | /** Acquires saved screen-shot for guest-screen with passed uScreenId. */
|
---|
388 | bool acquireSavedScreenshot(ulong uScreenId, KBitmapFormat enmFormat,
|
---|
389 | ulong &uWidth, ulong &uHeight, QVector<BYTE> &screenshot);
|
---|
390 | /** Notifies guest-screen with passed uScreenId about scale-factor change. */
|
---|
391 | bool notifyScaleFactorChange(ulong uScreenId, ulong uScaleFactorWMultiplied, ulong uScaleFactorHMultiplied);
|
---|
392 | /** Notifies display about unscaled HiDPI policy change. */
|
---|
393 | bool notifyHiDPIOutputPolicyChange(bool fUnscaledHiDPI);
|
---|
394 | /** Defines whether seamless mode is enabled for display. */
|
---|
395 | bool setSeamlessMode(bool fEnabled);
|
---|
396 | /** Notifies display about viewport changes. */
|
---|
397 | bool viewportChanged(ulong uScreenId, ulong xOrigin, ulong yOrigin, ulong uWidth, ulong uHeight);
|
---|
398 | /** Notifies display about all screens were invalidated. */
|
---|
399 | bool invalidateAndUpdate();
|
---|
400 | /** Notifies display about screen with passed uScreenId was invalidated. */
|
---|
401 | bool invalidateAndUpdateScreen(ulong uScreenId);
|
---|
402 |
|
---|
403 | /** Acquires whether VRDE server is present. */
|
---|
404 | bool acquireWhetherVRDEServerPresent(bool &fPresent);
|
---|
405 | /** Acquires whether VRDE server is enabled. */
|
---|
406 | bool acquireWhetherVRDEServerEnabled(bool &fEnabled);
|
---|
407 | /** Defines whether VRDE server is enabled. */
|
---|
408 | bool setVRDEServerEnabled(bool fEnabled);
|
---|
409 | /** Acquires VRDE server port. */
|
---|
410 | bool acquireVRDEServerPort(long &iPort);
|
---|
411 |
|
---|
412 | /** Acquires whether recording settings is present. */
|
---|
413 | bool acquireWhetherRecordingSettingsPresent(bool &fPresent);
|
---|
414 | /** Acquires whether recording settings is enabled. */
|
---|
415 | bool acquireWhetherRecordingSettingsEnabled(bool &fEnabled);
|
---|
416 | /** Defines whether recording settings is enabled. */
|
---|
417 | bool setRecordingSettingsEnabled(bool fEnabled);
|
---|
418 | /** @} */
|
---|
419 |
|
---|
420 | /** @name Guest additions stuff.
|
---|
421 | ** @{ */
|
---|
422 | /** Returns whether guest additions is active. */
|
---|
423 | bool isGuestAdditionsActive() const;
|
---|
424 | /** Returns whether guest additions supports graphics. */
|
---|
425 | bool isGuestSupportsGraphics() const;
|
---|
426 | /** Returns whether guest additions supports seamless. */
|
---|
427 | bool isGuestSupportsSeamless() const;
|
---|
428 | /** Acquires the guest addition's version. */
|
---|
429 | bool acquireGuestAdditionsVersion(QString &strVersion);
|
---|
430 | /** Acquires the guest addition's revision. */
|
---|
431 | bool acquireGuestAdditionsRevision(ulong &uRevision);
|
---|
432 | /** Notifies guest about VM window focus changes. */
|
---|
433 | bool notifyGuiFocusChange(bool fInfocus);
|
---|
434 | /** @} */
|
---|
435 |
|
---|
436 | /** @name Keyboard stuff.
|
---|
437 | ** @{ */
|
---|
438 | /** Returns the NUM lock status. */
|
---|
439 | bool isNumLock() const { return m_fNumLock; }
|
---|
440 | /** Returns the CAPS lock status. */
|
---|
441 | bool isCapsLock() const { return m_fCapsLock; }
|
---|
442 | /** Returns the SCROLL lock status. */
|
---|
443 | bool isScrollLock() const { return m_fScrollLock; }
|
---|
444 |
|
---|
445 | /** Returns the NUM lock adaption count. */
|
---|
446 | uint numLockAdaptionCnt() const { return m_uNumLockAdaptionCnt; }
|
---|
447 | /** Defines the NUM lock adaption @a uCount. */
|
---|
448 | void setNumLockAdaptionCnt(uint uCount) { m_uNumLockAdaptionCnt = uCount; }
|
---|
449 |
|
---|
450 | /** Returns the CAPS lock adaption count. */
|
---|
451 | uint capsLockAdaptionCnt() const { return m_uCapsLockAdaptionCnt; }
|
---|
452 | /** Defines the CAPS lock adaption @a uCount. */
|
---|
453 | void setCapsLockAdaptionCnt(uint uCount) { m_uCapsLockAdaptionCnt = uCount; }
|
---|
454 |
|
---|
455 | /** Returns whether VM should perform HID LEDs synchronization. */
|
---|
456 | bool isHidLedsSyncEnabled() const { return m_fIsHidLedsSyncEnabled; }
|
---|
457 |
|
---|
458 | /** Returns whether auto-capture is disabled. */
|
---|
459 | bool isAutoCaptureDisabled() const { return m_fIsAutoCaptureDisabled; }
|
---|
460 | /** Defines whether auto-capture is @a fDisabled. */
|
---|
461 | void setAutoCaptureDisabled(bool fDisabled) { m_fIsAutoCaptureDisabled = fDisabled; }
|
---|
462 |
|
---|
463 | /** Returns the keyboard-state. */
|
---|
464 | int keyboardState() const { return m_iKeyboardState; }
|
---|
465 |
|
---|
466 | /** Sends a scan @a iCode to VM's keyboard. */
|
---|
467 | bool putScancode(LONG iCode);
|
---|
468 | /** Sends a list of scan @a codes to VM's keyboard. */
|
---|
469 | bool putScancodes(const QVector<LONG> &codes);
|
---|
470 | /** Sends the CAD sequence to VM's keyboard. */
|
---|
471 | bool putCAD();
|
---|
472 | /** Releases all keys. */
|
---|
473 | bool releaseKeys();
|
---|
474 | /** Sends a USB HID @a iUsageCode and @a iUsagePage to VM's keyboard.
|
---|
475 | * The @a fKeyRelease flag is set when the key is being released. */
|
---|
476 | bool putUsageCode(LONG iUsageCode, LONG iUsagePage, bool fKeyRelease);
|
---|
477 | /** @} */
|
---|
478 |
|
---|
479 | /** @name Mouse stuff.
|
---|
480 | ** @{ */
|
---|
481 | /** Returns whether we should hide host mouse pointer. */
|
---|
482 | bool isHidingHostPointer() const { return m_fIsHidingHostPointer; }
|
---|
483 | /** Returns whether there is valid mouse pointer shape present. */
|
---|
484 | bool isValidPointerShapePresent() const { return m_fIsValidPointerShapePresent; }
|
---|
485 | /** Returns whether the @a cursorPosition() is valid and could be used by the GUI now. */
|
---|
486 | bool isValidCursorPositionPresent() const { return m_fIsValidCursorPositionPresent; }
|
---|
487 |
|
---|
488 | /** Returns whether mouse supports absolute coordinates. */
|
---|
489 | bool isMouseSupportsAbsolute() const { return m_fIsMouseSupportsAbsolute; }
|
---|
490 | /** Returns whether mouse supports relative coordinates. */
|
---|
491 | bool isMouseSupportsRelative() const { return m_fIsMouseSupportsRelative; }
|
---|
492 | /** Returns whether touch screen is supported. */
|
---|
493 | bool isMouseSupportsTouchScreen() const { return m_fIsMouseSupportsTouchScreen; }
|
---|
494 | /** Returns whether touch pad is supported. */
|
---|
495 | bool isMouseSupportsTouchPad() const { return m_fIsMouseSupportsTouchPad; }
|
---|
496 | /** Returns whether guest requires host cursor to be shown. */
|
---|
497 | bool isMouseHostCursorNeeded() const { return m_fIsMouseHostCursorNeeded; }
|
---|
498 |
|
---|
499 | /** Returns whether mouse is captured. */
|
---|
500 | bool isMouseCaptured() const { return m_fIsMouseCaptured; }
|
---|
501 | /** Returns whether mouse is integrated. */
|
---|
502 | bool isMouseIntegrated() const { return m_fIsMouseIntegrated; }
|
---|
503 | /** Defines whether mouse is @a fCaptured. */
|
---|
504 | void setMouseCaptured(bool fCaptured) { m_fIsMouseCaptured = fCaptured; }
|
---|
505 | /** Defines whether mouse is @a fIntegrated. */
|
---|
506 | void setMouseIntegrated(bool fIntegrated) { m_fIsMouseIntegrated = fIntegrated; }
|
---|
507 |
|
---|
508 | /** Returns currently cached mouse cursor shape pixmap. */
|
---|
509 | QPixmap cursorShapePixmap() const { return m_cursorShapePixmap; }
|
---|
510 | /** Returns currently cached mouse cursor mask pixmap. */
|
---|
511 | QPixmap cursorMaskPixmap() const { return m_cursorMaskPixmap; }
|
---|
512 | /** Returns currently cached mouse cursor size. */
|
---|
513 | QSize cursorSize() const { return m_cursorSize; }
|
---|
514 | /** Returns currently cached mouse cursor hotspot. */
|
---|
515 | QPoint cursorHotspot() const { return m_cursorHotspot; }
|
---|
516 | /** Returns currently cached mouse cursor position. */
|
---|
517 | QPoint cursorPosition() const { return m_cursorPosition; }
|
---|
518 |
|
---|
519 | /** Returns mouse-state. */
|
---|
520 | int mouseState() const { return m_iMouseState; }
|
---|
521 |
|
---|
522 | /** Sends relative mouse move event to VM's mouse. */
|
---|
523 | bool putMouseEvent(long iDx, long iDy, long iDz, long iDw, long iButtonState);
|
---|
524 | /** Sends absolute mouse move event to VM's mouse. */
|
---|
525 | bool putMouseEventAbsolute(long iX, long iY, long iDz, long iDw, long iButtonState);
|
---|
526 | /** Sends multi-touch event to VM's mouse. */
|
---|
527 | bool putEventMultiTouch(long iCount, const QVector<LONG64> &contacts, bool fIsTouchScreen, ulong uScanTime);
|
---|
528 |
|
---|
529 | /** Acquires clipboard mode. */
|
---|
530 | bool acquireClipboardMode(KClipboardMode &enmMode);
|
---|
531 | /** Defines clipboard mode. */
|
---|
532 | bool setClipboardMode(KClipboardMode enmMode);
|
---|
533 | /** En/disables guest clipboard file transfers. */
|
---|
534 | bool toggleClipboardFileTransfer(bool fEnabled);
|
---|
535 | /** Returns true if clipboard file transfer is enabled. Returns false otherwise or in case of an error. */
|
---|
536 | bool isClipboardFileTransferEnabled();
|
---|
537 |
|
---|
538 | /** Acquires D&D mode. */
|
---|
539 | bool acquireDnDMode(KDnDMode &enmMode);
|
---|
540 | /** Defines D&D mode. */
|
---|
541 | bool setDnDMode(KDnDMode enmMode);
|
---|
542 | /** @} */
|
---|
543 |
|
---|
544 | /** @name Storage stuff.
|
---|
545 | ** @{ */
|
---|
546 | /** Enumerates amount of storage devices. */
|
---|
547 | bool acquireAmountOfStorageDevices(ulong &cHardDisks, ulong &cOpticalDrives, ulong &cFloppyDrives);
|
---|
548 |
|
---|
549 | /** Returns a list of storage devices. */
|
---|
550 | bool storageDevices(KDeviceType enmDeviceType, QList<StorageDeviceInfo> &guiStorageDevices);
|
---|
551 |
|
---|
552 | /** Acquires encrypted media map. */
|
---|
553 | bool acquireEncryptedMedia(EncryptedMediumMap &media);
|
---|
554 | /** Adds encryption password. */
|
---|
555 | bool addEncryptionPassword(const QString &strId, const QString &strPassword, bool fClearOnSuspend);
|
---|
556 |
|
---|
557 | /** Calculates @a cAmount of immutable images. */
|
---|
558 | bool acquireAmountOfImmutableImages(ulong &cAmount);
|
---|
559 |
|
---|
560 | /** Attempts to mount medium with @p uMediumId to the machine
|
---|
561 | * if it can find an appropriate controller and port. */
|
---|
562 | bool mountBootMedium(const QUuid &uMediumId);
|
---|
563 |
|
---|
564 | /** Prepares storage menu. */
|
---|
565 | void prepareStorageMenu(QMenu *pMenu,
|
---|
566 | QObject *pListener, const char *pszSlotName,
|
---|
567 | const QString &strControllerName, const StorageSlot &storageSlot);
|
---|
568 | /** Updates machine storage with data described by target. */
|
---|
569 | void updateMachineStorage(const UIMediumTarget &target, UIActionPool *pActionPool);
|
---|
570 | /** @} */
|
---|
571 |
|
---|
572 | /** @name USB stuff.
|
---|
573 | ** @{ */
|
---|
574 | /** Acquires whether USB controller is enabled. */
|
---|
575 | void acquireWhetherUSBControllerEnabled(bool &fEnabled);
|
---|
576 | /** Acquires whether video input devices are enabled. */
|
---|
577 | void acquireWhetherVideoInputDevicesEnabled(bool &fEnabled);
|
---|
578 |
|
---|
579 | /** Returns a list of USB devices. */
|
---|
580 | bool usbDevices(QList<USBDeviceInfo> &guiUSBDevices);
|
---|
581 | /** Attaches USB device with passed @a uId. */
|
---|
582 | bool attachUSBDevice(const QUuid &uId);
|
---|
583 | /** Detaches USB device with passed @a uId. */
|
---|
584 | bool detachUSBDevice(const QUuid &uId);
|
---|
585 |
|
---|
586 | /** Returns a list of web cam devices. */
|
---|
587 | bool webcamDevices(QList<WebcamDeviceInfo> &guiWebcamDevices);
|
---|
588 | /** Attaches web cam device with passed @a strName and @a strPath. */
|
---|
589 | bool webcamAttach(const QString &strPath, const QString &strName);
|
---|
590 | /** Detaches web cam device with passed @a strName and @a strPath. */
|
---|
591 | bool webcamDetach(const QString &strPath, const QString &strName);
|
---|
592 | /** @} */
|
---|
593 |
|
---|
594 | /** @name Network stuff.
|
---|
595 | ** @{ */
|
---|
596 | /** Acquires whether network adapter is enabled. */
|
---|
597 | bool acquireWhetherNetworkAdapterEnabled(ulong uSlot, bool &fEnabled);
|
---|
598 | /** Acquires whether at leasst one network adapter is enabled. */
|
---|
599 | bool acquireWhetherAtLeastOneNetworkAdapterEnabled(bool &fEnabled);
|
---|
600 | /** Acquires whether network adapter cable is connected. */
|
---|
601 | bool acquireWhetherNetworkCableConnected(ulong uSlot, bool &fConnected);
|
---|
602 | /** Set whether network adapter cable is connected. */
|
---|
603 | bool setNetworkCableConnected(ulong uSlot, bool fConnected);
|
---|
604 | /** @} */
|
---|
605 |
|
---|
606 | /** @name Virtualization stuff.
|
---|
607 | ** @{ */
|
---|
608 | /** Returns IMachineDebugger::ExecutionEngine reference. */
|
---|
609 | KVMExecutionEngine vmExecutionEngine() const { return m_enmVMExecutionEngine; }
|
---|
610 |
|
---|
611 | /** Returns whether nested-paging CPU hardware virtualization extension is enabled. */
|
---|
612 | bool isHWVirtExNestedPagingEnabled() const { return m_fIsHWVirtExNestedPagingEnabled; }
|
---|
613 | /** Returns whether the VM is currently making use of the unrestricted execution feature of VT-x. */
|
---|
614 | bool isHWVirtExUXEnabled() const { return m_fIsHWVirtExUXEnabled; }
|
---|
615 |
|
---|
616 | /** Returns VM's effective paravirtualization provider. */
|
---|
617 | KParavirtProvider paravirtProvider() const { return m_enmParavirtProvider; }
|
---|
618 | /** @} */
|
---|
619 |
|
---|
620 | /** @name Status-bar stuff.
|
---|
621 | ** @{ */
|
---|
622 | /** Acquires device activity composing a vector of current @a states for device with @a deviceTypes specified. */
|
---|
623 | bool acquireDeviceActivity(const QVector<KDeviceType> &deviceTypes, QVector<KDeviceActivity> &states);
|
---|
624 |
|
---|
625 | /** Acquires status info for hard disk indicator. */
|
---|
626 | void acquireHardDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent);
|
---|
627 | /** Acquires status info for optical disk indicator. */
|
---|
628 | void acquireOpticalDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted);
|
---|
629 | /** Acquires status info for floppy disk indicator. */
|
---|
630 | void acquireFloppyDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted);
|
---|
631 | /** Acquires status info for audio indicator. */
|
---|
632 | void acquireAudioStatusInfo(QString &strInfo, bool &fAudioEnabled, bool &fEnabledOutput, bool &fEnabledInput);
|
---|
633 | /** Acquires status info for network indicator. */
|
---|
634 | void acquireNetworkStatusInfo(QString &strInfo, bool &fAdaptersPresent, bool &fCablesDisconnected);
|
---|
635 | /** Acquires status info for USB indicator. */
|
---|
636 | void acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds);
|
---|
637 | /** Acquires status info for Shared Folders indicator. */
|
---|
638 | void acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent);
|
---|
639 | /** Acquires status info for Display indicator. */
|
---|
640 | void acquireDisplayStatusInfo(QString &strInfo, bool &fAcceleration3D);
|
---|
641 | /** Acquires status info for Recording indicator. */
|
---|
642 | void acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused);
|
---|
643 | /** Acquires status info for Features indicator. */
|
---|
644 | void acquireFeaturesStatusInfo(QString &strInfo, KVMExecutionEngine &enmEngine);
|
---|
645 | /** @} */
|
---|
646 |
|
---|
647 | /** @name Debugger stuff.
|
---|
648 | ** @{ */
|
---|
649 | /** Defines whether log is @a fEnabled. */
|
---|
650 | bool setLogEnabled(bool fEnabled);
|
---|
651 | /** Acquires whether log is @a fEnabled. */
|
---|
652 | bool acquireWhetherLogEnabled(bool &fEnabled);
|
---|
653 |
|
---|
654 | /** Acquire log folder. */
|
---|
655 | bool acquireLogFolder(QString &strFolder);
|
---|
656 |
|
---|
657 | /** Acquires effective CPU @a uLoad. */
|
---|
658 | bool acquireEffectiveCPULoad(ulong &uLoad);
|
---|
659 | /** Acquires uptime @a iUpTime as milliseconds. */
|
---|
660 | bool acquireUptime(LONG64 &iUpTime);
|
---|
661 |
|
---|
662 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
663 | /** Makes sure debugger GUI is created. */
|
---|
664 | bool dbgCreated(void *pActionDebug);
|
---|
665 | /** Makes sure debugger GUI is destroyed. */
|
---|
666 | void dbgDestroy();
|
---|
667 |
|
---|
668 | /** Shows debugger UI statistics window. */
|
---|
669 | void dbgShowStatistics();
|
---|
670 | /** Shows debugger UI command line window. */
|
---|
671 | void dbgShowCommandLine();
|
---|
672 |
|
---|
673 | /** Adjusts relative position for debugger window. */
|
---|
674 | void dbgAdjustRelativePos();
|
---|
675 | #endif /* VBOX_WITH_DEBUGGER_GUI */
|
---|
676 | /** @} */
|
---|
677 |
|
---|
678 | /** @name Close stuff.
|
---|
679 | ** @{ */
|
---|
680 | /** Returns whether VM is in 'manual-override' mode.
|
---|
681 | * @note S.a. #m_fIsManualOverride description for more information. */
|
---|
682 | bool isManualOverrideMode() const { return m_fIsManualOverride; }
|
---|
683 | /** Defines whether VM is in 'manual-override' mode.
|
---|
684 | * @note S.a. #m_fIsManualOverride description for more information. */
|
---|
685 | void setManualOverrideMode(bool fIsManualOverride) { m_fIsManualOverride = fIsManualOverride; }
|
---|
686 |
|
---|
687 | /** Returns default close action. */
|
---|
688 | MachineCloseAction defaultCloseAction() const { return m_defaultCloseAction; }
|
---|
689 | /** Returns merged restricted close actions. */
|
---|
690 | MachineCloseAction restrictedCloseActions() const { return m_restrictedCloseActions; }
|
---|
691 |
|
---|
692 | /** Acquires whether guest @a fEntered ACPI mode. */
|
---|
693 | bool acquireWhetherGuestEnteredACPIMode(bool &fEntered);
|
---|
694 |
|
---|
695 | /** Returns whether qpp quit is requested. */
|
---|
696 | bool isQuitRequested() const { return m_fQuitRequested; }
|
---|
697 |
|
---|
698 | /** Detaches and closes Runtime UI. */
|
---|
699 | void detachUi();
|
---|
700 | /** Saves VM state, then closes Runtime UI. */
|
---|
701 | void saveState();
|
---|
702 | /** Calls for guest shutdown to close Runtime UI. */
|
---|
703 | void shutdown();
|
---|
704 | /** Powers VM off, then closes Runtime UI. */
|
---|
705 | void powerOff(bool fIncludingDiscard);
|
---|
706 | /** @} */
|
---|
707 |
|
---|
708 | /** @name VM information stuff.
|
---|
709 | ** @{ */
|
---|
710 | /** Return general info. of the machine(). */
|
---|
711 | void generateMachineInformationGeneral(const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions,
|
---|
712 | UITextTable &returnTable);
|
---|
713 | /** Return system info. of the machine(). */
|
---|
714 | void generateMachineInformationSystem(const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions,
|
---|
715 | UITextTable &returnTable);
|
---|
716 | /** Returns system info. of the machine(). */
|
---|
717 | void generateMachineInformationDisplay(const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions,
|
---|
718 | UITextTable &returnTable);
|
---|
719 | /** Returns storage info. of the machine(). */
|
---|
720 | void generateMachineInformationStorage(const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions,
|
---|
721 | UITextTable &returnTable);
|
---|
722 | /** Returns audio info. of the machine(). */
|
---|
723 | void generateMachineInformationAudio(const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions,
|
---|
724 | UITextTable &returnTable);
|
---|
725 | /** Returns network info. of the machine(). */
|
---|
726 | void generateMachineInformationNetwork(const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions,
|
---|
727 | UITextTable &returnTable);
|
---|
728 | /** Returns serial info. of the machine(). */
|
---|
729 | void generateMachineInformationSerial(const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions,
|
---|
730 | UITextTable &returnTable);
|
---|
731 | /** Returns USB info. of the machine(). */
|
---|
732 | void generateMachineInformationUSB(const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions,
|
---|
733 | UITextTable &returnTable);
|
---|
734 | /** Returns shared folders info. of the machine(). */
|
---|
735 | void generateMachineInformationSharedFolders(const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions,
|
---|
736 | UITextTable &returnTable);
|
---|
737 | /** @} */
|
---|
738 |
|
---|
739 | public slots:
|
---|
740 |
|
---|
741 | /** @name Guest additions stuff.
|
---|
742 | ** @{ */
|
---|
743 | /** Handles request to install guest additions image.
|
---|
744 | * @param strSource Brings the source of image being installed. */
|
---|
745 | void sltInstallGuestAdditionsFrom(const QString &strSource);
|
---|
746 | /** Mounts DVD adhoc.
|
---|
747 | * @param strSource Brings the source of image being mounted. */
|
---|
748 | void sltMountDVDAdHoc(const QString &strSource);
|
---|
749 | /** @} */
|
---|
750 |
|
---|
751 | /** @name Clipboard stuff.
|
---|
752 | ** @{ */
|
---|
753 | /** Handles clipboard errors. */
|
---|
754 | void sltClipboardError(QString strId, QString strMsg, long rcError);
|
---|
755 | /** @} */
|
---|
756 |
|
---|
757 | /** @name Keyboard stuff.
|
---|
758 | ** @{ */
|
---|
759 | /** Defines @a iKeyboardState. */
|
---|
760 | void setKeyboardState(int iKeyboardState) { m_iKeyboardState = iKeyboardState; emit sigKeyboardStateChange(m_iKeyboardState); }
|
---|
761 | /** @} */
|
---|
762 |
|
---|
763 | /** @name Mouse stuff.
|
---|
764 | ** @{ */
|
---|
765 | /** Defines @a iMouseState. */
|
---|
766 | void setMouseState(int iMouseState) { m_iMouseState = iMouseState; emit sigMouseStateChange(m_iMouseState); }
|
---|
767 | /** @} */
|
---|
768 |
|
---|
769 | /** @name Close stuff.
|
---|
770 | ** @{ */
|
---|
771 | /** Closes Runtime UI. */
|
---|
772 | void closeRuntimeUI();
|
---|
773 | /** @} */
|
---|
774 |
|
---|
775 | private slots:
|
---|
776 |
|
---|
777 | /** Visual state-change handler. */
|
---|
778 | void sltChangeVisualState(UIVisualStateType enmVisualStateType);
|
---|
779 |
|
---|
780 | /** @name COM events stuff.
|
---|
781 | ** @{ */
|
---|
782 | /** Handles additions state actual change signal. */
|
---|
783 | void sltHandleAdditionsActualChange();
|
---|
784 | /** Handles audio adapter change signal. */
|
---|
785 | void sltHandleAudioAdapterChange();
|
---|
786 | /** Handles recording change signal. */
|
---|
787 | void sltHandleRecordingChange();
|
---|
788 | /** Handles storage device change for @a attachment, which was @a fRemoved and it was @a fSilent for guest. */
|
---|
789 | void sltHandleStorageDeviceChange(const CMediumAttachment &comAttachment, bool fRemoved, bool fSilent);
|
---|
790 | /** Handles VRDE change signal. */
|
---|
791 | void sltHandleVRDEChange();
|
---|
792 | /** @} */
|
---|
793 |
|
---|
794 | /** @name Actions stuff.
|
---|
795 | ** @{ */
|
---|
796 | #ifdef VBOX_WS_MAC
|
---|
797 | /** macOS X: Handles menu-bar configuration-change. */
|
---|
798 | void sltHandleMenuBarConfigurationChange(const QUuid &uMachineID);
|
---|
799 | #endif
|
---|
800 | /** @} */
|
---|
801 |
|
---|
802 | /** @name Host-screen stuff.
|
---|
803 | ** @{ */
|
---|
804 | /** Handles host-screen count change. */
|
---|
805 | void sltHandleHostScreenCountChange();
|
---|
806 | /** Handles host-screen geometry change. */
|
---|
807 | void sltHandleHostScreenGeometryChange();
|
---|
808 | /** Handles host-screen available-area change. */
|
---|
809 | void sltHandleHostScreenAvailableAreaChange();
|
---|
810 | #ifdef VBOX_WS_MAC
|
---|
811 | /** macOS X: Restarts display-reconfiguration watchdog timer from the beginning.
|
---|
812 | * @note Watchdog is trying to determine display reconfiguration in
|
---|
813 | * UISession::sltCheckIfHostDisplayChanged() slot every 500ms for 40 tries. */
|
---|
814 | void sltHandleHostDisplayAboutToChange();
|
---|
815 | /** MacOS X: Determines display reconfiguration.
|
---|
816 | * @note Calls for UISession::sltHandleHostScreenCountChange() if screen count changed.
|
---|
817 | * @note Calls for UISession::sltHandleHostScreenGeometryChange() if screen geometry changed. */
|
---|
818 | void sltCheckIfHostDisplayChanged();
|
---|
819 | #endif /* VBOX_WS_MAC */
|
---|
820 | /** @} */
|
---|
821 |
|
---|
822 | /** @name Guest-screen stuff.
|
---|
823 | ** @{ */
|
---|
824 | /** Handles guest-monitor state change. */
|
---|
825 | void sltHandleGuestMonitorChange(KGuestMonitorChangedEventType enmChangeType, ulong uScreenId, QRect screenGeo);
|
---|
826 | /** @} */
|
---|
827 |
|
---|
828 | /** @name Keyboard stuff.
|
---|
829 | ** @{ */
|
---|
830 | /** Handles signal about keyboard LEDs change.
|
---|
831 | * @param fNumLock Brings NUM lock status.
|
---|
832 | * @param fCapsLock Brings CAPS lock status.
|
---|
833 | * @param fScrollLock Brings SCROLL lock status. */
|
---|
834 | void sltHandleKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
|
---|
835 |
|
---|
836 | /** Handles signal about keyboard LEDs sync state change.
|
---|
837 | * @param fEnabled Brings sync status. */
|
---|
838 | void sltHidLedsSyncStateChanged(bool fEnabled) { m_fIsHidLedsSyncEnabled = fEnabled; }
|
---|
839 | /** @} */
|
---|
840 |
|
---|
841 | /** @name Mouse stuff.
|
---|
842 | ** @{ */
|
---|
843 | /** Handles signal about mouse pointer shape data change.
|
---|
844 | * @param shapeData Brings complex struct describing mouse pointer shape aspects. */
|
---|
845 | void sltMousePointerShapeChange(const UIMousePointerShapeData &shapeData);
|
---|
846 | /** Handles signal about mouse capability change.
|
---|
847 | * @param fSupportsAbsolute Brings whether mouse supports absolute coordinates.
|
---|
848 | * @param fSupportsRelative Brings whether mouse supports relative coordinates.
|
---|
849 | * @param fSupportsTouchScreen Brings whether touch screen is supported.
|
---|
850 | * @param fSupportsTouchPad Brings whether touch pad is supported.
|
---|
851 | * @param fNeedsHostCursor Brings whether guest requires host cursor to be shown. */
|
---|
852 | void sltMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative,
|
---|
853 | bool fSupportsTouchScreen, bool fSupportsTouchPad,
|
---|
854 | bool fNeedsHostCursor);
|
---|
855 | /** Handles signal about guest request to change the cursor position to @a uX * @a uY.
|
---|
856 | * @param fContainsData Brings whether the @a uX and @a uY values are valid and could be used by the GUI now.
|
---|
857 | * @param uX Brings cursor position X origin.
|
---|
858 | * @param uY Brings cursor position Y origin. */
|
---|
859 | void sltCursorPositionChange(bool fContainsData,
|
---|
860 | unsigned long uX,
|
---|
861 | unsigned long uY);
|
---|
862 | /** @} */
|
---|
863 |
|
---|
864 | private:
|
---|
865 |
|
---|
866 | /** Constructs machine UI singleton. */
|
---|
867 | UIMachine();
|
---|
868 | /** Destructs machine UI singleton. */
|
---|
869 | virtual ~UIMachine() RT_OVERRIDE;
|
---|
870 |
|
---|
871 | /** Prepare routine. */
|
---|
872 | bool prepare();
|
---|
873 | /** Prepares notification-center. */
|
---|
874 | void prepareNotificationCenter();
|
---|
875 | /** Prepare routine: Session stuff. */
|
---|
876 | bool prepareSession();
|
---|
877 | /** Prepare routine: Actions stuff. */
|
---|
878 | void prepareActions();
|
---|
879 | /** Prepare routine: Host-screen data stuff. */
|
---|
880 | void prepareHostScreenData();
|
---|
881 | /** Prepare routine: Keyboard stuff. */
|
---|
882 | void prepareKeyboard();
|
---|
883 | /** Prepare routine: Close stuff. */
|
---|
884 | void prepareClose();
|
---|
885 | /** Prepare routine: Visual-state stuff. */
|
---|
886 | void prepareVisualState();
|
---|
887 |
|
---|
888 | /** Update routine: Branding. */
|
---|
889 | void updateBranding();
|
---|
890 | /** Update routine: Guest screen data stuff. */
|
---|
891 | void updateGuestScreenData();
|
---|
892 |
|
---|
893 | /** Moves VM to initial state. */
|
---|
894 | void enterInitialVisualState();
|
---|
895 |
|
---|
896 | /** Cleanup routine: Machine-logic stuff. */
|
---|
897 | void cleanupMachineLogic();
|
---|
898 | /** Cleanup routine: Branding. */
|
---|
899 | void cleanupBranding();
|
---|
900 | /** Cleanup routine: Host-screen data stuff. */
|
---|
901 | void cleanupHostScreenData();
|
---|
902 | /** Cleanup routine: Actions stuff. */
|
---|
903 | void cleanupActions();
|
---|
904 | /** Cleanup routine: Session stuff. */
|
---|
905 | void cleanupSession();
|
---|
906 | /** Cleanups notification-center. */
|
---|
907 | void cleanupNotificationCenter();
|
---|
908 | /** Cleanup routine. */
|
---|
909 | void cleanup();
|
---|
910 |
|
---|
911 | /** @name Actions stuff.
|
---|
912 | ** @{ */
|
---|
913 | /** Updates action restrictions. */
|
---|
914 | void updateActionRestrictions();
|
---|
915 |
|
---|
916 | #ifdef VBOX_WS_MAC
|
---|
917 | /** macOS X: Updates menu-bar content. */
|
---|
918 | void updateMenu();
|
---|
919 | #endif
|
---|
920 | /** @} */
|
---|
921 |
|
---|
922 | /** @name Host-screen stuff.
|
---|
923 | ** @{ */
|
---|
924 | /** Update host-screen data. */
|
---|
925 | void updateHostScreenData();
|
---|
926 | /** @} */
|
---|
927 |
|
---|
928 | /** @name Mouse stuff.
|
---|
929 | ** @{ */
|
---|
930 | /** Updates mouse pointer shape. */
|
---|
931 | void updateMousePointerShape();
|
---|
932 |
|
---|
933 | /** Updates mouse states. */
|
---|
934 | void updateMouseState();
|
---|
935 |
|
---|
936 | #if defined(VBOX_WS_NIX) || defined(VBOX_WS_MAC)
|
---|
937 | /** Generate a BGRA bitmap which approximates a XOR/AND mouse pointer.
|
---|
938 | *
|
---|
939 | * Pixels which has 1 in the AND mask and not 0 in the XOR mask are replaced by
|
---|
940 | * the inverted pixel and 8 surrounding pixels with the original color.
|
---|
941 | * Fort example a white pixel (W) is replaced with a black (B) pixel:
|
---|
942 | * WWW
|
---|
943 | * W -> WBW
|
---|
944 | * WWW
|
---|
945 | * The surrounding pixels are written only if the corresponding source pixel
|
---|
946 | * does not affect the screen, i.e. AND bit is 1 and XOR value is 0. */
|
---|
947 | static void renderCursorPixels(const uint32_t *pu32XOR, const uint8_t *pu8AND,
|
---|
948 | uint32_t u32Width, uint32_t u32Height,
|
---|
949 | uint32_t *pu32Pixels, uint32_t cbPixels);
|
---|
950 | #endif /* VBOX_WS_NIX || VBOX_WS_MAC */
|
---|
951 |
|
---|
952 | #ifdef VBOX_WS_WIN
|
---|
953 | /** Windows: Returns whether pointer of 1bpp depth. */
|
---|
954 | static bool isPointer1bpp(const uint8_t *pu8XorMask,
|
---|
955 | uint uWidth,
|
---|
956 | uint uHeight);
|
---|
957 | #endif /* VBOX_WS_WIN */
|
---|
958 | /** @} */
|
---|
959 |
|
---|
960 | /** @name Virtualization stuff.
|
---|
961 | ** @{ */
|
---|
962 | /** Updates virtualization state. */
|
---|
963 | void updateVirtualizationState();
|
---|
964 | /** @} */
|
---|
965 |
|
---|
966 | /** Holds the static instance. */
|
---|
967 | static UIMachine *s_pInstance;
|
---|
968 |
|
---|
969 | /** Holds whether machine is initialized. */
|
---|
970 | bool m_fInitialized;
|
---|
971 |
|
---|
972 | /** Holds the session UI instance. */
|
---|
973 | UISession *m_pSession;
|
---|
974 |
|
---|
975 | /** Holds allowed visual states. */
|
---|
976 | UIVisualStateType m_enmAllowedVisualStates;
|
---|
977 | /** Holds initial visual state. */
|
---|
978 | UIVisualStateType m_enmInitialVisualState;
|
---|
979 | /** Holds current visual state. */
|
---|
980 | UIVisualStateType m_enmVisualState;
|
---|
981 | /** Holds visual state which should be entered when possible. */
|
---|
982 | UIVisualStateType m_enmRequestedVisualState;
|
---|
983 | /** Holds current machine-logic. */
|
---|
984 | UIMachineLogic *m_pMachineLogic;
|
---|
985 |
|
---|
986 | /** @name Branding stuff.
|
---|
987 | ** @{ */
|
---|
988 | /** Holds the cached machine-window icon. */
|
---|
989 | QIcon *m_pMachineWindowIcon;
|
---|
990 |
|
---|
991 | #ifndef VBOX_WS_MAC
|
---|
992 | /** Holds redefined machine-window name postfix. */
|
---|
993 | QString m_strMachineWindowNamePostfix;
|
---|
994 | #endif
|
---|
995 | /** @} */
|
---|
996 |
|
---|
997 | /** @name Actions stuff.
|
---|
998 | ** @{ */
|
---|
999 | /** Holds the action-pool instance. */
|
---|
1000 | UIActionPool *m_pActionPool;
|
---|
1001 |
|
---|
1002 | #ifdef VBOX_WS_MAC
|
---|
1003 | /** macOS X: Holds the menu-bar instance. */
|
---|
1004 | QMenuBar *m_pMenuBar;
|
---|
1005 | #endif
|
---|
1006 | /** @} */
|
---|
1007 |
|
---|
1008 | /** @name Host-screen stuff.
|
---|
1009 | ** @{ */
|
---|
1010 | /** Holds the list of host-screen geometries we currently have. */
|
---|
1011 | QList<QRect> m_hostScreens;
|
---|
1012 |
|
---|
1013 | #ifdef VBOX_WS_MAC
|
---|
1014 | /** macOS X: Watchdog timer looking for display reconfiguration. */
|
---|
1015 | QTimer *m_pWatchdogDisplayChange;
|
---|
1016 | #endif
|
---|
1017 | /** @} */
|
---|
1018 |
|
---|
1019 | /** @name Guest-screen stuff.
|
---|
1020 | ** @{ */
|
---|
1021 | /** Holds the list of desired guest-screen visibility flags. */
|
---|
1022 | QVector<bool> m_guestScreenVisibilityVectorHostDesires;
|
---|
1023 | /** Holds the list of actual guest-screen visibility flags. */
|
---|
1024 | QVector<bool> m_guestScreenVisibilityVector;
|
---|
1025 |
|
---|
1026 | /** Holds the list of guest-screen full-screen sizes. */
|
---|
1027 | QVector<QSize> m_monitorLastFullScreenSizeVector;
|
---|
1028 |
|
---|
1029 | /** Holds whether guest screen resize should be ignored. */
|
---|
1030 | bool m_fIsGuestResizeIgnored;
|
---|
1031 | /** @} */
|
---|
1032 |
|
---|
1033 | /** @name Keyboard stuff.
|
---|
1034 | ** @{ */
|
---|
1035 | /** Holds the NUM lock status. */
|
---|
1036 | bool m_fNumLock;
|
---|
1037 | /** Holds the CAPS lock status. */
|
---|
1038 | bool m_fCapsLock;
|
---|
1039 | /** Holds the SCROLL lock status. */
|
---|
1040 | bool m_fScrollLock;
|
---|
1041 |
|
---|
1042 | /** Holds the NUM lock adaption count. */
|
---|
1043 | uint m_uNumLockAdaptionCnt;
|
---|
1044 | /** Holds the CAPS lock adaption count. */
|
---|
1045 | uint m_uCapsLockAdaptionCnt;
|
---|
1046 |
|
---|
1047 | /** Holds whether VM should perform HID LEDs synchronization. */
|
---|
1048 | bool m_fIsHidLedsSyncEnabled;
|
---|
1049 |
|
---|
1050 | /** Holds whether auto-capture is disabled. */
|
---|
1051 | bool m_fIsAutoCaptureDisabled;
|
---|
1052 |
|
---|
1053 | /** Holds the keyboard-state. */
|
---|
1054 | int m_iKeyboardState;
|
---|
1055 | /** @} */
|
---|
1056 |
|
---|
1057 | /** @name Mouse stuff.
|
---|
1058 | ** @{ */
|
---|
1059 | /** Holds whether we should hide host mouse pointer. */
|
---|
1060 | bool m_fIsHidingHostPointer;
|
---|
1061 | /** Holds whether there is valid mouse pointer shape present. */
|
---|
1062 | bool m_fIsValidPointerShapePresent;
|
---|
1063 | /** Holds whether the @a m_cursorPosition is valid and could be used by the GUI now. */
|
---|
1064 | bool m_fIsValidCursorPositionPresent;
|
---|
1065 |
|
---|
1066 | /** Holds whether mouse supports absolute coordinates. */
|
---|
1067 | bool m_fIsMouseSupportsAbsolute;
|
---|
1068 | /** Holds whether mouse supports relative coordinates. */
|
---|
1069 | bool m_fIsMouseSupportsRelative;
|
---|
1070 | /** Holds whether touch screen is supported. */
|
---|
1071 | bool m_fIsMouseSupportsTouchScreen;
|
---|
1072 | /** Holds whether touch pad is supported. */
|
---|
1073 | bool m_fIsMouseSupportsTouchPad;
|
---|
1074 | /** Holds whether guest requires host cursor to be shown. */
|
---|
1075 | bool m_fIsMouseHostCursorNeeded;
|
---|
1076 |
|
---|
1077 | /** Holds whether mouse is captured. */
|
---|
1078 | bool m_fIsMouseCaptured;
|
---|
1079 | /** Holds whether mouse is integrated. */
|
---|
1080 | bool m_fIsMouseIntegrated;
|
---|
1081 |
|
---|
1082 | /** Holds the mouse pointer shape data. */
|
---|
1083 | UIMousePointerShapeData m_shapeData;
|
---|
1084 |
|
---|
1085 | /** Holds cached mouse cursor shape pixmap. */
|
---|
1086 | QPixmap m_cursorShapePixmap;
|
---|
1087 | /** Holds cached mouse cursor mask pixmap. */
|
---|
1088 | QPixmap m_cursorMaskPixmap;
|
---|
1089 | /** Holds cached mouse cursor size. */
|
---|
1090 | QSize m_cursorSize;
|
---|
1091 | /** Holds cached mouse cursor hotspot. */
|
---|
1092 | QPoint m_cursorHotspot;
|
---|
1093 | /** Holds cached mouse cursor position. */
|
---|
1094 | QPoint m_cursorPosition;
|
---|
1095 |
|
---|
1096 | /** Holds the mouse-state. */
|
---|
1097 | int m_iMouseState;
|
---|
1098 | /** @} */
|
---|
1099 |
|
---|
1100 | /** @name Virtualization stuff.
|
---|
1101 | ** @{ */
|
---|
1102 | /** Holds the IMachineDebugger::ExecutionEngine reference. */
|
---|
1103 | KVMExecutionEngine m_enmVMExecutionEngine;
|
---|
1104 |
|
---|
1105 | /** Holds whether nested-paging CPU hardware virtualization extension is enabled. */
|
---|
1106 | bool m_fIsHWVirtExNestedPagingEnabled;
|
---|
1107 | /** Holds whether the VM is currently making use of the unrestricted execution feature of VT-x. */
|
---|
1108 | bool m_fIsHWVirtExUXEnabled;
|
---|
1109 |
|
---|
1110 | /** Holds the VM's effective paravirtualization provider. */
|
---|
1111 | KParavirtProvider m_enmParavirtProvider;
|
---|
1112 | /** @} */
|
---|
1113 |
|
---|
1114 | /** @name Close stuff.
|
---|
1115 | ** @{ */
|
---|
1116 | /** Holds whether VM is in 'manual-override' mode
|
---|
1117 | * which means there will be no automatic UI shutdowns,
|
---|
1118 | * visual representation mode changes and other stuff. */
|
---|
1119 | bool m_fIsManualOverride : 1;
|
---|
1120 |
|
---|
1121 | /** Default close action. */
|
---|
1122 | MachineCloseAction m_defaultCloseAction;
|
---|
1123 | /** Merged restricted close actions. */
|
---|
1124 | MachineCloseAction m_restrictedCloseActions;
|
---|
1125 |
|
---|
1126 | /** Holds whether app quit is requested. */
|
---|
1127 | bool m_fQuitRequested;
|
---|
1128 | /** @} */
|
---|
1129 | };
|
---|
1130 |
|
---|
1131 | #define gpMachine UIMachine::instance()
|
---|
1132 |
|
---|
1133 | #endif /* !FEQT_INCLUDED_SRC_runtime_UIMachine_h */
|
---|