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