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