VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h@ 14707

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

Ported s2 branch (r37120:38456).

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