VirtualBox

Changeset 53320 in vbox


Ignore:
Timestamp:
Nov 13, 2014 11:23:02 AM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7599: Handle menu-bar / status-bar extra-data changes on the broadcast basis.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r53311 r53320  
    35123512        }
    35133513    }
    3514     /* Make sure event came for the currently running VM: */
    3515     else if (   vboxGlobal().isVMConsoleProcess()
    3516              && strMachineID == vboxGlobal().managedVMUuid())
    3517     {
    3518         /* Status-bar configuration change: */
     3514    /* Machine extra-data 'change' event: */
     3515    else
     3516    {
     3517        /* Current VM only: */
     3518        if (   vboxGlobal().isVMConsoleProcess()
     3519            && strMachineID == vboxGlobal().managedVMUuid())
     3520        {
     3521            /* HID LEDs sync state changed (allowed if not restricted)? */
     3522            if (strKey == GUI_HidLedsSync)
     3523                emit sigHidLedsSyncStateChange(!isFeatureRestricted(strKey, strMachineID));
     3524#ifdef Q_WS_MAC
     3525            /* 'Dock icon' appearance changed (allowed if not restricted)? */
     3526            else if (   strKey == GUI_RealtimeDockIconUpdateEnabled
     3527                     || strKey == GUI_RealtimeDockIconUpdateMonitor)
     3528                emit sigDockIconAppearanceChange(!isFeatureRestricted(strKey, strMachineID));
     3529#endif /* Q_WS_MAC */
     3530        }
     3531
     3532        /* Menu-bar configuration change: */
    35193533        if (strKey == GUI_MenuBar_Enabled ||
    35203534            strKey == GUI_RestrictedRuntimeMenus ||
     
    35303544#endif /* VBOX_WITH_DEBUGGER_GUI */
    35313545            strKey == GUI_RestrictedRuntimeHelpMenuActions)
    3532             emit sigMenuBarConfigurationChange();
     3546            emit sigMenuBarConfigurationChange(strMachineID);
    35333547        /* Status-bar configuration change: */
    35343548        else if (strKey == GUI_StatusBar_Enabled ||
    35353549                 strKey == GUI_RestrictedStatusBarIndicators ||
    35363550                 strKey == GUI_StatusBar_IndicatorOrder)
    3537             emit sigStatusBarConfigurationChange();
    3538         /* HID LEDs sync state changed (allowed if not restricted)? */
    3539         else if (strKey == GUI_HidLedsSync)
    3540             emit sigHidLedsSyncStateChange(!isFeatureRestricted(strKey, strMachineID));
    3541 #ifdef Q_WS_MAC
    3542         /* 'Dock icon' appearance changed (allowed if not restricted)? */
    3543         else if (   strKey == GUI_RealtimeDockIconUpdateEnabled
    3544                  || strKey == GUI_RealtimeDockIconUpdateMonitor)
    3545             emit sigDockIconAppearanceChange(!isFeatureRestricted(strKey, strMachineID));
    3546 #endif /* Q_WS_MAC */
     3551            emit sigStatusBarConfigurationChange(strMachineID);
    35473552    }
    35483553
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r53250 r53320  
    6969
    7070    /** Notifies about menu-bar configuration change. */
    71     void sigMenuBarConfigurationChange();
     71    void sigMenuBarConfigurationChange(const QString &strMachineID);
    7272    /** Notifies about status-bar configuration change. */
    73     void sigStatusBarConfigurationChange();
     73    void sigStatusBarConfigurationChange(const QString &strMachineID);
    7474
    7575    /** Notifies about HID LEDs synchronization state change. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r53086 r53320  
    18851885#endif /* VBOX_WITH_DEBUGGER_GUI */
    18861886
    1887 void UIActionPoolRuntime::sltHandleConfigurationChange()
    1888 {
     1887void UIActionPoolRuntime::sltHandleConfigurationChange(const QString &strMachineID)
     1888{
     1889    /* Skip unrelated machine IDs: */
     1890    if (vboxGlobal().managedVMUuid() != strMachineID)
     1891        return;
     1892
    18891893    /* Update configuration: */
    18901894    updateConfiguration();
     
    20592063    /* Prepare connections: */
    20602064    connect(gShortcutPool, SIGNAL(sigMachineShortcutsReloaded()), this, SLOT(sltApplyShortcuts()));
    2061     connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange()), this, SLOT(sltHandleConfigurationChange()));
     2065    connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
     2066            this, SLOT(sltHandleConfigurationChange(const QString&)));
    20622067
    20632068    /* Call to base-class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r52937 r53320  
    181181
    182182    /** Handles configuration-change. */
    183     void sltHandleConfigurationChange();
     183    void sltHandleConfigurationChange(const QString &strMachineID);
    184184
    185185    /** Prepare 'View' : 'Virtual Screen #' menu routine (Normal, Scale). */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r53301 r53320  
    10731073}
    10741074
    1075 void UIIndicatorsPool::sltHandleConfigurationChange()
    1076 {
     1075void UIIndicatorsPool::sltHandleConfigurationChange(const QString &strMachineID)
     1076{
     1077    /* Skip unrelated machine IDs: */
     1078    if (vboxGlobal().managedVMUuid() != strMachineID)
     1079        return;
     1080
    10771081    /* Update pool: */
    10781082    updatePool();
     
    11501154{
    11511155    /* Listen for the status-bar configuration changes: */
    1152     connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange()),
    1153             this, SLOT(sltHandleConfigurationChange()));
     1156    connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange(const QString&)),
     1157            this, SLOT(sltHandleConfigurationChange(const QString&)));
    11541158}
    11551159
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h

    r52658 r53320  
    6666
    6767    /** Handles configuration change. */
    68     void sltHandleConfigurationChange();
     68    void sltHandleConfigurationChange(const QString &strMachineID);
    6969
    7070    /** Handles indicator-states auto-update. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp

    r52939 r53320  
    5858public:
    5959
    60     /** Constructor, taking @a pActionPool argument. */
    61     UIMenuBarEditorWidget(UIActionPool *pActionPool);
     60    /** Constructor.
     61      * @param pParent      is passed to QWidget constructor,
     62      * @param strMachineID brings the machine ID to be used by the editor,
     63      * @param pActionPool  brings the action-pool to be used by the editor. */
     64    UIMenuBarEditorWidget(QWidget *pParent,
     65                          const QString &strMachineID,
     66                          UIActionPool *pActionPool);
     67
     68    /** Returns the machine ID instance. */
     69    const QString& machineID() const { return m_strMachineID; }
    6270
    6371    /** Returns the action-pool reference. */
     
    6775
    6876    /** Handles configuration change. */
    69     void sltHandleConfigurationChange();
     77    void sltHandleConfigurationChange(const QString &strMachineID);
    7078
    7179    /** Handles menu-bar menu click. */
     
    143151    /** @name General
    144152      * @{ */
     153        /** Holds the machine ID instance. */
     154        QString m_strMachineID;
    145155        /** Holds the action-pool reference. */
    146156        const UIActionPool *m_pActionPool;
     
    160170};
    161171
    162 
    163 UIMenuBarEditorWidget::UIMenuBarEditorWidget(UIActionPool *pActionPool)
    164     : m_pActionPool(pActionPool)
     172UIMenuBarEditorWidget::UIMenuBarEditorWidget(QWidget *pParent,
     173                                             const QString &strMachineID,
     174                                             UIActionPool *pActionPool)
     175    : QIWithRetranslateUI2<QWidget>(pParent)
     176    , m_strMachineID(strMachineID)
     177    , m_pActionPool(pActionPool)
    165178    , m_pMainLayout(0)
    166179    , m_pToolBar(0)
     
    171184}
    172185
    173 void UIMenuBarEditorWidget::sltHandleConfigurationChange()
    174 {
     186void UIMenuBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID)
     187{
     188    /* Skip unrelated machine IDs: */
     189    if (machineID() != strMachineID)
     190        return;
     191
    175192    /* Update menus: */
    176193    updateMenus();
     
    192209                static_cast<UIExtraDataMetaDefs::MenuType>(pAction->property("type").toInt());
    193210            /* Load current menu-bar restrictions: */
    194             UIExtraDataMetaDefs::MenuType restrictions = gEDataManager->restrictedRuntimeMenuTypes(vboxGlobal().managedVMUuid());
     211            UIExtraDataMetaDefs::MenuType restrictions = gEDataManager->restrictedRuntimeMenuTypes(machineID());
    195212            /* Invert restriction for sender type: */
    196213            restrictions = (UIExtraDataMetaDefs::MenuType)(restrictions ^ type);
    197214            /* Save updated menu-bar restrictions: */
    198             gEDataManager->setRestrictedRuntimeMenuTypes(restrictions, vboxGlobal().managedVMUuid());
     215            gEDataManager->setRestrictedRuntimeMenuTypes(restrictions, machineID());
    199216            break;
    200217        }
     
    206223                static_cast<UIExtraDataMetaDefs::MenuApplicationActionType>(pAction->property("type").toInt());
    207224            /* Load current menu-bar restrictions: */
    208             UIExtraDataMetaDefs::MenuApplicationActionType restrictions = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(vboxGlobal().managedVMUuid());
     225            UIExtraDataMetaDefs::MenuApplicationActionType restrictions = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID());
    209226            /* Invert restriction for sender type: */
    210227            restrictions = (UIExtraDataMetaDefs::MenuApplicationActionType)(restrictions ^ type);
    211228            /* Save updated menu-bar restrictions: */
    212             gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(restrictions, vboxGlobal().managedVMUuid());
     229            gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(restrictions, machineID());
    213230            break;
    214231        }
     
    220237                static_cast<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(pAction->property("type").toInt());
    221238            /* Load current menu-bar restrictions: */
    222             UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictions = gEDataManager->restrictedRuntimeMenuMachineActionTypes(vboxGlobal().managedVMUuid());
     239            UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictions = gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID());
    223240            /* Invert restriction for sender type: */
    224241            restrictions = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)(restrictions ^ type);
    225242            /* Save updated menu-bar restrictions: */
    226             gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(restrictions, vboxGlobal().managedVMUuid());
     243            gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(restrictions, machineID());
    227244            break;
    228245        }
     
    233250                static_cast<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(pAction->property("type").toInt());
    234251            /* Load current menu-bar restrictions: */
    235             UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictions = gEDataManager->restrictedRuntimeMenuViewActionTypes(vboxGlobal().managedVMUuid());
     252            UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictions = gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID());
    236253            /* Invert restriction for sender type: */
    237254            restrictions = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)(restrictions ^ type);
    238255            /* Save updated menu-bar restrictions: */
    239             gEDataManager->setRestrictedRuntimeMenuViewActionTypes(restrictions, vboxGlobal().managedVMUuid());
     256            gEDataManager->setRestrictedRuntimeMenuViewActionTypes(restrictions, machineID());
    240257            break;
    241258        }
     
    246263                static_cast<UIExtraDataMetaDefs::RuntimeMenuInputActionType>(pAction->property("type").toInt());
    247264            /* Load current menu-bar restrictions: */
    248             UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictions = gEDataManager->restrictedRuntimeMenuInputActionTypes(vboxGlobal().managedVMUuid());
     265            UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictions = gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID());
    249266            /* Invert restriction for sender type: */
    250267            restrictions = (UIExtraDataMetaDefs::RuntimeMenuInputActionType)(restrictions ^ type);
    251268            /* Save updated menu-bar restrictions: */
    252             gEDataManager->setRestrictedRuntimeMenuInputActionTypes(restrictions, vboxGlobal().managedVMUuid());
     269            gEDataManager->setRestrictedRuntimeMenuInputActionTypes(restrictions, machineID());
    253270            break;
    254271        }
     
    259276                static_cast<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(pAction->property("type").toInt());
    260277            /* Load current menu-bar restrictions: */
    261             UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictions = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(vboxGlobal().managedVMUuid());
     278            UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictions = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID());
    262279            /* Invert restriction for sender type: */
    263280            restrictions = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictions ^ type);
    264281            /* Save updated menu-bar restrictions: */
    265             gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(restrictions, vboxGlobal().managedVMUuid());
     282            gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(restrictions, machineID());
    266283            break;
    267284        }
     
    273290                static_cast<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(pAction->property("type").toInt());
    274291            /* Load current menu-bar restrictions: */
    275             UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictions = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(vboxGlobal().managedVMUuid());
     292            UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictions = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID());
    276293            /* Invert restriction for sender type: */
    277294            restrictions = (UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType)(restrictions ^ type);
    278295            /* Save updated menu-bar restrictions: */
    279             gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(restrictions, vboxGlobal().managedVMUuid());
     296            gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(restrictions, machineID());
    280297            break;
    281298        }
     
    287304                static_cast<UIExtraDataMetaDefs::MenuHelpActionType>(pAction->property("type").toInt());
    288305            /* Load current menu-bar restrictions: */
    289             UIExtraDataMetaDefs::MenuHelpActionType restrictions = gEDataManager->restrictedRuntimeMenuHelpActionTypes(vboxGlobal().managedVMUuid());
     306            UIExtraDataMetaDefs::MenuHelpActionType restrictions = gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID());
    290307            /* Invert restriction for sender type: */
    291308            restrictions = (UIExtraDataMetaDefs::MenuHelpActionType)(restrictions ^ type);
    292309            /* Save updated menu-bar restrictions: */
    293             gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(restrictions, vboxGlobal().managedVMUuid());
     310            gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(restrictions, machineID());
    294311            break;
    295312        }
     
    363380
    364381    /* Listen for the menu-bar configuration changes: */
    365     connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange()),
    366             this, SLOT(sltHandleConfigurationChange()));
     382    connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
     383            this, SLOT(sltHandleConfigurationChange(const QString&)));
    367384
    368385    /* Update menus: */
     
    644661{
    645662    /* Recache menu-bar configuration: */
    646     const UIExtraDataMetaDefs::MenuType restrictionsMenuBar = gEDataManager->restrictedRuntimeMenuTypes(vboxGlobal().managedVMUuid());
     663    const UIExtraDataMetaDefs::MenuType restrictionsMenuBar = gEDataManager->restrictedRuntimeMenuTypes(machineID());
    647664    /* Get static meta-object: */
    648665    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
     
    687704{
    688705    /* Recache menu-bar configuration: */
    689     const UIExtraDataMetaDefs::MenuApplicationActionType restrictionsMenuApplication = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(vboxGlobal().managedVMUuid());
     706    const UIExtraDataMetaDefs::MenuApplicationActionType restrictionsMenuApplication = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID());
    690707    /* Get static meta-object: */
    691708    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
     
    717734{
    718735    /* Recache menu-bar configuration: */
    719     const UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionsMenuMachine = gEDataManager->restrictedRuntimeMenuMachineActionTypes(vboxGlobal().managedVMUuid());
     736    const UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionsMenuMachine = gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID());
    720737    /* Get static meta-object: */
    721738    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
     
    746763{
    747764    /* Recache menu-bar configuration: */
    748     const UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionsMenuView = gEDataManager->restrictedRuntimeMenuViewActionTypes(vboxGlobal().managedVMUuid());
     765    const UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionsMenuView = gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID());
    749766    /* Get static meta-object: */
    750767    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
     
    775792{
    776793    /* Recache menu-bar configuration: */
    777     const UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictionsMenuInput = gEDataManager->restrictedRuntimeMenuInputActionTypes(vboxGlobal().managedVMUuid());
     794    const UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictionsMenuInput = gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID());
    778795    /* Get static meta-object: */
    779796    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
     
    804821{
    805822    /* Recache menu-bar configuration: */
    806     const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionsMenuDevices = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(vboxGlobal().managedVMUuid());
     823    const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionsMenuDevices = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID());
    807824    /* Get static meta-object: */
    808825    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
     
    834851{
    835852    /* Recache menu-bar configuration: */
    836     const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictionsMenuDebug = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(vboxGlobal().managedVMUuid());
     853    const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictionsMenuDebug = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID());
    837854    /* Get static meta-object: */
    838855    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
     
    864881{
    865882    /* Recache menu-bar configuration: */
    866     const UIExtraDataMetaDefs::MenuHelpActionType restrictionsMenuHelp = gEDataManager->restrictedRuntimeMenuHelpActionTypes(vboxGlobal().managedVMUuid());
     883    const UIExtraDataMetaDefs::MenuHelpActionType restrictionsMenuHelp = gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID());
    867884    /* Get static meta-object: */
    868885    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
     
    964981UIMenuBarEditorWindow::UIMenuBarEditorWindow(UIMachineWindow *pParent, UIActionPool *pActionPool)
    965982#ifndef Q_WS_MAC
    966     : UISlidingToolBar(pParent, pParent->menuBar(), new UIMenuBarEditorWidget(pActionPool), UISlidingToolBar::Position_Top)
     983    : UISlidingToolBar(pParent, pParent->menuBar(), new UIMenuBarEditorWidget(0, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
    967984#else /* Q_WS_MAC */
    968     : UISlidingToolBar(pParent, 0, new UIMenuBarEditorWidget(pActionPool), UISlidingToolBar::Position_Top)
     985    : UISlidingToolBar(pParent, 0, new UIMenuBarEditorWidget(0, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
    969986#endif /* Q_WS_MAC */
    970987{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r53227 r53320  
    637637
    638638#ifdef RT_OS_DARWIN
    639 void UISession::sltHandleMenuBarConfigurationChange()
    640 {
     639void UISession::sltHandleMenuBarConfigurationChange(const QString &strMachineID)
     640{
     641    /* Skip unrelated machine IDs: */
     642    if (vboxGlobal().managedVMUuid() != strMachineID)
     643        return;
     644
    641645    /* Update Mac OS X menu-bar: */
    642646    updateMenu();
     
    11381142        {
    11391143            /* Configure Mac OS X menu-bar: */
    1140             connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange()),
    1141                     this, SLOT(sltHandleMenuBarConfigurationChange()));
     1144            connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
     1145                    this, SLOT(sltHandleMenuBarConfigurationChange(const QString&)));
    11421146            /* Update Mac OS X menu-bar: */
    11431147            updateMenu();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r53047 r53320  
    309309#ifdef RT_OS_DARWIN
    310310    /** Mac OS X: Handles menu-bar configuration-change. */
    311     void sltHandleMenuBarConfigurationChange();
     311    void sltHandleMenuBarConfigurationChange(const QString &strMachineID);
    312312#endif /* RT_OS_DARWIN */
    313313
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp

    r52730 r53320  
    127127public:
    128128
    129     /** Constructor, passes @a pParent to the QWidget constructor. */
    130     UIStatusBarEditorWidget(QWidget *pParent = 0);
     129    /** Constructor.
     130      * @param pParent      is passed to QWidget constructor,
     131      * @param strMachineID brings the machine ID to be used by the editor. */
     132    UIStatusBarEditorWidget(QWidget *pParent,
     133                            const QString &strMachineID);
     134
     135    /** Returns the machine ID instance. */
     136    const QString& machineID() const { return m_strMachineID; }
    131137
    132138private slots:
    133139
    134140    /** Handles configuration change. */
    135     void sltHandleConfigurationChange();
     141    void sltHandleConfigurationChange(const QString &strMachineID);
    136142
    137143    /** Handles button click. */
     
    170176    /** Returns position for passed @a type. */
    171177    int position(IndicatorType type) const;
     178
     179    /** @name General
     180      * @{ */
     181        /** Holds the machine ID instance. */
     182        QString m_strMachineID;
     183    /** @} */
    172184
    173185    /** @name Contents
     
    345357
    346358
    347 UIStatusBarEditorWidget::UIStatusBarEditorWidget(QWidget *pParent /* = 0 */)
     359UIStatusBarEditorWidget::UIStatusBarEditorWidget(QWidget *pParent,
     360                                                 const QString &strMachineID)
    348361    : QIWithRetranslateUI2<QWidget>(pParent)
     362    , m_strMachineID(strMachineID)
    349363    , m_pMainLayout(0), m_pButtonLayout(0)
    350364    , m_pButtonClose(0)
     
    356370}
    357371
    358 void UIStatusBarEditorWidget::sltHandleConfigurationChange()
    359 {
     372void UIStatusBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID)
     373{
     374    /* Skip unrelated machine IDs: */
     375    if (machineID() != strMachineID)
     376        return;
     377
    360378    /* Update status buttons: */
    361379    updateStatusButtons();
     
    373391    /* Load current status-bar indicator restrictions: */
    374392    QList<IndicatorType> restrictions =
    375         gEDataManager->restrictedStatusBarIndicators(vboxGlobal().managedVMUuid());
     393        gEDataManager->restrictedStatusBarIndicators(machineID());
    376394
    377395    /* Invert restriction for sender type: */
     
    382400
    383401    /* Save updated status-bar indicator restrictions: */
    384     gEDataManager->setRestrictedStatusBarIndicators(restrictions, vboxGlobal().managedVMUuid());
     402    gEDataManager->setRestrictedStatusBarIndicators(restrictions, machineID());
    385403}
    386404
     
    464482
    465483    /* Listen for the status-bar configuration changes: */
    466     connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange()),
    467             this, SLOT(sltHandleConfigurationChange()));
     484    connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange(const QString&)),
     485            this, SLOT(sltHandleConfigurationChange(const QString&)));
    468486
    469487    /* Update status buttons: */
     
    490508{
    491509    /* Recache status-bar configuration: */
    492     m_restrictions = gEDataManager->restrictedStatusBarIndicators(vboxGlobal().managedVMUuid());
    493     m_order = gEDataManager->statusBarIndicatorOrder(vboxGlobal().managedVMUuid());
     510    m_restrictions = gEDataManager->restrictedStatusBarIndicators(machineID());
     511    m_order = gEDataManager->statusBarIndicatorOrder(machineID());
    494512    for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType)
    495513        if (iType != IndicatorType_Invalid && iType != IndicatorType_KeyboardExtension &&
     
    688706    /* Load current status-bar indicator order and make sure it's complete: */
    689707    QList<IndicatorType> order =
    690         gEDataManager->statusBarIndicatorOrder(vboxGlobal().managedVMUuid());
     708        gEDataManager->statusBarIndicatorOrder(machineID());
    691709    for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType)
    692710        if (iType != IndicatorType_Invalid && iType != IndicatorType_KeyboardExtension &&
     
    703721
    704722    /* Save updated status-bar indicator order: */
    705     gEDataManager->setStatusBarIndicatorOrder(order, vboxGlobal().managedVMUuid());
     723    gEDataManager->setStatusBarIndicatorOrder(order, machineID());
    706724}
    707725
     
    719737
    720738UIStatusBarEditorWindow::UIStatusBarEditorWindow(UIMachineWindow *pParent)
    721     : UISlidingToolBar(pParent, pParent->statusBar(), new UIStatusBarEditorWidget, UISlidingToolBar::Position_Bottom)
     739    : UISlidingToolBar(pParent, pParent->statusBar(), new UIStatusBarEditorWidget(0, vboxGlobal().managedVMUuid()), UISlidingToolBar::Position_Bottom)
    722740{
    723741}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r53068 r53320  
    121121
    122122#ifndef RT_OS_DARWIN
    123 void UIMachineWindowNormal::sltHandleMenuBarConfigurationChange()
    124 {
     123void UIMachineWindowNormal::sltHandleMenuBarConfigurationChange(const QString &strMachineID)
     124{
     125    /* Skip unrelated machine IDs: */
     126    if (vboxGlobal().managedVMUuid() != strMachineID)
     127        return;
     128
    125129    /* Check whether menu-bar is enabled: */
    126130    const bool fEnabled = gEDataManager->menuBarEnabled(vboxGlobal().managedVMUuid());
     
    150154#endif /* !RT_OS_DARWIN */
    151155
    152 void UIMachineWindowNormal::sltHandleStatusBarConfigurationChange()
    153 {
     156void UIMachineWindowNormal::sltHandleStatusBarConfigurationChange(const QString &strMachineID)
     157{
     158    /* Skip unrelated machine IDs: */
     159    if (vboxGlobal().managedVMUuid() != strMachineID)
     160        return;
     161
    154162    /* Check whether status-bar is enabled: */
    155163    const bool fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid());
     
    246254        connect(menuBar(), SIGNAL(customContextMenuRequested(const QPoint&)),
    247255                this, SLOT(sltHandleMenuBarContextMenuRequest(const QPoint&)));
    248         connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange()),
    249                 this, SLOT(sltHandleMenuBarConfigurationChange()));
     256        connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
     257                this, SLOT(sltHandleMenuBarConfigurationChange(const QString&)));
    250258        /* Update menu-bar: */
    251259        updateMenu();
     
    278286        }
    279287        /* Post-configure status-bar: */
    280         connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange()),
    281                 this, SLOT(sltHandleStatusBarConfigurationChange()));
     288        connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange(const QString&)),
     289                this, SLOT(sltHandleStatusBarConfigurationChange(const QString&)));
    282290    }
    283291
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r52727 r53320  
    5959#ifndef RT_OS_DARWIN
    6060    /** Handles menu-bar configuration-change. */
    61     void sltHandleMenuBarConfigurationChange();
     61    void sltHandleMenuBarConfigurationChange(const QString &strMachineID);
    6262    /** Handles menu-bar context-menu-request. */
    6363    void sltHandleMenuBarContextMenuRequest(const QPoint &position);
     
    6565
    6666    /** Handles status-bar configuration-change. */
    67     void sltHandleStatusBarConfigurationChange();
     67    void sltHandleStatusBarConfigurationChange(const QString &strMachineID);
    6868    /** Handles status-bar context-menu-request. */
    6969    void sltHandleStatusBarContextMenuRequest(const QPoint &position);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette