- Timestamp:
- Jun 20, 2013 11:54:22 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86617
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r46684 r46703 58 58 template<> bool canConvert<DetailsElementType>(); 59 59 template<> bool canConvert<IndicatorType>(); 60 template<> bool canConvert<MachineCloseAction>(); 60 61 61 62 /* Declare COM canConvert specializations: */ … … 90 91 template<> QString toInternalString(const IndicatorType &indicatorType); 91 92 template<> IndicatorType fromInternalString<IndicatorType>(const QString &strIndicatorType); 93 template<> QString toInternalString(const MachineCloseAction &machineCloseAction); 94 template<> MachineCloseAction fromInternalString<MachineCloseAction>(const QString &strMachineCloseAction); 92 95 93 96 /* Declare COM conversion specializations: */ -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r46699 r46703 34 34 template<> bool canConvert<DetailsElementType>() { return true; } 35 35 template<> bool canConvert<IndicatorType>() { return true; } 36 template<> bool canConvert<MachineCloseAction>() { return true; } 36 37 37 38 /* QString <= StorageSlot: */ … … 417 418 } 418 419 420 /* QString <= MachineCloseAction: */ 421 template<> QString toInternalString(const MachineCloseAction &machineCloseAction) 422 { 423 QString strResult; 424 switch (machineCloseAction) 425 { 426 case MachineCloseAction_Save: strResult = "Save"; break; 427 case MachineCloseAction_Shutdown: strResult = "Shutdown"; break; 428 case MachineCloseAction_PowerOff: strResult = "PowerOff"; break; 429 case MachineCloseAction_PowerOff_RestoringSnapshot: strResult = "PowerOffRestoringSnapshot"; break; 430 default: 431 { 432 AssertMsgFailed(("No text for indicator type=%d", machineCloseAction)); 433 break; 434 } 435 } 436 return strResult; 437 } 438 439 /* MachineCloseAction <= QString: */ 440 template<> MachineCloseAction fromInternalString<MachineCloseAction>(const QString &strMachineCloseAction) 441 { 442 QHash<QString, MachineCloseAction> list; 443 list.insert("Save", MachineCloseAction_Save); 444 list.insert("Shutdown", MachineCloseAction_Shutdown); 445 list.insert("PowerOff", MachineCloseAction_PowerOff); 446 list.insert("PowerOffRestoringSnapshot", MachineCloseAction_PowerOff_RestoringSnapshot); 447 if (!list.contains(strMachineCloseAction)) 448 return MachineCloseAction_Invalid; 449 return list.value(strMachineCloseAction); 450 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
r46698 r46703 261 261 enum MachineCloseAction 262 262 { 263 MachineCloseAction_ Cancel,263 MachineCloseAction_Invalid, 264 264 MachineCloseAction_Save, 265 265 MachineCloseAction_Shutdown, 266 266 MachineCloseAction_PowerOff, 267 MachineCloseAction_PowerOff_Restoring _Snapshot,267 MachineCloseAction_PowerOff_RestoringSnapshot, 268 268 MachineCloseAction_Max 269 269 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r46698 r46703 261 261 262 262 /* Choose the close action: */ 263 MachineCloseAction closeAction = MachineCloseAction_ Cancel;263 MachineCloseAction closeAction = MachineCloseAction_Invalid; 264 264 265 265 /* If there IS default close-action defined: */ … … 273 273 if (uisession()->isStuck() && 274 274 closeAction != MachineCloseAction_PowerOff) 275 closeAction = MachineCloseAction_ Cancel;275 closeAction = MachineCloseAction_Invalid; 276 276 /* If the default-action is 'power-off', 277 277 * we should check if its possible to discard machine-state: */ 278 278 if (closeAction == MachineCloseAction_PowerOff && 279 279 machine().GetSnapshotCount() > 0) 280 closeAction = MachineCloseAction_PowerOff_Restoring _Snapshot;280 closeAction = MachineCloseAction_PowerOff_RestoringSnapshot; 281 281 } 282 282 283 283 /* If the close-action still undefined: */ 284 if (closeAction == MachineCloseAction_ Cancel)284 if (closeAction == MachineCloseAction_Invalid) 285 285 { 286 286 /* Prepare close-dialog: */ … … 306 306 * we should resume it if user canceled dialog or chosen shutdown: */ 307 307 if (!fWasPaused && uisession()->isPaused() && 308 (closeAction == MachineCloseAction_ Cancel||308 (closeAction == MachineCloseAction_Invalid || 309 309 closeAction == MachineCloseAction_Shutdown)) 310 310 { 311 311 /* If we unable to resume VM, cancel closing: */ 312 312 if (!uisession()->unpause()) 313 closeAction = MachineCloseAction_ Cancel;313 closeAction = MachineCloseAction_Invalid; 314 314 } 315 315 } … … 341 341 } 342 342 case MachineCloseAction_PowerOff: 343 case MachineCloseAction_PowerOff_Restoring _Snapshot:343 case MachineCloseAction_PowerOff_RestoringSnapshot: 344 344 { 345 345 /* Power VM off: */ 346 machineLogic()->powerOff(closeAction == MachineCloseAction_PowerOff_Restoring _Snapshot);346 machineLogic()->powerOff(closeAction == MachineCloseAction_PowerOff_RestoringSnapshot); 347 347 break; 348 348 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
r46698 r46703 67 67 MachineCloseAction UIVMCloseDialog::parseResultCode(const QString &strCloseAction) 68 68 { 69 MachineCloseAction closeAction = MachineCloseAction_ Cancel;69 MachineCloseAction closeAction = MachineCloseAction_Invalid; 70 70 if (!strCloseAction.compare("Save", Qt::CaseInsensitive)) 71 71 closeAction = MachineCloseAction_Save; … … 95 95 setResult(MachineCloseAction_PowerOff); 96 96 else 97 setResult(MachineCloseAction_PowerOff_Restoring _Snapshot);97 setResult(MachineCloseAction_PowerOff_RestoringSnapshot); 98 98 } 99 99 … … 122 122 break; 123 123 } 124 case MachineCloseAction_PowerOff_Restoring _Snapshot:124 case MachineCloseAction_PowerOff_RestoringSnapshot: 125 125 { 126 126 strLastAction = m_strExtraDataOptionPowerOff + "," +
Note:
See TracChangeset
for help on using the changeset viewer.