cc481874159fb224c588ff1974534c75400e3684vboxsync/* $Id$ */
cc481874159fb224c588ff1974534c75400e3684vboxsync/** @file
cc481874159fb224c588ff1974534c75400e3684vboxsync * VBox Qt GUI - UIMenuBarEditorWindow class implementation.
cc481874159fb224c588ff1974534c75400e3684vboxsync */
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync/*
cc481874159fb224c588ff1974534c75400e3684vboxsync * Copyright (C) 2014 Oracle Corporation
cc481874159fb224c588ff1974534c75400e3684vboxsync *
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.
cc481874159fb224c588ff1974534c75400e3684vboxsync */
cc481874159fb224c588ff1974534c75400e3684vboxsync
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync#ifdef VBOX_WITH_PRECOMPILED_HEADERS
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <precomp.h>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync/* Qt includes: */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QHBoxLayout>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QPaintEvent>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QMetaEnum>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QMenuBar>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QPainter>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QMenu>
b383a64b1f178415000bda9159eb7079c27edd4evboxsync# ifndef Q_WS_MAC
b383a64b1f178415000bda9159eb7079c27edd4evboxsync# include <QCheckBox>
b383a64b1f178415000bda9159eb7079c27edd4evboxsync# endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync/* GUI includes: */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIMenuBarEditorWindow.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIActionPoolRuntime.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIExtraDataManager.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIMachineWindow.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIConverter.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIIconPool.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIToolBar.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "QIToolButton.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "VBoxGlobal.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsyncUIMenuBarEditorWidget::UIMenuBarEditorWidget(QWidget *pParent,
91204831cf07b1a2d129a00380d344c69390b845vboxsync bool fStartedFromVMSettings /* = true */,
91204831cf07b1a2d129a00380d344c69390b845vboxsync const QString &strMachineID /* = QString() */,
91204831cf07b1a2d129a00380d344c69390b845vboxsync UIActionPool *pActionPool /* = 0 */)
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync : QIWithRetranslateUI2<QWidget>(pParent)
91204831cf07b1a2d129a00380d344c69390b845vboxsync , m_fPrepared(false)
91204831cf07b1a2d129a00380d344c69390b845vboxsync , m_fStartedFromVMSettings(fStartedFromVMSettings)
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync , m_strMachineID(strMachineID)
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync , m_pActionPool(pActionPool)
cc481874159fb224c588ff1974534c75400e3684vboxsync , m_pMainLayout(0)
cc481874159fb224c588ff1974534c75400e3684vboxsync , m_pToolBar(0)
cc481874159fb224c588ff1974534c75400e3684vboxsync , m_pButtonClose(0)
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#ifndef Q_WS_MAC
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync , m_pCheckBoxEnable(0)
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Prepare: */
cc481874159fb224c588ff1974534c75400e3684vboxsync prepare();
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
91204831cf07b1a2d129a00380d344c69390b845vboxsyncvoid UIMenuBarEditorWidget::setMachineID(const QString &strMachineID)
91204831cf07b1a2d129a00380d344c69390b845vboxsync{
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Remember new machine ID: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_strMachineID = strMachineID;
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Prepare: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync prepare();
91204831cf07b1a2d129a00380d344c69390b845vboxsync}
91204831cf07b1a2d129a00380d344c69390b845vboxsync
91204831cf07b1a2d129a00380d344c69390b845vboxsyncvoid UIMenuBarEditorWidget::setActionPool(UIActionPool *pActionPool)
91204831cf07b1a2d129a00380d344c69390b845vboxsync{
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Remember new action-pool: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_pActionPool = pActionPool;
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Prepare: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync prepare();
91204831cf07b1a2d129a00380d344c69390b845vboxsync}
91204831cf07b1a2d129a00380d344c69390b845vboxsync
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsyncvoid UIMenuBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID)
cc481874159fb224c588ff1974534c75400e3684vboxsync{
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync /* Skip unrelated machine IDs: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync if (machineID() != strMachineID)
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync return;
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#ifndef Q_WS_MAC
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Update enable-checkbox: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync updateEnableCheckbox();
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update menus: */
cc481874159fb224c588ff1974534c75400e3684vboxsync updateMenus();
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#ifndef RT_OS_DARWIN
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsyncvoid UIMenuBarEditorWidget::sltHandleMenuBarEnableToggle(bool fEnabled)
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync{
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Toggle enable-checkbox if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync {
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Check whether this value is really changed: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync const bool fMenuBarEnabled = gEDataManager->menuBarEnabled(machineID());
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync if (fMenuBarEnabled != fEnabled)
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync {
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Set new value: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync gEDataManager->setMenuBarEnabled(fEnabled, machineID());
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync }
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync }
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync}
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !RT_OS_DARWIN */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::sltHandleMenuBarMenuClick()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Make sure sender is valid: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pAction = qobject_cast<QAction*>(sender());
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(pAction);
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Depending on triggered action class: */
cc481874159fb224c588ff1974534c75400e3684vboxsync switch (pAction->property("class").toInt())
cc481874159fb224c588ff1974534c75400e3684vboxsync {
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync case UIExtraDataMetaDefs::MenuType_All:
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get sender type: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync const UIExtraDataMetaDefs::MenuType 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());
cc481874159fb224c588ff1974534c75400e3684vboxsync break;
cc481874159fb224c588ff1974534c75400e3684vboxsync }
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync case UIExtraDataMetaDefs::MenuType_Application:
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync {
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());
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync break;
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync }
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync case UIExtraDataMetaDefs::MenuType_Machine:
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 break;
cc481874159fb224c588ff1974534c75400e3684vboxsync }
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync case UIExtraDataMetaDefs::MenuType_View:
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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());
cc481874159fb224c588ff1974534c75400e3684vboxsync break;
cc481874159fb224c588ff1974534c75400e3684vboxsync }
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync case UIExtraDataMetaDefs::MenuType_Input:
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync {
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());
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync break;
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync }
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync case UIExtraDataMetaDefs::MenuType_Devices:
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 break;
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync#ifdef VBOX_WITH_DEBUGGER_GUI
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync case UIExtraDataMetaDefs::MenuType_Debug:
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 break;
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#ifdef Q_WS_MAC
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync case UIExtraDataMetaDefs::MenuType_Window:
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync {
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 break;
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync }
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync case UIExtraDataMetaDefs::MenuType_Help:
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 break;
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync default: break;
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepare()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Do nothing if already prepared: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync if (m_fPrepared)
91204831cf07b1a2d129a00380d344c69390b845vboxsync return;
91204831cf07b1a2d129a00380d344c69390b845vboxsync
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Do not prepare if machine ID or action-pool is not set: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync if (m_strMachineID.isEmpty() || !m_pActionPool)
91204831cf07b1a2d129a00380d344c69390b845vboxsync return;
91204831cf07b1a2d129a00380d344c69390b845vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create main-layout: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pMainLayout = new QHBoxLayout(this);
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(m_pMainLayout);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure main-layout: */
cc481874159fb224c588ff1974534c75400e3684vboxsync int iLeft, iTop, iRight, iBottom;
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Standard margins should not be too big: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync iLeft = qMin(iLeft, 10);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync iTop = qMin(iTop, 10);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync iRight = qMin(iRight, 10);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync iBottom = qMin(iBottom, 10);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Top margin should be smaller for the common case: */
cc481874159fb224c588ff1974534c75400e3684vboxsync if (iTop >= 5)
cc481874159fb224c588ff1974534c75400e3684vboxsync iTop -= 5;
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#ifndef Q_WS_MAC
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Right margin should be bigger for the settings case: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync if (m_fStartedFromVMSettings)
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync iRight += 5;
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Apply margins/spacing finally: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom);
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pMainLayout->setSpacing(0);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pToolBar = new UIToolBar;
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(m_pToolBar);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Prepare menus: */
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareMenus();
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add tool-bar into main-layout: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pMainLayout->addWidget(m_pToolBar);
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Insert stretch: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pMainLayout->addStretch();
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Create close-button if necessary: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync if (!m_fStartedFromVMSettings)
cc481874159fb224c588ff1974534c75400e3684vboxsync {
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_pButtonClose = new QIToolButton;
91204831cf07b1a2d129a00380d344c69390b845vboxsync AssertPtrReturnVoid(m_pButtonClose);
91204831cf07b1a2d129a00380d344c69390b845vboxsync {
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Configure close-button: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_pButtonClose->setFocusPolicy(Qt::StrongFocus);
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_pButtonClose->setShortcut(Qt::Key_Escape);
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: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_pMainLayout->addWidget(m_pButtonClose);
91204831cf07b1a2d129a00380d344c69390b845vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync }
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#ifndef Q_WS_MAC
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Create enable-checkbox if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync else
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync {
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync m_pCheckBoxEnable = new QCheckBox;
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync AssertPtrReturnVoid(m_pCheckBoxEnable);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync {
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 m_pMainLayout->addWidget(m_pCheckBoxEnable);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Update enable-checkbox: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync updateEnableCheckbox();
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync }
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync }
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Mark as prepared: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_fPrepared = true;
91204831cf07b1a2d129a00380d344c69390b845vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Translate contents: */
cc481874159fb224c588ff1974534c75400e3684vboxsync retranslateUi();
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepareMenus()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create menus: */
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareMenuApplication();
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareMenuMachine();
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareMenuView();
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync prepareMenuInput();
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareMenuDevices();
cc481874159fb224c588ff1974534c75400e3684vboxsync#ifdef VBOX_WITH_DEBUGGER_GUI
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareMenuDebug();
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#ifdef Q_WS_MAC
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync prepareMenuWindow();
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareMenuHelp();
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Listen for the menu-bar configuration changes: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync this, SLOT(sltHandleConfigurationChange(const QString&)));
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update menus: */
cc481874159fb224c588ff1974534c75400e3684vboxsync updateMenus();
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync#ifdef Q_WS_MAC
cc481874159fb224c588ff1974534c75400e3684vboxsyncQMenu* UIMenuBarEditorWidget::prepareNamedMenu(const QString &strName)
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create named menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pNamedMenu = new QMenu(strName, m_pToolBar);
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pNamedMenu, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure named menu: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync pNamedMenu->setProperty("class", UIExtraDataMetaDefs::MenuType_Application);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get named menu action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pNamedMenuAction = pNamedMenu->menuAction();
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pNamedMenuAction, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add menu action into tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pToolBar->addAction(pNamedMenuAction);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get named menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QToolButton *pNamedMenuToolButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pNamedMenuAction));
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pNamedMenuToolButton, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure named menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pNamedMenuToolButton->setPopupMode(QToolButton::MenuButtonPopup);
cc481874159fb224c588ff1974534c75400e3684vboxsync pNamedMenuToolButton->setAutoRaise(true);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create spacing after named menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QWidget *pSpacing = new QWidget;
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pSpacing, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure spacing: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pSpacing->setFixedSize(5, 1);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add spacing into tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pToolBar->addWidget(pSpacing);
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Return named menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync return pNamedMenu;
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncQMenu* UIMenuBarEditorWidget::prepareCopiedMenu(const UIAction *pAction)
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create copied menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pCopiedMenu = new QMenu(pAction->name(), m_pToolBar);
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pCopiedMenu, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenu->setProperty("class", pAction->extraDataID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get copied menu action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pCopiedMenuAction = pCopiedMenu->menuAction();
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pCopiedMenuAction, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied menu action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenuAction->setCheckable(true);
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 m_pToolBar->addAction(pCopiedMenuAction);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get copied menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QToolButton *pCopiedMenuToolButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pCopiedMenuAction));
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pCopiedMenuToolButton, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenuToolButton->setPopupMode(QToolButton::MenuButtonPopup);
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenuToolButton->setAutoRaise(true);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create spacing after copied menu tool-button: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QWidget *pSpacing = new QWidget;
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pSpacing, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure spacing: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pSpacing->setFixedSize(5, 1);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Add spacing into tool-bar: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_pToolBar->addWidget(pSpacing);
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Return copied menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync return pCopiedMenu;
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync#if 0
cc481874159fb224c588ff1974534c75400e3684vboxsyncQMenu* UIMenuBarEditorWidget::prepareCopiedSubMenu(QMenu *pMenu, const UIAction *pAction)
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create copied sub-menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pCopiedMenu = pMenu->addMenu(pAction->name());
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pCopiedMenu, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied sub-menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenu->setProperty("class", pMenu->property("class"));
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get copied sub-menu action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pCopiedMenuAction = pCopiedMenu->menuAction();
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pCopiedMenuAction, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied sub-menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedMenuAction->setCheckable(true);
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 }
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Return copied sub-menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync return pCopiedMenu;
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif
cc481874159fb224c588ff1974534c75400e3684vboxsync
fd9afeabf56257550f294200c88b018958a9ab48vboxsyncQAction* UIMenuBarEditorWidget::prepareNamedAction(QMenu *pMenu, const QString &strName,
fd9afeabf56257550f294200c88b018958a9ab48vboxsync int iExtraDataID, const QString &strExtraDataID)
fd9afeabf56257550f294200c88b018958a9ab48vboxsync{
fd9afeabf56257550f294200c88b018958a9ab48vboxsync /* Create copied action: */
fd9afeabf56257550f294200c88b018958a9ab48vboxsync QAction *pCopiedAction = pMenu->addAction(strName);
fd9afeabf56257550f294200c88b018958a9ab48vboxsync AssertPtrReturn(pCopiedAction, 0);
fd9afeabf56257550f294200c88b018958a9ab48vboxsync {
fd9afeabf56257550f294200c88b018958a9ab48vboxsync /* Configure copied action: */
fd9afeabf56257550f294200c88b018958a9ab48vboxsync pCopiedAction->setCheckable(true);
fd9afeabf56257550f294200c88b018958a9ab48vboxsync pCopiedAction->setProperty("class", pMenu->property("class"));
fd9afeabf56257550f294200c88b018958a9ab48vboxsync pCopiedAction->setProperty("type", iExtraDataID);
fd9afeabf56257550f294200c88b018958a9ab48vboxsync connect(pCopiedAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
fd9afeabf56257550f294200c88b018958a9ab48vboxsync m_actions.insert(strExtraDataID, pCopiedAction);
fd9afeabf56257550f294200c88b018958a9ab48vboxsync }
fd9afeabf56257550f294200c88b018958a9ab48vboxsync /* Return copied action: */
fd9afeabf56257550f294200c88b018958a9ab48vboxsync return pCopiedAction;
fd9afeabf56257550f294200c88b018958a9ab48vboxsync}
fd9afeabf56257550f294200c88b018958a9ab48vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncQAction* UIMenuBarEditorWidget::prepareCopiedAction(QMenu *pMenu, const UIAction *pAction)
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Create copied action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QAction *pCopiedAction = pMenu->addAction(pAction->name());
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturn(pCopiedAction, 0);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Configure copied action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync pCopiedAction->setCheckable(true);
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 }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Return copied action: */
cc481874159fb224c588ff1974534c75400e3684vboxsync return pCopiedAction;
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepareMenuApplication()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync#ifdef Q_WS_MAC
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync QMenu *pMenu = prepareNamedMenu("Application");
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync#else /* !Q_WS_MAC */
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_M_Application));
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(pMenu);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
2e76757ceed513b38c43d0f33cd24cc18baf3ffevboxsync#ifdef Q_WS_MAC
1ae2aeb1d8bb1614cf94d8de9a5afed3a2510161vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_About));
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
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 pMenu->addSeparator();
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 pMenu->addSeparator();
20646d909093709d168a9cddb9d8c35ddc65b4fevboxsync# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
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 }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepareMenuMachine()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Machine));
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(pMenu);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 pMenu->addSeparator();
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 }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepareMenuView()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_View));
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(pMenu);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 pMenu->addSeparator();
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize));
cc481874159fb224c588ff1974534c75400e3684vboxsync pMenu->addSeparator();
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));
82709943290f6a5e918ff2a081587de52191c791vboxsync pMenu->addSeparator();
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_MenuBar));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_StatusBar));
cc481874159fb224c588ff1974534c75400e3684vboxsync pMenu->addSeparator();
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));
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsyncvoid UIMenuBarEditorWidget::prepareMenuInput()
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync{
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Copy menu: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Input));
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync AssertPtrReturnVoid(pMenu);
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync {
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard));
5a159e1220eda615e07ca88097bd60d07a3ba2f1vboxsync pMenu->addSeparator();
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration));
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync }
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync}
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepareMenuDevices()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Devices));
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(pMenu);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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));
037c7c146972a56b4f708962044470c73553f9dfvboxsync pMenu->addSeparator();
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedClipboard));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_DragAndDrop));
cc481874159fb224c588ff1974534c75400e3684vboxsync pMenu->addSeparator();
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools));
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync#ifdef VBOX_WITH_DEBUGGER_GUI
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepareMenuDebug()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Debug));
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(pMenu);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
cc481874159fb224c588ff1974534c75400e3684vboxsync
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#ifdef Q_WS_MAC
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsyncvoid UIMenuBarEditorWidget::prepareMenuWindow()
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync{
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Copy menu: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_M_Window));
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync AssertPtrReturnVoid(pMenu);
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync {
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Window_S_Minimize));
fd632ad212b0eb375edb51a388a5886daa8ed1ebvboxsync pMenu->addSeparator();
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync prepareNamedAction(pMenu, tr("Switch"),
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync UIExtraDataMetaDefs::MenuWindowActionType_Switch,
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync gpConverter->toInternalString(UIExtraDataMetaDefs::MenuWindowActionType_Switch));
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync }
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync}
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::prepareMenuHelp()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Copy menu: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_Menu_Help));
cc481874159fb224c588ff1974534c75400e3684vboxsync AssertPtrReturnVoid(pMenu);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_Contents));
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_WebSite));
cc481874159fb224c588ff1974534c75400e3684vboxsync pMenu->addSeparator();
cc481874159fb224c588ff1974534c75400e3684vboxsync#ifndef Q_WS_MAC
cc481874159fb224c588ff1974534c75400e3684vboxsync prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_About));
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#ifndef Q_WS_MAC
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsyncvoid UIMenuBarEditorWidget::updateEnableCheckbox()
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync{
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Update enable-checkbox if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync {
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync m_pCheckBoxEnable->blockSignals(true);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync m_pCheckBoxEnable->setChecked(gEDataManager->menuBarEnabled(machineID()));
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync m_pCheckBoxEnable->blockSignals(false);
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync }
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync}
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::updateMenus()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Recache menu-bar configuration: */
fb84639c1f4fd5c78a79e35c19514d893cb54d8fvboxsync const UIExtraDataMetaDefs::MenuType restrictionsMenuBar = gEDataManager->restrictedRuntimeMenuTypes(machineID());
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get static meta-object: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
cc481874159fb224c588ff1974534c75400e3684vboxsync
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 {
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Get iterated enum-value: */
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync const UIExtraDataMetaDefs::MenuType enumValue =
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 ||
492de26ad701185b6f6cf63eb346b34a4440268dvboxsync enumValue == UIExtraDataMetaDefs::MenuType_All)
cc481874159fb224c588ff1974534c75400e3684vboxsync continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync if (!m_actions.contains(strKey))
cc481874159fb224c588ff1974534c75400e3684vboxsync continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuBar & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update known menu-bar menus: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync updateMenuApplication();
cc481874159fb224c588ff1974534c75400e3684vboxsync updateMenuMachine();
cc481874159fb224c588ff1974534c75400e3684vboxsync updateMenuView();
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync updateMenuInput();
cc481874159fb224c588ff1974534c75400e3684vboxsync updateMenuDevices();
cc481874159fb224c588ff1974534c75400e3684vboxsync#ifdef VBOX_WITH_DEBUGGER_GUI
cc481874159fb224c588ff1974534c75400e3684vboxsync updateMenuDebug();
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#ifdef Q_WS_MAC
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync updateMenuWindow();
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync updateMenuHelp();
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
23d244c365b2e2387698d91db556b5bca2a50c25vboxsyncvoid UIMenuBarEditorWidget::updateMenuApplication()
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync{
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
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* We have UIExtraDataMetaDefs::MenuApplicationActionType enum registered, so we can enumerate it: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync const int iEnumIndex = smo.indexOfEnumerator("MenuApplicationActionType");
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Handle other enum-values: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync {
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 continue;
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Which key required action registered under? */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync if (!m_actions.contains(strKey))
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync continue;
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync /* Update action 'checked' state: */
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuApplication & enumValue));
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync }
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync}
23d244c365b2e2387698d91db556b5bca2a50c25vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::updateMenuMachine()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
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
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuMachineActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuMachineActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync if (!m_actions.contains(strKey))
cc481874159fb224c588ff1974534c75400e3684vboxsync continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuMachine & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::updateMenuView()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
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
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuViewActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuViewActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync if (!m_actions.contains(strKey))
cc481874159fb224c588ff1974534c75400e3684vboxsync continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuView & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsyncvoid UIMenuBarEditorWidget::updateMenuInput()
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync{
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
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuInputActionType enum registered, so we can enumerate it: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuInputActionType");
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Handle other enum-values: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync {
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 continue;
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Which key required action registered under? */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync const QString strKey = gpConverter->toInternalString(enumValue);
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync if (!m_actions.contains(strKey))
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync continue;
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync /* Update action 'checked' state: */
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuInput & enumValue));
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync }
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync}
64ea3f1d9ca452c99cde7a135f5a3908c9bffcaavboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::updateMenuDevices()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
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
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDevicesActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync if (!m_actions.contains(strKey))
cc481874159fb224c588ff1974534c75400e3684vboxsync continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuDevices & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync#ifdef VBOX_WITH_DEBUGGER_GUI
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::updateMenuDebug()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
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
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDebuggerActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync if (!m_actions.contains(strKey))
cc481874159fb224c588ff1974534c75400e3684vboxsync continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuDebug & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
cc481874159fb224c588ff1974534c75400e3684vboxsync
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#ifdef Q_WS_MAC
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsyncvoid UIMenuBarEditorWidget::updateMenuWindow()
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync{
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
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* We have UIExtraDataMetaDefs::MenuWindowActionType enum registered, so we can enumerate it: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync const int iEnumIndex = smo.indexOfEnumerator("MenuWindowActionType");
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Handle other enum-values: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync {
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 continue;
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Which key required action registered under? */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync if (!m_actions.contains(strKey))
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync continue;
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync /* Update action 'checked' state: */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuWindow & enumValue));
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync }
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync}
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync#endif /* Q_WS_MAC */
f0821e819e51b95ecaf7b12c742da563b4ddf7e5vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::updateMenuHelp()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
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
cc481874159fb224c588ff1974534c75400e3684vboxsync /* We have UIExtraDataMetaDefs::MenuHelpActionType enum registered, so we can enumerate it: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const int iEnumIndex = smo.indexOfEnumerator("MenuHelpActionType");
cc481874159fb224c588ff1974534c75400e3684vboxsync QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Handle other enum-values: */
cc481874159fb224c588ff1974534c75400e3684vboxsync for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
cc481874159fb224c588ff1974534c75400e3684vboxsync {
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 continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Which key required action registered under? */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QString strKey = gpConverter->toInternalString(enumValue);
cc481874159fb224c588ff1974534c75400e3684vboxsync if (!m_actions.contains(strKey))
cc481874159fb224c588ff1974534c75400e3684vboxsync continue;
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Update action 'checked' state: */
cc481874159fb224c588ff1974534c75400e3684vboxsync m_actions.value(strKey)->setChecked(!(restrictionsMenuHelp & enumValue));
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::retranslateUi()
cc481874159fb224c588ff1974534c75400e3684vboxsync{
91204831cf07b1a2d129a00380d344c69390b845vboxsync /* Translate close-button if necessary: */
91204831cf07b1a2d129a00380d344c69390b845vboxsync if (!m_fStartedFromVMSettings && m_pButtonClose)
91204831cf07b1a2d129a00380d344c69390b845vboxsync m_pButtonClose->setToolTip(tr("Close"));
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#ifndef Q_WS_MAC
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync /* Translate enable-checkbox if necessary: */
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
011c737fd75427a7cc0b1e9901eee51e08c93a32vboxsync m_pCheckBoxEnable->setToolTip(tr("Enable Menu Bar"));
b383a64b1f178415000bda9159eb7079c27edd4evboxsync#endif /* !Q_WS_MAC */
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncvoid UIMenuBarEditorWidget::paintEvent(QPaintEvent*)
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Prepare painter: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QPainter painter(this);
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Prepare palette colors: */
cc481874159fb224c588ff1974534c75400e3684vboxsync const QPalette pal = palette();
cc481874159fb224c588ff1974534c75400e3684vboxsync QColor color0 = pal.color(QPalette::Window);
cc481874159fb224c588ff1974534c75400e3684vboxsync QColor color1 = pal.color(QPalette::Window).lighter(110);
cc481874159fb224c588ff1974534c75400e3684vboxsync color1.setAlpha(0);
cc481874159fb224c588ff1974534c75400e3684vboxsync QColor color2 = pal.color(QPalette::Window).darker(200);
cc481874159fb224c588ff1974534c75400e3684vboxsync#if defined(Q_WS_WIN) || defined(Q_WS_X11)
cc481874159fb224c588ff1974534c75400e3684vboxsync QColor color3 = pal.color(QPalette::Window).darker(120);
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* Q_WS_WIN || Q_WS_X11 */
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Left corner: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QRadialGradient grad1(QPointF(5, height() - 5), 5);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync grad1.setColorAt(0, color2);
cc481874159fb224c588ff1974534c75400e3684vboxsync grad1.setColorAt(1, color1);
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Right corner: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QRadialGradient grad2(QPointF(width() - 5, height() - 5), 5);
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync grad2.setColorAt(0, color2);
cc481874159fb224c588ff1974534c75400e3684vboxsync grad2.setColorAt(1, color1);
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Bottom line: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QLinearGradient grad3(QPointF(5, height()), QPointF(5, height() - 5));
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync grad3.setColorAt(0, color1);
cc481874159fb224c588ff1974534c75400e3684vboxsync grad3.setColorAt(1, color2);
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Left line: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QLinearGradient grad4(QPointF(0, height() - 5), QPointF(5, height() - 5));
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync grad4.setColorAt(0, color1);
cc481874159fb224c588ff1974534c75400e3684vboxsync grad4.setColorAt(1, color2);
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Right line: */
cc481874159fb224c588ff1974534c75400e3684vboxsync QLinearGradient grad5(QPointF(width(), height() - 5), QPointF(width() - 5, height() - 5));
cc481874159fb224c588ff1974534c75400e3684vboxsync {
cc481874159fb224c588ff1974534c75400e3684vboxsync grad5.setColorAt(0, color1);
cc481874159fb224c588ff1974534c75400e3684vboxsync grad5.setColorAt(1, color2);
cc481874159fb224c588ff1974534c75400e3684vboxsync }
cc481874159fb224c588ff1974534c75400e3684vboxsync
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
cc481874159fb224c588ff1974534c75400e3684vboxsync#if defined(Q_WS_WIN) || defined(Q_WS_X11)
cc481874159fb224c588ff1974534c75400e3684vboxsync /* Paint frames: */
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.save();
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.setPen(color3);
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 if (m_fStartedFromVMSettings)
91204831cf07b1a2d129a00380d344c69390b845vboxsync painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, 0), QPoint(5 + 1, 0)));
cc481874159fb224c588ff1974534c75400e3684vboxsync painter.restore();
cc481874159fb224c588ff1974534c75400e3684vboxsync#endif /* Q_WS_WIN || Q_WS_X11 */
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsync
cc481874159fb224c588ff1974534c75400e3684vboxsyncUIMenuBarEditorWindow::UIMenuBarEditorWindow(UIMachineWindow *pParent, UIActionPool *pActionPool)
d2d713371456834ea31f87eb8325171cf70545e7vboxsync#ifndef Q_WS_MAC
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 */
cc481874159fb224c588ff1974534c75400e3684vboxsync{
cc481874159fb224c588ff1974534c75400e3684vboxsync}
cc481874159fb224c588ff1974534c75400e3684vboxsync