void UIMachineLogicNormal::sltOpenStatusBarSettings() { /* Do not process if window(s) missed! */ AssertReturnVoid(isMachineWindowsCreated()); /* Make sure status-bar is enabled: */ const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->isChecked(); AssertReturnVoid(fEnabled); /* Prevent user from opening another one editor or toggle status-bar: */ actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)->setEnabled(false); actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->setEnabled(false); /* Create status-bar editor: */ UIStatusBarEditorWindow *pStatusBarEditor = new UIStatusBarEditorWindow(activeMachineWindow()); AssertPtrReturnVoid(pStatusBarEditor); { /* Configure status-bar editor: */ connect(pStatusBarEditor, SIGNAL(destroyed(QObject*)), this, SLOT(sltStatusBarSettingsClosed())); #ifdef Q_WS_MAC connect(this, SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)), pStatusBarEditor, SLOT(sltActivateWindow())); #endif /* Q_WS_MAC */ /* Show window: */ pStatusBarEditor->show(); } }
void UIMachineWindowFullscreen::prepareMiniToolbar() { /* Make sure mini-toolbar is not restricted: */ if (!gEDataManager->miniToolbarEnabled(vboxGlobal().managedVMUuid())) return; /* Create mini-toolbar: */ m_pMiniToolBar = new UIMiniToolBar(this, GeometryType_Full, gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()), gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid())); AssertPtrReturnVoid(m_pMiniToolBar); { /* Configure mini-toolbar: */ m_pMiniToolBar->addMenus(actionPool()->menus()); connect(m_pMiniToolBar, SIGNAL(sigMinimizeAction()), this, SLOT(showMinimized()), Qt::QueuedConnection); connect(m_pMiniToolBar, SIGNAL(sigExitAction()), actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SLOT(trigger())); connect(m_pMiniToolBar, SIGNAL(sigCloseAction()), actionPool()->action(UIActionIndex_M_Application_S_Close), SLOT(trigger())); connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutWindowActivationStolen()), this, SLOT(sltRevokeWindowActivation()), Qt::QueuedConnection); # ifdef Q_WS_X11 // WORKAROUND: // Due to Unity bug we want native full-screen flag to be set // for mini-toolbar _before_ trying to show it in full-screen mode. // That significantly improves of chances to have required geometry. if (vboxGlobal().typeOfWindowManager() == X11WMType_Compiz) vboxGlobal().setFullScreenFlag(m_pMiniToolBar); # endif /* Q_WS_X11 */ } }
bool UIMachineLogicSeamless::checkAvailability() { /* Check if there is enough physical memory to enter seamless: */ if (uisession()->isGuestSupportsSeamless()) { quint64 availBits = machine().GetVRAMSize() /* VRAM */ * _1M /* MiB to bytes */ * 8 /* to bits */; quint64 usedBits = m_pScreenLayout->memoryRequirements(); if (availBits < usedBits) { msgCenter().cannotEnterSeamlessMode(0, 0, 0, (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M); return false; } } /* Show the info message. */ const UIShortcut &shortcut = gShortcutPool->shortcut(actionPool()->shortcutsExtraDataID(), actionPool()->action(UIActionIndexRT_M_View_T_Seamless)->shortcutExtraDataID()); const QString strHotKey = QString("Host+%1").arg(shortcut.toString()); if (!msgCenter().confirmGoingSeamless(strHotKey)) return false; return true; }
void UIMachineLogicSeamless::prepareActionGroups() { /* Call to base-class: */ UIMachineLogic::prepareActionGroups(); /* Restrict 'Adjust Window', 'Guest Autoresize', 'Status Bar' and 'Resize' actions for 'View' menu: */ actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic, (UIExtraDataMetaDefs::RuntimeMenuViewActionType) (UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow | UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize | UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar | UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar | UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize)); #ifdef VBOX_WS_MAC /* Restrict 'Window' menu: */ actionPool()->toRuntime()->setRestrictionForMenuBar(UIActionRestrictionLevel_Logic, UIExtraDataMetaDefs::MenuType_Window); #endif /* VBOX_WS_MAC */ /* Take care of view-action toggle state: */ UIAction *pActionSeamless = actionPool()->action(UIActionIndexRT_M_View_T_Seamless); if (!pActionSeamless->isChecked()) { pActionSeamless->blockSignals(true); pActionSeamless->setChecked(true); pActionSeamless->blockSignals(false); } }
void UIMachineWindowNormal::sltHandleStatusBarConfigurationChange(const QUuid &uMachineID) { /* Skip unrelated machine IDs: */ if (vboxGlobal().managedVMUuid() != uMachineID) return; /* Check whether status-bar is enabled: */ const bool fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid()); /* Update settings action 'enable' state: */ QAction *pActionStatusBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings); pActionStatusBarSettings->setEnabled(fEnabled); /* Update switch action 'checked' state: */ QAction *pActionStatusBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility); pActionStatusBarSwitch->blockSignals(true); pActionStatusBarSwitch->setChecked(fEnabled); pActionStatusBarSwitch->blockSignals(false); /* Update status-bar visibility: */ statusBar()->setVisible(pActionStatusBarSwitch->isChecked()); /* Update status-bar indicators-pool: */ m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible() && uisession()->isRunning()); /* Normalize geometry without moving: */ normalizeGeometry(false /* adjust position */); }
void UIMachineWindowNormal::sltHandleMenuBarConfigurationChange(const QUuid &uMachineID) { /* Skip unrelated machine IDs: */ if (vboxGlobal().managedVMUuid() != uMachineID) return; /* Check whether menu-bar is enabled: */ const bool fEnabled = gEDataManager->menuBarEnabled(vboxGlobal().managedVMUuid()); /* Update settings action 'enable' state: */ QAction *pActionMenuBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings); pActionMenuBarSettings->setEnabled(fEnabled); /* Update switch action 'checked' state: */ QAction *pActionMenuBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility); pActionMenuBarSwitch->blockSignals(true); pActionMenuBarSwitch->setChecked(fEnabled); pActionMenuBarSwitch->blockSignals(false); /* Update menu-bar visibility: */ menuBar()->setVisible(pActionMenuBarSwitch->isChecked()); /* Update menu-bar: */ updateMenu(); /* Normalize geometry without moving: */ normalizeGeometry(false /* adjust position */); }
void UIMachineWindowFullscreen::prepareMiniToolbar() { /* Make sure mini-toolbar is not restricted: */ if (!gEDataManager->miniToolbarEnabled(vboxGlobal().managedVMUuid())) return; /* Create mini-toolbar: */ m_pMiniToolBar = new UIMiniToolBar(this, GeometryType_Full, gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()), gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid())); AssertPtrReturnVoid(m_pMiniToolBar); { /* Configure mini-toolbar: */ m_pMiniToolBar->addMenus(actionPool()->menus()); connect(m_pMiniToolBar, SIGNAL(sigMinimizeAction()), this, SLOT(showMinimized()), Qt::QueuedConnection); connect(m_pMiniToolBar, SIGNAL(sigExitAction()), actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SLOT(trigger())); connect(m_pMiniToolBar, SIGNAL(sigCloseAction()), actionPool()->action(UIActionIndex_M_Application_S_Close), SLOT(trigger())); connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutWindowActivationStolen()), this, SLOT(sltRevokeWindowActivation()), Qt::QueuedConnection); } }
/** Returns whether action is allowed. */ virtual bool isAllowed() const { #ifdef RT_OS_DARWIN return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_About); #else /* !RT_OS_DARWIN */ return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_About); #endif /* !RT_OS_DARWIN */ }
void UIMachineLogicNormal::sltStatusBarSettingsClosed() { /* Make sure status-bar is enabled: */ const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->isChecked(); AssertReturnVoid(fEnabled); /* Allow user to open editor and toggle status-bar again: */ actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)->setEnabled(true); actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->setEnabled(true); }
void UIMachineLogicNormal::prepareActionConnections() { /* Call to base-class: */ UIMachineLogic::prepareActionConnections(); /* Prepare 'View' actions connections: */ connect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToFullscreen())); connect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToSeamless())); connect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToScale())); connect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings), SIGNAL(triggered(bool)), this, SLOT(sltOpenMenuBarSettings())); #ifndef Q_WS_MAC connect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility), SIGNAL(triggered(bool)), this, SLOT(sltToggleMenuBar())); #endif /* !Q_WS_MAC */ connect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings), SIGNAL(triggered(bool)), this, SLOT(sltOpenStatusBarSettings())); connect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility), SIGNAL(triggered(bool)), this, SLOT(sltToggleStatusBar())); connect(actionPool(), SIGNAL(sigNotifyAboutTriggeringViewScreenToggle(int, bool)), this, SLOT(sltHandleActionTriggerViewScreenToggle(int, bool))); connect(actionPool(), SIGNAL(sigNotifyAboutTriggeringViewScreenResize(int, const QSize&)), this, SLOT(sltHandleActionTriggerViewScreenResize(int, const QSize&))); }
bool UIMachineLogicScale::checkAvailability() { /* Show the info message. */ const UIShortcut &shortcut = gShortcutPool->shortcut(actionPool()->shortcutsExtraDataID(), actionPool()->action(UIActionIndexRT_M_View_T_Scale)->shortcutExtraDataID()); const QString strHotKey = QString("Host+%1").arg(shortcut.toString()); if (!msgCenter().confirmGoingScale(strHotKey)) return false; return true; }
void UIMachineLogicSeamless::cleanupActionConnections() { /* "View" actions disconnections: */ disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToNormal())); disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToFullscreen())); disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToScale())); /* Call to base-class: */ UIMachineLogic::cleanupActionConnections(); }
void UIMachineLogicScale::prepareActionConnections() { /* Call to base-class: */ UIMachineLogic::prepareActionConnections(); /* Prepare 'View' actions connections: */ connect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToNormal())); connect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToFullscreen())); connect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToSeamless())); }
void UIMachineLogicNormal::sltMenuBarSettingsClosed() { #ifndef Q_WS_MAC /* Make sure menu-bar is enabled: */ const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->isChecked(); AssertReturnVoid(fEnabled); #endif /* !Q_WS_MAC */ /* Allow user to open editor and toggle menu-bar again: */ actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)->setEnabled(true); #ifndef Q_WS_MAC actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->setEnabled(true); #endif /* !Q_WS_MAC */ }
void UIMachineWindowNormal::updateMenu() { /* Rebuild menu-bar: */ menuBar()->clear(); foreach (QMenu *pMenu, actionPool()->menus()) menuBar()->addMenu(pMenu); }
QKeySequence defaultShortcut(UIActionPoolType) const { switch (actionPool()->type()) { case UIActionPoolType_Selector: return QKeySequence("Ctrl+G"); case UIActionPoolType_Runtime: break; } return QKeySequence(); }
void UIMachineLogicScale::cleanupActionGroups() { /* Take care of view-action toggle state: */ UIAction *pActionScale = actionPool()->action(UIActionIndexRT_M_View_T_Scale); if (pActionScale->isChecked()) { pActionScale->blockSignals(true); pActionScale->setChecked(false); pActionScale->blockSignals(false); } /* Allow 'Adjust Window', 'Guest Autoresize', 'Status Bar' and 'Resize' actions for 'View' menu: */ actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic, UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid); /* Call to base-class: */ UIMachineLogic::cleanupActionGroups(); }
UIMachineLogicSeamless::UIMachineLogicSeamless(QObject *pParent, UISession *pSession) : UIMachineLogic(pParent, pSession, UIVisualStateType_Seamless) #ifndef VBOX_WS_MAC , m_pPopupMenu(0) #endif /* !VBOX_WS_MAC */ { /* Create multiscreen layout: */ m_pScreenLayout = new UIMultiScreenLayout(this); actionPool()->toRuntime()->setMultiScreenLayout(m_pScreenLayout); }
void UIMachineLogicScale::prepareMenu() { /* Prepare popup-menu: */ m_pPopupMenu = new QIMenu; AssertPtrReturnVoid(m_pPopupMenu); { /* Prepare popup-menu: */ foreach (QMenu *pMenu, actionPool()->menus()) m_pPopupMenu->addMenu(pMenu); } }
void UIMachineWindowSeamless::prepareMiniToolbar() { /* Make sure mini-toolbar is not restricted: */ if (!gEDataManager->miniToolbarEnabled(vboxGlobal().managedVMUuid())) return; /* Create mini-toolbar: */ m_pMiniToolBar = new UIRuntimeMiniToolBar(this, GeometryType_Available, gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()), gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid())); m_pMiniToolBar->show(); m_pMiniToolBar->addMenus(actionPool()->menus()); connect(m_pMiniToolBar, SIGNAL(sigMinimizeAction()), this, SLOT(showMinimized())); connect(m_pMiniToolBar, SIGNAL(sigExitAction()), actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SLOT(trigger())); connect(m_pMiniToolBar, SIGNAL(sigCloseAction()), actionPool()->action(UIActionIndex_M_Application_S_Close), SLOT(trigger())); connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutFocusStolen()), this, SLOT(sltRevokeFocus()), Qt::QueuedConnection); }
UIMachineViewFullscreen::UIMachineViewFullscreen( UIMachineWindow *pMachineWindow , ulong uScreenId #ifdef VBOX_WITH_VIDEOHWACCEL , bool bAccelerate2DVideo #endif ) : UIMachineView( pMachineWindow , uScreenId #ifdef VBOX_WITH_VIDEOHWACCEL , bAccelerate2DVideo #endif ) , m_bIsGuestAutoresizeEnabled(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked()) { }
void UIAction::updateText() { /* Action-text format depends on action-pool type: */ switch (m_actionPoolType) { /* The same as menu name for Selector UI: */ case UIActionPoolType_Selector: setText(nameInMenu()); break; /* With shortcut appended for Runtime UI: */ case UIActionPoolType_Runtime: setText(vboxGlobal().insertKeyToActionText(nameInMenu(), gShortcutPool->shortcut(actionPool(), this).toString())); break; } }
UIMachineViewNormal::UIMachineViewNormal( UIMachineWindow *pMachineWindow , ulong uScreenId #ifdef VBOX_WITH_VIDEOHWACCEL , bool bAccelerate2DVideo #endif ) : UIMachineView( pMachineWindow , uScreenId #ifdef VBOX_WITH_VIDEOHWACCEL , bAccelerate2DVideo #endif ) , m_bIsGuestAutoresizeEnabled(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked()) { /* Resend the last resize hint: */ resendSizeHint(); }
void UIMachineWindowNormal::prepareStatusBar() { /* Call to base-class: */ UIMachineWindow::prepareStatusBar(); /* Create status-bar: */ setStatusBar(new QIStatusBar); AssertPtrReturnVoid(statusBar()); { /* Configure status-bar: */ statusBar()->setContextMenuPolicy(Qt::CustomContextMenu); connect(statusBar(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(sltHandleStatusBarContextMenuRequest(const QPoint&))); /* Create indicator-pool: */ m_pIndicatorsPool = new UIIndicatorsPool(machineLogic()->uisession()); AssertPtrReturnVoid(m_pIndicatorsPool); { /* Configure indicator-pool: */ connect(m_pIndicatorsPool, SIGNAL(sigContextMenuRequest(IndicatorType, const QPoint&)), this, SLOT(sltHandleIndicatorContextMenuRequest(IndicatorType, const QPoint&))); /* Add indicator-pool into status-bar: */ statusBar()->addPermanentWidget(m_pIndicatorsPool, 0); } /* Post-configure status-bar: */ connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange(const QUuid &)), this, SLOT(sltHandleStatusBarConfigurationChange(const QUuid &))); #ifdef VBOX_WS_MAC /* Make sure the status-bar is aware of action hovering: */ connect(actionPool(), SIGNAL(sigActionHovered(UIAction *)), this, SLOT(sltActionHovered(UIAction *))); #endif /* VBOX_WS_MAC */ } #ifdef VBOX_WS_MAC /* For the status-bar on Cocoa: */ setUnifiedTitleAndToolBarOnMac(true); #endif /* VBOX_WS_MAC */ }
void UIMachineLogicNormal::cleanupActionConnections() { /* "View" actions disconnections: */ disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToFullscreen())); disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToSeamless())); disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)), this, SLOT(sltChangeVisualStateToScale())); disconnect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings), SIGNAL(triggered(bool)), this, SLOT(sltOpenMenuBarSettings())); #ifndef Q_WS_MAC disconnect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility), SIGNAL(triggered(bool)), this, SLOT(sltToggleMenuBar())); #endif /* !Q_WS_MAC */ disconnect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings), SIGNAL(triggered(bool)), this, SLOT(sltOpenStatusBarSettings())); disconnect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility), SIGNAL(triggered(bool)), this, SLOT(sltToggleStatusBar())); /* Call to base-class: */ UIMachineLogic::cleanupActionConnections(); }
/** Returns whether action is allowed. */ virtual bool isAllowed() const { return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Preferences); }
void UIMachineWindowNormal::sltHandleStatusBarContextMenuRequest(const QPoint &position) { /* Raise action's context-menu: */ if (gEDataManager->statusBarContextMenuEnabled(vboxGlobal().managedVMUuid())) actionPool()->action(UIActionIndexRT_M_View_M_StatusBar)->menu()->exec(statusBar()->mapToGlobal(position)); }
void UIMachineWindowNormal::sltHandleIndicatorContextMenuRequest(IndicatorType enmIndicatorType, const QPoint &indicatorPosition) { /* Determine action depending on indicator-type: */ UIAction *pAction = 0; switch (enmIndicatorType) { case IndicatorType_HardDisks: pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives); break; case IndicatorType_OpticalDisks: pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices); break; case IndicatorType_FloppyDisks: pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices); break; case IndicatorType_Audio: pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_Audio); break; case IndicatorType_Network: pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_Network); break; case IndicatorType_USB: pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices); break; case IndicatorType_SharedFolders: pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders); break; case IndicatorType_Display: pAction = actionPool()->action(UIActionIndexRT_M_ViewPopup); break; case IndicatorType_Recording: pAction = actionPool()->action(UIActionIndexRT_M_View_M_Recording); break; case IndicatorType_Mouse: pAction = actionPool()->action(UIActionIndexRT_M_Input_M_Mouse); break; case IndicatorType_Keyboard: pAction = actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard); break; default: break; } /* Raise action's context-menu: */ if (pAction && pAction->isEnabled()) pAction->menu()->exec(m_pIndicatorsPool->mapIndicatorPositionToGlobal(enmIndicatorType, indicatorPosition)); }
void UIMachineWindowNormal::loadSettings() { /* Call to base-class: */ UIMachineWindow::loadSettings(); /* Load GUI customizations: */ { #ifndef VBOX_WS_MAC /* Update menu-bar visibility: */ menuBar()->setVisible(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->isChecked()); #endif /* !VBOX_WS_MAC */ /* Update status-bar visibility: */ statusBar()->setVisible(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->isChecked()); m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible() && uisession()->isRunning()); } /* Load window geometry: */ { /* Load extra-data: */ QRect geo = gEDataManager->machineWindowGeometry(machineLogic()->visualStateType(), m_uScreenId, vboxGlobal().managedVMUuid()); /* If we do have proper geometry: */ if (!geo.isNull()) { /* If previous machine-state was SAVED: */ if (machine().GetState() == KMachineState_Saved) { /* Restore window geometry: */ m_normalGeometry = geo; VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry); } /* If previous machine-state was NOT SAVED: */ else { /* Restore only window position: */ m_normalGeometry = QRect(geo.x(), geo.y(), width(), height()); VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry); /* And normalize to the optimal-size: */ normalizeGeometry(false /* adjust position */); } /* Maximize (if necessary): */ if (gEDataManager->machineWindowShouldBeMaximized(machineLogic()->visualStateType(), m_uScreenId, vboxGlobal().managedVMUuid())) setWindowState(windowState() | Qt::WindowMaximized); } /* If we do NOT have proper geometry: */ else { /* Get available geometry, for screen with (x,y) coords if possible: */ QRect availableGeo = !geo.isNull() ? gpDesktop->availableGeometry(QPoint(geo.x(), geo.y())) : gpDesktop->availableGeometry(this); /* Normalize to the optimal size: */ normalizeGeometry(true /* adjust position */); /* Move newly created window to the screen-center: */ m_normalGeometry = geometry(); m_normalGeometry.moveCenter(availableGeo.center()); VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry); } /* Normalize to the optimal size: */ #ifdef VBOX_WS_X11 QTimer::singleShot(0, this, SLOT(sltNormalizeGeometry())); #else /* !VBOX_WS_X11 */ normalizeGeometry(true /* adjust position */); #endif /* !VBOX_WS_X11 */ } }
UIMachineLogicSeamless::~UIMachineLogicSeamless() { /* Delete multiscreen layout: */ actionPool()->toRuntime()->unsetMultiScreenLayout(m_pScreenLayout); delete m_pScreenLayout; }