VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxProblemReporter.h@ 11228

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

FE/Qt: Added printing the mnemonic error code in addition to the hex number in the error boxes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.2 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxProblemReporter class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2007 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 __VBoxProblemReporter_h__
24#define __VBoxProblemReporter_h__
25
26#include "COMDefs.h"
27#include "QIMessageBox.h"
28
29/* Qt icludes */
30#include <QObject>
31
32class VBoxProblemReporter : public QObject
33{
34 Q_OBJECT
35
36public:
37
38 enum Type {
39 Info = 1,
40 Question,
41 Warning,
42 Error,
43 Critical,
44 GuruMeditation
45 };
46 enum {
47 AutoConfirmed = 0x8000
48 };
49
50 static VBoxProblemReporter &instance();
51
52 bool isValid();
53
54 // helpers
55
56 int message (QWidget *aParent, Type aType, const QString &aMessage,
57 const QString &aDetails = QString::null,
58 const char *aAutoConfirmId = 0,
59 int aButton1 = 0, int aButton2 = 0, int aButton3 = 0,
60 const QString &aText1 = QString::null,
61 const QString &aText2 = QString::null,
62 const QString &aText3 = QString::null);
63
64 int message (QWidget *aParent, Type aType, const QString &aMessage,
65 const char *aAutoConfirmId,
66 int aButton1 = 0, int aButton2 = 0, int aButton3 = 0,
67 const QString &aText1 = QString::null,
68 const QString &aText2 = QString::null,
69 const QString &aText3 = QString::null)
70 {
71 return message (aParent, aType, aMessage, QString::null, aAutoConfirmId,
72 aButton1, aButton2, aButton3, aText1, aText2, aText3);
73 }
74
75 bool messageYesNo (QWidget *aParent, Type aType, const QString &aMessage,
76 const QString &aDetails = QString::null,
77 const char *aAutoConfirmId = 0,
78 const QString &aYesText = QString::null,
79 const QString &aNoText = QString::null)
80 {
81 return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,
82 QIMessageBox::Yes | QIMessageBox::Default,
83 QIMessageBox::No | QIMessageBox::Escape,
84 0,
85 aYesText, aNoText, QString::null) &
86 QIMessageBox::ButtonMask) == QIMessageBox::Yes;
87 }
88
89 bool messageYesNo (QWidget *aParent, Type aType, const QString &aMessage,
90 const char *aAutoConfirmId,
91 const QString &aYesText = QString::null,
92 const QString &aNoText = QString::null)
93 {
94 return messageYesNo (aParent, aType, aMessage, QString::null,
95 aAutoConfirmId, aYesText, aNoText);
96 }
97
98 bool messageOkCancel (QWidget *aParent, Type aType, const QString &aMessage,
99 const QString &aDetails = QString::null,
100 const char *aAutoConfirmId = 0,
101 const QString &aOkText = QString::null,
102 const QString &aCancelText = QString::null)
103 {
104 return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,
105 QIMessageBox::Ok | QIMessageBox::Default,
106 QIMessageBox::Cancel | QIMessageBox::Escape,
107 0,
108 aOkText, aCancelText, QString::null) &
109 QIMessageBox::ButtonMask) == QIMessageBox::Ok;
110 }
111
112 bool messageOkCancel (QWidget *aParent, Type aType, const QString &aMessage,
113 const char *aAutoConfirmId,
114 const QString &aOkText = QString::null,
115 const QString &aCancelText = QString::null)
116 {
117 return messageOkCancel (aParent, aType, aMessage, QString::null,
118 aAutoConfirmId, aOkText, aCancelText);
119 }
120
121 bool showModalProgressDialog (CProgress &aProgress, const QString &aTitle,
122 QWidget *aParent, int aMinDuration = 2000);
123
124 QWidget *mainWindowShown();
125
126 // problem handlers
127
128#ifdef Q_WS_X11
129 void cannotFindLicenseFiles (const QString &aPath);
130 void cannotOpenLicenseFile (QWidget *aParent, const QString &aPath);
131#endif
132
133 void cannotOpenURL (const QString &aURL);
134 void cannotCopyFile (const QString &aSrc, const QString &aDst, int aVRC);
135
136 void cannotFindLanguage (const QString &aLangID, const QString &aNlsPath);
137 void cannotLoadLanguage (const QString &aLangFile);
138
139 void cannotInitCOM (HRESULT rc);
140 void cannotCreateVirtualBox (const CVirtualBox &vbox);
141
142 void cannotSaveGlobalSettings (const CVirtualBox &vbox,
143 QWidget *parent = 0);
144
145 void cannotLoadGlobalConfig (const CVirtualBox &vbox, const QString &error);
146 void cannotSaveGlobalConfig (const CVirtualBox &vbox);
147 void cannotSetSystemProperties (const CSystemProperties &props);
148 void cannotAccessUSB (const COMBase &obj);
149
150 void cannotCreateMachine (const CVirtualBox &vbox,
151 QWidget *parent = 0);
152 void cannotCreateMachine (const CVirtualBox &vbox, const CMachine &machine,
153 QWidget *parent = 0);
154 void cannotApplyMachineSettings (const CMachine &machine, const COMResult &res);
155 void cannotSaveMachineSettings (const CMachine &machine,
156 QWidget *parent = 0);
157 void cannotLoadMachineSettings (const CMachine &machine,
158 bool strict = true,
159 QWidget *parent = 0);
160
161 void cannotStartMachine (const CConsole &console);
162 void cannotStartMachine (const CProgress &progress);
163 void cannotPauseMachine (const CConsole &console);
164 void cannotResumeMachine (const CConsole &console);
165 void cannotACPIShutdownMachine (const CConsole &console);
166 void cannotSaveMachineState (const CConsole &console);
167 void cannotSaveMachineState (const CProgress &progress);
168 void cannotTakeSnapshot (const CConsole &console);
169 void cannotTakeSnapshot (const CProgress &progress);
170 void cannotStopMachine (const CConsole &console);
171 void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);
172 void cannotDiscardSavedState (const CConsole &console);
173
174 void cannotSetSnapshotFolder (const CMachine &aMachine, const QString &aPath);
175 void cannotDiscardSnapshot (const CConsole &console, const CSnapshot &snapshot);
176 void cannotDiscardSnapshot (const CProgress &progress, const CSnapshot &snapshot);
177 void cannotDiscardCurrentState (const CConsole &console);
178 void cannotDiscardCurrentState (const CProgress &progress);
179 void cannotDiscardCurrentSnapshotAndState (const CConsole &console);
180 void cannotDiscardCurrentSnapshotAndState (const CProgress &progress);
181
182 void cannotFindMachineByName (const CVirtualBox &vbox, const QString &name);
183
184 void cannotEnterSeamlessMode (ULONG aWidth, ULONG aHeight,
185 ULONG aBpp, ULONG64 aMinVRAM);
186 int cannotEnterFullscreenMode (ULONG aWidth, ULONG aHeight,
187 ULONG aBpp, ULONG64 aMinVRAM);
188
189 bool confirmMachineDeletion (const CMachine &machine);
190 bool confirmDiscardSavedState (const CMachine &machine);
191
192 bool confirmReleaseImage (QWidget *parent, const QString &usage);
193
194 void sayCannotOverwriteHardDiskImage (QWidget *parent, const QString &src);
195 int confirmHardDiskImageDeletion (QWidget *parent, const QString &src);
196 void cannotDeleteHardDiskImage (QWidget *parent, const CVirtualDiskImage &vdi);
197
198 bool confirmHardDiskUnregister (QWidget *parent, const QString &src);
199
200 int confirmDetachSATASlots (QWidget *aParent);
201 int confirmRunNewHDWzdOrVDM (QWidget* aParent);
202
203 void cannotCreateHardDiskImage (
204 QWidget *parent, const CVirtualBox &vbox, const QString &src,
205 const CVirtualDiskImage &vdi, const CProgress &progress);
206 void cannotAttachHardDisk (QWidget *parent, const CMachine &m, const QUuid &id,
207 KStorageBus bus, LONG channel, LONG dev);
208 void cannotDetachHardDisk (QWidget *parent, const CMachine &m,
209 KStorageBus bus, LONG channel, LONG dev);
210 void cannotRegisterMedia (QWidget *parent, const CVirtualBox &vbox,
211 VBoxDefs::DiskType type, const QString &src);
212 void cannotUnregisterMedia (QWidget *parent, const CVirtualBox &vbox,
213 VBoxDefs::DiskType type, const QString &src);
214
215 void cannotOpenSession (const CSession &session);
216 void cannotOpenSession (const CVirtualBox &vbox, const CMachine &machine,
217 const CProgress &progress = CProgress());
218
219 void cannotGetMediaAccessibility (const CUnknown &unk);
220
221/// @todo (r=dmik) later
222// void cannotMountMedia (const CUnknown &unk);
223// void cannotUnmountMedia (const CUnknown &unk);
224
225#if defined Q_WS_WIN
226 void cannotCreateHostInterface (const CHost &host, const QString &name,
227 QWidget *parent = 0);
228 void cannotCreateHostInterface (const CProgress &progress, const QString &name,
229 QWidget *parent = 0);
230 void cannotRemoveHostInterface (const CHost &host,
231 const CHostNetworkInterface &iface,
232 QWidget *parent = 0);
233 void cannotRemoveHostInterface (const CProgress &progress,
234 const CHostNetworkInterface &iface,
235 QWidget *parent = 0);
236#endif
237
238 void cannotAttachUSBDevice (const CConsole &console, const QString &device);
239 void cannotAttachUSBDevice (const CConsole &console, const QString &device,
240 const CVirtualBoxErrorInfo &error);
241 void cannotDetachUSBDevice (const CConsole &console, const QString &device);
242 void cannotDetachUSBDevice (const CConsole &console, const QString &device,
243 const CVirtualBoxErrorInfo &error);
244
245 void cannotCreateSharedFolder (QWidget *, const CMachine &,
246 const QString &, const QString &);
247 void cannotRemoveSharedFolder (QWidget *, const CMachine &,
248 const QString &, const QString &);
249 void cannotCreateSharedFolder (QWidget *, const CConsole &,
250 const QString &, const QString &);
251 void cannotRemoveSharedFolder (QWidget *, const CConsole &,
252 const QString &, const QString &);
253
254 int cannotFindGuestAdditions (const QString &aSrc1, const QString &aSrc2);
255 void cannotDownloadGuestAdditions (const QString &aURL,
256 const QString &aReason);
257 bool confirmDownloadAdditions (const QString &aURL, ulong aSize);
258 bool confirmMountAdditions (const QString &aURL, const QString &aSrc);
259 void warnAboutTooOldAdditions (QWidget *, const QString &, const QString &);
260 void warnAboutOldAdditions (QWidget *, const QString &, const QString &);
261 void warnAboutNewAdditions (QWidget *, const QString &, const QString &);
262
263 void cannotConnectRegister (QWidget *aParent,
264 const QString &aURL,
265 const QString &aReason);
266 void showRegisterResult (QWidget *aParent,
267 const QString &aResult);
268
269 void showUpdateSuccess (QWidget *aParent,
270 const QString &aVersion,
271 const QString &aLink);
272 void showUpdateFailure (QWidget *aParent,
273 const QString &aReason);
274 void showUpdateNotFound (QWidget *aParent);
275
276 bool confirmInputCapture (bool *aAutoConfirmed = NULL);
277 void remindAboutAutoCapture();
278 void remindAboutMouseIntegration (bool aSupportsAbsolute);
279 bool remindAboutPausedVMInput();
280
281 int warnAboutAutoConvertedSettings (const QString &aFormatVersion,
282 const QString &aFileList);
283
284 bool remindAboutInaccessibleMedia();
285
286 bool confirmGoingFullscreen (const QString &aHotKey);
287 bool confirmGoingSeamless (const QString &aHotKey);
288
289 void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP);
290
291 bool remindAboutGuruMeditation (const CConsole &aConsole,
292 const QString &aLogFolder);
293
294 bool confirmVMReset (QWidget *aParent);
295
296 bool confirmHardDisklessMachine (QWidget *aParent);
297
298 void cannotRunInSelectorMode();
299
300 void showRuntimeError (const CConsole &console, bool fatal,
301 const QString &errorID,
302 const QString &errorMsg);
303
304 static QString formatRC (HRESULT aRC);
305
306 static QString formatErrorInfo (const COMErrorInfo &aInfo,
307 HRESULT aWrapperRC = S_OK);
308
309 static QString formatErrorInfo (const CVirtualBoxErrorInfo &aInfo)
310 {
311 return formatErrorInfo (COMErrorInfo (aInfo));
312 }
313
314 static QString formatErrorInfo (const COMBase &aWrapper)
315 {
316 Assert (aWrapper.lastRC() != S_OK);
317 return formatErrorInfo (aWrapper.errorInfo(), aWrapper.lastRC());
318 }
319
320 static QString formatErrorInfo (const COMResult &aRC)
321 {
322 Assert (aRC.rc() != S_OK);
323 return formatErrorInfo (aRC.errorInfo(), aRC.rc());
324 }
325
326public slots:
327
328 void showHelpWebDialog();
329 void showHelpAboutDialog();
330 void showHelpHelpDialog();
331 void resetSuppressedMessages();
332
333private:
334
335 friend VBoxProblemReporter &vboxProblem();
336
337 static QString doFormatErrorInfo (const COMErrorInfo &aInfo,
338 HRESULT aWrapperRC = S_OK);
339};
340
341inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); }
342
343#endif // __VBoxProblemReporter_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