VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h@ 20619

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

Main: support for using VBox from Python on Windows (still certain limitation apply, such as enum visibility)

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

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