1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxSelectorWnd class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
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 |
|
---|
19 | #ifndef __VBoxSelectorWnd_h__
|
---|
20 | #define __VBoxSelectorWnd_h__
|
---|
21 |
|
---|
22 | /* Local includes */
|
---|
23 | #include "COMDefs.h"
|
---|
24 | #include "QIWithRetranslateUI.h"
|
---|
25 | #include "VBoxGlobal.h"
|
---|
26 | #include "VBoxHelpActions.h"
|
---|
27 | #include "VBoxProblemReporter.h"
|
---|
28 |
|
---|
29 | /* Global includes */
|
---|
30 | #include <QMainWindow>
|
---|
31 | #include <QUrl>
|
---|
32 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
33 | # include <QSystemTrayIcon>
|
---|
34 | #endif /* VBOX_GUI_WITH_SYSTRAY */
|
---|
35 |
|
---|
36 | /* Local forward declarations */
|
---|
37 | class QISplitter;
|
---|
38 | class UIMainBar;
|
---|
39 | class UIVMDesktop;
|
---|
40 | class UIVMItem;
|
---|
41 | class UIVMItemModel;
|
---|
42 | class UIVMListView;
|
---|
43 | class UIToolBar;
|
---|
44 | class VBoxTrayIcon;
|
---|
45 | class VBoxVMLogViewer;
|
---|
46 |
|
---|
47 | class VBoxSelectorWnd : public QIWithRetranslateUI2<QMainWindow>
|
---|
48 | {
|
---|
49 | Q_OBJECT;
|
---|
50 |
|
---|
51 | public:
|
---|
52 |
|
---|
53 | VBoxSelectorWnd(VBoxSelectorWnd **aSelf,
|
---|
54 | QWidget* aParent = 0,
|
---|
55 | Qt::WindowFlags aFlags = Qt::Window);
|
---|
56 | virtual ~VBoxSelectorWnd();
|
---|
57 |
|
---|
58 | signals:
|
---|
59 |
|
---|
60 | void closing();
|
---|
61 |
|
---|
62 | public slots:
|
---|
63 |
|
---|
64 | void fileMediaMgr();
|
---|
65 | void fileImportAppliance(const QString &strFile = "");
|
---|
66 | void fileExportAppliance();
|
---|
67 | void fileSettings();
|
---|
68 | void fileExit();
|
---|
69 |
|
---|
70 | void vmNew();
|
---|
71 | void vmAdd(const QString &strFile = "");
|
---|
72 | void vmSettings(const QString &aCategory = QString::null, const QString &aControl = QString::null, const QString & = QString::null);
|
---|
73 | void vmDelete(const QString & = QString::null);
|
---|
74 | void vmStart(const QString & = QString::null);
|
---|
75 | void vmDiscard(const QString & = QString::null);
|
---|
76 | void vmPause(bool, const QString & = QString::null);
|
---|
77 | void vmRefresh(const QString & = QString::null);
|
---|
78 | void vmShowLogs(const QString & = QString::null);
|
---|
79 | void vmOpenInFileManager(const QString &aUuid = QString::null);
|
---|
80 | void vmCreateShortcut(const QString &aUuid = QString::null);
|
---|
81 |
|
---|
82 | void refreshVMList();
|
---|
83 | void refreshVMItem(const QString &aID, bool aDetails, bool aSnapshots, bool aDescription);
|
---|
84 |
|
---|
85 | void showContextMenu(const QPoint &aPoint);
|
---|
86 |
|
---|
87 | void sltOpenUrls(QList<QUrl> list = QList<QUrl>());
|
---|
88 |
|
---|
89 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
90 | void trayIconActivated(QSystemTrayIcon::ActivationReason aReason);
|
---|
91 | void showWindow();
|
---|
92 | #endif
|
---|
93 |
|
---|
94 | const QAction *vmNewAction() const { return mVmNewAction; }
|
---|
95 | const QAction *vmAddAction() const { return mVmAddAction; }
|
---|
96 | const QAction *vmConfigAction() const { return mVmConfigAction; }
|
---|
97 | const QAction *vmDeleteAction() const { return mVmDeleteAction; }
|
---|
98 | const QAction *vmStartAction() const { return mVmStartAction; }
|
---|
99 | const QAction *vmDiscardAction() const { return mVmDiscardAction; }
|
---|
100 | const QAction *vmPauseAction() const { return mVmPauseAction; }
|
---|
101 | const QAction *vmRefreshAction() const { return mVmRefreshAction; }
|
---|
102 | const QAction *vmShowLogsAction() const { return mVmShowLogsAction; }
|
---|
103 |
|
---|
104 | protected:
|
---|
105 |
|
---|
106 | /* Events */
|
---|
107 | bool event(QEvent *aEvent);
|
---|
108 | void closeEvent(QCloseEvent *aEvent);
|
---|
109 | #ifdef Q_WS_MAC
|
---|
110 | bool eventFilter(QObject *pObject, QEvent *pEvent);
|
---|
111 | #endif /* Q_WS_MAC */
|
---|
112 |
|
---|
113 | void retranslateUi();
|
---|
114 |
|
---|
115 | private slots:
|
---|
116 |
|
---|
117 | void vmListViewCurrentChanged(bool aRefreshDetails = true, bool aRefreshSnapshots = true, bool aRefreshDescription = true);
|
---|
118 | void mediumEnumStarted();
|
---|
119 | void mediumEnumFinished(const VBoxMediaList &);
|
---|
120 |
|
---|
121 | /* VirtualBox callback events we're interested in */
|
---|
122 |
|
---|
123 | void machineStateChanged(QString strId, KMachineState state);
|
---|
124 | void machineDataChanged(QString strId);
|
---|
125 | void machineRegistered(QString strID, bool fRegistered);
|
---|
126 | void sessionStateChanged(QString strId, KSessionState state);
|
---|
127 | void snapshotChanged(QString strId, QString strSnapshotId);
|
---|
128 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
129 | void mainWindowCountChanged(int count);
|
---|
130 | void trayIconCanShow(bool fEnabled);
|
---|
131 | void trayIconShow(bool fEnabled);
|
---|
132 | void trayIconChanged(bool fEnabled);
|
---|
133 | #endif
|
---|
134 |
|
---|
135 | void sltDownloaderUserManualEmbed();
|
---|
136 |
|
---|
137 | void showViewContextMenu(const QPoint &pos);
|
---|
138 |
|
---|
139 | private:
|
---|
140 |
|
---|
141 | /* Main menus */
|
---|
142 | QMenu *mFileMenu;
|
---|
143 | QMenu *mVMMenu;
|
---|
144 | QMenu *mHelpMenu;
|
---|
145 |
|
---|
146 | /* Central splitter window */
|
---|
147 | QISplitter *m_pSplitter;
|
---|
148 |
|
---|
149 | /* Main toolbar */
|
---|
150 | #ifndef Q_WS_MAC
|
---|
151 | UIMainBar *m_pBar;
|
---|
152 | #endif /* !Q_WS_MAC */
|
---|
153 | UIToolBar *mVMToolBar;
|
---|
154 |
|
---|
155 | /* VM list context menu */
|
---|
156 | QMenu *mVMCtxtMenu;
|
---|
157 |
|
---|
158 | /* Actions */
|
---|
159 | QAction *mFileMediaMgrAction;
|
---|
160 | QAction *mFileApplianceImportAction;
|
---|
161 | QAction *mFileApplianceExportAction;
|
---|
162 | QAction *mFileSettingsAction;
|
---|
163 | QAction *mFileExitAction;
|
---|
164 | QAction *mVmNewAction;
|
---|
165 | QAction *mVmAddAction;
|
---|
166 | QAction *mVmConfigAction;
|
---|
167 | QAction *mVmDeleteAction;
|
---|
168 | QAction *mVmStartAction;
|
---|
169 | QAction *mVmDiscardAction;
|
---|
170 | QAction *mVmPauseAction;
|
---|
171 | QAction *mVmRefreshAction;
|
---|
172 | QAction *mVmShowLogsAction;
|
---|
173 | QAction *mVmOpenInFileManagerAction;
|
---|
174 | QAction *mVmCreateShortcut;
|
---|
175 |
|
---|
176 | VBoxHelpActions mHelpActions;
|
---|
177 |
|
---|
178 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
179 | /* The systray icon */
|
---|
180 | VBoxTrayIcon *mTrayIcon;
|
---|
181 | #endif
|
---|
182 |
|
---|
183 | /* The vm list view/model */
|
---|
184 | UIVMListView *mVMListView;
|
---|
185 | UIVMItemModel *mVMModel;
|
---|
186 |
|
---|
187 | /* The right information widgets */
|
---|
188 | UIVMDesktop *m_pVMDesktop;
|
---|
189 |
|
---|
190 | QRect mNormalGeo;
|
---|
191 |
|
---|
192 | bool mDoneInaccessibleWarningOnce : 1;
|
---|
193 | };
|
---|
194 |
|
---|
195 | #endif // __VBoxSelectorWnd_h__
|
---|
196 |
|
---|