cc481874159fb224c588ff1974534c75400e3684vboxsync * VBox Qt GUI - UIMenuBarEditorWindow class implementation.
cc481874159fb224c588ff1974534c75400e3684vboxsync * Copyright (C) 2014 Oracle Corporation
cc481874159fb224c588ff1974534c75400e3684vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
cc481874159fb224c588ff1974534c75400e3684vboxsync * available from http://www.virtualbox.org. This file is free software;
cc481874159fb224c588ff1974534c75400e3684vboxsync * you can redistribute it and/or modify it under the terms of the GNU
cc481874159fb224c588ff1974534c75400e3684vboxsync * General Public License (GPL) as published by the Free Software
cc481874159fb224c588ff1974534c75400e3684vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
cc481874159fb224c588ff1974534c75400e3684vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
cc481874159fb224c588ff1974534c75400e3684vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
cc481874159fb224c588ff1974534c75400e3684vboxsync/* Qt includes: */
b383a64b1f178415000bda9159eb7079c27edd4evboxsync# endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync/* GUI includes: */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsyncUIMenuBarEditorWidget::UIMenuBarEditorWidget(QWidget *pParent,
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Prepare: */
91204831cf07b1a2d129a00380d344c69390b845vboxsyncvoid UIMenuBarEditorWidget::setMachineID(const QString &strMachineID)
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Remember new machine ID: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Prepare: */
91204831cf07b1a2d129a00380d344c69390b845vboxsyncvoid UIMenuBarEditorWidget::setActionPool(UIActionPool *pActionPool)
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Remember new action-pool: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Prepare: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsyncvoid UIMenuBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID)
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync /* Skip unrelated machine IDs: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Update enable-checkbox: */
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update menus: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsyncvoid UIMenuBarEditorWidget::sltHandleMenuBarEnableToggle(bool fEnabled)
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Toggle enable-checkbox if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Check whether this value is really changed: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync const bool fMenuBarEnabled = gEDataManager->menuBarEnabled(machineID());
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Set new value: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync gEDataManager->setMenuBarEnabled(fEnabled, machineID());
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !RT_OS_DARWIN */
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::sltHandleMenuBarMenuClick()
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Make sure sender is valid: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pAction = qobject_cast<QAction*>(sender());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Depending on triggered action class: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get sender type: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync static_cast<UIExtraDataMetaDefs::MenuType>(pAction->property("type").toInt());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Load current menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync UIExtraDataMetaDefs::MenuType restrictions = gEDataManager->restrictedRuntimeMenuTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Invert restriction for sender type: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync restrictions = (UIExtraDataMetaDefs::MenuType)(restrictions ^ type);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Save updated menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync gEDataManager->setRestrictedRuntimeMenuTypes(restrictions, machineID());
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Get sender type: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync const UIExtraDataMetaDefs::MenuApplicationActionType type =
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync static_cast<UIExtraDataMetaDefs::MenuApplicationActionType>(pAction->property("type").toInt());
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Load current menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync UIExtraDataMetaDefs::MenuApplicationActionType restrictions = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID());
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Invert restriction for sender type: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync restrictions = (UIExtraDataMetaDefs::MenuApplicationActionType)(restrictions ^ type);
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Save updated menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(restrictions, machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::RuntimeMenuMachineActionType type =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(pAction->property("type").toInt());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Load current menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictions = gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Invert restriction for sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync restrictions = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)(restrictions ^ type);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Save updated menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(restrictions, machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::RuntimeMenuViewActionType type =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(pAction->property("type").toInt());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Load current menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictions = gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Invert restriction for sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync restrictions = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)(restrictions ^ type);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Save updated menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync gEDataManager->setRestrictedRuntimeMenuViewActionTypes(restrictions, machineID());
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Get sender type: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync const UIExtraDataMetaDefs::RuntimeMenuInputActionType type =
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync static_cast<UIExtraDataMetaDefs::RuntimeMenuInputActionType>(pAction->property("type").toInt());
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Load current menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictions = gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID());
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Invert restriction for sender type: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync restrictions = (UIExtraDataMetaDefs::RuntimeMenuInputActionType)(restrictions ^ type);
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Save updated menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync gEDataManager->setRestrictedRuntimeMenuInputActionTypes(restrictions, machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType type =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(pAction->property("type").toInt());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Load current menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictions = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Invert restriction for sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync restrictions = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictions ^ type);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Save updated menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(restrictions, machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType type =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(pAction->property("type").toInt());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Load current menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictions = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Invert restriction for sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync restrictions = (UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType)(restrictions ^ type);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Save updated menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(restrictions, machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Get sender type: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync const UIExtraDataMetaDefs::MenuWindowActionType type =
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync static_cast<UIExtraDataMetaDefs::MenuWindowActionType>(pAction->property("type").toInt());
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Load current menu-bar restrictions: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync UIExtraDataMetaDefs::MenuWindowActionType restrictions = gEDataManager->restrictedRuntimeMenuWindowActionTypes(machineID());
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Invert restriction for sender type: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync restrictions = (UIExtraDataMetaDefs::MenuWindowActionType)(restrictions ^ type);
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Save updated menu-bar restrictions: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync gEDataManager->setRestrictedRuntimeMenuWindowActionTypes(restrictions, machineID());
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::MenuHelpActionType type =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<UIExtraDataMetaDefs::MenuHelpActionType>(pAction->property("type").toInt());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Load current menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync UIExtraDataMetaDefs::MenuHelpActionType restrictions = gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Invert restriction for sender type: */
cc481874159fb224c588ff1974534c75400e3684vboxsync restrictions = (UIExtraDataMetaDefs::MenuHelpActionType)(restrictions ^ type);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Save updated menu-bar restrictions: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(restrictions, machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync default: break;
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Do nothing if already prepared: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Do not prepare if machine ID or action-pool is not set: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create main-layout: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure main-layout: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Standard margins should not be too big: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Top margin should be smaller for the common case: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Right margin should be bigger for the settings case: */
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Apply margins/spacing finally: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Prepare menus: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add tool-bar into main-layout: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Insert stretch: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Create close-button if necessary: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Configure close-button: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_pButtonClose->setIcon(UIIconPool::iconSet(":/ok_16px.png"));
91204831cf07b1a2d129a00380d344c69390b845vboxsync connect(m_pButtonClose, SIGNAL(clicked(bool)), this, SIGNAL(sigCancelClicked()));
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Add close-button into main-layout: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Create enable-checkbox if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Configure enable-checkbox: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync m_pCheckBoxEnable->setFocusPolicy(Qt::StrongFocus);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync connect(m_pCheckBoxEnable, SIGNAL(toggled(bool)), this, SLOT(sltHandleMenuBarEnableToggle(bool)));
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Add enable-checkbox into main-layout: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Update enable-checkbox: */
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Mark as prepared: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Translate contents: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create menus: */
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Listen for the menu-bar configuration changes: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync this, SLOT(sltHandleConfigurationChange(const QString&)));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update menus: */
cc481874159fb224c588ff1974534c75400e3684vboxsyncQMenu* UIMenuBarEditorWidget::prepareNamedMenu(const QString &strName)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create named menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pNamedMenu = new QMenu(strName, m_pToolBar);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure named menu: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync pNamedMenu->setProperty("class", UIExtraDataMetaDefs::MenuType_Application);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get named menu action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pNamedMenuAction = pNamedMenu->menuAction();
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add menu action into tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get named menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QToolButton *pNamedMenuToolButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pNamedMenuAction));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure named menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pNamedMenuToolButton->setPopupMode(QToolButton::MenuButtonPopup);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create spacing after named menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure spacing: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add spacing into tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Return named menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsyncQMenu* UIMenuBarEditorWidget::prepareCopiedMenu(const UIAction *pAction)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create copied menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pCopiedMenu = new QMenu(pAction->name(), m_pToolBar);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenu->setProperty("class", pAction->extraDataID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get copied menu action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pCopiedMenuAction = pCopiedMenu->menuAction();
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied menu action: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync pCopiedMenuAction->setProperty("class", UIExtraDataMetaDefs::MenuType_All);
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenuAction->setProperty("type", pAction->extraDataID());
cc481874159fb224c588ff1974534c75400e3684vboxsync connect(pCopiedMenuAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.insert(pAction->extraDataKey(), pCopiedMenuAction);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add menu action into tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get copied menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QToolButton *pCopiedMenuToolButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pCopiedMenuAction));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenuToolButton->setPopupMode(QToolButton::MenuButtonPopup);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create spacing after copied menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure spacing: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add spacing into tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Return copied menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsyncQMenu* UIMenuBarEditorWidget::prepareCopiedSubMenu(QMenu *pMenu, const UIAction *pAction)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create copied sub-menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pCopiedMenu = pMenu->addMenu(pAction->name());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied sub-menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenu->setProperty("class", pMenu->property("class"));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get copied sub-menu action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pCopiedMenuAction = pCopiedMenu->menuAction();
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied sub-menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenuAction->setProperty("class", pCopiedMenu->property("class"));
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenuAction->setProperty("type", pAction->extraDataID());
cc481874159fb224c588ff1974534c75400e3684vboxsync connect(pCopiedMenuAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.insert(pAction->extraDataKey(), pCopiedMenuAction);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Return copied sub-menu: */
fd9afeabf56257550f294200c88b018958a9ab48vboxsyncQAction* UIMenuBarEditorWidget::prepareNamedAction(QMenu *pMenu, const QString &strName,
fd9afeabf56257550f294200c88b018958a9ab48vboxsync /* Create copied action: */
fd9afeabf56257550f294200c88b018958a9ab48vboxsync QAction *pCopiedAction = pMenu->addAction(strName);
fd9afeabf56257550f294200c88b018958a9ab48vboxsync /* Configure copied action: */
fd9afeabf56257550f294200c88b018958a9ab48vboxsync pCopiedAction->setProperty("class", pMenu->property("class"));
fd9afeabf56257550f294200c88b018958a9ab48vboxsync connect(pCopiedAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
fd9afeabf56257550f294200c88b018958a9ab48vboxsync /* Return copied action: */
cc481874159fb224c588ff1974534c75400e3684vboxsyncQAction* UIMenuBarEditorWidget::prepareCopiedAction(QMenu *pMenu, const UIAction *pAction)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create copied action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pCopiedAction = pMenu->addAction(pAction->name());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedAction->setProperty("class", pMenu->property("class"));
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedAction->setProperty("type", pAction->extraDataID());
cc481874159fb224c588ff1974534c75400e3684vboxsync connect(pCopiedAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.insert(pAction->extraDataKey(), pCopiedAction);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Return copied action: */
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepareMenuApplication()
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync#else /* !Q_WS_MAC */
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_M_Application));
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync#endif /* !Q_WS_MAC */
1ae2aeb1d8bb1614cf94d8de9a5afed3a2510161vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_About));
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_NetworkAccessManager));
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_ResetWarnings));
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_Preferences));
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync#else /* !Q_WS_MAC */
1ae2aeb1d8bb1614cf94d8de9a5afed3a2510161vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_Preferences));
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_NetworkAccessManager));
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_ResetWarnings));
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Machine));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Settings));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_TakeSnapshot));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_ShowInformation));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_T_Pause));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Reset));
306bebaef59993c5a23e7fac0f3b20f34aab669bvboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_SaveState));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Shutdown));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_PowerOff));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_View));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_Seamless));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_Scale));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize));
82709943290f6a5e918ff2a081587de52191c791vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot));
4e1cd7e9ab24e7f0f8dad7393c8bbc97ad9ae335vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start));
037c7c146972a56b4f708962044470c73553f9dfvboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_MenuBar));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_StatusBar));
dbc2732f96946edbab2723f6bc0a2fe35e715b4evboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_ScaleFactor));
fd9afeabf56257550f294200c88b018958a9ab48vboxsync prepareNamedAction(pMenu, tr("Virtual Screen Resize"),
fd9afeabf56257550f294200c88b018958a9ab48vboxsync UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize,
fd9afeabf56257550f294200c88b018958a9ab48vboxsync gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize));
fd9afeabf56257550f294200c88b018958a9ab48vboxsync prepareNamedAction(pMenu, tr("Virtual Screen Mapping"),
fd9afeabf56257550f294200c88b018958a9ab48vboxsync UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen,
fd9afeabf56257550f294200c88b018958a9ab48vboxsync gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen));
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Copy menu: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Input));
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard));
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Devices));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_Network));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_WebCams));
77a8f1c110ad18b4b2818e03cb5a9e8fa6fb7c90vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedClipboard));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_DragAndDrop));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Debug));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Debug_S_ShowStatistics));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Debug_S_ShowCommandLine));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Debug_T_Logging));
d28848b0947386e93458618d0aa7aa53c1325d64vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Debug_S_ShowLogDialog));
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Copy menu: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_M_Window));
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Window_S_Minimize));
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync gpConverter->toInternalString(UIExtraDataMetaDefs::MenuWindowActionType_Switch));
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_Menu_Help));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_Contents));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_WebSite));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_About));
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* !Q_WS_MAC */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Update enable-checkbox if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync m_pCheckBoxEnable->setChecked(gEDataManager->menuBarEnabled(machineID()));
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::MenuType restrictionsMenuBar = gEDataManager->restrictedRuntimeMenuTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get static meta-object: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync /* We have UIExtraDataMetaDefs::MenuType enum registered, so we can enumerate it: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync const int iEnumIndex = smo.indexOfEnumerator("MenuType");
cc481874159fb224c588ff1974534c75400e3684vboxsync const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get iterated enum-value: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync static_cast<const UIExtraDataMetaDefs::MenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync /* Skip MenuType_Invalid & MenuType_All enum-value: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync if (enumValue == UIExtraDataMetaDefs::MenuType_Invalid ||
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuBar & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update known menu-bar menus: */
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::MenuApplicationActionType restrictionsMenuApplication = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID());
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Get static meta-object: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* We have UIExtraDataMetaDefs::MenuApplicationActionType enum registered, so we can enumerate it: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync const int iEnumIndex = smo.indexOfEnumerator("MenuApplicationActionType");
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Handle other enum-values: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Get iterated enum-value: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync const UIExtraDataMetaDefs::MenuApplicationActionType enumValue =
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync static_cast<const UIExtraDataMetaDefs::MenuApplicationActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Skip MenuApplicationActionType_Invalid & MenuApplicationActionType_All enum-value: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync if (enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_Invalid ||
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_All)
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Which key required action registered under? */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Update action 'checked' state: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuApplication & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionsMenuMachine = gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get static meta-object: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuMachineActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuMachineActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get iterated enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::RuntimeMenuMachineActionType enumValue =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<const UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Skip RuntimeMenuMachineActionType_Invalid & RuntimeMenuMachineActionType_All enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync if (enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid ||
cc481874159fb224c588ff1974534c75400e3684vboxsync enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_All)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuMachine & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionsMenuView = gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get static meta-object: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuViewActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuViewActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get iterated enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::RuntimeMenuViewActionType enumValue =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<const UIExtraDataMetaDefs::RuntimeMenuViewActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Skip RuntimeMenuViewActionType_Invalid & RuntimeMenuViewActionType_All enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync if (enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid ||
cc481874159fb224c588ff1974534c75400e3684vboxsync enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_All)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuView & enumValue));
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictionsMenuInput = gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID());
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Get static meta-object: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuInputActionType enum registered, so we can enumerate it: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuInputActionType");
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Handle other enum-values: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Get iterated enum-value: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync const UIExtraDataMetaDefs::RuntimeMenuInputActionType enumValue =
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync static_cast<const UIExtraDataMetaDefs::RuntimeMenuInputActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Skip RuntimeMenuInputActionType_Invalid & RuntimeMenuInputActionType_All enum-value: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync if (enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid ||
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_All)
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Which key required action registered under? */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync const QString strKey = gpConverter->toInternalString(enumValue);
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Update action 'checked' state: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuInput & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionsMenuDevices = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get static meta-object: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDevicesActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get iterated enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enumValue =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Skip RuntimeMenuDevicesActionType_Invalid & RuntimeMenuDevicesActionType_All enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid ||
cc481874159fb224c588ff1974534c75400e3684vboxsync enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_All)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuDevices & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictionsMenuDebug = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get static meta-object: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDebuggerActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get iterated enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enumValue =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Skip RuntimeMenuDebuggerActionType_Invalid & RuntimeMenuDebuggerActionType_All enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid ||
cc481874159fb224c588ff1974534c75400e3684vboxsync enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuDebug & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Recache menu-bar configuration: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync const UIExtraDataMetaDefs::MenuWindowActionType restrictionsMenuWindow = gEDataManager->restrictedRuntimeMenuWindowActionTypes(machineID());
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Get static meta-object: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* We have UIExtraDataMetaDefs::MenuWindowActionType enum registered, so we can enumerate it: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync const int iEnumIndex = smo.indexOfEnumerator("MenuWindowActionType");
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Handle other enum-values: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Get iterated enum-value: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync const UIExtraDataMetaDefs::MenuWindowActionType enumValue =
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync static_cast<const UIExtraDataMetaDefs::MenuWindowActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Skip MenuWindowActionType_Invalid & MenuWindowActionType_All enum-value: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync if (enumValue == UIExtraDataMetaDefs::MenuWindowActionType_Invalid ||
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync enumValue == UIExtraDataMetaDefs::MenuWindowActionType_All)
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Which key required action registered under? */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Update action 'checked' state: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuWindow & enumValue));
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::MenuHelpActionType restrictionsMenuHelp = gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get static meta-object: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::MenuHelpActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("MenuHelpActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get iterated enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const UIExtraDataMetaDefs::MenuHelpActionType enumValue =
cc481874159fb224c588ff1974534c75400e3684vboxsync static_cast<const UIExtraDataMetaDefs::MenuHelpActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Skip MenuHelpActionType_Invalid & MenuHelpActionType_All enum-value: */
cc481874159fb224c588ff1974534c75400e3684vboxsync if (enumValue == UIExtraDataMetaDefs::MenuHelpActionType_Invalid ||
cc481874159fb224c588ff1974534c75400e3684vboxsync enumValue == UIExtraDataMetaDefs::MenuHelpActionType_All)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuHelp & enumValue));
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Translate close-button if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Translate enable-checkbox if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync m_pCheckBoxEnable->setToolTip(tr("Enable Menu Bar"));
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::paintEvent(QPaintEvent*)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Prepare painter: */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Prepare palette colors: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QColor color1 = pal.color(QPalette::Window).lighter(110);
cc481874159fb224c588ff1974534c75400e3684vboxsync QColor color2 = pal.color(QPalette::Window).darker(200);
cc481874159fb224c588ff1974534c75400e3684vboxsync QColor color3 = pal.color(QPalette::Window).darker(120);
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* Q_WS_WIN || Q_WS_X11 */
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Left corner: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QRadialGradient grad1(QPointF(5, height() - 5), 5);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Right corner: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QRadialGradient grad2(QPointF(width() - 5, height() - 5), 5);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Bottom line: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QLinearGradient grad3(QPointF(5, height()), QPointF(5, height() - 5));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Left line: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QLinearGradient grad4(QPointF(0, height() - 5), QPointF(5, height() - 5));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Right line: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QLinearGradient grad5(QPointF(width(), height() - 5), QPointF(width() - 5, height() - 5));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Paint shape/shadow: */
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.fillRect(QRect(5, 0, width() - 5 * 2, height() - 5), color0); // background
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.fillRect(QRect(0, height() - 5, 5, 5), grad1); // left corner
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.fillRect(QRect(width() - 5, height() - 5, 5, 5), grad2); // right corner
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.fillRect(QRect(5, height() - 5, width() - 5 * 2, 5), grad3); // bottom line
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.fillRect(QRect(0, 0, 5, height() - 5), grad4); // left line
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.fillRect(QRect(width() - 5, 0, 5, height() - 5), grad5); // right line
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Paint frames: */
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.drawLine(QLine(QPoint(5 + 1, 0), QPoint(5 + 1, height() - 1 - 5 - 1)));
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.drawLine(QLine(QPoint(5 + 1, height() - 1 - 5 - 1), QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1)));
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1), QPoint(width() - 1 - 5 - 1, 0)));
91204831cf07b1a2d129a00380d344c69390b845vboxsync painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, 0), QPoint(5 + 1, 0)));
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* Q_WS_WIN || Q_WS_X11 */
cc481874159fb224c588ff1974534c75400e3684vboxsyncUIMenuBarEditorWindow::UIMenuBarEditorWindow(UIMachineWindow *pParent, UIActionPool *pActionPool)
91204831cf07b1a2d129a00380d344c69390b845vboxsync : UISlidingToolBar(pParent, pParent->menuBar(), new UIMenuBarEditorWidget(0, false, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
d2d713371456834ea31f87eb8325171cf70545e7vboxsync#else /* Q_WS_MAC */
91204831cf07b1a2d129a00380d344c69390b845vboxsync : UISlidingToolBar(pParent, 0, new UIMenuBarEditorWidget(0, false, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
d2d713371456834ea31f87eb8325171cf70545e7vboxsync#endif /* Q_WS_MAC */