Changeset 81612 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 31, 2019 6:20:11 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r81573 r81612 80 80 template<> SHARED_LIBRARY_STUFF bool canConvert<SizeSuffix>(); 81 81 template<> SHARED_LIBRARY_STUFF bool canConvert<StorageSlot>(); 82 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DialogType>(); 82 83 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::MenuType>(); 83 84 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::MenuApplicationActionType>(); … … 104 105 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>(); 105 106 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(); 106 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::RestrictedDialogs>();107 107 template<> SHARED_LIBRARY_STUFF bool canConvert<UIToolType>(); 108 108 template<> SHARED_LIBRARY_STUFF bool canConvert<UIVisualStateType>(); … … 161 161 template<> SHARED_LIBRARY_STUFF QString toString(const StorageSlot &storageSlot); 162 162 template<> SHARED_LIBRARY_STUFF StorageSlot fromString<StorageSlot>(const QString &strStorageSlot); 163 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIExtraDataMetaDefs::DialogType &enmDialogType); 164 template<> SHARED_LIBRARY_STUFF UIExtraDataMetaDefs::DialogType fromInternalString<UIExtraDataMetaDefs::DialogType>(const QString &strDialogType); 163 165 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIExtraDataMetaDefs::MenuType &menuType); 164 166 template<> SHARED_LIBRARY_STUFF UIExtraDataMetaDefs::MenuType fromInternalString<UIExtraDataMetaDefs::MenuType>(const QString &strMenuType); … … 216 218 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription &enmDetailsElementOptionTypeDescription); 217 219 template<> SHARED_LIBRARY_STUFF UIExtraDataMetaDefs::DetailsElementOptionTypeDescription fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(const QString &strDetailsElementOptionTypeDescription); 218 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIExtraDataMetaDefs::RestrictedDialogs &enmRestrictedDialogs);219 template<> SHARED_LIBRARY_STUFF UIExtraDataMetaDefs::RestrictedDialogs fromInternalString<UIExtraDataMetaDefs::RestrictedDialogs>(const QString &strRestrictedDialogs);220 220 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIToolType &enmToolType); 221 221 template<> SHARED_LIBRARY_STUFF UIToolType fromInternalString<UIToolType>(const QString &strToolType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r81563 r81612 34 34 template<> bool canConvert<SizeSuffix>() { return true; } 35 35 template<> bool canConvert<StorageSlot>() { return true; } 36 template<> bool canConvert<UIExtraDataMetaDefs::DialogType>() { return true; } 36 37 template<> bool canConvert<UIExtraDataMetaDefs::MenuType>() { return true; } 37 38 template<> bool canConvert<UIExtraDataMetaDefs::MenuApplicationActionType>() { return true; } … … 58 59 template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>() { return true; } 59 60 template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>() { return true; } 60 template<> bool canConvert<UIExtraDataMetaDefs::RestrictedDialogs>() { return true; }61 61 template<> bool canConvert<UIToolType>() { return true; } 62 62 template<> bool canConvert<UIVisualStateType>() { return true; } … … 380 380 /* Return result: */ 381 381 return result; 382 } 383 384 /* QString <= UIExtraDataMetaDefs::DialogType: */ 385 template<> QString toInternalString(const UIExtraDataMetaDefs::DialogType &enmDialogType) 386 { 387 QString strResult; 388 switch (enmDialogType) 389 { 390 case UIExtraDataMetaDefs::DialogType_VISOCreator: strResult = "VISOCreator"; break; 391 case UIExtraDataMetaDefs::DialogType_All: strResult = "All"; break; 392 default: 393 { 394 AssertMsgFailed(("No text for dialog type=%d", enmDialogType)); 395 break; 396 } 397 } 398 return strResult; 399 } 400 401 /* UIExtraDataMetaDefs::DialogType <= QString: */ 402 template<> UIExtraDataMetaDefs::DialogType fromInternalString<UIExtraDataMetaDefs::DialogType>(const QString &strDialogType) 403 { 404 /* Here we have some fancy stuff allowing us 405 * to search through the keys using 'case-insensitive' rule: */ 406 QStringList keys; QList<UIExtraDataMetaDefs::DialogType> values; 407 keys << "VISOCreator"; values << UIExtraDataMetaDefs::DialogType_VISOCreator; 408 keys << "All"; values << UIExtraDataMetaDefs::DialogType_All; 409 /* Invalid type for unknown words: */ 410 if (!keys.contains(strDialogType, Qt::CaseInsensitive)) 411 return UIExtraDataMetaDefs::DialogType_Invalid; 412 /* Corresponding type for known words: */ 413 return values.at(keys.indexOf(QRegExp(strDialogType, Qt::CaseInsensitive))); 382 414 } 383 415 … … 1455 1487 } 1456 1488 1457 /* QString <= UIExtraDataMetaDefs::RestrictedDialogs: */1458 template<> QString toInternalString(const UIExtraDataMetaDefs::RestrictedDialogs &enmRestrictedDialogs)1459 {1460 QString strResult;1461 switch (enmRestrictedDialogs)1462 {1463 case UIExtraDataMetaDefs::RestrictedDialogs_VISOCreator: strResult = "VISOCreator"; break;1464 case UIExtraDataMetaDefs::RestrictedDialogs_All: strResult = "All"; break;1465 default:1466 {1467 AssertMsgFailed(("No text for details element option type=%d", enmRestrictedDialogs));1468 break;1469 }1470 }1471 return strResult;1472 }1473 1474 /* UIExtraDataMetaDefs::RestrictedDialogs <= QString: */1475 template<> UIExtraDataMetaDefs::RestrictedDialogs fromInternalString<UIExtraDataMetaDefs::RestrictedDialogs>(const QString &strRestrictedDialogs)1476 {1477 /* Here we have some fancy stuff allowing us1478 * to search through the keys using 'case-insensitive' rule: */1479 QStringList keys; QList<UIExtraDataMetaDefs::RestrictedDialogs> values;1480 keys << "VISOCreator"; values << UIExtraDataMetaDefs::RestrictedDialogs_VISOCreator;1481 keys << "All"; values << UIExtraDataMetaDefs::RestrictedDialogs_All;1482 /* Invalid type for unknown words: */1483 if (!keys.contains(strRestrictedDialogs, Qt::CaseInsensitive))1484 return UIExtraDataMetaDefs::RestrictedDialogs_Invalid;1485 /* Corresponding type for known words: */1486 return values.at(keys.indexOf(QRegExp(strRestrictedDialogs, Qt::CaseInsensitive)));1487 }1488 1489 1489 /* UIExtraDataMetaDefs::DetailsElementOptionTypeDescription <= QString: */ 1490 1490 template<> UIExtraDataMetaDefs::DetailsElementOptionTypeDescription fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(const QString &strDetailsElementOptionTypeDescription) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r81563 r81612 22 22 /* General: */ 23 23 const char *UIExtraDataDefs::GUI_EventHandlingType = "GUI/EventHandlingType"; 24 const char *UIExtraDataDefs::GUI_RestrictedDialogs = "GUI/RestrictedDialogs"; 24 25 25 26 … … 239 240 const char *UIExtraDataDefs::GUI_GuestControl_LogViewerVisiblePanels = "GUI/LogViewerVisiblePanels"; 240 241 241 /* Restricted dialogs: */242 const char *UIExtraDataDefs::GUI_RestrictedDialogs = "GUI/RestrictedDialogs";243 244 242 /* Obsolete keys: */ 245 243 QMap<QString, QString> UIExtraDataDefs::prepareObsoleteKeysMap() -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r81563 r81612 46 46 /** Holds event handling type. */ 47 47 SHARED_LIBRARY_STUFF extern const char *GUI_EventHandlingType; 48 49 /** Holds restricted dialogs. */ 50 SHARED_LIBRARY_STUFF extern const char *GUI_RestrictedDialogs; 48 51 /** @} */ 49 52 … … 436 439 /** @} */ 437 440 438 /** @name Restricted dialogs439 * @{ */440 SHARED_LIBRARY_STUFF extern const char *GUI_RestrictedDialogs;441 /** @} */442 443 441 /** @name Old key support stuff. 444 442 * @{ */ … … 473 471 474 472 public: 473 474 /** Common UI: Dialog types. */ 475 enum DialogType 476 { 477 DialogType_Invalid = 0, 478 DialogType_VISOCreator = RT_BIT(0), 479 DialogType_All = 0xFFFF 480 }; 481 Q_ENUM(DialogType); 475 482 476 483 /** Common UI: Menu types. */ … … 778 785 }; 779 786 Q_ENUM(DetailsElementOptionTypeDescription); 780 781 enum RestrictedDialogs782 {783 RestrictedDialogs_Invalid = 0,784 RestrictedDialogs_VISOCreator = RT_BIT(0),785 RestrictedDialogs_All = 0xFFFF786 };787 Q_ENUM(RestrictedDialogs);788 787 }; 789 788 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r81563 r81612 1904 1904 << QString() 1905 1905 << GUI_EventHandlingType 1906 << GUI_RestrictedDialogs 1906 1907 << GUI_SuppressMessages << GUI_InvertMessageOption 1907 1908 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER … … 1990 1991 #endif /* VBOX_WITH_DEBUGGER_GUI */ 1991 1992 << GUI_ExtraDataManager_Geometry << GUI_ExtraDataManager_SplitterHints 1992 << GUI_LogWindowGeometry 1993 << GUI_RestrictedDialogs; 1993 << GUI_LogWindowGeometry; 1994 1994 } 1995 1995 … … 2277 2277 } 2278 2278 2279 UIExtraDataMetaDefs::DialogType UIExtraDataManager::restrictedDialogTypes(const QUuid &uID) 2280 { 2281 /* Prepare result: */ 2282 UIExtraDataMetaDefs::DialogType result = UIExtraDataMetaDefs::DialogType_Invalid; 2283 /* Get restricted runtime-menu-types: */ 2284 foreach (const QString &strValue, extraDataStringList(GUI_RestrictedDialogs, uID)) 2285 { 2286 UIExtraDataMetaDefs::DialogType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::DialogType>(strValue); 2287 if (value != UIExtraDataMetaDefs::DialogType_Invalid) 2288 result = static_cast<UIExtraDataMetaDefs::DialogType>(result | value); 2289 } 2290 /* Return result: */ 2291 return result; 2292 } 2293 2294 void UIExtraDataManager::setRestrictedDialogTypes(UIExtraDataMetaDefs::DialogType dialogs, const QUuid &uID) 2295 { 2296 /* We have MenuType enum registered, so we can enumerate it: */ 2297 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 2298 const int iEnumIndex = smo.indexOfEnumerator("DialogType"); 2299 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 2300 2301 /* Prepare result: */ 2302 QStringList result; 2303 /* Handle DialogType_All enum-value: */ 2304 if (dialogs == UIExtraDataMetaDefs::DialogType_All) 2305 result << gpConverter->toInternalString(dialogs); 2306 else 2307 { 2308 /* Handle other enum-values: */ 2309 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 2310 { 2311 /* Get iterated enum-value: */ 2312 const UIExtraDataMetaDefs::DialogType enumValue = 2313 static_cast<UIExtraDataMetaDefs::DialogType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 2314 /* Skip DialogType_Invalid & DialogType_All enum-values: */ 2315 if (enumValue == UIExtraDataMetaDefs::DialogType_Invalid || 2316 enumValue == UIExtraDataMetaDefs::DialogType_All) 2317 continue; 2318 if (dialogs & enumValue) 2319 result << gpConverter->toInternalString(enumValue); 2320 } 2321 } 2322 /* Save result: */ 2323 setExtraDataStringList(GUI_RestrictedDialogs, result, uID); 2324 } 2325 2279 2326 QStringList UIExtraDataManager::suppressedMessages(const QUuid &uID /* = GlobalID */) 2280 2327 { … … 4518 4565 { 4519 4566 return extraDataStringList(GUI_GuestControl_LogViewerVisiblePanels); 4520 }4521 4522 UIExtraDataMetaDefs::RestrictedDialogs UIExtraDataManager::restrictedDialogs(const QUuid &uID)4523 {4524 UIExtraDataMetaDefs::RestrictedDialogs result = UIExtraDataMetaDefs::RestrictedDialogs_Invalid;4525 foreach (const QString &strValue, extraDataStringList(GUI_RestrictedDialogs, uID))4526 {4527 UIExtraDataMetaDefs::RestrictedDialogs value =4528 gpConverter->fromInternalString<UIExtraDataMetaDefs::RestrictedDialogs>(strValue);4529 if (value != UIExtraDataMetaDefs::RestrictedDialogs_Invalid)4530 result = static_cast<UIExtraDataMetaDefs::RestrictedDialogs>(result | value);4531 }4532 return result;4533 }4534 4535 void UIExtraDataManager::setRestrictedDialogs(UIExtraDataMetaDefs::RestrictedDialogs dialogs, const QUuid &uID)4536 {4537 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;4538 const int iEnumIndex = smo.indexOfEnumerator("RestrictedDialogs");4539 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);4540 4541 QStringList result;4542 if (dialogs == UIExtraDataMetaDefs::RestrictedDialogs_All)4543 result << gpConverter->toInternalString(dialogs);4544 else4545 {4546 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)4547 {4548 const UIExtraDataMetaDefs::RestrictedDialogs enumValue =4549 static_cast<UIExtraDataMetaDefs::RestrictedDialogs>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));4550 if (enumValue == UIExtraDataMetaDefs::RestrictedDialogs_Invalid ||4551 enumValue == UIExtraDataMetaDefs::RestrictedDialogs_All)4552 continue;4553 if (dialogs & enumValue)4554 result << gpConverter->toInternalString(enumValue);4555 }4556 }4557 setExtraDataStringList(GUI_RestrictedDialogs, result, uID);4558 4567 } 4559 4568 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r81563 r81612 149 149 /** Returns event handling type. */ 150 150 EventHandlingType eventHandlingType(); 151 152 /** Returns a list of restricted dialogs. */ 153 UIExtraDataMetaDefs::DialogType restrictedDialogTypes(const QUuid &uID); 154 /** Defines a list of restricted dialogs. */ 155 void setRestrictedDialogTypes(UIExtraDataMetaDefs::DialogType enmTypes, const QUuid &uID); 151 156 /** @} */ 152 157 … … 750 755 void setLogViewerVisiblePanels(const QStringList &panelNameList); 751 756 QStringList logViewerVisiblePanels(); 752 /** @} */753 754 /** @name Restricted Dialogs755 * @{ */756 /** Returns a list of restricted dialogs. */757 UIExtraDataMetaDefs::RestrictedDialogs restrictedDialogs(const QUuid &uID);758 /** Defines restricted Runtime UI menu types. */759 void setRestrictedDialogs(UIExtraDataMetaDefs::RestrictedDialogs types, const QUuid &uID);760 757 /** @} */ 761 758 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
r81563 r81612 225 225 226 226 m_pToolBar->addAction(m_pActionAdd); 227 if (!(gEDataManager->restrictedDialog s(m_uMachineID) & UIExtraDataMetaDefs::RestrictedDialogs_VISOCreator))227 if (!(gEDataManager->restrictedDialogTypes(m_uMachineID) & UIExtraDataMetaDefs::DialogType_VISOCreator)) 228 228 m_pToolBar->addAction(m_pActionCreate); 229 229 m_pToolBar->addSeparator();
Note:
See TracChangeset
for help on using the changeset viewer.