VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

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

FE/Qt. bugref:10622. Using new UITranslationEventListener in the UIActionPool class.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 80.2 KB
Line 
1/* $Id: UIMachine.cpp 104393 2024-04-22 13:02:56Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMachine class implementation.
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/* Qt includes: */
29#include <QApplication>
30#ifdef VBOX_WS_WIN
31# include <QBitmap>
32#endif
33#ifdef VBOX_WS_MAC
34# include <QMenuBar>
35# include <QTimer>
36#endif
37
38/* GUI includes: */
39#include "UICommon.h"
40#include "UIDesktopWidgetWatchdog.h"
41#include "UIExtraDataManager.h"
42#include "UIGlobalSession.h"
43#include "UIIconPool.h"
44#include "UIMachine.h"
45#include "UISession.h"
46#include "UIActionPoolRuntime.h"
47#include "UILoggingDefs.h"
48#include "UIMachineLogic.h"
49#include "UIMachineWindow.h"
50#include "UIMessageCenter.h"
51#include "UINotificationCenter.h"
52#ifdef VBOX_WS_MAC
53# include "UICocoaApplication.h"
54# include "VBoxUtils-darwin.h"
55#endif
56
57/* COM includes: */
58#include "CAudioAdapter.h"
59#include "CAudioSettings.h"
60#include "CConsole.h"
61#include "CGraphicsAdapter.h"
62#include "CHostVideoInputDevice.h"
63#include "CMachine.h"
64#include "CMediumAttachment.h"
65#include "CNetworkAdapter.h"
66#include "CProgress.h"
67#include "CRecordingSettings.h"
68#include "CSession.h"
69#include "CSnapshot.h"
70#include "CSystemProperties.h"
71#include "CUSBController.h"
72#include "CUSBDeviceFilters.h"
73#include "CVRDEServer.h"
74
75
76#ifdef VBOX_WS_MAC
77/**
78 * MacOS X: Application Services: Core Graphics: Display reconfiguration callback.
79 *
80 * Notifies UIMachine about @a display configuration change.
81 * Corresponding change described by Core Graphics @a flags.
82 * Uses UIMachine @a pHandler to process this change.
83 *
84 * @note Last argument (@a pHandler) must always be valid pointer to UIMachine object.
85 * @note Calls for UIMachine::sltHandleHostDisplayAboutToChange() slot if display configuration changed.
86 */
87void cgDisplayReconfigurationCallback(CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *pHandler)
88{
89 /* Which flags we are handling? */
90 int iHandledFlags = kCGDisplayAddFlag /* display added */
91 | kCGDisplayRemoveFlag /* display removed */
92 | kCGDisplaySetModeFlag /* display mode changed */;
93
94 /* Handle 'display-add' case: */
95 if (flags & kCGDisplayAddFlag)
96 LogRelFlow(("GUI: UIMachine::cgDisplayReconfigurationCallback: Display added.\n"));
97 /* Handle 'display-remove' case: */
98 else if (flags & kCGDisplayRemoveFlag)
99 LogRelFlow(("GUI: UIMachine::cgDisplayReconfigurationCallback: Display removed.\n"));
100 /* Handle 'mode-set' case: */
101 else if (flags & kCGDisplaySetModeFlag)
102 LogRelFlow(("GUI: UIMachine::cgDisplayReconfigurationCallback: Display mode changed.\n"));
103
104 /* Ask handler to process our callback: */
105 if (flags & iHandledFlags)
106 QTimer::singleShot(0, static_cast<UIMachine*>(pHandler),
107 SLOT(sltHandleHostDisplayAboutToChange()));
108
109 Q_UNUSED(display);
110}
111#endif /* VBOX_WS_MAC */
112
113
114/* static */
115UIMachine *UIMachine::s_pInstance = 0;
116
117/* static */
118bool UIMachine::startMachine()
119{
120 /* Make sure machine is not created: */
121 AssertReturn(!s_pInstance, false);
122
123 /* Restore current snapshot if requested: */
124 if (uiCommon().shouldRestoreCurrentSnapshot())
125 {
126 /* Create temporary session: */
127 CSession comSession = uiCommon().openSession(KLockType_VM);
128 if (comSession.isNull())
129 return false;
130
131 /* Which VM we operate on? */
132 CMachine comMachine = comSession.GetMachine();
133 /* Which snapshot we are restoring? */
134 CSnapshot comSnapshot = comMachine.GetCurrentSnapshot();
135
136 /* Prepare restore-snapshot progress: */
137 CProgress comProgress = comMachine.RestoreSnapshot(comSnapshot);
138 if (!comMachine.isOk())
139 return msgCenter().cannotRestoreSnapshot(comMachine, comSnapshot.GetName(), comMachine.GetName());
140
141 /* Show the snapshot-discarding progress: */
142 msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_snapshot_discard_90px.png");
143 if (comProgress.GetResultCode() != 0)
144 return msgCenter().cannotRestoreSnapshot(comProgress, comSnapshot.GetName(), comMachine.GetName());
145
146 /* Unlock session finally: */
147 comSession.UnlockMachine();
148
149 /* Clear snapshot-restoring request: */
150 uiCommon().setShouldRestoreCurrentSnapshot(false);
151 }
152
153 /* For separate process we should launch VM before UI: */
154 if (uiCommon().isSeparateProcess())
155 {
156 /* Get corresponding machine: */
157 CMachine machine = gpGlobalSession->virtualBox().FindMachine(uiCommon().managedVMUuid().toString());
158 AssertMsgReturn(!machine.isNull(), ("UICommon::managedVMUuid() should have filter that case before!\n"), false);
159
160 /* Try to launch corresponding machine: */
161 if (!UICommon::launchMachine(machine, UILaunchMode_Separate))
162 return false;
163 }
164
165 /* Try to create machine UI: */
166 return create();
167}
168
169/* static */
170bool UIMachine::create()
171{
172 /* Make sure machine is not created: */
173 AssertReturn(!s_pInstance, false);
174
175 /* Create machine UI: */
176 new UIMachine;
177
178 /* Make sure it's prepared: */
179 if (!s_pInstance->prepare())
180 {
181 /* Destroy machine UI otherwise: */
182 destroy();
183 /* False in that case: */
184 return false;
185 }
186
187 /* True by default: */
188 return true;
189}
190
191/* static */
192void UIMachine::destroy()
193{
194 /* Make sure machine is created: */
195 if (!s_pInstance)
196 return;
197
198 /* Protect versus recursive call: */
199 UIMachine *pInstance = s_pInstance;
200 s_pInstance = 0;
201 /* Cleanup machine UI: */
202 pInstance->cleanup();
203 /* Destroy machine UI: */
204 delete pInstance;
205}
206
207UIFrameBuffer *UIMachine::frameBuffer(ulong uScreenId)
208{
209 return uisession()->frameBuffer(uScreenId);
210}
211
212QWidget* UIMachine::activeWindow() const
213{
214 return machineLogic() && machineLogic()->activeMachineWindow()
215 ? machineLogic()->activeMachineWindow()
216 : 0;
217}
218
219bool UIMachine::isSessionValid() const
220{
221 return uisession() ? uisession()->isValid() : false;
222}
223
224void UIMachine::asyncChangeVisualState(UIVisualStateType visualState)
225{
226 emit sigRequestAsyncVisualStateChange(visualState);
227}
228
229void UIMachine::setRequestedVisualState(UIVisualStateType visualStateType)
230{
231 /* Remember requested visual state: */
232 m_enmRequestedVisualState = visualStateType;
233
234 /* Save only if it's different from Invalid and from current one: */
235 if ( m_enmRequestedVisualState != UIVisualStateType_Invalid
236 && gEDataManager->requestedVisualState(uiCommon().managedVMUuid()) != m_enmRequestedVisualState)
237 gEDataManager->setRequestedVisualState(m_enmRequestedVisualState, uiCommon().managedVMUuid());
238}
239
240UIVisualStateType UIMachine::requestedVisualState() const
241{
242 return m_enmRequestedVisualState;
243}
244
245QString UIMachine::machineName() const
246{
247 return uisession()->machineName();
248}
249
250QString UIMachine::osTypeId() const
251{
252 return uisession()->osTypeId();
253}
254
255void UIMachine::acquireMachinePixmap(const QSize &size, QPixmap &pixmap)
256{
257 return uisession()->acquireMachinePixmap(size, pixmap);
258}
259
260void UIMachine::acquireUserMachineIcon(QIcon &icon)
261{
262 return uisession()->acquireUserMachineIcon(icon);
263}
264
265bool UIMachine::acquireArchitectureType(KPlatformArchitecture &enmType)
266{
267 return uisession()->acquireArchitectureType(enmType);
268}
269
270bool UIMachine::acquireChipsetType(KChipsetType &enmType)
271{
272 return uisession()->acquireChipsetType(enmType);
273}
274
275void UIMachine::updateStateAdditionsActions()
276{
277 /* Make sure action-pool knows whether GA supports graphics: */
278 actionPool()->toRuntime()->setGuestSupportsGraphics(isGuestSupportsGraphics());
279 /* Enable/Disable Upgrade Additions action depending on feature status: */
280 actionPool()->action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions)->setEnabled(uisession()->guestAdditionsUpgradable());
281}
282
283void UIMachine::updateStateAudioActions()
284{
285 /* Make sure Audio adapter is present: */
286 bool fAdapterPresent = false;
287 acquireWhetherAudioAdapterPresent(fAdapterPresent);
288 if (fAdapterPresent)
289 {
290 /* Check/Uncheck Audio adapter output/input actions depending on features status: */
291 bool fAudioOutputEnabled = false;
292 bool fAudioInputEnabled = false;
293 acquireWhetherAudioAdapterOutputEnabled(fAudioOutputEnabled);
294 acquireWhetherAudioAdapterInputEnabled(fAudioInputEnabled);
295 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(true);
296 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->setChecked(fAudioOutputEnabled);
297 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(false);
298 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(true);
299 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->setChecked(fAudioInputEnabled);
300 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(false);
301 }
302}
303
304void UIMachine::updateStateRecordingAction()
305{
306 /* Make sure Recording settings present: */
307 bool fSettingsPresent = false;
308 acquireWhetherRecordingSettingsPresent(fSettingsPresent);
309 AssertMsgReturnVoid(fSettingsPresent,
310 ("Recording settings can't be null!\n"));
311
312 /* Check/Uncheck Recording action depending on feature status: */
313 bool fSettingsEnabled = false;
314 acquireWhetherRecordingSettingsEnabled(fSettingsEnabled);
315 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->blockSignals(true);
316 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->setChecked(fSettingsEnabled);
317 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->blockSignals(false);
318}
319
320void UIMachine::updateStateVRDEServerAction()
321{
322 /* Make sure VRDE server present: */
323 bool fServerPresent = false;
324 acquireWhetherVRDEServerPresent(fServerPresent);
325 AssertMsgReturnVoid(fServerPresent,
326 ("VRDE server can't be null!\n"));
327
328 /* Check/Uncheck VRDE Server action depending on feature status: */
329 bool fServerEnabled = false;
330 acquireWhetherVRDEServerEnabled(fServerEnabled);
331 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(true);
332 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->setChecked(fServerEnabled);
333 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(false);
334}
335
336KMachineState UIMachine::machineStatePrevious() const
337{
338 return uisession()->machineStatePrevious();
339}
340
341KMachineState UIMachine::machineState() const
342{
343 return uisession()->machineState();
344}
345
346void UIMachine::forgetPreviousMachineState()
347{
348 uisession()->forgetPreviousMachineState();
349}
350
351bool UIMachine::acquireLiveMachineState(KMachineState &enmState)
352{
353 return uisession()->acquireLiveMachineState(enmState);
354}
355
356bool UIMachine::isTurnedOff() const
357{
358 return uisession()->isTurnedOff();
359}
360
361bool UIMachine::isPaused() const
362{
363 return uisession()->isPaused();
364}
365
366bool UIMachine::wasPaused() const
367{
368 return uisession()->wasPaused();
369}
370
371bool UIMachine::isRunning() const
372{
373 return uisession()->isRunning();
374}
375
376bool UIMachine::isStuck() const
377{
378 return uisession()->isStuck();
379}
380
381bool UIMachine::isGuestScreenUnDrawable() const
382{
383 return uisession()->isGuestScreenUnDrawable();
384}
385
386bool UIMachine::reset()
387{
388 return uisession()->reset();
389}
390
391bool UIMachine::pause()
392{
393 return uisession()->pause();
394}
395
396bool UIMachine::unpause()
397{
398 return uisession()->unpause();
399}
400
401bool UIMachine::setPause(bool fPause)
402{
403 return uisession()->setPause(fPause);
404}
405
406bool UIMachine::acquireSettingsFilePath(QString &strPath)
407{
408 return uisession()->acquireSettingsFilePath(strPath);
409}
410
411bool UIMachine::saveSettings()
412{
413 return uisession()->saveSettings();
414}
415
416bool UIMachine::acquireSnapshotCount(ulong &uCount)
417{
418 return uisession()->acquireSnapshotCount(uCount);
419}
420
421bool UIMachine::acquireCurrentSnapshotName(QString &strName)
422{
423 return uisession()->acquireCurrentSnapshotName(strName);
424}
425
426bool UIMachine::acquireMaxSnapshotIndex(const QString &strNameTemplate, ulong &uIndex)
427{
428 return uisession()->acquireMaxSnapshotIndex(strNameTemplate, uIndex);
429}
430
431void UIMachine::takeSnapshot(const QString &strName, const QString &strDescription)
432{
433 return uisession()->takeSnapshot(strName, strDescription);
434}
435
436bool UIMachine::acquireWhetherAudioAdapterPresent(bool &fPresent)
437{
438 return uisession()->acquireWhetherAudioAdapterPresent(fPresent);
439}
440
441bool UIMachine::acquireWhetherAudioAdapterEnabled(bool &fEnabled)
442{
443 return uisession()->acquireWhetherAudioAdapterEnabled(fEnabled);
444}
445
446bool UIMachine::acquireWhetherAudioAdapterOutputEnabled(bool &fEnabled)
447{
448 return uisession()->acquireWhetherAudioAdapterOutputEnabled(fEnabled);
449}
450
451bool UIMachine::acquireWhetherAudioAdapterInputEnabled(bool &fEnabled)
452{
453 return uisession()->acquireWhetherAudioAdapterInputEnabled(fEnabled);
454}
455
456bool UIMachine::setAudioAdapterOutputEnabled(bool fEnabled)
457{
458 return uisession()->setAudioAdapterOutputEnabled(fEnabled);
459}
460
461bool UIMachine::setAudioAdapterInputEnabled(bool fEnabled)
462{
463 return uisession()->setAudioAdapterInputEnabled(fEnabled);
464}
465
466bool UIMachine::isScreenVisibleHostDesires(ulong uScreenId) const
467{
468 /* Make sure index feats the bounds: */
469 AssertReturn(uScreenId < (ulong)m_guestScreenVisibilityVectorHostDesires.size(), false);
470
471 /* Return 'actual' (host-desire) visibility status: */
472 return m_guestScreenVisibilityVectorHostDesires.value((int)uScreenId);
473}
474
475void UIMachine::setScreenVisibleHostDesires(ulong uScreenId, bool fIsMonitorVisible)
476{
477 /* Make sure index feats the bounds: */
478 AssertReturnVoid(uScreenId < (ulong)m_guestScreenVisibilityVectorHostDesires.size());
479
480 /* Remember 'actual' (host-desire) visibility status: */
481 m_guestScreenVisibilityVectorHostDesires[(int)uScreenId] = fIsMonitorVisible;
482
483 /* And remember the request in extra data for guests with VMSVGA: */
484 /* This should be done before the actual hint is sent in case the guest overrides it. */
485 gEDataManager->setLastGuestScreenVisibilityStatus(uScreenId, fIsMonitorVisible, uiCommon().managedVMUuid());
486}
487
488bool UIMachine::isScreenVisible(ulong uScreenId) const
489{
490 /* Make sure index feats the bounds: */
491 AssertReturn(uScreenId < (ulong)m_guestScreenVisibilityVector.size(), false);
492
493 /* Return 'actual' visibility status: */
494 return m_guestScreenVisibilityVector.value((int)uScreenId);
495}
496
497void UIMachine::setScreenVisible(ulong uScreenId, bool fIsMonitorVisible)
498{
499 /* Make sure index feats the bounds: */
500 AssertReturnVoid(uScreenId < (ulong)m_guestScreenVisibilityVector.size());
501
502 /* Remember 'actual' visibility status: */
503 m_guestScreenVisibilityVector[(int)uScreenId] = fIsMonitorVisible;
504 /* Remember 'desired' visibility status: */
505 // See note in UIMachineView::sltHandleNotifyChange() regarding the graphics controller check. */
506 KGraphicsControllerType enmType = KGraphicsControllerType_Null;
507 acquireGraphicsControllerType(enmType);
508 if (enmType != KGraphicsControllerType_VMSVGA)
509 gEDataManager->setLastGuestScreenVisibilityStatus(uScreenId, fIsMonitorVisible, uiCommon().managedVMUuid());
510
511 /* Make sure action-pool knows guest-screen visibility status: */
512 actionPool()->toRuntime()->setGuestScreenVisible(uScreenId, fIsMonitorVisible);
513}
514
515int UIMachine::countOfVisibleWindows()
516{
517 int cCountOfVisibleWindows = 0;
518 for (int i = 0; i < m_guestScreenVisibilityVector.size(); ++i)
519 if (m_guestScreenVisibilityVector[i])
520 ++cCountOfVisibleWindows;
521 return cCountOfVisibleWindows;
522}
523
524QList<int> UIMachine::listOfVisibleWindows() const
525{
526 QList<int> visibleWindows;
527 for (int i = 0; i < m_guestScreenVisibilityVector.size(); ++i)
528 if (m_guestScreenVisibilityVector.at(i))
529 visibleWindows.push_back(i);
530 return visibleWindows;
531}
532
533QSize UIMachine::guestScreenSize(ulong uScreenId) const
534{
535 return uisession()->frameBufferSize(uScreenId);
536}
537
538QSize UIMachine::lastFullScreenSize(ulong uScreenId) const
539{
540 /* Make sure index fits the bounds: */
541 AssertReturn(uScreenId < (ulong)m_monitorLastFullScreenSizeVector.size(), QSize(-1, -1));
542
543 /* Return last full-screen size: */
544 return m_monitorLastFullScreenSizeVector.value((int)uScreenId);
545}
546
547void UIMachine::setLastFullScreenSize(ulong uScreenId, QSize size)
548{
549 /* Make sure index fits the bounds: */
550 AssertReturnVoid(uScreenId < (ulong)m_monitorLastFullScreenSizeVector.size());
551
552 /* Remember last full-screen size: */
553 m_monitorLastFullScreenSizeVector[(int)uScreenId] = size;
554}
555
556bool UIMachine::acquireGraphicsControllerType(KGraphicsControllerType &enmType)
557{
558 return uisession()->acquireGraphicsControllerType(enmType);
559}
560
561bool UIMachine::acquireVRAMSize(ulong &uSize)
562{
563 return uisession()->acquireVRAMSize(uSize);
564}
565
566bool UIMachine::acquireWhetherAccelerate3DEnabled(bool &fEnabled)
567{
568 return uisession()->acquireWhetherAccelerate3DEnabled(fEnabled);
569}
570
571bool UIMachine::acquireMonitorCount(ulong &uCount)
572{
573 return uisession()->acquireMonitorCount(uCount);
574}
575
576bool UIMachine::acquireGuestScreenParameters(ulong uScreenId,
577 ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
578 long &xOrigin, long &yOrigin, KGuestMonitorStatus &enmMonitorStatus)
579{
580 return uisession()->acquireGuestScreenParameters(uScreenId,
581 uWidth, uHeight, uBitsPerPixel,
582 xOrigin, yOrigin, enmMonitorStatus);
583}
584
585bool UIMachine::acquireSavedGuestScreenInfo(ulong uScreenId,
586 long &xOrigin, long &yOrigin,
587 ulong &uWidth, ulong &uHeight, bool &fEnabled)
588{
589 return uisession()->acquireSavedGuestScreenInfo(uScreenId,
590 xOrigin, yOrigin,
591 uWidth, uHeight, fEnabled);
592}
593
594bool UIMachine::setVideoModeHint(ulong uScreenId, bool fEnabled, bool fChangeOrigin,
595 long xOrigin, long yOrigin, ulong uWidth, ulong uHeight,
596 ulong uBitsPerPixel, bool fNotify)
597{
598 return uisession()->setVideoModeHint(uScreenId, fEnabled, fChangeOrigin,
599 xOrigin, yOrigin, uWidth, uHeight,
600 uBitsPerPixel, fNotify);
601}
602
603bool UIMachine::acquireVideoModeHint(ulong uScreenId, bool &fEnabled, bool &fChangeOrigin,
604 long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight,
605 ulong &uBitsPerPixel)
606{
607 return uisession()->acquireVideoModeHint(uScreenId, fEnabled, fChangeOrigin,
608 xOrigin, yOrigin, uWidth, uHeight,
609 uBitsPerPixel);
610}
611
612bool UIMachine::acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits)
613{
614 return uisession()->acquireScreenShot(uScreenId, uWidth, uHeight, enmFormat, pBits);
615}
616
617bool UIMachine::acquireSavedScreenshotInfo(ulong uScreenId, ulong &uWidth, ulong &uHeight, QVector<KBitmapFormat> &formats)
618{
619 return uisession()->acquireSavedScreenshotInfo(uScreenId, uWidth, uHeight, formats);
620}
621
622bool UIMachine::acquireSavedScreenshot(ulong uScreenId, KBitmapFormat enmFormat,
623 ulong &uWidth, ulong &uHeight, QVector<BYTE> &screenshot)
624{
625 return uisession()->acquireSavedScreenshot(uScreenId, enmFormat,
626 uWidth, uHeight, screenshot);
627}
628
629bool UIMachine::notifyScaleFactorChange(ulong uScreenId, ulong uScaleFactorWMultiplied, ulong uScaleFactorHMultiplied)
630{
631 return uisession()->notifyScaleFactorChange(uScreenId, uScaleFactorWMultiplied, uScaleFactorHMultiplied);
632}
633
634bool UIMachine::notifyHiDPIOutputPolicyChange(bool fUnscaledHiDPI)
635{
636 return uisession()->notifyHiDPIOutputPolicyChange(fUnscaledHiDPI);
637}
638
639bool UIMachine::setSeamlessMode(bool fEnabled)
640{
641 return uisession()->setSeamlessMode(fEnabled);
642}
643
644bool UIMachine::viewportChanged(ulong uScreenId, ulong xOrigin, ulong yOrigin, ulong uWidth, ulong uHeight)
645{
646 return uisession()->viewportChanged(uScreenId, xOrigin, yOrigin, uWidth, uHeight);
647}
648
649bool UIMachine::invalidateAndUpdate()
650{
651 return uisession()->invalidateAndUpdate();
652}
653
654bool UIMachine::invalidateAndUpdateScreen(ulong uScreenId)
655{
656 return uisession()->invalidateAndUpdateScreen(uScreenId);
657}
658
659bool UIMachine::acquireWhetherVRDEServerPresent(bool &fPresent)
660{
661 return uisession()->acquireWhetherVRDEServerPresent(fPresent);
662}
663
664bool UIMachine::acquireWhetherVRDEServerEnabled(bool &fEnabled)
665{
666 return uisession()->acquireWhetherVRDEServerEnabled(fEnabled);
667}
668
669bool UIMachine::setVRDEServerEnabled(bool fEnabled)
670{
671 return uisession()->setVRDEServerEnabled(fEnabled);
672}
673
674bool UIMachine::acquireVRDEServerPort(long &iPort)
675{
676 return uisession()->acquireVRDEServerPort(iPort);
677}
678
679bool UIMachine::acquireWhetherRecordingSettingsPresent(bool &fPresent)
680{
681 return uisession()->acquireWhetherRecordingSettingsPresent(fPresent);
682}
683
684bool UIMachine::acquireWhetherRecordingSettingsEnabled(bool &fEnabled)
685{
686 return uisession()->acquireWhetherRecordingSettingsEnabled(fEnabled);
687}
688
689bool UIMachine::setRecordingSettingsEnabled(bool fEnabled)
690{
691 return uisession()->setRecordingSettingsEnabled(fEnabled);
692}
693
694bool UIMachine::isGuestAdditionsActive() const
695{
696 return uisession()->isGuestAdditionsActive();
697}
698
699bool UIMachine::isGuestSupportsGraphics() const
700{
701 return uisession()->isGuestSupportsGraphics();
702}
703
704bool UIMachine::isGuestSupportsSeamless() const
705{
706 return uisession()->isGuestSupportsSeamless();
707}
708
709bool UIMachine::acquireGuestAdditionsVersion(QString &strVersion)
710{
711 return uisession()->acquireGuestAdditionsVersion(strVersion);
712}
713
714bool UIMachine::acquireGuestAdditionsRevision(ulong &uRevision)
715{
716 return uisession()->acquireGuestAdditionsRevision(uRevision);
717}
718
719bool UIMachine::notifyGuiFocusChange(bool fInfocus)
720{
721 return uisession()->notifyGuiFocusChange(fInfocus);
722}
723
724bool UIMachine::putScancode(LONG iCode)
725{
726 return uisession()->putScancode(iCode);
727}
728
729bool UIMachine::putScancodes(const QVector<LONG> &codes)
730{
731 return uisession()->putScancodes(codes);
732}
733
734bool UIMachine::putCAD()
735{
736 return uisession()->putCAD();
737}
738
739bool UIMachine::releaseKeys()
740{
741 return uisession()->releaseKeys();
742}
743
744bool UIMachine::putUsageCode(LONG iUsageCode, LONG iUsagePage, bool fKeyRelease)
745{
746 return uisession()->putUsageCode(iUsageCode, iUsagePage, fKeyRelease);
747}
748
749bool UIMachine::putMouseEvent(long iDx, long iDy, long iDz, long iDw, long iButtonState)
750{
751 return uisession()->putMouseEvent(iDx, iDy, iDz, iDw, iButtonState);
752}
753
754bool UIMachine::putMouseEventAbsolute(long iX, long iY, long iDz, long iDw, long iButtonState)
755{
756 return uisession()->putMouseEventAbsolute(iX, iY, iDz, iDw, iButtonState);
757}
758
759bool UIMachine::putEventMultiTouch(long iCount, const QVector<LONG64> &contacts, bool fIsTouchScreen, ulong uScanTime)
760{
761 return uisession()->putEventMultiTouch(iCount, contacts, fIsTouchScreen, uScanTime);
762}
763
764bool UIMachine::acquireClipboardMode(KClipboardMode &enmMode)
765{
766 return uisession()->acquireClipboardMode(enmMode);
767}
768
769bool UIMachine::setClipboardMode(KClipboardMode enmMode)
770{
771 return uisession()->setClipboardMode(enmMode);
772}
773
774bool UIMachine::toggleClipboardFileTransfer(bool fEnabled)
775{
776 return uisession()->toggleClipboardFileTransfer(fEnabled);
777}
778
779bool UIMachine::isClipboardFileTransferEnabled()
780{
781 return uisession()->isClipboardFileTransferEnabled();
782}
783
784bool UIMachine::acquireDnDMode(KDnDMode &enmMode)
785{
786 return uisession()->acquireDnDMode(enmMode);
787}
788
789bool UIMachine::setDnDMode(KDnDMode enmMode)
790{
791 return uisession()->setDnDMode(enmMode);
792}
793
794bool UIMachine::acquireAmountOfStorageDevices(ulong &cHardDisks, ulong &cOpticalDrives, ulong &cFloppyDrives)
795{
796 return uisession()->acquireAmountOfStorageDevices(cHardDisks, cOpticalDrives, cFloppyDrives);
797}
798
799bool UIMachine::storageDevices(KDeviceType enmDeviceType, QList<StorageDeviceInfo> &guiStorageDevices)
800{
801 return uisession()->storageDevices(enmDeviceType, guiStorageDevices);
802}
803
804bool UIMachine::acquireEncryptedMedia(EncryptedMediumMap &media)
805{
806 return uisession()->acquireEncryptedMedia(media);
807}
808
809bool UIMachine::addEncryptionPassword(const QString &strId, const QString &strPassword, bool fClearOnSuspend)
810{
811 return uisession()->addEncryptionPassword(strId, strPassword, fClearOnSuspend);
812}
813
814bool UIMachine::acquireAmountOfImmutableImages(ulong &cAmount)
815{
816 return uisession()->acquireAmountOfImmutableImages(cAmount);
817}
818
819bool UIMachine::mountBootMedium(const QUuid &uMediumId)
820{
821 return uisession()->mountBootMedium(uMediumId);
822}
823
824void UIMachine::prepareStorageMenu(QMenu *pMenu,
825 QObject *pListener, const char *pszSlotName,
826 const QString &strControllerName, const StorageSlot &storageSlot)
827{
828 return uisession()->prepareStorageMenu(pMenu,
829 pListener, pszSlotName,
830 strControllerName, storageSlot);
831}
832
833void UIMachine::updateMachineStorage(const UIMediumTarget &target, UIActionPool *pActionPool)
834{
835 return uisession()->updateMachineStorage(target, pActionPool);
836}
837
838void UIMachine::acquireWhetherUSBControllerEnabled(bool &fEnabled)
839{
840 return uisession()->acquireWhetherUSBControllerEnabled(fEnabled);
841}
842
843void UIMachine::acquireWhetherVideoInputDevicesEnabled(bool &fEnabled)
844{
845 return uisession()->acquireWhetherVideoInputDevicesEnabled(fEnabled);
846}
847
848bool UIMachine::usbDevices(QList<USBDeviceInfo> &guiUSBDevices)
849{
850 return uisession()->usbDevices(guiUSBDevices);
851}
852
853bool UIMachine::attachUSBDevice(const QUuid &uId)
854{
855 return uisession()->attachUSBDevice(uId);
856}
857
858bool UIMachine::detachUSBDevice(const QUuid &uId)
859{
860 return uisession()->detachUSBDevice(uId);
861}
862
863bool UIMachine::webcamDevices(QList<WebcamDeviceInfo> &guiWebcamDevices)
864{
865 return uisession()->webcamDevices(guiWebcamDevices);
866}
867
868bool UIMachine::webcamAttach(const QString &strPath, const QString &strName)
869{
870 return uisession()->webcamAttach(strPath, strName);
871}
872
873bool UIMachine::webcamDetach(const QString &strPath, const QString &strName)
874{
875 return uisession()->webcamDetach(strPath, strName);
876}
877
878bool UIMachine::acquireWhetherNetworkAdapterEnabled(ulong uSlot, bool &fEnabled)
879{
880 return uisession()->acquireWhetherNetworkAdapterEnabled(uSlot, fEnabled);
881}
882
883bool UIMachine::acquireWhetherAtLeastOneNetworkAdapterEnabled(bool &fEnabled)
884{
885 return uisession()->acquireWhetherAtLeastOneNetworkAdapterEnabled(fEnabled);
886}
887
888bool UIMachine::acquireWhetherNetworkCableConnected(ulong uSlot, bool &fConnected)
889{
890 return uisession()->acquireWhetherNetworkCableConnected(uSlot, fConnected);
891}
892
893bool UIMachine::setNetworkCableConnected(ulong uSlot, bool fConnected)
894{
895 return uisession()->setNetworkCableConnected(uSlot, fConnected);
896}
897
898bool UIMachine::acquireDeviceActivity(const QVector<KDeviceType> &deviceTypes, QVector<KDeviceActivity> &states)
899{
900 return uisession()->acquireDeviceActivity(deviceTypes, states);
901}
902
903void UIMachine::acquireHardDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent)
904{
905 uisession()->acquireHardDiskStatusInfo(strInfo, fAttachmentsPresent);
906}
907
908void UIMachine::acquireOpticalDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted)
909{
910 uisession()->acquireOpticalDiskStatusInfo(strInfo, fAttachmentsPresent, fAttachmentsMounted);
911}
912
913void UIMachine::acquireFloppyDiskStatusInfo(QString &strInfo, bool &fAttachmentsPresent, bool &fAttachmentsMounted)
914{
915 uisession()->acquireFloppyDiskStatusInfo(strInfo, fAttachmentsPresent, fAttachmentsMounted);
916}
917
918void UIMachine::acquireAudioStatusInfo(QString &strInfo, bool &fAudioEnabled, bool &fEnabledOutput, bool &fEnabledInput)
919{
920 uisession()->acquireAudioStatusInfo(strInfo, fAudioEnabled, fEnabledOutput, fEnabledInput);
921}
922
923void UIMachine::acquireNetworkStatusInfo(QString &strInfo, bool &fAdaptersPresent, bool &fCablesDisconnected)
924{
925 uisession()->acquireNetworkStatusInfo(strInfo, fAdaptersPresent, fCablesDisconnected);
926}
927
928void UIMachine::acquireUsbStatusInfo(QString &strInfo, bool &fUsbEnableds)
929{
930 uisession()->acquireUsbStatusInfo(strInfo, fUsbEnableds);
931}
932
933void UIMachine::acquireSharedFoldersStatusInfo(QString &strInfo, bool &fFoldersPresent)
934{
935 uisession()->acquireSharedFoldersStatusInfo(strInfo, fFoldersPresent);
936}
937
938void UIMachine::acquireDisplayStatusInfo(QString &strInfo, bool &fAcceleration3D)
939{
940 uisession()->acquireDisplayStatusInfo(strInfo, fAcceleration3D);
941}
942
943void UIMachine::acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused)
944{
945 uisession()->acquireRecordingStatusInfo(strInfo, fRecordingEnabled, fMachinePaused);
946}
947
948void UIMachine::acquireFeaturesStatusInfo(QString &strInfo, KVMExecutionEngine &enmEngine)
949{
950 enmEngine = vmExecutionEngine();
951 uisession()->acquireFeaturesStatusInfo(strInfo, enmEngine,
952 isHWVirtExNestedPagingEnabled(),
953 isHWVirtExUXEnabled(),
954 paravirtProvider());
955}
956
957void UIMachine::generateMachineInformationGeneral(const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions,
958 UITextTable &returnTable)
959{
960 uisession()->generateMachineInformationGeneral(fOptions, returnTable);
961}
962
963void UIMachine::generateMachineInformationSystem(const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions,
964 UITextTable &returnTable)
965{
966 uisession()->generateMachineInformationSystem(fOptions, returnTable);
967}
968
969void UIMachine::generateMachineInformationDisplay(const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions,
970 UITextTable &returnTable)
971{
972 uisession()->generateMachineInformationDisplay(fOptions, returnTable);
973}
974
975void UIMachine::generateMachineInformationStorage(const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions,
976 UITextTable &returnTable)
977{
978 uisession()->generateMachineInformationStorage(fOptions, returnTable);
979}
980
981void UIMachine::generateMachineInformationAudio(const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions,
982 UITextTable &returnTable)
983{
984 uisession()->generateMachineInformationAudio(fOptions, returnTable);
985}
986
987void UIMachine::generateMachineInformationNetwork(const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions,
988 UITextTable &returnTable)
989{
990 uisession()->generateMachineInformationNetwork(fOptions, returnTable);
991}
992
993void UIMachine::generateMachineInformationSerial(const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions,
994 UITextTable &returnTable)
995{
996 uisession()->generateMachineInformationSerial(fOptions, returnTable);
997}
998
999void UIMachine::generateMachineInformationUSB(const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions,
1000 UITextTable &returnTable)
1001{
1002 uisession()->generateMachineInformationUSB(fOptions, returnTable);
1003}
1004
1005void UIMachine::generateMachineInformationSharedFolders(const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions,
1006 UITextTable &returnTable)
1007{
1008 uisession()->generateMachineInformationSharedFolders(fOptions, returnTable);
1009}
1010
1011bool UIMachine::setLogEnabled(bool fEnabled)
1012{
1013 return uisession()->setLogEnabled(fEnabled);
1014}
1015
1016bool UIMachine::acquireWhetherLogEnabled(bool &fEnabled)
1017{
1018 return uisession()->acquireWhetherLogEnabled(fEnabled);
1019}
1020
1021bool UIMachine::acquireLogFolder(QString &strFolder)
1022{
1023 return uisession()->acquireLogFolder(strFolder);
1024}
1025
1026bool UIMachine::acquireEffectiveCPULoad(ulong &uLoad)
1027{
1028 return uisession()->acquireEffectiveCPULoad(uLoad);
1029}
1030
1031bool UIMachine::acquireUptime(LONG64 &iUpTime)
1032{
1033 return uisession()->acquireUptime(iUpTime);
1034}
1035
1036#ifdef VBOX_WITH_DEBUGGER_GUI
1037bool UIMachine::dbgCreated(void *pActionDebug)
1038{
1039 return uisession()->dbgCreated(pActionDebug);
1040}
1041
1042void UIMachine::dbgDestroy()
1043{
1044 return uisession()->dbgDestroy();
1045}
1046
1047void UIMachine::dbgShowStatistics()
1048{
1049 return uisession()->dbgShowStatistics();
1050}
1051
1052void UIMachine::dbgShowCommandLine()
1053{
1054 return uisession()->dbgShowCommandLine();
1055}
1056
1057void UIMachine::dbgAdjustRelativePos()
1058{
1059 return uisession()->dbgAdjustRelativePos();
1060}
1061#endif /* VBOX_WITH_DEBUGGER_GUI */
1062
1063bool UIMachine::acquireWhetherGuestEnteredACPIMode(bool &fEntered)
1064{
1065 return uisession()->acquireWhetherGuestEnteredACPIMode(fEntered);
1066}
1067
1068void UIMachine::detachUi()
1069{
1070 /* Manually close Runtime UI: */
1071 LogRel(("GUI: Detaching UI..\n"));
1072 closeRuntimeUI();
1073}
1074
1075void UIMachine::saveState()
1076{
1077 uisession()->saveState();
1078}
1079
1080void UIMachine::shutdown()
1081{
1082 uisession()->shutdown();
1083}
1084
1085void UIMachine::powerOff(bool fIncludingDiscard)
1086{
1087 uisession()->powerOff(fIncludingDiscard);
1088}
1089
1090void UIMachine::sltInstallGuestAdditionsFrom(const QString &strSource)
1091{
1092 uisession()->sltInstallGuestAdditionsFrom(strSource);
1093}
1094
1095void UIMachine::sltMountDVDAdHoc(const QString &strSource)
1096{
1097 uisession()->sltMountDVDAdHoc(strSource);
1098}
1099
1100void UIMachine::sltClipboardError(QString strId, QString strMsg, long rcError)
1101{
1102 UINotificationMessage::showClipboardError(strId, strMsg, rcError);
1103}
1104
1105void UIMachine::closeRuntimeUI()
1106{
1107 /* First, we have to hide any opened modal/popup widgets.
1108 * They then should unlock their event-loops asynchronously.
1109 * If all such loops are unlocked, we can close Runtime UI. */
1110 QWidget *pWidget = QApplication::activeModalWidget()
1111 ? QApplication::activeModalWidget()
1112 : QApplication::activePopupWidget()
1113 ? QApplication::activePopupWidget()
1114 : 0;
1115 if (pWidget)
1116 {
1117 /* First we should try to close this widget: */
1118 pWidget->close();
1119 /* If widget rejected the 'close-event' we can
1120 * still hide it and hope it will behave correctly
1121 * and unlock his event-loop if any: */
1122 if (!pWidget->isHidden())
1123 pWidget->hide();
1124 /* Asynchronously restart this slot: */
1125 QMetaObject::invokeMethod(this, "closeRuntimeUI", Qt::QueuedConnection);
1126 return;
1127 }
1128
1129 /* Asynchronously ask QApplication to quit: */
1130 LogRel(("GUI: Request for async QApp quit.\n"));
1131 m_fQuitRequested = true;
1132 QMetaObject::invokeMethod(qApp, "quit", Qt::QueuedConnection);
1133}
1134
1135void UIMachine::sltChangeVisualState(UIVisualStateType visualState)
1136{
1137 /* Create new machine-logic: */
1138 UIMachineLogic *pMachineLogic = UIMachineLogic::create(this, visualState);
1139
1140 /* First we have to check if the selected machine-logic is available at all.
1141 * Only then we delete the old machine-logic and switch to the new one. */
1142 if (pMachineLogic->checkAvailability())
1143 {
1144 /* Delete previous machine-logic if any: */
1145 UIMachineLogic::destroy(m_pMachineLogic);
1146
1147 /* Set the new machine-logic as current one: */
1148 m_pMachineLogic = pMachineLogic;
1149 m_pMachineLogic->prepare();
1150
1151 /* Remember new visual state: */
1152 m_enmVisualState = visualState;
1153
1154 /* Save requested visual state: */
1155 gEDataManager->setRequestedVisualState(m_enmVisualState, uiCommon().managedVMUuid());
1156 }
1157 else
1158 {
1159 /* Delete temporary created machine-logic: */
1160 UIMachineLogic::destroy(pMachineLogic);
1161 }
1162
1163 /* Make sure machine-logic exists: */
1164 if (!m_pMachineLogic)
1165 {
1166 /* Reset initial visual state to normal: */
1167 m_enmInitialVisualState = UIVisualStateType_Normal;
1168 /* Enter initial visual state again: */
1169 enterInitialVisualState();
1170 }
1171}
1172
1173void UIMachine::sltHandleAdditionsActualChange()
1174{
1175 updateStateAdditionsActions();
1176 emit sigAdditionsStateChange();
1177}
1178
1179void UIMachine::sltHandleAudioAdapterChange()
1180{
1181 updateStateAudioActions();
1182 emit sigAudioAdapterChange();
1183}
1184
1185void UIMachine::sltHandleRecordingChange()
1186{
1187 updateStateRecordingAction();
1188 emit sigRecordingChange();
1189}
1190
1191void UIMachine::sltHandleStorageDeviceChange(const CMediumAttachment &comAttachment, bool fRemoved, bool fSilent)
1192{
1193 updateActionRestrictions();
1194 emit sigStorageDeviceChange(comAttachment, fRemoved, fSilent);
1195}
1196
1197void UIMachine::sltHandleVRDEChange()
1198{
1199 updateStateVRDEServerAction();
1200 emit sigVRDEChange();
1201}
1202
1203#ifdef VBOX_WS_MAC
1204void UIMachine::sltHandleMenuBarConfigurationChange(const QUuid &uMachineID)
1205{
1206 /* Skip unrelated machine IDs: */
1207 if (uiCommon().managedVMUuid() != uMachineID)
1208 return;
1209
1210 /* Update Mac OS X menu-bar: */
1211 updateMenu();
1212}
1213#endif /* VBOX_WS_MAC */
1214
1215void UIMachine::sltHandleHostScreenCountChange()
1216{
1217 LogRelFlow(("GUI: UIMachine: Host-screen count changed.\n"));
1218
1219 /* Recache display data: */
1220 updateHostScreenData();
1221
1222 /* Notify current machine-logic: */
1223 emit sigHostScreenCountChange();
1224}
1225
1226void UIMachine::sltHandleHostScreenGeometryChange()
1227{
1228 LogRelFlow(("GUI: UIMachine: Host-screen geometry changed.\n"));
1229
1230 /* Recache display data: */
1231 updateHostScreenData();
1232
1233 /* Notify current machine-logic: */
1234 emit sigHostScreenGeometryChange();
1235}
1236
1237void UIMachine::sltHandleHostScreenAvailableAreaChange()
1238{
1239 LogRelFlow(("GUI: UIMachine: Host-screen available-area changed.\n"));
1240
1241 /* Notify current machine-logic: */
1242 emit sigHostScreenAvailableAreaChange();
1243}
1244
1245#ifdef VBOX_WS_MAC
1246void UIMachine::sltHandleHostDisplayAboutToChange()
1247{
1248 LogRelFlow(("GUI: UIMachine::sltHandleHostDisplayAboutToChange()\n"));
1249
1250 if (m_pWatchdogDisplayChange->isActive())
1251 m_pWatchdogDisplayChange->stop();
1252 m_pWatchdogDisplayChange->setProperty("tryNumber", 1);
1253 m_pWatchdogDisplayChange->start();
1254}
1255
1256void UIMachine::sltCheckIfHostDisplayChanged()
1257{
1258 LogRelFlow(("GUI: UIMachine::sltCheckIfHostDisplayChanged()\n"));
1259
1260 /* Check if display count changed: */
1261 if (UIDesktopWidgetWatchdog::screenCount() != m_hostScreens.size())
1262 {
1263 /* Reset watchdog: */
1264 m_pWatchdogDisplayChange->setProperty("tryNumber", 0);
1265 /* Notify listeners about screen-count changed: */
1266 return sltHandleHostScreenCountChange();
1267 }
1268 else
1269 {
1270 /* Check if at least one display geometry changed: */
1271 for (int iScreenIndex = 0; iScreenIndex < UIDesktopWidgetWatchdog::screenCount(); ++iScreenIndex)
1272 {
1273 if (gpDesktop->screenGeometry(iScreenIndex) != m_hostScreens.at(iScreenIndex))
1274 {
1275 /* Reset watchdog: */
1276 m_pWatchdogDisplayChange->setProperty("tryNumber", 0);
1277 /* Notify listeners about screen-geometry changed: */
1278 return sltHandleHostScreenGeometryChange();
1279 }
1280 }
1281 }
1282
1283 /* Check if watchdog expired, restart if not: */
1284 int cTryNumber = m_pWatchdogDisplayChange->property("tryNumber").toInt();
1285 if (cTryNumber > 0 && cTryNumber < 40)
1286 {
1287 /* Restart watchdog again: */
1288 m_pWatchdogDisplayChange->setProperty("tryNumber", ++cTryNumber);
1289 m_pWatchdogDisplayChange->start();
1290 }
1291 else
1292 {
1293 /* Reset watchdog: */
1294 m_pWatchdogDisplayChange->setProperty("tryNumber", 0);
1295 }
1296}
1297#endif /* VBOX_WS_MAC */
1298
1299void UIMachine::sltHandleGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
1300{
1301 /* Ignore KGuestMonitorChangedEventType_NewOrigin change event: */
1302 if (changeType == KGuestMonitorChangedEventType_NewOrigin)
1303 return;
1304 /* Ignore KGuestMonitorChangedEventType_Disabled event for primary screen: */
1305 AssertMsg(countOfVisibleWindows() > 0, ("All machine windows are hidden!"));
1306 if (changeType == KGuestMonitorChangedEventType_Disabled && uScreenId == 0)
1307 return;
1308
1309 /* Process KGuestMonitorChangedEventType_Enabled change event: */
1310 if ( !isScreenVisible(uScreenId)
1311 && changeType == KGuestMonitorChangedEventType_Enabled)
1312 setScreenVisible(uScreenId, true);
1313 /* Process KGuestMonitorChangedEventType_Disabled change event: */
1314 else if ( isScreenVisible(uScreenId)
1315 && changeType == KGuestMonitorChangedEventType_Disabled)
1316 setScreenVisible(uScreenId, false);
1317
1318 /* Notify listeners about the change: */
1319 emit sigGuestMonitorChange(changeType, uScreenId, screenGeo);
1320}
1321
1322void UIMachine::sltHandleKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock)
1323{
1324 /* Check if something had changed: */
1325 if ( m_fNumLock != fNumLock
1326 || m_fCapsLock != fCapsLock
1327 || m_fScrollLock != fScrollLock)
1328 {
1329 /* Store new num lock data: */
1330 if (m_fNumLock != fNumLock)
1331 {
1332 m_fNumLock = fNumLock;
1333 m_uNumLockAdaptionCnt = 2;
1334 }
1335
1336 /* Store new caps lock data: */
1337 if (m_fCapsLock != fCapsLock)
1338 {
1339 m_fCapsLock = fCapsLock;
1340 m_uCapsLockAdaptionCnt = 2;
1341 }
1342
1343 /* Store new scroll lock data: */
1344 if (m_fScrollLock != fScrollLock)
1345 {
1346 m_fScrollLock = fScrollLock;
1347 }
1348
1349 /* Notify listeners: */
1350 emit sigKeyboardLedsChange();
1351 }
1352}
1353
1354void UIMachine::sltMousePointerShapeChange(const UIMousePointerShapeData &shapeData)
1355{
1356 LogRelFlow(("GUI: UIMachine::sltMousePointerShapeChange: "
1357 "Is visible: %s, Has alpha: %s, "
1358 "Hot spot: %dx%d, Shape size: %dx%d, "
1359 "Shape data: %s\n",
1360 shapeData.isVisible() ? "TRUE" : "FALSE",
1361 shapeData.hasAlpha() ? "TRUE" : "FALSE",
1362 shapeData.hotSpot().x(), shapeData.hotSpot().y(),
1363 shapeData.shapeSize().width(), shapeData.shapeSize().height(),
1364 shapeData.shape().isEmpty() ? "EMPTY" : "PRESENT"));
1365
1366 /* In case if shape itself is present: */
1367 if (shapeData.shape().size() > 0)
1368 {
1369 /* We are ignoring visibility flag: */
1370 m_fIsHidingHostPointer = false;
1371
1372 /* And updating current shape data: */
1373 m_shapeData = shapeData;
1374 updateMousePointerShape();
1375 }
1376 /* In case if shape itself is NOT present: */
1377 else
1378 {
1379 /* Remember if we should hide the cursor: */
1380 m_fIsHidingHostPointer = !shapeData.isVisible();
1381 }
1382
1383 /* Notify listeners: */
1384 emit sigMousePointerShapeChange();
1385}
1386
1387void UIMachine::sltMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative,
1388 bool fSupportsTouchScreen, bool fSupportsTouchPad,
1389 bool fNeedsHostCursor)
1390{
1391 LogRelFlow(("GUI: UIMachine::sltMouseCapabilityChange: "
1392 "Supports absolute: %s, Supports relative: %s, "
1393 "Supports touchscreen: %s, Supports touchpad: %s, "
1394 "Needs host cursor: %s\n",
1395 fSupportsAbsolute ? "TRUE" : "FALSE", fSupportsRelative ? "TRUE" : "FALSE",
1396 fSupportsTouchScreen ? "TRUE" : "FALSE", fSupportsTouchPad ? "TRUE" : "FALSE",
1397 fNeedsHostCursor ? "TRUE" : "FALSE"));
1398
1399 /* Check if something had changed: */
1400 if ( m_fIsMouseSupportsAbsolute != fSupportsAbsolute
1401 || m_fIsMouseSupportsRelative != fSupportsRelative
1402 || m_fIsMouseSupportsTouchScreen != fSupportsTouchScreen
1403 || m_fIsMouseSupportsTouchPad != fSupportsTouchPad
1404 || m_fIsMouseHostCursorNeeded != fNeedsHostCursor)
1405 {
1406 /* Store new data: */
1407 m_fIsMouseSupportsAbsolute = fSupportsAbsolute;
1408 m_fIsMouseSupportsRelative = fSupportsRelative;
1409 m_fIsMouseSupportsTouchScreen = fSupportsTouchScreen;
1410 m_fIsMouseSupportsTouchPad = fSupportsTouchPad;
1411 m_fIsMouseHostCursorNeeded = fNeedsHostCursor;
1412
1413 /* Notify listeners: */
1414 emit sigMouseCapabilityChange();
1415 }
1416}
1417
1418void UIMachine::sltCursorPositionChange(bool fContainsData, unsigned long uX, unsigned long uY)
1419{
1420 LogRelFlow(("GUI: UIMachine::sltCursorPositionChange: "
1421 "Cursor position valid: %d, Cursor position: %dx%d\n",
1422 fContainsData ? "TRUE" : "FALSE", uX, uY));
1423
1424 /* Check if something had changed: */
1425 if ( m_fIsValidCursorPositionPresent != fContainsData
1426 || m_cursorPosition.x() != (int)uX
1427 || m_cursorPosition.y() != (int)uY)
1428 {
1429 /* Store new data: */
1430 m_fIsValidCursorPositionPresent = fContainsData;
1431 m_cursorPosition = QPoint(uX, uY);
1432
1433 /* Notify listeners: */
1434 emit sigCursorPositionChange();
1435 }
1436}
1437
1438UIMachine::UIMachine()
1439 : QObject(0)
1440 , m_fInitialized(false)
1441 , m_pSession(0)
1442 , m_enmAllowedVisualStates(UIVisualStateType_Invalid)
1443 , m_enmInitialVisualState(UIVisualStateType_Normal)
1444 , m_enmVisualState(UIVisualStateType_Invalid)
1445 , m_enmRequestedVisualState(UIVisualStateType_Invalid)
1446 , m_pMachineLogic(0)
1447 , m_pMachineWindowIcon(0)
1448 , m_pActionPool(0)
1449#ifdef VBOX_WS_MAC
1450 , m_pMenuBar(0)
1451#endif
1452#ifdef VBOX_WS_MAC
1453 , m_pWatchdogDisplayChange(0)
1454#endif
1455 , m_fIsGuestResizeIgnored(false)
1456 , m_fNumLock(false)
1457 , m_fCapsLock(false)
1458 , m_fScrollLock(false)
1459 , m_uNumLockAdaptionCnt(2)
1460 , m_uCapsLockAdaptionCnt(2)
1461 , m_fIsHidLedsSyncEnabled(false)
1462 , m_fIsAutoCaptureDisabled(false)
1463 , m_iKeyboardState(0)
1464 , m_fIsHidingHostPointer(true)
1465 , m_fIsValidPointerShapePresent(false)
1466 , m_fIsValidCursorPositionPresent(false)
1467 , m_fIsMouseSupportsAbsolute(false)
1468 , m_fIsMouseSupportsRelative(false)
1469 , m_fIsMouseSupportsTouchScreen(false)
1470 , m_fIsMouseSupportsTouchPad(false)
1471 , m_fIsMouseHostCursorNeeded(false)
1472 , m_fIsMouseCaptured(false)
1473 , m_fIsMouseIntegrated(true)
1474 , m_iMouseState(0)
1475 , m_enmVMExecutionEngine(KVMExecutionEngine_NotSet)
1476 , m_fIsHWVirtExNestedPagingEnabled(false)
1477 , m_fIsHWVirtExUXEnabled(false)
1478 , m_enmParavirtProvider(KParavirtProvider_None)
1479 , m_fIsManualOverride(false)
1480 , m_defaultCloseAction(MachineCloseAction_Invalid)
1481 , m_restrictedCloseActions(MachineCloseAction_Invalid)
1482 , m_fQuitRequested(false)
1483{
1484 s_pInstance = this;
1485}
1486
1487UIMachine::~UIMachine()
1488{
1489 s_pInstance = 0;
1490}
1491
1492bool UIMachine::prepare()
1493{
1494 /* Prepare stuff unrelated to VM: */
1495 prepareNotificationCenter();
1496
1497 /* Prepare VM session: */
1498 if (!prepareSession())
1499 return false;
1500
1501 /* Prepare VM related stuff: */
1502 prepareActions();
1503 prepareHostScreenData();
1504 prepareKeyboard();
1505 prepareClose();
1506 prepareVisualState();
1507
1508 /* Update VM related stuff: */
1509 updateBranding();
1510 updateGuestScreenData();
1511 enterInitialVisualState();
1512
1513 /* Try to initialize VM session: */
1514 if (!uisession()->initialize())
1515 return false;
1516
1517 /* Update stuff which doesn't send events on init: */
1518 updateVirtualizationState();
1519 updateStateAudioActions();
1520 updateMouseState();
1521
1522 /* Warn listeners about we are initialized: */
1523 m_fInitialized = true;
1524 emit sigInitialized();
1525
1526 /* True by default: */
1527 return true;
1528}
1529
1530void UIMachine::prepareNotificationCenter()
1531{
1532 UINotificationCenter::create();
1533}
1534
1535bool UIMachine::prepareSession()
1536{
1537 /* Create session UI: */
1538 m_pSession = new UISession(this);
1539 AssertPtrReturn(uisession(), false);
1540
1541 /* Console events stuff: */
1542 connect(uisession(), &UISession::sigAudioAdapterChange,
1543 this, &UIMachine::sltHandleAudioAdapterChange);
1544 connect(uisession(), &UISession::sigAdditionsStateChange,
1545 this, &UIMachine::sigAdditionsStateChange);
1546 connect(uisession(), &UISession::sigAdditionsStateActualChange,
1547 this, &UIMachine::sltHandleAdditionsActualChange);
1548 connect(uisession(), &UISession::sigClipboardModeChange,
1549 this, &UIMachine::sigClipboardModeChange);
1550 connect(uisession(), &UISession::sigClipboardError,
1551 this, &UIMachine::sltClipboardError);
1552 connect(uisession(), &UISession::sigCPUExecutionCapChange,
1553 this, &UIMachine::sigCPUExecutionCapChange);
1554 connect(uisession(), &UISession::sigDnDModeChange,
1555 this, &UIMachine::sigDnDModeChange);
1556 connect(uisession(), &UISession::sigGuestMonitorChange,
1557 this, &UIMachine::sltHandleGuestMonitorChange);
1558 connect(uisession(), &UISession::sigMachineStateChange,
1559 this, &UIMachine::sigMachineStateChange);
1560 connect(uisession(), &UISession::sigMediumChange,
1561 this, &UIMachine::sigMediumChange);
1562 connect(uisession(), &UISession::sigNetworkAdapterChange,
1563 this, &UIMachine::sigNetworkAdapterChange);
1564 connect(uisession(), &UISession::sigRecordingChange,
1565 this, &UIMachine::sltHandleRecordingChange);
1566 connect(uisession(), &UISession::sigSharedFolderChange,
1567 this, &UIMachine::sigSharedFolderChange);
1568 connect(uisession(), &UISession::sigStorageDeviceChange,
1569 this, &UIMachine::sltHandleStorageDeviceChange);
1570 connect(uisession(), &UISession::sigUSBControllerChange,
1571 this, &UIMachine::sigUSBControllerChange);
1572 connect(uisession(), &UISession::sigUSBDeviceStateChange,
1573 this, &UIMachine::sigUSBDeviceStateChange);
1574 connect(uisession(), &UISession::sigVRDEChange,
1575 this, &UIMachine::sltHandleVRDEChange);
1576 connect(uisession(), &UISession::sigRuntimeError,
1577 this, &UIMachine::sigRuntimeError);
1578#ifdef VBOX_WS_MAC
1579 connect(uisession(), &UISession::sigShowWindows,
1580 this, &UIMachine::sigShowWindows);
1581#endif
1582
1583 /* Keyboard stuff: */
1584 connect(uisession(), &UISession::sigKeyboardLedsChange,
1585 this, &UIMachine::sltHandleKeyboardLedsChange);
1586
1587 /* Mouse stuff: */
1588 connect(uisession(), &UISession::sigMousePointerShapeChange,
1589 this, &UIMachine::sltMousePointerShapeChange);
1590 connect(uisession(), &UISession::sigMouseCapabilityChange,
1591 this, &UIMachine::sltMouseCapabilityChange);
1592 connect(uisession(), &UISession::sigCursorPositionChange,
1593 this, &UIMachine::sltCursorPositionChange);
1594
1595 /* Make sure session prepared: */
1596 return uisession()->prepare();
1597}
1598
1599void UIMachine::prepareActions()
1600{
1601 /* Create action-pool: */
1602 m_pActionPool = UIActionPool::create(UIType_RuntimeUI);
1603 if (actionPool())
1604 {
1605 /* Make sure action-pool knows guest-screen count: */
1606 actionPool()->toRuntime()->setGuestScreenCount(uisession()->frameBuffers().size());
1607 /* Update action restrictions: */
1608 updateActionRestrictions();
1609
1610#ifdef VBOX_WS_MAC
1611 /* Create Mac OS X menu-bar: */
1612 m_pMenuBar = new QMenuBar;
1613 if (m_pMenuBar)
1614 {
1615 /* Configure Mac OS X menu-bar: */
1616 connect(gEDataManager, &UIExtraDataManager::sigMenuBarConfigurationChange,
1617 this, &UIMachine::sltHandleMenuBarConfigurationChange);
1618 /* Update Mac OS X menu-bar: */
1619 updateMenu();
1620 }
1621#endif /* VBOX_WS_MAC */
1622
1623 /* Get machine ID: */
1624 const QUuid uMachineID = uiCommon().managedVMUuid();
1625 Q_UNUSED(uMachineID);
1626
1627#ifdef VBOX_WS_MAC
1628 /* User-element (Menu-bar and Dock) options: */
1629 {
1630 const bool fDisabled = gEDataManager->guiFeatureEnabled(GUIFeatureType_NoUserElements);
1631 if (fDisabled)
1632 UICocoaApplication::instance()->hideUserElements();
1633 }
1634#else /* !VBOX_WS_MAC */
1635 /* Menu-bar options: */
1636 {
1637 const bool fEnabledGlobally = !gEDataManager->guiFeatureEnabled(GUIFeatureType_NoMenuBar);
1638 const bool fEnabledForMachine = gEDataManager->menuBarEnabled(uMachineID);
1639 const bool fEnabled = fEnabledGlobally && fEnabledForMachine;
1640 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)->setEnabled(fEnabled);
1641 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->blockSignals(true);
1642 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->setChecked(fEnabled);
1643 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->blockSignals(false);
1644 }
1645#endif /* !VBOX_WS_MAC */
1646
1647 /* View options: */
1648 const bool fGuestScreenAutoresize = gEDataManager->guestScreenAutoResizeEnabled(uMachineID);
1649 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->blockSignals(true);
1650 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->setChecked(fGuestScreenAutoresize);
1651 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->blockSignals(false);
1652
1653 /* Input options: */
1654 const bool fMouseIntegrated = isMouseIntegrated(); // no e-data for now ..
1655 actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->blockSignals(true);
1656 actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->setChecked(fMouseIntegrated);
1657 actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->blockSignals(false);
1658
1659 /* Device options: */
1660 actionPool()->action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions)->setEnabled(false);
1661
1662 /* Status-bar options: */
1663 {
1664 const bool fEnabledGlobally = !gEDataManager->guiFeatureEnabled(GUIFeatureType_NoStatusBar);
1665 const bool fEnabledForMachine = gEDataManager->statusBarEnabled(uMachineID);
1666 const bool fEnabled = fEnabledGlobally && fEnabledForMachine;
1667 actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)->setEnabled(fEnabled);
1668 actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->blockSignals(true);
1669 actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->setChecked(fEnabled);
1670 actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->blockSignals(false);
1671 }
1672 }
1673}
1674
1675void UIMachine::prepareHostScreenData()
1676{
1677 /* Recache display data: */
1678 updateHostScreenData();
1679
1680#ifdef VBOX_WS_MAC
1681 /* Prepare display-change watchdog: */
1682 m_pWatchdogDisplayChange = new QTimer(this);
1683 {
1684 m_pWatchdogDisplayChange->setInterval(500);
1685 m_pWatchdogDisplayChange->setSingleShot(true);
1686 connect(m_pWatchdogDisplayChange, &QTimer::timeout,
1687 this, &UIMachine::sltCheckIfHostDisplayChanged);
1688 }
1689 /* Install native display reconfiguration callback: */
1690 CGDisplayRegisterReconfigurationCallback(cgDisplayReconfigurationCallback, this);
1691#else /* !VBOX_WS_MAC */
1692 /* Install Qt display reconfiguration callbacks: */
1693 connect(gpDesktop, &UIDesktopWidgetWatchdog::sigHostScreenCountChanged,
1694 this, &UIMachine::sltHandleHostScreenCountChange);
1695 connect(gpDesktop, &UIDesktopWidgetWatchdog::sigHostScreenResized,
1696 this, &UIMachine::sltHandleHostScreenGeometryChange);
1697# if defined(VBOX_WS_NIX) && !defined(VBOX_GUI_WITH_CUSTOMIZATIONS1)
1698 connect(gpDesktop, &UIDesktopWidgetWatchdog::sigHostScreenWorkAreaRecalculated,
1699 this, &UIMachine::sltHandleHostScreenAvailableAreaChange);
1700# else /* !VBOX_WS_NIX || VBOX_GUI_WITH_CUSTOMIZATIONS1 */
1701 connect(gpDesktop, &UIDesktopWidgetWatchdog::sigHostScreenWorkAreaResized,
1702 this, &UIMachine::sltHandleHostScreenAvailableAreaChange);
1703# endif /* !VBOX_WS_NIX || VBOX_GUI_WITH_CUSTOMIZATIONS1 */
1704#endif /* !VBOX_WS_MAC */
1705}
1706
1707void UIMachine::prepareKeyboard()
1708{
1709#if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
1710 /* Load extra-data value: */
1711 m_fIsHidLedsSyncEnabled = gEDataManager->hidLedsSyncState(uiCommon().managedVMUuid());
1712 /* Connect to extra-data changes to be able to enable/disable feature dynamically: */
1713 connect(gEDataManager, &UIExtraDataManager::sigHidLedsSyncStateChange,
1714 this, &UIMachine::sltHidLedsSyncStateChanged);
1715#endif /* VBOX_WS_MAC || VBOX_WS_WIN */
1716}
1717
1718void UIMachine::prepareClose()
1719{
1720 /* What is the default close action and the restricted are? */
1721 const QUuid uMachineID = uiCommon().managedVMUuid();
1722 m_defaultCloseAction = gEDataManager->defaultMachineCloseAction(uMachineID);
1723 m_restrictedCloseActions = gEDataManager->restrictedMachineCloseActions(uMachineID);
1724}
1725
1726void UIMachine::prepareVisualState()
1727{
1728 /* Prepare async visual state type change handler: */
1729 qRegisterMetaType<UIVisualStateType>();
1730 connect(this, &UIMachine::sigRequestAsyncVisualStateChange,
1731 this, &UIMachine::sltChangeVisualState,
1732 Qt::QueuedConnection);
1733
1734 /* Load restricted visual states: */
1735 UIVisualStateType enmRestrictedVisualStates = gEDataManager->restrictedVisualStates(uiCommon().managedVMUuid());
1736 /* Acquire allowed visual states: */
1737 m_enmAllowedVisualStates = static_cast<UIVisualStateType>(UIVisualStateType_All ^ enmRestrictedVisualStates);
1738
1739 /* Load requested visual state, it can override initial one: */
1740 m_enmRequestedVisualState = gEDataManager->requestedVisualState(uiCommon().managedVMUuid());
1741 /* Check if requested visual state is allowed: */
1742 if (isVisualStateAllowed(m_enmRequestedVisualState))
1743 {
1744 switch (m_enmRequestedVisualState)
1745 {
1746 /* Direct transition allowed to scale/fullscreen modes only: */
1747 case UIVisualStateType_Scale:
1748 case UIVisualStateType_Fullscreen:
1749 m_enmInitialVisualState = m_enmRequestedVisualState;
1750 break;
1751 default:
1752 break;
1753 }
1754 }
1755}
1756
1757void UIMachine::updateBranding()
1758{
1759 /* Create the icon dynamically: */
1760 delete m_pMachineWindowIcon;
1761 m_pMachineWindowIcon = new QIcon;
1762 acquireUserMachineIcon(*m_pMachineWindowIcon);
1763
1764#ifndef VBOX_WS_MAC
1765 /* Load user's machine-window name postfix: */
1766 const QUuid uMachineID = uiCommon().managedVMUuid();
1767 m_strMachineWindowNamePostfix = gEDataManager->machineWindowNamePostfix(uMachineID);
1768#endif /* !VBOX_WS_MAC */
1769}
1770
1771void UIMachine::updateGuestScreenData()
1772{
1773 /* Accquire guest-screen count: */
1774 ulong cMonitorCount = 0;
1775 acquireMonitorCount(cMonitorCount);
1776
1777 /* Prepare initial screen visibility status: */
1778 m_guestScreenVisibilityVector.fill(false, cMonitorCount);
1779 m_guestScreenVisibilityVector[0] = true;
1780
1781 /* Prepare empty last full-screen size vector: */
1782 m_monitorLastFullScreenSizeVector.fill(QSize(-1, -1), cMonitorCount);
1783
1784 /* If machine is in 'saved' state: */
1785 if (uisession()->isSaved())
1786 {
1787 /* Update screen visibility status from saved-state: */
1788 for (int iScreenIndex = 0; iScreenIndex < m_guestScreenVisibilityVector.size(); ++iScreenIndex)
1789 {
1790 long iDummy = 0;
1791 ulong uDummy = 0;
1792 bool fEnabled = true;
1793 acquireSavedGuestScreenInfo(iScreenIndex, iDummy, iDummy, uDummy, uDummy, fEnabled);
1794 m_guestScreenVisibilityVector[iScreenIndex] = fEnabled;
1795 }
1796 /* And make sure at least one of them is visible (primary if others are hidden): */
1797 if (countOfVisibleWindows() < 1)
1798 m_guestScreenVisibilityVector[0] = true;
1799 }
1800 else if (uiCommon().isSeparateProcess())
1801 {
1802 /* Update screen visibility status from display directly: */
1803 for (int iScreenIndex = 0; iScreenIndex < m_guestScreenVisibilityVector.size(); ++iScreenIndex)
1804 {
1805 ulong uDummy = 0;
1806 long iDummy = 0;
1807 KGuestMonitorStatus enmMonitorStatus = KGuestMonitorStatus_Disabled;
1808 acquireGuestScreenParameters(iScreenIndex, uDummy, uDummy, uDummy, iDummy, iDummy, enmMonitorStatus);
1809 m_guestScreenVisibilityVector[iScreenIndex] = ( enmMonitorStatus == KGuestMonitorStatus_Enabled
1810 || enmMonitorStatus == KGuestMonitorStatus_Blank);
1811 }
1812 /* And make sure at least one of them is visible (primary if others are hidden): */
1813 if (countOfVisibleWindows() < 1)
1814 m_guestScreenVisibilityVector[0] = true;
1815 }
1816
1817 /* Prepare initial screen visibility status of host-desires (same as facts): */
1818 m_guestScreenVisibilityVectorHostDesires.resize(cMonitorCount);
1819 for (int iScreenIndex = 0; iScreenIndex < m_guestScreenVisibilityVector.size(); ++iScreenIndex)
1820 m_guestScreenVisibilityVectorHostDesires[iScreenIndex] = m_guestScreenVisibilityVector[iScreenIndex];
1821
1822 /* Make sure action-pool knows guest-screen visibility status: */
1823 for (int iScreenIndex = 0; iScreenIndex < m_guestScreenVisibilityVector.size(); ++iScreenIndex)
1824 actionPool()->toRuntime()->setGuestScreenVisible(iScreenIndex, m_guestScreenVisibilityVector.at(iScreenIndex));
1825}
1826
1827void UIMachine::enterInitialVisualState()
1828{
1829 sltChangeVisualState(m_enmInitialVisualState);
1830}
1831
1832void UIMachine::cleanupMachineLogic()
1833{
1834 /* Delete machine-logic if any: */
1835 UIMachineLogic::destroy(m_pMachineLogic);
1836}
1837
1838void UIMachine::cleanupBranding()
1839{
1840 /* Cleanup machine-window icon: */
1841 delete m_pMachineWindowIcon;
1842 m_pMachineWindowIcon = 0;
1843}
1844
1845void UIMachine::cleanupHostScreenData()
1846{
1847#ifdef VBOX_WS_MAC
1848 /* Remove display reconfiguration callback: */
1849 CGDisplayRemoveReconfigurationCallback(cgDisplayReconfigurationCallback, this);
1850#endif /* VBOX_WS_MAC */
1851}
1852
1853void UIMachine::cleanupActions()
1854{
1855#ifdef VBOX_WS_MAC
1856 /* Destroy Mac OS X menu-bar: */
1857 delete m_pMenuBar;
1858 m_pMenuBar = 0;
1859#endif /* VBOX_WS_MAC */
1860
1861 /* Destroy action-pool if necessary: */
1862 if (actionPool())
1863 UIActionPool::destroy(actionPool());
1864}
1865
1866void UIMachine::cleanupSession()
1867{
1868 /* Destroy session UI if exists: */
1869 delete m_pSession;
1870 m_pSession = 0;
1871}
1872
1873void UIMachine::cleanupNotificationCenter()
1874{
1875 UINotificationCenter::destroy();
1876}
1877
1878void UIMachine::cleanup()
1879{
1880 /* Preprocess all the meta-events: */
1881 QApplication::sendPostedEvents(0, QEvent::MetaCall);
1882
1883 /* Cleanup stuff: */
1884 cleanupMachineLogic();
1885 cleanupBranding();
1886 cleanupHostScreenData();
1887 cleanupActions();
1888 cleanupSession();
1889 cleanupNotificationCenter();
1890}
1891
1892void UIMachine::updateActionRestrictions()
1893{
1894 /* Get host and prepare restrictions: */
1895 UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionForMachine =
1896 UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid;
1897 UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionForView =
1898 UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid;
1899 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionForDevices =
1900 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid;
1901
1902 /* Separate process stuff: */
1903 {
1904 /* Initialize 'Machine' menu: */
1905 if (!uiCommon().isSeparateProcess())
1906 restrictionForMachine = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)
1907 (restrictionForMachine | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach);
1908 }
1909
1910 /* VRDE server stuff: */
1911 {
1912 /* Initialize 'View' menu: */
1913 bool fServerPresent = false;
1914 acquireWhetherVRDEServerPresent(fServerPresent);
1915 if (!fServerPresent)
1916 restrictionForView = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
1917 (restrictionForView | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer);
1918 }
1919
1920 /* Storage stuff: */
1921 {
1922 /* Initialize CD/FD menus: */
1923 ulong cHardDisks = 0;
1924 ulong iOpticalDevices = 0;
1925 ulong cFloppyDevices = 0;
1926 acquireAmountOfStorageDevices(cHardDisks, iOpticalDevices, cFloppyDevices);
1927 QAction *pOpticalDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices);
1928 QAction *pFloppyDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices);
1929 pOpticalDevicesMenu->setData((int)iOpticalDevices);
1930 pFloppyDevicesMenu->setData((int)cFloppyDevices);
1931 if (!iOpticalDevices)
1932 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
1933 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices);
1934 if (!cFloppyDevices)
1935 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
1936 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices);
1937 }
1938
1939 /* Audio stuff: */
1940 {
1941 /* Do we need to restrict something? */
1942 bool fRestricted = false;
1943 /* Check whether audio adapter is present: */
1944 bool fAdapterPresent = false;
1945 acquireWhetherAudioAdapterPresent(fAdapterPresent);
1946 if (!fAdapterPresent)
1947 fRestricted = true;
1948 else
1949 {
1950 /* Check whether audio adapter is enabled: */
1951 bool fAdapterEnabled = false;
1952 acquireWhetherAudioAdapterEnabled(fAdapterEnabled);
1953 if (!fAdapterEnabled)
1954 fRestricted = true;
1955 }
1956 /* Apply restrictions: */
1957 if (fRestricted)
1958 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
1959 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio);
1960 }
1961
1962 /* Network stuff: */
1963 {
1964 /* Initialize Network menu: */
1965 bool fAtLeastOneAdapterEnabled = false;
1966 acquireWhetherAtLeastOneNetworkAdapterEnabled(fAtLeastOneAdapterEnabled);
1967 if (!fAtLeastOneAdapterEnabled)
1968 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
1969 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network);
1970 }
1971
1972 /* USB stuff: */
1973 {
1974 /* Check whether there is at least one USB controller with an available proxy. */
1975 bool fUSBEnabled = false;
1976 acquireWhetherUSBControllerEnabled(fUSBEnabled);
1977 if (!fUSBEnabled)
1978 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
1979 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);
1980 }
1981
1982 /* WebCams stuff: */
1983 {
1984 /* Check whether there is an accessible video input devices pool: */
1985 bool fWebCamsEnabled = false;
1986 acquireWhetherVideoInputDevicesEnabled(fWebCamsEnabled);
1987 if (!fWebCamsEnabled)
1988 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
1989 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);
1990 }
1991
1992 /* Apply cumulative restriction for 'Machine' menu: */
1993 actionPool()->toRuntime()->setRestrictionForMenuMachine(UIActionRestrictionLevel_Session, restrictionForMachine);
1994 /* Apply cumulative restriction for 'View' menu: */
1995 actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Session, restrictionForView);
1996 /* Apply cumulative restriction for 'Devices' menu: */
1997 actionPool()->toRuntime()->setRestrictionForMenuDevices(UIActionRestrictionLevel_Session, restrictionForDevices);
1998}
1999
2000#ifdef VBOX_WS_MAC
2001void UIMachine::updateMenu()
2002{
2003 /* Rebuild Mac OS X menu-bar: */
2004 m_pMenuBar->clear();
2005 foreach (QMenu *pMenu, actionPool()->menus())
2006 {
2007 UIMenu *pMenuUI = qobject_cast<UIMenu*>(pMenu);
2008 if (!pMenuUI->isConsumable() || !pMenuUI->isConsumed())
2009 m_pMenuBar->addMenu(pMenuUI);
2010 if (pMenuUI->isConsumable() && !pMenuUI->isConsumed())
2011 pMenuUI->setConsumed(true);
2012 }
2013 /* Update the dock menu as well: */
2014 if (machineLogic())
2015 machineLogic()->updateDock();
2016}
2017#endif /* VBOX_WS_MAC */
2018
2019void UIMachine::updateHostScreenData()
2020{
2021 /* Rebuild host-screen data vector: */
2022 m_hostScreens.clear();
2023 for (int iScreenIndex = 0; iScreenIndex < UIDesktopWidgetWatchdog::screenCount(); ++iScreenIndex)
2024 m_hostScreens << gpDesktop->screenGeometry(iScreenIndex);
2025
2026 /* Make sure action-pool knows host-screen count: */
2027 actionPool()->toRuntime()->setHostScreenCount(m_hostScreens.size());
2028}
2029
2030void UIMachine::updateMousePointerShape()
2031{
2032 /* Fetch incoming shape data: */
2033 const bool fHasAlpha = m_shapeData.hasAlpha();
2034 const uint uWidth = m_shapeData.shapeSize().width();
2035 const uint uHeight = m_shapeData.shapeSize().height();
2036 const uchar *pShapeData = m_shapeData.shape().constData();
2037 AssertMsgReturnVoid(pShapeData, ("Shape data must not be NULL!\n"));
2038
2039 /* Invalidate mouse pointer shape initially: */
2040 m_fIsValidPointerShapePresent = false;
2041 m_cursorShapePixmap = QPixmap();
2042 m_cursorMaskPixmap = QPixmap();
2043
2044 /* Parse incoming shape data: */
2045 const uchar *pSrcAndMaskPtr = pShapeData;
2046 const uint uAndMaskSize = (uWidth + 7) / 8 * uHeight;
2047 const uchar *pSrcShapePtr = pShapeData + ((uAndMaskSize + 3) & ~3);
2048
2049#if defined (VBOX_WS_WIN)
2050
2051 /* Create an ARGB image out of the shape data: */
2052
2053 // WORKAROUND:
2054 // Qt5 QCursor recommends 32 x 32 cursor, therefore the original data is copied to
2055 // a larger QImage if necessary. Cursors like 10x16 did not work correctly (Solaris 10 guest).
2056 // Align the cursor dimensions to 32 bit pixels, because for example a 56x56 monochrome cursor
2057 // did not work correctly on Windows host.
2058 const uint uCursorWidth = RT_ALIGN_32(uWidth, 32);
2059 const uint uCursorHeight = RT_ALIGN_32(uHeight, 32);
2060
2061 if (fHasAlpha)
2062 {
2063 QImage image(uCursorWidth, uCursorHeight, QImage::Format_ARGB32);
2064 memset(image.bits(), 0, image.sizeInBytes());
2065
2066 const uint32_t *pu32SrcShapeScanline = (uint32_t *)pSrcShapePtr;
2067 for (uint y = 0; y < uHeight; ++y, pu32SrcShapeScanline += uWidth)
2068 memcpy(image.scanLine(y), pu32SrcShapeScanline, uWidth * sizeof(uint32_t));
2069
2070 m_cursorShapePixmap = QPixmap::fromImage(image);
2071 }
2072 else
2073 {
2074 if (isPointer1bpp(pSrcShapePtr, uWidth, uHeight))
2075 {
2076 // Incoming data consist of 32 bit BGR XOR mask and 1 bit AND mask.
2077 // XOR pixels contain either 0x00000000 or 0x00FFFFFF.
2078 //
2079 // Originally intended result (F denotes 0x00FFFFFF):
2080 // XOR AND
2081 // 0 0 black
2082 // F 0 white
2083 // 0 1 transparent
2084 // F 1 xor'd
2085 //
2086 // Actual Qt5 result for color table 0:0xFF000000, 1:0xFFFFFFFF
2087 // (tested on Windows 7 and 10 64 bit hosts):
2088 // Bitmap Mask
2089 // 0 0 black
2090 // 1 0 white
2091 // 0 1 xor
2092 // 1 1 transparent
2093
2094 QVector<QRgb> colors(2);
2095 colors[0] = UINT32_C(0xFF000000);
2096 colors[1] = UINT32_C(0xFFFFFFFF);
2097
2098 QImage bitmap(uCursorWidth, uCursorHeight, QImage::Format_Mono);
2099 bitmap.setColorTable(colors);
2100 memset(bitmap.bits(), 0xFF, bitmap.sizeInBytes());
2101
2102 QImage mask(uCursorWidth, uCursorHeight, QImage::Format_Mono);
2103 mask.setColorTable(colors);
2104 memset(mask.bits(), 0xFF, mask.sizeInBytes());
2105
2106 const uint8_t *pu8SrcAndScanline = pSrcAndMaskPtr;
2107 const uint32_t *pu32SrcShapeScanline = (uint32_t *)pSrcShapePtr;
2108 for (uint y = 0; y < uHeight; ++y)
2109 {
2110 for (uint x = 0; x < uWidth; ++x)
2111 {
2112 const uint8_t u8Bit = (uint8_t)(1 << (7 - x % 8));
2113
2114 const uint8_t u8SrcMaskByte = pu8SrcAndScanline[x / 8];
2115 const uint8_t u8SrcMaskBit = u8SrcMaskByte & u8Bit;
2116 const uint32_t u32SrcPixel = pu32SrcShapeScanline[x] & UINT32_C(0xFFFFFF);
2117
2118 uint8_t *pu8DstMaskByte = &mask.scanLine(y)[x / 8];
2119 uint8_t *pu8DstBitmapByte = &bitmap.scanLine(y)[x / 8];
2120
2121 if (u8SrcMaskBit == 0)
2122 {
2123 if (u32SrcPixel == 0)
2124 {
2125 /* Black: Qt Bitmap = 0, Mask = 0 */
2126 *pu8DstMaskByte &= ~u8Bit;
2127 *pu8DstBitmapByte &= ~u8Bit;
2128 }
2129 else
2130 {
2131 /* White: Qt Bitmap = 1, Mask = 0 */
2132 *pu8DstMaskByte &= ~u8Bit;
2133 *pu8DstBitmapByte |= u8Bit;
2134 }
2135 }
2136 else
2137 {
2138 if (u32SrcPixel == 0)
2139 {
2140 /* Transparent: Qt Bitmap = 1, Mask = 1 */
2141 *pu8DstMaskByte |= u8Bit;
2142 *pu8DstBitmapByte |= u8Bit;
2143 }
2144 else
2145 {
2146 /* Xor'ed: Qt Bitmap = 0, Mask = 1 */
2147 *pu8DstMaskByte |= u8Bit;
2148 *pu8DstBitmapByte &= ~u8Bit;
2149 }
2150 }
2151 }
2152
2153 pu8SrcAndScanline += (uWidth + 7) / 8;
2154 pu32SrcShapeScanline += uWidth;
2155 }
2156
2157 m_cursorShapePixmap = QBitmap::fromImage(bitmap);
2158 m_cursorMaskPixmap = QBitmap::fromImage(mask);
2159 }
2160 else
2161 {
2162 /* Assign alpha channel values according to the AND mask: 1 -> 0x00, 0 -> 0xFF: */
2163 QImage image(uCursorWidth, uCursorHeight, QImage::Format_ARGB32);
2164 memset(image.bits(), 0, image.sizeInBytes());
2165
2166 const uint8_t *pu8SrcAndScanline = pSrcAndMaskPtr;
2167 const uint32_t *pu32SrcShapeScanline = (uint32_t *)pSrcShapePtr;
2168
2169 for (uint y = 0; y < uHeight; ++y)
2170 {
2171 uint32_t *pu32DstPixel = (uint32_t *)image.scanLine(y);
2172
2173 for (uint x = 0; x < uWidth; ++x)
2174 {
2175 const uint8_t u8Bit = (uint8_t)(1 << (7 - x % 8));
2176 const uint8_t u8SrcMaskByte = pu8SrcAndScanline[x / 8];
2177
2178 if (u8SrcMaskByte & u8Bit)
2179 *pu32DstPixel++ = pu32SrcShapeScanline[x] & UINT32_C(0x00FFFFFF);
2180 else
2181 *pu32DstPixel++ = pu32SrcShapeScanline[x] | UINT32_C(0xFF000000);
2182 }
2183
2184 pu32SrcShapeScanline += uWidth;
2185 pu8SrcAndScanline += (uWidth + 7) / 8;
2186 }
2187
2188 m_cursorShapePixmap = QPixmap::fromImage(image);
2189 }
2190 }
2191
2192 /* Mark mouse pointer shape valid: */
2193 m_fIsValidPointerShapePresent = true;
2194
2195#elif defined(VBOX_WS_NIX) || defined(VBOX_WS_MAC)
2196
2197 /* Create an ARGB image out of the shape data: */
2198 QImage image(uWidth, uHeight, QImage::Format_ARGB32);
2199
2200 if (fHasAlpha)
2201 {
2202 memcpy(image.bits(), pSrcShapePtr, uHeight * uWidth * 4);
2203 }
2204 else
2205 {
2206 renderCursorPixels((uint32_t *)pSrcShapePtr, pSrcAndMaskPtr,
2207 uWidth, uHeight,
2208 (uint32_t *)image.bits(), uHeight * uWidth * 4);
2209 }
2210
2211 /* Create cursor-pixmap from the image: */
2212 m_cursorShapePixmap = QPixmap::fromImage(image);
2213
2214 /* Mark mouse pointer shape valid: */
2215 m_fIsValidPointerShapePresent = true;
2216
2217#else
2218
2219# warning "port me"
2220
2221#endif
2222
2223 /* Cache cursor pixmap size and hotspot: */
2224 m_cursorSize = m_cursorShapePixmap.size();
2225 m_cursorHotspot = m_shapeData.hotSpot();
2226}
2227
2228void UIMachine::updateMouseState()
2229{
2230 uisession()->acquireWhetherAbsoluteSupported(m_fIsMouseSupportsAbsolute);
2231 uisession()->acquireWhetherRelativeSupported(m_fIsMouseSupportsRelative);
2232 uisession()->acquireWhetherTouchScreenSupported(m_fIsMouseSupportsTouchScreen);
2233 uisession()->acquireWhetherTouchPadSupported(m_fIsMouseSupportsTouchPad);
2234 uisession()->acquireWhetherNeedsHostCursor(m_fIsMouseHostCursorNeeded);
2235}
2236
2237#if defined(VBOX_WS_NIX) || defined(VBOX_WS_MAC)
2238/* static */
2239void UIMachine::renderCursorPixels(const uint32_t *pu32XOR, const uint8_t *pu8AND,
2240 uint32_t u32Width, uint32_t u32Height,
2241 uint32_t *pu32Pixels, uint32_t cbPixels)
2242{
2243 /* Output pixels set to 0 which allow to not write transparent pixels anymore. */
2244 memset(pu32Pixels, 0, cbPixels);
2245
2246 const uint32_t *pu32XORSrc = pu32XOR; /* Iterator for source XOR pixels. */
2247 const uint8_t *pu8ANDSrcLine = pu8AND; /* The current AND mask scanline. */
2248 uint32_t *pu32Dst = pu32Pixels; /* Iterator for all destination BGRA pixels. */
2249
2250 /* Some useful constants. */
2251 const int cbANDLine = ((int)u32Width + 7) / 8;
2252
2253 int y;
2254 for (y = 0; y < (int)u32Height; ++y)
2255 {
2256 int x;
2257 for (x = 0; x < (int)u32Width; ++x)
2258 {
2259 const uint32_t u32Pixel = *pu32XORSrc; /* Current pixel at (x,y) */
2260 const uint8_t *pu8ANDSrc = pu8ANDSrcLine + x / 8; /* Byte which containt current AND bit. */
2261
2262 if ((*pu8ANDSrc << (x % 8)) & 0x80)
2263 {
2264 if (u32Pixel)
2265 {
2266 const uint32_t u32PixelInverted = ~u32Pixel;
2267
2268 /* Scan neighbor pixels and assign them if they are transparent. */
2269 int dy;
2270 for (dy = -1; dy <= 1; ++dy)
2271 {
2272 const int yn = y + dy;
2273 if (yn < 0 || yn >= (int)u32Height)
2274 continue; /* Do not cross the bounds. */
2275
2276 int dx;
2277 for (dx = -1; dx <= 1; ++dx)
2278 {
2279 const int xn = x + dx;
2280 if (xn < 0 || xn >= (int)u32Width)
2281 continue; /* Do not cross the bounds. */
2282
2283 if (dx != 0 || dy != 0)
2284 {
2285 /* Check if the neighbor pixel is transparent. */
2286 const uint32_t *pu32XORNeighborSrc = &pu32XORSrc[dy * (int)u32Width + dx];
2287 const uint8_t *pu8ANDNeighborSrc = pu8ANDSrcLine + dy * cbANDLine + xn / 8;
2288 if ( *pu32XORNeighborSrc == 0
2289 && ((*pu8ANDNeighborSrc << (xn % 8)) & 0x80) != 0)
2290 {
2291 /* Transparent neighbor pixels are replaced with the source pixel value. */
2292 uint32_t *pu32PixelNeighborDst = &pu32Dst[dy * (int)u32Width + dx];
2293 *pu32PixelNeighborDst = u32Pixel | 0xFF000000;
2294 }
2295 }
2296 else
2297 {
2298 /* The pixel itself is replaced with inverted value. */
2299 *pu32Dst = u32PixelInverted | 0xFF000000;
2300 }
2301 }
2302 }
2303 }
2304 else
2305 {
2306 /* The pixel does not affect the screen.
2307 * Do nothing. Do not touch destination which can already contain generated pixels.
2308 */
2309 }
2310 }
2311 else
2312 {
2313 /* AND bit is 0, the pixel will be just drawn. */
2314 *pu32Dst = u32Pixel | 0xFF000000;
2315 }
2316
2317 ++pu32XORSrc; /* Next source pixel. */
2318 ++pu32Dst; /* Next destination pixel. */
2319 }
2320
2321 /* Next AND scanline. */
2322 pu8ANDSrcLine += cbANDLine;
2323 }
2324}
2325#endif /* VBOX_WS_NIX || VBOX_WS_MAC */
2326
2327#ifdef VBOX_WS_WIN
2328/* static */
2329bool UIMachine::isPointer1bpp(const uint8_t *pu8XorMask,
2330 uint uWidth,
2331 uint uHeight)
2332{
2333 /* Check if the pointer has only 0 and 0xFFFFFF pixels, ignoring the alpha channel. */
2334 const uint32_t *pu32Src = (uint32_t *)pu8XorMask;
2335
2336 uint y;
2337 for (y = 0; y < uHeight ; ++y)
2338 {
2339 uint x;
2340 for (x = 0; x < uWidth; ++x)
2341 {
2342 const uint32_t u32Pixel = pu32Src[x] & UINT32_C(0xFFFFFF);
2343 if (u32Pixel != 0 && u32Pixel != UINT32_C(0xFFFFFF))
2344 return false;
2345 }
2346
2347 pu32Src += uWidth;
2348 }
2349
2350 return true;
2351}
2352#endif /* VBOX_WS_WIN */
2353
2354void UIMachine::updateVirtualizationState()
2355{
2356 uisession()->acquireExecutionEngineType(m_enmVMExecutionEngine);
2357 uisession()->acquireWhetherHwVirtExNestedPagingEnabled(m_fIsHWVirtExNestedPagingEnabled);
2358 uisession()->acquireWhetherHwVirtExUXEnabled(m_fIsHWVirtExUXEnabled);
2359 uisession()->acquireEffectiveParavirtProvider(m_enmParavirtProvider);
2360}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use