VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 4 weeks ago

Copyright year updates by scm.

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