Changeset 52557 in vbox
- Timestamp:
- Sep 1, 2014 4:45:25 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r52478 r52557 453 453 switch (runtimeMenuType) 454 454 { 455 case UIExtraDataMetaDefs::RuntimeMenuType_Machine: strResult = "Machine"; break; 456 case UIExtraDataMetaDefs::RuntimeMenuType_View: strResult = "View"; break; 457 case UIExtraDataMetaDefs::RuntimeMenuType_Devices: strResult = "Devices"; break; 455 #ifdef RT_OS_DARWIN 456 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; 458 461 #ifdef VBOX_WITH_DEBUGGER_GUI 459 case UIExtraDataMetaDefs::RuntimeMenuType_Debug: strResult = "Debug"; break;462 case UIExtraDataMetaDefs::RuntimeMenuType_Debug: strResult = "Debug"; break; 460 463 #endif /* VBOX_WITH_DEBUGGER_GUI */ 461 case UIExtraDataMetaDefs::RuntimeMenuType_Help: strResult = "Help"; break;462 case UIExtraDataMetaDefs::RuntimeMenuType_All: strResult = "All"; break;464 case UIExtraDataMetaDefs::RuntimeMenuType_Help: strResult = "Help"; break; 465 case UIExtraDataMetaDefs::RuntimeMenuType_All: strResult = "All"; break; 463 466 default: 464 467 { … … 475 478 /* Here we have some fancy stuff allowing us 476 479 * to search through the keys using 'case-insensitive' rule: */ 477 QStringList keys; QList<UIExtraDataMetaDefs::RuntimeMenuType> values; 478 keys << "Machine"; values << UIExtraDataMetaDefs::RuntimeMenuType_Machine; 479 keys << "View"; values << UIExtraDataMetaDefs::RuntimeMenuType_View; 480 keys << "Devices"; values << UIExtraDataMetaDefs::RuntimeMenuType_Devices; 480 QStringList keys; QList<UIExtraDataMetaDefs::RuntimeMenuType> values; 481 #ifdef RT_OS_DARWIN 482 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; 481 487 #ifdef VBOX_WITH_DEBUGGER_GUI 482 keys << "Debug"; values << UIExtraDataMetaDefs::RuntimeMenuType_Debug;488 keys << "Debug"; values << UIExtraDataMetaDefs::RuntimeMenuType_Debug; 483 489 #endif /* VBOX_WITH_DEBUGGER_GUI */ 484 keys << "Help"; values << UIExtraDataMetaDefs::RuntimeMenuType_Help;485 keys << "All"; values << UIExtraDataMetaDefs::RuntimeMenuType_All;490 keys << "Help"; values << UIExtraDataMetaDefs::RuntimeMenuType_Help; 491 keys << "All"; values << UIExtraDataMetaDefs::RuntimeMenuType_All; 486 492 /* Invalid type for unknown words: */ 487 493 if (!keys.contains(strRuntimeMenuType, Qt::CaseInsensitive)) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r52478 r52557 315 315 enum RuntimeMenuType 316 316 { 317 RuntimeMenuType_Invalid = 0, 318 RuntimeMenuType_Machine = RT_BIT(0), 319 RuntimeMenuType_View = RT_BIT(1), 320 RuntimeMenuType_Devices = RT_BIT(2), 317 RuntimeMenuType_Invalid = 0, 318 #ifdef RT_OS_DARWIN 319 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), 321 324 #ifdef VBOX_WITH_DEBUGGER_GUI 322 RuntimeMenuType_Debug = RT_BIT(3),325 RuntimeMenuType_Debug = RT_BIT(4), 323 326 #endif /* VBOX_WITH_DEBUGGER_GUI */ 324 RuntimeMenuType_Help = RT_BIT(4),325 RuntimeMenuType_All = 0xFF327 RuntimeMenuType_Help = RT_BIT(5), 328 RuntimeMenuType_All = 0xFF 326 329 }; 327 330 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r52480 r52557 69 69 /** Prepare routine. */ 70 70 void prepare(); 71 71 72 #ifdef Q_WS_MAC 72 73 /** Prepare named menu routine. */ … … 81 82 /** Prepare copied action routine. */ 82 83 QAction* prepareCopiedAction(QMenu *pMenu, const UIAction *pAction); 84 83 85 /** Prepare menus routine. */ 84 86 void prepareMenus(); … … 102 104 /** Updates menus routine. */ 103 105 void updateMenus(); 106 #ifdef Q_WS_MAC 107 /** Mac OS X: Updates 'Application' menu routine. */ 108 void updateMenuApplication(); 109 #endif /* Q_WS_MAC */ 104 110 /** Updates 'Machine' menu routine. */ 105 111 void updateMenuMachine(); … … 179 185 break; 180 186 } 187 #ifdef Q_WS_MAC 188 case UIExtraDataMetaDefs::RuntimeMenuType_Application: 189 { 190 /* Get sender type: */ 191 const UIExtraDataMetaDefs::MenuApplicationActionType type = 192 static_cast<UIExtraDataMetaDefs::MenuApplicationActionType>(pAction->property("type").toInt()); 193 /* Load current menu-bar restrictions: */ 194 UIExtraDataMetaDefs::MenuApplicationActionType restrictions = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(vboxGlobal().managedVMUuid()); 195 /* Invert restriction for sender type: */ 196 restrictions = (UIExtraDataMetaDefs::MenuApplicationActionType)(restrictions ^ type); 197 /* Save updated menu-bar restrictions: */ 198 gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(restrictions, vboxGlobal().managedVMUuid()); 199 break; 200 } 201 #endif /* Q_WS_MAC */ 181 202 case UIExtraDataMetaDefs::RuntimeMenuType_Machine: 182 203 { … … 329 350 { 330 351 /* Configure named menu: */ 331 pNamedMenu->setProperty("class", UIExtraDataMetaDefs::RuntimeMenuType_ Help);352 pNamedMenu->setProperty("class", UIExtraDataMetaDefs::RuntimeMenuType_Application); 332 353 /* Get named menu action: */ 333 354 QAction *pNamedMenuAction = pNamedMenu->menuAction(); … … 596 617 597 618 /* Update known menu-bar menus: */ 619 #ifdef Q_WS_MAC 620 updateMenuApplication(); 621 #endif /* Q_WS_MAC */ 598 622 updateMenuMachine(); 599 623 updateMenuView(); … … 604 628 updateMenuHelp(); 605 629 } 630 631 #ifdef Q_WS_MAC 632 void UIMenuBarEditorWidget::updateMenuApplication() 633 { 634 /* Recache menu-bar configuration: */ 635 const UIExtraDataMetaDefs::MenuApplicationActionType restrictionsMenuApplication = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(vboxGlobal().managedVMUuid()); 636 /* Get static meta-object: */ 637 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 638 639 /* We have UIExtraDataMetaDefs::MenuApplicationActionType enum registered, so we can enumerate it: */ 640 const int iEnumIndex = smo.indexOfEnumerator("MenuApplicationActionType"); 641 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 642 /* Handle other enum-values: */ 643 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 644 { 645 /* Get iterated enum-value: */ 646 const UIExtraDataMetaDefs::MenuApplicationActionType enumValue = 647 static_cast<const UIExtraDataMetaDefs::MenuApplicationActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 648 /* Skip MenuApplicationActionType_Invalid & MenuApplicationActionType_All enum-value: */ 649 if (enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_Invalid || 650 enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_All) 651 continue; 652 /* Which key required action registered under? */ 653 const QString strKey = gpConverter->toInternalString(enumValue); 654 if (!m_actions.contains(strKey)) 655 continue; 656 /* Update action 'checked' state: */ 657 m_actions.value(strKey)->setChecked(!(restrictionsMenuApplication & enumValue)); 658 } 659 } 660 #endif /* Q_WS_MAC */ 606 661 607 662 void UIMenuBarEditorWidget::updateMenuMachine()
Note:
See TracChangeset
for help on using the changeset viewer.