Changeset 46796 in vbox
- Timestamp:
- Jun 26, 2013 10:58:39 AM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/converter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r46760 r46796 56 56 /* Declare global canConvert specializations: */ 57 57 template<> bool canConvert<StorageSlot>(); 58 template<> bool canConvert<RuntimeMenuType>(); 58 59 template<> bool canConvert<DetailsElementType>(); 59 60 template<> bool canConvert<GlobalSettingsPageType>(); … … 87 88 template<> QString toString(const StorageSlot &storageSlot); 88 89 template<> StorageSlot fromString<StorageSlot>(const QString &strStorageSlot); 90 template<> QString toInternalString(const RuntimeMenuType &runtimeMenuType); 91 template<> RuntimeMenuType fromInternalString<RuntimeMenuType>(const QString &strRuntimeMenuType); 89 92 template<> QString toString(const DetailsElementType &detailsElementType); 90 93 template<> DetailsElementType fromString<DetailsElementType>(const QString &strDetailsElementType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r46761 r46796 32 32 * These functions returns 'true' for all allowed conversions. */ 33 33 template<> bool canConvert<StorageSlot>() { return true; } 34 template<> bool canConvert<RuntimeMenuType>() { return true; } 34 35 template<> bool canConvert<DetailsElementType>() { return true; } 35 36 template<> bool canConvert<GlobalSettingsPageType>() { return true; } … … 264 265 } 265 266 return result; 267 } 268 269 /* QString <= RuntimeMenuType: */ 270 template<> QString toInternalString(const RuntimeMenuType &runtimeMenuType) 271 { 272 QString strResult; 273 switch (runtimeMenuType) 274 { 275 case RuntimeMenuType_Machine: strResult = "Machine"; break; 276 case RuntimeMenuType_View: strResult = "View"; break; 277 case RuntimeMenuType_Devices: strResult = "Devices"; break; 278 case RuntimeMenuType_Debug: strResult = "Debug"; break; 279 case RuntimeMenuType_Help: strResult = "Help"; break; 280 case RuntimeMenuType_All: strResult = "All"; break; 281 default: 282 { 283 AssertMsgFailed(("No text for indicator type=%d", runtimeMenuType)); 284 break; 285 } 286 } 287 return strResult; 288 } 289 290 /* RuntimeMenuType <= QString: */ 291 template<> RuntimeMenuType fromInternalString<RuntimeMenuType>(const QString &strRuntimeMenuType) 292 { 293 /* Here we have some fancy stuff allowing us 294 * to search through the keys using 'case-insensitive' rule: */ 295 QStringList keys; QList<RuntimeMenuType> values; 296 keys << "Machine"; values << RuntimeMenuType_Machine; 297 keys << "View"; values << RuntimeMenuType_View; 298 keys << "Devices"; values << RuntimeMenuType_Devices; 299 keys << "Debug"; values << RuntimeMenuType_Debug; 300 keys << "Help"; values << RuntimeMenuType_Help; 301 keys << "All"; values << RuntimeMenuType_All; 302 /* Invalid type for unknown words: */ 303 if (!keys.contains(strRuntimeMenuType, Qt::CaseInsensitive)) 304 return RuntimeMenuType_Invalid; 305 /* Corresponding type for known words: */ 306 return values.at(keys.indexOf(QRegExp(strRuntimeMenuType, Qt::CaseInsensitive))); 266 307 } 267 308 … … 553 594 return values.at(keys.indexOf(QRegExp(strMachineCloseAction, Qt::CaseInsensitive))); 554 595 } 596
Note:
See TracChangeset
for help on using the changeset viewer.