VirtualBox

Changeset 14509 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 24, 2008 10:49:09 AM (16 years ago)
Author:
vboxsync
Message:

Fe/Qt4: Global callback for tray icon code.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDefs.h

    r14056 r14509  
    118118#endif
    119119        ChangeGUILanguageEventType,
     120#if defined (VBOX_GUI_WITH_SYSTRAY)
     121        ChangeGUITrayIconEventType,
     122#endif
    120123        AddVDMUrlsEventType
    121124    };
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r14442 r14509  
    390390};
    391391
     392#ifdef VBOX_GUI_WITH_SYSTRAY
     393class VBoxChangeGUITrayIconEvent : public QEvent
     394{
     395public:
     396    VBoxChangeGUITrayIconEvent (bool aEnabled)
     397        : QEvent ((QEvent::Type) VBoxDefs::ChangeGUITrayIconEventType)
     398        , mEnabled (aEnabled)
     399        {}
     400
     401    const bool mEnabled;
     402};
     403#endif
     404
    392405class Process : public QProcess
    393406{
     
    915928
    916929    /* signals emitted when the VirtualBox callback is called by the server
    917      * (not that currently these signals are emitted only when the application
     930     * (note that currently these signals are emitted only when the application
    918931     * is the in the VM selector mode) */
    919932
     
    923936    void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
    924937    void snapshotChanged (const VBoxSnapshotEvent &e);
     938    void systrayIconChanged (const VBoxChangeGUITrayIconEvent& e);
    925939
    926940    void canShowRegDlg (bool aCanShow);
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h

    r14478 r14509  
    132132    void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
    133133    void snapshotChanged (const VBoxSnapshotEvent &e);
     134#ifdef VBOX_GUI_WITH_SYSTRAY
     135    void systrayIconChanged (const VBoxChangeGUITrayIconEvent &e);
     136#endif
    134137
    135138private:
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r14442 r14509  
    831831                if (sKey == "GUI/LanguageID")
    832832                    QApplication::postEvent (&mGlobal, new VBoxChangeGUILanguageEvent (sVal));
     833            #ifdef VBOX_GUI_WITH_SYSTRAY
     834                if (sKey == "GUI/TrayIcon/Enabled")
     835                    QApplication::postEvent (&mGlobal, new VBoxChangeGUITrayIconEvent ((sVal.toLower() == "true") ? true : false));
     836            #endif
    833837
    834838                mMutex.lock();
     
    50315035        {
    50325036            loadLanguage (static_cast<VBoxChangeGUILanguageEvent*> (e)->mLangId);
     5037            return true;
     5038        }
     5039        case VBoxDefs::ChangeGUITrayIconEventType:
     5040        {
     5041            emit systrayIconChanged (*(VBoxChangeGUITrayIconEvent *) e);
    50335042            return true;
    50345043        }
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r14490 r14509  
    674674    connect (&vboxGlobal(), SIGNAL (snapshotChanged (const VBoxSnapshotEvent &)),
    675675             this, SLOT (snapshotChanged (const VBoxSnapshotEvent &)));
     676#ifdef VBOX_GUI_WITH_SYSTRAY
     677    connect (&vboxGlobal(), SIGNAL (systrayIconChanged (const VBoxChangeGUITrayIconEvent &)),
     678             this, SLOT (systrayIconChanged (const VBoxChangeGUITrayIconEvent &)));
     679#endif
    676680
    677681    /* bring the VM list to the focus */
     
    739743
    740744    delete dlg;
    741 
    742     /* Reload settings. */
    743     settings = vboxGlobal().settings();
    744 
    745     /* Update GUI settings. */
    746 #ifdef VBOX_GUI_WITH_SYSTRAY   
    747     mTrayIcon->trayIconShow (settings.trayIconEnabled());
    748 #endif
    749745}
    750746
     
    16171613#ifdef VBOX_GUI_WITH_SYSTRAY
    16181614
     1615void VBoxSelectorWnd::systrayIconChanged (const VBoxChangeGUITrayIconEvent &aEvent)
     1616{
     1617    mTrayIcon->trayIconShow (aEvent.mEnabled);
     1618}
     1619
    16191620VBoxTrayIcon::VBoxTrayIcon (VBoxSelectorWnd* aParent, VBoxVMModel* aVMModel)
    16201621{
     
    19371938    }
    19381939    setVisible (mActive);
    1939 
    1940     VBoxGlobalSettings settings = vboxGlobal().settings();
    1941     settings.setTrayIconEnabled (mActive);
    1942 
    1943     CVirtualBox vbox = vboxGlobal().virtualBox();
    1944     settings.save (vbox);
    19451940}
    19461941
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