VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h@ 104158

Last change on this file since 104158 was 103803, checked in by vboxsync, 9 months ago

FE/Qt. bugref:10618. Splitting COMEnums.h file into individual enum header files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.0 KB
Line 
1/* $Id: UISession.h 103803 2024-03-12 11:15:18Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UISession 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_UISession_h
29#define FEQT_INCLUDED_SRC_runtime_UISession_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QCursor>
36#include <QEvent>
37#include <QMap>
38#include <QObject>
39
40/* GUI includes: */
41#include "UIAddDiskEncryptionPasswordDialog.h"
42#include "UIExtraDataDefs.h"
43#include "UIMachineDefs.h"
44#include "UIMediumDefs.h"
45#include "UIMousePointerShapeData.h"
46#include "UITextTable.h"
47
48/* COM includes: */
49#include "CConsole.h"
50#include "CDisplay.h"
51#include "CGuest.h"
52#include "CKeyboard.h"
53#include "CMachine.h"
54#include "CMachineDebugger.h"
55#include "CMouse.h"
56#include "CSession.h"
57#include "KChipsetType.h"
58#include "KGraphicsControllerType.h"
59#include "KGuestMonitorChangedEventType.h"
60#include "KPlatformArchitecture.h"
61
62/* Forward declarations: */
63class QMenu;
64class UIConsoleEventHandler;
65class UIFrameBuffer;
66class UIMachine;
67class UIMachineLogic;
68class UIMachineWindow;
69class UIActionPool;
70class CUSBDevice;
71class CNetworkAdapter;
72class CMediumAttachment;
73
74#ifdef VBOX_WITH_DEBUGGER_GUI
75typedef struct DBGGUIVT const *PCDBGGUIVT;
76typedef struct DBGGUI *PDBGGUI;
77#endif /* VBOX_WITH_DEBUGGER_GUI */
78
79/** QObject subclass implementing
80 * COM related functionality for Runtime UI. */
81class UISession : public QObject
82{
83 Q_OBJECT;
84
85signals:
86
87 /** @name COM events stuff.
88 ** @{ */
89 /** Notifies about additions state change. */
90 void sigAdditionsStateChange();
91 /** Notifies about additions state actually change. */
92 void sigAdditionsStateActualChange();
93 /** Notifies about additions state actually change. */
94 void sigAudioAdapterChange();
95 /** Notifies about clipboard mode change. */
96 void sigClipboardModeChange(KClipboardMode enmMode);
97 /** Notifies about a clipboard error. */
98 void sigClipboardError(QString strId, QString strMsg, long rcError);
99 /** Notifies about CPU execution cap change. */
100 void sigCPUExecutionCapChange();
101 /** Notifies about DnD mode change. */
102 void sigDnDModeChange(KDnDMode enmMode);
103 /** Notifies about guest monitor change. */
104 void sigGuestMonitorChange(KGuestMonitorChangedEventType enmChangeType, ulong uScreenId, QRect screenGeo);
105 /** Notifies about machine change. */
106 void sigMachineStateChange();
107 /** Notifies about medium change. */
108 void sigMediumChange(const CMediumAttachment &comMediumAttachment);
109 /** Notifies about network adapter change. */
110 void sigNetworkAdapterChange(const CNetworkAdapter &comNetworkAdapter);
111 /** Notifies about recording change. */
112 void sigRecordingChange();
113 /** Notifies about shared folder change. */
114 void sigSharedFolderChange();
115 /** Notifies about storage device change for @a attachment, which was @a fRemoved and it was @a fSilent for guest. */
116 void sigStorageDeviceChange(const CMediumAttachment &comAttachment, bool fRemoved, bool fSilent);
117 /** Handles USB controller change signal. */
118 void sigUSBControllerChange();
119 /** Handles USB device state change signal. */
120 void sigUSBDeviceStateChange(const CUSBDevice &comDevice, bool fAttached, const CVirtualBoxErrorInfo &comError);
121 /** Notifies about VRDE change. */
122 void sigVRDEChange();
123
124 /** Notifies about runtime error happened. */
125 void sigRuntimeError(bool fFatal, const QString &strErrorId, const QString &strMessage);
126
127#ifdef VBOX_WS_MAC
128 /** Notifies about VM window should be shown. */
129 void sigShowWindows();
130#endif
131 /** @} */
132
133 /** @name Keyboard stuff.
134 ** @{ */
135 /** Notifies about keyboard LEDs change. */
136 void sigKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
137 /** @} */
138
139 /** @name Mouse stuff.
140 ** @{ */
141 /** Notifies listeners about mouse pointer shape change. */
142 void sigMousePointerShapeChange(const UIMousePointerShapeData &shapeData);
143 /** Notifies listeners about mouse capability change. */
144 void sigMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative,
145 bool fSupportsTouchScreen, bool fSupportsTouchPad,
146 bool fNeedsHostCursor);
147 /** Notifies listeners about cursor position change. */
148 void sigCursorPositionChange(bool fContainsData, unsigned long uX, unsigned long uY);
149 /** @} */
150
151public:
152
153 /** Constructs session UI passing @a pMachine to the base-class.
154 * @param pMachine Brings the machine UI reference. */
155 UISession(UIMachine *pMachine);
156
157 /** @name General stuff.
158 ** @{ */
159 /** Prepares everything. */
160 bool prepare();
161 /** Performs session UI intialization. */
162 bool initialize();
163
164 /** Returns whether session UI is valid. */
165 bool isValid() const { return m_fValid; }
166
167 /** Powers VM up. */
168 bool powerUp();
169 /** @} */
170
171 /** @name COM stuff.
172 ** @{ */
173 /** Returns the session instance. */
174 CSession &session() { return m_comSession; }
175 /** Returns the session's machine instance. */
176 CMachine &machine() { return m_comMachine; }
177 /** Returns the session's console instance. */
178 CConsole &console() { return m_comConsole; }
179 /** Returns the console's display instance. */
180 CDisplay &display() { return m_comDisplay; }
181 /** Returns the console's guest instance. */
182 CGuest &guest() { return m_comGuest; }
183 /** Returns the console's mouse instance. */
184 CMouse &mouse() { return m_comMouse; }
185 /** Returns the console's keyboard instance. */
186 CKeyboard &keyboard() { return m_comKeyboard; }
187 /** Returns the console's debugger instance. */
188 CMachineDebugger &debugger() { return m_comDebugger; }
189 /** @} */
190
191 /** @name General stuff.
192 ** @{ */
193 /** Returns the machine name. */
194 QString machineName() const { return m_strMachineName; }
195 /** Returns the OS type id. */
196 QString osTypeId() const { return m_strOSTypeId; }
197
198 /** Returns main machine-widget id. */
199 WId mainMachineWindowId() const;
200
201 /** Acquire machine pixmap. */
202 void acquireMachinePixmap(const QSize &size, QPixmap &pixmap);
203 /** Acquire user machine icon. */
204 void acquireUserMachineIcon(QIcon &icon);
205
206 /** Acquires architecture type. */
207 bool acquireArchitectureType(KPlatformArchitecture &enmType);
208 /** Acquires chipset type. */
209 bool acquireChipsetType(KChipsetType &enmType);
210 /** @} */
211
212 /** @name Machine-state stuff.
213 ** @{ */
214 /** Returns previous machine state. */
215 KMachineState machineStatePrevious() const { return m_enmMachineStatePrevious; }
216 /** Returns cached machine state. */
217 KMachineState machineState() const { return m_enmMachineState; }
218
219 /** Resets previous state to be the same as current one. */
220 void forgetPreviousMachineState() { m_enmMachineStatePrevious = m_enmMachineState; }
221
222 /** Acquire live machine state. */
223 bool acquireLiveMachineState(KMachineState &enmState);
224
225 /** Returns whether VM is in one of saved states. */
226 bool isSaved() const { return machineState() == KMachineState_Saved
227 || machineState() == KMachineState_AbortedSaved; }
228 /** Returns whether VM is in one of turned off states. */
229 bool isTurnedOff() const { return machineState() == KMachineState_PoweredOff
230 || machineState() == KMachineState_Saved
231 || machineState() == KMachineState_Teleported
232 || machineState() == KMachineState_Aborted
233 || machineState() == KMachineState_AbortedSaved; }
234 /** Returns whether VM is in one of paused states. */
235 bool isPaused() const { return machineState() == KMachineState_Paused
236 || machineState() == KMachineState_TeleportingPausedVM; }
237 /** Returns whether VM was in one of paused states. */
238 bool wasPaused() const { return machineStatePrevious() == KMachineState_Paused
239 || machineStatePrevious() == KMachineState_TeleportingPausedVM; }
240 /** Returns whether VM is in one of running states. */
241 bool isRunning() const { return machineState() == KMachineState_Running
242 || machineState() == KMachineState_Teleporting
243 || machineState() == KMachineState_LiveSnapshotting; }
244 /** Returns whether VM is in one of stuck states. */
245 bool isStuck() const { return machineState() == KMachineState_Stuck; }
246 /** Returns whether VM is one of states where guest-screen is undrawable. */
247 bool isGuestScreenUnDrawable() const { return machineState() == KMachineState_Stopping
248 || machineState() == KMachineState_Saving; }
249
250 /** Resets VM. */
251 bool reset();
252 /** Performes VM pausing. */
253 bool pause() { return setPause(true); }
254 /** Performes VM resuming. */
255 bool unpause() { return setPause(false); }
256 /** Performes VM pausing/resuming depending on @a fPause state. */
257 bool setPause(bool fPause);
258 /** @} */
259
260 /** @name Machine-data stuff.
261 ** @{ */
262 /** Acquires settings file path. */
263 bool acquireSettingsFilePath(QString &strPath);
264
265 /** Saves machine data. */
266 bool saveSettings();
267 /** @} */
268
269 /** @name Snapshot stuff.
270 ** @{ */
271 /** Acquires snapshot count. */
272 bool acquireSnapshotCount(ulong &uCount);
273 /** Acquires current snapshot name. */
274 bool acquireCurrentSnapshotName(QString &strName);
275
276 /** Recursively searches for a first snapshot matching name template conditions. */
277 bool acquireMaxSnapshotIndex(const QString &strNameTemplate, ulong &uIndex);
278
279 /** Takes snapshot with name & description specified. */
280 void takeSnapshot(const QString &strName, const QString &strDescription);
281 /** @} */
282
283 /** @name Keyboard stuff.
284 ** @{ */
285 /** Sends a scan @a iCode to VM's keyboard. */
286 bool putScancode(LONG iCode);
287 /** Sends a list of scan @a codes to VM's keyboard. */
288 bool putScancodes(const QVector<LONG> &codes);
289 /** Sends the CAD sequence to VM's keyboard. */
290 bool putCAD();
291 /** Releases all keys. */
292 bool releaseKeys();
293 /** Sends a USB HID @a iUsageCode and @a iUsagePage to VM's keyboard.
294 * The @a fKeyRelease flag is set when the key is being released. */
295 bool putUsageCode(LONG iUsageCode, LONG iUsagePage, bool fKeyRelease);
296 /** @} */
297
298 /** @name Mouse stuff.
299 ** @{ */
300 /** Returns whether VM's mouse supports absolute coordinates. */
301 bool acquireWhetherAbsoluteSupported(bool &fSupported);
302 /** Returns whether VM's mouse supports relative coordinates. */
303 bool acquireWhetherRelativeSupported(bool &fSupported);
304 /** Returns whether VM's mouse supports touch screen device. */
305 bool acquireWhetherTouchScreenSupported(bool &fSupported);
306 /** Returns whether VM's mouse supports touch pad device. */
307 bool acquireWhetherTouchPadSupported(bool &fSupported);
308 /** Returns whether VM's mouse requires host cursor. */
309 bool acquireWhetherNeedsHostCursor(bool &fNeeds);
310
311 /** Sends relative mouse move event to VM's mouse. */
312 bool putMouseEvent(long iDx, long iDy, long iDz, long iDw, long iButtonState);
313 /** Sends absolute mouse move event to VM's mouse. */
314 bool putMouseEventAbsolute(long iX, long iY, long iDz, long iDw, long iButtonState);
315 /** Sends multi-touch event to VM's mouse. */
316 bool putEventMultiTouch(long iCount, const QVector<LONG64> &contacts, bool fIsTouchScreen, ulong uScanTime);
317
318 /** Acquires clipboard mode. */
319 bool acquireClipboardMode(KClipboardMode &enmMode);
320 /** Defines clipboard mode. */
321 bool setClipboardMode(KClipboardMode enmMode);
322 /** En/disables guest clipboard file transfers. */
323 bool toggleClipboardFileTransfer(bool fEnabled);
324 /** Returns true if clipboard file transfer is enabled. Returns false otherwise or in case of an error. */
325 bool isClipboardFileTransferEnabled();
326
327 /** Acquires D&D mode. */
328 bool acquireDnDMode(KDnDMode &enmMode);
329 /** Defines D&D mode. */
330 bool setDnDMode(KDnDMode enmMode);
331 /** @} */
332
333 /** @name Storage stuff.
334 ** @{ */
335 /** Enumerates amount of storage devices. */
336 bool acquireAmountOfStorageDevices(ulong &cHardDisks, ulong &cOpticalDrives, ulong &cFloppyDrives);
337
338 /** Returns a list of storage devices. */
339 bool storageDevices(KDeviceType enmDeviceType, QList<StorageDeviceInfo> &guiStorageDevices);
340
341 /** Acquires encrypted media map. */
342 bool acquireEncryptedMedia(EncryptedMediumMap &media);
343 /** Adds encryption password. */
344 bool addEncryptionPassword(const QString &strId, const QString &strPassword, bool fClearOnSuspend);
345
346 /** Calculates @a cAmount of immutable images. */
347 bool acquireAmountOfImmutableImages(ulong &cAmount);
348
349 /** Attempts to mount medium with @p uMediumId to the machine
350 * if it can find an appropriate controller and port. */
351 bool mountBootMedium(const QUuid &uMediumId);
352
353 /** Prepares storage menu. */
354 void prepareStorageMenu(QMenu *pMenu,
355 QObject *pListener, const char *pszSlotName,
356 const QString &strControllerName, const StorageSlot &storageSlot);
357 /** Updates machine storage with data described by target. */
358 void updateMachineStorage(const UIMediumTarget &target, UIActionPool *pActionPool);
359 /** @} */
360
361 /** @name USB stuff.
362 ** @{ */
363 /** Acquires whether USB controller is enabled. */
364 void acquireWhetherUSBControllerEnabled(bool &fEnabled);
365 /** Acquires whether video input devices are enabled. */
366 void acquireWhetherVideoInputDevicesEnabled(bool &fEnabled);
367
368 /** Returns a list of USB devices. */
369 bool usbDevices(QList<USBDeviceInfo> &guiUSBDevices);
370 /** Attaches USB device with passed @a uId. */
371 bool attachUSBDevice(const QUuid &uId);
372 /** Detaches USB device with passed @a uId. */
373 bool detachUSBDevice(const QUuid &uId);
374
375 /** Returns a list of web cam devices. */
376 bool webcamDevices(QList<WebcamDeviceInfo> &guiWebcamDevices);
377 /** Attaches web cam device with passed @a strName and @a strPath. */
378 bool webcamAttach(const QString &strPath, const QString &strName);
379 /** Detaches web cam device with passed @a strName and @a strPath. */
380 bool webcamDetach(const QString &strPath, const QString &strName);
381 /** @} */
382
383 /** @name Network stuff.
384 ** @{ */
385 /** Acquires whether network adapter is enabled. */
386 bool acquireWhetherNetworkAdapterEnabled(ulong uSlot, bool &fEnabled);
387 /** Acquires whether at leasst one network adapter is enabled. */
388 bool acquireWhetherAtLeastOneNetworkAdapterEnabled(bool &fEnabled);
389 /** Acquires whether network adapter cable is connected. */
390 bool acquireWhetherNetworkCableConnected(ulong uSlot, bool &fConnected);
391 /** Set whether network adapter cable is connected. */
392 bool setNetworkCableConnected(ulong uSlot, bool fConnected);
393 /** @} */
394
395 /** @name Guest additions stuff.
396 ** @{ */
397 /** Returns whether guest additions is active. */
398 bool isGuestAdditionsActive() const { return (m_ulGuestAdditionsRunLevel > KAdditionsRunLevelType_None); }
399 /** Returns whether guest additions supports graphics. */
400 bool isGuestSupportsGraphics() const { return m_fIsGuestSupportsGraphics; }
401 /** Returns whether guest additions supports seamless.
402 * @note The double check below is correct, even though it is an implementation
403 * detail of the Additions which the GUI should not ideally have to know. */
404 bool isGuestSupportsSeamless() const { return isGuestSupportsGraphics() && m_fIsGuestSupportsSeamless; }
405 /** Returns whether GA can be upgraded. */
406 bool guestAdditionsUpgradable();
407 /** Acquires the guest addition's version. */
408 bool acquireGuestAdditionsVersion(QString &strVersion);
409 /** Acquires the guest addition's revision. */
410 bool acquireGuestAdditionsRevision(ulong &uRevision);
411 /** Notifies GAs about VM window focus changes. */
412 bool notifyGuiFocusChange(bool fInfocus);
413 /** @} */
414
415 /** @name Audio stuff.
416 ** @{ */
417 /** Acquires whether audio adapter is present. */
418 bool acquireWhetherAudioAdapterPresent(bool &fPresent);
419 /** Acquires whether audio adapter is enabled. */
420 bool acquireWhetherAudioAdapterEnabled(bool &fEnabled);
421 /** Acquires whether audio adapter output is enabled. */
422 bool acquireWhetherAudioAdapterOutputEnabled(bool &fEnabled);
423 /** Acquires whether audio adapter input is enabled. */
424 bool acquireWhetherAudioAdapterInputEnabled(bool &fEnabled);
425 /** Defines whether audio adapter output is enabled. */
426 bool setAudioAdapterOutputEnabled(bool fEnabled);
427 /** Defines whether audio adapter input is enabled. */
428 bool setAudioAdapterInputEnabled(bool fEnabled);
429 /** @} */
430
431 /** @name Graphics stuff.
432 ** @{ */
433 /** Returns existing framebuffer for the screen with given @a uScreenId;
434 * @returns 0 (asserts) if uScreenId attribute is out of bounds. */
435 UIFrameBuffer *frameBuffer(ulong uScreenId) const;
436 /** Returns existing frame-buffer vector. */
437 const QVector<UIFrameBuffer*> &frameBuffers() const { return m_frameBufferVector; }
438 /** Returns frame-buffer size for screen with index @a uScreenId. */
439 QSize frameBufferSize(ulong uScreenId) const;
440
441 /** Acquires graphics controller type. */
442 bool acquireGraphicsControllerType(KGraphicsControllerType &enmType);
443 /** Acquires VRAM size. */
444 bool acquireVRAMSize(ulong &uSize);
445 /** Acquires whether accelerate 3D is enabled. */
446 bool acquireWhetherAccelerate3DEnabled(bool &fEnabled);
447 /** Acquires monitor count. */
448 bool acquireMonitorCount(ulong &uCount);
449
450 /** Acquires parameters for guest-screen with passed uScreenId. */
451 bool acquireGuestScreenParameters(ulong uScreenId,
452 ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
453 long &xOrigin, long &yOrigin, KGuestMonitorStatus &enmMonitorStatus);
454 /** Acquires saved info for guest-screen with passed uScreenId. */
455 bool acquireSavedGuestScreenInfo(ulong uScreenId,
456 long &xOrigin, long &yOrigin,
457 ulong &uWidth, ulong &uHeight, bool &fEnabled);
458 /** Defines video mode hint for guest-screen with passed uScreenId. */
459 bool setVideoModeHint(ulong uScreenId, bool fEnabled, bool fChangeOrigin,
460 long xOrigin, long yOrigin, ulong uWidth, ulong uHeight,
461 ulong uBitsPerPixel, bool fNotify);
462 /** Acquires video mode hint for guest-screen with passed uScreenId. */
463 bool acquireVideoModeHint(ulong uScreenId, bool &fEnabled, bool &fChangeOrigin,
464 long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight,
465 ulong &uBitsPerPixel);
466 /** Acquires screen-shot for guest-screen with passed uScreenId. */
467 bool acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits);
468 /** Acquires saved screen-shot info for guest-screen with passed uScreenId. */
469 bool acquireSavedScreenshotInfo(ulong uScreenId, ulong &uWidth, ulong &uHeight, QVector<KBitmapFormat> &formats);
470 /** Acquires saved screen-shot for guest-screen with passed uScreenId. */
471 bool acquireSavedScreenshot(ulong uScreenId, KBitmapFormat enmFormat,
472 ulong &uWidth, ulong &uHeight, QVector<BYTE> &screenshot);
473 /** Notifies guest-screen with passed uScreenId about scale-factor change. */
474 bool notifyScaleFactorChange(ulong uScreenId, ulong uScaleFactorWMultiplied, ulong uScaleFactorHMultiplied);
475 /** Notifies display about unscaled HiDPI policy change. */
476 bool notifyHiDPIOutputPolicyChange(bool fUnscaledHiDPI);
477 /** Defines whether seamless mode is enabled for display. */
478 bool setSeamlessMode(bool fEnabled);
479 /** Notifies display about viewport changes. */
480 bool viewportChanged(ulong uScreenId, ulong xOrigin, ulong yOrigin, ulong uWidth, ulong uHeight);
481 /** Notifies display about all screens were invalidated. */
482 bool invalidateAndUpdate();
483 /** Notifies display about screen with passed uScreenId was invalidated. */
484 bool invalidateAndUpdateScreen(ulong uScreenId);
485
486 /** Acquires whether VRDE server is present. */
487 bool acquireWhetherVRDEServerPresent(bool &fPresent);
488 /** Acquires whether VRDE server is enabled. */
489 bool acquireWhetherVRDEServerEnabled(bool &fEnabled);
490 /** Defines whether VRDE server is enabled. */
491 bool setVRDEServerEnabled(bool fEnabled);
492 /** Acquires VRDE server port. */
493 bool acquireVRDEServerPort(long &iPort);
494
495 /** Acquires whether recording settings is present. */
496 bool acquireWhetherRecordingSettingsPresent(bool &fPresent);
497 /** Acquires whether recording settings is enabled. */
498 bool acquireWhetherRecordingSettingsEnabled(bool &fEnabled);
499 /** Defines whether recording settings is enabled. */
500 bool setRecordingSettingsEnabled(bool fEnabled);
501 /** @} */
502
503 /** @name Status-bar stuff.
504 ** @{ */
505 /** Acquires device activity composing a vector of current @a states for device with @a deviceTypes specified. */
506 bool acquireDeviceActivity(const QVector<KDeviceType> &deviceTypes, QVector<KDeviceActivity> &states);
507
508 /** Acquires status info for hard disk indicator. */
509 void acquireHardDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent);
510 /** Acquires status info for optical disk indicator. */
511 void acquireOpticalDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted);
512 /** Acquires status info for floppy disk indicator. */
513 void acquireFloppyDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted);
514 /** Acquires status info for audio indicator. */
515 void acquireAudioStatusInfo(QString &strInfo, bool &fAudioEnabled, bool &fEnabledOutput, bool &fEnabledInput);
516 /** Acquires status info for network indicator. */
517 void acquireNetworkStatusInfo(QString &strInfo, bool &fAdaptersPresent, bool &fCablesDisconnected);
518 /** Acquires status info for USB indicator. */
519 void acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds);
520 /** Acquires status info for Shared Folders indicator. */
521 void acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent);
522 /** Acquires status info for Display indicator. */
523 void acquireDisplayStatusInfo(QString &strInfo, bool &fAcceleration3D);
524 /** Acquires status info for Recording indicator. */
525 void acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused);
526 /** Acquires status info for Features indicator. */
527 void acquireFeaturesStatusInfo(QString &strInfo, KVMExecutionEngine &enmEngine,
528 bool fNestedPagingEnabled, bool fUxEnabled,
529 KParavirtProvider enmProvider);
530 /** @} */
531
532 /** @name Debugger stuff.
533 ** @{ */
534 /** Defines whether log is @a fEnabled. */
535 bool setLogEnabled(bool fEnabled);
536 /** Acquires whether log is @a fEnabled. */
537 bool acquireWhetherLogEnabled(bool &fEnabled);
538
539 /** Acquire log folder. */
540 bool acquireLogFolder(QString &strFolder);
541
542 /** Acquires effective paravirt provider. */
543 bool acquireEffectiveParavirtProvider(KParavirtProvider &enmProvider);
544
545 /** Acquires VM's execution engine @a enmType. */
546 bool acquireExecutionEngineType(KVMExecutionEngine &enmType);
547 /** Acquires whether nested paging hardware virtualization extension is @a fEnabled. */
548 bool acquireWhetherHwVirtExNestedPagingEnabled(bool &fEnabled);
549 /** Acquires whether UX hardware virtualization extension is @a fEnabled. */
550 bool acquireWhetherHwVirtExUXEnabled(bool &fEnabled);
551
552 /** Acquires effective CPU @a uLoad. */
553 bool acquireEffectiveCPULoad(ulong &uLoad);
554 /** Acquires uptime @a iUpTime as milliseconds. */
555 bool acquireUptime(LONG64 &iUpTime);
556
557#ifdef VBOX_WITH_DEBUGGER_GUI
558 /** Makes sure debugger GUI is created. */
559 bool dbgCreated(void *pActionDebug);
560 /** Makes sure debugger GUI is destroyed. */
561 void dbgDestroy();
562
563 /** Shows debugger UI statistics window. */
564 void dbgShowStatistics();
565 /** Shows debugger UI command line window. */
566 void dbgShowCommandLine();
567
568 /** Adjusts relative position for debugger window. */
569 void dbgAdjustRelativePos();
570#endif /* VBOX_WITH_DEBUGGER_GUI */
571 /** @} */
572
573 /** @name Close stuff.
574 ** @{ */
575 /** Acquires whether guest @a fEntered ACPI mode. */
576 bool acquireWhetherGuestEnteredACPIMode(bool &fEntered);
577
578 /** Saves VM state, then closes Runtime UI. */
579 void saveState();
580 /** Calls for guest shutdown to close Runtime UI. */
581 void shutdown();
582 /** Powers VM off, then closes Runtime UI. */
583 void powerOff(bool fIncludingDiscard);
584 /** @} */
585
586 /** @name VM information stuff.
587 ** @{ */
588 /** Returns general info. of the machine(). */
589 void generateMachineInformationGeneral(const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions,
590 UITextTable &returnTable);
591 /** Returns system info. of the machine(). */
592 void generateMachineInformationSystem(const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions,
593 UITextTable &returnTable);
594 /** Returns display info. of the machine(). */
595 void generateMachineInformationDisplay(const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions,
596 UITextTable &returnTable);
597 /** Returns storage info. of the machine(). */
598 void generateMachineInformationStorage(const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions,
599 UITextTable &returnTable);
600 /** Returns audio info. of the machine(). */
601 void generateMachineInformationAudio(const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions,
602 UITextTable &returnTable);
603 /** Returns network info. of the machine(). */
604 void generateMachineInformationNetwork(const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions,
605 UITextTable &returnTable);
606 /** Returns serial info. of the machine(). */
607 void generateMachineInformationSerial(const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions,
608 UITextTable &returnTable);
609 /** Returns USB info. of the machine(). */
610 void generateMachineInformationUSB(const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions,
611 UITextTable &returnTable);
612 /** Returns shared folders info. of the machine(). */
613 void generateMachineInformationSharedFolders(const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions,
614 UITextTable &returnTable);
615 /** @} */
616
617public slots:
618
619 /** @name Guest additions stuff.
620 ** @{ */
621 /** Handles request to install guest additions image.
622 * @param strSource Brings the source of image being installed. */
623 void sltInstallGuestAdditionsFrom(const QString &strSource);
624 /** Mounts DVD adhoc.
625 * @param strSource Brings the source of image being mounted. */
626 void sltMountDVDAdHoc(const QString &strSource);
627 /** @} */
628
629private slots:
630
631 /** @name COM stuff.
632 ** @{ */
633 /** Detaches COM. */
634 void sltDetachCOM();
635 /** @} */
636
637 /** @name Machine-state stuff.
638 ** @{ */
639 /** Handles event about VM @a enmState change. */
640 void sltStateChange(KMachineState enmState);
641 /** @} */
642
643 /** @name Guest additions stuff.
644 ** @{ */
645 /** Handles event about guest additions change. */
646 void sltAdditionsChange();
647 /** @} */
648
649 /** @name Close stuff.
650 ** @{ */
651 /** Handles signal about machine state saved.
652 * @param fSuccess Brings whether state was saved successfully. */
653 void sltHandleMachineStateSaved(bool fSuccess);
654 /** Handles signal about machine powered off.
655 * @param fSuccess Brings whether machine was powered off successfully.
656 * @param fIncludingDiscard Brings whether machine state should be discarded. */
657 void sltHandleMachinePoweredOff(bool fSuccess, bool fIncludingDiscard);
658 /** Handles signal about snapshot restored.
659 * @param fSuccess Brings whether machine was powered off successfully. */
660 void sltHandleSnapshotRestored(bool fSuccess);
661 /** @} */
662
663private:
664
665 /** @name Prepare/cleanup cascade.
666 ** @{ */
667 /** Prepares COM stuff. */
668 bool prepareCOMStuff();
669 /** Prepares console event-handler. */
670 void prepareConsoleEventHandlers();
671 /** Prepares frame-buffers. */
672 void prepareFramebuffers();
673 /** Prepares connections. */
674 void prepareConnections();
675 /** Prepares signal handling. */
676 void prepareSignalHandling();
677
678 /** Cleanups frame-buffers. */
679 void cleanupFramebuffers();
680 /** Cleanups console event-handler. */
681 void cleanupConsoleEventHandlers();
682 /** Cleanups COM stuff. */
683 void cleanupCOMStuff();
684 /** @} */
685
686 /** @name General stuff.
687 ** @{ */
688 /** Returns the machine UI reference. */
689 UIMachine *uimachine() const { return m_pMachine; }
690 /** Returns the machine-logic reference. */
691 UIMachineLogic *machineLogic() const;
692 /** Returns main machine-window reference. */
693 UIMachineWindow *activeMachineWindow() const;
694 /** Returns main machine-widget reference. */
695 QWidget *mainMachineWindow() const;
696
697 /** Preprocess initialization. */
698 bool preprocessInitialization();
699
700 /** Mounts medium adhoc.
701 * @param enmDeviceType Brings device type.
702 * @param enmMediumType Brings medium type.
703 * @param strMediumName Brings medium name. */
704 bool mountAdHocImage(KDeviceType enmDeviceType, UIMediumDeviceType enmMediumType, const QString &strMediumName);
705
706 /** Recaches media attached to the machine. */
707 void recacheMachineMedia();
708 /** @} */
709
710 /** @name Snapshot stuff.
711 ** @{ */
712 /** Recursively searches for a first snapshot matching name template conditions. */
713 static bool searchMaxSnapshotIndex(const CMachine &machine, const CSnapshot &snapshot,
714 const QString &strNameTemplate, ulong &uIndex);
715 /** @} */
716
717 /** @name General stuff.
718 ** @{ */
719 /** Holds the machine UI reference. */
720 UIMachine *m_pMachine;
721
722 /** Holds whether session UI is valid. */
723 bool m_fValid;
724
725 /** Holds the machine name. */
726 QString m_strMachineName;
727 /** Holds the OS type id. */
728 QString m_strOSTypeId;
729 /** @} */
730
731 /** @name COM stuff.
732 ** @{ */
733 /** Holds the CConsole event handler instance. */
734 UIConsoleEventHandler *m_pConsoleEventhandler;
735
736 /** Holds the session instance. */
737 CSession m_comSession;
738 /** Holds the session's machine instance. */
739 CMachine m_comMachine;
740 /** Holds the session's console instance. */
741 CConsole m_comConsole;
742 /** Holds the console's display instance. */
743 CDisplay m_comDisplay;
744 /** Holds the console's guest instance. */
745 CGuest m_comGuest;
746 /** Holds the console's mouse instance. */
747 CMouse m_comMouse;
748 /** Holds the console's keyboard instance. */
749 CKeyboard m_comKeyboard;
750 /** Holds the console's debugger instance. */
751 CMachineDebugger m_comDebugger;
752 /** @} */
753
754 /** @name Machine-state stuff.
755 ** @{ */
756 /** Holds the previous machine state. */
757 KMachineState m_enmMachineStatePrevious;
758 /** Holds the actual machine state. */
759 KMachineState m_enmMachineState;
760 /** @} */
761
762 /** @name Guest additions stuff.
763 ** @{ */
764 /** Holds the guest-additions run level. */
765 ulong m_ulGuestAdditionsRunLevel;
766 /** Holds whether guest-additions supports graphics. */
767 bool m_fIsGuestSupportsGraphics;
768 /** Holds whether guest-additions supports seamless. */
769 bool m_fIsGuestSupportsSeamless;
770 /** @} */
771
772 /** @name Machine-state stuff.
773 ** @{ */
774 /** Holds the frame-buffer vector. */
775 QVector<UIFrameBuffer*> m_frameBufferVector;
776 /** @} */
777
778 /** @name Debugger stuff.
779 ** @{ */
780#ifdef VBOX_WITH_DEBUGGER_GUI
781 /** Holds the handle to the debugger GUI. */
782 PDBGGUI m_pDbgGui;
783 /** Holds the virtual method table for the debugger GUI. */
784 PCDBGGUIVT m_pDbgGuiVT;
785#endif /* VBOX_WITH_DEBUGGER_GUI */
786 /** @} */
787};
788
789#endif /* !FEQT_INCLUDED_SRC_runtime_UISession_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette