1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxProblemReporter class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 innotek 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 (QWidget *parent, Type type, const QString &msg,
|
---|
57 | const QString &details = QString::null,
|
---|
58 | const char *autoConfirmId = NULL,
|
---|
59 | int b1 = 0, int b2 = 0, int b3 = 0,
|
---|
60 | const char *name = 0);
|
---|
61 |
|
---|
62 | int message (QWidget *parent, Type type, const QString &msg,
|
---|
63 | const char *autoConfirmId,
|
---|
64 | int b1 = 0, int b2 = 0, int b3 = 0,
|
---|
65 | const char *name = 0)
|
---|
66 | {
|
---|
67 | return message (parent, type, msg, QString::null, autoConfirmId,
|
---|
68 | b1, b2, b3, name);
|
---|
69 | }
|
---|
70 |
|
---|
71 | bool messageYesNo (QWidget *parent, Type type, const QString &msg,
|
---|
72 | const QString &details = QString::null,
|
---|
73 | const char *autoConfirmId = 0,
|
---|
74 | const char *name = 0);
|
---|
75 |
|
---|
76 | bool messageYesNo (QWidget *parent, Type type, const QString &msg,
|
---|
77 | const char *autoConfirmId,
|
---|
78 | const char *name = 0)
|
---|
79 | {
|
---|
80 | return messageYesNo (parent, type, msg, QString::null, autoConfirmId, name);
|
---|
81 | }
|
---|
82 |
|
---|
83 | bool showModalProgressDialog (CProgress &aProgress, const QString &aTitle,
|
---|
84 | QWidget *aParent, int aMinDuration = 2000);
|
---|
85 |
|
---|
86 | QWidget *mainWindowShown();
|
---|
87 |
|
---|
88 | // problem handlers
|
---|
89 |
|
---|
90 | void cannotOpenURL (const QString &aURL);
|
---|
91 |
|
---|
92 | void cannotFindLanguage (const QString &aLangID, const QString &aNlsPath);
|
---|
93 | void cannotLoadLanguage (const QString &aLangFile);
|
---|
94 |
|
---|
95 | void cannotInitCOM (HRESULT rc);
|
---|
96 | void cannotCreateVirtualBox (const CVirtualBox &vbox);
|
---|
97 |
|
---|
98 | void cannotLoadGlobalConfig (const CVirtualBox &vbox, const QString &error);
|
---|
99 | void cannotSaveGlobalConfig (const CVirtualBox &vbox);
|
---|
100 | void cannotSetSystemProperties (const CSystemProperties &props);
|
---|
101 | void cannotAccessUSB (const COMBase &obj);
|
---|
102 |
|
---|
103 | void cannotCreateMachine (const CVirtualBox &vbox,
|
---|
104 | QWidget *parent = 0);
|
---|
105 | void cannotCreateMachine (const CVirtualBox &vbox, const CMachine &machine,
|
---|
106 | QWidget *parent = 0);
|
---|
107 | void cannotApplyMachineSettings (const CMachine &machine, const COMResult &res);
|
---|
108 | void cannotSaveMachineSettings (const CMachine &machine,
|
---|
109 | QWidget *parent = 0);
|
---|
110 | void cannotLoadMachineSettings (const CMachine &machine,
|
---|
111 | bool strict = true,
|
---|
112 | QWidget *parent = 0);
|
---|
113 |
|
---|
114 | void cannotStartMachine (const CConsole &console);
|
---|
115 | void cannotStartMachine (const CProgress &progress);
|
---|
116 | void cannotPauseMachine (const CConsole &console);
|
---|
117 | void cannotResumeMachine (const CConsole &console);
|
---|
118 | void cannotSaveMachineState (const CConsole &console);
|
---|
119 | void cannotSaveMachineState (const CProgress &progress);
|
---|
120 | void cannotTakeSnapshot (const CConsole &console);
|
---|
121 | void cannotTakeSnapshot (const CProgress &progress);
|
---|
122 | void cannotStopMachine (const CConsole &console);
|
---|
123 | void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);
|
---|
124 | void cannotDiscardSavedState (const CConsole &console);
|
---|
125 |
|
---|
126 | void cannotDiscardSnapshot (const CConsole &console, const CSnapshot &snapshot);
|
---|
127 | void cannotDiscardSnapshot (const CProgress &progress, const CSnapshot &snapshot);
|
---|
128 | void cannotDiscardCurrentState (const CConsole &console);
|
---|
129 | void cannotDiscardCurrentState (const CProgress &progress);
|
---|
130 | void cannotDiscardCurrentSnapshotAndState (const CConsole &console);
|
---|
131 | void cannotDiscardCurrentSnapshotAndState (const CProgress &progress);
|
---|
132 |
|
---|
133 | void cannotFindMachineByName (const CVirtualBox &vbox, const QString &name);
|
---|
134 |
|
---|
135 | bool confirmMachineDeletion (const CMachine &machine);
|
---|
136 | bool confirmDiscardSavedState (const CMachine &machine);
|
---|
137 |
|
---|
138 | bool confirmReleaseImage (QWidget *parent, const QString &usage);
|
---|
139 |
|
---|
140 | void sayCannotOverwriteHardDiskImage (QWidget *parent, const QString &src);
|
---|
141 | int confirmHardDiskImageDeletion (QWidget *parent, const QString &src);
|
---|
142 | void cannotDeleteHardDiskImage (QWidget *parent, const CVirtualDiskImage &vdi);
|
---|
143 |
|
---|
144 | int confirmHardDiskUnregister (QWidget *parent, const QString &src);
|
---|
145 |
|
---|
146 | void cannotCreateHardDiskImage (
|
---|
147 | QWidget *parent, const CVirtualBox &vbox, const QString &src,
|
---|
148 | const CVirtualDiskImage &vdi, const CProgress &progress);
|
---|
149 | void cannotAttachHardDisk (QWidget *parent, const CMachine &m, const QUuid &id,
|
---|
150 | CEnums::DiskControllerType ctl, LONG dev);
|
---|
151 | void cannotDetachHardDisk (QWidget *parent, const CMachine &m,
|
---|
152 | CEnums::DiskControllerType ctl, LONG dev);
|
---|
153 | void cannotRegisterMedia (QWidget *parent, const CVirtualBox &vbox,
|
---|
154 | VBoxDefs::DiskType type, const QString &src);
|
---|
155 | void cannotUnregisterMedia (QWidget *parent, const CVirtualBox &vbox,
|
---|
156 | VBoxDefs::DiskType type, const QString &src);
|
---|
157 |
|
---|
158 | void cannotOpenSession (const CSession &session);
|
---|
159 | void cannotOpenSession (const CVirtualBox &vbox, const CMachine &machine,
|
---|
160 | const CProgress &progress = CProgress());
|
---|
161 |
|
---|
162 | void cannotGetMediaAccessibility (const CUnknown &unk);
|
---|
163 |
|
---|
164 | /// @todo (r=dmik) later
|
---|
165 | // void cannotMountMedia (const CUnknown &unk);
|
---|
166 | // void cannotUnmountMedia (const CUnknown &unk);
|
---|
167 |
|
---|
168 | #if defined Q_WS_WIN
|
---|
169 | void cannotCreateHostInterface (const CHost &host, const QString &name,
|
---|
170 | QWidget *parent = 0);
|
---|
171 | void cannotCreateHostInterface (const CProgress &progress, const QString &name,
|
---|
172 | QWidget *parent = 0);
|
---|
173 | void cannotRemoveHostInterface (const CHost &host,
|
---|
174 | const CHostNetworkInterface &iface,
|
---|
175 | QWidget *parent = 0);
|
---|
176 | void cannotRemoveHostInterface (const CProgress &progress,
|
---|
177 | const CHostNetworkInterface &iface,
|
---|
178 | QWidget *parent = 0);
|
---|
179 | #endif
|
---|
180 |
|
---|
181 | void cannotAttachUSBDevice (const CConsole &console, const QString &device);
|
---|
182 | void cannotAttachUSBDevice (const CConsole &console, const QString &device,
|
---|
183 | const CVirtualBoxErrorInfo &error);
|
---|
184 | void cannotDetachUSBDevice (const CConsole &console, const QString &device);
|
---|
185 | void cannotDetachUSBDevice (const CConsole &console, const QString &device,
|
---|
186 | const CVirtualBoxErrorInfo &error);
|
---|
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 | void cannotDonwloadGuestAdditions (const QString &aName,
|
---|
198 | const QString &aReason);
|
---|
199 |
|
---|
200 | int warnAboutAdditionsDownload (const QString &aSrc1, const QString &aSrc2,
|
---|
201 | const QString &aName, ulong aSize);
|
---|
202 |
|
---|
203 | void warnAboutTooOldAdditions (QWidget *, const QString &, const QString &);
|
---|
204 | void warnAboutOldAdditions (QWidget *, const QString &, const QString &);
|
---|
205 | void warnAboutNewAdditions (QWidget *, const QString &, const QString &);
|
---|
206 |
|
---|
207 | bool remindAboutInputCapture();
|
---|
208 | bool remindAboutAutoCapture();
|
---|
209 | bool remindAboutMouseIntegration (bool supportsAbsolute);
|
---|
210 | bool remindAboutPausedVMInput();
|
---|
211 |
|
---|
212 | bool remindAboutInaccessibleMedia();
|
---|
213 |
|
---|
214 | void remindAboutGoingFullscreen (const QString &hotKey,
|
---|
215 | const QString &hostKey);
|
---|
216 | void remindAboutGoingSeamless (const QString &hotKey,
|
---|
217 | const QString &hostKey);
|
---|
218 |
|
---|
219 | void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP);
|
---|
220 |
|
---|
221 | void cannotRunInSelectorMode();
|
---|
222 |
|
---|
223 | void showRuntimeError (const CConsole &console, bool fatal,
|
---|
224 | const QString &errorID,
|
---|
225 | const QString &errorMsg);
|
---|
226 |
|
---|
227 | static QString formatErrorInfo (const COMErrorInfo &aInfo,
|
---|
228 | HRESULT aWrapperRC = S_OK);
|
---|
229 |
|
---|
230 | static QString formatErrorInfo (const CVirtualBoxErrorInfo &aInfo)
|
---|
231 | {
|
---|
232 | return formatErrorInfo (COMErrorInfo (aInfo));
|
---|
233 | }
|
---|
234 |
|
---|
235 | static QString formatErrorInfo (const COMBase &aWrapper)
|
---|
236 | {
|
---|
237 | Assert (FAILED (aWrapper.lastRC()));
|
---|
238 | return formatErrorInfo (aWrapper.errorInfo(), aWrapper.lastRC());
|
---|
239 | }
|
---|
240 |
|
---|
241 | static QString formatErrorInfo (const COMResult &aRC)
|
---|
242 | {
|
---|
243 | Assert (FAILED (aRC.rc()));
|
---|
244 | return formatErrorInfo (aRC.errorInfo(), aRC.rc());
|
---|
245 | }
|
---|
246 |
|
---|
247 | public slots:
|
---|
248 |
|
---|
249 | void showHelpWebDialog();
|
---|
250 | void showHelpAboutDialog();
|
---|
251 | void showHelpHelpDialog();
|
---|
252 | void resetSuppressedMessages();
|
---|
253 |
|
---|
254 | private:
|
---|
255 |
|
---|
256 | friend VBoxProblemReporter &vboxProblem();
|
---|
257 |
|
---|
258 | static QString doFormatErrorInfo (const COMErrorInfo &aInfo,
|
---|
259 | HRESULT aWrapperRC = S_OK);
|
---|
260 | };
|
---|
261 |
|
---|
262 | inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); }
|
---|
263 |
|
---|
264 | #endif // __VBoxProblemReporter_h__
|
---|