3
* VBox frontends: Qt GUI ("VirtualBox"):
4
* VBoxProblemReporter class declaration
8
* Copyright (C) 2006-2008 Sun Microsystems, Inc.
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.
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.
23
#ifndef __VBoxProblemReporter_h__
24
#define __VBoxProblemReporter_h__
27
#include "QIMessageBox.h"
34
// VBoxProblemReporter class
35
////////////////////////////////////////////////////////////////////////////////
38
* The VBoxProblemReporter class is a central place to handle all problem/error
39
* situations that happen during application runtime and require the user's
42
* The role of this class is to describe the problem and/or the cause of the
43
* error to the user and give him the opportunity to select an action (when
46
* Every problem sutiation has its own (correspondingly named) method in this
47
* class that takes a list of arguments necessary to describe the situation and
48
* to provide the appropriate actions. The method then returns the choice to the
51
class VBoxProblemReporter : public QObject
69
AutoConfirmed = 0x8000
72
static VBoxProblemReporter &instance();
78
int message (QWidget *aParent, Type aType, const QString &aMessage,
79
const QString &aDetails = QString::null,
80
const char *aAutoConfirmId = 0,
81
int aButton1 = 0, int aButton2 = 0, int aButton3 = 0,
82
const QString &aText1 = QString::null,
83
const QString &aText2 = QString::null,
84
const QString &aText3 = QString::null) const;
86
int message (QWidget *aParent, Type aType, const QString &aMessage,
87
const char *aAutoConfirmId,
88
int aButton1 = 0, int aButton2 = 0, int aButton3 = 0,
89
const QString &aText1 = QString::null,
90
const QString &aText2 = QString::null,
91
const QString &aText3 = QString::null) const
93
return message (aParent, aType, aMessage, QString::null, aAutoConfirmId,
94
aButton1, aButton2, aButton3, aText1, aText2, aText3);
97
bool messageYesNo (QWidget *aParent, Type aType, const QString &aMessage,
98
const QString &aDetails = QString::null,
99
const char *aAutoConfirmId = 0,
100
const QString &aYesText = QString::null,
101
const QString &aNoText = QString::null) const
103
return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,
104
QIMessageBox::Yes | QIMessageBox::Default,
105
QIMessageBox::No | QIMessageBox::Escape,
107
aYesText, aNoText, QString::null) &
108
QIMessageBox::ButtonMask) == QIMessageBox::Yes;
111
bool messageYesNo (QWidget *aParent, Type aType, const QString &aMessage,
112
const char *aAutoConfirmId,
113
const QString &aYesText = QString::null,
114
const QString &aNoText = QString::null) const
116
return messageYesNo (aParent, aType, aMessage, QString::null,
117
aAutoConfirmId, aYesText, aNoText);
120
bool messageOkCancel (QWidget *aParent, Type aType, const QString &aMessage,
121
const QString &aDetails = QString::null,
122
const char *aAutoConfirmId = 0,
123
const QString &aOkText = QString::null,
124
const QString &aCancelText = QString::null) const
126
return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,
127
QIMessageBox::Ok | QIMessageBox::Default,
128
QIMessageBox::Cancel | QIMessageBox::Escape,
130
aOkText, aCancelText, QString::null) &
131
QIMessageBox::ButtonMask) == QIMessageBox::Ok;
134
bool messageOkCancel (QWidget *aParent, Type aType, const QString &aMessage,
135
const char *aAutoConfirmId,
136
const QString &aOkText = QString::null,
137
const QString &aCancelText = QString::null) const
139
return messageOkCancel (aParent, aType, aMessage, QString::null,
140
aAutoConfirmId, aOkText, aCancelText); }
142
bool showModalProgressDialog (CProgress &aProgress, const QString &aTitle,
143
QWidget *aParent, int aMinDuration = 2000);
145
QWidget *mainWindowShown() const;
147
/* Generic problem handlers */
148
bool askForOverridingFile (const QString& aPath, QWidget *aParent = NULL) const;
149
bool askForOverridingFiles (const QVector<QString>& aPaths, QWidget *aParent = NULL) const;
150
bool askForOverridingFileIfExists (const QString& path, QWidget *aParent = NULL) const;
151
bool askForOverridingFilesIfExists (const QVector<QString>& aPaths, QWidget *aParent = NULL) const;
153
void cannotDeleteFile (const QString& path, QWidget *aParent = NULL) const;
155
/* Special problem handlers */
156
void showBETAWarning();
159
void cannotFindLicenseFiles (const QString &aPath);
160
void cannotOpenLicenseFile (QWidget *aParent, const QString &aPath);
163
void cannotOpenURL (const QString &aURL);
164
void cannotCopyFile (const QString &aSrc, const QString &aDst, int aVRC);
166
void cannotFindLanguage (const QString &aLangID, const QString &aNlsPath);
167
void cannotLoadLanguage (const QString &aLangFile);
169
void cannotInitCOM (HRESULT rc);
170
void cannotCreateVirtualBox (const CVirtualBox &vbox);
172
void cannotSaveGlobalSettings (const CVirtualBox &vbox,
173
QWidget *parent = 0);
175
void cannotLoadGlobalConfig (const CVirtualBox &vbox, const QString &error);
176
void cannotSaveGlobalConfig (const CVirtualBox &vbox);
177
void cannotSetSystemProperties (const CSystemProperties &props);
178
void cannotAccessUSB (const COMBaseWithEI &aObj);
180
void cannotCreateMachine (const CVirtualBox &vbox,
181
QWidget *parent = 0);
182
void cannotCreateMachine (const CVirtualBox &vbox, const CMachine &machine,
183
QWidget *parent = 0);
184
void cannotApplyMachineSettings (const CMachine &machine, const COMResult &res);
185
void cannotSaveMachineSettings (const CMachine &machine,
186
QWidget *parent = 0);
187
void cannotLoadMachineSettings (const CMachine &machine,
189
QWidget *parent = 0);
191
void cannotStartMachine (const CConsole &console);
192
void cannotStartMachine (const CProgress &progress);
193
void cannotPauseMachine (const CConsole &console);
194
void cannotResumeMachine (const CConsole &console);
195
void cannotACPIShutdownMachine (const CConsole &console);
196
void cannotSaveMachineState (const CConsole &console);
197
void cannotSaveMachineState (const CProgress &progress);
198
void cannotTakeSnapshot (const CConsole &console);
199
void cannotTakeSnapshot (const CProgress &progress);
200
void cannotStopMachine (const CConsole &console);
201
void cannotStopMachine (const CProgress &progress);
202
void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);
203
void cannotDiscardSavedState (const CConsole &console);
205
void cannotSendACPIToMachine();
206
bool warnAboutVirtNotEnabled64BitsGuest();
207
bool warnAboutVirtNotEnabledGuestRequired();
209
void cannotSetSnapshotFolder (const CMachine &aMachine, const QString &aPath);
210
bool askAboutSnapshotAndStateDiscarding();
211
void cannotDiscardSnapshot (const CConsole &aConsole,
212
const QString &aSnapshotName);
213
void cannotDiscardSnapshot (const CProgress &aProgress,
214
const QString &aSnapshotName);
215
void cannotDiscardCurrentState (const CConsole &console);
216
void cannotDiscardCurrentState (const CProgress &progress);
217
void cannotDiscardCurrentSnapshotAndState (const CConsole &console);
218
void cannotDiscardCurrentSnapshotAndState (const CProgress &progress);
220
void cannotFindMachineByName (const CVirtualBox &vbox, const QString &name);
222
void cannotEnterSeamlessMode (ULONG aWidth, ULONG aHeight,
223
ULONG aBpp, ULONG64 aMinVRAM);
224
int cannotEnterFullscreenMode (ULONG aWidth, ULONG aHeight,
225
ULONG aBpp, ULONG64 aMinVRAM);
227
bool confirmMachineDeletion (const CMachine &machine);
228
bool confirmDiscardSavedState (const CMachine &machine);
230
bool confirmReleaseMedium (QWidget *aParent, const VBoxMedium &aMedium,
231
const QString &aUsage);
233
bool confirmRemoveMedium (QWidget *aParent, const VBoxMedium &aMedium);
235
void sayCannotOverwriteHardDiskStorage (QWidget *aParent,
236
const QString &aLocation);
237
int confirmDeleteHardDiskStorage (QWidget *aParent,
238
const QString &aLocation);
239
void cannotDeleteHardDiskStorage (QWidget *aParent, const CHardDisk &aHD,
240
const CProgress &aProgress);
242
int confirmDetachAddControllerSlots (QWidget *aParent) const;
243
int confirmChangeAddControllerSlots (QWidget *aParent) const;
244
int confirmRunNewHDWzdOrVDM (QWidget* aParent);
246
void cannotCreateHardDiskStorage (QWidget *aParent, const CVirtualBox &aVBox,
247
const QString &aLocaiton,
248
const CHardDisk &aHD,
249
const CProgress &aProgress);
250
void cannotAttachHardDisk (QWidget *aParent, const CMachine &aMachine,
251
const QString &aLocation, KStorageBus aBus,
252
LONG aChannel, LONG aDevice);
253
void cannotDetachHardDisk (QWidget *aParent, const CMachine &aMachine,
254
const QString &aLocation, KStorageBus aBus,
255
LONG aChannel, LONG aDevice);
257
void cannotMountMedium (QWidget *aParent, const CMachine &aMachine,
258
const VBoxMedium &aMedium, const COMResult &aResult);
259
void cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine,
260
const VBoxMedium &aMedium, const COMResult &aResult);
261
void cannotOpenMedium (QWidget *aParent, const CVirtualBox &aVBox,
262
VBoxDefs::MediaType aType, const QString &aLocation);
263
void cannotCloseMedium (QWidget *aParent, const VBoxMedium &aMedium,
264
const COMResult &aResult);
265
void cannotEjectDrive();
267
void cannotOpenSession (const CSession &session);
268
void cannotOpenSession (const CVirtualBox &vbox, const CMachine &machine,
269
const CProgress &progress = CProgress());
271
void cannotGetMediaAccessibility (const VBoxMedium &aMedium);
273
int confirmDeletingHostInterface (const QString &aName, QWidget *aParent = 0);
274
void cannotCreateHostInterface (const CHost &aHost, QWidget *aParent = 0);
275
void cannotCreateHostInterface (const CProgress &aProgress, QWidget *aParent = 0);
276
void cannotRemoveHostInterface (const CHost &aHost,
277
const CHostNetworkInterface &aIface,
278
QWidget *aParent = 0);
279
void cannotRemoveHostInterface (const CProgress &aProgress,
280
const CHostNetworkInterface &aIface,
281
QWidget *aParent = 0);
283
void cannotAttachUSBDevice (const CConsole &console, const QString &device);
284
void cannotAttachUSBDevice (const CConsole &console, const QString &device,
285
const CVirtualBoxErrorInfo &error);
286
void cannotDetachUSBDevice (const CConsole &console, const QString &device);
287
void cannotDetachUSBDevice (const CConsole &console, const QString &device,
288
const CVirtualBoxErrorInfo &error);
290
void cannotCreateSharedFolder (QWidget *, const CMachine &,
291
const QString &, const QString &);
292
void cannotRemoveSharedFolder (QWidget *, const CMachine &,
293
const QString &, const QString &);
294
void cannotCreateSharedFolder (QWidget *, const CConsole &,
295
const QString &, const QString &);
296
void cannotRemoveSharedFolder (QWidget *, const CConsole &,
297
const QString &, const QString &);
299
int cannotFindGuestAdditions (const QString &aSrc1, const QString &aSrc2);
300
void cannotDownloadGuestAdditions (const QString &aURL,
301
const QString &aReason);
302
bool confirmDownloadAdditions (const QString &aURL, ulong aSize);
303
bool confirmMountAdditions (const QString &aURL, const QString &aSrc);
304
void warnAboutTooOldAdditions (QWidget *, const QString &, const QString &);
305
void warnAboutOldAdditions (QWidget *, const QString &, const QString &);
306
void warnAboutNewAdditions (QWidget *, const QString &, const QString &);
308
void cannotConnectRegister (QWidget *aParent,
310
const QString &aReason);
311
void showRegisterResult (QWidget *aParent,
312
const QString &aResult);
314
void showUpdateSuccess (QWidget *aParent,
315
const QString &aVersion,
316
const QString &aLink);
317
void showUpdateFailure (QWidget *aParent,
318
const QString &aReason);
319
void showUpdateNotFound (QWidget *aParent);
321
bool confirmInputCapture (bool *aAutoConfirmed = NULL);
322
void remindAboutAutoCapture();
323
void remindAboutMouseIntegration (bool aSupportsAbsolute);
324
bool remindAboutPausedVMInput();
326
int warnAboutAutoConvertedSettings (const QString &aFormatVersion,
327
const QString &aFileList,
330
bool remindAboutInaccessibleMedia();
332
bool confirmGoingFullscreen (const QString &aHotKey);
333
bool confirmGoingSeamless (const QString &aHotKey);
335
void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP);
337
bool remindAboutGuruMeditation (const CConsole &aConsole,
338
const QString &aLogFolder);
340
bool confirmVMReset (QWidget *aParent);
342
bool confirmHardDisklessMachine (QWidget *aParent);
344
void cannotRunInSelectorMode();
346
void cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL) const;
347
void cannotImportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const;
349
void cannotCheckFiles (const CProgress &aProgress, QWidget *aParent = NULL) const;
350
void cannotRemoveFiles (const CProgress &aProgress, QWidget *aParent = NULL) const;
352
void cannotExportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL) const;
353
void cannotExportAppliance (const CMachine &aMachine, CAppliance *aAppliance, QWidget *aParent = NULL) const;
354
void cannotExportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const;
356
void showRuntimeError (const CConsole &console, bool fatal,
357
const QString &errorID,
358
const QString &errorMsg) const;
360
static QString toAccusative (VBoxDefs::MediaType aType);
362
static QString formatRC (HRESULT aRC);
364
static QString formatErrorInfo (const COMErrorInfo &aInfo,
365
HRESULT aWrapperRC = S_OK);
367
static QString formatErrorInfo (const CVirtualBoxErrorInfo &aInfo)
369
return formatErrorInfo (COMErrorInfo (aInfo));
372
static QString formatErrorInfo (const COMBaseWithEI &aWrapper)
374
Assert (aWrapper.lastRC() != S_OK);
375
return formatErrorInfo (aWrapper.errorInfo(), aWrapper.lastRC());
378
static QString formatErrorInfo (const COMResult &aRC)
380
Assert (aRC.rc() != S_OK);
381
return formatErrorInfo (aRC.errorInfo(), aRC.rc());
386
void showHelpWebDialog();
387
void showHelpAboutDialog();
388
void showHelpHelpDialog();
389
void resetSuppressedMessages();
393
friend VBoxProblemReporter &vboxProblem();
395
static QString doFormatErrorInfo (const COMErrorInfo &aInfo,
396
HRESULT aWrapperRC = S_OK);
400
* Shortcut to the static VBoxProblemReporter::instance() method, for
403
inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); }
405
#endif // __VBoxProblemReporter_h__