1 | /* $Id: VBoxProblemReporter.cpp 34787 2010-12-07 14:51:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
5 | * VBoxProblemReporter class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | */
|
---|
19 |
|
---|
20 | /* Global includes */
|
---|
21 | #include <QDir>
|
---|
22 | #include <QDesktopWidget>
|
---|
23 | #include <QFileInfo>
|
---|
24 | #include <QThread>
|
---|
25 | #ifdef Q_WS_MAC
|
---|
26 | # include <QPushButton>
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #include <iprt/err.h>
|
---|
30 | #include <iprt/param.h>
|
---|
31 | #include <iprt/path.h>
|
---|
32 |
|
---|
33 | /* Local includes */
|
---|
34 | #include "VBoxProblemReporter.h"
|
---|
35 | #include "VBoxGlobal.h"
|
---|
36 | #include "VBoxSelectorWnd.h"
|
---|
37 | #include "UIProgressDialog.h"
|
---|
38 | #include "UIDownloaderUserManual.h"
|
---|
39 | #include "UIMachine.h"
|
---|
40 | #include "VBoxAboutDlg.h"
|
---|
41 | #include "QIHotKeyEdit.h"
|
---|
42 | #ifdef Q_WS_MAC
|
---|
43 | # include "VBoxUtils-darwin.h"
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #if defined (Q_WS_WIN32)
|
---|
47 | # include <Htmlhelp.h>
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | bool VBoxProblemReporter::isAnyWarningShown()
|
---|
51 | {
|
---|
52 | /* Check if at least one warning is alive!
|
---|
53 | * All warnings are stored in m_warnings list as live pointers,
|
---|
54 | * this is why if some warning was deleted from another place,
|
---|
55 | * its pointer here will equal NULL... */
|
---|
56 | for (int i = 0; i < m_warnings.size(); ++i)
|
---|
57 | if (m_warnings[i])
|
---|
58 | return true;
|
---|
59 | return false;
|
---|
60 | }
|
---|
61 |
|
---|
62 | bool VBoxProblemReporter::isAlreadyShown(const QString &strWarningName) const
|
---|
63 | {
|
---|
64 | return m_shownWarnings.contains(strWarningName);
|
---|
65 | }
|
---|
66 |
|
---|
67 | void VBoxProblemReporter::setShownStatus(const QString &strWarningName)
|
---|
68 | {
|
---|
69 | if (!m_shownWarnings.contains(strWarningName))
|
---|
70 | m_shownWarnings.append(strWarningName);
|
---|
71 | }
|
---|
72 |
|
---|
73 | void VBoxProblemReporter::clearShownStatus(const QString &strWarningName)
|
---|
74 | {
|
---|
75 | if (m_shownWarnings.contains(strWarningName))
|
---|
76 | m_shownWarnings.removeAll(strWarningName);
|
---|
77 | }
|
---|
78 |
|
---|
79 | void VBoxProblemReporter::closeAllWarnings()
|
---|
80 | {
|
---|
81 | /* Broadcast signal to perform emergent
|
---|
82 | * closing + deleting all the opened warnings. */
|
---|
83 | emit sigToCloseAllWarnings();
|
---|
84 | }
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Shows a message box of the given type with the given text and with buttons
|
---|
88 | * according to arguments b1, b2 and b3 (in the same way as QMessageBox does
|
---|
89 | * it), and returns the user's choice.
|
---|
90 | *
|
---|
91 | * When all button arguments are zero, a single 'Ok' button is shown.
|
---|
92 | *
|
---|
93 | * If aAutoConfirmId is not null, then the message box will contain a
|
---|
94 | * checkbox "Don't show this message again" below the message text and its
|
---|
95 | * state will be saved in the global config. When the checkbox is in the
|
---|
96 | * checked state, this method doesn't actually show the message box but
|
---|
97 | * returns immediately. The return value in this case is the same as if the
|
---|
98 | * user has pressed the Enter key or the default button, but with
|
---|
99 | * AutoConfirmed bit set (AutoConfirmed alone is returned when no default
|
---|
100 | * button is defined in button arguments).
|
---|
101 | *
|
---|
102 | * @param aParent
|
---|
103 | * Parent widget or 0 to use the desktop as the parent. Also,
|
---|
104 | * #mainWindowShown can be used to determine the currently shown VBox
|
---|
105 | * main window (Selector or Console).
|
---|
106 | * @param aType
|
---|
107 | * One of values of the Type enum, that defines the message box
|
---|
108 | * title and icon.
|
---|
109 | * @param aMessage
|
---|
110 | * Message text to display (can contain simple Qt-html tags).
|
---|
111 | * @param aDetails
|
---|
112 | * Detailed message description displayed under the main message text using
|
---|
113 | * QTextEdit (that provides rich text support and scrollbars when necessary).
|
---|
114 | * If equals to QString::null, no details text box is shown.
|
---|
115 | * @param aAutoConfirmId
|
---|
116 | * ID used to save the auto confirmation state across calls. If null,
|
---|
117 | * the auto confirmation feature is turned off (and no checkbox is shown)
|
---|
118 | * @param aButton1
|
---|
119 | * First button code or 0, see QIMessageBox for a list of codes.
|
---|
120 | * @param aButton2
|
---|
121 | * Second button code or 0, see QIMessageBox for a list of codes.
|
---|
122 | * @param aButton3
|
---|
123 | * Third button code or 0, see QIMessageBox for a list of codes.
|
---|
124 | * @param aText1
|
---|
125 | * Optional custom text for the first button.
|
---|
126 | * @param aText2
|
---|
127 | * Optional custom text for the second button.
|
---|
128 | * @param aText3
|
---|
129 | * Optional custom text for the third button.
|
---|
130 | *
|
---|
131 | * @return
|
---|
132 | * code of the button pressed by the user
|
---|
133 | */
|
---|
134 | int VBoxProblemReporter::message (QWidget *aParent, Type aType, const QString &aMessage,
|
---|
135 | const QString &aDetails /* = QString::null */,
|
---|
136 | const char *aAutoConfirmId /* = 0 */,
|
---|
137 | int aButton1 /* = 0 */, int aButton2 /* = 0 */,
|
---|
138 | int aButton3 /* = 0 */,
|
---|
139 | const QString &aText1 /* = QString::null */,
|
---|
140 | const QString &aText2 /* = QString::null */,
|
---|
141 | const QString &aText3 /* = QString::null */) const
|
---|
142 | {
|
---|
143 | if (aButton1 == 0 && aButton2 == 0 && aButton3 == 0)
|
---|
144 | aButton1 = QIMessageBox::Ok | QIMessageBox::Default;
|
---|
145 |
|
---|
146 | CVirtualBox vbox;
|
---|
147 | QStringList msgs;
|
---|
148 |
|
---|
149 | if (aAutoConfirmId)
|
---|
150 | {
|
---|
151 | vbox = vboxGlobal().virtualBox();
|
---|
152 | msgs = vbox.GetExtraData (VBoxDefs::GUI_SuppressMessages).split (',');
|
---|
153 | if (msgs.contains (aAutoConfirmId)) {
|
---|
154 | int rc = AutoConfirmed;
|
---|
155 | if (aButton1 & QIMessageBox::Default)
|
---|
156 | rc |= (aButton1 & QIMessageBox::ButtonMask);
|
---|
157 | if (aButton2 & QIMessageBox::Default)
|
---|
158 | rc |= (aButton2 & QIMessageBox::ButtonMask);
|
---|
159 | if (aButton3 & QIMessageBox::Default)
|
---|
160 | rc |= (aButton3 & QIMessageBox::ButtonMask);
|
---|
161 | return rc;
|
---|
162 | }
|
---|
163 | }
|
---|
164 |
|
---|
165 | QString title;
|
---|
166 | QIMessageBox::Icon icon;
|
---|
167 |
|
---|
168 | switch (aType)
|
---|
169 | {
|
---|
170 | default:
|
---|
171 | case Info:
|
---|
172 | title = tr ("VirtualBox - Information", "msg box title");
|
---|
173 | icon = QIMessageBox::Information;
|
---|
174 | break;
|
---|
175 | case Question:
|
---|
176 | title = tr ("VirtualBox - Question", "msg box title");
|
---|
177 | icon = QIMessageBox::Question;
|
---|
178 | break;
|
---|
179 | case Warning:
|
---|
180 | title = tr ("VirtualBox - Warning", "msg box title");
|
---|
181 | icon = QIMessageBox::Warning;
|
---|
182 | break;
|
---|
183 | case Error:
|
---|
184 | title = tr ("VirtualBox - Error", "msg box title");
|
---|
185 | icon = QIMessageBox::Critical;
|
---|
186 | break;
|
---|
187 | case Critical:
|
---|
188 | title = tr ("VirtualBox - Critical Error", "msg box title");
|
---|
189 | icon = QIMessageBox::Critical;
|
---|
190 | break;
|
---|
191 | case GuruMeditation:
|
---|
192 | title = "VirtualBox - Guru Meditation"; /* don't translate this */
|
---|
193 | icon = QIMessageBox::GuruMeditation;
|
---|
194 | break;
|
---|
195 | }
|
---|
196 |
|
---|
197 | QPointer<QIMessageBox> box = new QIMessageBox (title, aMessage, icon, aButton1, aButton2,
|
---|
198 | aButton3, aParent, aAutoConfirmId);
|
---|
199 | connect(this, SIGNAL(sigToCloseAllWarnings()), box, SLOT(deleteLater()));
|
---|
200 |
|
---|
201 | if (!aText1.isNull())
|
---|
202 | box->setButtonText (0, aText1);
|
---|
203 | if (!aText2.isNull())
|
---|
204 | box->setButtonText (1, aText2);
|
---|
205 | if (!aText3.isNull())
|
---|
206 | box->setButtonText (2, aText3);
|
---|
207 |
|
---|
208 | if (!aDetails.isEmpty())
|
---|
209 | box->setDetailsText (aDetails);
|
---|
210 |
|
---|
211 | if (aAutoConfirmId)
|
---|
212 | {
|
---|
213 | box->setFlagText (tr ("Do not show this message again", "msg box flag"));
|
---|
214 | box->setFlagChecked (false);
|
---|
215 | }
|
---|
216 |
|
---|
217 | m_warnings << box;
|
---|
218 | int rc = box->exec();
|
---|
219 | if (box && m_warnings.contains(box))
|
---|
220 | m_warnings.removeAll(box);
|
---|
221 |
|
---|
222 | if (aAutoConfirmId)
|
---|
223 | {
|
---|
224 | if (box && box->isFlagChecked())
|
---|
225 | {
|
---|
226 | msgs << aAutoConfirmId;
|
---|
227 | vbox.SetExtraData (VBoxDefs::GUI_SuppressMessages, msgs.join (","));
|
---|
228 | }
|
---|
229 | }
|
---|
230 |
|
---|
231 | if (box)
|
---|
232 | delete box;
|
---|
233 |
|
---|
234 | return rc;
|
---|
235 | }
|
---|
236 |
|
---|
237 | /** @fn message (QWidget *, Type, const QString &, const char *, int, int,
|
---|
238 | * int, const QString &, const QString &, const QString &)
|
---|
239 | *
|
---|
240 | * A shortcut to #message() that doesn't require to specify the details
|
---|
241 | * text (QString::null is assumed).
|
---|
242 | */
|
---|
243 |
|
---|
244 | /** @fn messageYesNo (QWidget *, Type, const QString &, const QString &, const char *)
|
---|
245 | *
|
---|
246 | * A shortcut to #message() that shows 'Yes' and 'No' buttons ('Yes' is the
|
---|
247 | * default) and returns true when the user selects Yes.
|
---|
248 | */
|
---|
249 |
|
---|
250 | /** @fn messageYesNo (QWidget *, Type, const QString &, const char *)
|
---|
251 | *
|
---|
252 | * A shortcut to #messageYesNo() that doesn't require to specify the details
|
---|
253 | * text (QString::null is assumed).
|
---|
254 | */
|
---|
255 |
|
---|
256 | /**
|
---|
257 | * Shows a modal progress dialog using a CProgress object passed as an
|
---|
258 | * argument to track the progress.
|
---|
259 | *
|
---|
260 | * @param aProgress progress object to track
|
---|
261 | * @param aTitle title prefix
|
---|
262 | * @param aParent parent widget
|
---|
263 | * @param aMinDuration time (ms) that must pass before the dialog appears
|
---|
264 | */
|
---|
265 | bool VBoxProblemReporter::showModalProgressDialog(CProgress &progress, const QString &strTitle, const QString &strImage /* = "" */, QWidget *pParent /* = 0 */, bool fSheetOnDarwin /* = false */, int cMinDuration /* = 2000 */)
|
---|
266 | {
|
---|
267 | QPixmap *pPixmap = 0;
|
---|
268 | if (!strImage.isEmpty())
|
---|
269 | pPixmap = new QPixmap(strImage);
|
---|
270 |
|
---|
271 | UIProgressDialog progressDlg(progress, strTitle, pPixmap, fSheetOnDarwin, cMinDuration, pParent ? pParent : mainWindowShown());
|
---|
272 | /* Run the dialog with the 350 ms refresh interval. */
|
---|
273 | progressDlg.run(350);
|
---|
274 |
|
---|
275 | if (pPixmap)
|
---|
276 | delete pPixmap;
|
---|
277 |
|
---|
278 | return true;
|
---|
279 | }
|
---|
280 |
|
---|
281 | /**
|
---|
282 | * Returns what main window (VM selector or main VM window) is now shown, or
|
---|
283 | * zero if none of them. Main VM window takes precedence.
|
---|
284 | */
|
---|
285 | QWidget* VBoxProblemReporter::mainWindowShown() const
|
---|
286 | {
|
---|
287 | /* It may happen that this method is called during VBoxGlobal
|
---|
288 | * initialization or even after it failed (for example, to show some
|
---|
289 | * error message). Return no main window in this case: */
|
---|
290 | if (!vboxGlobal().isValid())
|
---|
291 | return 0;
|
---|
292 |
|
---|
293 | if (vboxGlobal().isVMConsoleProcess())
|
---|
294 | {
|
---|
295 | if (vboxGlobal().vmWindow() && vboxGlobal().vmWindow()->isVisible()) /* VM window is visible */
|
---|
296 | return vboxGlobal().vmWindow(); /* return that window */
|
---|
297 | }
|
---|
298 | else
|
---|
299 | {
|
---|
300 | if (vboxGlobal().selectorWnd().isVisible()) /* VM selector is visible */
|
---|
301 | return &vboxGlobal().selectorWnd(); /* return that window */
|
---|
302 | }
|
---|
303 |
|
---|
304 | return 0;
|
---|
305 | }
|
---|
306 |
|
---|
307 | /**
|
---|
308 | * Returns main machine window is now shown, or zero if none of them.
|
---|
309 | */
|
---|
310 | QWidget* VBoxProblemReporter::mainMachineWindowShown() const
|
---|
311 | {
|
---|
312 | /* It may happen that this method is called during VBoxGlobal
|
---|
313 | * initialization or even after it failed (for example, to show some
|
---|
314 | * error message). Return no main window in this case: */
|
---|
315 | if (!vboxGlobal().isValid())
|
---|
316 | return 0;
|
---|
317 |
|
---|
318 | if (vboxGlobal().vmWindow() && vboxGlobal().vmWindow()->isVisible()) /* VM window is visible */
|
---|
319 | return vboxGlobal().vmWindow(); /* return that window */
|
---|
320 |
|
---|
321 | return 0;
|
---|
322 | }
|
---|
323 |
|
---|
324 | bool VBoxProblemReporter::askForOverridingFile (const QString& aPath, QWidget *aParent /* = NULL */) const
|
---|
325 | {
|
---|
326 | return messageYesNo (aParent, Question, tr ("A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.").arg (aPath));
|
---|
327 | }
|
---|
328 |
|
---|
329 | bool VBoxProblemReporter::askForOverridingFiles (const QVector<QString>& aPaths, QWidget *aParent /* = NULL */) const
|
---|
330 | {
|
---|
331 | if (aPaths.size() == 1)
|
---|
332 | /* If it is only one file use the single question versions above */
|
---|
333 | return askForOverridingFile (aPaths.at (0), aParent);
|
---|
334 | else if (aPaths.size() > 1)
|
---|
335 | return messageYesNo (aParent, Question, tr ("The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.").arg (QStringList(aPaths.toList()).join ("<br />")));
|
---|
336 | else
|
---|
337 | return true;
|
---|
338 | }
|
---|
339 |
|
---|
340 | bool VBoxProblemReporter::askForOverridingFileIfExists (const QString& aPath, QWidget *aParent /* = NULL */) const
|
---|
341 | {
|
---|
342 | QFileInfo fi (aPath);
|
---|
343 | if (fi.exists())
|
---|
344 | return askForOverridingFile (aPath, aParent);
|
---|
345 | else
|
---|
346 | return true;
|
---|
347 | }
|
---|
348 |
|
---|
349 | bool VBoxProblemReporter::askForOverridingFilesIfExists (const QVector<QString>& aPaths, QWidget *aParent /* = NULL */) const
|
---|
350 | {
|
---|
351 | QVector<QString> existingFiles;
|
---|
352 | foreach (const QString &file, aPaths)
|
---|
353 | {
|
---|
354 | QFileInfo fi (file);
|
---|
355 | if (fi.exists())
|
---|
356 | existingFiles << fi.absoluteFilePath();
|
---|
357 | }
|
---|
358 | if (existingFiles.size() == 1)
|
---|
359 | /* If it is only one file use the single question versions above */
|
---|
360 | return askForOverridingFileIfExists (existingFiles.at (0), aParent);
|
---|
361 | else if (existingFiles.size() > 1)
|
---|
362 | return askForOverridingFiles (existingFiles, aParent);
|
---|
363 | else
|
---|
364 | return true;
|
---|
365 | }
|
---|
366 |
|
---|
367 | void VBoxProblemReporter::checkForMountedWrongUSB() const
|
---|
368 | {
|
---|
369 | #ifdef RT_OS_LINUX
|
---|
370 | QFile file ("/proc/mounts");
|
---|
371 | if (file.exists() && file.open (QIODevice::ReadOnly | QIODevice::Text))
|
---|
372 | {
|
---|
373 | QStringList contents;
|
---|
374 | for (;;)
|
---|
375 | {
|
---|
376 | QByteArray line = file.readLine();
|
---|
377 | if (line.isEmpty())
|
---|
378 | break;
|
---|
379 | contents << line;
|
---|
380 | }
|
---|
381 | QStringList grep1 (contents.filter ("/sys/bus/usb/drivers"));
|
---|
382 | QStringList grep2 (grep1.filter ("usbfs"));
|
---|
383 | if (!grep2.isEmpty())
|
---|
384 | message (mainWindowShown(), Warning,
|
---|
385 | tr ("You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. "
|
---|
386 | "We strongly recommend that you change this, as it is a severe mis-configuration of "
|
---|
387 | "your system which could cause USB devices to fail in unexpected ways."),
|
---|
388 | "checkForMountedWrongUSB");
|
---|
389 | }
|
---|
390 | #endif
|
---|
391 | }
|
---|
392 |
|
---|
393 | void VBoxProblemReporter::showBETAWarning()
|
---|
394 | {
|
---|
395 | message
|
---|
396 | (0, Warning,
|
---|
397 | tr ("You are running a prerelease version of VirtualBox. "
|
---|
398 | "This version is not suitable for production use."));
|
---|
399 | }
|
---|
400 |
|
---|
401 | void VBoxProblemReporter::showBEBWarning()
|
---|
402 | {
|
---|
403 | message
|
---|
404 | (0, Warning,
|
---|
405 | tr ("You are running an EXPERIMENTAL build of VirtualBox. "
|
---|
406 | "This version is not suitable for production use."));
|
---|
407 | }
|
---|
408 |
|
---|
409 | #ifdef Q_WS_X11
|
---|
410 | void VBoxProblemReporter::cannotFindLicenseFiles (const QString &aPath)
|
---|
411 | {
|
---|
412 | message
|
---|
413 | (0, VBoxProblemReporter::Error,
|
---|
414 | tr ("Failed to find license files in "
|
---|
415 | "<nobr><b>%1</b></nobr>.")
|
---|
416 | .arg (aPath));
|
---|
417 | }
|
---|
418 |
|
---|
419 | void VBoxProblemReporter::cannotOpenLicenseFile (QWidget *aParent,
|
---|
420 | const QString &aPath)
|
---|
421 | {
|
---|
422 | message
|
---|
423 | (aParent, VBoxProblemReporter::Error,
|
---|
424 | tr ("Failed to open the license file <nobr><b>%1</b></nobr>. "
|
---|
425 | "Check file permissions.")
|
---|
426 | .arg (aPath));
|
---|
427 | }
|
---|
428 | #endif
|
---|
429 |
|
---|
430 | void VBoxProblemReporter::cannotOpenURL (const QString &aURL)
|
---|
431 | {
|
---|
432 | message
|
---|
433 | (mainWindowShown(), VBoxProblemReporter::Error,
|
---|
434 | tr ("Failed to open <tt>%1</tt>. Make sure your desktop environment "
|
---|
435 | "can properly handle URLs of this type.")
|
---|
436 | .arg (aURL));
|
---|
437 | }
|
---|
438 |
|
---|
439 | void VBoxProblemReporter::cannotFindLanguage (const QString &aLangID,
|
---|
440 | const QString &aNlsPath)
|
---|
441 | {
|
---|
442 | message (0, VBoxProblemReporter::Error,
|
---|
443 | tr ("<p>Could not find a language file for the language "
|
---|
444 | "<b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>"
|
---|
445 | "<p>The language will be temporarily reset to the system "
|
---|
446 | "default language. Please go to the <b>Preferences</b> "
|
---|
447 | "dialog which you can open from the <b>File</b> menu of the "
|
---|
448 | "main VirtualBox window, and select one of the existing "
|
---|
449 | "languages on the <b>Language</b> page.</p>")
|
---|
450 | .arg (aLangID).arg (aNlsPath));
|
---|
451 | }
|
---|
452 |
|
---|
453 | void VBoxProblemReporter::cannotLoadLanguage (const QString &aLangFile)
|
---|
454 | {
|
---|
455 | message (0, VBoxProblemReporter::Error,
|
---|
456 | tr ("<p>Could not load the language file <b><nobr>%1</nobr></b>. "
|
---|
457 | "<p>The language will be temporarily reset to English (built-in). "
|
---|
458 | "Please go to the <b>Preferences</b> "
|
---|
459 | "dialog which you can open from the <b>File</b> menu of the "
|
---|
460 | "main VirtualBox window, and select one of the existing "
|
---|
461 | "languages on the <b>Language</b> page.</p>")
|
---|
462 | .arg (aLangFile));
|
---|
463 | }
|
---|
464 |
|
---|
465 | void VBoxProblemReporter::cannotInitCOM (HRESULT rc)
|
---|
466 | {
|
---|
467 | message (0, Critical,
|
---|
468 | tr ("<p>Failed to initialize COM or to find the VirtualBox COM server. "
|
---|
469 | "Most likely, the VirtualBox server is not running "
|
---|
470 | "or failed to start.</p>"
|
---|
471 | "<p>The application will now terminate.</p>"),
|
---|
472 | formatErrorInfo (COMErrorInfo(), rc));
|
---|
473 | }
|
---|
474 |
|
---|
475 | void VBoxProblemReporter::cannotCreateVirtualBox (const CVirtualBox &vbox)
|
---|
476 | {
|
---|
477 | message (0, Critical,
|
---|
478 | tr ("<p>Failed to create the VirtualBox COM object.</p>"
|
---|
479 | "<p>The application will now terminate.</p>"),
|
---|
480 | formatErrorInfo (vbox));
|
---|
481 | }
|
---|
482 |
|
---|
483 | void VBoxProblemReporter::cannotLoadGlobalConfig (const CVirtualBox &vbox,
|
---|
484 | const QString &error)
|
---|
485 | {
|
---|
486 | /* preserve the current error info before calling the object again */
|
---|
487 | COMResult res (vbox);
|
---|
488 |
|
---|
489 | message (mainWindowShown(), Critical,
|
---|
490 | tr ("<p>Failed to load the global GUI configuration from "
|
---|
491 | "<b><nobr>%1</nobr></b>.</p>"
|
---|
492 | "<p>The application will now terminate.</p>")
|
---|
493 | .arg (vbox.GetSettingsFilePath()),
|
---|
494 | !res.isOk() ? formatErrorInfo (res)
|
---|
495 | : QString ("<!--EOM--><p>%1</p>").arg (vboxGlobal().emphasize (error)));
|
---|
496 | }
|
---|
497 |
|
---|
498 | void VBoxProblemReporter::cannotSaveGlobalConfig (const CVirtualBox &vbox)
|
---|
499 | {
|
---|
500 | /* preserve the current error info before calling the object again */
|
---|
501 | COMResult res (vbox);
|
---|
502 |
|
---|
503 | message (mainWindowShown(), Critical,
|
---|
504 | tr ("<p>Failed to save the global GUI configuration to "
|
---|
505 | "<b><nobr>%1</nobr></b>.</p>"
|
---|
506 | "<p>The application will now terminate.</p>")
|
---|
507 | .arg (vbox.GetSettingsFilePath()),
|
---|
508 | formatErrorInfo (res));
|
---|
509 | }
|
---|
510 |
|
---|
511 | void VBoxProblemReporter::cannotSetSystemProperties (const CSystemProperties &props)
|
---|
512 | {
|
---|
513 | message (mainWindowShown(), Critical,
|
---|
514 | tr ("Failed to set global VirtualBox properties."),
|
---|
515 | formatErrorInfo (props));
|
---|
516 | }
|
---|
517 |
|
---|
518 | void VBoxProblemReporter::cannotAccessUSB (const COMBaseWithEI &aObj)
|
---|
519 | {
|
---|
520 | /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return
|
---|
521 | * E_NOTIMPL, it means the USB support is intentionally missing
|
---|
522 | * (as in the OSE version). Don't show the error message in this case. */
|
---|
523 | COMResult res (aObj);
|
---|
524 | if (res.rc() == E_NOTIMPL)
|
---|
525 | return;
|
---|
526 |
|
---|
527 | #ifdef RT_OS_LINUX
|
---|
528 | /* xxx There is no macro to turn an error into a warning, but we need
|
---|
529 | * to do that here. */
|
---|
530 | if (res.rc() == (VBOX_E_HOST_ERROR & ~0x80000000))
|
---|
531 | {
|
---|
532 | message (mainWindowShown(), VBoxProblemReporter::Warning,
|
---|
533 | tr ("Could not access USB on the host system, because "
|
---|
534 | "neither the USB file system (usbfs) nor the DBus "
|
---|
535 | "and hal services are currently available. If you "
|
---|
536 | "wish to use host USB devices inside guest systems, "
|
---|
537 | "you must correct this and restart VirtualBox."),
|
---|
538 | formatErrorInfo (res),
|
---|
539 | "cannotAccessUSB" /* aAutoConfirmId */);
|
---|
540 | return;
|
---|
541 | }
|
---|
542 | #endif
|
---|
543 | message (mainWindowShown(), res.isWarning() ? Warning : Error,
|
---|
544 | tr ("Failed to access the USB subsystem."),
|
---|
545 | formatErrorInfo (res),
|
---|
546 | "cannotAccessUSB");
|
---|
547 | }
|
---|
548 |
|
---|
549 | void VBoxProblemReporter::cannotCreateMachine (const CVirtualBox &vbox,
|
---|
550 | QWidget *parent /* = 0 */)
|
---|
551 | {
|
---|
552 | message (
|
---|
553 | parent ? parent : mainWindowShown(),
|
---|
554 | Error,
|
---|
555 | tr ("Failed to create a new virtual machine."),
|
---|
556 | formatErrorInfo (vbox)
|
---|
557 | );
|
---|
558 | }
|
---|
559 |
|
---|
560 | void VBoxProblemReporter::cannotCreateMachine (const CVirtualBox &vbox,
|
---|
561 | const CMachine &machine,
|
---|
562 | QWidget *parent /* = 0 */)
|
---|
563 | {
|
---|
564 | message (
|
---|
565 | parent ? parent : mainWindowShown(),
|
---|
566 | Error,
|
---|
567 | tr ("Failed to create a new virtual machine <b>%1</b>.")
|
---|
568 | .arg (machine.GetName()),
|
---|
569 | formatErrorInfo (vbox)
|
---|
570 | );
|
---|
571 | }
|
---|
572 |
|
---|
573 | void VBoxProblemReporter::cannotOpenMachine(QWidget *pParent, const QString &strMachinePath, const CVirtualBox &vbox)
|
---|
574 | {
|
---|
575 | message(pParent ? pParent : mainWindowShown(),
|
---|
576 | Error,
|
---|
577 | tr("Failed to open virtual machine located in %1.")
|
---|
578 | .arg(strMachinePath),
|
---|
579 | formatErrorInfo(vbox));
|
---|
580 | }
|
---|
581 |
|
---|
582 | void VBoxProblemReporter::cannotReregisterMachine(QWidget *pParent, const QString &strMachinePath, const QString &strMachineName)
|
---|
583 | {
|
---|
584 | message(pParent ? pParent : mainWindowShown(),
|
---|
585 | Error,
|
---|
586 | tr("Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.")
|
---|
587 | .arg(strMachineName).arg(strMachinePath));
|
---|
588 | }
|
---|
589 |
|
---|
590 | void VBoxProblemReporter::
|
---|
591 | cannotApplyMachineSettings (const CMachine &machine, const COMResult &res)
|
---|
592 | {
|
---|
593 | message (
|
---|
594 | mainWindowShown(),
|
---|
595 | Error,
|
---|
596 | tr ("Failed to apply the settings to the virtual machine <b>%1</b>.")
|
---|
597 | .arg (machine.GetName()),
|
---|
598 | formatErrorInfo (res)
|
---|
599 | );
|
---|
600 | }
|
---|
601 |
|
---|
602 | void VBoxProblemReporter::cannotSaveMachineSettings (const CMachine &machine,
|
---|
603 | QWidget *parent /* = 0 */)
|
---|
604 | {
|
---|
605 | /* preserve the current error info before calling the object again */
|
---|
606 | COMResult res (machine);
|
---|
607 |
|
---|
608 | message (parent ? parent : mainWindowShown(), Error,
|
---|
609 | tr ("Failed to save the settings of the virtual machine "
|
---|
610 | "<b>%1</b> to <b><nobr>%2</nobr></b>.")
|
---|
611 | .arg (machine.GetName(), machine.GetSettingsFilePath()),
|
---|
612 | formatErrorInfo (res));
|
---|
613 | }
|
---|
614 |
|
---|
615 | /**
|
---|
616 | * @param strict If |false|, this method will silently return if the COM
|
---|
617 | * result code is E_NOTIMPL.
|
---|
618 | */
|
---|
619 | void VBoxProblemReporter::cannotLoadMachineSettings (const CMachine &machine,
|
---|
620 | bool strict /* = true */,
|
---|
621 | QWidget *parent /* = 0 */)
|
---|
622 | {
|
---|
623 | /* If COM result code is E_NOTIMPL, it means the requested object or
|
---|
624 | * function is intentionally missing (as in the OSE version). Don't show
|
---|
625 | * the error message in this case. */
|
---|
626 | COMResult res (machine);
|
---|
627 | if (!strict && res.rc() == E_NOTIMPL)
|
---|
628 | return;
|
---|
629 |
|
---|
630 | message (parent ? parent : mainWindowShown(), Error,
|
---|
631 | tr ("Failed to load the settings of the virtual machine "
|
---|
632 | "<b>%1</b> from <b><nobr>%2</nobr></b>.")
|
---|
633 | .arg (machine.GetName(), machine.GetSettingsFilePath()),
|
---|
634 | formatErrorInfo (res));
|
---|
635 | }
|
---|
636 |
|
---|
637 | void VBoxProblemReporter::cannotStartMachine (const CConsole &console)
|
---|
638 | {
|
---|
639 | /* preserve the current error info before calling the object again */
|
---|
640 | COMResult res (console);
|
---|
641 |
|
---|
642 | message (mainWindowShown(), Error,
|
---|
643 | tr ("Failed to start the virtual machine <b>%1</b>.")
|
---|
644 | .arg (console.GetMachine().GetName()),
|
---|
645 | formatErrorInfo (res));
|
---|
646 | }
|
---|
647 |
|
---|
648 | void VBoxProblemReporter::cannotStartMachine (const CProgress &progress)
|
---|
649 | {
|
---|
650 | AssertWrapperOk (progress);
|
---|
651 | CConsole console (CProgress (progress).GetInitiator());
|
---|
652 | AssertWrapperOk (console);
|
---|
653 |
|
---|
654 | message (
|
---|
655 | mainWindowShown(),
|
---|
656 | Error,
|
---|
657 | tr ("Failed to start the virtual machine <b>%1</b>.")
|
---|
658 | .arg (console.GetMachine().GetName()),
|
---|
659 | formatErrorInfo (progress.GetErrorInfo())
|
---|
660 | );
|
---|
661 | }
|
---|
662 |
|
---|
663 | void VBoxProblemReporter::cannotPauseMachine (const CConsole &console)
|
---|
664 | {
|
---|
665 | /* preserve the current error info before calling the object again */
|
---|
666 | COMResult res (console);
|
---|
667 |
|
---|
668 | message (mainWindowShown(), Error,
|
---|
669 | tr ("Failed to pause the execution of the virtual machine <b>%1</b>.")
|
---|
670 | .arg (console.GetMachine().GetName()),
|
---|
671 | formatErrorInfo (res));
|
---|
672 | }
|
---|
673 |
|
---|
674 | void VBoxProblemReporter::cannotResumeMachine (const CConsole &console)
|
---|
675 | {
|
---|
676 | /* preserve the current error info before calling the object again */
|
---|
677 | COMResult res (console);
|
---|
678 |
|
---|
679 | message (mainWindowShown(), Error,
|
---|
680 | tr ("Failed to resume the execution of the virtual machine <b>%1</b>.")
|
---|
681 | .arg (console.GetMachine().GetName()),
|
---|
682 | formatErrorInfo (res));
|
---|
683 | }
|
---|
684 |
|
---|
685 | void VBoxProblemReporter::cannotACPIShutdownMachine (const CConsole &console)
|
---|
686 | {
|
---|
687 | /* preserve the current error info before calling the object again */
|
---|
688 | COMResult res (console);
|
---|
689 |
|
---|
690 | message (mainWindowShown(), Error,
|
---|
691 | tr ("Failed to send the ACPI Power Button press event to the "
|
---|
692 | "virtual machine <b>%1</b>.")
|
---|
693 | .arg (console.GetMachine().GetName()),
|
---|
694 | formatErrorInfo (res));
|
---|
695 | }
|
---|
696 |
|
---|
697 | void VBoxProblemReporter::cannotSaveMachineState (const CConsole &console)
|
---|
698 | {
|
---|
699 | /* preserve the current error info before calling the object again */
|
---|
700 | COMResult res (console);
|
---|
701 |
|
---|
702 | message (mainWindowShown(), Error,
|
---|
703 | tr ("Failed to save the state of the virtual machine <b>%1</b>.")
|
---|
704 | .arg (console.GetMachine().GetName()),
|
---|
705 | formatErrorInfo (res));
|
---|
706 | }
|
---|
707 |
|
---|
708 | void VBoxProblemReporter::cannotSaveMachineState (const CProgress &progress)
|
---|
709 | {
|
---|
710 | AssertWrapperOk (progress);
|
---|
711 | CConsole console (CProgress (progress).GetInitiator());
|
---|
712 | AssertWrapperOk (console);
|
---|
713 |
|
---|
714 | message (
|
---|
715 | mainWindowShown(),
|
---|
716 | Error,
|
---|
717 | tr ("Failed to save the state of the virtual machine <b>%1</b>.")
|
---|
718 | .arg (console.GetMachine().GetName()),
|
---|
719 | formatErrorInfo (progress.GetErrorInfo())
|
---|
720 | );
|
---|
721 | }
|
---|
722 |
|
---|
723 | void VBoxProblemReporter::cannotTakeSnapshot (const CConsole &console)
|
---|
724 | {
|
---|
725 | /* preserve the current error info before calling the object again */
|
---|
726 | COMResult res (console);
|
---|
727 |
|
---|
728 | message (mainWindowShown(), Error,
|
---|
729 | tr ("Failed to create a snapshot of the virtual machine <b>%1</b>.")
|
---|
730 | .arg (console.GetMachine().GetName()),
|
---|
731 | formatErrorInfo (res));
|
---|
732 | }
|
---|
733 |
|
---|
734 | void VBoxProblemReporter::cannotTakeSnapshot (const CProgress &progress)
|
---|
735 | {
|
---|
736 | AssertWrapperOk (progress);
|
---|
737 | CConsole console (CProgress (progress).GetInitiator());
|
---|
738 | AssertWrapperOk (console);
|
---|
739 |
|
---|
740 | message (
|
---|
741 | mainWindowShown(),
|
---|
742 | Error,
|
---|
743 | tr ("Failed to create a snapshot of the virtual machine <b>%1</b>.")
|
---|
744 | .arg (console.GetMachine().GetName()),
|
---|
745 | formatErrorInfo (progress.GetErrorInfo())
|
---|
746 | );
|
---|
747 | }
|
---|
748 |
|
---|
749 | void VBoxProblemReporter::cannotStopMachine (const CConsole &console)
|
---|
750 | {
|
---|
751 | /* preserve the current error info before calling the object again */
|
---|
752 | COMResult res (console);
|
---|
753 |
|
---|
754 | message (mainWindowShown(), Error,
|
---|
755 | tr ("Failed to stop the virtual machine <b>%1</b>.")
|
---|
756 | .arg (console.GetMachine().GetName()),
|
---|
757 | formatErrorInfo (res));
|
---|
758 | }
|
---|
759 |
|
---|
760 | void VBoxProblemReporter::cannotStopMachine (const CProgress &progress)
|
---|
761 | {
|
---|
762 | AssertWrapperOk (progress);
|
---|
763 | CConsole console (CProgress (progress).GetInitiator());
|
---|
764 | AssertWrapperOk (console);
|
---|
765 |
|
---|
766 | message (mainWindowShown(), Error,
|
---|
767 | tr ("Failed to stop the virtual machine <b>%1</b>.")
|
---|
768 | .arg (console.GetMachine().GetName()),
|
---|
769 | formatErrorInfo (progress.GetErrorInfo()));
|
---|
770 | }
|
---|
771 |
|
---|
772 | void VBoxProblemReporter::cannotDeleteMachine(const CMachine &machine)
|
---|
773 | {
|
---|
774 | /* preserve the current error info before calling the object again */
|
---|
775 | COMResult res (machine);
|
---|
776 |
|
---|
777 | message(mainWindowShown(),
|
---|
778 | Error,
|
---|
779 | tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
|
---|
780 | !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res));
|
---|
781 | }
|
---|
782 |
|
---|
783 | void VBoxProblemReporter::cannotDiscardSavedState (const CConsole &console)
|
---|
784 | {
|
---|
785 | /* preserve the current error info before calling the object again */
|
---|
786 | COMResult res (console);
|
---|
787 |
|
---|
788 | message (mainWindowShown(), Error,
|
---|
789 | tr ("Failed to discard the saved state of the virtual machine <b>%1</b>.")
|
---|
790 | .arg (console.GetMachine().GetName()),
|
---|
791 | formatErrorInfo (res));
|
---|
792 | }
|
---|
793 |
|
---|
794 | void VBoxProblemReporter::cannotSendACPIToMachine()
|
---|
795 | {
|
---|
796 | message (mainWindowShown(), Warning,
|
---|
797 | tr ("You are trying to shut down the guest with the ACPI power "
|
---|
798 | "button. This is currently not possible because the guest "
|
---|
799 | "does not support software shutdown."));
|
---|
800 | }
|
---|
801 |
|
---|
802 | bool VBoxProblemReporter::warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported)
|
---|
803 | {
|
---|
804 | if (fHWVirtExSupported)
|
---|
805 | return messageOkCancel (mainWindowShown(), Error,
|
---|
806 | tr ("<p>VT-x/AMD-V hardware acceleration has been enabled, but is "
|
---|
807 | "not operational. Your 64-bit guest will fail to detect a "
|
---|
808 | "64-bit CPU and will not be able to boot.</p><p>Please ensure "
|
---|
809 | "that you have enabled VT-x/AMD-V properly in the BIOS of your "
|
---|
810 | "host computer.</p>"),
|
---|
811 | 0 /* aAutoConfirmId */,
|
---|
812 | tr ("Close VM"), tr ("Continue"));
|
---|
813 | else
|
---|
814 | return messageOkCancel (mainWindowShown(), Error,
|
---|
815 | tr ("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
|
---|
816 | "Your 64-bit guest will fail to detect a 64-bit CPU and will "
|
---|
817 | "not be able to boot."),
|
---|
818 | 0 /* aAutoConfirmId */,
|
---|
819 | tr ("Close VM"), tr ("Continue"));
|
---|
820 | }
|
---|
821 |
|
---|
822 | bool VBoxProblemReporter::warnAboutVirtNotEnabledGuestRequired(bool fHWVirtExSupported)
|
---|
823 | {
|
---|
824 | if (fHWVirtExSupported)
|
---|
825 | return messageOkCancel (mainWindowShown(), Error,
|
---|
826 | tr ("<p>VT-x/AMD-V hardware acceleration has been enabled, but is "
|
---|
827 | "not operational. Certain guests (e.g. OS/2 and QNX) require "
|
---|
828 | "this feature.</p><p>Please ensure "
|
---|
829 | "that you have enabled VT-x/AMD-V properly in the BIOS of your "
|
---|
830 | "host computer.</p>"),
|
---|
831 | 0 /* aAutoConfirmId */,
|
---|
832 | tr ("Close VM"), tr ("Continue"));
|
---|
833 | else
|
---|
834 | return messageOkCancel (mainWindowShown(), Error,
|
---|
835 | tr ("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
|
---|
836 | "Certain guests (e.g. OS/2 and QNX) require this feature and will "
|
---|
837 | "fail to boot without it.</p>"),
|
---|
838 | 0 /* aAutoConfirmId */,
|
---|
839 | tr ("Close VM"), tr ("Continue"));
|
---|
840 | }
|
---|
841 |
|
---|
842 | bool VBoxProblemReporter::askAboutSnapshotRestoring (const QString &aSnapshotName)
|
---|
843 | {
|
---|
844 | return messageOkCancel (mainWindowShown(), Question,
|
---|
845 | tr ("<p>Are you sure you want to restore snapshot <b>%1</b>? "
|
---|
846 | "This will cause you to lose your current machine state, which cannot be recovered.</p>")
|
---|
847 | .arg (aSnapshotName),
|
---|
848 | /* Do NOT allow this message to be disabled! */
|
---|
849 | NULL /* aAutoConfirmId */,
|
---|
850 | tr ("Restore"), tr ("Cancel"));
|
---|
851 | }
|
---|
852 |
|
---|
853 | bool VBoxProblemReporter::askAboutSnapshotDeleting (const QString &aSnapshotName)
|
---|
854 | {
|
---|
855 | return messageOkCancel (mainWindowShown(), Question,
|
---|
856 | tr ("<p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over "
|
---|
857 | "several image files that VirtualBox has created together with the snapshot will be merged into one file. This can be a lengthy process, and the information "
|
---|
858 | "in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>")
|
---|
859 | .arg (aSnapshotName),
|
---|
860 | /* Do NOT allow this message to be disabled! */
|
---|
861 | NULL /* aAutoConfirmId */,
|
---|
862 | tr ("Delete"), tr ("Cancel"));
|
---|
863 | }
|
---|
864 |
|
---|
865 | bool VBoxProblemReporter::askAboutSnapshotDeletingFreeSpace (const QString &aSnapshotName,
|
---|
866 | const QString &aTargetImageName,
|
---|
867 | const QString &aTargetImageMaxSize,
|
---|
868 | const QString &aTargetFilesystemFree)
|
---|
869 | {
|
---|
870 | return messageOkCancel (mainWindowShown(), Question,
|
---|
871 | tr ("<p>Deleting the snapshot %1 will temporarily need more disk space. In the worst case the size of image %2 will grow by %3, "
|
---|
872 | "however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in "
|
---|
873 | "corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting "
|
---|
874 | "the snapshot at your own risk.</p>")
|
---|
875 | .arg (aSnapshotName)
|
---|
876 | .arg (aTargetImageName)
|
---|
877 | .arg (aTargetImageMaxSize)
|
---|
878 | .arg (aTargetFilesystemFree),
|
---|
879 | /* Do NOT allow this message to be disabled! */
|
---|
880 | NULL /* aAutoConfirmId */,
|
---|
881 | tr ("Delete"), tr ("Cancel"));
|
---|
882 | }
|
---|
883 |
|
---|
884 | void VBoxProblemReporter::cannotRestoreSnapshot (const CConsole &aConsole,
|
---|
885 | const QString &aSnapshotName)
|
---|
886 | {
|
---|
887 | message (mainWindowShown(), Error,
|
---|
888 | tr ("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
|
---|
889 | .arg (aSnapshotName)
|
---|
890 | .arg (CConsole (aConsole).GetMachine().GetName()),
|
---|
891 | formatErrorInfo (aConsole));
|
---|
892 | }
|
---|
893 |
|
---|
894 | void VBoxProblemReporter::cannotRestoreSnapshot (const CProgress &aProgress,
|
---|
895 | const QString &aSnapshotName)
|
---|
896 | {
|
---|
897 | CConsole console (CProgress (aProgress).GetInitiator());
|
---|
898 |
|
---|
899 | message (mainWindowShown(), Error,
|
---|
900 | tr ("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
|
---|
901 | .arg (aSnapshotName)
|
---|
902 | .arg (console.GetMachine().GetName()),
|
---|
903 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
904 | }
|
---|
905 |
|
---|
906 | void VBoxProblemReporter::cannotDeleteSnapshot (const CConsole &aConsole,
|
---|
907 | const QString &aSnapshotName)
|
---|
908 | {
|
---|
909 | message (mainWindowShown(), Error,
|
---|
910 | tr ("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
|
---|
911 | .arg (aSnapshotName)
|
---|
912 | .arg (CConsole (aConsole).GetMachine().GetName()),
|
---|
913 | formatErrorInfo (aConsole));
|
---|
914 | }
|
---|
915 |
|
---|
916 | void VBoxProblemReporter::cannotDeleteSnapshot (const CProgress &aProgress,
|
---|
917 | const QString &aSnapshotName)
|
---|
918 | {
|
---|
919 | CConsole console (CProgress (aProgress).GetInitiator());
|
---|
920 |
|
---|
921 | message (mainWindowShown(), Error,
|
---|
922 | tr ("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
|
---|
923 | .arg (aSnapshotName)
|
---|
924 | .arg (console.GetMachine().GetName()),
|
---|
925 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
926 | }
|
---|
927 |
|
---|
928 | void VBoxProblemReporter::cannotFindMachineByName (const CVirtualBox &vbox,
|
---|
929 | const QString &name)
|
---|
930 | {
|
---|
931 | message (
|
---|
932 | QApplication::desktop()->screen(QApplication::desktop()->primaryScreen()),
|
---|
933 | Error,
|
---|
934 | tr ("There is no virtual machine named <b>%1</b>.")
|
---|
935 | .arg (name),
|
---|
936 | formatErrorInfo (vbox)
|
---|
937 | );
|
---|
938 | }
|
---|
939 |
|
---|
940 | void VBoxProblemReporter::cannotEnterSeamlessMode (ULONG /* aWidth */,
|
---|
941 | ULONG /* aHeight */,
|
---|
942 | ULONG /* aBpp */,
|
---|
943 | ULONG64 aMinVRAM)
|
---|
944 | {
|
---|
945 | message (mainMachineWindowShown(), Error,
|
---|
946 | tr ("<p>Could not enter seamless mode due to insufficient guest "
|
---|
947 | "video memory.</p>"
|
---|
948 | "<p>You should configure the virtual machine to have at "
|
---|
949 | "least <b>%1</b> of video memory.</p>")
|
---|
950 | .arg (VBoxGlobal::formatSize (aMinVRAM)));
|
---|
951 | }
|
---|
952 |
|
---|
953 | int VBoxProblemReporter::cannotEnterFullscreenMode (ULONG /* aWidth */,
|
---|
954 | ULONG /* aHeight */,
|
---|
955 | ULONG /* aBpp */,
|
---|
956 | ULONG64 aMinVRAM)
|
---|
957 | {
|
---|
958 | return message (mainMachineWindowShown(), Warning,
|
---|
959 | tr ("<p>Could not switch the guest display to fullscreen mode due "
|
---|
960 | "to insufficient guest video memory.</p>"
|
---|
961 | "<p>You should configure the virtual machine to have at "
|
---|
962 | "least <b>%1</b> of video memory.</p>"
|
---|
963 | "<p>Press <b>Ignore</b> to switch to fullscreen mode anyway "
|
---|
964 | "or press <b>Cancel</b> to cancel the operation.</p>")
|
---|
965 | .arg (VBoxGlobal::formatSize (aMinVRAM)),
|
---|
966 | 0, /* aAutoConfirmId */
|
---|
967 | QIMessageBox::Ignore | QIMessageBox::Default,
|
---|
968 | QIMessageBox::Cancel | QIMessageBox::Escape);
|
---|
969 | }
|
---|
970 |
|
---|
971 | void VBoxProblemReporter::cannotSwitchScreenInSeamless(quint64 minVRAM)
|
---|
972 | {
|
---|
973 | message(mainMachineWindowShown(), Error,
|
---|
974 | tr("<p>Could not change the guest screen to this host screen "
|
---|
975 | "due to insufficient guest video memory.</p>"
|
---|
976 | "<p>You should configure the virtual machine to have at "
|
---|
977 | "least <b>%1</b> of video memory.</p>")
|
---|
978 | .arg(VBoxGlobal::formatSize(minVRAM)));
|
---|
979 | }
|
---|
980 |
|
---|
981 | int VBoxProblemReporter::cannotSwitchScreenInFullscreen(quint64 minVRAM)
|
---|
982 | {
|
---|
983 | return message(mainMachineWindowShown(), Warning,
|
---|
984 | tr("<p>Could not change the guest screen to this host screen "
|
---|
985 | "due to insufficient guest video memory.</p>"
|
---|
986 | "<p>You should configure the virtual machine to have at "
|
---|
987 | "least <b>%1</b> of video memory.</p>"
|
---|
988 | "<p>Press <b>Ignore</b> to switch the screen anyway "
|
---|
989 | "or press <b>Cancel</b> to cancel the operation.</p>")
|
---|
990 | .arg(VBoxGlobal::formatSize(minVRAM)),
|
---|
991 | 0, /* aAutoConfirmId */
|
---|
992 | QIMessageBox::Ignore | QIMessageBox::Default,
|
---|
993 | QIMessageBox::Cancel | QIMessageBox::Escape);
|
---|
994 | }
|
---|
995 |
|
---|
996 | int VBoxProblemReporter::cannotEnterFullscreenMode()
|
---|
997 | {
|
---|
998 | return message(mainMachineWindowShown(), Error,
|
---|
999 | tr ("<p>Can not switch the guest display to fullscreen mode. You "
|
---|
1000 | "have more virtual screens configured than physical screens are "
|
---|
1001 | "attached to your host.</p><p>Please either lower the virtual "
|
---|
1002 | "screens in your VM configuration or attach additional screens "
|
---|
1003 | "to your host.</p>"),
|
---|
1004 | 0, /* aAutoConfirmId */
|
---|
1005 | QIMessageBox::Ok | QIMessageBox::Default);
|
---|
1006 | }
|
---|
1007 |
|
---|
1008 | int VBoxProblemReporter::cannotEnterSeamlessMode()
|
---|
1009 | {
|
---|
1010 | return message(mainMachineWindowShown(), Error,
|
---|
1011 | tr ("<p>Can not switch the guest display to seamless mode. You "
|
---|
1012 | "have more virtual screens configured than physical screens are "
|
---|
1013 | "attached to your host.</p><p>Please either lower the virtual "
|
---|
1014 | "screens in your VM configuration or attach additional screens "
|
---|
1015 | "to your host.</p>"),
|
---|
1016 | 0, /* aAutoConfirmId */
|
---|
1017 | QIMessageBox::Ok | QIMessageBox::Default);
|
---|
1018 | }
|
---|
1019 |
|
---|
1020 | int VBoxProblemReporter::confirmMachineDeletion(const CMachine &machine)
|
---|
1021 | {
|
---|
1022 | if (machine.GetAccessible())
|
---|
1023 | {
|
---|
1024 | int cDisks = 0;
|
---|
1025 | const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
|
---|
1026 | for (int i = 0; i < attachments.size(); ++i)
|
---|
1027 | {
|
---|
1028 | const CMediumAttachment &attachment = attachments.at(i);
|
---|
1029 | /* Check if the medium is a harddisk: */
|
---|
1030 | if (attachment.GetType() == KDeviceType_HardDisk)
|
---|
1031 | {
|
---|
1032 | /* Check if the disk isn't shared.
|
---|
1033 | * If the disk is shared, it will be *never* deleted. */
|
---|
1034 | QVector<QString> ids = attachment.GetMedium().GetMachineIds();
|
---|
1035 | if (ids.size() == 1)
|
---|
1036 | ++cDisks;
|
---|
1037 | }
|
---|
1038 | }
|
---|
1039 | const QString strBase = tr("<p>You are about to remove the virtual machine <b>%1</b> from the machine list.</p>"
|
---|
1040 | "<p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p>")
|
---|
1041 | .arg(machine.GetName());
|
---|
1042 | const QString strExtd = tr("<p>You are about to remove the virtual machine <b>%1</b> from the machine list.</p>"
|
---|
1043 | "<p>Would you like to delete the files containing the virtual machine from your hard disk as well? "
|
---|
1044 | "Doing this will also remove the files containing the machine's virtual hard disks "
|
---|
1045 | "if they are not in use by another machine.</p>")
|
---|
1046 | .arg(machine.GetName());
|
---|
1047 | return message(&vboxGlobal().selectorWnd(),
|
---|
1048 | Question,
|
---|
1049 | cDisks == 0 ? strBase : strExtd,
|
---|
1050 | 0, /* auto-confirm id */
|
---|
1051 | QIMessageBox::Yes,
|
---|
1052 | QIMessageBox::No,
|
---|
1053 | QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
|
---|
1054 | tr("Delete all files"),
|
---|
1055 | tr("Remove only"));
|
---|
1056 | }
|
---|
1057 | else
|
---|
1058 | {
|
---|
1059 | /* This should be in sync with UIVMListBoxItem::recache(): */
|
---|
1060 | QFileInfo fi(machine.GetSettingsFilePath());
|
---|
1061 | const QString strName = VBoxGlobal::hasAllowedExtension(fi.completeSuffix(), VBoxDefs::VBoxFileExts) ? fi.completeBaseName() : fi.fileName();
|
---|
1062 | const QString strBase = tr("You are about to remove the inaccessible virtual machine "
|
---|
1063 | "<b>%1</b> from the machine list. Do you wish to proceed?")
|
---|
1064 | .arg(strName);
|
---|
1065 | return message(&vboxGlobal().selectorWnd(),
|
---|
1066 | Question,
|
---|
1067 | strBase,
|
---|
1068 | 0, /* auto-confirm id */
|
---|
1069 | QIMessageBox::Ok,
|
---|
1070 | QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
|
---|
1071 | 0,
|
---|
1072 | tr("Remove"));
|
---|
1073 | }
|
---|
1074 | }
|
---|
1075 |
|
---|
1076 | bool VBoxProblemReporter::confirmDiscardSavedState (const CMachine &machine)
|
---|
1077 | {
|
---|
1078 | return messageOkCancel (&vboxGlobal().selectorWnd(), Question,
|
---|
1079 | tr ("<p>Are you sure you want to discard the saved state of "
|
---|
1080 | "the virtual machine <b>%1</b>?</p>"
|
---|
1081 | "<p>This operation is equivalent to resetting or powering off "
|
---|
1082 | "the machine without doing a proper shutdown of the "
|
---|
1083 | "guest OS.</p>")
|
---|
1084 | .arg (machine.GetName()),
|
---|
1085 | 0 /* aAutoConfirmId */,
|
---|
1086 | tr ("Discard", "saved state"));
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | bool VBoxProblemReporter::confirmReleaseMedium (QWidget *aParent,
|
---|
1090 | const VBoxMedium &aMedium,
|
---|
1091 | const QString &aUsage)
|
---|
1092 | {
|
---|
1093 | /** @todo (translation-related): the gender of "the" in translations
|
---|
1094 | * will depend on the gender of aMedium.type(). */
|
---|
1095 | return messageOkCancel (aParent, Question,
|
---|
1096 | tr ("<p>Are you sure you want to release the %1 "
|
---|
1097 | "<nobr><b>%2</b></nobr>?</p>"
|
---|
1098 | "<p>This will detach it from the "
|
---|
1099 | "following virtual machine(s): <b>%3</b>.</p>")
|
---|
1100 | .arg (mediumToAccusative (aMedium.type()))
|
---|
1101 | .arg (aMedium.location())
|
---|
1102 | .arg (aUsage),
|
---|
1103 | 0 /* aAutoConfirmId */,
|
---|
1104 | tr ("Release", "detach medium"));
|
---|
1105 | }
|
---|
1106 |
|
---|
1107 | bool VBoxProblemReporter::confirmRemoveMedium (QWidget *aParent,
|
---|
1108 | const VBoxMedium &aMedium)
|
---|
1109 | {
|
---|
1110 | /** @todo (translation-related): the gender of "the" in translations
|
---|
1111 | * will depend on the gender of aMedium.type(). */
|
---|
1112 | QString msg =
|
---|
1113 | tr ("<p>Are you sure you want to remove the %1 "
|
---|
1114 | "<nobr><b>%2</b></nobr> from the list of known media?</p>")
|
---|
1115 | .arg (mediumToAccusative (aMedium.type()))
|
---|
1116 | .arg (aMedium.location());
|
---|
1117 |
|
---|
1118 | if (aMedium.type() == VBoxDefs::MediumType_HardDisk)
|
---|
1119 | {
|
---|
1120 | if (aMedium.state() == KMediumState_Inaccessible)
|
---|
1121 | msg +=
|
---|
1122 | tr ("Note that as this hard disk is inaccessible its "
|
---|
1123 | "storage unit cannot be deleted right now.");
|
---|
1124 | else
|
---|
1125 | msg +=
|
---|
1126 | tr ("The next dialog will let you choose whether you also "
|
---|
1127 | "want to delete the storage unit of this hard disk or "
|
---|
1128 | "keep it for later usage.");
|
---|
1129 | }
|
---|
1130 | else
|
---|
1131 | msg +=
|
---|
1132 | tr ("<p>Note that the storage unit of this medium will not be "
|
---|
1133 | "deleted and that it will be possible to add it to "
|
---|
1134 | "the list later again.</p>");
|
---|
1135 |
|
---|
1136 | return messageOkCancel (aParent, Question, msg,
|
---|
1137 | "confirmRemoveMedium", /* aAutoConfirmId */
|
---|
1138 | tr ("Remove", "medium"));
|
---|
1139 | }
|
---|
1140 |
|
---|
1141 | void VBoxProblemReporter::sayCannotOverwriteHardDiskStorage (
|
---|
1142 | QWidget *aParent, const QString &aLocation)
|
---|
1143 | {
|
---|
1144 | message (aParent, Info,
|
---|
1145 | tr ("<p>The hard disk storage unit at location <b>%1</b> already "
|
---|
1146 | "exists. You cannot create a new virtual hard disk that uses this "
|
---|
1147 | "location because it can be already used by another virtual hard "
|
---|
1148 | "disk.</p>"
|
---|
1149 | "<p>Please specify a different location.</p>")
|
---|
1150 | .arg (aLocation));
|
---|
1151 | }
|
---|
1152 |
|
---|
1153 | int VBoxProblemReporter::confirmDeleteHardDiskStorage (
|
---|
1154 | QWidget *aParent, const QString &aLocation)
|
---|
1155 | {
|
---|
1156 | return message (aParent, Question,
|
---|
1157 | tr ("<p>Do you want to delete the storage unit of the hard disk "
|
---|
1158 | "<nobr><b>%1</b></nobr>?</p>"
|
---|
1159 | "<p>If you select <b>Delete</b> then the specified storage unit "
|
---|
1160 | "will be permanently deleted. This operation <b>cannot be "
|
---|
1161 | "undone</b>.</p>"
|
---|
1162 | "<p>If you select <b>Keep</b> then the hard disk will be only "
|
---|
1163 | "removed from the list of known hard disks, but the storage unit "
|
---|
1164 | "will be left untouched which makes it possible to add this hard "
|
---|
1165 | "disk to the list later again.</p>")
|
---|
1166 | .arg (aLocation),
|
---|
1167 | 0, /* aAutoConfirmId */
|
---|
1168 | QIMessageBox::Yes,
|
---|
1169 | QIMessageBox::No | QIMessageBox::Default,
|
---|
1170 | QIMessageBox::Cancel | QIMessageBox::Escape,
|
---|
1171 | tr ("Delete", "hard disk storage"),
|
---|
1172 | tr ("Keep", "hard disk storage"));
|
---|
1173 | }
|
---|
1174 |
|
---|
1175 | void VBoxProblemReporter::cannotDeleteHardDiskStorage (QWidget *aParent,
|
---|
1176 | const CMedium &aHD,
|
---|
1177 | const CProgress &aProgress)
|
---|
1178 | {
|
---|
1179 | /* below, we use CMedium (aHD) to preserve current error info
|
---|
1180 | * for formatErrorInfo() */
|
---|
1181 |
|
---|
1182 | message (aParent, Error,
|
---|
1183 | tr ("Failed to delete the storage unit of the hard disk <b>%1</b>.")
|
---|
1184 | .arg (CMedium (aHD).GetLocation()),
|
---|
1185 | !aHD.isOk() ? formatErrorInfo (aHD) :
|
---|
1186 | !aProgress.isOk() ? formatErrorInfo (aProgress) :
|
---|
1187 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
1188 | }
|
---|
1189 |
|
---|
1190 | int VBoxProblemReporter::askAboutHardDiskAttachmentCreation(QWidget *pParent,
|
---|
1191 | const QString &strControllerName)
|
---|
1192 | {
|
---|
1193 | return message(pParent, Question,
|
---|
1194 | tr("<p>You are about to add a virtual hard disk to controller <b>%1</b>.</p>"
|
---|
1195 | "<p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>")
|
---|
1196 | .arg(strControllerName),
|
---|
1197 | 0, /* aAutoConfirmId */
|
---|
1198 | QIMessageBox::Yes,
|
---|
1199 | QIMessageBox::No,
|
---|
1200 | QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape,
|
---|
1201 | tr("Create &new disk", "add attachment routine"),
|
---|
1202 | tr("&Choose existing disk", "add attachment routine"));
|
---|
1203 | }
|
---|
1204 |
|
---|
1205 | int VBoxProblemReporter::askAboutOpticalAttachmentCreation(QWidget *pParent,
|
---|
1206 | const QString &strControllerName)
|
---|
1207 | {
|
---|
1208 | return message(pParent, Question,
|
---|
1209 | tr("<p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p>"
|
---|
1210 | "<p>Would you like to choose a virtual CD/DVD disk to put in the drive "
|
---|
1211 | "or to leave it empty for now?</p>")
|
---|
1212 | .arg(strControllerName),
|
---|
1213 | 0, /* aAutoConfirmId */
|
---|
1214 | QIMessageBox::Yes,
|
---|
1215 | QIMessageBox::No,
|
---|
1216 | QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape,
|
---|
1217 | tr("&Choose disk", "add attachment routine"),
|
---|
1218 | tr("Leave &empty", "add attachment routine"));
|
---|
1219 | }
|
---|
1220 |
|
---|
1221 | int VBoxProblemReporter::askAboutFloppyAttachmentCreation(QWidget *pParent,
|
---|
1222 | const QString &strControllerName)
|
---|
1223 | {
|
---|
1224 | return message(pParent, Question,
|
---|
1225 | tr("<p>You are about to add a new floppy drive to controller <b>%1</b>.</p>"
|
---|
1226 | "<p>Would you like to choose a virtual floppy disk to put in the drive "
|
---|
1227 | "or to leave it empty for now?</p>")
|
---|
1228 | .arg(strControllerName),
|
---|
1229 | 0, /* aAutoConfirmId */
|
---|
1230 | QIMessageBox::Yes,
|
---|
1231 | QIMessageBox::No,
|
---|
1232 | QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape,
|
---|
1233 | tr("&Choose disk", "add attachment routine"),
|
---|
1234 | tr("Leave &empty", "add attachment routine"));
|
---|
1235 | }
|
---|
1236 |
|
---|
1237 | int VBoxProblemReporter::confirmRemovingOfLastDVDDevice() const
|
---|
1238 | {
|
---|
1239 | return messageOkCancel (QApplication::activeWindow(), Info,
|
---|
1240 | tr ("<p>Are you sure you want to delete the CD/DVD-ROM device?</p>"
|
---|
1241 | "<p>You will not be able to mount any CDs or ISO images "
|
---|
1242 | "or install the Guest Additions without it!</p>"),
|
---|
1243 | 0, /* aAutoConfirmId */
|
---|
1244 | tr ("&Remove", "medium"));
|
---|
1245 | }
|
---|
1246 |
|
---|
1247 | void VBoxProblemReporter::cannotCreateHardDiskStorage (
|
---|
1248 | QWidget *aParent, const CVirtualBox &aVBox, const QString &aLocation,
|
---|
1249 | const CMedium &aHD, const CProgress &aProgress)
|
---|
1250 | {
|
---|
1251 | message (aParent, Error,
|
---|
1252 | tr ("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
|
---|
1253 | .arg (aLocation),
|
---|
1254 | !aVBox.isOk() ? formatErrorInfo (aVBox) :
|
---|
1255 | !aHD.isOk() ? formatErrorInfo (aHD) :
|
---|
1256 | !aProgress.isOk() ? formatErrorInfo (aProgress) :
|
---|
1257 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
1258 | }
|
---|
1259 |
|
---|
1260 | void VBoxProblemReporter::cannotDetachDevice(QWidget *pParent, const CMachine &machine,
|
---|
1261 | VBoxDefs::MediumType type, const QString &strLocation, const StorageSlot &storageSlot)
|
---|
1262 | {
|
---|
1263 | QString strMessage;
|
---|
1264 | switch (type)
|
---|
1265 | {
|
---|
1266 | case VBoxDefs::MediumType_HardDisk:
|
---|
1267 | {
|
---|
1268 | strMessage = tr("Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
|
---|
1269 | .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
|
---|
1270 | break;
|
---|
1271 | }
|
---|
1272 | case VBoxDefs::MediumType_DVD:
|
---|
1273 | {
|
---|
1274 | strMessage = tr("Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
|
---|
1275 | .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
|
---|
1276 | break;
|
---|
1277 | }
|
---|
1278 | case VBoxDefs::MediumType_Floppy:
|
---|
1279 | {
|
---|
1280 | strMessage = tr("Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
|
---|
1281 | .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
|
---|
1282 | break;
|
---|
1283 | }
|
---|
1284 | default:
|
---|
1285 | break;
|
---|
1286 | }
|
---|
1287 | message(pParent ? pParent : mainWindowShown(), Error, strMessage, formatErrorInfo(machine));
|
---|
1288 | }
|
---|
1289 |
|
---|
1290 | int VBoxProblemReporter::cannotRemountMedium (QWidget *aParent, const CMachine &aMachine,
|
---|
1291 | const VBoxMedium &aMedium, bool aMount, bool aRetry)
|
---|
1292 | {
|
---|
1293 | /** @todo (translation-related): the gender of "the" in translations
|
---|
1294 | * will depend on the gender of aMedium.type(). */
|
---|
1295 | QString text;
|
---|
1296 | if (aMount)
|
---|
1297 | {
|
---|
1298 | text = tr ("Unable to mount the %1 <nobr><b>%2</b></nobr> on the machine <b>%3</b>.");
|
---|
1299 | if (aRetry) text += tr (" Would you like to force mounting of this medium?");
|
---|
1300 | }
|
---|
1301 | else
|
---|
1302 | {
|
---|
1303 | text = tr ("Unable to unmount the %1 <nobr><b>%2</b></nobr> from the machine <b>%3</b>.");
|
---|
1304 | if (aRetry) text += tr (" Would you like to force unmounting of this medium?");
|
---|
1305 | }
|
---|
1306 | if (aRetry)
|
---|
1307 | {
|
---|
1308 | return messageOkCancel (aParent ? aParent : mainWindowShown(), Question, text
|
---|
1309 | .arg (mediumToAccusative (aMedium.type(), aMedium.isHostDrive()))
|
---|
1310 | .arg (aMedium.isHostDrive() ? aMedium.name() : aMedium.location())
|
---|
1311 | .arg (CMachine (aMachine).GetName()),
|
---|
1312 | formatErrorInfo (aMachine),
|
---|
1313 | 0 /* Auto Confirm ID */,
|
---|
1314 | tr ("Force Unmount"));
|
---|
1315 | }
|
---|
1316 | else
|
---|
1317 | {
|
---|
1318 | return message (aParent ? aParent : mainWindowShown(), Error, text
|
---|
1319 | .arg (mediumToAccusative (aMedium.type(), aMedium.isHostDrive()))
|
---|
1320 | .arg (aMedium.isHostDrive() ? aMedium.name() : aMedium.location())
|
---|
1321 | .arg (CMachine (aMachine).GetName()),
|
---|
1322 | formatErrorInfo (aMachine));
|
---|
1323 | }
|
---|
1324 | }
|
---|
1325 |
|
---|
1326 | void VBoxProblemReporter::cannotOpenMedium (
|
---|
1327 | QWidget *aParent, const CVirtualBox &aVBox,
|
---|
1328 | VBoxDefs::MediumType aType, const QString &aLocation)
|
---|
1329 | {
|
---|
1330 | /** @todo (translation-related): the gender of "the" in translations
|
---|
1331 | * will depend on the gender of aMedium.type(). */
|
---|
1332 | message (aParent ? aParent : mainWindowShown(), Error,
|
---|
1333 | tr ("Failed to open the %1 <nobr><b>%2</b></nobr>.")
|
---|
1334 | .arg (mediumToAccusative (aType))
|
---|
1335 | .arg (aLocation),
|
---|
1336 | formatErrorInfo (aVBox));
|
---|
1337 | }
|
---|
1338 |
|
---|
1339 | void VBoxProblemReporter::cannotCloseMedium (
|
---|
1340 | QWidget *aParent, const VBoxMedium &aMedium, const COMResult &aResult)
|
---|
1341 | {
|
---|
1342 | /** @todo (translation-related): the gender of "the" in translations
|
---|
1343 | * will depend on the gender of aMedium.type(). */
|
---|
1344 | message (aParent, Error,
|
---|
1345 | tr ("Failed to close the %1 <nobr><b>%2</b></nobr>.")
|
---|
1346 | .arg (mediumToAccusative (aMedium.type()))
|
---|
1347 | .arg (aMedium.location()),
|
---|
1348 | formatErrorInfo (aResult));
|
---|
1349 | }
|
---|
1350 |
|
---|
1351 | void VBoxProblemReporter::cannotOpenSession (const CSession &session)
|
---|
1352 | {
|
---|
1353 | Assert (session.isNull());
|
---|
1354 |
|
---|
1355 | message (
|
---|
1356 | mainWindowShown(),
|
---|
1357 | Error,
|
---|
1358 | tr ("Failed to create a new session."),
|
---|
1359 | formatErrorInfo (session)
|
---|
1360 | );
|
---|
1361 | }
|
---|
1362 |
|
---|
1363 | void VBoxProblemReporter::cannotOpenSession (
|
---|
1364 | const CVirtualBox &vbox, const CMachine &machine,
|
---|
1365 | const CProgress &progress
|
---|
1366 | ) {
|
---|
1367 | Assert (!vbox.isOk() || progress.isOk());
|
---|
1368 |
|
---|
1369 | QString name = machine.GetName();
|
---|
1370 | if (name.isEmpty())
|
---|
1371 | name = QFileInfo (machine.GetSettingsFilePath()).baseName();
|
---|
1372 |
|
---|
1373 | message (
|
---|
1374 | mainWindowShown(),
|
---|
1375 | Error,
|
---|
1376 | tr ("Failed to open a session for the virtual machine <b>%1</b>.")
|
---|
1377 | .arg (name),
|
---|
1378 | !vbox.isOk() ? formatErrorInfo (vbox) :
|
---|
1379 | formatErrorInfo (progress.GetErrorInfo())
|
---|
1380 | );
|
---|
1381 | }
|
---|
1382 |
|
---|
1383 | void VBoxProblemReporter::cannotGetMediaAccessibility (const VBoxMedium &aMedium)
|
---|
1384 | {
|
---|
1385 | message (qApp->activeWindow(), Error,
|
---|
1386 | tr ("Failed to determine the accessibility state of the medium "
|
---|
1387 | "<nobr><b>%1</b></nobr>.")
|
---|
1388 | .arg (aMedium.location()),
|
---|
1389 | formatErrorInfo (aMedium.result()));
|
---|
1390 | }
|
---|
1391 |
|
---|
1392 | int VBoxProblemReporter::confirmDeletingHostInterface (const QString &aName,
|
---|
1393 | QWidget *aParent)
|
---|
1394 | {
|
---|
1395 | return vboxProblem().message (aParent, VBoxProblemReporter::Question,
|
---|
1396 | tr ("<p>Deleting this host-only network will remove "
|
---|
1397 | "the host-only interface this network is based on. Do you want to "
|
---|
1398 | "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>"
|
---|
1399 | "<p><b>Note:</b> this interface may be in use by one or more "
|
---|
1400 | "virtual network adapters belonging to one of your VMs. "
|
---|
1401 | "After it is removed, these adapters will no longer be usable until "
|
---|
1402 | "you correct their settings by either choosing a different interface "
|
---|
1403 | "name or a different adapter attachment type.</p>").arg (aName),
|
---|
1404 | 0, /* autoConfirmId */
|
---|
1405 | QIMessageBox::Ok | QIMessageBox::Default,
|
---|
1406 | QIMessageBox::Cancel | QIMessageBox::Escape);
|
---|
1407 | }
|
---|
1408 |
|
---|
1409 | void VBoxProblemReporter::cannotAttachUSBDevice (const CConsole &console,
|
---|
1410 | const QString &device)
|
---|
1411 | {
|
---|
1412 | /* preserve the current error info before calling the object again */
|
---|
1413 | COMResult res (console);
|
---|
1414 |
|
---|
1415 | message (mainMachineWindowShown(), Error,
|
---|
1416 | tr ("Failed to attach the USB device <b>%1</b> "
|
---|
1417 | "to the virtual machine <b>%2</b>.")
|
---|
1418 | .arg (device)
|
---|
1419 | .arg (console.GetMachine().GetName()),
|
---|
1420 | formatErrorInfo (res));
|
---|
1421 | }
|
---|
1422 |
|
---|
1423 | void VBoxProblemReporter::cannotAttachUSBDevice (const CConsole &console,
|
---|
1424 | const QString &device,
|
---|
1425 | const CVirtualBoxErrorInfo &error)
|
---|
1426 | {
|
---|
1427 | message (mainMachineWindowShown(), Error,
|
---|
1428 | tr ("Failed to attach the USB device <b>%1</b> "
|
---|
1429 | "to the virtual machine <b>%2</b>.")
|
---|
1430 | .arg (device)
|
---|
1431 | .arg (console.GetMachine().GetName()),
|
---|
1432 | formatErrorInfo (error));
|
---|
1433 | }
|
---|
1434 |
|
---|
1435 | void VBoxProblemReporter::cannotDetachUSBDevice (const CConsole &console,
|
---|
1436 | const QString &device)
|
---|
1437 | {
|
---|
1438 | /* preserve the current error info before calling the object again */
|
---|
1439 | COMResult res (console);
|
---|
1440 |
|
---|
1441 | message (mainMachineWindowShown(), Error,
|
---|
1442 | tr ("Failed to detach the USB device <b>%1</b> "
|
---|
1443 | "from the virtual machine <b>%2</b>.")
|
---|
1444 | .arg (device)
|
---|
1445 | .arg (console.GetMachine().GetName()),
|
---|
1446 | formatErrorInfo (res));
|
---|
1447 | }
|
---|
1448 |
|
---|
1449 | void VBoxProblemReporter::cannotDetachUSBDevice (const CConsole &console,
|
---|
1450 | const QString &device,
|
---|
1451 | const CVirtualBoxErrorInfo &error)
|
---|
1452 | {
|
---|
1453 | message (mainMachineWindowShown(), Error,
|
---|
1454 | tr ("Failed to detach the USB device <b>%1</b> "
|
---|
1455 | "from the virtual machine <b>%2</b>.")
|
---|
1456 | .arg (device)
|
---|
1457 | .arg (console.GetMachine().GetName()),
|
---|
1458 | formatErrorInfo (error));
|
---|
1459 | }
|
---|
1460 |
|
---|
1461 | void VBoxProblemReporter::remindAboutGuestAdditionsAreNotActive(QWidget *pParent)
|
---|
1462 | {
|
---|
1463 | message (pParent, Warning,
|
---|
1464 | tr("<p>The VirtualBox Guest Additions do not appear to be "
|
---|
1465 | "available on this virtual machine, and shared folders "
|
---|
1466 | "cannot be used without them. To use shared folders inside "
|
---|
1467 | "the virtual machine, please install the Guest Additions "
|
---|
1468 | "if they are not installed, or re-install them if they are "
|
---|
1469 | "not working correctly, by selecting <b>Install Guest Additions</b> "
|
---|
1470 | "from the <b>Machine</b> menu. "
|
---|
1471 | "If they are installed but the machine is not yet fully started "
|
---|
1472 | "then shared folders will be available once it is.</p>"),
|
---|
1473 | "remindAboutGuestAdditionsAreNotActive");
|
---|
1474 | }
|
---|
1475 |
|
---|
1476 | int VBoxProblemReporter::cannotFindGuestAdditions (const QString &aSrc1,
|
---|
1477 | const QString &aSrc2)
|
---|
1478 | {
|
---|
1479 | return message (mainMachineWindowShown(), Question,
|
---|
1480 | tr ("<p>Could not find the VirtualBox Guest Additions "
|
---|
1481 | "CD image file <nobr><b>%1</b></nobr> or "
|
---|
1482 | "<nobr><b>%2</b>.</nobr></p><p>Do you wish to "
|
---|
1483 | "download this CD image from the Internet?</p>")
|
---|
1484 | .arg (aSrc1).arg (aSrc2),
|
---|
1485 | 0, /* aAutoConfirmId */
|
---|
1486 | QIMessageBox::Yes | QIMessageBox::Default,
|
---|
1487 | QIMessageBox::No | QIMessageBox::Escape);
|
---|
1488 | }
|
---|
1489 |
|
---|
1490 | void VBoxProblemReporter::cannotDownloadGuestAdditions (const QString &aURL,
|
---|
1491 | const QString &aReason)
|
---|
1492 | {
|
---|
1493 | message (mainMachineWindowShown(), Error,
|
---|
1494 | tr ("<p>Failed to download the VirtualBox Guest Additions CD "
|
---|
1495 | "image from <nobr><a href=\"%1\">%2</a>.</nobr></p><p>%3</p>")
|
---|
1496 | .arg (aURL).arg (aURL).arg (aReason));
|
---|
1497 | }
|
---|
1498 |
|
---|
1499 | void VBoxProblemReporter::cannotMountGuestAdditions (const QString &aMachineName)
|
---|
1500 | {
|
---|
1501 | message (mainMachineWindowShown(), Error,
|
---|
1502 | tr ("<p>Could not insert the VirtualBox Guest Additions "
|
---|
1503 | "installer CD image into the virtual machine <b>%1</b>, as the machine "
|
---|
1504 | "has no CD/DVD-ROM drives. Please add a drive using the "
|
---|
1505 | "storage page of the virtual machine settings dialog.</p>")
|
---|
1506 | .arg (aMachineName));
|
---|
1507 | }
|
---|
1508 |
|
---|
1509 | bool VBoxProblemReporter::confirmDownloadAdditions (const QString &aURL,
|
---|
1510 | ulong aSize)
|
---|
1511 | {
|
---|
1512 | return messageOkCancel (mainMachineWindowShown(), Question,
|
---|
1513 | tr ("<p>Are you sure you want to download the VirtualBox "
|
---|
1514 | "Guest Additions CD image from "
|
---|
1515 | "<nobr><a href=\"%1\">%2</a></nobr> "
|
---|
1516 | "(size %3 bytes)?</p>").arg (aURL).arg (aURL).arg (aSize),
|
---|
1517 | 0, /* aAutoConfirmId */
|
---|
1518 | tr ("Download", "additions"));
|
---|
1519 | }
|
---|
1520 |
|
---|
1521 | bool VBoxProblemReporter::confirmMountAdditions (const QString &aURL,
|
---|
1522 | const QString &aSrc)
|
---|
1523 | {
|
---|
1524 | return messageOkCancel (mainMachineWindowShown(), Question,
|
---|
1525 | tr ("<p>The VirtualBox Guest Additions CD image has been "
|
---|
1526 | "successfully downloaded from "
|
---|
1527 | "<nobr><a href=\"%1\">%2</a></nobr> "
|
---|
1528 | "and saved locally as <nobr><b>%3</b>.</nobr></p>"
|
---|
1529 | "<p>Do you wish to register this CD image and mount it "
|
---|
1530 | "on the virtual CD/DVD drive?</p>")
|
---|
1531 | .arg (aURL).arg (aURL).arg (aSrc),
|
---|
1532 | 0, /* aAutoConfirmId */
|
---|
1533 | tr ("Mount", "additions"));
|
---|
1534 | }
|
---|
1535 |
|
---|
1536 | bool VBoxProblemReporter::askAboutUserManualDownload(const QString &strMissedLocation)
|
---|
1537 | {
|
---|
1538 | return messageOkCancel(mainWindowShown(), Question,
|
---|
1539 | tr("<p>Could not find the VirtualBox User Manual "
|
---|
1540 | "<nobr><b>%1</b>.</nobr></p><p>Do you wish to "
|
---|
1541 | "download this file from the Internet?</p>")
|
---|
1542 | .arg(strMissedLocation),
|
---|
1543 | 0, /* Auto-confirm Id */
|
---|
1544 | tr ("Download", "additions"));
|
---|
1545 | }
|
---|
1546 |
|
---|
1547 | bool VBoxProblemReporter::confirmUserManualDownload(const QString &strURL, ulong uSize)
|
---|
1548 | {
|
---|
1549 | return messageOkCancel(mainWindowShown(), Question,
|
---|
1550 | tr ("<p>Are you sure you want to download the VirtualBox "
|
---|
1551 | "User Manual from "
|
---|
1552 | "<nobr><a href=\"%1\">%2</a></nobr> "
|
---|
1553 | "(size %3 bytes)?</p>").arg(strURL).arg(strURL).arg(uSize),
|
---|
1554 | 0, /* Auto-confirm Id */
|
---|
1555 | tr ("Download", "additions"));
|
---|
1556 | }
|
---|
1557 |
|
---|
1558 | void VBoxProblemReporter::warnAboutUserManualCantBeDownloaded(const QString &strURL, const QString &strReason)
|
---|
1559 | {
|
---|
1560 | message(mainWindowShown(), Error,
|
---|
1561 | tr("<p>Failed to download the VirtualBox User Manual "
|
---|
1562 | "from <nobr><a href=\"%1\">%2</a>.</nobr></p><p>%3</p>")
|
---|
1563 | .arg(strURL).arg(strURL).arg(strReason));
|
---|
1564 | }
|
---|
1565 |
|
---|
1566 | void VBoxProblemReporter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget)
|
---|
1567 | {
|
---|
1568 | message(mainWindowShown(), Warning,
|
---|
1569 | tr("<p>The VirtualBox User Manual has been "
|
---|
1570 | "successfully downloaded from "
|
---|
1571 | "<nobr><a href=\"%1\">%2</a></nobr> "
|
---|
1572 | "and saved locally as <nobr><b>%3</b>.</nobr></p>")
|
---|
1573 | .arg(strURL).arg(strURL).arg(strTarget));
|
---|
1574 | }
|
---|
1575 |
|
---|
1576 | void VBoxProblemReporter::warnAboutUserManualCantBeSaved(const QString &strURL, const QString &strTarget)
|
---|
1577 | {
|
---|
1578 | message(mainWindowShown(), Error,
|
---|
1579 | tr("<p>The VirtualBox User Manual has been "
|
---|
1580 | "successfully downloaded from "
|
---|
1581 | "<nobr><a href=\"%1\">%2</a></nobr> "
|
---|
1582 | "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>"
|
---|
1583 | "<p>Please choose another location for that file.</p>")
|
---|
1584 | .arg(strURL).arg(strURL).arg(strTarget));
|
---|
1585 | }
|
---|
1586 |
|
---|
1587 | void VBoxProblemReporter::cannotConnectRegister (QWidget *aParent,
|
---|
1588 | const QString &aURL,
|
---|
1589 | const QString &aReason)
|
---|
1590 | {
|
---|
1591 | /* we don't want to expose the registration script URL to the user
|
---|
1592 | * if he simply doesn't have an internet connection */
|
---|
1593 | Q_UNUSED (aURL);
|
---|
1594 |
|
---|
1595 | message (aParent, Error,
|
---|
1596 | tr ("<p>Failed to connect to the VirtualBox online "
|
---|
1597 | "registration service due to the following error:</p><p><b>%1</b></p>")
|
---|
1598 | .arg (aReason));
|
---|
1599 | }
|
---|
1600 |
|
---|
1601 | void VBoxProblemReporter::showRegisterResult (QWidget *aParent,
|
---|
1602 | const QString &aResult)
|
---|
1603 | {
|
---|
1604 | if (aResult == "OK")
|
---|
1605 | {
|
---|
1606 | /* On successful registration attempt */
|
---|
1607 | message (aParent, Info,
|
---|
1608 | tr ("<p>Congratulations! You have been successfully registered "
|
---|
1609 | "as a user of VirtualBox.</p>"
|
---|
1610 | "<p>Thank you for finding time to fill out the "
|
---|
1611 | "registration form!</p>"));
|
---|
1612 | }
|
---|
1613 | else
|
---|
1614 | {
|
---|
1615 | QString parsed;
|
---|
1616 |
|
---|
1617 | /* Else parse and translate special key-words */
|
---|
1618 | if (aResult == "AUTHFAILED")
|
---|
1619 | parsed = tr ("<p>Invalid e-mail address or password specified.</p>");
|
---|
1620 |
|
---|
1621 | message (aParent, Error,
|
---|
1622 | tr ("<p>Failed to register the VirtualBox product.</p><p>%1</p>")
|
---|
1623 | .arg (parsed.isNull() ? aResult : parsed));
|
---|
1624 | }
|
---|
1625 | }
|
---|
1626 |
|
---|
1627 | void VBoxProblemReporter::showUpdateSuccess (QWidget *aParent,
|
---|
1628 | const QString &aVersion,
|
---|
1629 | const QString &aLink)
|
---|
1630 | {
|
---|
1631 | message (aParent, Info,
|
---|
1632 | tr ("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href=\"http://www.virtualbox.org/\">virtualbox.org</a>.</p>"
|
---|
1633 | "<p>You can download this version using the link:</p>"
|
---|
1634 | "<p><a href=%2>%3</a></p>")
|
---|
1635 | .arg (aVersion, aLink, aLink));
|
---|
1636 | }
|
---|
1637 |
|
---|
1638 | void VBoxProblemReporter::showUpdateFailure (QWidget *aParent,
|
---|
1639 | const QString &aReason)
|
---|
1640 | {
|
---|
1641 | message (aParent, Error,
|
---|
1642 | tr ("<p>Unable to obtain the new version information "
|
---|
1643 | "due to the following error:</p><p><b>%1</b></p>")
|
---|
1644 | .arg (aReason));
|
---|
1645 | }
|
---|
1646 |
|
---|
1647 | void VBoxProblemReporter::showUpdateNotFound (QWidget *aParent)
|
---|
1648 | {
|
---|
1649 | message (aParent, Info,
|
---|
1650 | tr ("You are already running the most recent version of VirtualBox."
|
---|
1651 | ""));
|
---|
1652 | }
|
---|
1653 |
|
---|
1654 | /**
|
---|
1655 | * @return @c true if the user has confirmed input capture (this is always
|
---|
1656 | * the case if the dialog was autoconfirmed). @a aAutoConfirmed, when not
|
---|
1657 | * NULL, will receive @c true if the dialog wasn't actually shown.
|
---|
1658 | */
|
---|
1659 | bool VBoxProblemReporter::confirmInputCapture (bool *aAutoConfirmed /* = NULL */)
|
---|
1660 | {
|
---|
1661 | int rc = message (mainMachineWindowShown(), Info,
|
---|
1662 | tr ("<p>You have <b>clicked the mouse</b> inside the Virtual Machine display "
|
---|
1663 | "or pressed the <b>host key</b>. This will cause the Virtual Machine to "
|
---|
1664 | "<b>capture</b> the host mouse pointer (only if the mouse pointer "
|
---|
1665 | "integration is not currently supported by the guest OS) and the "
|
---|
1666 | "keyboard, which will make them unavailable to other applications "
|
---|
1667 | "running on your host machine."
|
---|
1668 | "</p>"
|
---|
1669 | "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the "
|
---|
1670 | "keyboard and mouse (if it is captured) and return them to normal "
|
---|
1671 | "operation. The currently assigned host key is shown on the status bar "
|
---|
1672 | "at the bottom of the Virtual Machine window, next to the "
|
---|
1673 | "<img src=:/hostkey_16px.png/> icon. This icon, together "
|
---|
1674 | "with the mouse icon placed nearby, indicate the current keyboard "
|
---|
1675 | "and mouse capture state."
|
---|
1676 | "</p>") +
|
---|
1677 | tr ("<p>The host key is currently defined as <b>%1</b>.</p>",
|
---|
1678 | "additional message box paragraph")
|
---|
1679 | .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())),
|
---|
1680 | "confirmInputCapture",
|
---|
1681 | QIMessageBox::Ok | QIMessageBox::Default,
|
---|
1682 | QIMessageBox::Cancel | QIMessageBox::Escape,
|
---|
1683 | 0,
|
---|
1684 | tr ("Capture", "do input capture"));
|
---|
1685 |
|
---|
1686 | if (aAutoConfirmed)
|
---|
1687 | *aAutoConfirmed = (rc & AutoConfirmed);
|
---|
1688 |
|
---|
1689 | return (rc & QIMessageBox::ButtonMask) == QIMessageBox::Ok;
|
---|
1690 | }
|
---|
1691 |
|
---|
1692 | void VBoxProblemReporter::remindAboutAutoCapture()
|
---|
1693 | {
|
---|
1694 | message (mainMachineWindowShown(), Info,
|
---|
1695 | tr ("<p>You have the <b>Auto capture keyboard</b> option turned on. "
|
---|
1696 | "This will cause the Virtual Machine to automatically <b>capture</b> "
|
---|
1697 | "the keyboard every time the VM window is activated and make it "
|
---|
1698 | "unavailable to other applications running on your host machine: "
|
---|
1699 | "when the keyboard is captured, all keystrokes (including system ones "
|
---|
1700 | "like Alt-Tab) will be directed to the VM."
|
---|
1701 | "</p>"
|
---|
1702 | "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the "
|
---|
1703 | "keyboard and mouse (if it is captured) and return them to normal "
|
---|
1704 | "operation. The currently assigned host key is shown on the status bar "
|
---|
1705 | "at the bottom of the Virtual Machine window, next to the "
|
---|
1706 | "<img src=:/hostkey_16px.png/> icon. This icon, together "
|
---|
1707 | "with the mouse icon placed nearby, indicate the current keyboard "
|
---|
1708 | "and mouse capture state."
|
---|
1709 | "</p>") +
|
---|
1710 | tr ("<p>The host key is currently defined as <b>%1</b>.</p>",
|
---|
1711 | "additional message box paragraph")
|
---|
1712 | .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())),
|
---|
1713 | "remindAboutAutoCapture");
|
---|
1714 | }
|
---|
1715 |
|
---|
1716 | void VBoxProblemReporter::remindAboutMouseIntegration (bool aSupportsAbsolute)
|
---|
1717 | {
|
---|
1718 | if (isAlreadyShown("remindAboutMouseIntegration"))
|
---|
1719 | return;
|
---|
1720 | setShownStatus("remindAboutMouseIntegration");
|
---|
1721 |
|
---|
1722 | static const char *kNames [2] =
|
---|
1723 | {
|
---|
1724 | "remindAboutMouseIntegrationOff",
|
---|
1725 | "remindAboutMouseIntegrationOn"
|
---|
1726 | };
|
---|
1727 |
|
---|
1728 | /* Close the previous (outdated) window if any. We use kName as
|
---|
1729 | * aAutoConfirmId which is also used as the widget name by default. */
|
---|
1730 | {
|
---|
1731 | QWidget *outdated =
|
---|
1732 | VBoxGlobal::findWidget (NULL, kNames [int (!aSupportsAbsolute)],
|
---|
1733 | "QIMessageBox");
|
---|
1734 | if (outdated)
|
---|
1735 | outdated->close();
|
---|
1736 | }
|
---|
1737 |
|
---|
1738 | if (aSupportsAbsolute)
|
---|
1739 | {
|
---|
1740 | message (mainMachineWindowShown(), Info,
|
---|
1741 | tr ("<p>The Virtual Machine reports that the guest OS supports "
|
---|
1742 | "<b>mouse pointer integration</b>. This means that you do not "
|
---|
1743 | "need to <i>capture</i> the mouse pointer to be able to use it "
|
---|
1744 | "in your guest OS -- all "
|
---|
1745 | "mouse actions you perform when the mouse pointer is over the "
|
---|
1746 | "Virtual Machine's display are directly sent to the guest OS. "
|
---|
1747 | "If the mouse is currently captured, it will be automatically "
|
---|
1748 | "uncaptured."
|
---|
1749 | "</p>"
|
---|
1750 | "<p>The mouse icon on the status bar will look like "
|
---|
1751 | "<img src=:/mouse_seamless_16px.png/> to inform you that mouse "
|
---|
1752 | "pointer integration is supported by the guest OS and is "
|
---|
1753 | "currently turned on."
|
---|
1754 | "</p>"
|
---|
1755 | "<p><b>Note</b>: Some applications may behave incorrectly in "
|
---|
1756 | "mouse pointer integration mode. You can always disable it for "
|
---|
1757 | "the current session (and enable it again) by selecting the "
|
---|
1758 | "corresponding action from the menu bar."
|
---|
1759 | "</p>"),
|
---|
1760 | kNames [1] /* aAutoConfirmId */);
|
---|
1761 | }
|
---|
1762 | else
|
---|
1763 | {
|
---|
1764 | message (mainMachineWindowShown(), Info,
|
---|
1765 | tr ("<p>The Virtual Machine reports that the guest OS does not "
|
---|
1766 | "support <b>mouse pointer integration</b> in the current video "
|
---|
1767 | "mode. You need to capture the mouse (by clicking over the VM "
|
---|
1768 | "display or pressing the host key) in order to use the "
|
---|
1769 | "mouse inside the guest OS.</p>"),
|
---|
1770 | kNames [0] /* aAutoConfirmId */);
|
---|
1771 | }
|
---|
1772 |
|
---|
1773 | clearShownStatus("remindAboutMouseIntegration");
|
---|
1774 | }
|
---|
1775 |
|
---|
1776 | /**
|
---|
1777 | * @return @c false if the dialog wasn't actually shown (i.e. it was
|
---|
1778 | * autoconfirmed).
|
---|
1779 | */
|
---|
1780 | bool VBoxProblemReporter::remindAboutPausedVMInput()
|
---|
1781 | {
|
---|
1782 | int rc = message (
|
---|
1783 | mainMachineWindowShown(),
|
---|
1784 | Info,
|
---|
1785 | tr (
|
---|
1786 | "<p>The Virtual Machine is currently in the <b>Paused</b> state and "
|
---|
1787 | "not able to see any keyboard or mouse input. If you want to "
|
---|
1788 | "continue to work inside the VM, you need to resume it by selecting the "
|
---|
1789 | "corresponding action from the menu bar.</p>"
|
---|
1790 | ),
|
---|
1791 | "remindAboutPausedVMInput"
|
---|
1792 | );
|
---|
1793 | return !(rc & AutoConfirmed);
|
---|
1794 | }
|
---|
1795 |
|
---|
1796 | /** @return true if the user has chosen to show the Disk Manager Window */
|
---|
1797 | bool VBoxProblemReporter::remindAboutInaccessibleMedia()
|
---|
1798 | {
|
---|
1799 | int rc = message (&vboxGlobal().selectorWnd(), Warning,
|
---|
1800 | tr ("<p>One or more virtual hard disks, CD/DVD or "
|
---|
1801 | "floppy media are not currently accessible. As a result, you will "
|
---|
1802 | "not be able to operate virtual machines that use these media until "
|
---|
1803 | "they become accessible later.</p>"
|
---|
1804 | "<p>Press <b>Check</b> to open the Virtual Media Manager window and "
|
---|
1805 | "see what media are inaccessible, or press <b>Ignore</b> to "
|
---|
1806 | "ignore this message.</p>"),
|
---|
1807 | "remindAboutInaccessibleMedia",
|
---|
1808 | QIMessageBox::Ok | QIMessageBox::Default,
|
---|
1809 | QIMessageBox::Ignore | QIMessageBox::Escape,
|
---|
1810 | 0,
|
---|
1811 | tr ("Check", "inaccessible media message box"));
|
---|
1812 |
|
---|
1813 | return rc == QIMessageBox::Ok; /* implies !AutoConfirmed */
|
---|
1814 | }
|
---|
1815 |
|
---|
1816 | /**
|
---|
1817 | * Shows user a proposal to either convert configuration files or
|
---|
1818 | * Exit the application leaving all as already is.
|
---|
1819 | *
|
---|
1820 | * @param aFileList List of files for auto-conversion (may use Qt HTML).
|
---|
1821 | * @param aAfterRefresh @true when called after the VM refresh.
|
---|
1822 | *
|
---|
1823 | * @return QIMessageBox::Ok (Save + Backup), QIMessageBox::Cancel (Exit)
|
---|
1824 | */
|
---|
1825 | int VBoxProblemReporter::warnAboutSettingsAutoConversion (const QString &aFileList,
|
---|
1826 | bool aAfterRefresh)
|
---|
1827 | {
|
---|
1828 | if (!aAfterRefresh)
|
---|
1829 | {
|
---|
1830 | /* Common variant for all VMs */
|
---|
1831 | return message (mainWindowShown(), Info,
|
---|
1832 | tr ("<p>Your existing VirtualBox settings files will be automatically "
|
---|
1833 | "converted from the old format to a new format required by the "
|
---|
1834 | "new version of VirtualBox.</p>"
|
---|
1835 | "<p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if "
|
---|
1836 | "you want to terminate the VirtualBox "
|
---|
1837 | "application without any further actions.</p>"),
|
---|
1838 | NULL /* aAutoConfirmId */,
|
---|
1839 | QIMessageBox::Ok | QIMessageBox::Default,
|
---|
1840 | QIMessageBox::Cancel | QIMessageBox::Escape,
|
---|
1841 | 0,
|
---|
1842 | 0,
|
---|
1843 | tr ("E&xit", "warnAboutSettingsAutoConversion message box"));
|
---|
1844 | }
|
---|
1845 | else
|
---|
1846 | {
|
---|
1847 | /* Particular VM variant */
|
---|
1848 | return message (mainWindowShown(), Info,
|
---|
1849 | tr ("<p>The following VirtualBox settings files will be automatically "
|
---|
1850 | "converted from the old format to a new format required by the "
|
---|
1851 | "new version of VirtualBox.</p>"
|
---|
1852 | "<p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if "
|
---|
1853 | "you want to terminate the VirtualBox "
|
---|
1854 | "application without any further actions.</p>"),
|
---|
1855 | QString ("<!--EOM-->%1").arg (aFileList),
|
---|
1856 | NULL /* aAutoConfirmId */,
|
---|
1857 | QIMessageBox::Ok | QIMessageBox::Default,
|
---|
1858 | QIMessageBox::Cancel | QIMessageBox::Escape,
|
---|
1859 | 0,
|
---|
1860 | 0,
|
---|
1861 | tr ("E&xit", "warnAboutSettingsAutoConversion message box"));
|
---|
1862 | }
|
---|
1863 | }
|
---|
1864 |
|
---|
1865 | /**
|
---|
1866 | * @param aHotKey Fullscreen hot key as defined in the menu.
|
---|
1867 | *
|
---|
1868 | * @return @c true if the user has chosen to go fullscreen (this is always
|
---|
1869 | * the case if the dialog was autoconfirmed).
|
---|
1870 | */
|
---|
1871 | bool VBoxProblemReporter::confirmGoingFullscreen (const QString &aHotKey)
|
---|
1872 | {
|
---|
1873 | return messageOkCancel (mainMachineWindowShown(), Info,
|
---|
1874 | tr ("<p>The virtual machine window will be now switched to "
|
---|
1875 | "<b>fullscreen</b> mode. "
|
---|
1876 | "You can go back to windowed mode at any time by pressing "
|
---|
1877 | "<b>%1</b>. Note that the <i>Host</i> key is currently "
|
---|
1878 | "defined as <b>%2</b>.</p>"
|
---|
1879 | "<p>Note that the main menu bar is hidden in fullscreen mode. You "
|
---|
1880 | "can access it by pressing <b>Host+Home</b>.</p>")
|
---|
1881 | .arg (aHotKey)
|
---|
1882 | .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())),
|
---|
1883 | "confirmGoingFullscreen",
|
---|
1884 | tr ("Switch", "fullscreen"));
|
---|
1885 | }
|
---|
1886 |
|
---|
1887 | /**
|
---|
1888 | * @param aHotKey Seamless hot key as defined in the menu.
|
---|
1889 | *
|
---|
1890 | * @return @c true if the user has chosen to go seamless (this is always
|
---|
1891 | * the case if the dialog was autoconfirmed).
|
---|
1892 | */
|
---|
1893 | bool VBoxProblemReporter::confirmGoingSeamless (const QString &aHotKey)
|
---|
1894 | {
|
---|
1895 | return messageOkCancel (mainMachineWindowShown(), Info,
|
---|
1896 | tr ("<p>The virtual machine window will be now switched to "
|
---|
1897 | "<b>Seamless</b> mode. "
|
---|
1898 | "You can go back to windowed mode at any time by pressing "
|
---|
1899 | "<b>%1</b>. Note that the <i>Host</i> key is currently "
|
---|
1900 | "defined as <b>%2</b>.</p>"
|
---|
1901 | "<p>Note that the main menu bar is hidden in seamless mode. You "
|
---|
1902 | "can access it by pressing <b>Host+Home</b>.</p>")
|
---|
1903 | .arg (aHotKey)
|
---|
1904 | .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())),
|
---|
1905 | "confirmGoingSeamless",
|
---|
1906 | tr ("Switch", "seamless"));
|
---|
1907 | }
|
---|
1908 |
|
---|
1909 | /**
|
---|
1910 | * Returns @c true if the user has selected to power off the machine.
|
---|
1911 | */
|
---|
1912 | bool VBoxProblemReporter::remindAboutGuruMeditation (const CConsole &aConsole,
|
---|
1913 | const QString &aLogFolder)
|
---|
1914 | {
|
---|
1915 | Q_UNUSED (aConsole);
|
---|
1916 |
|
---|
1917 | int rc = message (mainMachineWindowShown(), GuruMeditation,
|
---|
1918 | tr ("<p>A critical error has occurred while running the virtual "
|
---|
1919 | "machine and the machine execution has been stopped.</p>"
|
---|
1920 | ""
|
---|
1921 | "<p>For help, please see the Community section on "
|
---|
1922 | "<a href=http://www.virtualbox.org>http://www.virtualbox.org</a> "
|
---|
1923 | "or your support contract. Please provide the contents of the "
|
---|
1924 | "log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, "
|
---|
1925 | "which you can find in the <nobr><b>%1</b></nobr> directory, "
|
---|
1926 | "as well as a description of what you were doing when this error "
|
---|
1927 | "happened. "
|
---|
1928 | ""
|
---|
1929 | "Note that you can also access the above files by selecting "
|
---|
1930 | "<b>Show Log</b> from the <b>Machine</b> menu of the main "
|
---|
1931 | "VirtualBox window.</p>"
|
---|
1932 | ""
|
---|
1933 | "<p>Press <b>OK</b> if you want to power off the machine "
|
---|
1934 | "or press <b>Ignore</b> if you want to leave it as is for debugging. "
|
---|
1935 | "Please note that debugging requires special knowledge and tools, so "
|
---|
1936 | "it is recommended to press <b>OK</b> now.</p>")
|
---|
1937 | .arg (aLogFolder),
|
---|
1938 | 0, /* aAutoConfirmId */
|
---|
1939 | QIMessageBox::Ok | QIMessageBox::Default,
|
---|
1940 | QIMessageBox::Ignore | QIMessageBox::Escape);
|
---|
1941 |
|
---|
1942 | return rc == QIMessageBox::Ok;
|
---|
1943 | }
|
---|
1944 |
|
---|
1945 | /**
|
---|
1946 | * @return @c true if the user has selected to reset the machine.
|
---|
1947 | */
|
---|
1948 | bool VBoxProblemReporter::confirmVMReset (QWidget *aParent)
|
---|
1949 | {
|
---|
1950 | return messageOkCancel (aParent ? aParent : mainMachineWindowShown(), Question,
|
---|
1951 | tr ("<p>Do you really want to reset the virtual machine?</p>"
|
---|
1952 | "<p>This will cause any unsaved data in applications running inside "
|
---|
1953 | "it to be lost.</p>"),
|
---|
1954 | "confirmVMReset" /* aAutoConfirmId */,
|
---|
1955 | tr ("Reset", "machine"));
|
---|
1956 | }
|
---|
1957 |
|
---|
1958 | /**
|
---|
1959 | * @return @c true if the user has selected to continue without attaching a
|
---|
1960 | * hard disk.
|
---|
1961 | */
|
---|
1962 | bool VBoxProblemReporter::confirmHardDisklessMachine (QWidget *aParent)
|
---|
1963 | {
|
---|
1964 | return message (aParent, Warning,
|
---|
1965 | tr ("<p>You didn't attach a hard disk to the new virtual machine. "
|
---|
1966 | "The machine will not be able to boot unless you attach "
|
---|
1967 | "a hard disk with a guest operating system or some other bootable "
|
---|
1968 | "media to it later using the machine settings dialog or the First "
|
---|
1969 | "Run Wizard.</p><p>Do you wish to continue?</p>"),
|
---|
1970 | 0, /* aAutoConfirmId */
|
---|
1971 | QIMessageBox::Ok,
|
---|
1972 | QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape,
|
---|
1973 | 0,
|
---|
1974 | tr ("Continue", "no hard disk attached"),
|
---|
1975 | tr ("Go Back", "no hard disk attached")) == QIMessageBox::Ok;
|
---|
1976 | }
|
---|
1977 |
|
---|
1978 | void VBoxProblemReporter::cannotRunInSelectorMode()
|
---|
1979 | {
|
---|
1980 | message (mainWindowShown(), Critical,
|
---|
1981 | tr ("<p>Cannot run VirtualBox in <i>VM Selector</i> "
|
---|
1982 | "mode due to local restrictions.</p>"
|
---|
1983 | "<p>The application will now terminate.</p>"));
|
---|
1984 | }
|
---|
1985 |
|
---|
1986 | void VBoxProblemReporter::cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent /* = NULL */) const
|
---|
1987 | {
|
---|
1988 | if (aAppliance->isNull())
|
---|
1989 | {
|
---|
1990 | message (aParent ? aParent : mainWindowShown(),
|
---|
1991 | Error,
|
---|
1992 | tr ("Failed to open appliance."));
|
---|
1993 | }else
|
---|
1994 | {
|
---|
1995 | /* Preserve the current error info before calling the object again */
|
---|
1996 | COMResult res (*aAppliance);
|
---|
1997 |
|
---|
1998 | /* Add the warnings in the case of an early error */
|
---|
1999 | QVector<QString> w = aAppliance->GetWarnings();
|
---|
2000 | QString wstr;
|
---|
2001 | foreach (const QString &str, w)
|
---|
2002 | wstr += QString ("<br />Warning: %1").arg (str);
|
---|
2003 | if (!wstr.isEmpty())
|
---|
2004 | wstr = "<br />" + wstr;
|
---|
2005 |
|
---|
2006 | message (aParent ? aParent : mainWindowShown(),
|
---|
2007 | Error,
|
---|
2008 | tr ("Failed to open/interpret appliance <b>%1</b>.").arg (aAppliance->GetPath()),
|
---|
2009 | wstr +
|
---|
2010 | formatErrorInfo (res));
|
---|
2011 | }
|
---|
2012 | }
|
---|
2013 |
|
---|
2014 | void VBoxProblemReporter::cannotImportAppliance (const CProgress &aProgress, CAppliance* aAppliance, QWidget *aParent /* = NULL */) const
|
---|
2015 | {
|
---|
2016 | AssertWrapperOk (aProgress);
|
---|
2017 |
|
---|
2018 | message (aParent ? aParent : mainWindowShown(),
|
---|
2019 | Error,
|
---|
2020 | tr ("Failed to import appliance <b>%1</b>.").arg (aAppliance->GetPath()),
|
---|
2021 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
2022 | }
|
---|
2023 |
|
---|
2024 | void VBoxProblemReporter::cannotCheckFiles (const CProgress &aProgress, QWidget *aParent /* = NULL */) const
|
---|
2025 | {
|
---|
2026 | AssertWrapperOk (aProgress);
|
---|
2027 |
|
---|
2028 | message (aParent ? aParent : mainWindowShown(),
|
---|
2029 | Error,
|
---|
2030 | tr ("Failed to check files."),
|
---|
2031 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
2032 | }
|
---|
2033 |
|
---|
2034 | void VBoxProblemReporter::cannotRemoveFiles (const CProgress &aProgress, QWidget *aParent /* = NULL */) const
|
---|
2035 | {
|
---|
2036 | AssertWrapperOk (aProgress);
|
---|
2037 |
|
---|
2038 | message (aParent ? aParent : mainWindowShown(),
|
---|
2039 | Error,
|
---|
2040 | tr ("Failed to remove file."),
|
---|
2041 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
2042 | }
|
---|
2043 |
|
---|
2044 | bool VBoxProblemReporter::confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget * /* aParent = NULL */) const
|
---|
2045 | {
|
---|
2046 | return messageOkCancel(mainWindowShown(), Warning,
|
---|
2047 | tr("<p>The virtual machine(s) <b>%1</b> are currently in a saved state.</p>"
|
---|
2048 | "<p>If you continue the runtime state of the exported machine(s) "
|
---|
2049 | "will be discarded. Note that the existing machine(s) are not "
|
---|
2050 | "changed.</p>", "",
|
---|
2051 | machineNames.size()).arg(VBoxGlobal::toHumanReadableList(machineNames)),
|
---|
2052 | 0 /* aAutoConfirmId */,
|
---|
2053 | tr("Continue"), tr("Cancel"));
|
---|
2054 | }
|
---|
2055 |
|
---|
2056 | void VBoxProblemReporter::cannotExportAppliance (CAppliance *aAppliance, QWidget *aParent /* = NULL */) const
|
---|
2057 | {
|
---|
2058 | if (aAppliance->isNull())
|
---|
2059 | {
|
---|
2060 | message (aParent ? aParent : mainWindowShown(),
|
---|
2061 | Error,
|
---|
2062 | tr ("Failed to create appliance."));
|
---|
2063 | }else
|
---|
2064 | {
|
---|
2065 | /* Preserve the current error info before calling the object again */
|
---|
2066 | COMResult res (*aAppliance);
|
---|
2067 |
|
---|
2068 | message (aParent ? aParent : mainWindowShown(),
|
---|
2069 | Error,
|
---|
2070 | tr ("Failed to prepare the export of the appliance <b>%1</b>.").arg (aAppliance->GetPath()),
|
---|
2071 | formatErrorInfo (res));
|
---|
2072 | }
|
---|
2073 | }
|
---|
2074 |
|
---|
2075 | void VBoxProblemReporter::cannotExportAppliance (const CMachine &aMachine, CAppliance *aAppliance, QWidget *aParent /* = NULL */) const
|
---|
2076 | {
|
---|
2077 | if (aAppliance->isNull() ||
|
---|
2078 | aMachine.isNull())
|
---|
2079 | {
|
---|
2080 | message (aParent ? aParent : mainWindowShown(),
|
---|
2081 | Error,
|
---|
2082 | tr ("Failed to create an appliance."));
|
---|
2083 | }else
|
---|
2084 | {
|
---|
2085 | message (aParent ? aParent : mainWindowShown(),
|
---|
2086 | Error,
|
---|
2087 | tr ("Failed to prepare the export of the appliance <b>%1</b>.").arg (aAppliance->GetPath()),
|
---|
2088 | formatErrorInfo (aMachine));
|
---|
2089 | }
|
---|
2090 | }
|
---|
2091 |
|
---|
2092 | void VBoxProblemReporter::cannotExportAppliance (const CProgress &aProgress, CAppliance* aAppliance, QWidget *aParent /* = NULL */) const
|
---|
2093 | {
|
---|
2094 | AssertWrapperOk (aProgress);
|
---|
2095 |
|
---|
2096 | message (aParent ? aParent : mainWindowShown(),
|
---|
2097 | Error,
|
---|
2098 | tr ("Failed to export appliance <b>%1</b>.").arg (aAppliance->GetPath()),
|
---|
2099 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
2100 | }
|
---|
2101 |
|
---|
2102 | void VBoxProblemReporter::cannotUpdateGuestAdditions (const CProgress &aProgress, QWidget *aParent /* = NULL */) const
|
---|
2103 | {
|
---|
2104 | AssertWrapperOk (aProgress);
|
---|
2105 |
|
---|
2106 | message (aParent ? aParent : mainWindowShown(),
|
---|
2107 | Error,
|
---|
2108 | tr ("Failed to update Guest Additions. The Guest Additions installation image will be mounted to provide a manual installation."),
|
---|
2109 | formatErrorInfo (aProgress.GetErrorInfo()));
|
---|
2110 | }
|
---|
2111 |
|
---|
2112 | void VBoxProblemReporter::cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent /* = 0 */)
|
---|
2113 | {
|
---|
2114 | message (pParent ? pParent : mainWindowShown(),
|
---|
2115 | Error,
|
---|
2116 | tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
|
---|
2117 | formatErrorInfo(extPackManager));
|
---|
2118 | }
|
---|
2119 |
|
---|
2120 | void VBoxProblemReporter::badExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent /* = 0 */)
|
---|
2121 | {
|
---|
2122 | message (pParent ? pParent : mainWindowShown(),
|
---|
2123 | Error,
|
---|
2124 | tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
|
---|
2125 | extPackFile.GetWhyUnusable());
|
---|
2126 | }
|
---|
2127 |
|
---|
2128 | void VBoxProblemReporter::cannotInstallExtPack(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent /* = 0 */)
|
---|
2129 | {
|
---|
2130 | message (pParent ? pParent : mainWindowShown(),
|
---|
2131 | Error,
|
---|
2132 | tr("Failed to install the Extension Pack <b>%1</b>.").arg(strFilename),
|
---|
2133 | formatErrorInfo(extPackFile));
|
---|
2134 | }
|
---|
2135 |
|
---|
2136 | void VBoxProblemReporter::cannotUninstallExtPack(const QString &strPackName, const CExtPackManager &extPackManager, QWidget *pParent /* = 0 */)
|
---|
2137 | {
|
---|
2138 | message (pParent ? pParent : mainWindowShown(),
|
---|
2139 | Error,
|
---|
2140 | tr("Failed to uninstall the Extension Pack <b>%1</b>.").arg(strPackName),
|
---|
2141 | formatErrorInfo(extPackManager));
|
---|
2142 | }
|
---|
2143 |
|
---|
2144 | bool VBoxProblemReporter::confirmRemovingPackage(const QString &strPackName, QWidget *pParent /* = 0 */)
|
---|
2145 | {
|
---|
2146 | return messageOkCancel (pParent ? pParent : mainWindowShown(),
|
---|
2147 | Question,
|
---|
2148 | tr("You are about to remove the Extension Pack <b>%1</b>. Are you sure you want to do that?").arg(strPackName),
|
---|
2149 | 0,
|
---|
2150 | tr("&Remove"));
|
---|
2151 | }
|
---|
2152 |
|
---|
2153 | void VBoxProblemReporter::warnAboutIncorrectPort (QWidget *pParent) const
|
---|
2154 | {
|
---|
2155 | message(pParent, Error,
|
---|
2156 | tr("The current port forwarding rules are not valid. "
|
---|
2157 | "None of the host or guest port values may be set to zero."));
|
---|
2158 | }
|
---|
2159 |
|
---|
2160 | bool VBoxProblemReporter::confirmCancelingPortForwardingDialog (QWidget *pParent) const
|
---|
2161 | {
|
---|
2162 | return messageOkCancel(pParent, Question,
|
---|
2163 | tr("<p>There are unsaved changes in the port forwarding configuration.</p>"
|
---|
2164 | "<p>If you proceed your changes will be discarded.</p>"));
|
---|
2165 | }
|
---|
2166 |
|
---|
2167 | void VBoxProblemReporter::showRuntimeError (const CConsole &aConsole, bool fatal,
|
---|
2168 | const QString &errorID,
|
---|
2169 | const QString &errorMsg) const
|
---|
2170 | {
|
---|
2171 | /// @todo (r=dmik) it's just a preliminary box. We need to:
|
---|
2172 | // - for fatal errors and non-fatal with-retry errors, listen for a
|
---|
2173 | // VM state signal to automatically close the message if the VM
|
---|
2174 | // (externally) leaves the Paused state while it is shown.
|
---|
2175 | // - make warning messages modeless
|
---|
2176 | // - add common buttons like Retry/Save/PowerOff/whatever
|
---|
2177 |
|
---|
2178 | QByteArray autoConfimId = "showRuntimeError.";
|
---|
2179 |
|
---|
2180 | CConsole console = aConsole;
|
---|
2181 | KMachineState state = console.GetState();
|
---|
2182 | Type type;
|
---|
2183 | QString severity;
|
---|
2184 |
|
---|
2185 | if (fatal)
|
---|
2186 | {
|
---|
2187 | /* the machine must be paused on fatal errors */
|
---|
2188 | Assert (state == KMachineState_Paused);
|
---|
2189 | if (state != KMachineState_Paused)
|
---|
2190 | console.Pause();
|
---|
2191 | type = Critical;
|
---|
2192 | severity = tr ("<nobr>Fatal Error</nobr>", "runtime error info");
|
---|
2193 | autoConfimId += "fatal.";
|
---|
2194 | }
|
---|
2195 | else if (state == KMachineState_Paused)
|
---|
2196 | {
|
---|
2197 | type = Error;
|
---|
2198 | severity = tr ("<nobr>Non-Fatal Error</nobr>", "runtime error info");
|
---|
2199 | autoConfimId += "error.";
|
---|
2200 | }
|
---|
2201 | else
|
---|
2202 | {
|
---|
2203 | type = Warning;
|
---|
2204 | severity = tr ("<nobr>Warning</nobr>", "runtime error info");
|
---|
2205 | autoConfimId += "warning.";
|
---|
2206 | }
|
---|
2207 |
|
---|
2208 | autoConfimId += errorID.toUtf8();
|
---|
2209 |
|
---|
2210 | QString formatted ("<!--EOM-->");
|
---|
2211 |
|
---|
2212 | if (!errorMsg.isEmpty())
|
---|
2213 | formatted.prepend (QString ("<p>%1.</p>").arg (vboxGlobal().emphasize (errorMsg)));
|
---|
2214 |
|
---|
2215 | if (!errorID.isEmpty())
|
---|
2216 | formatted += QString ("<table bgcolor=#EEEEEE border=0 cellspacing=0 "
|
---|
2217 | "cellpadding=0 width=100%>"
|
---|
2218 | "<tr><td>%1</td><td>%2</td></tr>"
|
---|
2219 | "<tr><td>%3</td><td>%4</td></tr>"
|
---|
2220 | "</table>")
|
---|
2221 | .arg (tr ("<nobr>Error ID: </nobr>", "runtime error info"),
|
---|
2222 | errorID)
|
---|
2223 | .arg (tr ("Severity: ", "runtime error info"),
|
---|
2224 | severity);
|
---|
2225 |
|
---|
2226 | if (!formatted.isEmpty())
|
---|
2227 | formatted = "<qt>" + formatted + "</qt>";
|
---|
2228 |
|
---|
2229 | int rc = 0;
|
---|
2230 |
|
---|
2231 | if (type == Critical)
|
---|
2232 | {
|
---|
2233 | rc = message (mainMachineWindowShown(), type,
|
---|
2234 | tr ("<p>A fatal error has occurred during virtual machine execution! "
|
---|
2235 | "The virtual machine will be powered off. Please copy the "
|
---|
2236 | "following error message using the clipboard to help diagnose "
|
---|
2237 | "the problem:</p>"),
|
---|
2238 | formatted, autoConfimId.data());
|
---|
2239 |
|
---|
2240 | /* always power down after a fatal error */
|
---|
2241 | console.PowerDown();
|
---|
2242 | }
|
---|
2243 | else if (type == Error)
|
---|
2244 | {
|
---|
2245 | rc = message (mainMachineWindowShown(), type,
|
---|
2246 | tr ("<p>An error has occurred during virtual machine execution! "
|
---|
2247 | "The error details are shown below. You may try to correct "
|
---|
2248 | "the error and resume the virtual machine "
|
---|
2249 | "execution.</p>"),
|
---|
2250 | formatted, autoConfimId.data());
|
---|
2251 | }
|
---|
2252 | else
|
---|
2253 | {
|
---|
2254 | rc = message (mainMachineWindowShown(), type,
|
---|
2255 | tr ("<p>The virtual machine execution may run into an error "
|
---|
2256 | "condition as described below. "
|
---|
2257 | "We suggest that you take "
|
---|
2258 | "an appropriate action to avert the error."
|
---|
2259 | "</p>"),
|
---|
2260 | formatted, autoConfimId.data());
|
---|
2261 | }
|
---|
2262 |
|
---|
2263 | NOREF (rc);
|
---|
2264 | }
|
---|
2265 |
|
---|
2266 | /* static */
|
---|
2267 | QString VBoxProblemReporter::mediumToAccusative (VBoxDefs::MediumType aType, bool aIsHostDrive /* = false */)
|
---|
2268 | {
|
---|
2269 | QString type =
|
---|
2270 | aType == VBoxDefs::MediumType_HardDisk ?
|
---|
2271 | tr ("hard disk", "failed to mount ...") :
|
---|
2272 | aType == VBoxDefs::MediumType_DVD && aIsHostDrive ?
|
---|
2273 | tr ("CD/DVD", "failed to mount ... host-drive") :
|
---|
2274 | aType == VBoxDefs::MediumType_DVD && !aIsHostDrive ?
|
---|
2275 | tr ("CD/DVD image", "failed to mount ...") :
|
---|
2276 | aType == VBoxDefs::MediumType_Floppy && aIsHostDrive ?
|
---|
2277 | tr ("floppy", "failed to mount ... host-drive") :
|
---|
2278 | aType == VBoxDefs::MediumType_Floppy && !aIsHostDrive ?
|
---|
2279 | tr ("floppy image", "failed to mount ...") :
|
---|
2280 | QString::null;
|
---|
2281 |
|
---|
2282 | Assert (!type.isNull());
|
---|
2283 | return type;
|
---|
2284 | }
|
---|
2285 |
|
---|
2286 | /**
|
---|
2287 | * Formats the given COM result code as a human-readable string.
|
---|
2288 | *
|
---|
2289 | * If a mnemonic name for the given result code is found, a string in format
|
---|
2290 | * "MNEMONIC_NAME (0x12345678)" is returned where the hex number is the result
|
---|
2291 | * code as is. If no mnemonic name is found, then the raw hex number only is
|
---|
2292 | * returned (w/o parenthesis).
|
---|
2293 | *
|
---|
2294 | * @param aRC COM result code to format.
|
---|
2295 | */
|
---|
2296 | /* static */
|
---|
2297 | QString VBoxProblemReporter::formatRC (HRESULT aRC)
|
---|
2298 | {
|
---|
2299 | QString str;
|
---|
2300 |
|
---|
2301 | PCRTCOMERRMSG msg = NULL;
|
---|
2302 | const char *errMsg = NULL;
|
---|
2303 |
|
---|
2304 | /* first, try as is (only set bit 31 bit for warnings) */
|
---|
2305 | if (SUCCEEDED_WARNING (aRC))
|
---|
2306 | msg = RTErrCOMGet (aRC | 0x80000000);
|
---|
2307 | else
|
---|
2308 | msg = RTErrCOMGet (aRC);
|
---|
2309 |
|
---|
2310 | if (msg != NULL)
|
---|
2311 | errMsg = msg->pszDefine;
|
---|
2312 |
|
---|
2313 | #if defined (Q_WS_WIN)
|
---|
2314 |
|
---|
2315 | PCRTWINERRMSG winMsg = NULL;
|
---|
2316 |
|
---|
2317 | /* if not found, try again using RTErrWinGet with masked off top 16bit */
|
---|
2318 | if (msg == NULL)
|
---|
2319 | {
|
---|
2320 | winMsg = RTErrWinGet (aRC & 0xFFFF);
|
---|
2321 |
|
---|
2322 | if (winMsg != NULL)
|
---|
2323 | errMsg = winMsg->pszDefine;
|
---|
2324 | }
|
---|
2325 |
|
---|
2326 | #endif
|
---|
2327 |
|
---|
2328 | if (errMsg != NULL && *errMsg != '\0')
|
---|
2329 | str.sprintf ("%s (0x%08X)", errMsg, aRC);
|
---|
2330 | else
|
---|
2331 | str.sprintf ("0x%08X", aRC);
|
---|
2332 |
|
---|
2333 | return str;
|
---|
2334 | }
|
---|
2335 |
|
---|
2336 | /* static */
|
---|
2337 | QString VBoxProblemReporter::formatErrorInfo (const COMErrorInfo &aInfo,
|
---|
2338 | HRESULT aWrapperRC /* = S_OK */)
|
---|
2339 | {
|
---|
2340 | QString formatted = doFormatErrorInfo (aInfo, aWrapperRC);
|
---|
2341 | return QString ("<qt>%1</qt>").arg (formatted);
|
---|
2342 | }
|
---|
2343 |
|
---|
2344 | void VBoxProblemReporter::cannotCreateHostInterface(const CHost &host, QWidget *pParent /* = 0 */)
|
---|
2345 | {
|
---|
2346 | if (thread() == QThread::currentThread())
|
---|
2347 | sltCannotCreateHostInterface(host, pParent);
|
---|
2348 | else
|
---|
2349 | emit sigCannotCreateHostInterface(host, pParent);
|
---|
2350 | }
|
---|
2351 |
|
---|
2352 | void VBoxProblemReporter::cannotCreateHostInterface(const CProgress &progress, QWidget *pParent /* = 0 */)
|
---|
2353 | {
|
---|
2354 | if (thread() == QThread::currentThread())
|
---|
2355 | sltCannotCreateHostInterface(progress, pParent);
|
---|
2356 | else
|
---|
2357 | emit sigCannotCreateHostInterface(progress, pParent);
|
---|
2358 | }
|
---|
2359 |
|
---|
2360 | void VBoxProblemReporter::cannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface,
|
---|
2361 | QWidget *pParent /* = 0 */)
|
---|
2362 | {
|
---|
2363 | if (thread() == QThread::currentThread())
|
---|
2364 | sltCannotRemoveHostInterface(host, iface ,pParent);
|
---|
2365 | else
|
---|
2366 | emit sigCannotRemoveHostInterface(host, iface, pParent);
|
---|
2367 | }
|
---|
2368 |
|
---|
2369 | void VBoxProblemReporter::cannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface,
|
---|
2370 | QWidget *pParent /* = 0 */)
|
---|
2371 | {
|
---|
2372 | if (thread() == QThread::currentThread())
|
---|
2373 | sltCannotRemoveHostInterface(progress, iface, pParent);
|
---|
2374 | else
|
---|
2375 | emit sigCannotRemoveHostInterface(progress, iface, pParent);
|
---|
2376 | }
|
---|
2377 |
|
---|
2378 | void VBoxProblemReporter::cannotAttachDevice(const CMachine &machine, VBoxDefs::MediumType type,
|
---|
2379 | const QString &strLocation, const StorageSlot &storageSlot,
|
---|
2380 | QWidget *pParent /* = 0 */)
|
---|
2381 | {
|
---|
2382 | if (thread() == QThread::currentThread())
|
---|
2383 | sltCannotAttachDevice(machine, type, strLocation, storageSlot, pParent);
|
---|
2384 | else
|
---|
2385 | emit sigCannotAttachDevice(machine, type, strLocation, storageSlot, pParent);
|
---|
2386 | }
|
---|
2387 |
|
---|
2388 | void VBoxProblemReporter::cannotCreateSharedFolder(const CMachine &machine, const QString &strName,
|
---|
2389 | const QString &strPath, QWidget *pParent /* = 0 */)
|
---|
2390 | {
|
---|
2391 | if (thread() == QThread::currentThread())
|
---|
2392 | sltCannotCreateSharedFolder(machine, strName, strPath, pParent);
|
---|
2393 | else
|
---|
2394 | emit sigCannotCreateSharedFolder(machine, strName, strPath, pParent);
|
---|
2395 | }
|
---|
2396 |
|
---|
2397 | void VBoxProblemReporter::cannotRemoveSharedFolder(const CMachine &machine, const QString &strName,
|
---|
2398 | const QString &strPath, QWidget *pParent /* = 0 */)
|
---|
2399 | {
|
---|
2400 | if (thread() == QThread::currentThread())
|
---|
2401 | sltCannotRemoveSharedFolder(machine, strName, strPath, pParent);
|
---|
2402 | else
|
---|
2403 | emit sigCannotRemoveSharedFolder(machine, strName, strPath, pParent);
|
---|
2404 | }
|
---|
2405 |
|
---|
2406 | void VBoxProblemReporter::cannotCreateSharedFolder(const CConsole &console, const QString &strName,
|
---|
2407 | const QString &strPath, QWidget *pParent /* = 0 */)
|
---|
2408 | {
|
---|
2409 | if (thread() == QThread::currentThread())
|
---|
2410 | sltCannotCreateSharedFolder(console, strName, strPath, pParent);
|
---|
2411 | else
|
---|
2412 | emit sigCannotCreateSharedFolder(console, strName, strPath, pParent);
|
---|
2413 | }
|
---|
2414 |
|
---|
2415 | void VBoxProblemReporter::cannotRemoveSharedFolder(const CConsole &console, const QString &strName,
|
---|
2416 | const QString &strPath, QWidget *pParent /* = 0 */)
|
---|
2417 | {
|
---|
2418 | if (thread() == QThread::currentThread())
|
---|
2419 | sltCannotRemoveSharedFolder(console, strName, strPath, pParent);
|
---|
2420 | else
|
---|
2421 | emit sigCannotRemoveSharedFolder(console, strName, strPath, pParent);
|
---|
2422 | }
|
---|
2423 |
|
---|
2424 | void VBoxProblemReporter::remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP)
|
---|
2425 | {
|
---|
2426 | emit sigRemindAboutWrongColorDepth(uRealBPP, uWantedBPP);
|
---|
2427 | }
|
---|
2428 |
|
---|
2429 | void VBoxProblemReporter::showHelpWebDialog()
|
---|
2430 | {
|
---|
2431 | vboxGlobal().openURL ("http://www.virtualbox.org");
|
---|
2432 | }
|
---|
2433 |
|
---|
2434 | void VBoxProblemReporter::showHelpAboutDialog()
|
---|
2435 | {
|
---|
2436 | CVirtualBox vbox = vboxGlobal().virtualBox();
|
---|
2437 | QString strFullVersion;
|
---|
2438 | if (vboxGlobal().brandingIsActive())
|
---|
2439 | {
|
---|
2440 | strFullVersion = QString("%1 r%2 - %3").arg(vbox.GetVersion())
|
---|
2441 | .arg(vbox.GetRevision())
|
---|
2442 | .arg(vboxGlobal().brandingGetKey("Name"));
|
---|
2443 | }
|
---|
2444 | else
|
---|
2445 | {
|
---|
2446 | strFullVersion = QString("%1 r%2").arg(vbox.GetVersion())
|
---|
2447 | .arg(vbox.GetRevision());
|
---|
2448 | }
|
---|
2449 | AssertWrapperOk(vbox);
|
---|
2450 |
|
---|
2451 | (new VBoxAboutDlg(mainWindowShown(), strFullVersion))->show();
|
---|
2452 | }
|
---|
2453 |
|
---|
2454 | void VBoxProblemReporter::showHelpHelpDialog()
|
---|
2455 | {
|
---|
2456 | #ifndef VBOX_OSE
|
---|
2457 | /* For non-OSE version we just open it: */
|
---|
2458 | sltShowUserManual(vboxGlobal().helpFile());
|
---|
2459 | #else /* #ifndef VBOX_OSE */
|
---|
2460 | /* For OSE version we have to check if it present first: */
|
---|
2461 | QString strUserManualFileName1 = vboxGlobal().helpFile();
|
---|
2462 | QString strShortFileName = QFileInfo(strUserManualFileName1).fileName();
|
---|
2463 | QString strUserManualFileName2 = QDir(vboxGlobal().virtualBox().GetHomeFolder()).absoluteFilePath(strShortFileName);
|
---|
2464 | if (QFile::exists(strUserManualFileName1))
|
---|
2465 | {
|
---|
2466 | sltShowUserManual(strUserManualFileName1);
|
---|
2467 | }
|
---|
2468 | else if (QFile::exists(strUserManualFileName2))
|
---|
2469 | {
|
---|
2470 | sltShowUserManual(strUserManualFileName2);
|
---|
2471 | }
|
---|
2472 | else if (!UIDownloaderUserManual::current() && askAboutUserManualDownload(strUserManualFileName1))
|
---|
2473 | {
|
---|
2474 | /* Create User Manual downloader: */
|
---|
2475 | UIDownloaderUserManual *pDl = UIDownloaderUserManual::create();
|
---|
2476 | /* Configure User Manual downloader: */
|
---|
2477 | CVirtualBox vbox = vboxGlobal().virtualBox();
|
---|
2478 | pDl->addSource(QString("http://download.virtualbox.org/virtualbox/%1/").arg(vbox.GetVersion().remove("_OSE")) + strShortFileName);
|
---|
2479 | pDl->addSource(QString("http://download.virtualbox.org/virtualbox/") + strShortFileName);
|
---|
2480 | pDl->setTarget(strUserManualFileName2);
|
---|
2481 | pDl->setParentWidget(mainWindowShown());
|
---|
2482 | /* After the download is finished => show the document: */
|
---|
2483 | connect(pDl, SIGNAL(sigDownloadFinished(const QString&)), this, SLOT(sltShowUserManual(const QString&)));
|
---|
2484 | /* Notify listeners: */
|
---|
2485 | emit sigDownloaderUserManualCreated();
|
---|
2486 | /* Start the downloader: */
|
---|
2487 | pDl->startDownload();
|
---|
2488 | }
|
---|
2489 | #endif /* #ifdef VBOX_OSE */
|
---|
2490 | }
|
---|
2491 |
|
---|
2492 | void VBoxProblemReporter::resetSuppressedMessages()
|
---|
2493 | {
|
---|
2494 | CVirtualBox vbox = vboxGlobal().virtualBox();
|
---|
2495 | vbox.SetExtraData (VBoxDefs::GUI_SuppressMessages, QString::null);
|
---|
2496 | }
|
---|
2497 |
|
---|
2498 | void VBoxProblemReporter::sltShowUserManual(const QString &strLocation)
|
---|
2499 | {
|
---|
2500 | #if defined (Q_WS_WIN32)
|
---|
2501 | HtmlHelp(GetDesktopWindow(), strLocation.utf16(), HH_DISPLAY_TOPIC, NULL);
|
---|
2502 | #elif defined (Q_WS_X11)
|
---|
2503 | # ifndef VBOX_OSE
|
---|
2504 | char szViewerPath[RTPATH_MAX];
|
---|
2505 | int rc;
|
---|
2506 | rc = RTPathAppPrivateArch(szViewerPath, sizeof(szViewerPath));
|
---|
2507 | AssertRC(rc);
|
---|
2508 | QProcess::startDetached(QString(szViewerPath) + "/kchmviewer", QStringList(strLocation));
|
---|
2509 | # else /* #ifndef VBOX_OSE */
|
---|
2510 | vboxGlobal().openURL("file://" + strLocation);
|
---|
2511 | # endif /* #ifdef VBOX_OSE */
|
---|
2512 | #elif defined (Q_WS_MAC)
|
---|
2513 | vboxGlobal().openURL("file://" + strLocation);
|
---|
2514 | #endif
|
---|
2515 | }
|
---|
2516 |
|
---|
2517 | void VBoxProblemReporter::sltCannotCreateHostInterface(const CHost &host, QWidget *pParent)
|
---|
2518 | {
|
---|
2519 | message(pParent ? pParent : mainWindowShown(), Error,
|
---|
2520 | tr("Failed to create the host-only network interface."),
|
---|
2521 | formatErrorInfo(host));
|
---|
2522 | }
|
---|
2523 |
|
---|
2524 | void VBoxProblemReporter::sltCannotCreateHostInterface(const CProgress &progress, QWidget *pParent)
|
---|
2525 | {
|
---|
2526 | message(pParent ? pParent : mainWindowShown(), Error,
|
---|
2527 | tr("Failed to create the host-only network interface."),
|
---|
2528 | formatErrorInfo(progress.GetErrorInfo()));
|
---|
2529 | }
|
---|
2530 |
|
---|
2531 | void VBoxProblemReporter::sltCannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent)
|
---|
2532 | {
|
---|
2533 | message(pParent ? pParent : mainWindowShown(), Error,
|
---|
2534 | tr("Failed to remove the host network interface <b>%1</b>.")
|
---|
2535 | .arg(iface.GetName()),
|
---|
2536 | formatErrorInfo(host));
|
---|
2537 | }
|
---|
2538 |
|
---|
2539 | void VBoxProblemReporter::sltCannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent)
|
---|
2540 | {
|
---|
2541 | message(pParent ? pParent : mainWindowShown(), Error,
|
---|
2542 | tr("Failed to remove the host network interface <b>%1</b>.")
|
---|
2543 | .arg(iface.GetName()),
|
---|
2544 | formatErrorInfo(progress.GetErrorInfo()));
|
---|
2545 | }
|
---|
2546 |
|
---|
2547 | void VBoxProblemReporter::sltCannotAttachDevice(const CMachine &machine, VBoxDefs::MediumType type,
|
---|
2548 | const QString &strLocation, const StorageSlot &storageSlot,
|
---|
2549 | QWidget *pParent)
|
---|
2550 | {
|
---|
2551 | QString strMessage;
|
---|
2552 | switch (type)
|
---|
2553 | {
|
---|
2554 | case VBoxDefs::MediumType_HardDisk:
|
---|
2555 | {
|
---|
2556 | strMessage = tr("Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
|
---|
2557 | .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
|
---|
2558 | break;
|
---|
2559 | }
|
---|
2560 | case VBoxDefs::MediumType_DVD:
|
---|
2561 | {
|
---|
2562 | strMessage = tr("Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
|
---|
2563 | .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
|
---|
2564 | break;
|
---|
2565 | }
|
---|
2566 | case VBoxDefs::MediumType_Floppy:
|
---|
2567 | {
|
---|
2568 | strMessage = tr("Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
|
---|
2569 | .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
|
---|
2570 | break;
|
---|
2571 | }
|
---|
2572 | default:
|
---|
2573 | break;
|
---|
2574 | }
|
---|
2575 | message(pParent ? pParent : mainWindowShown(), Error, strMessage, formatErrorInfo(machine));
|
---|
2576 | }
|
---|
2577 |
|
---|
2578 | void VBoxProblemReporter::sltCannotCreateSharedFolder(const CMachine &machine, const QString &strName,
|
---|
2579 | const QString &strPath, QWidget *pParent)
|
---|
2580 | {
|
---|
2581 | message(pParent ? pParent : mainMachineWindowShown(), Error,
|
---|
2582 | tr("Failed to create the shared folder <b>%1</b> "
|
---|
2583 | "(pointing to <nobr><b>%2</b></nobr>) "
|
---|
2584 | "for the virtual machine <b>%3</b>.")
|
---|
2585 | .arg(strName)
|
---|
2586 | .arg(strPath)
|
---|
2587 | .arg(CMachine(machine).GetName()),
|
---|
2588 | formatErrorInfo(machine));
|
---|
2589 | }
|
---|
2590 |
|
---|
2591 | void VBoxProblemReporter::sltCannotRemoveSharedFolder(const CMachine &machine, const QString &strName,
|
---|
2592 | const QString &strPath, QWidget *pParent)
|
---|
2593 | {
|
---|
2594 | message(pParent ? pParent : mainMachineWindowShown(), Error,
|
---|
2595 | tr("Failed to remove the shared folder <b>%1</b> "
|
---|
2596 | "(pointing to <nobr><b>%2</b></nobr>) "
|
---|
2597 | "from the virtual machine <b>%3</b>.")
|
---|
2598 | .arg(strName)
|
---|
2599 | .arg(strPath)
|
---|
2600 | .arg(CMachine(machine).GetName()),
|
---|
2601 | formatErrorInfo(machine));
|
---|
2602 | }
|
---|
2603 |
|
---|
2604 | void VBoxProblemReporter::sltCannotCreateSharedFolder(const CConsole &console, const QString &strName,
|
---|
2605 | const QString &strPath, QWidget *pParent)
|
---|
2606 | {
|
---|
2607 | message(pParent ? pParent : mainMachineWindowShown(), Error,
|
---|
2608 | tr("Failed to create the shared folder <b>%1</b> "
|
---|
2609 | "(pointing to <nobr><b>%2</b></nobr>) "
|
---|
2610 | "for the virtual machine <b>%3</b>.")
|
---|
2611 | .arg(strName)
|
---|
2612 | .arg(strPath)
|
---|
2613 | .arg(CConsole(console).GetMachine().GetName()),
|
---|
2614 | formatErrorInfo(console));
|
---|
2615 | }
|
---|
2616 |
|
---|
2617 | void VBoxProblemReporter::sltCannotRemoveSharedFolder(const CConsole &console, const QString &strName,
|
---|
2618 | const QString &strPath, QWidget *pParent)
|
---|
2619 | {
|
---|
2620 | message(pParent ? pParent : mainMachineWindowShown(), Error,
|
---|
2621 | tr("<p>Failed to remove the shared folder <b>%1</b> "
|
---|
2622 | "(pointing to <nobr><b>%2</b></nobr>) "
|
---|
2623 | "from the virtual machine <b>%3</b>.</p>"
|
---|
2624 | "<p>Please close all programs in the guest OS that "
|
---|
2625 | "may be using this shared folder and try again.</p>")
|
---|
2626 | .arg(strName)
|
---|
2627 | .arg(strPath)
|
---|
2628 | .arg(CConsole(console).GetMachine().GetName()),
|
---|
2629 | formatErrorInfo(console));
|
---|
2630 | }
|
---|
2631 |
|
---|
2632 | void VBoxProblemReporter::sltRemindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP)
|
---|
2633 | {
|
---|
2634 | const char *kName = "remindAboutWrongColorDepth";
|
---|
2635 |
|
---|
2636 | /* Close the previous (outdated) window if any. We use kName as
|
---|
2637 | * aAutoConfirmId which is also used as the widget name by default. */
|
---|
2638 | {
|
---|
2639 | QWidget *outdated = VBoxGlobal::findWidget(NULL, kName, "QIMessageBox");
|
---|
2640 | if (outdated)
|
---|
2641 | outdated->close();
|
---|
2642 | }
|
---|
2643 |
|
---|
2644 | message(mainMachineWindowShown(), Info,
|
---|
2645 | tr("<p>The virtual machine window is optimized to work in "
|
---|
2646 | "<b>%1 bit</b> color mode but the "
|
---|
2647 | "virtual display is currently set to <b>%2 bit</b>.</p>"
|
---|
2648 | "<p>Please open the display properties dialog of the guest OS and "
|
---|
2649 | "select a <b>%3 bit</b> color mode, if it is available, for "
|
---|
2650 | "best possible performance of the virtual video subsystem.</p>"
|
---|
2651 | "<p><b>Note</b>. Some operating systems, like OS/2, may actually "
|
---|
2652 | "work in 32 bit mode but report it as 24 bit "
|
---|
2653 | "(16 million colors). You may try to select a different color "
|
---|
2654 | "mode to see if this message disappears or you can simply "
|
---|
2655 | "disable the message now if you are sure the required color "
|
---|
2656 | "mode (%4 bit) is not available in the guest OS.</p>")
|
---|
2657 | .arg(uWantedBPP).arg(uRealBPP).arg(uWantedBPP).arg(uWantedBPP),
|
---|
2658 | kName);
|
---|
2659 | }
|
---|
2660 |
|
---|
2661 | VBoxProblemReporter::VBoxProblemReporter()
|
---|
2662 | {
|
---|
2663 | /* Register required objects as meta-types: */
|
---|
2664 | qRegisterMetaType<CProgress>();
|
---|
2665 | qRegisterMetaType<CHost>();
|
---|
2666 | qRegisterMetaType<CMachine>();
|
---|
2667 | qRegisterMetaType<CConsole>();
|
---|
2668 | qRegisterMetaType<CHostNetworkInterface>();
|
---|
2669 | qRegisterMetaType<VBoxDefs::MediumType>();
|
---|
2670 | qRegisterMetaType<StorageSlot>();
|
---|
2671 |
|
---|
2672 | /* Prepare required connections: */
|
---|
2673 | connect(this, SIGNAL(sigCannotCreateHostInterface(const CHost&, QWidget*)),
|
---|
2674 | this, SLOT(sltCannotCreateHostInterface(const CHost&, QWidget*)),
|
---|
2675 | Qt::BlockingQueuedConnection);
|
---|
2676 | connect(this, SIGNAL(sigCannotCreateHostInterface(const CProgress&, QWidget*)),
|
---|
2677 | this, SLOT(sltCannotCreateHostInterface(const CProgress&, QWidget*)),
|
---|
2678 | Qt::BlockingQueuedConnection);
|
---|
2679 | connect(this, SIGNAL(sigCannotRemoveHostInterface(const CHost&, const CHostNetworkInterface&, QWidget*)),
|
---|
2680 | this, SLOT(sltCannotRemoveHostInterface(const CHost&, const CHostNetworkInterface&, QWidget*)),
|
---|
2681 | Qt::BlockingQueuedConnection);
|
---|
2682 | connect(this, SIGNAL(sigCannotRemoveHostInterface(const CProgress&, const CHostNetworkInterface&, QWidget*)),
|
---|
2683 | this, SLOT(sltCannotRemoveHostInterface(const CProgress&, const CHostNetworkInterface&, QWidget*)),
|
---|
2684 | Qt::BlockingQueuedConnection);
|
---|
2685 | connect(this, SIGNAL(sigCannotAttachDevice(const CMachine&, VBoxDefs::MediumType, const QString&, const StorageSlot&, QWidget*)),
|
---|
2686 | this, SLOT(sltCannotAttachDevice(const CMachine&, VBoxDefs::MediumType, const QString&, const StorageSlot&, QWidget*)),
|
---|
2687 | Qt::BlockingQueuedConnection);
|
---|
2688 | connect(this, SIGNAL(sigCannotCreateSharedFolder(const CMachine&, const QString&, const QString&, QWidget*)),
|
---|
2689 | this, SLOT(sltCannotCreateSharedFolder(const CMachine&, const QString&, const QString&, QWidget*)),
|
---|
2690 | Qt::BlockingQueuedConnection);
|
---|
2691 | connect(this, SIGNAL(sigCannotRemoveSharedFolder(const CMachine&, const QString&, const QString&, QWidget*)),
|
---|
2692 | this, SLOT(sltCannotRemoveSharedFolder(const CMachine&, const QString&, const QString&, QWidget*)),
|
---|
2693 | Qt::BlockingQueuedConnection);
|
---|
2694 | connect(this, SIGNAL(sigCannotCreateSharedFolder(const CConsole&, const QString&, const QString&, QWidget*)),
|
---|
2695 | this, SLOT(sltCannotCreateSharedFolder(const CConsole&, const QString&, const QString&, QWidget*)),
|
---|
2696 | Qt::BlockingQueuedConnection);
|
---|
2697 | connect(this, SIGNAL(sigCannotRemoveSharedFolder(const CConsole&, const QString&, const QString&, QWidget*)),
|
---|
2698 | this, SLOT(sltCannotRemoveSharedFolder(const CConsole&, const QString&, const QString&, QWidget*)),
|
---|
2699 | Qt::BlockingQueuedConnection);
|
---|
2700 | connect(this, SIGNAL(sigRemindAboutWrongColorDepth(ulong, ulong)),
|
---|
2701 | this, SLOT(sltRemindAboutWrongColorDepth(ulong, ulong)), Qt::QueuedConnection);
|
---|
2702 | }
|
---|
2703 |
|
---|
2704 | /* Returns a reference to the global VirtualBox problem reporter instance: */
|
---|
2705 | VBoxProblemReporter &VBoxProblemReporter::instance()
|
---|
2706 | {
|
---|
2707 | static VBoxProblemReporter global_instance;
|
---|
2708 | return global_instance;
|
---|
2709 | }
|
---|
2710 |
|
---|
2711 | QString VBoxProblemReporter::doFormatErrorInfo (const COMErrorInfo &aInfo,
|
---|
2712 | HRESULT aWrapperRC /* = S_OK */)
|
---|
2713 | {
|
---|
2714 | /* Compose complex details string with internal <!--EOM--> delimiter to
|
---|
2715 | * make it possible to split string into info & details parts which will
|
---|
2716 | * be used separately in QIMessageBox */
|
---|
2717 | QString formatted;
|
---|
2718 |
|
---|
2719 | if (!aInfo.text().isEmpty())
|
---|
2720 | formatted += QString ("<p>%1.</p>").arg (vboxGlobal().emphasize (aInfo.text()));
|
---|
2721 |
|
---|
2722 | formatted += "<!--EOM--><table bgcolor=#EEEEEE border=0 cellspacing=0 "
|
---|
2723 | "cellpadding=0 width=100%>";
|
---|
2724 |
|
---|
2725 | bool haveResultCode = false;
|
---|
2726 |
|
---|
2727 | if (aInfo.isBasicAvailable())
|
---|
2728 | {
|
---|
2729 | #if defined (Q_WS_WIN)
|
---|
2730 | haveResultCode = aInfo.isFullAvailable();
|
---|
2731 | bool haveComponent = true;
|
---|
2732 | bool haveInterfaceID = true;
|
---|
2733 | #else /* defined (Q_WS_WIN) */
|
---|
2734 | haveResultCode = true;
|
---|
2735 | bool haveComponent = aInfo.isFullAvailable();
|
---|
2736 | bool haveInterfaceID = aInfo.isFullAvailable();
|
---|
2737 | #endif
|
---|
2738 |
|
---|
2739 | if (haveResultCode)
|
---|
2740 | {
|
---|
2741 | formatted += QString ("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
|
---|
2742 | .arg (tr ("Result Code: ", "error info"))
|
---|
2743 | .arg (formatRC (aInfo.resultCode()));
|
---|
2744 | }
|
---|
2745 |
|
---|
2746 | if (haveComponent)
|
---|
2747 | formatted += QString ("<tr><td>%1</td><td>%2</td></tr>")
|
---|
2748 | .arg (tr ("Component: ", "error info"), aInfo.component());
|
---|
2749 |
|
---|
2750 | if (haveInterfaceID)
|
---|
2751 | {
|
---|
2752 | QString s = aInfo.interfaceID();
|
---|
2753 | if (!aInfo.interfaceName().isEmpty())
|
---|
2754 | s = aInfo.interfaceName() + ' ' + s;
|
---|
2755 | formatted += QString ("<tr><td>%1</td><td>%2</td></tr>")
|
---|
2756 | .arg (tr ("Interface: ", "error info"), s);
|
---|
2757 | }
|
---|
2758 |
|
---|
2759 | if (!aInfo.calleeIID().isNull() && aInfo.calleeIID() != aInfo.interfaceID())
|
---|
2760 | {
|
---|
2761 | QString s = aInfo.calleeIID();
|
---|
2762 | if (!aInfo.calleeName().isEmpty())
|
---|
2763 | s = aInfo.calleeName() + ' ' + s;
|
---|
2764 | formatted += QString ("<tr><td>%1</td><td>%2</td></tr>")
|
---|
2765 | .arg (tr ("Callee: ", "error info"), s);
|
---|
2766 | }
|
---|
2767 | }
|
---|
2768 |
|
---|
2769 | if (FAILED (aWrapperRC) &&
|
---|
2770 | (!haveResultCode || aWrapperRC != aInfo.resultCode()))
|
---|
2771 | {
|
---|
2772 | formatted += QString ("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
|
---|
2773 | .arg (tr ("Callee RC: ", "error info"))
|
---|
2774 | .arg (formatRC (aWrapperRC));
|
---|
2775 | }
|
---|
2776 |
|
---|
2777 | formatted += "</table>";
|
---|
2778 |
|
---|
2779 | if (aInfo.next())
|
---|
2780 | formatted = formatted + "<!--EOP-->" + doFormatErrorInfo (*aInfo.next());
|
---|
2781 |
|
---|
2782 | return formatted;
|
---|
2783 | }
|
---|
2784 |
|
---|