VirtualBox

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

Last change on this file since 8337 was 8337, checked in by vboxsync, 17 years ago

Fix check of seamless VRAM requirements. Avoided incorrect duplicate computation of required size and added rounding. Both qt3 and qt4 GUIs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.6 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, ULONG aBpp, ULONG64 aMinVRAM);
185
186 bool confirmMachineDeletion (const CMachine &machine);
187 bool confirmDiscardSavedState (const CMachine &machine);
188
189 bool confirmReleaseImage (QWidget *parent, const QString &usage);
190
191 void sayCannotOverwriteHardDiskImage (QWidget *parent, const QString &src);
192 int confirmHardDiskImageDeletion (QWidget *parent, const QString &src);
193 void cannotDeleteHardDiskImage (QWidget *parent, const CVirtualDiskImage &vdi);
194
195 bool confirmHardDiskUnregister (QWidget *parent, const QString &src);
196
197 void cannotCreateHardDiskImage (
198 QWidget *parent, const CVirtualBox &vbox, const QString &src,
199 const CVirtualDiskImage &vdi, const CProgress &progress);
200 void cannotAttachHardDisk (QWidget *parent, const CMachine &m, const QUuid &id,
201 KStorageBus bus, LONG channel, LONG dev);
202 void cannotDetachHardDisk (QWidget *parent, const CMachine &m,
203 KStorageBus bus, LONG channel, LONG dev);
204 void cannotRegisterMedia (QWidget *parent, const CVirtualBox &vbox,
205 VBoxDefs::DiskType type, const QString &src);
206 void cannotUnregisterMedia (QWidget *parent, const CVirtualBox &vbox,
207 VBoxDefs::DiskType type, const QString &src);
208
209 void cannotOpenSession (const CSession &session);
210 void cannotOpenSession (const CVirtualBox &vbox, const CMachine &machine,
211 const CProgress &progress = CProgress());
212
213 void cannotGetMediaAccessibility (const CUnknown &unk);
214
215/// @todo (r=dmik) later
216// void cannotMountMedia (const CUnknown &unk);
217// void cannotUnmountMedia (const CUnknown &unk);
218
219#if defined Q_WS_WIN
220 void cannotCreateHostInterface (const CHost &host, const QString &name,
221 QWidget *parent = 0);
222 void cannotCreateHostInterface (const CProgress &progress, const QString &name,
223 QWidget *parent = 0);
224 void cannotRemoveHostInterface (const CHost &host,
225 const CHostNetworkInterface &iface,
226 QWidget *parent = 0);
227 void cannotRemoveHostInterface (const CProgress &progress,
228 const CHostNetworkInterface &iface,
229 QWidget *parent = 0);
230#endif
231
232 void cannotAttachUSBDevice (const CConsole &console, const QString &device);
233 void cannotAttachUSBDevice (const CConsole &console, const QString &device,
234 const CVirtualBoxErrorInfo &error);
235 void cannotDetachUSBDevice (const CConsole &console, const QString &device);
236 void cannotDetachUSBDevice (const CConsole &console, const QString &device,
237 const CVirtualBoxErrorInfo &error);
238
239 void cannotCreateSharedFolder (QWidget *, const CMachine &,
240 const QString &, const QString &);
241 void cannotRemoveSharedFolder (QWidget *, const CMachine &,
242 const QString &, const QString &);
243 void cannotCreateSharedFolder (QWidget *, const CConsole &,
244 const QString &, const QString &);
245 void cannotRemoveSharedFolder (QWidget *, const CConsole &,
246 const QString &, const QString &);
247
248 int cannotFindGuestAdditions (const QString &aSrc1, const QString &aSrc2);
249 void cannotDownloadGuestAdditions (const QString &aURL,
250 const QString &aReason);
251 bool confirmDownloadAdditions (const QString &aURL, ulong aSize);
252 bool confirmMountAdditions (const QString &aURL, const QString &aSrc);
253 void warnAboutTooOldAdditions (QWidget *, const QString &, const QString &);
254 void warnAboutOldAdditions (QWidget *, const QString &, const QString &);
255 void warnAboutNewAdditions (QWidget *, const QString &, const QString &);
256
257 void cannotConnectRegister (QWidget *aParent,
258 const QString &aURL,
259 const QString &aReason);
260 void showRegisterResult (QWidget *aParent,
261 const QString &aResult);
262
263 bool confirmInputCapture (bool *aAutoConfirmed = NULL);
264 void remindAboutAutoCapture();
265 void remindAboutMouseIntegration (bool aSupportsAbsolute);
266 bool remindAboutPausedVMInput();
267
268 int warnAboutAutoConvertedSettings (const QString &aFormatVersion,
269 const QString &aFileList);
270
271 bool remindAboutInaccessibleMedia();
272
273 bool confirmGoingFullscreen (const QString &aHotKey);
274 bool confirmGoingSeamless (const QString &aHotKey);
275
276 void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP);
277
278 bool remindAboutGuruMeditation (const CConsole &aConsole,
279 const QString &aLogFolder);
280
281 bool confirmVMReset (QWidget *aParent);
282
283 bool confirmHardDisklessMachine (QWidget *aParent);
284
285 void cannotRunInSelectorMode();
286
287 void showRuntimeError (const CConsole &console, bool fatal,
288 const QString &errorID,
289 const QString &errorMsg);
290
291 static QString formatErrorInfo (const COMErrorInfo &aInfo,
292 HRESULT aWrapperRC = S_OK);
293
294 static QString formatErrorInfo (const CVirtualBoxErrorInfo &aInfo)
295 {
296 return formatErrorInfo (COMErrorInfo (aInfo));
297 }
298
299 static QString formatErrorInfo (const COMBase &aWrapper)
300 {
301 Assert (aWrapper.lastRC() != S_OK);
302 return formatErrorInfo (aWrapper.errorInfo(), aWrapper.lastRC());
303 }
304
305 static QString formatErrorInfo (const COMResult &aRC)
306 {
307 Assert (aRC.rc() != S_OK);
308 return formatErrorInfo (aRC.errorInfo(), aRC.rc());
309 }
310
311public slots:
312
313 void showHelpWebDialog();
314 void showHelpAboutDialog();
315 void showHelpHelpDialog();
316 void resetSuppressedMessages();
317
318private:
319
320 friend VBoxProblemReporter &vboxProblem();
321
322 static QString doFormatErrorInfo (const COMErrorInfo &aInfo,
323 HRESULT aWrapperRC = S_OK);
324};
325
326inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); }
327
328#endif // __VBoxProblemReporter_h__
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette