Changeset 53046 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 13, 2014 3:01:22 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r53043 r53046 213 213 prepareMachineLogic(); 214 214 215 /* Now power up the machine. 216 * Actually powerUp does more that just a power up, 217 * so call it regardless of isSeparateProcess setting. */ 218 uisession()->powerUp(); 219 220 /* Initialization of MachineLogic internals after the powerUp. 221 * This is a hack, maybe more generic approach can be used. */ 222 machineLogic()->initializePostPowerUp(); 215 /* Try to initialize session UI: */ 216 if (!uisession()->initialize()) 217 return false; 223 218 224 219 /* True by default: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r53030 r53046 829 829 { 830 830 /* We should check for entering/exiting requested modes: */ 831 connect(uisession(), SIGNAL(sig Started()), this, SLOT(sltCheckForRequestedVisualStateType()));831 connect(uisession(), SIGNAL(sigInitialized()), this, SLOT(sltCheckForRequestedVisualStateType())); 832 832 connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltCheckForRequestedVisualStateType())); 833 833 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r53029 r53046 156 156 } 157 157 158 void UISession::powerUp() 159 { 160 /* Prepare powerup: */ 161 bool fPrepared = preparePowerUp(); 162 if (!fPrepared) 163 return; 158 bool UISession::initialize() 159 { 160 /* Preprocess initialization: */ 161 if (!preprocessInitialization()) 162 return false; 163 164 /* Notify user about mouse&keyboard auto-capturing: */ 165 if (vboxGlobal().settings().autoCapture()) 166 popupCenter().remindAboutAutoCapture(machineLogic()->activeMachineWindow()); 167 168 /* Check if we are in teleportation waiting mode. 169 * In that case no first run wizard is necessary. */ 170 m_machineState = machine().GetState(); 171 if ( isFirstTimeStarted() 172 && !(( m_machineState == KMachineState_PoweredOff 173 || m_machineState == KMachineState_Aborted 174 || m_machineState == KMachineState_Teleported) 175 && machine().GetTeleporterEnabled())) 176 { 177 UISafePointerWizard pWizard = new UIWizardFirstRun(mainMachineWindow(), machine()); 178 pWizard->prepare(); 179 pWizard->exec(); 180 if (pWizard) 181 delete pWizard; 182 } 164 183 165 184 /* Apply debug settings from the command line. */ 166 if ( debugger().isOk())185 if (!debugger().isNull() && debugger().isOk()) 167 186 { 168 187 if (vboxGlobal().isPatmDisabled()) … … 180 199 } 181 200 201 /* Power UP if this is NOT separate process: */ 182 202 if (!vboxGlobal().isSeparateProcess()) 183 { 184 /* Power UP machine: */ 185 #ifdef VBOX_WITH_DEBUGGER_GUI 186 CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled() ? 187 console().PowerUpPaused() : console().PowerUp(); 188 #else /* !VBOX_WITH_DEBUGGER_GUI */ 189 CProgress progress = console().PowerUp(); 190 #endif /* !VBOX_WITH_DEBUGGER_GUI */ 191 192 /* Check for immediate failure: */ 193 if (!console().isOk()) 194 { 195 if (vboxGlobal().showStartVMErrors()) 196 msgCenter().cannotStartMachine(console(), machineName()); 197 closeRuntimeUI(); 198 return; 199 } 200 201 /* Guard progressbar warnings from auto-closing: */ 202 if (uimachine()->machineLogic()) 203 uimachine()->machineLogic()->setPreventAutoClose(true); 204 205 /* Show "Starting/Restoring" progress dialog: */ 206 if (isSaved()) 207 { 208 msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_state_restore_90px.png", 0, 0); 209 /* After restoring from 'saved' state, machine-window(s) geometry should be adjusted: */ 210 machineLogic()->adjustMachineWindowsGeometry(); 211 } 212 else 213 msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_start_90px.png"); 214 215 /* Check for a progress failure: */ 216 if (!progress.isOk() || progress.GetResultCode() != 0) 217 { 218 if (vboxGlobal().showStartVMErrors()) 219 msgCenter().cannotStartMachine(progress, machineName()); 220 closeRuntimeUI(); 221 return; 222 } 223 224 /* Allow further auto-closing: */ 225 if (uimachine()->machineLogic()) 226 uimachine()->machineLogic()->setPreventAutoClose(false); 227 } 228 else 229 { 230 /* Fetch the current mouse state: */ 203 if (!powerUp()) 204 return false; 205 206 /* Check if we missed a really quick termination after successful startup: */ 207 if (isTurnedOff()) 208 return false; 209 210 /* Postprocess initialization: */ 211 if (!postprocessInitialization()) 212 return false; 213 214 /* Fetch corresponding states: */ 215 if (vboxGlobal().isSeparateProcess()) 216 { 231 217 m_fIsMouseSupportsAbsolute = mouse().GetAbsoluteSupported(); 232 218 m_fIsMouseSupportsRelative = mouse().GetRelativeSupported(); 233 219 m_fIsMouseSupportsMultiTouch = mouse().GetMultiTouchSupported(); 234 220 m_fIsMouseHostCursorNeeded = mouse().GetNeedsHostCursor(); 235 /* Fetch the current guest additions state: */236 221 sltAdditionsChange(); 237 222 } 238 239 /* Check if we missed a really quick termination after successful startup, and process it if we did: */ 240 if (isTurnedOff()) 241 { 242 closeRuntimeUI(); 243 return; 244 } 245 246 /* Check if the required virtualization features are active. We get this info only when the session is active. */ 247 const bool fIs64BitsGuest = vboxGlobal().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetIs64Bit(); 248 const bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetRecommendedVirtEx(); 249 AssertMsg(!fIs64BitsGuest || fRecommendVirtEx, ("Virtualization support missed for 64bit guest!\n")); 250 bool fIsVirtEnabled = debugger().GetHWVirtExEnabled(); 251 if (fRecommendVirtEx && !fIsVirtEnabled) 252 { 253 bool fShouldWeClose; 254 255 bool fVTxAMDVSupported = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx); 256 257 QApplication::processEvents(); 258 setPause(true); 259 260 if (fIs64BitsGuest) 261 fShouldWeClose = msgCenter().warnAboutVirtNotEnabled64BitsGuest(fVTxAMDVSupported); 262 else 263 fShouldWeClose = msgCenter().warnAboutVirtNotEnabledGuestRequired(fVTxAMDVSupported); 264 265 if (fShouldWeClose) 266 { 267 /* At this point the console is powered up. 268 * So we have to close this session again. */ 269 CProgress progress = console().PowerDown(); 270 if (console().isOk()) 271 { 272 /* Guard progressbar warnings from auto-closing: */ 273 if (uimachine()->machineLogic()) 274 uimachine()->machineLogic()->setPreventAutoClose(true); 275 /* Show the power down progress dialog */ 276 msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_poweroff_90px.png"); 277 if (!progress.isOk() || progress.GetResultCode() != 0) 278 msgCenter().cannotPowerDownMachine(progress, machineName()); 279 /* Allow further auto-closing: */ 280 if (uimachine()->machineLogic()) 281 uimachine()->machineLogic()->setPreventAutoClose(false); 282 } 283 else 284 msgCenter().cannotPowerDownMachine(console()); 285 closeRuntimeUI(); 286 return; 287 } 288 289 setPause(false); 290 } 223 machineLogic()->initializePostPowerUp(); 291 224 292 225 #ifdef VBOX_WITH_VIDEOHWACCEL 226 /* Log whether 2D video acceleration is enabled: */ 293 227 LogRel(("2D video acceleration is %s.\n", 294 228 machine().GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable() 295 ? "enabled" 296 : "disabled")); 229 ? "enabled" : "disabled")); 297 230 #endif /* VBOX_WITH_VIDEOHWACCEL */ 298 231 299 /* Check if HID LEDs sync is enabled and add a log message about it.*/232 /* Log whether HID LEDs sync is enabled: */ 300 233 #if defined(Q_WS_MAC) || defined(Q_WS_WIN) 301 if(uimachine()->machineLogic()->isHidLedsSyncEnabled()) 302 LogRel(("HID LEDs sync is enabled.\n")); 303 else 304 LogRel(("HID LEDs sync is disabled.\n")); 305 #else 234 LogRel(("HID LEDs sync is %s.\n", 235 uimachine()->machineLogic()->isHidLedsSyncEnabled() 236 ? "enabled" : "disabled")); 237 #else /* !Q_WS_MAC && !Q_WS_WIN */ 306 238 LogRel(("HID LEDs sync is not supported on this platform.\n")); 307 #endif 239 #endif /* !Q_WS_MAC && !Q_WS_WIN */ 308 240 309 241 #ifdef VBOX_GUI_WITH_PIDFILE 310 242 vboxGlobal().createPidfile(); 311 #endif 312 313 /* Warn listeners about machine was started: */ 314 emit sigStarted(); 243 #endif /* VBOX_GUI_WITH_PIDFILE */ 244 245 /* Warn listeners about we are initialized: */ 246 emit sigInitialized(); 247 248 /* True by default: */ 249 return true; 250 } 251 252 bool UISession::powerUp() 253 { 254 /* Power UP machine: */ 255 #ifdef VBOX_WITH_DEBUGGER_GUI 256 CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled() ? 257 console().PowerUpPaused() : console().PowerUp(); 258 #else /* !VBOX_WITH_DEBUGGER_GUI */ 259 CProgress progress = console().PowerUp(); 260 #endif /* !VBOX_WITH_DEBUGGER_GUI */ 261 262 /* Check for immediate failure: */ 263 if (!console().isOk() || progress.isNull()) 264 { 265 if (vboxGlobal().showStartVMErrors()) 266 msgCenter().cannotStartMachine(console(), machineName()); 267 return false; 268 } 269 270 /* Guard progressbar warnings from auto-closing: */ 271 if (uimachine()->machineLogic()) 272 uimachine()->machineLogic()->setPreventAutoClose(true); 273 274 /* Show "Starting/Restoring" progress dialog: */ 275 if (isSaved()) 276 { 277 msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_state_restore_90px.png", 0, 0); 278 /* After restoring from 'saved' state, machine-window(s) geometry should be adjusted: */ 279 machineLogic()->adjustMachineWindowsGeometry(); 280 } 281 else 282 msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_start_90px.png"); 283 284 /* Check for progress failure: */ 285 if (!progress.isOk() || progress.GetResultCode() != 0) 286 { 287 if (vboxGlobal().showStartVMErrors()) 288 msgCenter().cannotStartMachine(progress, machineName()); 289 return false; 290 } 291 292 /* Allow further auto-closing: */ 293 if (uimachine()->machineLogic()) 294 uimachine()->machineLogic()->setPreventAutoClose(false); 295 296 /* True by default: */ 297 return true; 315 298 } 316 299 … … 891 874 , m_fAllCloseActionsRestricted(false) 892 875 /* Common flags: */ 893 , m_fI sStarted(false)876 , m_fInitialized(false) 894 877 , m_fIsFirstTimeStarted(false) 895 878 , m_fIsGuestResizeIgnored(false) … … 1101 1084 void UISession::prepareConnections() 1102 1085 { 1103 connect(this, SIGNAL(sig Started()), this, SLOT(sltMarkStarted()));1086 connect(this, SIGNAL(sigInitialized()), this, SLOT(sltMarkInitialized())); 1104 1087 connect(this, SIGNAL(sigCloseRuntimeUI()), this, SLOT(sltCloseRuntimeUI())); 1105 1088 … … 1682 1665 } 1683 1666 1684 bool UISession::preparePowerUp() 1685 { 1686 /* Notify user about mouse&keyboard auto-capturing: */ 1687 if (vboxGlobal().settings().autoCapture()) 1688 popupCenter().remindAboutAutoCapture(machineLogic()->activeMachineWindow()); 1689 1690 /* Check if we are in teleportation waiting mode. 1691 * In that case no first run wizard is necessary. */ 1692 m_machineState = machine().GetState(); 1693 if ( isFirstTimeStarted() 1694 && !(( m_machineState == KMachineState_PoweredOff 1695 || m_machineState == KMachineState_Aborted 1696 || m_machineState == KMachineState_Teleported) 1697 && machine().GetTeleporterEnabled())) 1698 { 1699 UISafePointerWizard pWizard = new UIWizardFirstRun(mainMachineWindow(), machine()); 1700 pWizard->prepare(); 1701 pWizard->exec(); 1702 if (pWizard) 1703 delete pWizard; 1704 } 1705 1667 bool UISession::preprocessInitialization() 1668 { 1706 1669 #ifdef VBOX_WITH_NETFLT 1707 1670 /* Skip further checks if VM in saved state */ … … 1758 1721 if (!failedInterfaceNames.isEmpty()) 1759 1722 { 1760 if (msgCenter(). UIMessageCenter::cannotStartWithoutNetworkIf(machineName(), failedInterfaceNames.join(", ")))1723 if (msgCenter().cannotStartWithoutNetworkIf(machineName(), failedInterfaceNames.join(", "))) 1761 1724 machineLogic()->openNetworkSettingsDialog(); 1762 1725 else 1763 {1764 closeRuntimeUI();1765 1726 return false; 1766 }1767 1727 } 1768 1728 #endif /* VBOX_WITH_NETFLT */ 1769 1729 1730 /* True by default: */ 1731 return true; 1732 } 1733 1734 bool UISession::postprocessInitialization() 1735 { 1736 /* Check if the required virtualization features are active. We get this info only when the session is active. */ 1737 const bool fIs64BitsGuest = vboxGlobal().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetIs64Bit(); 1738 const bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetRecommendedVirtEx(); 1739 AssertMsg(!fIs64BitsGuest || fRecommendVirtEx, ("Virtualization support missed for 64bit guest!\n")); 1740 bool fIsVirtEnabled = debugger().GetHWVirtExEnabled(); 1741 if (fRecommendVirtEx && !fIsVirtEnabled) 1742 { 1743 /* Check whether vt-x / amd-v supported: */ 1744 bool fVTxAMDVSupported = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx); 1745 1746 /* Pause VM: */ 1747 setPause(true); 1748 1749 /* Ask the user about further actions: */ 1750 bool fShouldWeClose; 1751 if (fIs64BitsGuest) 1752 fShouldWeClose = msgCenter().warnAboutVirtNotEnabled64BitsGuest(fVTxAMDVSupported); 1753 else 1754 fShouldWeClose = msgCenter().warnAboutVirtNotEnabledGuestRequired(fVTxAMDVSupported); 1755 1756 /* If user asked to close VM: */ 1757 if (fShouldWeClose) 1758 { 1759 /* Prevent auto-closure during power off sequence: */ 1760 machineLogic()->setPreventAutoClose(true); 1761 /* Power off VM: */ 1762 bool fServerCrashed = false; 1763 powerOff(false, fServerCrashed); 1764 return false; 1765 } 1766 1767 /* Resume VM: */ 1768 setPause(false); 1769 } 1770 1771 /* True by default: */ 1770 1772 return true; 1771 1773 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r53029 r53046 90 90 91 91 /* API: Runtime UI stuff: */ 92 void powerUp(); 92 bool initialize(); 93 bool powerUp(); 93 94 bool saveState(); 94 95 bool shutdown(); … … 181 182 bool wasPaused() const { return machineStatePrevious() == KMachineState_Paused || 182 183 machineStatePrevious() == KMachineState_TeleportingPausedVM; } 183 bool is Started() const { return m_fIsStarted; }184 bool isInitialized() const { return m_fInitialized; } 184 185 bool isFirstTimeStarted() const { return m_fIsFirstTimeStarted; } 185 186 bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; } … … 285 286 286 287 /* Session signals: */ 287 void sig Started();288 void sigInitialized(); 288 289 289 290 public slots: … … 300 301 301 302 /** Marks machine started. */ 302 void sltMark Started() { m_fIsStarted = true; }303 void sltMarkInitialized() { m_fInitialized = true; } 303 304 304 305 /* Handler: Close Runtime UI stuff: */ … … 371 372 WId winId() const; 372 373 void setPointerShape(const uchar *pShapeData, bool fHasAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight); 373 bool preparePowerUp(); 374 bool preprocessInitialization(); 375 bool postprocessInitialization(); 374 376 int countOfVisibleWindows(); 375 377 … … 470 472 471 473 /* Common flags: */ 472 bool m_fI sStarted : 1;474 bool m_fInitialized : 1; 473 475 bool m_fIsFirstTimeStarted : 1; 474 476 bool m_fIsGuestResizeIgnored : 1; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r52889 r53046 285 285 uisession()->setRequestedVisualState(UIVisualStateType_Normal); 286 286 287 /* If session started already=> push mode-change directly: */288 if (uisession()->is Started())287 /* If session already initialized => push mode-change directly: */ 288 if (uisession()->isInitialized()) 289 289 sltCheckForRequestedVisualStateType(); 290 290 }
Note:
See TracChangeset
for help on using the changeset viewer.