VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h@ 14578

Last change on this file since 14578 was 14578, checked in by vboxsync, 16 years ago

Fe/Qt4: Systray: First implementation for IPC handling.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
Line 
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
39class VBoxSnapshotsWgt;
40class VBoxVMDetailsView;
41class VBoxVMDescriptionPage;
42class VBoxVMLogViewer;
43class VBoxVMListView;
44class VBoxVMModel;
45class VBoxVMItem;
46class VBoxTrayIcon;
47
48class QTabWidget;
49class QListView;
50class QEvent;
51
52class VBoxSelectorWnd : public QIWithRetranslateUI2 <QMainWindow>
53{
54 Q_OBJECT;
55
56public:
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
65signals:
66
67 void closing();
68
69public 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 const QAction *vmNewAction() const { return mVmNewAction; }
99 const QAction *vmConfigAction() const { return mVmConfigAction; }
100 const QAction *vmDeleteAction() const { return mVmDeleteAction; }
101 const QAction *vmStartAction() const { return mVmStartAction; }
102 const QAction *vmDiscardAction() const { return mVmDiscardAction; }
103 const QAction *vmPauseAction() const { return mVmPauseAction; }
104 const QAction *vmRefreshAction() const { return mVmRefreshAction; }
105 const QAction *vmShowLogsAction() const { return mVmShowLogsAction; }
106
107protected:
108
109 /* Events */
110 bool event (QEvent *aEvent);
111 void closeEvent (QCloseEvent *aEvent);
112#if defined (Q_WS_MAC) && (QT_VERSION < 0x040402)
113 bool eventFilter (QObject *aObject, QEvent *aEvent);
114#endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */
115
116 void retranslateUi();
117
118private slots:
119
120 void vmListViewCurrentChanged (bool aRefreshDetails = true,
121 bool aRefreshSnapshots = true,
122 bool aRefreshDescription = true);
123
124 void mediumEnumStarted();
125 void mediumEnumFinished (const VBoxMediaList &);
126
127 /* VirtualBox callback events we're interested in */
128
129 void machineStateChanged (const VBoxMachineStateChangeEvent &e);
130 void machineDataChanged (const VBoxMachineDataChangeEvent &e);
131 void machineRegistered (const VBoxMachineRegisteredEvent &e);
132 void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
133 void snapshotChanged (const VBoxSnapshotEvent &e);
134#ifdef VBOX_GUI_WITH_SYSTRAY
135 void trayIconCanShow (const VBoxCanShowTrayIconEvent &e);
136 void trayIconChanged (const VBoxChangeTrayIconEvent &e);
137#endif
138
139private:
140
141 /* Main menus */
142 QMenu *mFileMenu;
143 QMenu *mVMMenu;
144 QMenu *mHelpMenu;
145
146 /* VM list context menu */
147 QMenu *mVMCtxtMenu;
148
149 /* Actions */
150 QAction *mFileMediaMgrAction;
151 QAction *mFileSettingsAction;
152 QAction *mFileExitAction;
153 QAction *mVmNewAction;
154 QAction *mVmConfigAction;
155 QAction *mVmDeleteAction;
156 QAction *mVmStartAction;
157 QAction *mVmDiscardAction;
158 QAction *mVmPauseAction;
159 QAction *mVmRefreshAction;
160 QAction *mVmShowLogsAction;
161
162 VBoxHelpActions mHelpActions;
163
164#ifdef VBOX_GUI_WITH_SYSTRAY
165 /* The systray icon */
166 VBoxTrayIcon *mTrayIcon;
167#endif
168
169 /* The vm list view/model */
170 VBoxVMListView *mVMListView;
171 VBoxVMModel *mVMModel;
172
173 /* The right information widgets */
174 QTabWidget *mVmTabWidget;
175 VBoxVMDetailsView *mVmDetailsView;
176 VBoxSnapshotsWgt *mVmSnapshotsWgt;
177 VBoxVMDescriptionPage *mVmDescriptionPage;
178
179 QPoint mNormalPos;
180 QSize mNormalSize;
181
182 bool mDoneInaccessibleWarningOnce : 1;
183};
184
185#ifdef VBOX_GUI_WITH_SYSTRAY
186
187Q_DECLARE_METATYPE(QUuid);
188
189class VBoxTrayIcon : public QSystemTrayIcon
190{
191 Q_OBJECT;
192
193public:
194
195 VBoxTrayIcon (VBoxSelectorWnd* aParent, VBoxVMModel* aVMModel);
196 virtual ~VBoxTrayIcon ();
197
198 void refresh ();
199 void retranslateUi ();
200
201protected:
202
203 VBoxVMItem* GetItem (QObject* aObject);
204
205signals:
206
207public slots:
208
209 void trayIconShow (bool aShow = false);
210
211private slots:
212
213 void showSubMenu();
214 void hideSubMenu ();
215
216 void vmSettings();
217 void vmDelete();
218 void vmStart();
219 void vmDiscard();
220 void vmPause(bool aPause);
221 void vmRefresh();
222 void vmShowLogs();
223
224private:
225
226 bool mActive; /* Is systray menu active/available? */
227
228 /* The vm list model */
229 VBoxVMModel *mVMModel;
230
231 VBoxSelectorWnd* mParent;
232 QMenu *mTrayIconMenu;
233
234 QAction *mShowSelectorAction;
235 QAction *mHideSystrayMenuAction;
236 QAction *mVmConfigAction;
237 QAction *mVmDeleteAction;
238 QAction *mVmStartAction;
239 QAction *mVmDiscardAction;
240 QAction *mVmPauseAction;
241 QAction *mVmRefreshAction;
242 QAction *mVmShowLogsAction;
243};
244
245#endif // VBOX_GUI_WITH_SYSTRAY
246
247#endif // __VBoxSelectorWnd_h__
Note: See TracBrowser for help on using the repository browser.

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