VirtualBox

Ignore:
Timestamp:
Nov 4, 2008 4:01:42 PM (16 years ago)
Author:
vboxsync
Message:

Fe/Qt4: Added first systray support (under development, compile with VBOX_GUI_WITH_SYSTRAY in VirtualBox4_DEFS).

Location:
trunk/src/VBox/Frontends/VirtualBox4/include
Files:
2 edited

Legend:

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

    r13580 r13790  
    3333/* Qt includes */
    3434#include <QMainWindow>
     35#ifdef VBOX_GUI_WITH_SYSTRAY
     36    #include <QSystemTrayIcon>
     37#endif
     38#include <QUuid>
    3539
    3640class VBoxSnapshotsWgt;
     
    6670
    6771    void fileMediaMgr();
     72    VBoxVMItem* getSelectedItem();
     73#ifdef VBOX_GUI_WITH_SYSTRAY
     74    void iconActivated(QSystemTrayIcon::ActivationReason aReason);
     75    void showWindow();
     76#endif
    6877    void fileSettings();
    6978    void fileExit();
     
    7180    void vmNew();
    7281    void vmSettings (const QString &aCategory = QString::null,
    73                      const QString &aControl = QString::null);
    74     void vmDelete();
    75     void vmStart();
    76     void vmDiscard();
    77     void vmPause (bool);
    78     void vmRefresh();
    79     void vmShowLogs();
     82                     const QString &aControl = QString::null,
     83                     const QUuid& = "");
     84    void vmDelete(const QUuid& = "");
     85    void vmStart (const QUuid& = "");
     86    void vmDiscard(const QUuid& = "");
     87    void vmPause (bool, const QUuid& = "");
     88    void vmRefresh(const QUuid& = "");
     89    void vmShowLogs(const QUuid& = "");
    8090
     91#ifdef VBOX_GUI_WITH_SYSTRAY
     92    void refreshSysTray();
     93#endif
    8194    void refreshVMList();
    8295    void refreshVMItem (const QUuid &aID, bool aDetails,
     
    129142    QAction *fileExitAction;
    130143    QAction *vmNewAction;
     144#ifdef VBOX_GUI_WITH_SYSTRAY
     145    QAction *trayShowWindowAction;
     146    QAction *trayExitAction;
     147#endif
    131148    QAction *vmConfigAction;
    132149    QAction *vmDeleteAction;
     
    138155
    139156    VBoxHelpActions mHelpActions;
     157
     158#ifdef VBOX_GUI_WITH_SYSTRAY
     159    /* The systray icon */
     160    QSystemTrayIcon *trayIcon;
     161    QMenu *trayIconMenu;
     162#endif
    140163
    141164    /* The vm list view/model */
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMListView.h

    r9729 r13790  
    3131#include <QDateTime>
    3232
    33 class VBoxVMItem
    34 {
    35 public:
    36     VBoxVMItem (const CMachine &aM);
     33class VBoxVMItem : public QObject
     34{
     35    Q_OBJECT;
     36
     37public:
     38
     39    enum Action
     40    {
     41        Config = 0,
     42        Delete,
     43        Start,
     44        Discard,
     45        Pause,
     46        Refresh,
     47        ShowLogs
     48    };
     49
     50public:
     51
     52    VBoxVMItem (const CMachine &aM, QObject* pParent);
    3753    virtual ~VBoxVMItem();
    3854
     
    4258    QIcon osIcon() const { return mAccessible ? vboxGlobal().vmGuestOSTypeIcon (mOSTypeId) :QPixmap (":/os_unknown.png"); }
    4359    QUuid id() const { return mId; }
    44    
     60
    4561    QString sessionStateName() const;
    4662    QIcon sessionStateIcon() const { return mAccessible ? vboxGlobal().toIcon (mState) : QPixmap (":/state_aborted_16px.png"); }
     
    4965    ULONG snapshotCount() const { return mSnapshotCount; }
    5066
     67    QAction* vmActionConfig() const { return vmConfigAction; }
     68    QAction* vmActionDelete() const { return vmDeleteAction; }
     69    QAction* vmActionStart() const { return vmStartAction; }
     70    QAction* vmActionDiscard() const { return vmDiscardAction; }
     71    QAction* vmActionPause() const { return vmPauseAction; }
     72    QAction* vmActionRefresh() const { return vmRefreshAction; }
     73    QAction* vmActionShowLogs() const { return vmShowLogsAction; }
     74
    5175    QString toolTipText() const;
    5276
    5377    bool accessible() const { return mAccessible; }
     78    bool running() const {  return (sessionState() != KSessionState_Closed); }
    5479    const CVirtualBoxErrorInfo &accessError() const { return mAccessError; }
    5580    KMachineState state() const { return mState; }
     
    6085    bool canSwitchTo() const;
    6186    bool switchTo();
     87   
     88    void updateActions();
    6289
    6390private:
    6491
    6592    /* Private member vars */
     93    QObject* mParent;
    6694    CMachine mMachine;
     95
     96    QAction *vmConfigAction;
     97    QAction *vmDeleteAction;
     98    QAction *vmStartAction;
     99    QAction *vmDiscardAction;
     100    QAction *vmPauseAction;
     101    QAction *vmRefreshAction;
     102    QAction *vmShowLogsAction;
    67103
    68104    /* Cached machine data (to minimize server requests) */
     
    82118
    83119    ULONG mPid;
     120
     121private slots:
     122
     123    void vmSettings();
     124    void vmDelete();
     125    void vmStart();
     126    void vmDiscard();
     127    void vmPause(bool aPause);
     128    void vmRefresh();
     129    void vmShowLogs();
    84130};
    85131
     
    111157
    112158    VBoxVMItem *itemById (const QUuid &aId) const;
     159    VBoxVMItem *itemByRow (int aRow) const;
    113160    QModelIndex indexById (const QUuid &aId) const;
    114161
     
    163210    void mousePressEvent (QMouseEvent *aEvent);
    164211    bool selectCurrent();
    165 }; 
     212};
    166213
    167214class VBoxVMItemPainter: public QIItemDelegate
     
    181228    inline QIcon::Mode iconMode (QStyle::State aState) const
    182229    {
    183         if (!(aState & QStyle::State_Enabled)) 
     230        if (!(aState & QStyle::State_Enabled))
    184231            return QIcon::Disabled;
    185         if (aState & QStyle::State_Selected) 
     232        if (aState & QStyle::State_Selected)
    186233            return QIcon::Selected;
    187234        return QIcon::Normal;
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