VirtualBox

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

最後變更 在這個檔案從13374是 13374,由 vboxsync 提交於 16 年 前

Main, FE/Qt: Added IProgress::PowerDownAsync() (#3242).

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

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