1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxProblemReporter class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * If you received this file as part of a commercial VirtualBox
|
---|
19 | * distribution, then only the terms of your commercial VirtualBox
|
---|
20 | * license agreement apply instead of the previous paragraph.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxProblemReporter_h__
|
---|
24 | #define __VBoxProblemReporter_h__
|
---|
25 |
|
---|
26 | #include "COMDefs.h"
|
---|
27 | #include "QIMessageBox.h"
|
---|
28 |
|
---|
29 | #include <qobject.h>
|
---|
30 |
|
---|
31 | class QProcess;
|
---|
32 |
|
---|
33 | class VBoxProblemReporter : public QObject
|
---|
34 | {
|
---|
35 | Q_OBJECT
|
---|
36 |
|
---|
37 | public:
|
---|
38 |
|
---|
39 | enum Type {
|
---|
40 | Info = 1,
|
---|
41 | Question,
|
---|
42 | Warning,
|
---|
43 | Error,
|
---|
44 | Critical
|
---|
45 | };
|
---|
46 | enum {
|
---|
47 | AutoConfirmed = 0x8000
|
---|
48 | };
|
---|
49 |
|
---|
50 | static VBoxProblemReporter &instance();
|
---|
51 |
|
---|
52 | bool isValid();
|
---|
53 |
|
---|
54 | // helpers
|
---|
55 |
|
---|
56 | int message (
|
---|
57 | QWidget *parent, Type type, const QString &msg,
|
---|
58 | const QString &details = QString::null,
|
---|
59 | const char *autoConfirmId = 0,
|
---|
60 | int b1 = 0, int b2 = 0, int b3 = 0,
|
---|
61 | const char *name = 0
|
---|
62 | );
|
---|
63 |
|
---|
64 | int message (
|
---|
65 | QWidget *parent, Type type, const QString &msg,
|
---|
66 | const char *autoConfirmId,
|
---|
67 | int b1 = 0, int b2 = 0, int b3 = 0,
|
---|
68 | const char *name = 0
|
---|
69 | ) {
|
---|
70 | return message (parent, type, msg, QString::null, autoConfirmId,
|
---|
71 | b1, b2, b3, name);
|
---|
72 | }
|
---|
73 |
|
---|
74 | bool messageYesNo (
|
---|
75 | QWidget *parent, Type type, const QString &msg,
|
---|
76 | const QString &details = QString::null,
|
---|
77 | const char *autoConfirmId = 0,
|
---|
78 | const char *name = 0
|
---|
79 | );
|
---|
80 |
|
---|
81 | bool messageYesNo (
|
---|
82 | QWidget *parent, Type type, const QString &msg,
|
---|
83 | const char *autoConfirmId,
|
---|
84 | const char *name = 0
|
---|
85 | ) {
|
---|
86 | return messageYesNo (parent, type, msg, QString::null, autoConfirmId, name);
|
---|
87 | }
|
---|
88 |
|
---|
89 | bool showModalProgressDialog (
|
---|
90 | CProgress &aProgress, const QString &aTitle, QWidget *aParent,
|
---|
91 | int aMinDuration = 2000
|
---|
92 | );
|
---|
93 |
|
---|
94 | QWidget *mainWindowShown();
|
---|
95 |
|
---|
96 | // problem handlers
|
---|
97 |
|
---|
98 | void cannotOpenURL (const QString &aURL);
|
---|
99 |
|
---|
100 | void cannotInitCOM (HRESULT rc);
|
---|
101 | void cannotCreateVirtualBox (const CVirtualBox &vbox);
|
---|
102 |
|
---|
103 | void cannotLoadGlobalConfig (const CVirtualBox &vbox, const QString &error);
|
---|
104 | void cannotSaveGlobalConfig (const CVirtualBox &vbox);
|
---|
105 | void cannotSetSystemProperties (const CSystemProperties &props);
|
---|
106 | void cannotAccessUSB (const COMBase &obj);
|
---|
107 |
|
---|
108 | void cannotCreateMachine (const CVirtualBox &vbox,
|
---|
109 | QWidget *parent = 0);
|
---|
110 | void cannotCreateMachine (const CVirtualBox &vbox, const CMachine &machine,
|
---|
111 | QWidget *parent = 0);
|
---|
112 | void cannotApplyMachineSettings (const CMachine &machine, const COMResult &res);
|
---|
113 | void cannotSaveMachineSettings (const CMachine &machine,
|
---|
114 | QWidget *parent = 0);
|
---|
115 | void cannotLoadMachineSettings (const CMachine &machine,
|
---|
116 | bool strict = true,
|
---|
117 | QWidget *parent = 0);
|
---|
118 |
|
---|
119 | void cannotStartMachine (const CConsole &console);
|
---|
120 | void cannotStartMachine (const CProgress &progress);
|
---|
121 | void cannotPauseMachine (const CConsole &console);
|
---|
122 | void cannotResumeMachine (const CConsole &console);
|
---|
123 | void cannotSaveMachineState (const CConsole &console);
|
---|
124 | void cannotSaveMachineState (const CProgress &progress);
|
---|
125 | void cannotTakeSnapshot (const CConsole &console);
|
---|
126 | void cannotTakeSnapshot (const CProgress &progress);
|
---|
127 | void cannotStopMachine (const CConsole &console);
|
---|
128 | void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);
|
---|
129 | void cannotDiscardSavedState (const CConsole &console);
|
---|
130 |
|
---|
131 | void cannotDiscardSnapshot (const CConsole &console, const CSnapshot &snapshot);
|
---|
132 | void cannotDiscardSnapshot (const CProgress &progress, const CSnapshot &snapshot);
|
---|
133 | void cannotDiscardCurrentState (const CConsole &console);
|
---|
134 | void cannotDiscardCurrentState (const CProgress &progress);
|
---|
135 | void cannotDiscardCurrentSnapshotAndState (const CConsole &console);
|
---|
136 | void cannotDiscardCurrentSnapshotAndState (const CProgress &progress);
|
---|
137 |
|
---|
138 | void cannotFindMachineByName (const CVirtualBox &vbox, const QString &name);
|
---|
139 |
|
---|
140 | bool confirmMachineDeletion (const CMachine &machine);
|
---|
141 | bool confirmDiscardSavedState (const CMachine &machine);
|
---|
142 |
|
---|
143 | void sayCannotOverwriteHardDiskImage (QWidget *parent, const QString &src);
|
---|
144 | int confirmHardDiskImageDeletion (QWidget *parent, const QString &src);
|
---|
145 | void cannotDeleteHardDiskImage (QWidget *parent, const CVirtualDiskImage &vdi);
|
---|
146 |
|
---|
147 | int confirmHardDiskUnregister (QWidget *parent, const QString &src);
|
---|
148 |
|
---|
149 | void cannotCreateHardDiskImage (
|
---|
150 | QWidget *parent, const CVirtualBox &vbox, const QString &src,
|
---|
151 | const CVirtualDiskImage &vdi, const CProgress &progress);
|
---|
152 | void cannotAttachHardDisk (QWidget *parent, const CMachine &m, const QUuid &id,
|
---|
153 | CEnums::DiskControllerType ctl, LONG dev);
|
---|
154 | void cannotDetachHardDisk (QWidget *parent, const CMachine &m,
|
---|
155 | CEnums::DiskControllerType ctl, LONG dev);
|
---|
156 | void cannotRegisterMedia (QWidget *parent, const CVirtualBox &vbox,
|
---|
157 | VBoxDefs::DiskType type, const QString &src);
|
---|
158 | void cannotUnregisterMedia (QWidget *parent, const CVirtualBox &vbox,
|
---|
159 | VBoxDefs::DiskType type, const QString &src);
|
---|
160 |
|
---|
161 | void cannotOpenSession (const CSession &session);
|
---|
162 | void cannotOpenSession (const CVirtualBox &vbox, const QUuid &id);
|
---|
163 | void cannotOpenSession (const CVirtualBox &vbox, const CMachine &machine,
|
---|
164 | const CProgress &progress = CProgress());
|
---|
165 |
|
---|
166 | void cannotGetMediaAccessibility (const CUnknown &unk);
|
---|
167 |
|
---|
168 | /// @todo (r=dmik) later
|
---|
169 | // void cannotMountMedia (const CUnknown &unk);
|
---|
170 | // void cannotUnmountMedia (const CUnknown &unk);
|
---|
171 |
|
---|
172 | #if defined Q_WS_WIN
|
---|
173 | void cannotCreateHostInterface (const CHost &host, const QString &name,
|
---|
174 | QWidget *parent = 0);
|
---|
175 | void cannotCreateHostInterface (const CProgress &progress, const QString &name,
|
---|
176 | QWidget *parent = 0);
|
---|
177 | void cannotRemoveHostInterface (const CHost &host,
|
---|
178 | const CHostNetworkInterface &iface,
|
---|
179 | QWidget *parent = 0);
|
---|
180 | void cannotRemoveHostInterface (const CProgress &progress,
|
---|
181 | const CHostNetworkInterface &iface,
|
---|
182 | QWidget *parent = 0);
|
---|
183 | #endif
|
---|
184 |
|
---|
185 | void cannotAttachUSBDevice (const CConsole &console, const QString &device);
|
---|
186 | void cannotDetachUSBDevice (const CConsole &console, const QString &device);
|
---|
187 |
|
---|
188 | void cannotCreateSharedFolder (QWidget *, const CMachine &,
|
---|
189 | const QString &, const QString &);
|
---|
190 | void cannotRemoveSharedFolder (QWidget *, const CMachine &,
|
---|
191 | const QString &, const QString &);
|
---|
192 | void cannotCreateSharedFolder (QWidget *, const CConsole &,
|
---|
193 | const QString &, const QString &);
|
---|
194 | void cannotRemoveSharedFolder (QWidget *, const CConsole &,
|
---|
195 | const QString &, const QString &);
|
---|
196 |
|
---|
197 | bool confirmReleaseImage (QWidget*, QString);
|
---|
198 |
|
---|
199 | bool remindAboutInputCapture();
|
---|
200 | bool remindAboutAutoCapture();
|
---|
201 | bool remindAboutMouseIntegration (bool supportsAbsolute);
|
---|
202 | bool remindAboutPausedVMInput();
|
---|
203 |
|
---|
204 | bool remindAboutInaccessibleMedia();
|
---|
205 |
|
---|
206 | void remindAboutGoingFullscreen (const QString &hotKey,
|
---|
207 | const QString &hostKey);
|
---|
208 |
|
---|
209 | void cannotRunInSelectorMode();
|
---|
210 |
|
---|
211 | void showRuntimeError (const CConsole &console, bool fatal,
|
---|
212 | const QString &errorID,
|
---|
213 | const QString &errorMsg);
|
---|
214 |
|
---|
215 | static QString formatErrorInfo (const COMErrorInfo &info,
|
---|
216 | HRESULT wrapperRC = S_OK);
|
---|
217 | static QString formatErrorInfo (const CVirtualBoxErrorInfo &info) {
|
---|
218 | return formatErrorInfo (COMErrorInfo (info));
|
---|
219 | }
|
---|
220 | static QString formatErrorInfo (const COMBase &wrapper) {
|
---|
221 | Assert (FAILED (wrapper.lastRC()));
|
---|
222 | return formatErrorInfo (wrapper.errorInfo(), wrapper.lastRC());
|
---|
223 | }
|
---|
224 | static QString formatErrorInfo (const COMResult &rc) {
|
---|
225 | Assert (FAILED (rc.rc()));
|
---|
226 | return formatErrorInfo (rc.errorInfo(), rc.rc());
|
---|
227 | }
|
---|
228 |
|
---|
229 | public slots:
|
---|
230 |
|
---|
231 | void showHelpWebDialog();
|
---|
232 | void showHelpAboutDialog();
|
---|
233 | void resetSuppressedMessages();
|
---|
234 |
|
---|
235 | private:
|
---|
236 |
|
---|
237 | friend VBoxProblemReporter &vboxProblem();
|
---|
238 | };
|
---|
239 |
|
---|
240 | inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); }
|
---|
241 |
|
---|
242 | #endif // __VBoxProblemReporter_h__
|
---|