Changeset 46698 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 20, 2013 10:18:39 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
r46686 r46698 258 258 Q_DECLARE_METATYPE(IndicatorType); 259 259 260 /* Machine close action: */ 261 enum MachineCloseAction 262 { 263 MachineCloseAction_Cancel, 264 MachineCloseAction_Save, 265 MachineCloseAction_Shutdown, 266 MachineCloseAction_PowerOff, 267 MachineCloseAction_PowerOff_Restoring_Snapshot, 268 MachineCloseAction_Max 269 }; 270 Q_DECLARE_METATYPE(MachineCloseAction); 271 260 272 #endif // __UIDefs_h__ 261 273 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r46244 r46698 261 261 262 262 /* Choose the close action: */ 263 UIVMCloseDialog::ResultCode closeAction = UIVMCloseDialog::ResultCode_Cancel;263 MachineCloseAction closeAction = MachineCloseAction_Cancel; 264 264 265 265 /* If there IS default close-action defined: */ … … 272 272 * we should ask the user about what to do: */ 273 273 if (uisession()->isStuck() && 274 closeAction != UIVMCloseDialog::ResultCode_PowerOff)275 closeAction = UIVMCloseDialog::ResultCode_Cancel;274 closeAction != MachineCloseAction_PowerOff) 275 closeAction = MachineCloseAction_Cancel; 276 276 /* If the default-action is 'power-off', 277 277 * we should check if its possible to discard machine-state: */ 278 if (closeAction == UIVMCloseDialog::ResultCode_PowerOff &&278 if (closeAction == MachineCloseAction_PowerOff && 279 279 machine().GetSnapshotCount() > 0) 280 closeAction = UIVMCloseDialog::ResultCode_PowerOff_With_Discarding;280 closeAction = MachineCloseAction_PowerOff_Restoring_Snapshot; 281 281 } 282 282 283 283 /* If the close-action still undefined: */ 284 if (closeAction == UIVMCloseDialog::ResultCode_Cancel)284 if (closeAction == MachineCloseAction_Cancel) 285 285 { 286 286 /* Prepare close-dialog: */ … … 297 297 /* Show close-dialog to let the user make the choice: */ 298 298 windowManager().registerNewParent(pCloseDlg, pParentDlg); 299 closeAction = (UIVMCloseDialog::ResultCode)pCloseDlg->exec();299 closeAction = static_cast<MachineCloseAction>(pCloseDlg->exec()); 300 300 301 301 /* Make sure the dialog still valid: */ … … 306 306 * we should resume it if user canceled dialog or chosen shutdown: */ 307 307 if (!fWasPaused && uisession()->isPaused() && 308 (closeAction == UIVMCloseDialog::ResultCode_Cancel ||309 closeAction == UIVMCloseDialog::ResultCode_Shutdown))308 (closeAction == MachineCloseAction_Cancel || 309 closeAction == MachineCloseAction_Shutdown)) 310 310 { 311 311 /* If we unable to resume VM, cancel closing: */ 312 312 if (!uisession()->unpause()) 313 closeAction = UIVMCloseDialog::ResultCode_Cancel;313 closeAction = MachineCloseAction_Cancel; 314 314 } 315 315 } … … 318 318 { 319 319 /* Else user misconfigured .vbox file, 'power-off' will be the action: */ 320 closeAction = UIVMCloseDialog::ResultCode_PowerOff;320 closeAction = MachineCloseAction_PowerOff; 321 321 } 322 322 … … 328 328 switch (closeAction) 329 329 { 330 case UIVMCloseDialog::ResultCode_Save:330 case MachineCloseAction_Save: 331 331 { 332 332 /* Save VM state: */ … … 334 334 break; 335 335 } 336 case UIVMCloseDialog::ResultCode_Shutdown:336 case MachineCloseAction_Shutdown: 337 337 { 338 338 /* Shutdown VM: */ … … 340 340 break; 341 341 } 342 case UIVMCloseDialog::ResultCode_PowerOff:343 case UIVMCloseDialog::ResultCode_PowerOff_With_Discarding:342 case MachineCloseAction_PowerOff: 343 case MachineCloseAction_PowerOff_Restoring_Snapshot: 344 344 { 345 345 /* Power VM off: */ 346 machineLogic()->powerOff(closeAction == UIVMCloseDialog::ResultCode_PowerOff_With_Discarding);346 machineLogic()->powerOff(closeAction == MachineCloseAction_PowerOff_Restoring_Snapshot); 347 347 break; 348 348 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
r45736 r46698 65 65 66 66 /* static */ 67 UIVMCloseDialog::ResultCodeUIVMCloseDialog::parseResultCode(const QString &strCloseAction)68 { 69 ResultCode resultCode = ResultCode_Cancel;67 MachineCloseAction UIVMCloseDialog::parseResultCode(const QString &strCloseAction) 68 { 69 MachineCloseAction closeAction = MachineCloseAction_Cancel; 70 70 if (!strCloseAction.compare("Save", Qt::CaseInsensitive)) 71 resultCode = ResultCode_Save;71 closeAction = MachineCloseAction_Save; 72 72 else if (!strCloseAction.compare("Shutdown", Qt::CaseInsensitive)) 73 resultCode = ResultCode_Shutdown;73 closeAction = MachineCloseAction_Shutdown; 74 74 else if (!strCloseAction.compare("PowerOff", Qt::CaseInsensitive)) 75 resultCode = ResultCode_PowerOff;76 return resultCode;75 closeAction = MachineCloseAction_PowerOff; 76 return closeAction; 77 77 } 78 78 … … 87 87 /* Calculate result: */ 88 88 if (m_pSaveRadio->isChecked()) 89 setResult( ResultCode_Save);89 setResult(MachineCloseAction_Save); 90 90 else if (m_pShutdownRadio->isChecked()) 91 setResult( ResultCode_Shutdown);91 setResult(MachineCloseAction_Shutdown); 92 92 else if (m_pPowerOffRadio->isChecked()) 93 93 { 94 94 if (!m_pDiscardCheckBox->isChecked() || !m_pDiscardCheckBox->isVisible()) 95 setResult( ResultCode_PowerOff);95 setResult(MachineCloseAction_PowerOff); 96 96 else 97 setResult( ResultCode_PowerOff_With_Discarding);97 setResult(MachineCloseAction_PowerOff_Restoring_Snapshot); 98 98 } 99 99 … … 104 104 switch (result()) 105 105 { 106 case ResultCode_Save:106 case MachineCloseAction_Save: 107 107 { 108 108 strLastAction = m_strExtraDataOptionSave; 109 109 break; 110 110 } 111 case ResultCode_Shutdown:111 case MachineCloseAction_Shutdown: 112 112 { 113 113 strLastAction = m_strExtraDataOptionShutdown; 114 114 break; 115 115 } 116 case ResultCode_PowerOff:116 case MachineCloseAction_PowerOff: 117 117 { 118 118 if (previousChoice[0] == m_strExtraDataOptionShutdown && !m_fIsACPIEnabled) … … 122 122 break; 123 123 } 124 case ResultCode_PowerOff_With_Discarding:124 case MachineCloseAction_PowerOff_Restoring_Snapshot: 125 125 { 126 126 strLastAction = m_strExtraDataOptionPowerOff + "," + -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h
r45736 r46698 21 21 22 22 /* GUI includes: */ 23 #include "QIWithRetranslateUI.h" 23 24 #include "QIDialog.h" 24 #include " QIWithRetranslateUI.h"25 #include "UIDefs.h" 25 26 26 27 /* COM includes: */ … … 41 42 public: 42 43 43 /* Dialog result-code enumerator: */44 enum ResultCode45 {46 ResultCode_Cancel = 0,47 ResultCode_Save,48 ResultCode_Shutdown,49 ResultCode_PowerOff,50 ResultCode_PowerOff_With_Discarding51 };52 53 44 /* Constructor: */ 54 45 UIVMCloseDialog(QWidget *pParent, const CMachine &machine, const CSession &session); … … 58 49 59 50 /* Static API: Parse string containing result-code: */ 60 static ResultCodeparseResultCode(const QString &strCloseAction);51 static MachineCloseAction parseResultCode(const QString &strCloseAction); 61 52 62 53 private slots:
Note:
See TracChangeset
for help on using the changeset viewer.