VirtualBox

Changeset 51596 in vbox for trunk/src


Ignore:
Timestamp:
Jun 10, 2014 6:21:10 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 6660: Advanced extra-data management framework: Integrate GUI_HidLedsSync.

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

Legend:

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

    r51595 r51596  
    949949}
    950950
     951bool UIExtraDataManager::hidLedsSyncState(const QString &strID) const
     952{
     953    /* 'True' unless feature restricted: */
     954    return !isFeatureRestricted(GUI_HidLedsSync, strID);
     955}
     956
    951957void UIExtraDataManager::sltExtraDataChange(QString strMachineID, QString strKey, QString strValue)
    952958{
     
    982988        /* HID LEDs sync state changed (allowed if not restricted)? */
    983989        if (strKey == GUI_HidLedsSync)
    984             emit sigHIDLedsSyncStateChange(!isFeatureRestricted(strKey));
     990            emit sigHidLedsSyncStateChange(!isFeatureRestricted(strKey, strMachineID));
    985991#ifdef Q_WS_MAC
    986992        /* 'Dock icon' appearance changed (allowed if not restricted)? */
    987993        else if (   strKey == GUI_RealtimeDockIconUpdateEnabled
    988994                 || strKey == GUI_RealtimeDockIconUpdateMonitor)
    989             emit sigDockIconAppearanceChange(!isFeatureRestricted(strKey));
     995            emit sigDockIconAppearanceChange(!isFeatureRestricted(strKey, strMachineID));
    990996#endif /* Q_WS_MAC */
    991997    }
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51595 r51596  
    5656    void sigRuntimeUIShortcutChange();
    5757
    58     /** Notifies about HID LED sync state change. */
    59     void sigHIDLedsSyncStateChange(bool fEnabled);
     58    /** Notifies about HID LEDs synchronization state change. */
     59    void sigHidLedsSyncStateChange(bool fEnabled);
    6060
    6161#ifdef RT_OS_DARWIN
     
    274274    bool passCADtoGuest(const QString &strID) const;
    275275
     276    /** Returns whether VM should perform HID LEDs synchronization. */
     277    bool hidLedsSyncState(const QString &strID) const;
     278
    276279private slots:
    277280
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r51565 r51596  
    189189    sltAdditionsStateChanged();
    190190    sltMouseCapabilityChanged();
    191     sltSwitchKeyboardLedsToGuestLeds();
    192191
    193192#ifdef VBOX_WITH_DEBUGGER_GUI
     
    196195#endif /* VBOX_WITH_DEBUGGER_GUI */
    197196
     197    /* Load settings: */
     198    loadSettings();
     199
    198200    /* Retranslate logic part: */
    199201    retranslateUi();
     
    202204void UIMachineLogic::cleanup()
    203205{
    204     /* Deinitialization: */
    205     sltSwitchKeyboardLedsToPreviousLeds();
     206    /* Save settings: */
     207    saveSettings();
    206208
    207209#ifdef VBOX_WITH_DEBUGGER_GUI
     
    527529void UIMachineLogic::sltHidLedsSyncStateChanged(bool fEnabled)
    528530{
    529     m_isHidLedsSyncEnabled = fEnabled;
     531    m_fIsHidLedsSyncEnabled = fEnabled;
    530532}
    531533
     
    642644#endif /* Q_WS_MAC */
    643645    , m_pHostLedsState(NULL)
    644     , m_isHidLedsSyncEnabled(false)
    645 {
    646     /* Setup HID LEDs synchronization. */
    647 #if defined(Q_WS_MAC) || defined(Q_WS_WIN)
    648     /* Read initial extradata value. */
    649     QString strHidLedsSyncSettings = session().GetMachine().GetExtraData(GUI_HidLedsSync);
    650 
    651     /* If extra data GUI/HidLedsSync is not present in VM config or set
    652      * to 1 then sync is enabled. Otherwise, it is disabled. */
    653     if (strHidLedsSyncSettings.isEmpty() || strHidLedsSyncSettings == "1")
    654         m_isHidLedsSyncEnabled = true;
    655     else
    656         m_isHidLedsSyncEnabled = false;
    657 
    658     /* Subscribe to GUI_HidLedsSync extradata changes in order to
    659      * be able to enable or disable feature dynamically. */
    660     connect(gEDataManager, SIGNAL(sigHIDLedsSyncStateChange(bool)), this, SLOT(sltHidLedsSyncStateChanged(bool)));
    661 #else
    662     m_isHidLedsSyncEnabled = false;
    663 #endif
     646    , m_fIsHidLedsSyncEnabled(false)
     647{
    664648}
    665649
     
    10841068#endif /* VBOX_WITH_DEBUGGER_GUI */
    10851069
     1070void UIMachineLogic::loadSettings()
     1071{
     1072#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
     1073    /* Read cached extra-data value: */
     1074    m_fIsHidLedsSyncEnabled = gEDataManager->hidLedsSyncState(vboxGlobal().managedVMUuid());
     1075    /* Subscribe to extra-data changes to be able to enable/disable feature dynamically: */
     1076    connect(gEDataManager, SIGNAL(sigHidLedsSyncStateChange(bool)), this, SLOT(sltHidLedsSyncStateChanged(bool)));
     1077#endif /* Q_WS_MAC || Q_WS_WIN */
     1078    /* HID LEDs sync initialization: */
     1079    sltSwitchKeyboardLedsToGuestLeds();
     1080}
     1081
     1082void UIMachineLogic::saveSettings()
     1083{
     1084    /* HID LEDs sync deinitialization: */
     1085    sltSwitchKeyboardLedsToPreviousLeds();
     1086}
     1087
    10861088#ifdef VBOX_WITH_DEBUGGER_GUI
    10871089void UIMachineLogic::cleanupDebugger()
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r51398 r51596  
    9898    virtual void notifyAbout3DOverlayVisibilityChange(bool fVisible);
    9999
    100     /** Performs HID LEDs sync. */
    101     bool isHidLedsSyncEnabled() { return m_isHidLedsSyncEnabled; };
     100    /** Returns whether VM should perform HID LEDs synchronization. */
     101    bool isHidLedsSyncEnabled() const { return m_fIsHidLedsSyncEnabled; }
    102102
    103103protected slots:
     
    166166    virtual void prepareDebugger();
    167167#endif /* VBOX_WITH_DEBUGGER_GUI */
     168    virtual void loadSettings();
    168169
    169170    /* Cleanup helpers: */
     171    virtual void saveSettings();
    170172#ifdef VBOX_WITH_DEBUGGER_GUI
    171173    virtual void cleanupDebugger();
     
    297299
    298300    void *m_pHostLedsState;
    299     bool m_isHidLedsSyncEnabled;
     301
     302    /** Holds whether VM should perform HID LEDs synchronization. */
     303    bool m_fIsHidLedsSyncEnabled;
    300304
    301305    /* Friend classes: */
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