VirtualBox

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

Last change on this file since 253 was 237, checked in by vboxsync, 18 years ago

FE/Qt: Implemented preliminary support for IConsole runtime error notifications in the VM console window.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.3 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxProblemReporter class declaration
5 */
6
7/*
8 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
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 };
46 enum {
47 AutoConfirmed = 0x8000
48 };
49
50 static VBoxProblemReporter &instance();
51
52 bool isValid();
53
54 // helpers
55
56 int message (
57 QWidget *parent, Type type, const QString &msg,
58 const QString &details = QString::null,
59 const char *autoConfirmId = 0,
60 int b1 = 0, int b2 = 0, int b3 = 0,
61 const char *name = 0
62 );
63
64 int message (
65 QWidget *parent, Type type, const QString &msg,
66 const char *autoConfirmId,
67 int b1 = 0, int b2 = 0, int b3 = 0,
68 const char *name = 0
69 ) {
70 return message (parent, type, msg, QString::null, autoConfirmId,
71 b1, b2, b3, name);
72 }
73
74 bool messageYesNo (
75 QWidget *parent, Type type, const QString &msg,
76 const QString &details = QString::null,
77 const char *autoConfirmId = 0,
78 const char *name = 0
79 );
80
81 bool messageYesNo (
82 QWidget *parent, Type type, const QString &msg,
83 const char *autoConfirmId,
84 const char *name = 0
85 ) {
86 return messageYesNo (parent, type, msg, QString::null, autoConfirmId, name);
87 }
88
89 bool showModalProgressDialog (
90 CProgress &aProgress, const QString &aTitle, QWidget *aParent,
91 int aMinDuration = 2000
92 );
93
94 QWidget *mainWindowShown();
95
96 // problem handlers
97
98 void cannotInitCOM (HRESULT rc);
99 void cannotCreateVirtualBox (const CVirtualBox &vbox);
100
101 void cannotLoadGlobalConfig (const CVirtualBox &vbox, const QString &error);
102 void cannotSaveGlobalConfig (const CVirtualBox &vbox);
103 void cannotSetSystemProperties (const CSystemProperties &props);
104
105 void cannotCreateMachine (const CVirtualBox &vbox,
106 QWidget *parent = 0);
107 void cannotCreateMachine (const CVirtualBox &vbox, const CMachine &machine,
108 QWidget *parent = 0);
109 void cannotApplyMachineSettings (const CMachine &machine, const COMResult &res);
110 void cannotSaveMachineSettings (const CMachine &machine,
111 QWidget *parent = 0);
112 void cannotLoadMachineSettings (const CMachine &machine,
113 bool strict = true,
114 QWidget *parent = 0);
115
116 void cannotStartMachine (const CConsole &console);
117 void cannotStartMachine (const CProgress &progress);
118 void cannotPauseMachine (const CConsole &console);
119 void cannotResumeMachine (const CConsole &console);
120 void cannotSaveMachineState (const CConsole &console);
121 void cannotSaveMachineState (const CProgress &progress);
122 void cannotTakeSnapshot (const CConsole &console);
123 void cannotTakeSnapshot (const CProgress &progress);
124 void cannotStopMachine (const CConsole &console);
125 void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);
126 void cannotDiscardSavedState (const CConsole &console);
127
128 void cannotDiscardSnapshot (const CConsole &console, const CSnapshot &snapshot);
129 void cannotDiscardSnapshot (const CProgress &progress, const CSnapshot &snapshot);
130 void cannotDiscardCurrentState (const CConsole &console);
131 void cannotDiscardCurrentState (const CProgress &progress);
132 void cannotDiscardCurrentSnapshotAndState (const CConsole &console);
133 void cannotDiscardCurrentSnapshotAndState (const CProgress &progress);
134
135 void cannotFindMachineByName (const CVirtualBox &vbox, const QString &name);
136
137 bool confirmMachineDeletion (const CMachine &machine);
138 bool confirmDiscardSavedState (const CMachine &machine);
139
140 void sayCannotOverwriteHardDiskImage (QWidget *parent, const QString &src);
141 int confirmHardDiskImageDeletion (QWidget *parent, const QString &src);
142 void cannotDeleteHardDiskImage (QWidget *parent, const CVirtualDiskImage &vdi);
143
144 int confirmHardDiskUnregister (QWidget *parent, const QString &src);
145
146 void cannotCreateHardDiskImage (
147 QWidget *parent, const CVirtualBox &vbox, const QString &src,
148 const CVirtualDiskImage &vdi, const CProgress &progress);
149 void cannotAttachHardDisk (QWidget *parent, const CMachine &m, const QUuid &id,
150 CEnums::DiskControllerType ctl, LONG dev);
151 void cannotDetachHardDisk (QWidget *parent, const CMachine &m,
152 CEnums::DiskControllerType ctl, LONG dev);
153 void cannotRegisterMedia (QWidget *parent, const CVirtualBox &vbox,
154 VBoxDefs::DiskType type, const QString &src);
155 void cannotUnregisterMedia (QWidget *parent, const CVirtualBox &vbox,
156 VBoxDefs::DiskType type, const QString &src);
157
158 void cannotOpenSession (const CSession &session);
159 void cannotOpenSession (const CVirtualBox &vbox, const QUuid &id);
160 void cannotOpenSession (const CVirtualBox &vbox, const CMachine &machine,
161 const CProgress &progress = CProgress());
162
163 void cannotGetMediaAccessibility (const CUnknown &unk);
164
165/// @todo (r=dmik) later
166// void cannotMountMedia (const CUnknown &unk);
167// void cannotUnmountMedia (const CUnknown &unk);
168
169#if defined Q_WS_WIN
170 void cannotCreateHostInterface (const CHost &host, const QString &name,
171 QWidget *parent = 0);
172 void cannotCreateHostInterface (const CProgress &progress, const QString &name,
173 QWidget *parent = 0);
174 void cannotRemoveHostInterface (const CHost &host,
175 const CHostNetworkInterface &iface,
176 QWidget *parent = 0);
177 void cannotRemoveHostInterface (const CProgress &progress,
178 const CHostNetworkInterface &iface,
179 QWidget *parent = 0);
180#endif
181
182 bool confirmReleaseImage (QWidget*, QString);
183
184 bool remindAboutInputCapture();
185 bool remindAboutAutoCapture();
186 bool remindAboutMouseIntegration (bool supportsAbsolute);
187 bool remindAboutPausedVMInput();
188
189 bool remindAboutInaccessibleMedia();
190
191 void remindAboutGoingFullscreen (const QString &hotKey,
192 const QString &hostKey);
193
194 void showRuntimeError (const CConsole &console, bool fatal,
195 const QString &errorID,
196 const QString &errorMsg);
197
198 static QString highlight (const QString &str);
199 static QString formatErrorInfo (const COMErrorInfo &info,
200 HRESULT wrapperRC = S_OK);
201 static QString formatErrorInfo (const CVirtualBoxErrorInfo &info) {
202 return formatErrorInfo (COMErrorInfo (info));
203 }
204 static QString formatErrorInfo (const COMBase &wrapper) {
205 Assert (FAILED (wrapper.lastRC()));
206 return formatErrorInfo (wrapper.errorInfo(), wrapper.lastRC());
207 }
208 static QString formatErrorInfo (const COMResult &rc) {
209 Assert (FAILED (rc.rc()));
210 return formatErrorInfo (rc.errorInfo(), rc.rc());
211 }
212
213public slots:
214
215 void showHelpWebDialog();
216 void showHelpAboutDialog();
217 void resetSuppressedMessages();
218
219private:
220
221 friend VBoxProblemReporter &vboxProblem();
222};
223
224inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); }
225
226#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