1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxSelectorWnd class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2008 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxSelectorWnd_h__
|
---|
24 | #define __VBoxSelectorWnd_h__
|
---|
25 |
|
---|
26 | #include "COMDefs.h"
|
---|
27 |
|
---|
28 | #include "QIWithRetranslateUI.h"
|
---|
29 |
|
---|
30 | #include "VBoxGlobal.h"
|
---|
31 | #include "VBoxProblemReporter.h"
|
---|
32 |
|
---|
33 | /* Qt includes */
|
---|
34 | #include <QMainWindow>
|
---|
35 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
36 | #include <QSystemTrayIcon>
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | class VBoxSnapshotsWgt;
|
---|
40 | class VBoxVMDetailsView;
|
---|
41 | class VBoxVMDescriptionPage;
|
---|
42 | class VBoxVMLogViewer;
|
---|
43 | class VBoxVMListView;
|
---|
44 | class VBoxVMModel;
|
---|
45 | class VBoxVMItem;
|
---|
46 | class VBoxTrayIcon;
|
---|
47 |
|
---|
48 | class QTabWidget;
|
---|
49 | class QListView;
|
---|
50 | class QEvent;
|
---|
51 |
|
---|
52 | class VBoxSelectorWnd : public QIWithRetranslateUI2 <QMainWindow>
|
---|
53 | {
|
---|
54 | Q_OBJECT;
|
---|
55 |
|
---|
56 | public:
|
---|
57 |
|
---|
58 | VBoxSelectorWnd (VBoxSelectorWnd **aSelf,
|
---|
59 | QWidget* aParent = 0,
|
---|
60 | Qt::WindowFlags aFlags = Qt::Window);
|
---|
61 | virtual ~VBoxSelectorWnd();
|
---|
62 |
|
---|
63 | bool startMachine (const QUuid &aId);
|
---|
64 |
|
---|
65 | signals:
|
---|
66 |
|
---|
67 | void closing();
|
---|
68 |
|
---|
69 | public slots:
|
---|
70 |
|
---|
71 | void fileMediaMgr();
|
---|
72 | void fileSettings();
|
---|
73 | void fileExit();
|
---|
74 |
|
---|
75 | void vmNew();
|
---|
76 | void vmSettings (const QString &aCategory = QString::null,
|
---|
77 | const QString &aControl = QString::null,
|
---|
78 | const QUuid & = QUuid_null);
|
---|
79 | void vmDelete (const QUuid & = QUuid_null);
|
---|
80 | void vmStart (const QUuid & = QUuid_null);
|
---|
81 | void vmDiscard (const QUuid & = QUuid_null);
|
---|
82 | void vmPause (bool, const QUuid & = QUuid_null);
|
---|
83 | void vmRefresh (const QUuid & = QUuid_null);
|
---|
84 | void vmShowLogs (const QUuid & = QUuid_null);
|
---|
85 |
|
---|
86 | void refreshVMList();
|
---|
87 | void refreshVMItem (const QUuid &aID, bool aDetails,
|
---|
88 | bool aSnapshots,
|
---|
89 | bool aDescription);
|
---|
90 |
|
---|
91 | void showContextMenu (const QPoint &aPoint);
|
---|
92 |
|
---|
93 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
94 | void trayIconActivated (QSystemTrayIcon::ActivationReason aReason);
|
---|
95 | void showWindow();
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | protected:
|
---|
99 |
|
---|
100 | /* Events */
|
---|
101 | bool event (QEvent *aEvent);
|
---|
102 | void closeEvent (QCloseEvent *aEvent);
|
---|
103 | #if defined (Q_WS_MAC) && (QT_VERSION < 0x040402)
|
---|
104 | bool eventFilter (QObject *aObject, QEvent *aEvent);
|
---|
105 | #endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */
|
---|
106 |
|
---|
107 | void retranslateUi();
|
---|
108 |
|
---|
109 | private slots:
|
---|
110 |
|
---|
111 | void vmListViewCurrentChanged (bool aRefreshDetails = true,
|
---|
112 | bool aRefreshSnapshots = true,
|
---|
113 | bool aRefreshDescription = true);
|
---|
114 |
|
---|
115 | void mediumEnumStarted();
|
---|
116 | void mediumEnumFinished (const VBoxMediaList &);
|
---|
117 |
|
---|
118 | /* VirtualBox callback events we're interested in */
|
---|
119 |
|
---|
120 | void machineStateChanged (const VBoxMachineStateChangeEvent &e);
|
---|
121 | void machineDataChanged (const VBoxMachineDataChangeEvent &e);
|
---|
122 | void machineRegistered (const VBoxMachineRegisteredEvent &e);
|
---|
123 | void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
|
---|
124 | void snapshotChanged (const VBoxSnapshotEvent &e);
|
---|
125 |
|
---|
126 | private:
|
---|
127 |
|
---|
128 | /* Main menus */
|
---|
129 | QMenu *mFileMenu;
|
---|
130 | QMenu *mVMMenu;
|
---|
131 | QMenu *mHelpMenu;
|
---|
132 |
|
---|
133 | /* VM list context menu */
|
---|
134 | QMenu *mVMCtxtMenu;
|
---|
135 |
|
---|
136 | /* Actions */
|
---|
137 | QAction *fileMediaMgrAction;
|
---|
138 | QAction *fileSettingsAction;
|
---|
139 | QAction *fileExitAction;
|
---|
140 | QAction *vmNewAction;
|
---|
141 | QAction *vmConfigAction;
|
---|
142 | QAction *vmDeleteAction;
|
---|
143 | QAction *vmStartAction;
|
---|
144 | QAction *vmDiscardAction;
|
---|
145 | QAction *vmPauseAction;
|
---|
146 | QAction *vmRefreshAction;
|
---|
147 | QAction *vmShowLogsAction;
|
---|
148 |
|
---|
149 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
150 | QAction *mTrayShowWindowAction;
|
---|
151 | #endif
|
---|
152 |
|
---|
153 | VBoxHelpActions mHelpActions;
|
---|
154 |
|
---|
155 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
156 | /* The systray icon */
|
---|
157 | VBoxTrayIcon *mTrayIcon;
|
---|
158 | #endif
|
---|
159 |
|
---|
160 | /* The vm list view/model */
|
---|
161 | VBoxVMListView *mVMListView;
|
---|
162 | VBoxVMModel *mVMModel;
|
---|
163 |
|
---|
164 | /* The right information widgets */
|
---|
165 | QTabWidget *vmTabWidget;
|
---|
166 | VBoxVMDetailsView *vmDetailsView;
|
---|
167 | VBoxSnapshotsWgt *vmSnapshotsWgt;
|
---|
168 | VBoxVMDescriptionPage *vmDescriptionPage;
|
---|
169 |
|
---|
170 | QPoint normal_pos;
|
---|
171 | QSize normal_size;
|
---|
172 |
|
---|
173 | bool doneInaccessibleWarningOnce : 1;
|
---|
174 | };
|
---|
175 |
|
---|
176 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
177 |
|
---|
178 | Q_DECLARE_METATYPE(QUuid);
|
---|
179 |
|
---|
180 | class VBoxTrayIcon : public QSystemTrayIcon
|
---|
181 | {
|
---|
182 | Q_OBJECT;
|
---|
183 |
|
---|
184 | public:
|
---|
185 |
|
---|
186 | VBoxTrayIcon (VBoxSelectorWnd* aParent, VBoxVMModel* aVMModel);
|
---|
187 | virtual ~VBoxTrayIcon ();
|
---|
188 |
|
---|
189 | void refresh ();
|
---|
190 | void retranslateUi ();
|
---|
191 |
|
---|
192 | protected:
|
---|
193 |
|
---|
194 | VBoxVMItem* GetItem (QObject* aObject);
|
---|
195 |
|
---|
196 | signals:
|
---|
197 |
|
---|
198 | public slots:
|
---|
199 |
|
---|
200 |
|
---|
201 | private slots:
|
---|
202 |
|
---|
203 | void showSubMenu();
|
---|
204 | void hideSubMenu ();
|
---|
205 |
|
---|
206 | void vmSettings();
|
---|
207 | void vmDelete();
|
---|
208 | void vmStart();
|
---|
209 | void vmDiscard();
|
---|
210 | void vmPause(bool aPause);
|
---|
211 | void vmRefresh();
|
---|
212 | void vmShowLogs();
|
---|
213 |
|
---|
214 | private:
|
---|
215 |
|
---|
216 | /* The vm list model */
|
---|
217 | VBoxVMModel *mVMModel;
|
---|
218 |
|
---|
219 | VBoxSelectorWnd* mParent;
|
---|
220 | QMenu *mTrayIconMenu;
|
---|
221 | QAction *mVmConfigAction;
|
---|
222 | QAction *mVmDeleteAction;
|
---|
223 | QAction *mVmStartAction;
|
---|
224 | QAction *mVmDiscardAction;
|
---|
225 | QAction *mVmPauseAction;
|
---|
226 | QAction *mVmRefreshAction;
|
---|
227 | QAction *mVmShowLogsAction;
|
---|
228 | };
|
---|
229 |
|
---|
230 | #endif // VBOX_GUI_WITH_SYSTRAY
|
---|
231 |
|
---|
232 | #endif // __VBoxSelectorWnd_h__
|
---|