Changeset 51021 in vbox
- Timestamp:
- Apr 9, 2014 4:48:49 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r50041 r51021 77 77 template<> bool canConvert<IndicatorType>(); 78 78 template<> bool canConvert<MachineCloseAction>(); 79 template<> bool canConvert<GuruMeditationHandlerType>(); 79 80 80 81 /* Declare COM canConvert specializations: */ … … 140 141 template<> QString toInternalString(const MachineCloseAction &machineCloseAction); 141 142 template<> MachineCloseAction fromInternalString<MachineCloseAction>(const QString &strMachineCloseAction); 143 template<> QString toInternalString(const GuruMeditationHandlerType &guruMeditationHandlerType); 144 template<> GuruMeditationHandlerType fromInternalString<GuruMeditationHandlerType>(const QString &strGuruMeditationHandlerType); 142 145 143 146 /* Declare COM conversion specializations: */ -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r50849 r51021 50 50 template<> bool canConvert<IndicatorType>() { return true; } 51 51 template<> bool canConvert<MachineCloseAction>() { return true; } 52 template<> bool canConvert<GuruMeditationHandlerType>() { return true; } 52 53 53 54 /* QString <= SizeSuffix: */ … … 1045 1046 } 1046 1047 1048 /* QString <= GuruMeditationHandlerType: */ 1049 template<> QString toInternalString(const GuruMeditationHandlerType &guruMeditationHandlerType) 1050 { 1051 QString strResult; 1052 switch (guruMeditationHandlerType) 1053 { 1054 case GuruMeditationHandlerType_Default: strResult = "Default"; break; 1055 case GuruMeditationHandlerType_PowerOff: strResult = "PowerOff"; break; 1056 case GuruMeditationHandlerType_Ignore: strResult = "Ignore"; break; 1057 default: 1058 { 1059 AssertMsgFailed(("No text for indicator type=%d", guruMeditationHandlerType)); 1060 break; 1061 } 1062 } 1063 return strResult; 1064 } 1065 1066 /* GuruMeditationHandlerType <= QString: */ 1067 template<> GuruMeditationHandlerType fromInternalString<GuruMeditationHandlerType>(const QString &strGuruMeditationHandlerType) 1068 { 1069 /* Here we have some fancy stuff allowing us 1070 * to search through the keys using 'case-insensitive' rule: */ 1071 QStringList keys; QList<GuruMeditationHandlerType> values; 1072 keys << "Default"; values << GuruMeditationHandlerType_Default; 1073 keys << "PowerOff"; values << GuruMeditationHandlerType_PowerOff; 1074 keys << "Ignore"; values << GuruMeditationHandlerType_Ignore; 1075 /* Default type for unknown words: */ 1076 if (!keys.contains(strGuruMeditationHandlerType, Qt::CaseInsensitive)) 1077 return GuruMeditationHandlerType_Default; 1078 /* Corresponding type for known words: */ 1079 return values.at(keys.indexOf(QRegExp(strGuruMeditationHandlerType, Qt::CaseInsensitive))); 1080 } 1081 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
r51004 r51021 83 83 const char* UIDefs::GUI_RestrictedStatusBarIndicators = "GUI/RestrictedStatusBarIndicators"; 84 84 const char* UIDefs::GUI_HidLedsSync = "GUI/HidLedsSync"; 85 const char* UIDefs::GUI_GuruMeditationHandler = "GUI/GuruMeditationHandler"; 85 86 86 87 /* Settings dialogs stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
r51004 r51021 152 152 extern const char* GUI_RestrictedStatusBarIndicators; 153 153 extern const char* GUI_HidLedsSync; 154 extern const char* GUI_GuruMeditationHandler; 154 155 155 156 /* Settings dialogs stuff: */ … … 473 474 Q_DECLARE_METATYPE(MachineCloseAction); 474 475 476 /** Guru Meditation handler types. */ 477 enum GuruMeditationHandlerType 478 { 479 GuruMeditationHandlerType_Default, 480 GuruMeditationHandlerType_PowerOff, 481 GuruMeditationHandlerType_Ignore 482 }; 483 475 484 #endif /* !___UIDefs_h___ */ 476 485 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r51004 r51021 4093 4093 #endif /* !Q_WS_MAC */ 4094 4094 4095 /* static */ 4096 GuruMeditationHandlerType VBoxGlobal::guruMeditationHandlerType(CMachine &machine) 4097 { 4098 /* Return result: */ 4099 return gpConverter->fromInternalString<GuruMeditationHandlerType>(machine.GetExtraData(GUI_GuruMeditationHandler)); 4100 } 4101 4095 4102 #ifdef RT_OS_LINUX 4096 4103 /* static */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r51004 r51021 401 401 static QStringList machineWindowIconNames(CMachine &machine); 402 402 #endif /* !Q_WS_MAC */ 403 /** Loads redefined guru-meditation handler type. */ 404 static GuruMeditationHandlerType guruMeditationHandlerType(CMachine &machine); 403 405 404 406 #ifdef RT_OS_LINUX -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r50943 r51021 414 414 /* Take the screenshot for debugging purposes: */ 415 415 takeScreenshot(strLogFolder + "/VBox.png", "png"); 416 /* Warn the user about GURU meditation: */ 417 if (msgCenter().remindAboutGuruMeditation(QDir::toNativeSeparators(strLogFolder))) 418 powerOff(false /* do NOT restore current snapshot */); 416 /* How should we handle Guru Meditation? */ 417 switch (uisession()->guruMeditationHandlerType()) 418 { 419 /* Ask how to proceed; Power off VM if proposal accepted: */ 420 case GuruMeditationHandlerType_Default: 421 { 422 if (msgCenter().remindAboutGuruMeditation(QDir::toNativeSeparators(strLogFolder))) 423 powerOff(false /* do NOT restore current snapshot */); 424 break; 425 } 426 /* Power off VM silently: */ 427 case GuruMeditationHandlerType_PowerOff: 428 { 429 powerOff(false /* do NOT restore current snapshot */); 430 break; 431 } 432 /* Just ignore it: */ 433 case GuruMeditationHandlerType_Ignore: 434 default: 435 break; 436 } 419 437 break; 420 438 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r51004 r51021 133 133 , m_pMachineWindowIcon(0) 134 134 #endif /* !Q_WS_MAC */ 135 , m_guruMeditationHandlerType(GuruMeditationHandlerType_Default) 135 136 , m_fIsExtensionPackUsable(false) 136 137 , m_requestedVisualStateType(UIVisualStateType_Invalid) … … 1130 1131 #endif /* !Q_WS_MAC */ 1131 1132 1133 /* Determine Guru Meditation handler type: */ 1134 m_guruMeditationHandlerType = VBoxGlobal::guruMeditationHandlerType(machine); 1135 1132 1136 /* Is there should be First RUN Wizard? */ 1133 1137 strSettings = machine.GetExtraData(GUI_FirstRun); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r51004 r51021 105 105 #endif /* !Q_WS_MAC */ 106 106 107 /** @name Runtime workflow stuff. 108 ** @{ */ 109 /** Returns Guru Meditation handler type. */ 110 GuruMeditationHandlerType guruMeditationHandlerType() const { return m_guruMeditationHandlerType; } 111 /** @} */ 112 107 113 /** @name Extension Pack stuff. 108 114 ** @{ */ … … 349 355 #endif /* !Q_WS_MAC */ 350 356 357 /** @name Runtime workflow variables. 358 ** @{ */ 359 /** Holds Guru Meditation handler type. */ 360 GuruMeditationHandlerType m_guruMeditationHandlerType; 361 /** @} */ 362 351 363 /** @name Extension Pack variables. 352 364 ** @{ */
Note:
See TracChangeset
for help on using the changeset viewer.