Changeset 52583 in vbox
- Timestamp:
- Sep 3, 2014 1:15:23 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r52459 r52583 70 70 template<> bool canConvert<SizeSuffix>(); 71 71 template<> bool canConvert<StorageSlot>(); 72 template<> bool canConvert<UIExtraDataMetaDefs::Menu HelpActionType>();72 template<> bool canConvert<UIExtraDataMetaDefs::MenuType>(); 73 73 #ifdef Q_WS_MAC 74 74 template<> bool canConvert<UIExtraDataMetaDefs::MenuApplicationActionType>(); 75 75 #endif /* Q_WS_MAC */ 76 template<> bool canConvert<UIExtraDataMetaDefs:: RuntimeMenuType>();76 template<> bool canConvert<UIExtraDataMetaDefs::MenuHelpActionType>(); 77 77 template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(); 78 78 template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(); … … 123 123 template<> QString toString(const StorageSlot &storageSlot); 124 124 template<> StorageSlot fromString<StorageSlot>(const QString &strStorageSlot); 125 template<> QString toInternalString(const UIExtraDataMetaDefs::Menu HelpActionType &menuHelpActionType);126 template<> UIExtraDataMetaDefs::Menu HelpActionType fromInternalString<UIExtraDataMetaDefs::MenuHelpActionType>(const QString &strMenuHelpActionType);125 template<> QString toInternalString(const UIExtraDataMetaDefs::MenuType &menuType); 126 template<> UIExtraDataMetaDefs::MenuType fromInternalString<UIExtraDataMetaDefs::MenuType>(const QString &strMenuType); 127 127 #ifdef Q_WS_MAC 128 128 template<> QString toInternalString(const UIExtraDataMetaDefs::MenuApplicationActionType &runtimeMenuApplicationActionType); 129 129 template<> UIExtraDataMetaDefs::MenuApplicationActionType fromInternalString<UIExtraDataMetaDefs::MenuApplicationActionType>(const QString &strRuntimeMenuApplicationActionType); 130 130 #endif /* Q_WS_MAC */ 131 template<> QString toInternalString(const UIExtraDataMetaDefs:: RuntimeMenuType &runtimeMenuType);132 template<> UIExtraDataMetaDefs:: RuntimeMenuType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuType>(const QString &strRuntimeMenuType);131 template<> QString toInternalString(const UIExtraDataMetaDefs::MenuHelpActionType &menuHelpActionType); 132 template<> UIExtraDataMetaDefs::MenuHelpActionType fromInternalString<UIExtraDataMetaDefs::MenuHelpActionType>(const QString &strMenuHelpActionType); 133 133 template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuMachineActionType &runtimeMenuMachineActionType); 134 134 template<> UIExtraDataMetaDefs::RuntimeMenuMachineActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(const QString &strRuntimeMenuMachineActionType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r52557 r52583 34 34 template<> bool canConvert<SizeSuffix>() { return true; } 35 35 template<> bool canConvert<StorageSlot>() { return true; } 36 template<> bool canConvert<UIExtraDataMetaDefs::Menu HelpActionType>() { return true; }36 template<> bool canConvert<UIExtraDataMetaDefs::MenuType>() { return true; } 37 37 #ifdef Q_WS_MAC 38 38 template<> bool canConvert<UIExtraDataMetaDefs::MenuApplicationActionType>() { return true; } 39 39 #endif /* Q_WS_MAC */ 40 template<> bool canConvert<UIExtraDataMetaDefs:: RuntimeMenuType>() { return true; }40 template<> bool canConvert<UIExtraDataMetaDefs::MenuHelpActionType>() { return true; } 41 41 template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>() { return true; } 42 42 template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuViewActionType>() { return true; } … … 357 357 } 358 358 359 /* QString <= UIExtraDataMetaDefs::MenuType: */ 360 template<> QString toInternalString(const UIExtraDataMetaDefs::MenuType &menuType) 361 { 362 QString strResult; 363 switch (menuType) 364 { 365 #ifdef RT_OS_DARWIN 366 case UIExtraDataMetaDefs::MenuType_Application: strResult = "Application"; break; 367 #endif /* RT_OS_DARWIN */ 368 case UIExtraDataMetaDefs::MenuType_Machine: strResult = "Machine"; break; 369 case UIExtraDataMetaDefs::MenuType_View: strResult = "View"; break; 370 case UIExtraDataMetaDefs::MenuType_Devices: strResult = "Devices"; break; 371 #ifdef VBOX_WITH_DEBUGGER_GUI 372 case UIExtraDataMetaDefs::MenuType_Debug: strResult = "Debug"; break; 373 #endif /* VBOX_WITH_DEBUGGER_GUI */ 374 case UIExtraDataMetaDefs::MenuType_Help: strResult = "Help"; break; 375 case UIExtraDataMetaDefs::MenuType_All: strResult = "All"; break; 376 default: 377 { 378 AssertMsgFailed(("No text for indicator type=%d", menuType)); 379 break; 380 } 381 } 382 return strResult; 383 } 384 385 /* UIExtraDataMetaDefs::MenuType <= QString: */ 386 template<> UIExtraDataMetaDefs::MenuType fromInternalString<UIExtraDataMetaDefs::MenuType>(const QString &strMenuType) 387 { 388 /* Here we have some fancy stuff allowing us 389 * to search through the keys using 'case-insensitive' rule: */ 390 QStringList keys; QList<UIExtraDataMetaDefs::MenuType> values; 391 #ifdef RT_OS_DARWIN 392 keys << "Application"; values << UIExtraDataMetaDefs::MenuType_Application; 393 #endif /* RT_OS_DARWIN */ 394 keys << "Machine"; values << UIExtraDataMetaDefs::MenuType_Machine; 395 keys << "View"; values << UIExtraDataMetaDefs::MenuType_View; 396 keys << "Devices"; values << UIExtraDataMetaDefs::MenuType_Devices; 397 #ifdef VBOX_WITH_DEBUGGER_GUI 398 keys << "Debug"; values << UIExtraDataMetaDefs::MenuType_Debug; 399 #endif /* VBOX_WITH_DEBUGGER_GUI */ 400 keys << "Help"; values << UIExtraDataMetaDefs::MenuType_Help; 401 keys << "All"; values << UIExtraDataMetaDefs::MenuType_All; 402 /* Invalid type for unknown words: */ 403 if (!keys.contains(strMenuType, Qt::CaseInsensitive)) 404 return UIExtraDataMetaDefs::MenuType_Invalid; 405 /* Corresponding type for known words: */ 406 return values.at(keys.indexOf(QRegExp(strMenuType, Qt::CaseInsensitive))); 407 } 408 409 #ifdef Q_WS_MAC 410 /* QString <= UIExtraDataMetaDefs::MenuApplicationActionType: */ 411 template<> QString toInternalString(const UIExtraDataMetaDefs::MenuApplicationActionType &runtimeMenuApplicationActionType) 412 { 413 QString strResult; 414 switch (runtimeMenuApplicationActionType) 415 { 416 case UIExtraDataMetaDefs::MenuApplicationActionType_About: strResult = "About"; break; 417 case UIExtraDataMetaDefs::MenuApplicationActionType_Preferences: strResult = "Preferences"; break; 418 case UIExtraDataMetaDefs::MenuApplicationActionType_Close: strResult = "Close"; break; 419 case UIExtraDataMetaDefs::MenuApplicationActionType_All: strResult = "All"; break; 420 default: 421 { 422 AssertMsgFailed(("No text for action type=%d", runtimeMenuApplicationActionType)); 423 break; 424 } 425 } 426 return strResult; 427 } 428 429 /* UIExtraDataMetaDefs::MenuApplicationActionType <= QString: */ 430 template<> UIExtraDataMetaDefs::MenuApplicationActionType fromInternalString<UIExtraDataMetaDefs::MenuApplicationActionType>(const QString &strRuntimeMenuApplicationActionType) 431 { 432 /* Here we have some fancy stuff allowing us 433 * to search through the keys using 'case-insensitive' rule: */ 434 QStringList keys; QList<UIExtraDataMetaDefs::MenuApplicationActionType> values; 435 keys << "About"; values << UIExtraDataMetaDefs::MenuApplicationActionType_About; 436 keys << "Preferences"; values << UIExtraDataMetaDefs::MenuApplicationActionType_Preferences; 437 keys << "Close"; values << UIExtraDataMetaDefs::MenuApplicationActionType_Close; 438 keys << "All"; values << UIExtraDataMetaDefs::MenuApplicationActionType_All; 439 /* Invalid type for unknown words: */ 440 if (!keys.contains(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive)) 441 return UIExtraDataMetaDefs::MenuApplicationActionType_Invalid; 442 /* Corresponding type for known words: */ 443 return values.at(keys.indexOf(QRegExp(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive))); 444 } 445 #endif /* Q_WS_MAC */ 446 359 447 /* QString <= UIExtraDataMetaDefs::MenuHelpActionType: */ 360 448 template<> QString toInternalString(const UIExtraDataMetaDefs::MenuHelpActionType &menuHelpActionType) … … 407 495 /* Corresponding type for known words: */ 408 496 return values.at(keys.indexOf(QRegExp(strMenuHelpActionType, Qt::CaseInsensitive))); 409 }410 411 #ifdef Q_WS_MAC412 /* QString <= UIExtraDataMetaDefs::MenuApplicationActionType: */413 template<> QString toInternalString(const UIExtraDataMetaDefs::MenuApplicationActionType &runtimeMenuApplicationActionType)414 {415 QString strResult;416 switch (runtimeMenuApplicationActionType)417 {418 case UIExtraDataMetaDefs::MenuApplicationActionType_About: strResult = "About"; break;419 case UIExtraDataMetaDefs::MenuApplicationActionType_Preferences: strResult = "Preferences"; break;420 case UIExtraDataMetaDefs::MenuApplicationActionType_Close: strResult = "Close"; break;421 case UIExtraDataMetaDefs::MenuApplicationActionType_All: strResult = "All"; break;422 default:423 {424 AssertMsgFailed(("No text for action type=%d", runtimeMenuApplicationActionType));425 break;426 }427 }428 return strResult;429 }430 431 /* UIExtraDataMetaDefs::MenuApplicationActionType <= QString: */432 template<> UIExtraDataMetaDefs::MenuApplicationActionType fromInternalString<UIExtraDataMetaDefs::MenuApplicationActionType>(const QString &strRuntimeMenuApplicationActionType)433 {434 /* Here we have some fancy stuff allowing us435 * to search through the keys using 'case-insensitive' rule: */436 QStringList keys; QList<UIExtraDataMetaDefs::MenuApplicationActionType> values;437 keys << "About"; values << UIExtraDataMetaDefs::MenuApplicationActionType_About;438 keys << "Preferences"; values << UIExtraDataMetaDefs::MenuApplicationActionType_Preferences;439 keys << "Close"; values << UIExtraDataMetaDefs::MenuApplicationActionType_Close;440 keys << "All"; values << UIExtraDataMetaDefs::MenuApplicationActionType_All;441 /* Invalid type for unknown words: */442 if (!keys.contains(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive))443 return UIExtraDataMetaDefs::MenuApplicationActionType_Invalid;444 /* Corresponding type for known words: */445 return values.at(keys.indexOf(QRegExp(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive)));446 }447 #endif /* Q_WS_MAC */448 449 /* QString <= UIExtraDataMetaDefs::RuntimeMenuType: */450 template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuType &runtimeMenuType)451 {452 QString strResult;453 switch (runtimeMenuType)454 {455 #ifdef RT_OS_DARWIN456 case UIExtraDataMetaDefs::RuntimeMenuType_Application: strResult = "Application"; break;457 #endif /* RT_OS_DARWIN */458 case UIExtraDataMetaDefs::RuntimeMenuType_Machine: strResult = "Machine"; break;459 case UIExtraDataMetaDefs::RuntimeMenuType_View: strResult = "View"; break;460 case UIExtraDataMetaDefs::RuntimeMenuType_Devices: strResult = "Devices"; break;461 #ifdef VBOX_WITH_DEBUGGER_GUI462 case UIExtraDataMetaDefs::RuntimeMenuType_Debug: strResult = "Debug"; break;463 #endif /* VBOX_WITH_DEBUGGER_GUI */464 case UIExtraDataMetaDefs::RuntimeMenuType_Help: strResult = "Help"; break;465 case UIExtraDataMetaDefs::RuntimeMenuType_All: strResult = "All"; break;466 default:467 {468 AssertMsgFailed(("No text for indicator type=%d", runtimeMenuType));469 break;470 }471 }472 return strResult;473 }474 475 /* UIExtraDataMetaDefs::RuntimeMenuType <= QString: */476 template<> UIExtraDataMetaDefs::RuntimeMenuType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuType>(const QString &strRuntimeMenuType)477 {478 /* Here we have some fancy stuff allowing us479 * to search through the keys using 'case-insensitive' rule: */480 QStringList keys; QList<UIExtraDataMetaDefs::RuntimeMenuType> values;481 #ifdef RT_OS_DARWIN482 keys << "Application"; values << UIExtraDataMetaDefs::RuntimeMenuType_Application;483 #endif /* RT_OS_DARWIN */484 keys << "Machine"; values << UIExtraDataMetaDefs::RuntimeMenuType_Machine;485 keys << "View"; values << UIExtraDataMetaDefs::RuntimeMenuType_View;486 keys << "Devices"; values << UIExtraDataMetaDefs::RuntimeMenuType_Devices;487 #ifdef VBOX_WITH_DEBUGGER_GUI488 keys << "Debug"; values << UIExtraDataMetaDefs::RuntimeMenuType_Debug;489 #endif /* VBOX_WITH_DEBUGGER_GUI */490 keys << "Help"; values << UIExtraDataMetaDefs::RuntimeMenuType_Help;491 keys << "All"; values << UIExtraDataMetaDefs::RuntimeMenuType_All;492 /* Invalid type for unknown words: */493 if (!keys.contains(strRuntimeMenuType, Qt::CaseInsensitive))494 return UIExtraDataMetaDefs::RuntimeMenuType_Invalid;495 /* Corresponding type for known words: */496 return values.at(keys.indexOf(QRegExp(strRuntimeMenuType, Qt::CaseInsensitive)));497 497 } 498 498 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r52557 r52583 268 268 { 269 269 Q_OBJECT; 270 Q_ENUMS(Menu HelpActionType);270 Q_ENUMS(MenuType); 271 271 #ifdef RT_OS_DARWIN 272 272 Q_ENUMS(MenuApplicationActionType); 273 273 #endif /* RT_OS_DARWIN */ 274 Q_ENUMS( RuntimeMenuType);274 Q_ENUMS(MenuHelpActionType); 275 275 Q_ENUMS(RuntimeMenuMachineActionType); 276 276 Q_ENUMS(RuntimeMenuViewActionType); … … 281 281 282 282 public: 283 284 /** Common UI: Menu types. */ 285 enum MenuType 286 { 287 MenuType_Invalid = 0, 288 #ifdef RT_OS_DARWIN 289 MenuType_Application = RT_BIT(0), 290 #endif /* RT_OS_DARWIN */ 291 MenuType_Machine = RT_BIT(1), 292 MenuType_View = RT_BIT(2), 293 MenuType_Devices = RT_BIT(3), 294 #ifdef VBOX_WITH_DEBUGGER_GUI 295 MenuType_Debug = RT_BIT(4), 296 #endif /* VBOX_WITH_DEBUGGER_GUI */ 297 MenuType_Help = RT_BIT(5), 298 MenuType_All = 0xFF 299 }; 300 301 #ifdef RT_OS_DARWIN 302 /** Menu "Application": Action types. */ 303 enum MenuApplicationActionType 304 { 305 MenuApplicationActionType_Invalid = 0, 306 MenuApplicationActionType_About = RT_BIT(0), 307 MenuApplicationActionType_Preferences = RT_BIT(1), 308 MenuApplicationActionType_Close = RT_BIT(2), 309 MenuApplicationActionType_All = 0xFFFF 310 }; 311 #endif /* RT_OS_DARWIN */ 283 312 284 313 /** Menu "Help": Action types. */ … … 298 327 #endif /* !RT_OS_DARWIN */ 299 328 MenuHelpActionType_All = 0xFFFF 300 };301 302 #ifdef RT_OS_DARWIN303 /** Menu "Application": Action types. */304 enum MenuApplicationActionType305 {306 MenuApplicationActionType_Invalid = 0,307 MenuApplicationActionType_About = RT_BIT(0),308 MenuApplicationActionType_Preferences = RT_BIT(1),309 MenuApplicationActionType_Close = RT_BIT(2),310 MenuApplicationActionType_All = 0xFFFF311 };312 #endif /* RT_OS_DARWIN */313 314 /** Runtime UI: Menu types. */315 enum RuntimeMenuType316 {317 RuntimeMenuType_Invalid = 0,318 #ifdef RT_OS_DARWIN319 RuntimeMenuType_Application = RT_BIT(0),320 #endif /* RT_OS_DARWIN */321 RuntimeMenuType_Machine = RT_BIT(1),322 RuntimeMenuType_View = RT_BIT(2),323 RuntimeMenuType_Devices = RT_BIT(3),324 #ifdef VBOX_WITH_DEBUGGER_GUI325 RuntimeMenuType_Debug = RT_BIT(4),326 #endif /* VBOX_WITH_DEBUGGER_GUI */327 RuntimeMenuType_Help = RT_BIT(5),328 RuntimeMenuType_All = 0xFF329 329 }; 330 330 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r52556 r52583 2489 2489 } 2490 2490 2491 UIExtraDataMetaDefs:: RuntimeMenuType UIExtraDataManager::restrictedRuntimeMenuTypes(const QString &strID)2491 UIExtraDataMetaDefs::MenuType UIExtraDataManager::restrictedRuntimeMenuTypes(const QString &strID) 2492 2492 { 2493 2493 /* Prepare result: */ 2494 UIExtraDataMetaDefs:: RuntimeMenuType result = UIExtraDataMetaDefs::RuntimeMenuType_Invalid;2494 UIExtraDataMetaDefs::MenuType result = UIExtraDataMetaDefs::MenuType_Invalid; 2495 2495 /* Get restricted runtime-menu-types: */ 2496 2496 foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeMenus, strID)) 2497 2497 { 2498 UIExtraDataMetaDefs:: RuntimeMenuType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::RuntimeMenuType>(strValue);2499 if (value != UIExtraDataMetaDefs:: RuntimeMenuType_Invalid)2500 result = static_cast<UIExtraDataMetaDefs:: RuntimeMenuType>(result | value);2498 UIExtraDataMetaDefs::MenuType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::MenuType>(strValue); 2499 if (value != UIExtraDataMetaDefs::MenuType_Invalid) 2500 result = static_cast<UIExtraDataMetaDefs::MenuType>(result | value); 2501 2501 } 2502 2502 /* Return result: */ … … 2504 2504 } 2505 2505 2506 void UIExtraDataManager::setRestrictedRuntimeMenuTypes(UIExtraDataMetaDefs:: RuntimeMenuType types, const QString &strID)2507 { 2508 /* We have RuntimeMenuType enum registered, so we can enumerate it: */2506 void UIExtraDataManager::setRestrictedRuntimeMenuTypes(UIExtraDataMetaDefs::MenuType types, const QString &strID) 2507 { 2508 /* We have MenuType enum registered, so we can enumerate it: */ 2509 2509 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 2510 const int iEnumIndex = smo.indexOfEnumerator(" RuntimeMenuType");2510 const int iEnumIndex = smo.indexOfEnumerator("MenuType"); 2511 2511 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 2512 2512 2513 2513 /* Prepare result: */ 2514 2514 QStringList result; 2515 /* Handle RuntimeMenuType_All enum-value: */2516 if (types == UIExtraDataMetaDefs:: RuntimeMenuType_All)2515 /* Handle MenuType_All enum-value: */ 2516 if (types == UIExtraDataMetaDefs::MenuType_All) 2517 2517 result << gpConverter->toInternalString(types); 2518 2518 else … … 2522 2522 { 2523 2523 /* Get iterated enum-value: */ 2524 const UIExtraDataMetaDefs:: RuntimeMenuType enumValue =2525 static_cast<const UIExtraDataMetaDefs:: RuntimeMenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));2526 /* Skip RuntimeMenuType_Invalid & RuntimeMenuType_All enum-values: */2527 if (enumValue == UIExtraDataMetaDefs:: RuntimeMenuType_Invalid ||2528 enumValue == UIExtraDataMetaDefs:: RuntimeMenuType_All)2524 const UIExtraDataMetaDefs::MenuType enumValue = 2525 static_cast<const UIExtraDataMetaDefs::MenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 2526 /* Skip MenuType_Invalid & MenuType_All enum-values: */ 2527 if (enumValue == UIExtraDataMetaDefs::MenuType_Invalid || 2528 enumValue == UIExtraDataMetaDefs::MenuType_All) 2529 2529 continue; 2530 2530 if (types & enumValue) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r52556 r52583 287 287 288 288 /** Returns restricted Runtime UI menu types. */ 289 UIExtraDataMetaDefs:: RuntimeMenuType restrictedRuntimeMenuTypes(const QString &strID);289 UIExtraDataMetaDefs::MenuType restrictedRuntimeMenuTypes(const QString &strID); 290 290 /** Defines restricted Runtime UI menu types. */ 291 void setRestrictedRuntimeMenuTypes(UIExtraDataMetaDefs:: RuntimeMenuType types, const QString &strID);291 void setRestrictedRuntimeMenuTypes(UIExtraDataMetaDefs::MenuType types, const QString &strID); 292 292 293 293 #ifdef Q_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r52579 r52583 326 326 327 327 /** Returns action extra-data ID. */ 328 virtual int extraDataID() const { return UIExtraDataMetaDefs:: RuntimeMenuType_Application; }328 virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Application; } 329 329 /** Returns action extra-data key. */ 330 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs:: RuntimeMenuType_Application); }330 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Application); } 331 331 332 332 void retranslateUi() … … 388 388 389 389 /** Returns action extra-data ID. */ 390 virtual int extraDataID() const { return UIExtraDataMetaDefs:: RuntimeMenuType_Help; }390 virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Help; } 391 391 /** Returns action extra-data key. */ 392 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs:: RuntimeMenuType_Help); }392 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Help); } 393 393 394 394 void retranslateUi() … … 724 724 } 725 725 726 bool UIActionPool::isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType type) const 727 { 728 foreach (const UIExtraDataMetaDefs::MenuType &restriction, m_restrictedMenus.values()) 729 if (restriction & type) 730 return false; 731 return true; 732 } 733 734 void UIActionPool::setRestrictionForMenuBar(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuType restriction) 735 { 736 m_restrictedMenus[level] = restriction; 737 updateMenus(); 738 } 739 740 #ifdef Q_WS_MAC 741 bool UIActionPool::isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType type) const 742 { 743 foreach (const UIExtraDataMetaDefs::MenuApplicationActionType &restriction, m_restrictedActionsMenuApplication.values()) 744 if (restriction & type) 745 return false; 746 return true; 747 } 748 749 void UIActionPool::setRestrictionForMenuApplication(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuApplicationActionType restriction) 750 { 751 m_restrictedActionsMenuApplication[level] = restriction; 752 m_invalidations << UIActionIndex_M_Application; 753 } 754 #endif /* Q_WS_MAC */ 755 726 756 bool UIActionPool::isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType type) const 727 757 { … … 737 767 m_invalidations << UIActionIndex_Menu_Help; 738 768 } 739 740 #ifdef Q_WS_MAC741 bool UIActionPool::isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType type) const742 {743 foreach (const UIExtraDataMetaDefs::MenuApplicationActionType &restriction, m_restrictedActionsMenuApplication.values())744 if (restriction & type)745 return false;746 return true;747 }748 749 void UIActionPool::setRestrictionForMenuApplication(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuApplicationActionType restriction)750 {751 m_restrictedActionsMenuApplication[level] = restriction;752 m_invalidations << UIActionIndex_M_Application;753 }754 #endif /* Q_WS_MAC */755 769 756 770 void UIActionPool::sltHandleMenuPrepare() -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r52579 r52583 355 355 QList<UIAction*> actions() const { return m_pool.values(); } 356 356 357 /** Returns whether the action with passed @a type is allowed in the 'Help' menu. */358 bool isAllowedInMenu Help(UIExtraDataMetaDefs::MenuHelpActionType type) const;359 /** Defines 'Help' menu@a restriction for passed @a level. */360 void setRestrictionForMenu Help(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuHelpActionType restriction);357 /** Returns whether the menu with passed @a type is allowed in menu-bar. */ 358 bool isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType type) const; 359 /** Defines menu-bar @a restriction for passed @a level. */ 360 void setRestrictionForMenuBar(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuType restriction); 361 361 362 362 #ifdef Q_WS_MAC … … 366 366 void setRestrictionForMenuApplication(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuApplicationActionType restriction); 367 367 #endif /* Q_WS_MAC */ 368 369 /** Returns whether the action with passed @a type is allowed in the 'Help' menu. */ 370 bool isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType type) const; 371 /** Defines 'Help' menu @a restriction for passed @a level. */ 372 void setRestrictionForMenuHelp(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuHelpActionType restriction); 368 373 369 374 /** Hot-key processing delegate. */ … … 437 442 QSet<int> m_invalidations; 438 443 439 /** Holds restricted action types of the Help menu. */440 QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::Menu HelpActionType> m_restrictedActionsMenuHelp;444 /** Holds restricted menu types. */ 445 QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::MenuType> m_restrictedMenus; 441 446 #ifdef Q_WS_MAC 442 447 /** Holds restricted action types of the Application menu. */ 443 448 QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::MenuApplicationActionType> m_restrictedActionsMenuApplication; 444 449 #endif /* Q_WS_MAC */ 450 /** Holds restricted action types of the Help menu. */ 451 QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::MenuHelpActionType> m_restrictedActionsMenuHelp; 445 452 }; 446 453 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r52579 r52583 46 46 47 47 /** Returns action extra-data ID. */ 48 virtual int extraDataID() const { return UIExtraDataMetaDefs:: RuntimeMenuType_Machine; }49 /** Returns action extra-data key. */ 50 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs:: RuntimeMenuType_Machine); }48 virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Machine; } 49 /** Returns action extra-data key. */ 50 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Machine); } 51 51 52 52 void retranslateUi() … … 574 574 575 575 /** Returns action extra-data ID. */ 576 virtual int extraDataID() const { return UIExtraDataMetaDefs:: RuntimeMenuType_View; }577 /** Returns action extra-data key. */ 578 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs:: RuntimeMenuType_View); }576 virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_View; } 577 /** Returns action extra-data key. */ 578 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_View); } 579 579 580 580 void retranslateUi() … … 596 596 597 597 /** Returns action extra-data ID. */ 598 virtual int extraDataID() const { return UIExtraDataMetaDefs:: RuntimeMenuType_View; }599 /** Returns action extra-data key. */ 600 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs:: RuntimeMenuType_View); }598 virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_View; } 599 /** Returns action extra-data key. */ 600 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_View); } 601 601 602 602 void retranslateUi() {} … … 917 917 918 918 /** Returns action extra-data ID. */ 919 virtual int extraDataID() const { return UIExtraDataMetaDefs:: RuntimeMenuType_Devices; }920 /** Returns action extra-data key. */ 921 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs:: RuntimeMenuType_Devices); }919 virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Devices; } 920 /** Returns action extra-data key. */ 921 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Devices); } 922 922 923 923 void retranslateUi() … … 1408 1408 1409 1409 /** Returns action extra-data ID. */ 1410 virtual int extraDataID() const { return UIExtraDataMetaDefs:: RuntimeMenuType_Debug; }1411 /** Returns action extra-data key. */ 1412 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs:: RuntimeMenuType_Debug); }1410 virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Debug; } 1411 /** Returns action extra-data key. */ 1412 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Debug); } 1413 1413 1414 1414 void retranslateUi() … … 1643 1643 /* Invalidate View menu: */ 1644 1644 m_invalidations << UIActionIndexRT_M_View; 1645 }1646 1647 bool UIActionPoolRuntime::isAllowedInMenuBar(UIExtraDataMetaDefs::RuntimeMenuType type) const1648 {1649 foreach (const UIExtraDataMetaDefs::RuntimeMenuType &restriction, m_restrictedMenus.values())1650 if (restriction & type)1651 return false;1652 return true;1653 }1654 1655 void UIActionPoolRuntime::setRestrictionForMenuBar(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuType restriction)1656 {1657 m_restrictedMenus[level] = restriction;1658 updateMenus();1659 1645 } 1660 1646 … … 2009 1995 2010 1996 /* 'Machine' menu: */ 2011 const bool fAllowToShowMenuMachine = isAllowedInMenuBar(UIExtraDataMetaDefs:: RuntimeMenuType_Machine);1997 const bool fAllowToShowMenuMachine = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Machine); 2012 1998 action(UIActionIndexRT_M_Machine)->setVisible(fAllowToShowMenuMachine); 2013 1999 if (fAllowToShowMenuMachine) … … 2016 2002 2017 2003 /* 'View' menu: */ 2018 const bool fAllowToShowMenuView = isAllowedInMenuBar(UIExtraDataMetaDefs:: RuntimeMenuType_View);2004 const bool fAllowToShowMenuView = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_View); 2019 2005 action(UIActionIndexRT_M_View)->setVisible(fAllowToShowMenuView); 2020 2006 action(UIActionIndexRT_M_ViewPopup)->setVisible(fAllowToShowMenuView); … … 2025 2011 2026 2012 /* 'Devices' menu: */ 2027 const bool fAllowToShowMenuDevices = isAllowedInMenuBar(UIExtraDataMetaDefs:: RuntimeMenuType_Devices);2013 const bool fAllowToShowMenuDevices = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Devices); 2028 2014 action(UIActionIndexRT_M_Devices)->setVisible(fAllowToShowMenuDevices); 2029 2015 if (fAllowToShowMenuDevices) … … 2033 2019 #ifdef VBOX_WITH_DEBUGGER_GUI 2034 2020 /* 'Debug' menu: */ 2035 const bool fAllowToShowMenuDebug = isAllowedInMenuBar(UIExtraDataMetaDefs:: RuntimeMenuType_Debug);2021 const bool fAllowToShowMenuDebug = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Debug); 2036 2022 action(UIActionIndexRT_M_Debug)->setVisible(fAllowToShowMenuDebug); 2037 2023 if (fAllowToShowMenuDebug) … … 2041 2027 2042 2028 /* 'Help' menu: */ 2043 const bool fAllowToShowMenuHelp = isAllowedInMenuBar(UIExtraDataMetaDefs:: RuntimeMenuType_Help);2029 const bool fAllowToShowMenuHelp = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Help); 2044 2030 action(UIActionIndex_Menu_Help)->setVisible(fAllowToShowMenuHelp); 2045 2031 if (fAllowToShowMenuHelp) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
r52579 r52583 146 146 /** Returns UI multi-screen layout object reference. */ 147 147 UIMultiScreenLayout* multiScreenLayout() const { return m_pMultiScreenLayout; } 148 149 /** Returns whether the menu with passed @a type is allowed in menu-bar. */150 bool isAllowedInMenuBar(UIExtraDataMetaDefs::RuntimeMenuType type) const;151 /** Defines menu-bar @a restriction for passed @a level. */152 void setRestrictionForMenuBar(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuType restriction);153 148 154 149 /** Returns whether the action with passed @a type is allowed in the 'Machine' menu. */ … … 267 262 QList<QMenu*> m_mainMenus; 268 263 269 /** Holds restricted menu types. */270 QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::RuntimeMenuType> m_restrictedMenus;271 264 /** Holds restricted action types of the Machine menu. */ 272 265 QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::RuntimeMenuMachineActionType> m_restrictedActionsMenuMachine; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r52579 r52583 172 172 switch (pAction->property("class").toInt()) 173 173 { 174 case UIExtraDataMetaDefs:: RuntimeMenuType_All:174 case UIExtraDataMetaDefs::MenuType_All: 175 175 { 176 176 /* Get sender type: */ 177 const UIExtraDataMetaDefs:: RuntimeMenuType type =178 static_cast<UIExtraDataMetaDefs:: RuntimeMenuType>(pAction->property("type").toInt());177 const UIExtraDataMetaDefs::MenuType type = 178 static_cast<UIExtraDataMetaDefs::MenuType>(pAction->property("type").toInt()); 179 179 /* Load current menu-bar restrictions: */ 180 UIExtraDataMetaDefs:: RuntimeMenuType restrictions = gEDataManager->restrictedRuntimeMenuTypes(vboxGlobal().managedVMUuid());180 UIExtraDataMetaDefs::MenuType restrictions = gEDataManager->restrictedRuntimeMenuTypes(vboxGlobal().managedVMUuid()); 181 181 /* Invert restriction for sender type: */ 182 restrictions = (UIExtraDataMetaDefs:: RuntimeMenuType)(restrictions ^ type);182 restrictions = (UIExtraDataMetaDefs::MenuType)(restrictions ^ type); 183 183 /* Save updated menu-bar restrictions: */ 184 184 gEDataManager->setRestrictedRuntimeMenuTypes(restrictions, vboxGlobal().managedVMUuid()); … … 186 186 } 187 187 #ifdef Q_WS_MAC 188 case UIExtraDataMetaDefs:: RuntimeMenuType_Application:188 case UIExtraDataMetaDefs::MenuType_Application: 189 189 { 190 190 /* Get sender type: */ … … 200 200 } 201 201 #endif /* Q_WS_MAC */ 202 case UIExtraDataMetaDefs:: RuntimeMenuType_Machine:202 case UIExtraDataMetaDefs::MenuType_Machine: 203 203 { 204 204 /* Get sender type: */ … … 213 213 break; 214 214 } 215 case UIExtraDataMetaDefs:: RuntimeMenuType_View:215 case UIExtraDataMetaDefs::MenuType_View: 216 216 { 217 217 /* Get sender type: */ … … 226 226 break; 227 227 } 228 case UIExtraDataMetaDefs:: RuntimeMenuType_Devices:228 case UIExtraDataMetaDefs::MenuType_Devices: 229 229 { 230 230 /* Get sender type: */ … … 240 240 } 241 241 #ifdef VBOX_WITH_DEBUGGER_GUI 242 case UIExtraDataMetaDefs:: RuntimeMenuType_Debug:242 case UIExtraDataMetaDefs::MenuType_Debug: 243 243 { 244 244 /* Get sender type: */ … … 254 254 } 255 255 #endif /* VBOX_WITH_DEBUGGER_GUI */ 256 case UIExtraDataMetaDefs:: RuntimeMenuType_Help:256 case UIExtraDataMetaDefs::MenuType_Help: 257 257 { 258 258 /* Get sender type: */ … … 350 350 { 351 351 /* Configure named menu: */ 352 pNamedMenu->setProperty("class", UIExtraDataMetaDefs:: RuntimeMenuType_Application);352 pNamedMenu->setProperty("class", UIExtraDataMetaDefs::MenuType_Application); 353 353 /* Get named menu action: */ 354 354 QAction *pNamedMenuAction = pNamedMenu->menuAction(); … … 395 395 /* Configure copied menu action: */ 396 396 pCopiedMenuAction->setCheckable(true); 397 pCopiedMenuAction->setProperty("class", UIExtraDataMetaDefs:: RuntimeMenuType_All);397 pCopiedMenuAction->setProperty("class", UIExtraDataMetaDefs::MenuType_All); 398 398 pCopiedMenuAction->setProperty("type", pAction->extraDataID()); 399 399 connect(pCopiedMenuAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick())); … … 591 591 { 592 592 /* Recache menu-bar configuration: */ 593 const UIExtraDataMetaDefs:: RuntimeMenuType restrictionsMenuBar = gEDataManager->restrictedRuntimeMenuTypes(vboxGlobal().managedVMUuid());593 const UIExtraDataMetaDefs::MenuType restrictionsMenuBar = gEDataManager->restrictedRuntimeMenuTypes(vboxGlobal().managedVMUuid()); 594 594 /* Get static meta-object: */ 595 595 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 596 596 597 /* We have UIExtraDataMetaDefs:: RuntimeMenuType enum registered, so we can enumerate it: */598 const int iEnumIndex = smo.indexOfEnumerator(" RuntimeMenuType");597 /* We have UIExtraDataMetaDefs::MenuType enum registered, so we can enumerate it: */ 598 const int iEnumIndex = smo.indexOfEnumerator("MenuType"); 599 599 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 600 600 /* Handle other enum-values: */ … … 602 602 { 603 603 /* Get iterated enum-value: */ 604 const UIExtraDataMetaDefs:: RuntimeMenuType enumValue =605 static_cast<const UIExtraDataMetaDefs:: RuntimeMenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));606 /* Skip RuntimeMenuType_Invalid & RuntimeMenuType_All enum-value: */607 if (enumValue == UIExtraDataMetaDefs:: RuntimeMenuType_Invalid ||608 enumValue == UIExtraDataMetaDefs:: RuntimeMenuType_All)604 const UIExtraDataMetaDefs::MenuType enumValue = 605 static_cast<const UIExtraDataMetaDefs::MenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 606 /* Skip MenuType_Invalid & MenuType_All enum-value: */ 607 if (enumValue == UIExtraDataMetaDefs::MenuType_Invalid || 608 enumValue == UIExtraDataMetaDefs::MenuType_All) 609 609 continue; 610 610 /* Which key required action registered under? */
Note:
See TracChangeset
for help on using the changeset viewer.