VirtualBox

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

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

Fe/Qt4: Systray: Now gets started through an own process; should solve the redundant systray icons as well. Reverted some changes for having an instance of the selector window in a pure console session as well.

  • 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
63signals:
64
65 void closing();
66
67public slots:
68
69 void fileMediaMgr();
70 void fileSettings();
71 void fileExit();
72
73 void vmNew();
74 void vmSettings (const QString &aCategory = QString::null,
75 const QString &aControl = QString::null,
76 const QUuid & = QUuid_null);
77 void vmDelete (const QUuid & = QUuid_null);
78 void vmStart (const QUuid & = QUuid_null);
79 void vmDiscard (const QUuid & = QUuid_null);
80 void vmPause (bool, const QUuid & = QUuid_null);
81 void vmRefresh (const QUuid & = QUuid_null);
82 void vmShowLogs (const QUuid & = QUuid_null);
83
84 void refreshVMList();
85 void refreshVMItem (const QUuid &aID, bool aDetails,
86 bool aSnapshots,
87 bool aDescription);
88
89 void showContextMenu (const QPoint &aPoint);
90
91#ifdef VBOX_GUI_WITH_SYSTRAY
92 void trayIconActivated (QSystemTrayIcon::ActivationReason aReason);
93 void showWindow();
94#endif
95
96 const QAction *vmNewAction() const { return mVmNewAction; }
97 const QAction *vmConfigAction() const { return mVmConfigAction; }
98 const QAction *vmDeleteAction() const { return mVmDeleteAction; }
99 const QAction *vmStartAction() const { return mVmStartAction; }
100 const QAction *vmDiscardAction() const { return mVmDiscardAction; }
101 const QAction *vmPauseAction() const { return mVmPauseAction; }
102 const QAction *vmRefreshAction() const { return mVmRefreshAction; }
103 const QAction *vmShowLogsAction() const { return mVmShowLogsAction; }
104
105protected:
106
107 /* Events */
108 bool event (QEvent *aEvent);
109 void closeEvent (QCloseEvent *aEvent);
110#if defined (Q_WS_MAC) && (QT_VERSION < 0x040402)
111 bool eventFilter (QObject *aObject, QEvent *aEvent);
112#endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */
113
114 void retranslateUi();
115
116private slots:
117
118 void vmListViewCurrentChanged (bool aRefreshDetails = true,
119 bool aRefreshSnapshots = true,
120 bool aRefreshDescription = true);
121
122 void mediumEnumStarted();
123 void mediumEnumFinished (const VBoxMediaList &);
124
125 /* VirtualBox callback events we're interested in */
126
127 void machineStateChanged (const VBoxMachineStateChangeEvent &e);
128 void machineDataChanged (const VBoxMachineDataChangeEvent &e);
129 void machineRegistered (const VBoxMachineRegisteredEvent &e);
130 void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
131 void snapshotChanged (const VBoxSnapshotEvent &e);
132#ifdef VBOX_GUI_WITH_SYSTRAY
133 void trayIconCanShow (const VBoxCanShowTrayIconEvent &e);
134 void trayIconChanged (const VBoxChangeTrayIconEvent &e);
135#endif
136
137private:
138
139 /* Main menus */
140 QMenu *mFileMenu;
141 QMenu *mVMMenu;
142 QMenu *mHelpMenu;
143
144 /* VM list context menu */
145 QMenu *mVMCtxtMenu;
146
147 /* Actions */
148 QAction *mFileMediaMgrAction;
149 QAction *mFileSettingsAction;
150 QAction *mFileExitAction;
151 QAction *mVmNewAction;
152 QAction *mVmConfigAction;
153 QAction *mVmDeleteAction;
154 QAction *mVmStartAction;
155 QAction *mVmDiscardAction;
156 QAction *mVmPauseAction;
157 QAction *mVmRefreshAction;
158 QAction *mVmShowLogsAction;
159
160 VBoxHelpActions mHelpActions;
161
162#ifdef VBOX_GUI_WITH_SYSTRAY
163 /* The systray icon */
164 VBoxTrayIcon *mTrayIcon;
165#endif
166
167 /* The vm list view/model */
168 VBoxVMListView *mVMListView;
169 VBoxVMModel *mVMModel;
170
171 /* The right information widgets */
172 QTabWidget *mVmTabWidget;
173 VBoxVMDetailsView *mVmDetailsView;
174 VBoxSnapshotsWgt *mVmSnapshotsWgt;
175 VBoxVMDescriptionPage *mVmDescriptionPage;
176
177 QPoint mNormalPos;
178 QSize mNormalSize;
179
180 bool mDoneInaccessibleWarningOnce : 1;
181};
182
183#ifdef VBOX_GUI_WITH_SYSTRAY
184
185Q_DECLARE_METATYPE(QUuid);
186
187class VBoxTrayIcon : public QSystemTrayIcon
188{
189 Q_OBJECT;
190
191public:
192
193 VBoxTrayIcon (VBoxSelectorWnd* aParent, VBoxVMModel* aVMModel);
194 virtual ~VBoxTrayIcon ();
195
196 void refresh ();
197 void retranslateUi ();
198
199protected:
200
201 VBoxVMItem* GetItem (QObject* aObject);
202
203signals:
204
205public slots:
206
207 void trayIconShow (bool aShow = false);
208
209private slots:
210
211 void showSubMenu();
212 void hideSubMenu ();
213
214 void vmSettings();
215 void vmDelete();
216 void vmStart();
217 void vmDiscard();
218 void vmPause(bool aPause);
219 void vmRefresh();
220 void vmShowLogs();
221
222private:
223
224 bool mActive; /* Is systray menu active/available? */
225
226 /* The vm list model */
227 VBoxVMModel *mVMModel;
228
229 VBoxSelectorWnd* mParent;
230 QMenu *mTrayIconMenu;
231
232 QAction *mShowSelectorAction;
233 QAction *mHideSystrayMenuAction;
234 QAction *mVmConfigAction;
235 QAction *mVmDeleteAction;
236 QAction *mVmStartAction;
237 QAction *mVmDiscardAction;
238 QAction *mVmPauseAction;
239 QAction *mVmRefreshAction;
240 QAction *mVmShowLogsAction;
241};
242
243#endif // VBOX_GUI_WITH_SYSTRAY
244
245#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