VirtualBox

Ignore:
Timestamp:
Aug 17, 2017 8:59:12 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: Factoring out error string formatting functions from UIMessageCenter.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
18 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r68396 r68435  
    640640        src/globals/UIMainEventListener.cpp \
    641641        src/globals/UIMessageCenter.cpp \
     642        src/globals/UIErrorString.cpp \
    642643        src/globals/UIModalWindowManager.cpp \
    643644        src/globals/UIPopupCenter.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIErrorString.cpp

    r68433 r68435  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIMessageCenter class implementation.
     3 * VBox Qt GUI - UIErrorString class implementation.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121
    2222/* Qt includes: */
    23 # include <QDir>
    24 # include <QFileInfo>
    25 # include <QLocale>
    26 # include <QThread>
    27 # include <QProcess>
    28 # ifdef VBOX_WS_MAC
    29 #  include <QPushButton>
    30 # endif /* VBOX_WS_MAC */
     23#include <QObject>
    3124
    3225/* GUI includes: */
    33 # include "VBoxGlobal.h"
    34 # include "UIConverter.h"
    35 # include "UIMessageCenter.h"
    36 # include "UISelectorWindow.h"
    37 # include "UIProgressDialog.h"
    38 # ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    39 #  include "UINetworkManager.h"
    40 #  include "UINetworkManagerDialog.h"
    41 # endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    42 # include "UIModalWindowManager.h"
    43 # include "UIExtraDataManager.h"
    44 # include "UIMedium.h"
    45 # ifdef VBOX_OSE
    46 #  include "UIDownloaderUserManual.h"
    47 # endif /* VBOX_OSE */
    48 # include "UIMachine.h"
    49 # include "VBoxAboutDlg.h"
    50 # include "UIHostComboEditor.h"
    51 # ifdef VBOX_WS_MAC
    52 #  include "VBoxUtils-darwin.h"
    53 # endif /* VBOX_WS_MAC */
    54 # ifdef VBOX_WS_WIN
    55 #  include <Htmlhelp.h>
    56 # endif /* VBOX_WS_WIN */
     26#include "UIErrorString.h"
     27#include "VBoxGlobal.h"
    5728
    5829/* COM includes: */
    59 # include "CNATNetwork.h"
    60 # include "CDHCPServer.h"
    61 # include "CAudioAdapter.h"
    62 # include "CNATEngine.h"
    63 # include "CSerialPort.h"
    64 # include "CSharedFolder.h"
    65 # include "CSnapshot.h"
    66 # include "CStorageController.h"
    67 # include "CUSBController.h"
    68 # include "CUSBDeviceFilters.h"
    69 # include "CUSBDeviceFilter.h"
    70 # include "CConsole.h"
    71 # include "CMachine.h"
    72 # include "CSystemProperties.h"
    73 # include "CVirtualBoxErrorInfo.h"
    74 # include "CMediumAttachment.h"
    75 # include "CMediumFormat.h"
    76 # include "CAppliance.h"
    77 # include "CExtPackManager.h"
    78 # include "CExtPackFile.h"
    79 # include "CHostNetworkInterface.h"
    80 # include "CVRDEServer.h"
    81 # include "CNetworkAdapter.h"
    82 # include "CEmulatedUSB.h"
    83 # ifdef VBOX_WITH_DRAG_AND_DROP
    84 #  include "CGuest.h"
    85 #  include "CDnDSource.h"
    86 #  include "CDnDTarget.h"
    87 # endif /* VBOX_WITH_DRAG_AND_DROP */
    88 
    89 /* Other VBox includes: */
    90 # include <iprt/param.h>
    91 # include <iprt/path.h>
     30#include "COMDefs.h"
     31#include "CProgress.h"
     32#include "CVirtualBoxErrorInfo.h"
    9233
    9334#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    9435
    95 #include <iprt/err.h>
    96 
    97 
    98 /* static */
    99 UIMessageCenter* UIMessageCenter::m_spInstance = 0;
    100 UIMessageCenter* UIMessageCenter::instance() { return m_spInstance; }
    101 
    102 /* static */
    103 void UIMessageCenter::create()
    104 {
    105     /* Make sure instance is NOT created yet: */
    106     if (m_spInstance)
    107     {
    108         AssertMsgFailed(("UIMessageCenter instance is already created!"));
    109         return;
    110     }
    111 
    112     /* Create instance: */
    113     new UIMessageCenter;
    114     /* Prepare instance: */
    115     m_spInstance->prepare();
    116 }
    117 
    118 /* static */
    119 void UIMessageCenter::destroy()
    120 {
    121     /* Make sure instance is NOT destroyed yet: */
    122     if (!m_spInstance)
    123     {
    124         AssertMsgFailed(("UIMessageCenter instance is already destroyed!"));
    125         return;
    126     }
    127 
    128     /* Cleanup instance: */
    129     m_spInstance->cleanup();
    130     /* Destroy instance: */
    131     delete m_spInstance;
    132 }
    133 
    134 bool UIMessageCenter::warningShown(const QString &strWarningName) const
    135 {
    136     return m_warnings.contains(strWarningName);
    137 }
    138 
    139 void UIMessageCenter::setWarningShown(const QString &strWarningName, bool fWarningShown) const
    140 {
    141     if (fWarningShown && !m_warnings.contains(strWarningName))
    142         m_warnings.append(strWarningName);
    143     else if (!fWarningShown && m_warnings.contains(strWarningName))
    144         m_warnings.removeAll(strWarningName);
    145 }
    146 
    147 int UIMessageCenter::message(QWidget *pParent, MessageType type,
    148                              const QString &strMessage,
    149                              const QString &strDetails,
    150                              const char *pcszAutoConfirmId /* = 0*/,
    151                              int iButton1 /* = 0*/,
    152                              int iButton2 /* = 0*/,
    153                              int iButton3 /* = 0*/,
    154                              const QString &strButtonText1 /* = QString() */,
    155                              const QString &strButtonText2 /* = QString() */,
    156                              const QString &strButtonText3 /* = QString() */) const
    157 {
    158     /* If this is NOT a GUI thread: */
    159     if (thread() != QThread::currentThread())
    160     {
    161         /* We have to throw a blocking signal
    162          * to show a message-box in the GUI thread: */
    163         emit sigToShowMessageBox(pParent, type,
    164                                  strMessage, strDetails,
    165                                  iButton1, iButton2, iButton3,
    166                                  strButtonText1, strButtonText2, strButtonText3,
    167                                  QString(pcszAutoConfirmId));
    168         /* Inter-thread communications are not yet implemented: */
    169         return 0;
    170     }
    171     /* In usual case we can chow a message-box directly: */
    172     return showMessageBox(pParent, type,
    173                           strMessage, strDetails,
    174                           iButton1, iButton2, iButton3,
    175                           strButtonText1, strButtonText2, strButtonText3,
    176                           QString(pcszAutoConfirmId));
    177 }
    178 
    179 void UIMessageCenter::error(QWidget *pParent, MessageType type,
    180                            const QString &strMessage,
    181                            const QString &strDetails,
    182                            const char *pcszAutoConfirmId /* = 0*/) const
    183 {
    184     message(pParent, type, strMessage, strDetails, pcszAutoConfirmId,
    185             AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape);
    186 }
    187 
    188 bool UIMessageCenter::errorWithQuestion(QWidget *pParent, MessageType type,
    189                                         const QString &strMessage,
    190                                         const QString &strDetails,
    191                                         const char *pcszAutoConfirmId /* = 0*/,
    192                                         const QString &strOkButtonText /* = QString()*/,
    193                                         const QString &strCancelButtonText /* = QString()*/) const
    194 {
    195     return (message(pParent, type, strMessage, strDetails, pcszAutoConfirmId,
    196                     AlertButton_Ok | AlertButtonOption_Default,
    197                     AlertButton_Cancel | AlertButtonOption_Escape,
    198                     0 /* third button */,
    199                     strOkButtonText,
    200                     strCancelButtonText,
    201                     QString() /* third button */) &
    202             AlertButtonMask) == AlertButton_Ok;
    203 }
    204 
    205 void UIMessageCenter::alert(QWidget *pParent, MessageType type,
    206                            const QString &strMessage,
    207                            const char *pcszAutoConfirmId /* = 0*/) const
    208 {
    209     error(pParent, type, strMessage, QString(), pcszAutoConfirmId);
    210 }
    211 
    212 int UIMessageCenter::question(QWidget *pParent, MessageType type,
    213                               const QString &strMessage,
    214                               const char *pcszAutoConfirmId/* = 0*/,
    215                               int iButton1 /* = 0*/,
    216                               int iButton2 /* = 0*/,
    217                               int iButton3 /* = 0*/,
    218                               const QString &strButtonText1 /* = QString()*/,
    219                               const QString &strButtonText2 /* = QString()*/,
    220                               const QString &strButtonText3 /* = QString()*/) const
    221 {
    222     return message(pParent, type, strMessage, QString(), pcszAutoConfirmId,
    223                    iButton1, iButton2, iButton3, strButtonText1, strButtonText2, strButtonText3);
    224 }
    225 
    226 bool UIMessageCenter::questionBinary(QWidget *pParent, MessageType type,
    227                                      const QString &strMessage,
    228                                      const char *pcszAutoConfirmId /* = 0*/,
    229                                      const QString &strOkButtonText /* = QString()*/,
    230                                      const QString &strCancelButtonText /* = QString()*/,
    231                                      bool fDefaultFocusForOk /* = true*/) const
    232 {
    233     return fDefaultFocusForOk ?
    234            ((question(pParent, type, strMessage, pcszAutoConfirmId,
    235                       AlertButton_Ok | AlertButtonOption_Default,
    236                       AlertButton_Cancel | AlertButtonOption_Escape,
    237                       0 /* third button */,
    238                       strOkButtonText,
    239                       strCancelButtonText,
    240                       QString() /* third button */) &
    241              AlertButtonMask) == AlertButton_Ok) :
    242            ((question(pParent, type, strMessage, pcszAutoConfirmId,
    243                       AlertButton_Ok,
    244                       AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    245                       0 /* third button */,
    246                       strOkButtonText,
    247                       strCancelButtonText,
    248                       QString() /* third button */) &
    249              AlertButtonMask) == AlertButton_Ok);
    250 }
    251 
    252 int UIMessageCenter::questionTrinary(QWidget *pParent, MessageType type,
    253                                      const QString &strMessage,
    254                                      const char *pcszAutoConfirmId /* = 0*/,
    255                                      const QString &strChoice1ButtonText /* = QString()*/,
    256                                      const QString &strChoice2ButtonText /* = QString()*/,
    257                                      const QString &strCancelButtonText /* = QString()*/) const
    258 {
    259     return question(pParent, type, strMessage, pcszAutoConfirmId,
    260                     AlertButton_Choice1,
    261                     AlertButton_Choice2 | AlertButtonOption_Default,
    262                     AlertButton_Cancel | AlertButtonOption_Escape,
    263                     strChoice1ButtonText,
    264                     strChoice2ButtonText,
    265                     strCancelButtonText);
    266 }
    267 
    268 int UIMessageCenter::messageWithOption(QWidget *pParent, MessageType type,
    269                                        const QString &strMessage,
    270                                        const QString &strOptionText,
    271                                        bool fDefaultOptionValue /* = true */,
    272                                        int iButton1 /* = 0*/,
    273                                        int iButton2 /* = 0*/,
    274                                        int iButton3 /* = 0*/,
    275                                        const QString &strButtonName1 /* = QString() */,
    276                                        const QString &strButtonName2 /* = QString() */,
    277                                        const QString &strButtonName3 /* = QString() */) const
    278 {
    279     /* If no buttons are set, using single 'OK' button: */
    280     if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
    281         iButton1 = AlertButton_Ok | AlertButtonOption_Default;
    282 
    283     /* Assign corresponding title and icon: */
    284     QString strTitle;
    285     AlertIconType icon;
    286     switch (type)
    287     {
    288         default:
    289         case MessageType_Info:
    290             strTitle = tr("VirtualBox - Information", "msg box title");
    291             icon = AlertIconType_Information;
    292             break;
    293         case MessageType_Question:
    294             strTitle = tr("VirtualBox - Question", "msg box title");
    295             icon = AlertIconType_Question;
    296             break;
    297         case MessageType_Warning:
    298             strTitle = tr("VirtualBox - Warning", "msg box title");
    299             icon = AlertIconType_Warning;
    300             break;
    301         case MessageType_Error:
    302             strTitle = tr("VirtualBox - Error", "msg box title");
    303             icon = AlertIconType_Critical;
    304             break;
    305         case MessageType_Critical:
    306             strTitle = tr("VirtualBox - Critical Error", "msg box title");
    307             icon = AlertIconType_Critical;
    308             break;
    309         case MessageType_GuruMeditation:
    310             strTitle = "VirtualBox - Guru Meditation"; /* don't translate this */
    311             icon = AlertIconType_GuruMeditation;
    312             break;
    313     }
    314 
    315     /* Create message-box: */
    316     QWidget *pBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
    317     QPointer<QIMessageBox> pBox = new QIMessageBox(strTitle, strMessage, icon,
    318                                                    iButton1, iButton2, iButton3, pBoxParent);
    319     windowManager().registerNewParent(pBox, pBoxParent);
    320 
    321     /* Load option: */
    322     if (!strOptionText.isNull())
    323     {
    324         pBox->setFlagText(strOptionText);
    325         pBox->setFlagChecked(fDefaultOptionValue);
    326     }
    327 
    328     /* Configure button-text: */
    329     if (!strButtonName1.isNull())
    330         pBox->setButtonText(0, strButtonName1);
    331     if (!strButtonName2.isNull())
    332         pBox->setButtonText(1, strButtonName2);
    333     if (!strButtonName3.isNull())
    334         pBox->setButtonText(2, strButtonName3);
    335 
    336     /* Show box: */
    337     int rc = pBox->exec();
    338 
    339     /* Make sure box still valid: */
    340     if (!pBox)
    341         return rc;
    342 
    343     /* Save option: */
    344     if (pBox->flagChecked())
    345         rc |= AlertOption_CheckBox;
    346 
    347     /* Delete message-box: */
    348     if (pBox)
    349         delete pBox;
    350 
    351     return rc;
    352 }
    353 
    354 bool UIMessageCenter::showModalProgressDialog(CProgress &progress,
    355                                               const QString &strTitle,
    356                                               const QString &strImage /* = "" */,
    357                                               QWidget *pParent /* = 0*/,
    358                                               int cMinDuration /* = 2000 */)
    359 {
    360     /* Prepare pixmap: */
    361     QPixmap *pPixmap = NULL;
    362     if (!strImage.isEmpty())
    363         pPixmap = new QPixmap(strImage);
    364 
    365     /* Create progress-dialog: */
    366     QWidget *pDlgParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
    367     QPointer<UIProgressDialog> pProgressDlg = new UIProgressDialog(progress, strTitle, pPixmap, cMinDuration, pDlgParent);
    368     windowManager().registerNewParent(pProgressDlg, pDlgParent);
    369 
    370     /* Run the dialog with the 350 ms refresh interval. */
    371     pProgressDlg->run(350);
    372 
    373     /* Make sure progress-dialog still valid: */
    374     bool fRc;
    375     if (pProgressDlg)
    376     {
    377         /* Delete progress-dialog: */
    378         delete pProgressDlg;
    379 
    380         fRc = true;
    381     }
    382     else
    383         fRc = false;
    384 
    385     /* Cleanup pixmap: */
    386     if (pPixmap)
    387         delete pPixmap;
    388 
    389     return fRc;
    390 }
    391 
    392 #ifdef RT_OS_LINUX
    393 void UIMessageCenter::warnAboutWrongUSBMounted() const
    394 {
    395     alert(0, MessageType_Warning,
    396           tr("You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. "
    397              "We strongly recommend that you change this, as it is a severe mis-configuration of "
    398              "your system which could cause USB devices to fail in unexpected ways."),
    399           "warnAboutWrongUSBMounted");
    400 }
    401 #endif /* RT_OS_LINUX */
    402 
    403 void UIMessageCenter::cannotStartSelector() const
    404 {
    405     alert(0, MessageType_Critical,
    406           tr("<p>Cannot start the VirtualBox Manager due to local restrictions.</p>"
    407              "<p>The application will now terminate.</p>"));
    408 }
    409 
    410 void UIMessageCenter::showBetaBuildWarning() const
    411 {
    412     alert(0, MessageType_Warning,
    413           tr("You are running a prerelease version of VirtualBox. "
    414              "This version is not suitable for production use."));
    415 }
    416 
    417 void UIMessageCenter::showExperimentalBuildWarning() const
    418 {
    419     alert(0, MessageType_Warning,
    420           tr("You are running an EXPERIMENTAL build of VirtualBox. "
    421              "This version is not suitable for production use."));
    422 }
    423 
    424 void UIMessageCenter::cannotInitUserHome(const QString &strUserHome) const
    425 {
    426     error(0, MessageType_Critical,
    427           tr("<p>Failed to initialize COM because the VirtualBox global "
    428              "configuration directory <b><nobr>%1</nobr></b> is not accessible. "
    429              "Please check the permissions of this directory and of its parent directory.</p>"
    430              "<p>The application will now terminate.</p>")
    431              .arg(strUserHome),
    432           formatErrorInfo(COMErrorInfo()));
    433 }
    434 
    435 void UIMessageCenter::cannotInitCOM(HRESULT rc) const
    436 {
    437     error(0, MessageType_Critical,
    438           tr("<p>Failed to initialize COM or to find the VirtualBox COM server. "
    439              "Most likely, the VirtualBox server is not running or failed to start.</p>"
    440              "<p>The application will now terminate.</p>"),
    441           formatErrorInfo(COMErrorInfo(), rc));
    442 }
    443 
    444 void UIMessageCenter::cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const
    445 {
    446     error(0, MessageType_Critical,
    447           tr("<p>Failed to create the VirtualBoxClient COM object.</p>"
    448              "<p>The application will now terminate.</p>"),
    449           formatErrorInfo(client));
    450 }
    451 
    452 void UIMessageCenter::cannotAcquireVirtualBox(const CVirtualBoxClient &client) const
    453 {
    454     QString err = tr("<p>Failed to acquire the VirtualBox COM object.</p>"
    455                      "<p>The application will now terminate.</p>");
    456 #if defined(VBOX_WS_X11) || defined(VBOX_WS_MAC)
    457     if (client.lastRC() == NS_ERROR_SOCKET_FAIL)
    458         err += tr("<p>The reason for this error are most likely wrong permissions of the IPC "
    459                   "daemon socket due to an installation problem. Please check the permissions of "
    460                   "<font color=blue>'/tmp'</font> and <font color=blue>'/tmp/.vbox-*-ipc/'</font></p>");
    461 #endif
    462     error(0, MessageType_Critical, err, formatErrorInfo(client));
    463 }
    464 
    465 void UIMessageCenter::cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const
    466 {
    467     alert(0, MessageType_Error,
    468           tr("<p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>"
    469              "<p>The language will be temporarily reset to the system default language. "
    470              "Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the "
    471              "VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>")
    472              .arg(strLangId).arg(strNlsPath));
    473 }
    474 
    475 void UIMessageCenter::cannotLoadLanguage(const QString &strLangFile) const
    476 {
    477     alert(0, MessageType_Error,
    478           tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. "
    479              "<p>The language will be temporarily reset to English (built-in). "
    480              "Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the "
    481              "VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>")
    482              .arg(strLangFile));
    483 }
    484 
    485 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const
    486 {
    487     error(0, MessageType_Error,
    488           tr("There is no virtual machine named <b>%1</b>.")
    489              .arg(strName),
    490           formatErrorInfo(vbox));
    491 }
    492 
    493 void UIMessageCenter::cannotFindMachineById(const CVirtualBox &vbox, const QString &strId) const
    494 {
    495     error(0, MessageType_Error,
    496           tr("There is no virtual machine with the identifier <b>%1</b>.")
    497              .arg(strId),
    498           formatErrorInfo(vbox));
    499 }
    500 
    501 void UIMessageCenter::cannotOpenSession(const CSession &session) const
    502 {
    503     error(0, MessageType_Error,
    504           tr("Failed to create a new session."),
    505           formatErrorInfo(session));
    506 }
    507 
    508 void UIMessageCenter::cannotOpenSession(const CMachine &machine) const
    509 {
    510     error(0, MessageType_Error,
    511           tr("Failed to open a session for the virtual machine <b>%1</b>.")
    512              .arg(CMachine(machine).GetName()),
    513           formatErrorInfo(machine));
    514 }
    515 
    516 void UIMessageCenter::cannotOpenSession(const CProgress &progress, const QString &strMachineName) const
    517 {
    518     error(0, MessageType_Error,
    519           tr("Failed to open a session for the virtual machine <b>%1</b>.")
    520              .arg(strMachineName),
    521           formatErrorInfo(progress));
    522 }
    523 
    524 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &medium) const
    525 {
    526     error(0, MessageType_Error,
    527           tr("Failed to access the disk image file <nobr><b>%1</b></nobr>.")
    528              .arg(medium.location()),
    529           formatErrorInfo(medium.result()));
    530 }
    531 
    532 void UIMessageCenter::cannotOpenURL(const QString &strUrl) const
    533 {
    534     alert(0, MessageType_Error,
    535           tr("Failed to open <tt>%1</tt>. "
    536              "Make sure your desktop environment can properly handle URLs of this type.")
    537              .arg(strUrl));
    538 }
    539 
    540 void UIMessageCenter::cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue)
    541 {
    542     error(0, MessageType_Error,
    543           tr("Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.")
    544              .arg(strKey, strValue),
    545           formatErrorInfo(vbox));
    546 }
    547 
    548 void UIMessageCenter::cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue)
    549 {
    550     error(0, MessageType_Error,
    551           tr("Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.")
    552              .arg(strKey, CMachine(machine).GetName(), strValue),
    553           formatErrorInfo(machine));
    554 }
    555 
    556 void UIMessageCenter::warnAboutInvalidEncryptionPassword(const QString &strPasswordId, QWidget *pParent /* = 0 */)
    557 {
    558     alert(pParent, MessageType_Error,
    559           tr("Encryption password for <nobr>ID = '%1'</nobr> is invalid.")
    560              .arg(strPasswordId));
    561 }
    562 
    563 void UIMessageCenter::cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const
    564 {
    565     error(0, MessageType_Error,
    566           tr("Failed to open virtual machine located in %1.")
    567              .arg(strMachinePath),
    568           formatErrorInfo(vbox));
    569 }
    570 
    571 void UIMessageCenter::cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) const
    572 {
    573     alert(0, MessageType_Error,
    574           tr("Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.")
    575              .arg(strMachineName, strMachinePath));
    576 }
    577 
    578 void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strCollisionName, const QString &strGroupName) const
    579 {
    580     alert(0, MessageType_Error,
    581           tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> "
    582              "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>"
    583              "<p>Please resolve this name-conflict and try again.</p>")
    584              .arg(strCollisionName, strGroupName));
    585 }
    586 
    587 bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) const
    588 {
    589     return questionBinary(0, MessageType_Question,
    590                           tr("<p>You are trying to move group <nobr><b>%1</b></nobr> "
    591                              "to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>"
    592                              "<p>Would you like to automatically rename it?</p>")
    593                              .arg(strName, strGroupName),
    594                           0 /* auto-confirm id */,
    595                           tr("Rename"));
    596 }
    597 
    598 void UIMessageCenter::cannotSetGroups(const CMachine &machine) const
    599 {
    600     /* Compose machine name: */
    601     QString strName = CMachine(machine).GetName();
    602     if (strName.isEmpty())
    603         strName = QFileInfo(CMachine(machine).GetSettingsFilePath()).baseName();
    604     /* Show the error: */
    605     error(0, MessageType_Error,
    606           tr("Failed to set groups of the virtual machine <b>%1</b>.")
    607              .arg(strName),
    608           formatErrorInfo(machine));
    609 }
    610 
    611 bool UIMessageCenter::confirmMachineItemRemoval(const QStringList &names) const
    612 {
    613     return questionBinary(0, MessageType_Question,
    614                           tr("<p>You are about to remove following virtual machine items from the machine list:</p>"
    615                              "<p><b>%1</b></p><p>Do you wish to proceed?</p>")
    616                              .arg(names.join(", ")),
    617                           0 /* auto-confirm id */,
    618                           tr("Remove") /* ok button text */,
    619                           QString() /* cancel button text */,
    620                           false /* ok button by default? */);
    621 }
    622 
    623 int UIMessageCenter::confirmMachineRemoval(const QList<CMachine> &machines) const
    624 {
    625     /* Enumerate the machines: */
    626     int cInacessibleMachineCount = 0;
    627     bool fMachineWithHardDiskPresent = false;
    628     QString strMachineNames;
    629     foreach (const CMachine &machine, machines)
    630     {
    631         /* Prepare machine name: */
    632         QString strMachineName;
    633         if (machine.GetAccessible())
    634         {
    635             /* Just get machine name: */
    636             strMachineName = machine.GetName();
    637             /* Enumerate the attachments: */
    638             const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
    639             foreach (const CMediumAttachment &attachment, attachments)
    640             {
    641                 /* Check if the medium is a hard disk: */
    642                 if (attachment.GetType() == KDeviceType_HardDisk)
    643                 {
    644                     /* Check if that hard disk isn't shared.
    645                      * If hard disk is shared, it will *never* be deleted: */
    646                     QVector<QString> usedMachineList = attachment.GetMedium().GetMachineIds();
    647                     if (usedMachineList.size() == 1)
    648                     {
    649                         fMachineWithHardDiskPresent = true;
    650                         break;
    651                     }
    652                 }
    653             }
    654         }
    655         else
    656         {
    657             /* Compose machine name: */
    658             QFileInfo fi(machine.GetSettingsFilePath());
    659             strMachineName = VBoxGlobal::hasAllowedExtension(fi.completeSuffix(), VBoxFileExts) ? fi.completeBaseName() : fi.fileName();
    660             /* Increment inacessible machine count: */
    661             ++cInacessibleMachineCount;
    662         }
    663         /* Append machine name to the full name string: */
    664         strMachineNames += QString(strMachineNames.isEmpty() ? "<b>%1</b>" : ", <b>%1</b>").arg(strMachineName);
    665     }
    666 
    667     /* Prepare message text: */
    668     QString strText = cInacessibleMachineCount == machines.size() ?
    669                       tr("<p>You are about to remove following inaccessible virtual machines from the machine list:</p>"
    670                          "<p>%1</p>"
    671                          "<p>Do you wish to proceed?</p>")
    672                          .arg(strMachineNames) :
    673                       fMachineWithHardDiskPresent ?
    674                       tr("<p>You are about to remove following virtual machines from the machine list:</p>"
    675                          "<p>%1</p>"
    676                          "<p>Would you like to delete the files containing the virtual machine from your hard disk as well? "
    677                          "Doing this will also remove the files containing the machine's virtual hard disks "
    678                          "if they are not in use by another machine.</p>")
    679                          .arg(strMachineNames) :
    680                       tr("<p>You are about to remove following virtual machines from the machine list:</p>"
    681                          "<p>%1</p>"
    682                          "<p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p>")
    683                          .arg(strMachineNames);
    684 
    685     /* Prepare message itself: */
    686     return cInacessibleMachineCount == machines.size() ?
    687            message(0, MessageType_Question,
    688                    strText, QString(),
    689                    0 /* auto-confirm id */,
    690                    AlertButton_Ok,
    691                    AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    692                    0,
    693                    tr("Remove")) :
    694            message(0, MessageType_Question,
    695                    strText, QString(),
    696                    0 /* auto-confirm id */,
    697                    AlertButton_Choice1,
    698                    AlertButton_Choice2,
    699                    AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    700                    tr("Delete all files"),
    701                    tr("Remove only"));
    702 }
    703 
    704 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine) const
    705 {
    706     error(0, MessageType_Error,
    707           tr("Failed to remove the virtual machine <b>%1</b>.")
    708              .arg(CMachine(machine).GetName()),
    709           formatErrorInfo(machine));
    710 }
    711 
    712 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const
    713 {
    714     error(0, MessageType_Error,
    715           tr("Failed to remove the virtual machine <b>%1</b>.")
    716              .arg(CMachine(machine).GetName()),
    717           formatErrorInfo(progress));
    718 }
    719 
    720 bool UIMessageCenter::warnAboutInaccessibleMedia() const
    721 {
    722     return questionBinary(0, MessageType_Warning,
    723                           tr("<p>One or more disk image files are not currently accessible. As a result, you will "
    724                              "not be able to operate virtual machines that use these files until "
    725                              "they become accessible later.</p>"
    726                              "<p>Press <b>Check</b> to open the Virtual Media Manager window and "
    727                              "see which files are inaccessible, or press <b>Ignore</b> to "
    728                              "ignore this message.</p>"),
    729                           "warnAboutInaccessibleMedia",
    730                           tr("Ignore"), tr("Check", "inaccessible media message box"));
    731 }
    732 
    733 bool UIMessageCenter::confirmDiscardSavedState(const QString &strNames) const
    734 {
    735     return questionBinary(0, MessageType_Question,
    736                           tr("<p>Are you sure you want to discard the saved state of "
    737                              "the following virtual machines?</p><p><b>%1</b></p>"
    738                              "<p>This operation is equivalent to resetting or powering off "
    739                              "the machine without doing a proper shutdown of the guest OS.</p>")
    740                              .arg(strNames),
    741                           0 /* auto-confirm id */,
    742                           tr("Discard", "saved state"));
    743 }
    744 
    745 bool UIMessageCenter::confirmResetMachine(const QString &strNames) const
    746 {
    747     return questionBinary(0, MessageType_Question,
    748                           tr("<p>Do you really want to reset the following virtual machines?</p>"
    749                              "<p><b>%1</b></p><p>This will cause any unsaved data "
    750                              "in applications running inside it to be lost.</p>")
    751                              .arg(strNames),
    752                           "confirmResetMachine" /* auto-confirm id */,
    753                           tr("Reset", "machine"));
    754 }
    755 
    756 bool UIMessageCenter::confirmACPIShutdownMachine(const QString &strNames) const
    757 {
    758     return questionBinary(0, MessageType_Question,
    759                           tr("<p>Do you really want to send an ACPI shutdown signal "
    760                              "to the following virtual machines?</p><p><b>%1</b></p>")
    761                              .arg(strNames),
    762                           "confirmACPIShutdownMachine" /* auto-confirm id */,
    763                           tr("ACPI Shutdown", "machine"));
    764 }
    765 
    766 bool UIMessageCenter::confirmPowerOffMachine(const QString &strNames) const
    767 {
    768     return questionBinary(0, MessageType_Question,
    769                           tr("<p>Do you really want to power off the following virtual machines?</p>"
    770                              "<p><b>%1</b></p><p>This will cause any unsaved data in applications "
    771                              "running inside it to be lost.</p>")
    772                              .arg(strNames),
    773                           "confirmPowerOffMachine" /* auto-confirm id */,
    774                           tr("Power Off", "machine"));
    775 }
    776 
    777 void UIMessageCenter::cannotPauseMachine(const CConsole &console) const
    778 {
    779     error(0, MessageType_Error,
    780           tr("Failed to pause the execution of the virtual machine <b>%1</b>.")
    781              .arg(CConsole(console).GetMachine().GetName()),
    782           formatErrorInfo(console));
    783 }
    784 
    785 void UIMessageCenter::cannotResumeMachine(const CConsole &console) const
    786 {
    787     error(0, MessageType_Error,
    788           tr("Failed to resume the execution of the virtual machine <b>%1</b>.")
    789              .arg(CConsole(console).GetMachine().GetName()),
    790           formatErrorInfo(console));
    791 }
    792 
    793 void UIMessageCenter::cannotDiscardSavedState(const CMachine &machine) const
    794 {
    795     error(0, MessageType_Error,
    796           tr("Failed to discard the saved state of the virtual machine <b>%1</b>.")
    797              .arg(machine.GetName()),
    798           formatErrorInfo(machine));
    799 }
    800 
    801 void UIMessageCenter::cannotSaveMachineState(const CMachine &machine)
    802 {
    803     error(0, MessageType_Error,
    804           tr("Failed to save the state of the virtual machine <b>%1</b>.")
    805              .arg(machine.GetName()),
    806           formatErrorInfo(machine));
    807 }
    808 
    809 void UIMessageCenter::cannotSaveMachineState(const CProgress &progress, const QString &strMachineName)
    810 {
    811     error(0, MessageType_Error,
    812           tr("Failed to save the state of the virtual machine <b>%1</b>.")
    813              .arg(strMachineName),
    814           formatErrorInfo(progress));
    815 }
    816 
    817 void UIMessageCenter::cannotACPIShutdownMachine(const CConsole &console) const
    818 {
    819     error(0, MessageType_Error,
    820           tr("Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.")
    821              .arg(CConsole(console).GetMachine().GetName()),
    822           formatErrorInfo(console));
    823 }
    824 
    825 void UIMessageCenter::cannotPowerDownMachine(const CConsole &console) const
    826 {
    827     error(0, MessageType_Error,
    828           tr("Failed to stop the virtual machine <b>%1</b>.")
    829              .arg(CConsole(console).GetMachine().GetName()),
    830           formatErrorInfo(console));
    831 }
    832 
    833 void UIMessageCenter::cannotPowerDownMachine(const CProgress &progress, const QString &strMachineName) const
    834 {
    835     error(0, MessageType_Error,
    836           tr("Failed to stop the virtual machine <b>%1</b>.")
    837              .arg(strMachineName),
    838           formatErrorInfo(progress));
    839 }
    840 
    841 bool UIMessageCenter::confirmStartMultipleMachines(const QString &strNames) const
    842 {
    843     return questionBinary(0, MessageType_Question,
    844                           tr("<p>You are about to start all of the following virtual machines:</p>"
    845                              "<p><b>%1</b></p><p>This could take some time and consume a lot of "
    846                              "host system resources. Do you wish to proceed?</p>").arg(strNames),
    847                           "confirmStartMultipleMachines" /* auto-confirm id */);
    848 }
    849 
    850 int UIMessageCenter::confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) const
    851 {
    852     return fAlsoCreateNewSnapshot ?
    853            messageWithOption(0, MessageType_Question,
    854                              tr("<p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p>"
    855                                 "<p>You can create a snapshot of the current state of the virtual machine first by checking the box below; "
    856                                 "if you do not do this the current state will be permanently lost. Do you wish to proceed?</p>")
    857                                 .arg(strSnapshotName),
    858                              tr("Create a snapshot of the current machine state"),
    859                              !gEDataManager->messagesWithInvertedOption().contains("confirmSnapshotRestoring"),
    860                              AlertButton_Ok,
    861                              AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    862                              0 /* 3rd button */,
    863                              tr("Restore"), tr("Cancel"), QString() /* 3rd button text */) :
    864            message(0, MessageType_Question,
    865                    tr("<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>")
    866                       .arg(strSnapshotName),
    867                    QString() /* details */,
    868                    0 /* auto-confirm id */,
    869                    AlertButton_Ok,
    870                    AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    871                    0 /* 3rd button */,
    872                    tr("Restore"), tr("Cancel"), QString() /* 3rd button text */);
    873 }
    874 
    875 bool UIMessageCenter::confirmSnapshotRemoval(const QString &strSnapshotName) const
    876 {
    877     return questionBinary(0, MessageType_Question,
    878                           tr("<p>Deleting the snapshot will cause the state information saved in it to be lost, and storage data spread over "
    879                              "several image files that VirtualBox has created together with the snapshot will be merged into one file. "
    880                              "This can be a lengthy process, and the information in the snapshot cannot be recovered.</p>"
    881                              "</p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>")
    882                              .arg(strSnapshotName),
    883                           0 /* auto-confirm id */,
    884                           tr("Delete") /* ok button text */,
    885                           QString() /* cancel button text */,
    886                           false /* ok button by default? */);
    887 }
    888 
    889 bool UIMessageCenter::warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName,
    890                                                         const QString &strTargetImageName,
    891                                                         const QString &strTargetImageMaxSize,
    892                                                         const QString &strTargetFileSystemFree) const
    893 {
    894     return questionBinary(0, MessageType_Question,
    895                           tr("<p>Deleting the snapshot %1 will temporarily need more storage space. In the worst case the size of image %2 will grow by %3, "
    896                               "however on this filesystem there is only %4 free.</p><p>Running out of storage space during the merge operation can result in "
    897                               "corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting "
    898                               "the snapshot at your own risk.</p>")
    899                               .arg(strSnapshotName, strTargetImageName, strTargetImageMaxSize, strTargetFileSystemFree),
    900                           0 /* auto-confirm id */,
    901                           tr("Delete") /* ok button text */,
    902                           QString() /* cancel button text */,
    903                           false /* ok button by default? */);
    904 }
    905 
    906 void UIMessageCenter::cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent /* = 0*/) const
    907 {
    908     error(pParent, MessageType_Error,
    909           tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")
    910              .arg(strMachineName),
    911           formatErrorInfo(machine));
    912 }
    913 
    914 void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const
    915 {
    916     error(pParent, MessageType_Error,
    917           tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")
    918              .arg(strMachineName),
    919           formatErrorInfo(progress));
    920 }
    921 
    922 bool UIMessageCenter::cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const
    923 {
    924     error(0, MessageType_Error,
    925           tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    926              .arg(strSnapshotName, strMachineName),
    927           formatErrorInfo(machine));
    928     return false;
    929 }
    930 
    931 bool UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const
    932 {
    933     error(0, MessageType_Error,
    934           tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    935              .arg(strSnapshotName, strMachineName),
    936           formatErrorInfo(progress));
    937     return false;
    938 }
    939 
    940 void UIMessageCenter::cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const
    941 {
    942     error(0, MessageType_Error,
    943           tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    944              .arg(strSnapshotName, strMachineName),
    945           formatErrorInfo(machine));
    946 }
    947 
    948 void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const
    949 {
    950     error(0, MessageType_Error,
    951           tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    952              .arg(strSnapshotName).arg(strMachineName),
    953           formatErrorInfo(progress));
    954 }
    955 
    956 void UIMessageCenter::cannotFindSnapshotByName(const CMachine &comMachine,
    957                                                const QString &strName,
    958                                                QWidget *pParent /* = 0*/) const
    959 {
    960     error(pParent, MessageType_Error,
    961           tr("Can't find snapshot named <b>%1</b>.")
    962              .arg(strName),
    963           formatErrorInfo(comMachine));
    964 }
    965 
    966 void UIMessageCenter::cannotFindSnapshotById(const CMachine &comMachine,
    967                                              const QString &strId,
    968                                              QWidget *pParent /* = 0 */) const
    969 {
    970     error(pParent, MessageType_Error,
    971           tr("Can't find snapshot with ID=<b>%1</b>.")
    972              .arg(strId),
    973           formatErrorInfo(comMachine));
    974 }
    975 
    976 void UIMessageCenter::cannotAcquireSnapshotAttributes(const CSnapshot &comSnapshot,
    977                                                       QWidget *pParent /* = 0 */)
    978 {
    979     error(pParent, MessageType_Error,
    980           tr("Can't acquire snapshot attributes."),
    981           formatErrorInfo(comSnapshot));
    982 }
    983 
    984 void UIMessageCenter::cannotSaveSettings(const QString strDetails, QWidget *pParent /* = 0 */) const
    985 {
    986     error(pParent, MessageType_Error,
    987           tr("Failed to save the settings."),
    988           strDetails);
    989 }
    990 
    991 bool UIMessageCenter::confirmNATNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const
    992 {
    993     return questionBinary(pParent, MessageType_Question,
    994                           tr("<p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p>"
    995                              "<p>If this network is in use by one or more virtual "
    996                              "machine network adapters these adapters will no longer be "
    997                              "usable until you correct their settings by either choosing "
    998                              "a different network name or a different adapter attachment "
    999                              "type.</p>")
    1000                              .arg(strName),
    1001                           0 /* auto-confirm id */,
    1002                           tr("Remove") /* ok button text */,
    1003                           QString() /* cancel button text */,
    1004                           false /* ok button by default? */);
    1005 }
    1006 
    1007 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties, QWidget *pParent /* = 0*/) const
    1008 {
    1009     error(pParent, MessageType_Critical,
    1010           tr("Failed to set global VirtualBox properties."),
    1011           formatErrorInfo(properties));
    1012 }
    1013 
    1014 void UIMessageCenter::warnAboutUnaccessibleUSB(const COMBaseWithEI &object, QWidget *pParent /* = 0*/) const
    1015 {
    1016     /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return
    1017      * E_NOTIMPL, it means the USB support is intentionally missing
    1018      * (as in the OSE version). Don't show the error message in this case. */
    1019     COMResult res(object);
    1020     if (res.rc() == E_NOTIMPL)
    1021         return;
    1022     /* Show the error: */
    1023     error(pParent, res.isWarning() ? MessageType_Warning : MessageType_Error,
    1024           tr("Failed to access the USB subsystem."),
    1025           formatErrorInfo(res),
    1026           "warnAboutUnaccessibleUSB");
    1027 }
    1028 
    1029 void UIMessageCenter::warnAboutStateChange(QWidget *pParent /* = 0*/) const
    1030 {
    1031     if (warningShown("warnAboutStateChange"))
    1032         return;
    1033     setWarningShown("warnAboutStateChange", true);
    1034 
    1035     alert(pParent, MessageType_Warning,
    1036           tr("The virtual machine that you are changing has been started. "
    1037              "Only certain settings can be changed while a machine is running. "
    1038              "All other changes will be lost if you close this window now."));
    1039 
    1040     setWarningShown("warnAboutStateChange", false);
    1041 }
    1042 
    1043 bool UIMessageCenter::confirmSettingsReloading(QWidget *pParent /* = 0*/) const
    1044 {
    1045     return questionBinary(pParent, MessageType_Question,
    1046                           tr("<p>The machine settings were changed while you were editing them. "
    1047                              "You currently have unsaved setting changes.</p>"
    1048                              "<p>Would you like to reload the changed settings or to keep your own changes?</p>"),
    1049                           0 /* auto-confirm id */,
    1050                           tr("Reload settings"), tr("Keep changes"));
    1051 }
    1052 
    1053 int UIMessageCenter::confirmHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent /* = 0*/) const
    1054 {
    1055     return questionTrinary(pParent, MessageType_Question,
    1056                            tr("<p>You are about to add a virtual hard disk to controller <b>%1</b>.</p>"
    1057                               "<p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>")
    1058                               .arg(strControllerName),
    1059                            0 /* auto-confirm id */,
    1060                            tr("Create &new disk"), tr("&Choose existing disk"));
    1061 }
    1062 
    1063 int UIMessageCenter::confirmOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent /* = 0*/) const
    1064 {
    1065     return questionTrinary(pParent, MessageType_Question,
    1066                            tr("<p>You are about to add a new optical drive to controller <b>%1</b>.</p>"
    1067                               "<p>Would you like to choose a virtual optical disk to put in the drive "
    1068                               "or to leave it empty for now?</p>")
    1069                               .arg(strControllerName),
    1070                            0 /* auto-confirm id */,
    1071                            tr("Leave &empty"), tr("&Choose disk"));
    1072 }
    1073 
    1074 int UIMessageCenter::confirmFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent /* = 0*/) const
    1075 {
    1076     return questionTrinary(pParent, MessageType_Question,
    1077                            tr("<p>You are about to add a new floppy drive to controller <b>%1</b>.</p>"
    1078                               "<p>Would you like to choose a virtual floppy disk to put in the drive "
    1079                               "or to leave it empty for now?</p>")
    1080                               .arg(strControllerName),
    1081                            0 /* auto-confirm id */,
    1082                            tr("Leave &empty"), tr("&Choose disk"));
    1083 }
    1084 
    1085 int UIMessageCenter::confirmRemovingOfLastDVDDevice(QWidget *pParent /* = 0*/) const
    1086 {
    1087     return questionBinary(pParent, MessageType_Info,
    1088                           tr("<p>Are you sure you want to delete the optical drive?</p>"
    1089                              "<p>You will not be able to insert any optical disks or ISO images "
    1090                              "or install the Guest Additions without it!</p>"),
    1091                           0 /* auto-confirm id */,
    1092                           tr("&Remove", "medium") /* ok button text */,
    1093                           QString() /* cancel button text */,
    1094                           false /* ok button by default? */);
    1095 }
    1096 
    1097 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType type,
    1098                                          const QString &strLocation, const StorageSlot &storageSlot,
    1099                                          QWidget *pParent /* = 0*/)
    1100 {
    1101     QString strMessage;
    1102     switch (type)
    1103     {
    1104         case UIMediumType_HardDisk:
    1105         {
    1106             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>.")
    1107                             .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    1108             break;
    1109         }
    1110         case UIMediumType_DVD:
    1111         {
    1112             strMessage = tr("Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
    1113                             .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    1114             break;
    1115         }
    1116         case UIMediumType_Floppy:
    1117         {
    1118             strMessage = tr("Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
    1119                             .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    1120             break;
    1121         }
    1122         default:
    1123             break;
    1124     }
    1125     error(pParent, MessageType_Error,
    1126           strMessage, formatErrorInfo(machine));
    1127 }
    1128 
    1129 bool UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent /* = 0 */) const
    1130 {
    1131     alert(pParent, MessageType_Error,
    1132           tr("The current port forwarding rules are not valid. "
    1133              "None of the host or guest port values may be set to zero."));
    1134     return false;
    1135 }
    1136 
    1137 bool UIMessageCenter::warnAboutIncorrectAddress(QWidget *pParent /* = 0 */) const
    1138 {
    1139     alert(pParent, MessageType_Error,
    1140           tr("The current port forwarding rules are not valid. "
    1141              "All of the host or guest address values should be correct or empty."));
    1142     return false;
    1143 }
    1144 
    1145 bool UIMessageCenter::warnAboutEmptyGuestAddress(QWidget *pParent /* = 0 */) const
    1146 {
    1147     alert(pParent, MessageType_Error,
    1148           tr("The current port forwarding rules are not valid. "
    1149              "None of the guest address values may be empty."));
    1150     return false;
    1151 }
    1152 
    1153 bool UIMessageCenter::warnAboutNameShouldBeUnique(QWidget *pParent /* = 0 */) const
    1154 {
    1155     alert(pParent, MessageType_Error,
    1156           tr("The current port forwarding rules are not valid. "
    1157              "Rule names should be unique."));
    1158     return false;
    1159 }
    1160 
    1161 bool UIMessageCenter::warnAboutRulesConflict(QWidget *pParent /* = 0 */) const
    1162 {
    1163     alert(pParent, MessageType_Error,
    1164           tr("The current port forwarding rules are not valid. "
    1165              "Few rules have same host ports and conflicting IP addresses."));
    1166     return false;
    1167 }
    1168 
    1169 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent /* = 0*/) const
    1170 {
    1171     return questionBinary(pParent, MessageType_Question,
    1172                           tr("<p>There are unsaved changes in the port forwarding configuration.</p>"
    1173                              "<p>If you proceed your changes will be discarded.</p>"),
    1174                           0 /* auto-confirm id */,
    1175                           QString() /* ok button text */,
    1176                           QString() /* cancel button text */,
    1177                           false /* ok button by default? */);
    1178 }
    1179 
    1180 void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /* = 0*/) const
    1181 {
    1182     error(pParent, MessageType_Error,
    1183           tr("Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.")
    1184              .arg(machine.GetName(), CMachine(machine).GetSettingsFilePath()),
    1185           formatErrorInfo(machine));
    1186 }
    1187 
    1188 void UIMessageCenter::cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent /* = 0*/) const
    1189 {
    1190     error(pParent, MessageType_Error,
    1191           tr("<p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p>")
    1192              .arg(gpConverter->toString(oldMediumType)).arg(gpConverter->toString(newMediumType)),
    1193           formatErrorInfo(medium));
    1194 }
    1195 
    1196 void UIMessageCenter::cannotMoveMediumStorage(const CMedium &comMedium, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent /* = 0 */) const
    1197 {
    1198     error(pParent, MessageType_Error,
    1199           tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.")
    1200              .arg(strLocationOld, strLocationNew),
    1201           formatErrorInfo(comMedium));
    1202 }
    1203 
    1204 void UIMessageCenter::cannotMoveMediumStorage(const CProgress &comProgress, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent /* = 0 */) const
    1205 {
    1206     error(pParent, MessageType_Error,
    1207           tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.")
    1208              .arg(strLocationOld, strLocationNew),
    1209           formatErrorInfo(comProgress));
    1210 }
    1211 
    1212 void UIMessageCenter::cannotChangeMediumDescription(const CMedium &comMedium, const QString &strLocation, QWidget *pParent /* = 0 */) const
    1213 {
    1214     error(pParent, MessageType_Error,
    1215           tr("<p>Error changing the description of the disk image <b>%1</b>.</p>")
    1216              .arg(strLocation),
    1217           formatErrorInfo(comMedium));
    1218 }
    1219 
    1220 bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, QWidget *pParent /* = 0*/) const
    1221 {
    1222     /* Prepare the usage: */
    1223     QStringList usage;
    1224     CVirtualBox vbox = vboxGlobal().virtualBox();
    1225     foreach (const QString &strMachineID, medium.curStateMachineIds())
    1226     {
    1227         CMachine machine = vbox.FindMachine(strMachineID);
    1228         if (!vbox.isOk() || machine.isNull())
    1229             continue;
    1230         usage << machine.GetName();
    1231     }
    1232     /* Show the question: */
    1233     return questionBinary(pParent, MessageType_Question,
    1234                           tr("<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p>"
    1235                              "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>")
    1236                              .arg(medium.location(), usage.join(", ")),
    1237                           0 /* auto-confirm id */,
    1238                           tr("Release", "detach medium"));
    1239 }
    1240 
    1241 bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pParent /* = 0*/) const
    1242 {
    1243     /* Prepare the message: */
    1244     QString strMessage;
    1245     switch (medium.type())
    1246     {
    1247         case UIMediumType_HardDisk:
    1248         {
    1249             strMessage = tr("<p>Are you sure you want to remove the virtual hard disk "
    1250                             "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");
    1251             /* Compose capabilities flag: */
    1252             qulonglong caps = 0;
    1253             QVector<KMediumFormatCapabilities> capabilities;
    1254             capabilities = medium.medium().GetMediumFormat().GetCapabilities();
    1255             for (int i = 0; i < capabilities.size(); ++i)
    1256                 caps |= capabilities[i];
    1257             /* Check capabilities for additional options: */
    1258             if (caps & KMediumFormatCapabilities_File)
    1259             {
    1260                 if (medium.state() == KMediumState_Inaccessible)
    1261                     strMessage += tr("<p>As this hard disk is inaccessible its image file"
    1262                                      " can not be deleted.</p>");
    1263             }
    1264             break;
    1265         }
    1266         case UIMediumType_DVD:
    1267         {
    1268             strMessage = tr("<p>Are you sure you want to remove the virtual optical disk "
    1269                             "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");
    1270             strMessage += tr("<p>Note that the storage unit of this medium will not be "
    1271                              "deleted and that it will be possible to use it later again.</p>");
    1272             break;
    1273         }
    1274         case UIMediumType_Floppy:
    1275         {
    1276             strMessage = tr("<p>Are you sure you want to remove the virtual floppy disk "
    1277                             "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");
    1278             strMessage += tr("<p>Note that the storage unit of this medium will not be "
    1279                              "deleted and that it will be possible to use it later again.</p>");
    1280             break;
    1281         }
    1282         default:
    1283             break;
    1284     }
    1285     /* Show the question: */
    1286     return questionBinary(pParent, MessageType_Question,
    1287                           strMessage.arg(medium.location()),
    1288                           0 /* auto-confirm id */,
    1289                           tr("Remove", "medium") /* ok button text */,
    1290                           QString() /* cancel button text */,
    1291                           false /* ok button by default? */);
    1292 }
    1293 
    1294 int UIMessageCenter::confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const
    1295 {
    1296     return questionTrinary(pParent, MessageType_Question,
    1297                            tr("<p>Do you want to delete the storage unit of the virtual hard disk "
    1298                               "<nobr><b>%1</b></nobr>?</p>"
    1299                               "<p>If you select <b>Delete</b> then the specified storage unit "
    1300                               "will be permanently deleted. This operation <b>cannot be "
    1301                               "undone</b>.</p>"
    1302                               "<p>If you select <b>Keep</b> then the hard disk will be only "
    1303                               "removed from the list of known hard disks, but the storage unit "
    1304                               "will be left untouched which makes it possible to add this hard "
    1305                               "disk to the list later again.</p>")
    1306                               .arg(strLocation),
    1307                            0 /* auto-confirm id */,
    1308                            tr("Delete", "hard disk storage"),
    1309                            tr("Keep", "hard disk storage"));
    1310 }
    1311 
    1312 void UIMessageCenter::cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const
    1313 {
    1314     error(pParent, MessageType_Error,
    1315           tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")
    1316              .arg(strLocation),
    1317           formatErrorInfo(medium));
    1318 }
    1319 
    1320 void UIMessageCenter::cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const
    1321 {
    1322     error(pParent, MessageType_Error,
    1323           tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")
    1324              .arg(strLocation),
    1325           formatErrorInfo(progress));
    1326 }
    1327 
    1328 void UIMessageCenter::cannotResizeHardDiskStorage(const CMedium &comMedium, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent /* = 0 */) const
    1329 {
    1330     error(pParent, MessageType_Error,
    1331           tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.")
    1332              .arg(strLocation, strSizeOld, strSizeNew),
    1333           formatErrorInfo(comMedium));
    1334 }
    1335 
    1336 void UIMessageCenter::cannotResizeHardDiskStorage(const CProgress &comProgress, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent /* = 0 */) const
    1337 {
    1338     error(pParent, MessageType_Error,
    1339           tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.")
    1340              .arg(strLocation, strSizeOld, strSizeNew),
    1341           formatErrorInfo(comProgress));
    1342 }
    1343 
    1344 void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /* = 0*/) const
    1345 {
    1346     /* Prepare the message: */
    1347     QString strMessage;
    1348     switch (type)
    1349     {
    1350         case UIMediumType_HardDisk:
    1351         {
    1352             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>.")
    1353                             .arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName());
    1354             break;
    1355         }
    1356         case UIMediumType_DVD:
    1357         {
    1358             strMessage = tr("Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
    1359                             .arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName());
    1360             break;
    1361         }
    1362         case UIMediumType_Floppy:
    1363         {
    1364             strMessage = tr("Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
    1365                             .arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName());
    1366             break;
    1367         }
    1368         default:
    1369             break;
    1370     }
    1371     /* Show the error: */
    1372     error(pParent, MessageType_Error, strMessage, formatErrorInfo(machine));
    1373 }
    1374 
    1375 bool UIMessageCenter::cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent /* = 0*/) const
    1376 {
    1377     /* Compose the message: */
    1378     QString strMessage;
    1379     switch (medium.type())
    1380     {
    1381         case UIMediumType_DVD:
    1382         {
    1383             if (fMount)
    1384             {
    1385                 strMessage = tr("<p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p>");
    1386                 if (fRetry)
    1387                     strMessage += tr("<p>Would you like to try to force insertion of this disk?</p>");
    1388             }
    1389             else
    1390             {
    1391                 strMessage = tr("<p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p>");
    1392                 if (fRetry)
    1393                     strMessage += tr("<p>Would you like to try to force ejection of this disk?</p>");
    1394             }
    1395             break;
    1396         }
    1397         case UIMediumType_Floppy:
    1398         {
    1399             if (fMount)
    1400             {
    1401                 strMessage = tr("<p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p>");
    1402                 if (fRetry)
    1403                     strMessage += tr("<p>Would you like to try to force insertion of this disk?</p>");
    1404             }
    1405             else
    1406             {
    1407                 strMessage = tr("<p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p>");
    1408                 if (fRetry)
    1409                     strMessage += tr("<p>Would you like to try to force ejection of this disk?</p>");
    1410             }
    1411             break;
    1412         }
    1413         default:
    1414             break;
    1415     }
    1416     /* Show the messsage: */
    1417     if (fRetry)
    1418         return errorWithQuestion(pParent, MessageType_Question,
    1419                                  strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()),
    1420                                  formatErrorInfo(machine),
    1421                                  0 /* Auto Confirm ID */,
    1422                                  tr("Force Unmount"));
    1423     error(pParent, MessageType_Error,
    1424           strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()),
    1425           formatErrorInfo(machine));
    1426     return false;
    1427 }
    1428 
    1429 void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType /* type */, const QString &strLocation, QWidget *pParent /* = 0*/) const
    1430 {
    1431     /* Show the error: */
    1432     error(pParent, MessageType_Error,
    1433           tr("Failed to open the disk image file <nobr><b>%1</b></nobr>.").arg(strLocation), formatErrorInfo(vbox));
    1434 }
    1435 
    1436 void UIMessageCenter::cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent /* = 0*/) const
    1437 {
    1438     /* Show the error: */
    1439     error(pParent, MessageType_Error,
    1440           tr("Failed to close the disk image file <nobr><b>%1</b></nobr>.").arg(medium.location()), formatErrorInfo(rc));
    1441 }
    1442 
    1443 bool UIMessageCenter::confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent /* = 0 */) const
    1444 {
    1445     return questionBinary(pParent, MessageType_Question,
    1446                           tr("<p>Deleting this host-only network will remove "
    1447                              "the host-only interface this network is based on. Do you want to "
    1448                              "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>"
    1449                              "<p><b>Note:</b> this interface may be in use by one or more "
    1450                              "virtual network adapters belonging to one of your VMs. "
    1451                              "After it is removed, these adapters will no longer be usable until "
    1452                              "you correct their settings by either choosing a different interface "
    1453                              "name or a different adapter attachment type.</p>")
    1454                              .arg(strName),
    1455                           0 /* auto-confirm id */,
    1456                           tr("Remove") /* ok button text */,
    1457                           QString() /* cancel button text */,
    1458                           false /* ok button by default? */);
    1459 }
    1460 
    1461 void UIMessageCenter::cannotAcquireHostNetworkInterfaces(const CHost &comHost, QWidget *pParent /* = 0 */) const
    1462 {
    1463     error(pParent, MessageType_Error,
    1464           tr("Failed to acquire host network interfaces."),
    1465           formatErrorInfo(comHost));
    1466 }
    1467 
    1468 void UIMessageCenter::cannotFindHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
    1469 {
    1470     error(pParent, MessageType_Error,
    1471           tr("Unable to find the host network interface <b>%1</b>.")
    1472              .arg(strInterfaceName),
    1473           formatErrorInfo(comHost));
    1474 }
    1475 
    1476 void UIMessageCenter::cannotCreateHostNetworkInterface(const CHost &comHost, QWidget *pParent /* = 0 */) const
    1477 {
    1478     error(pParent, MessageType_Error,
    1479           tr("Failed to create a host network interface."),
    1480           formatErrorInfo(comHost));
    1481 }
    1482 
    1483 void UIMessageCenter::cannotCreateHostNetworkInterface(const CProgress &progress, QWidget *pParent /* = 0 */) const
    1484 {
    1485     error(pParent, MessageType_Error,
    1486           tr("Failed to create a host network interface."),
    1487           formatErrorInfo(progress));
    1488 }
    1489 
    1490 void UIMessageCenter::cannotRemoveHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
    1491 {
    1492     error(pParent, MessageType_Error,
    1493           tr("Failed to remove the host network interface <b>%1</b>.")
    1494              .arg(strInterfaceName),
    1495           formatErrorInfo(comHost));
    1496 }
    1497 
    1498 void UIMessageCenter::cannotRemoveHostNetworkInterface(const CProgress &progress, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
    1499 {
    1500     error(pParent, MessageType_Error,
    1501           tr("Failed to remove the host network interface <b>%1</b>.")
    1502              .arg(strInterfaceName),
    1503           formatErrorInfo(progress));
    1504 }
    1505 
    1506 void UIMessageCenter::cannotAcquireHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent /* = 0 */) const
    1507 {
    1508     error(pParent, MessageType_Error,
    1509           tr("Failed to acquire host network interface parameter."),
    1510           formatErrorInfo(comInterface));
    1511 }
    1512 
    1513 void UIMessageCenter::cannotSaveHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent /* = 0 */) const
    1514 {
    1515     error(pParent, MessageType_Error,
    1516           tr("Failed to save host network interface parameter."),
    1517           formatErrorInfo(comInterface));
    1518 }
    1519 
    1520 void UIMessageCenter::cannotCreateDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
    1521 {
    1522     error(pParent, MessageType_Error,
    1523           tr("Failed to create a DHCP server for the network interface <b>%1</b>.")
    1524              .arg(strInterfaceName),
    1525           formatErrorInfo(comVBox));
    1526 }
    1527 
    1528 void UIMessageCenter::cannotRemoveDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
    1529 {
    1530     error(pParent, MessageType_Error,
    1531           tr("Failed to remove the DHCP server for the network interface <b>%1</b>.")
    1532              .arg(strInterfaceName),
    1533           formatErrorInfo(comVBox));
    1534 }
    1535 
    1536 void UIMessageCenter::cannotAcquireDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent /* = 0 */) const
    1537 {
    1538     error(pParent, MessageType_Error,
    1539           tr("Failed to acquire DHCP server parameter."),
    1540           formatErrorInfo(comServer));
    1541 }
    1542 
    1543 void UIMessageCenter::cannotSaveDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent /* = 0 */) const
    1544 {
    1545     error(pParent, MessageType_Error,
    1546           tr("Failed to save DHCP server parameter."),
    1547           formatErrorInfo(comServer));
    1548 }
    1549 
    1550 bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent /* = 0*/) const
    1551 {
    1552     return questionBinary(pParent, MessageType_Warning,
    1553                           tr("You are about to create a new virtual machine without a hard disk. "
    1554                              "You will not be able to install an operating system on the machine "
    1555                              "until you add one. In the mean time you will only be able to start the "
    1556                              "machine using a virtual optical disk or from the network."),
    1557                           0 /* auto-confirm id */,
    1558                           tr("Continue", "no hard disk attached"),
    1559                           tr("Go Back", "no hard disk attached"));
    1560 }
    1561 
    1562 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0*/) const
    1563 {
    1564     error(pParent, MessageType_Error,
    1565           tr("Failed to create a new virtual machine."),
    1566           formatErrorInfo(vbox));
    1567 }
    1568 
    1569 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent /* = 0*/) const
    1570 {
    1571     error(pParent, MessageType_Error,
    1572           tr("Failed to register the virtual machine <b>%1</b>.")
    1573              .arg(strMachineName),
    1574           formatErrorInfo(vbox));
    1575 }
    1576 
    1577 void UIMessageCenter::cannotCreateClone(const CMachine &machine, QWidget *pParent /* = 0*/) const
    1578 {
    1579     error(pParent, MessageType_Error,
    1580           tr("Failed to clone the virtual machine <b>%1</b>.")
    1581              .arg(CMachine(machine).GetName()),
    1582           formatErrorInfo(machine));
    1583 }
    1584 
    1585 void UIMessageCenter::cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const
    1586 {
    1587     error(pParent, MessageType_Error,
    1588           tr("Failed to clone the virtual machine <b>%1</b>.")
    1589              .arg(strMachineName),
    1590           formatErrorInfo(progress));
    1591 }
    1592 
    1593 void UIMessageCenter::cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const
    1594 {
    1595     alert(pParent, MessageType_Info,
    1596           tr("<p>The hard disk storage unit at location <b>%1</b> already exists. "
    1597              "You cannot create a new virtual hard disk that uses this location "
    1598              "because it can be already used by another virtual hard disk.</p>"
    1599              "<p>Please specify a different location.</p>")
    1600              .arg(strLocation));
    1601 }
    1602 
    1603 void UIMessageCenter::cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation, QWidget *pParent /* = 0*/) const
    1604 {
    1605     error(pParent, MessageType_Error,
    1606           tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
    1607              .arg(strLocation),
    1608           formatErrorInfo(vbox));
    1609 }
    1610 
    1611 void UIMessageCenter::cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const
    1612 {
    1613     error(pParent, MessageType_Error,
    1614           tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
    1615              .arg(strLocation),
    1616           formatErrorInfo(medium));
    1617 }
    1618 
    1619 void UIMessageCenter::cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const
    1620 {
    1621     error(pParent, MessageType_Error,
    1622           tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
    1623              .arg(strLocation),
    1624           formatErrorInfo(progress));
    1625 }
    1626 
    1627 void UIMessageCenter::cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const
    1628 {
    1629     alert(pParent, MessageType_Critical,
    1630           tr("<p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p>"
    1631              "<p>Please check that this folder really exists and that you have permissions to remove it.</p>")
    1632              .arg(QFileInfo(strFolderName).fileName()));
    1633 }
    1634 
    1635 void UIMessageCenter::cannotRewriteMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const
    1636 {
    1637     QFileInfo fi(strFolderName);
    1638     alert(pParent, MessageType_Critical,
    1639           tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>"
    1640              "<p>This folder already exists and possibly belongs to another machine.</p>")
    1641              .arg(fi.fileName()).arg(fi.absolutePath()));
    1642 }
    1643 
    1644 void UIMessageCenter::cannotCreateMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const
    1645 {
    1646     QFileInfo fi(strFolderName);
    1647     alert(pParent, MessageType_Critical,
    1648           tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>"
    1649              "<p>Please check that the parent really exists and that you have permissions to create the machine folder.</p>")
    1650              .arg(fi.fileName()).arg(fi.absolutePath()));
    1651 }
    1652 
    1653 void UIMessageCenter::cannotImportAppliance(CAppliance &appliance, QWidget *pParent /* = 0*/) const
    1654 {
    1655     /* Preserve error-info: */
    1656     QString strErrorInfo = formatErrorInfo(appliance);
    1657     /* Add the warnings in the case of an early error: */
    1658     QString strWarningInfo;
    1659     foreach(const QString &strWarning, appliance.GetWarnings())
    1660         strWarningInfo += QString("<br />Warning: %1").arg(strWarning);
    1661     if (!strWarningInfo.isEmpty())
    1662         strWarningInfo = "<br />" + strWarningInfo;
    1663     /* Show the error: */
    1664     error(pParent, MessageType_Error,
    1665           tr("Failed to open/interpret appliance <b>%1</b>.")
    1666              .arg(appliance.GetPath()),
    1667           strWarningInfo + strErrorInfo);
    1668 }
    1669 
    1670 void UIMessageCenter::cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const
    1671 {
    1672     error(pParent, MessageType_Error,
    1673           tr("Failed to import appliance <b>%1</b>.")
    1674              .arg(strPath),
    1675           formatErrorInfo(progress));
    1676 }
    1677 
    1678 void UIMessageCenter::cannotCheckFiles(const CProgress &progress, QWidget *pParent /* = 0*/) const
    1679 {
    1680     error(pParent, MessageType_Error,
    1681           tr("Failed to check files."),
    1682           formatErrorInfo(progress));
    1683 }
    1684 
    1685 void UIMessageCenter::cannotRemoveFiles(const CProgress &progress, QWidget *pParent /* = 0*/) const
    1686 {
    1687     error(pParent, MessageType_Error,
    1688           tr("Failed to remove file."),
    1689           formatErrorInfo(progress));
    1690 }
    1691 
    1692 bool UIMessageCenter::confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent /* = 0*/) const
    1693 {
    1694     return questionBinary(pParent, MessageType_Warning,
    1695                           tr("<p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p>"
    1696                              "<p>If you continue the runtime state of the exported machine(s) will be discarded. "
    1697                              "The other machine(s) will not be changed.</p>",
    1698                              "This text is never used with n == 0. Feel free to drop the %n where possible, "
    1699                              "we only included it because of problems with Qt Linguist (but the user can see "
    1700                              "how many machines are in the list and doesn't need to be told).", machineNames.size())
    1701                              .arg(machineNames.join(", ")),
    1702                           0 /* auto-confirm id */,
    1703                           tr("Continue"));
    1704 }
    1705 
    1706 void UIMessageCenter::cannotExportAppliance(const CAppliance &appliance, QWidget *pParent /* = 0*/) const
    1707 {
    1708     error(pParent, MessageType_Error,
    1709           tr("Failed to prepare the export of the appliance <b>%1</b>.")
    1710              .arg(CAppliance(appliance).GetPath()),
    1711           formatErrorInfo(appliance));
    1712 }
    1713 
    1714 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0*/) const
    1715 {
    1716     error(pParent, MessageType_Error,
    1717           tr("Failed to prepare the export of the appliance <b>%1</b>.")
    1718              .arg(strPath),
    1719           formatErrorInfo(machine));
    1720 }
    1721 
    1722 void UIMessageCenter::cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const
    1723 {
    1724     error(pParent, MessageType_Error,
    1725           tr("Failed to export appliance <b>%1</b>.")
    1726              .arg(strPath),
    1727           formatErrorInfo(progress));
    1728 }
    1729 
    1730 void UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent /* = 0 */)
    1731 {
    1732     error(pParent, MessageType_Error,
    1733           tr("Bad password or authentication failure."),
    1734           formatErrorInfo(appliance));
    1735 }
    1736 
    1737 void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const
    1738 {
    1739     /* Prepare auto-confirm id: */
    1740     QByteArray autoConfimId = "showRuntimeError.";
    1741 
    1742     /* Prepare variables: */
    1743     CConsole console1 = console;
    1744     KMachineState state = console1.GetState();
    1745     MessageType type;
    1746     QString severity;
    1747 
    1748     /// @todo Move to Runtime UI!
    1749     /* Preprocessing: */
    1750     if (fFatal)
    1751     {
    1752         /* The machine must be paused on fFatal errors: */
    1753         Assert(state == KMachineState_Paused);
    1754         if (state != KMachineState_Paused)
    1755             console1.Pause();
    1756     }
    1757 
    1758     /* Compose type, severity, advance confirm id: */
    1759     if (fFatal)
    1760     {
    1761         type = MessageType_Critical;
    1762         severity = tr("<nobr>Fatal Error</nobr>", "runtime error info");
    1763         autoConfimId += "fatal.";
    1764     }
    1765     else if (state == KMachineState_Paused)
    1766     {
    1767         type = MessageType_Error;
    1768         severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info");
    1769         autoConfimId += "error.";
    1770     }
    1771     else
    1772     {
    1773         type = MessageType_Warning;
    1774         severity = tr("<nobr>Warning</nobr>", "runtime error info");
    1775         autoConfimId += "warning.";
    1776     }
    1777     /* Advance auto-confirm id: */
    1778     autoConfimId += strErrorId.toUtf8();
    1779 
    1780     /* Format error-details: */
    1781     QString formatted("<!--EOM-->");
    1782     if (!strErrorMsg.isEmpty())
    1783         formatted.prepend(QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strErrorMsg)));
    1784     if (!strErrorId.isEmpty())
    1785         formatted += QString("<table bgcolor=#EEEEEE border=0 cellspacing=5 "
    1786                              "cellpadding=0 width=100%>"
    1787                              "<tr><td>%1</td><td>%2</td></tr>"
    1788                              "<tr><td>%3</td><td>%4</td></tr>"
    1789                              "</table>")
    1790                              .arg(tr("<nobr>Error ID: </nobr>", "runtime error info"), strErrorId)
    1791                              .arg(tr("Severity: ", "runtime error info"), severity);
    1792     if (!formatted.isEmpty())
    1793         formatted = "<qt>" + formatted + "</qt>";
    1794 
    1795     /* Show the error: */
    1796     if (type == MessageType_Critical)
    1797     {
    1798         error(0, type,
    1799               tr("<p>A fatal error has occurred during virtual machine execution! "
    1800                  "The virtual machine will be powered off. Please copy the following error message "
    1801                  "using the clipboard to help diagnose the problem:</p>"),
    1802               formatted, autoConfimId.data());
    1803     }
    1804     else if (type == MessageType_Error)
    1805     {
    1806         error(0, type,
    1807               tr("<p>An error has occurred during virtual machine execution! "
    1808                  "The error details are shown below. You may try to correct the error "
    1809                  "and resume the virtual machine execution.</p>"),
    1810               formatted, autoConfimId.data());
    1811     }
    1812     else
    1813     {
    1814         error(0, type,
    1815               tr("<p>The virtual machine execution may run into an error condition as described below. "
    1816                  "We suggest that you take an appropriate action to avert the error.</p>"),
    1817               formatted, autoConfimId.data());
    1818     }
    1819 
    1820     /// @todo Move to Runtime UI!
    1821     /* Postprocessing: */
    1822     if (fFatal)
    1823     {
    1824         /* Power down after a fFatal error: */
    1825         LogRel(("GUI: Powering VM down after a fatal runtime error...\n"));
    1826         console1.PowerDown();
    1827     }
    1828 }
    1829 
    1830 bool UIMessageCenter::remindAboutGuruMeditation(const QString &strLogFolder)
    1831 {
    1832     return questionBinary(0, MessageType_GuruMeditation,
    1833                           tr("<p>A critical error has occurred while running the virtual "
    1834                              "machine and the machine execution has been stopped.</p>"
    1835                              ""
    1836                              "<p>For help, please see the Community section on "
    1837                              "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> "
    1838                              "or your support contract. Please provide the contents of the "
    1839                              "log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, "
    1840                              "which you can find in the <nobr><b>%1</b></nobr> directory, "
    1841                              "as well as a description of what you were doing when this error happened. "
    1842                              ""
    1843                              "Note that you can also access the above files by selecting <b>Show Log</b> "
    1844                              "from the <b>Machine</b> menu of the main VirtualBox window.</p>"
    1845                              ""
    1846                              "<p>Press <b>OK</b> if you want to power off the machine "
    1847                              "or press <b>Ignore</b> if you want to leave it as is for debugging. "
    1848                              "Please note that debugging requires special knowledge and tools, "
    1849                              "so it is recommended to press <b>OK</b> now.</p>")
    1850                              .arg(strLogFolder),
    1851                           0 /* auto-confirm id */,
    1852                           QIMessageBox::tr("OK"),
    1853                           tr("Ignore"));
    1854 }
    1855 
    1856 void UIMessageCenter::warnAboutVBoxSVCUnavailable() const
    1857 {
    1858     alert(0, MessageType_Critical,
    1859           tr("<p>A critical error has occurred while running the virtual "
    1860              "machine and the machine execution should be stopped.</p>"
    1861              ""
    1862              "<p>For help, please see the Community section on "
    1863              "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> "
    1864              "or your support contract. Please provide the contents of the "
    1865              "log file <tt>VBox.log</tt>, "
    1866              "which you can find in the virtual machine log directory, "
    1867              "as well as a description of what you were doing when this error happened. "
    1868              ""
    1869              "Note that you can also access the above file by selecting <b>Show Log</b> "
    1870              "from the <b>Machine</b> menu of the main VirtualBox window.</p>"
    1871              ""
    1872              "<p>Press <b>OK</b> to power off the machine.</p>"),
    1873           0 /* auto-confirm id */);
    1874 }
    1875 
    1876 bool UIMessageCenter::warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const
    1877 {
    1878     if (fHWVirtExSupported)
    1879         return questionBinary(0, MessageType_Error,
    1880                               tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "
    1881                                  "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p>"
    1882                                  "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),
    1883                               0 /* auto-confirm id */,
    1884                               tr("Close VM"), tr("Continue"));
    1885     else
    1886         return questionBinary(0, MessageType_Error,
    1887                               tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
    1888                                  "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot."),
    1889                               0 /* auto-confirm id */,
    1890                               tr("Close VM"), tr("Continue"));
    1891 }
    1892 
    1893 bool UIMessageCenter::warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const
    1894 {
    1895     if (fHWVirtExSupported)
    1896         return questionBinary(0, MessageType_Error,
    1897                               tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "
    1898                                  "Certain guests (e.g. OS/2 and QNX) require this feature.</p>"
    1899                                  "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),
    1900                               0 /* auto-confirm id */,
    1901                               tr("Close VM"), tr("Continue"));
    1902     else
    1903         return questionBinary(0, MessageType_Error,
    1904                               tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
    1905                                  "Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p>"),
    1906                               0 /* auto-confirm id */,
    1907                               tr("Close VM"), tr("Continue"));
    1908 }
    1909 
    1910 bool UIMessageCenter::cannotStartWithoutNetworkIf(const QString &strMachineName, const QString &strIfNames) const
    1911 {
    1912     return questionBinary(0, MessageType_Error,
    1913                           tr("<p>Could not start the machine <b>%1</b> because the following "
    1914                              "physical network interfaces were not found:</p><p><b>%2</b></p>"
    1915                              "<p>You can either change the machine's network settings or stop the machine.</p>")
    1916                              .arg(strMachineName, strIfNames),
    1917                           0 /* auto-confirm id */,
    1918                           tr("Change Network Settings"), tr("Close VM"));
    1919 }
    1920 
    1921 void UIMessageCenter::cannotStartMachine(const CConsole &console, const QString &strName) const
    1922 {
    1923     error(0, MessageType_Error,
    1924           tr("Failed to start the virtual machine <b>%1</b>.")
    1925              .arg(strName),
    1926           formatErrorInfo(console));
    1927 }
    1928 
    1929 void UIMessageCenter::cannotStartMachine(const CProgress &progress, const QString &strName) const
    1930 {
    1931     error(0, MessageType_Error,
    1932           tr("Failed to start the virtual machine <b>%1</b>.")
    1933              .arg(strName),
    1934           formatErrorInfo(progress));
    1935 }
    1936 
    1937 bool UIMessageCenter::confirmInputCapture(bool &fAutoConfirmed) const
    1938 {
    1939     int rc = question(0, MessageType_Info,
    1940                       tr("<p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. "
    1941                          "This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer "
    1942                          "integration is not currently supported by the guest OS) and the keyboard, which will make them "
    1943                          "unavailable to other applications running on your host machine.</p>"
    1944                          "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the keyboard and mouse "
    1945                          "(if it is captured) and return them to normal operation. "
    1946                          "The currently assigned host key is shown on the status bar at the bottom of the Virtual Machine window, "
    1947                          "next to the&nbsp;<img src=:/hostkey_16px.png/>&nbsp;icon. "
    1948                          "This icon, together with the mouse icon placed nearby, indicate the current keyboard and mouse capture state.</p>") +
    1949                       tr("<p>The host key is currently defined as <b>%1</b>.</p>", "additional message box paragraph")
    1950                          .arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
    1951                       "confirmInputCapture",
    1952                       AlertButton_Ok | AlertButtonOption_Default,
    1953                       AlertButton_Cancel | AlertButtonOption_Escape,
    1954                       0,
    1955                       tr("Capture", "do input capture"));
    1956     /* Was the message auto-confirmed? */
    1957     fAutoConfirmed = (rc & AlertOption_AutoConfirmed);
    1958     /* True if "Ok" was pressed: */
    1959     return (rc & AlertButtonMask) == AlertButton_Ok;
    1960 }
    1961 
    1962 bool UIMessageCenter::confirmGoingFullscreen(const QString &strHotKey) const
    1963 {
    1964     return questionBinary(0, MessageType_Info,
    1965                           tr("<p>The virtual machine window will be now switched to <b>full-screen</b> mode. "
    1966                              "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"
    1967                              "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"
    1968                              "<p>Note that the main menu bar is hidden in full-screen mode. "
    1969                              "You can access it by pressing <b>Host+Home</b>.</p>")
    1970                              .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
    1971                           "confirmGoingFullscreen",
    1972                           tr("Switch"));
    1973 }
    1974 
    1975 bool UIMessageCenter::confirmGoingSeamless(const QString &strHotKey) const
    1976 {
    1977     return questionBinary(0, MessageType_Info,
    1978                           tr("<p>The virtual machine window will be now switched to <b>Seamless</b> mode. "
    1979                              "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"
    1980                              "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"
    1981                              "<p>Note that the main menu bar is hidden in seamless mode. "
    1982                              "You can access it by pressing <b>Host+Home</b>.</p>")
    1983                              .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
    1984                           "confirmGoingSeamless",
    1985                           tr("Switch"));
    1986 }
    1987 
    1988 bool UIMessageCenter::confirmGoingScale(const QString &strHotKey) const
    1989 {
    1990     return questionBinary(0, MessageType_Info,
    1991                           tr("<p>The virtual machine window will be now switched to <b>Scale</b> mode. "
    1992                              "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"
    1993                              "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"
    1994                              "<p>Note that the main menu bar is hidden in scaled mode. "
    1995                              "You can access it by pressing <b>Host+Home</b>.</p>")
    1996                              .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
    1997                           "confirmGoingScale",
    1998                           tr("Switch"));
    1999 }
    2000 
    2001 bool UIMessageCenter::cannotEnterFullscreenMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const
    2002 {
    2003     return questionBinary(0, MessageType_Warning,
    2004                           tr("<p>Could not switch the guest display to full-screen mode due to insufficient guest video memory.</p>"
    2005                              "<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>"
    2006                              "<p>Press <b>Ignore</b> to switch to full-screen mode anyway or press <b>Cancel</b> to cancel the operation.</p>")
    2007                              .arg(VBoxGlobal::formatSize(uMinVRAM)),
    2008                           0 /* auto-confirm id */,
    2009                           tr("Ignore"));
    2010 }
    2011 
    2012 void UIMessageCenter::cannotEnterSeamlessMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const
    2013 {
    2014     alert(0, MessageType_Error,
    2015           tr("<p>Could not enter seamless mode due to insufficient guest "
    2016              "video memory.</p>"
    2017              "<p>You should configure the virtual machine to have at "
    2018              "least <b>%1</b> of video memory.</p>")
    2019              .arg(VBoxGlobal::formatSize(uMinVRAM)));
    2020 }
    2021 
    2022 bool UIMessageCenter::cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const
    2023 {
    2024     return questionBinary(0, MessageType_Warning,
    2025                           tr("<p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p>"
    2026                              "<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>"
    2027                              "<p>Press <b>Ignore</b> to switch the screen anyway or press <b>Cancel</b> to cancel the operation.</p>")
    2028                              .arg(VBoxGlobal::formatSize(uMinVRAM)),
    2029                           0 /* auto-confirm id */,
    2030                           tr("Ignore"));
    2031 }
    2032 
    2033 void UIMessageCenter::cannotSwitchScreenInSeamless(quint64 uMinVRAM) const
    2034 {
    2035     alert(0, MessageType_Error,
    2036           tr("<p>Could not change the guest screen to this host screen "
    2037              "due to insufficient guest video memory.</p>"
    2038              "<p>You should configure the virtual machine to have at "
    2039              "least <b>%1</b> of video memory.</p>")
    2040              .arg(VBoxGlobal::formatSize(uMinVRAM)));
    2041 }
    2042 
    2043 void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console, const QString &strDevice) const
    2044 {
    2045     error(0, MessageType_Error,
    2046           tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
    2047              .arg(strDevice, CConsole(console).GetMachine().GetName()),
    2048           formatErrorInfo(console));
    2049 }
    2050 
    2051 void UIMessageCenter::cannotAttachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const
    2052 {
    2053     error(0, MessageType_Error,
    2054           tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
    2055              .arg(strDevice, strMachineName),
    2056           formatErrorInfo(errorInfo));
    2057 }
    2058 
    2059 void UIMessageCenter::cannotDetachUSBDevice(const CConsole &console, const QString &strDevice) const
    2060 {
    2061     error(0, MessageType_Error,
    2062           tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
    2063              .arg(strDevice, CConsole(console).GetMachine().GetName()),
    2064           formatErrorInfo(console));
    2065 }
    2066 
    2067 void UIMessageCenter::cannotDetachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const
    2068 {
    2069     error(0, MessageType_Error,
    2070           tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
    2071              .arg(strDevice, strMachineName),
    2072           formatErrorInfo(errorInfo));
    2073 }
    2074 
    2075 void UIMessageCenter::cannotAttachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const
    2076 {
    2077     error(0, MessageType_Error,
    2078           tr("Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.")
    2079              .arg(strWebCamName, strMachineName),
    2080           formatErrorInfo(dispatcher));
    2081 }
    2082 
    2083 void UIMessageCenter::cannotDetachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const
    2084 {
    2085     error(0, MessageType_Error,
    2086           tr("Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.")
    2087              .arg(strWebCamName, strMachineName),
    2088           formatErrorInfo(dispatcher));
    2089 }
    2090 
    2091 void UIMessageCenter::cannotToggleVideoCapture(const CMachine &machine, bool fEnable)
    2092 {
    2093     /* Get machine-name preserving error-info: */
    2094     QString strMachineName(CMachine(machine).GetName());
    2095     error(0, MessageType_Error,
    2096           fEnable ?
    2097               tr("Failed to enable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName) :
    2098               tr("Failed to disable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName),
    2099           formatErrorInfo(machine));
    2100 }
    2101 
    2102 void UIMessageCenter::cannotToggleVRDEServer(const CVRDEServer &server, const QString &strMachineName, bool fEnable)
    2103 {
    2104     error(0, MessageType_Error,
    2105           fEnable ?
    2106               tr("Failed to enable the remote desktop server for the virtual machine <b>%1</b>.").arg(strMachineName) :
    2107               tr("Failed to disable the remote desktop server for the virtual machine <b>%1</b>.").arg(strMachineName),
    2108           formatErrorInfo(server));
    2109 }
    2110 
    2111 void UIMessageCenter::cannotToggleNetworkAdapterCable(const CNetworkAdapter &adapter, const QString &strMachineName, bool fConnect)
    2112 {
    2113     error(0, MessageType_Error,
    2114           fConnect ?
    2115               tr("Failed to connect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName) :
    2116               tr("Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName),
    2117           formatErrorInfo(adapter));
    2118 }
    2119 
    2120 void UIMessageCenter::remindAboutGuestAdditionsAreNotActive() const
    2121 {
    2122     alert(0, MessageType_Warning,
    2123           tr("<p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, "
    2124              "and shared folders cannot be used without them. To use shared folders inside the virtual machine, "
    2125              "please install the Guest Additions if they are not installed, or re-install them if they are "
    2126              "not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. "
    2127              "If they are installed but the machine is not yet fully started then shared folders will be available once it is.</p>"),
    2128           "remindAboutGuestAdditionsAreNotActive");
    2129 }
    2130 
    2131 void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName) const
    2132 {
    2133     alert(0, MessageType_Error,
    2134           tr("<p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, "
    2135              "as the machine has no optical drives. Please add a drive using the storage page of the "
    2136              "virtual machine settings window.</p>")
    2137              .arg(strMachineName));
    2138 }
    2139 
    2140 void UIMessageCenter::cannotAddDiskEncryptionPassword(const CConsole &console)
    2141 {
    2142     error(0, MessageType_Error,
    2143           tr("Bad password or authentication failure."),
    2144           formatErrorInfo(console));
    2145 }
    2146 
    2147 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    2148 bool UIMessageCenter::confirmCancelingAllNetworkRequests() const
    2149 {
    2150     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2151                           tr("Do you wish to cancel all current network operations?"));
    2152 }
    2153 
    2154 void UIMessageCenter::showUpdateSuccess(const QString &strVersion, const QString &strLink) const
    2155 {
    2156     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info,
    2157           tr("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available "
    2158              "at <a href=\"https://www.virtualbox.org/\">virtualbox.org</a>.</p>"
    2159              "<p>You can download this version using the link:</p>"
    2160              "<p><a href=%2>%3</a></p>")
    2161              .arg(strVersion, strLink, strLink));
    2162 }
    2163 
    2164 void UIMessageCenter::showUpdateNotFound() const
    2165 {
    2166     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info,
    2167           tr("You are already running the most recent version of VirtualBox."));
    2168 }
    2169 
    2170 void UIMessageCenter::askUserToDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion) const
    2171 {
    2172     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info,
    2173           tr("<p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p>"
    2174              "<p>You should download and install version %3 of this extension pack from Oracle!</p>")
    2175              .arg(strExtPackVersion).arg(strExtPackName).arg(strVBoxVersion));
    2176 }
    2177 
    2178 bool UIMessageCenter::cannotFindGuestAdditions() const
    2179 {
    2180     return questionBinary(0, MessageType_Question,
    2181                           tr("<p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p>"
    2182                              "<p>Do you wish to download this disk image file from the Internet?</p>"),
    2183                           0 /* auto-confirm id */,
    2184                           tr("Download"));
    2185 }
    2186 
    2187 bool UIMessageCenter::confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const
    2188 {
    2189     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2190                           tr("<p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file "
    2191                              "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>")
    2192                              .arg(strUrl, QLocale(VBoxGlobal::languageId()).toString(uSize)),
    2193                           0 /* auto-confirm id */,
    2194                           tr("Download"));
    2195 }
    2196 
    2197 void UIMessageCenter::cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const
    2198 {
    2199     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
    2200           tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "
    2201              "from <nobr><a href=\"%1\">%1</a></nobr> "
    2202              "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>"
    2203              "<p>Please choose another location for that file.</p>")
    2204              .arg(strURL, strTarget));
    2205 }
    2206 
    2207 bool UIMessageCenter::proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const
    2208 {
    2209     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2210                           tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "
    2211                              "from <nobr><a href=\"%1\">%1</a></nobr> "
    2212                              "and saved locally as <nobr><b>%2</b>.</nobr></p>"
    2213                              "<p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p>")
    2214                              .arg(strUrl, strSrc),
    2215                           0 /* auto-confirm id */,
    2216                           tr("Insert", "additions"));
    2217 }
    2218 
    2219 void UIMessageCenter::cannotValidateGuestAdditionsSHA256Sum(const QString &strUrl, const QString &strSrc) const
    2220 {
    2221     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
    2222           tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "
    2223              "from <nobr><a href=\"%1\">%1</a></nobr> "
    2224              "and saved locally as <nobr><b>%2</b>, </nobr>"
    2225              "but the SHA-256 checksum verification failed.</p>"
    2226              "<p>Please do the download, installation and verification manually.</p>")
    2227              .arg(strUrl, strSrc));
    2228 }
    2229 
    2230 void UIMessageCenter::cannotUpdateGuestAdditions(const CProgress &progress) const
    2231 {
    2232     error(0, MessageType_Error,
    2233           tr("Failed to update Guest Additions. "
    2234              "The Guest Additions disk image file will be inserted for user installation."),
    2235           formatErrorInfo(progress));
    2236 }
    2237 
    2238 bool UIMessageCenter::cannotFindUserManual(const QString &strMissedLocation) const
    2239 {
    2240     return questionBinary(0, MessageType_Question,
    2241                           tr("<p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p>"
    2242                              "<p>Do you wish to download this file from the Internet?</p>")
    2243                              .arg(strMissedLocation),
    2244                           0 /* auto-confirm id */,
    2245                           tr("Download"));
    2246 }
    2247 
    2248 bool UIMessageCenter::confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const
    2249 {
    2250     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2251                           tr("<p>Are you sure you want to download the <b>VirtualBox User Manual</b> "
    2252                              "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>")
    2253                              .arg(strURL, QLocale(VBoxGlobal::languageId()).toString(uSize)),
    2254                           0 /* auto-confirm id */,
    2255                           tr("Download"));
    2256 }
    2257 
    2258 void UIMessageCenter::cannotSaveUserManual(const QString &strURL, const QString &strTarget) const
    2259 {
    2260     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
    2261           tr("<p>The VirtualBox User Manual has been successfully downloaded "
    2262              "from <nobr><a href=\"%1\">%1</a></nobr> "
    2263              "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>"
    2264              "<p>Please choose another location for that file.</p>")
    2265              .arg(strURL, strTarget));
    2266 }
    2267 
    2268 void UIMessageCenter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) const
    2269 {
    2270     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Warning,
    2271           tr("<p>The VirtualBox User Manual has been successfully downloaded "
    2272              "from <nobr><a href=\"%1\">%1</a></nobr> "
    2273              "and saved locally as <nobr><b>%2</b>.</nobr></p>")
    2274              .arg(strURL, strTarget));
    2275 }
    2276 
    2277 bool UIMessageCenter::warAboutOutdatedExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const
    2278 {
    2279     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2280                           tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>"
    2281                              "<p>Do you wish to download latest one from the Internet?</p>")
    2282                              .arg(strExtPackVersion).arg(strExtPackName),
    2283                           0 /* auto-confirm id */,
    2284                           tr("Download"));
    2285 }
    2286 
    2287 bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const
    2288 {
    2289     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2290                           tr("<p>Are you sure you want to download the <b><nobr>%1</nobr></b> "
    2291                              "from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>")
    2292                              .arg(strExtPackName, strURL, QLocale(VBoxGlobal::languageId()).toString(uSize)),
    2293                           0 /* auto-confirm id */,
    2294                           tr("Download"));
    2295 }
    2296 
    2297 void UIMessageCenter::cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const
    2298 {
    2299     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
    2300           tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
    2301              "from <nobr><a href=\"%2\">%2</a></nobr> "
    2302              "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>"
    2303              "<p>Please choose another location for that file.</p>")
    2304              .arg(strExtPackName, strFrom, strTo));
    2305 }
    2306 
    2307 bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const
    2308 {
    2309     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2310                           tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
    2311                              "from <nobr><a href=\"%2\">%2</a></nobr> "
    2312                              "and saved locally as <nobr><b>%3</b>.</nobr></p>"
    2313                              "<p>Do you wish to install this extension pack?</p>")
    2314                              .arg(strExtPackName, strFrom, strTo),
    2315                           0 /* auto-confirm id */,
    2316                           tr("Install", "extension pack"));
    2317 }
    2318 
    2319 void UIMessageCenter::cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const
    2320 {
    2321     alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
    2322           tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
    2323              "from <nobr><a href=\"%2\">%2</a></nobr> "
    2324              "and saved locally as <nobr><b>%3</b>, </nobr>"
    2325              "but the SHA-256 checksum verification failed.</p>"
    2326              "<p>Please do the download, installation and verification manually.</p>")
    2327              .arg(strExtPackName, strFrom, strTo));
    2328 }
    2329 
    2330 bool UIMessageCenter::proposeDeleteExtentionPack(const QString &strTo) const
    2331 {
    2332     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2333                           tr("Do you want to delete the downloaded file <nobr><b>%1</b></nobr>?")
    2334                              .arg(strTo),
    2335                           0 /* auto-confirm id */,
    2336                           tr("Delete", "extension pack"));
    2337 }
    2338 
    2339 bool UIMessageCenter::proposeDeleteOldExtentionPacks(const QStringList &strFiles) const
    2340 {
    2341     return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
    2342                           tr("Do you want to delete following list of files <nobr><b>%1</b></nobr>?")
    2343                              .arg(strFiles.join(",")),
    2344                           0 /* auto-confirm id */,
    2345                           tr("Delete", "extension pack"));
    2346 }
    2347 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    2348 
    2349 bool UIMessageCenter::confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion,
    2350                                                   const QString &strPackDescription, QWidget *pParent /* = 0*/) const
    2351 {
    2352     return questionBinary(pParent, MessageType_Question,
    2353                           tr("<p>You are about to install a VirtualBox extension pack. "
    2354                              "Extension packs complement the functionality of VirtualBox and can contain system level software "
    2355                              "that could be potentially harmful to your system. Please review the description below and only proceed "
    2356                              "if you have obtained the extension pack from a trusted source.</p>"
    2357                              "<p><table cellpadding=0 cellspacing=5>"
    2358                              "<tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%1</td></tr>"
    2359                              "<tr><td><b>Version:&nbsp;&nbsp;</b></td><td>%2</td></tr>"
    2360                              "<tr><td><b>Description:&nbsp;&nbsp;</b></td><td>%3</td></tr>"
    2361                              "</table></p>")
    2362                              .arg(strPackName).arg(strPackVersion).arg(strPackDescription),
    2363                           0 /* auto-confirm id */,
    2364                           tr("Install", "extension pack"));
    2365 }
    2366 
    2367 bool UIMessageCenter::confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew,
    2368                                                   const QString &strPackVersionOld, const QString &strPackDescription,
    2369                                                   QWidget *pParent /* = 0*/) const
    2370 {
    2371     /* Prepare initial message: */
    2372     QString strBelehrung = tr("Extension packs complement the functionality of VirtualBox and can contain "
    2373                               "system level software that could be potentially harmful to your system. "
    2374                               "Please review the description below and only proceed if you have obtained "
    2375                               "the extension pack from a trusted source.");
    2376 
    2377     /* Compare versions: */
    2378     QByteArray  ba1     = strPackVersionNew.toUtf8();
    2379     QByteArray  ba2     = strPackVersionOld.toUtf8();
    2380     int         iVerCmp = RTStrVersionCompare(ba1.constData(), ba2.constData());
    2381 
    2382     /* Show the question: */
    2383     bool fRc;
    2384     if (iVerCmp > 0)
    2385         fRc = questionBinary(pParent, MessageType_Question,
    2386                              tr("<p>An older version of the extension pack is already installed, would you like to upgrade? "
    2387                                 "<p>%1</p>"
    2388                                 "<p><table cellpadding=0 cellspacing=5>"
    2389                                 "<tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr>"
    2390                                 "<tr><td><b>New Version:&nbsp;&nbsp;</b></td><td>%3</td></tr>"
    2391                                 "<tr><td><b>Current Version:&nbsp;&nbsp;</b></td><td>%4</td></tr>"
    2392                                 "<tr><td><b>Description:&nbsp;&nbsp;</b></td><td>%5</td></tr>"
    2393                                 "</table></p>")
    2394                                 .arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription),
    2395                              0 /* auto-confirm id */,
    2396                              tr("&Upgrade"));
    2397     else if (iVerCmp < 0)
    2398         fRc = questionBinary(pParent, MessageType_Question,
    2399                              tr("<p>An newer version of the extension pack is already installed, would you like to downgrade? "
    2400                                 "<p>%1</p>"
    2401                                 "<p><table cellpadding=0 cellspacing=5>"
    2402                                 "<tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr>"
    2403                                 "<tr><td><b>New Version:&nbsp;&nbsp;</b></td><td>%3</td></tr>"
    2404                                 "<tr><td><b>Current Version:&nbsp;&nbsp;</b></td><td>%4</td></tr>"
    2405                                 "<tr><td><b>Description:&nbsp;&nbsp;</b></td><td>%5</td></tr>"
    2406                                 "</table></p>")
    2407                                 .arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription),
    2408                              0 /* auto-confirm id */,
    2409                              tr("&Downgrade"));
    2410     else
    2411         fRc = questionBinary(pParent, MessageType_Question,
    2412                              tr("<p>The extension pack is already installed with the same version, would you like reinstall it? "
    2413                                 "<p>%1</p>"
    2414                                 "<p><table cellpadding=0 cellspacing=5>"
    2415                                 "<tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr>"
    2416                                 "<tr><td><b>Version:&nbsp;&nbsp;</b></td><td>%3</td></tr>"
    2417                                 "<tr><td><b>Description:&nbsp;&nbsp;</b></td><td>%4</td></tr>"
    2418                                 "</table></p>")
    2419                                 .arg(strBelehrung).arg(strPackName).arg(strPackVersionOld).arg(strPackDescription),
    2420                              0 /* auto-confirm id */,
    2421                              tr("&Reinstall"));
    2422     return fRc;
    2423 }
    2424 
    2425 bool UIMessageCenter::confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent /* = 0*/) const
    2426 {
    2427     return questionBinary(pParent, MessageType_Question,
    2428                           tr("<p>You are about to remove the VirtualBox extension pack <b>%1</b>.</p>"
    2429                              "<p>Are you sure you want to proceed?</p>")
    2430                              .arg(strPackName),
    2431                           0 /* auto-confirm id */,
    2432                           tr("&Remove") /* ok button text */,
    2433                           QString() /* cancel button text */,
    2434                           false /* ok button by default? */);
    2435 }
    2436 
    2437 void UIMessageCenter::cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent /* = 0*/) const
    2438 {
    2439     error(pParent, MessageType_Error,
    2440           tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
    2441           formatErrorInfo(extPackManager));
    2442 }
    2443 
    2444 void UIMessageCenter::warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent /* = 0*/) const
    2445 {
    2446     error(pParent, MessageType_Error,
    2447           tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
    2448           "<!--EOM-->" + extPackFile.GetWhyUnusable());
    2449 }
    2450 
    2451 void UIMessageCenter::cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent /* = 0*/) const
    2452 {
    2453     error(pParent, MessageType_Error,
    2454           tr("Failed to install the Extension Pack <b>%1</b>.")
    2455              .arg(strFilename),
    2456           formatErrorInfo(extPackFile));
    2457 }
    2458 
    2459 void UIMessageCenter::cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent /* = 0*/) const
    2460 {
    2461     error(pParent, MessageType_Error,
    2462           tr("Failed to install the Extension Pack <b>%1</b>.")
    2463              .arg(strFilename),
    2464           formatErrorInfo(progress));
    2465 }
    2466 
    2467 void UIMessageCenter::cannotUninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent /* = 0*/) const
    2468 {
    2469     error(pParent, MessageType_Error,
    2470           tr("Failed to uninstall the Extension Pack <b>%1</b>.")
    2471              .arg(strPackName),
    2472           formatErrorInfo(extPackManager));
    2473 }
    2474 
    2475 void UIMessageCenter::cannotUninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent /* = 0*/) const
    2476 {
    2477     error(pParent, MessageType_Error,
    2478           tr("Failed to uninstall the Extension Pack <b>%1</b>.")
    2479              .arg(strPackName),
    2480           formatErrorInfo(progress));
    2481 }
    2482 
    2483 void UIMessageCenter::warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent /* = 0*/) const
    2484 {
    2485     alert(pParent, MessageType_Info,
    2486           tr("The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.")
    2487              .arg(strPackName));
    2488 }
    2489 
    2490 #ifdef VBOX_WITH_DRAG_AND_DROP
    2491 void UIMessageCenter::cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
    2492 {
    2493     error(pParent, MessageType_Error,
    2494           tr("Drag and drop operation from host to guest failed."),
    2495           formatErrorInfo(dndTarget));
    2496 }
    2497 
    2498 void UIMessageCenter::cannotDropDataToGuest(const CProgress &progress, QWidget *pParent /* = 0 */) const
    2499 {
    2500     error(pParent, MessageType_Error,
    2501           tr("Drag and drop operation from host to guest failed."),
    2502           formatErrorInfo(progress));
    2503 }
    2504 
    2505 void UIMessageCenter::cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
    2506 {
    2507     error(pParent, MessageType_Error,
    2508           tr("Unable to cancel host to guest drag and drop operation."),
    2509           formatErrorInfo(dndTarget));
    2510 }
    2511 
    2512 void UIMessageCenter::cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent /* = 0 */) const
    2513 {
    2514     error(pParent, MessageType_Error,
    2515           tr("Drag and drop operation from guest to host failed."),
    2516           formatErrorInfo(dndSource));
    2517 }
    2518 
    2519 void UIMessageCenter::cannotDropDataToHost(const CProgress &progress, QWidget *pParent /* = 0 */) const
    2520 {
    2521     error(pParent, MessageType_Error,
    2522           tr("Drag and drop operation from guest to host failed."),
    2523           formatErrorInfo(progress));
    2524 }
    2525 #endif /* VBOX_WITH_DRAG_AND_DROP */
    2526 
    2527 void UIMessageCenter::cannotOpenLicenseFile(const QString &strPath, QWidget *pParent /* = 0*/) const
    2528 {
    2529     alert(pParent, MessageType_Error,
    2530           tr("Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.")
    2531              .arg(strPath));
    2532 }
    2533 
    2534 bool UIMessageCenter::confirmOverridingFile(const QString &strPath, QWidget *pParent /* = 0*/) const
    2535 {
    2536     return questionBinary(pParent, MessageType_Question,
    2537                           tr("A file named <b>%1</b> already exists. "
    2538                              "Are you sure you want to replace it?<br /><br />"
    2539                              "Replacing it will overwrite its contents.")
    2540                              .arg(strPath),
    2541                           0 /* auto-confirm id */,
    2542                           QString() /* ok button text */,
    2543                           QString() /* cancel button text */,
    2544                           false /* ok button by default? */);
    2545 }
    2546 
    2547 bool UIMessageCenter::confirmOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent /* = 0*/) const
    2548 {
    2549     /* If it is only one file use the single question versions above: */
    2550     if (strPaths.size() == 1)
    2551         return confirmOverridingFile(strPaths.at(0), pParent);
    2552     else if (strPaths.size() > 1)
    2553         return questionBinary(pParent, MessageType_Question,
    2554                               tr("The following files already exist:<br /><br />%1<br /><br />"
    2555                                  "Are you sure you want to replace them? "
    2556                                  "Replacing them will overwrite their contents.")
    2557                                  .arg(QStringList(strPaths.toList()).join("<br />")),
    2558                               0 /* auto-confirm id */,
    2559                               QString() /* ok button text */,
    2560                               QString() /* cancel button text */,
    2561                               false /* ok button by default? */);
    2562     else
    2563         return true;
    2564 }
    2565 
    2566 bool UIMessageCenter::confirmOverridingFileIfExists(const QString &strPath, QWidget *pParent /* = 0*/) const
    2567 {
    2568     QFileInfo fi(strPath);
    2569     if (fi.exists())
    2570         return confirmOverridingFile(strPath, pParent);
    2571     else
    2572         return true;
    2573 }
    2574 
    2575 bool UIMessageCenter::confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent /* = 0*/) const
    2576 {
    2577     QVector<QString> existingFiles;
    2578     foreach(const QString &file, strPaths)
    2579     {
    2580         QFileInfo fi(file);
    2581         if (fi.exists())
    2582             existingFiles << fi.absoluteFilePath();
    2583     }
    2584     /* If it is only one file use the single question versions above: */
    2585     if (existingFiles.size() == 1)
    2586         return confirmOverridingFileIfExists(existingFiles.at(0), pParent);
    2587     else if (existingFiles.size() > 1)
    2588         return confirmOverridingFiles(existingFiles, pParent);
    2589     else
    2590         return true;
    2591 }
    2592 
    2593 /* static */
    2594 QString UIMessageCenter::formatRC(HRESULT rc)
     36
     37/* static */
     38QString UIErrorString::formatRC(HRESULT rc)
    259539{
    259640    QString str;
    259741
    259842    PCRTCOMERRMSG msg = NULL;
    2599     const char *errMsg = NULL;
     43    const char *pErrMsg = NULL;
    260044
    260145    /* First, try as is (only set bit 31 bit for warnings): */
     
    260650
    260751    if (msg != NULL)
    2608         errMsg = msg->pszDefine;
     52        pErrMsg = msg->pszDefine;
    260953
    261054#ifdef VBOX_WS_WIN
     
    261761
    261862        if (winMsg != NULL)
    2619             errMsg = winMsg->pszDefine;
     63            pErrMsg = winMsg->pszDefine;
    262064    }
    262165#endif /* VBOX_WS_WIN */
    262266
    2623     if (errMsg != NULL && *errMsg != '\0')
    2624         str.sprintf("%s", errMsg);
     67    if (pErrMsg != NULL && *pErrMsg != '\0')
     68        str.sprintf("%s", pErrMsg);
    262569
    262670    return str;
     
    262872
    262973/* static */
    2630 QString UIMessageCenter::formatRCFull(HRESULT rc)
     74QString UIErrorString::formatRCFull(HRESULT rc)
    263175{
    263276    QString str;
    263377
    263478    PCRTCOMERRMSG msg = NULL;
    2635     const char *errMsg = NULL;
     79    const char *pErrMsg = NULL;
    263680
    263781    /* First, try as is (only set bit 31 bit for warnings): */
     
    264286
    264387    if (msg != NULL)
    2644         errMsg = msg->pszDefine;
     88        pErrMsg = msg->pszDefine;
    264589
    264690#ifdef VBOX_WS_WIN
     
    265397
    265498        if (winMsg != NULL)
    2655             errMsg = winMsg->pszDefine;
     99            pErrMsg = winMsg->pszDefine;
    2656100    }
    2657101#endif /* VBOX_WS_WIN */
    2658102
    2659     if (errMsg != NULL && *errMsg != '\0')
    2660         str.sprintf("%s (0x%08X)", errMsg, rc);
     103    if (pErrMsg != NULL && *pErrMsg != '\0')
     104        str.sprintf("%s (0x%08X)", pErrMsg, rc);
    2661105    else
    2662106        str.sprintf("0x%08X", rc);
     
    2666110
    2667111/* static */
    2668 QString UIMessageCenter::formatErrorInfo(const CProgress &progress)
     112QString UIErrorString::formatErrorInfo(const CProgress &comProgress)
    2669113{
    2670114    /* Check for API errors first: */
    2671     if (!progress.isOk())
    2672         return formatErrorInfo(static_cast<COMBaseWithEI>(progress));
     115    if (!comProgress.isOk())
     116        return formatErrorInfo(static_cast<COMBaseWithEI>(comProgress));
    2673117
    2674118    /* For progress errors otherwise: */
    2675     CVirtualBoxErrorInfo errorInfo = progress.GetErrorInfo();
     119    CVirtualBoxErrorInfo comErrorInfo = comProgress.GetErrorInfo();
    2676120    /* Handle valid error-info first: */
    2677     if (!errorInfo.isNull())
    2678         return formatErrorInfo(errorInfo);
     121    if (!comErrorInfo.isNull())
     122        return formatErrorInfo(comErrorInfo);
    2679123    /* Handle NULL error-info otherwise: */
    2680124    return QString("<table bgcolor=#EEEEEE border=0 cellspacing=5 cellpadding=0 width=100%>"
    2681125                   "<tr><td>%1</td><td><tt>%2</tt></td></tr></table>")
    2682                    .arg(tr("Result&nbsp;Code: ", "error info"))
    2683                    .arg(formatRCFull(progress.GetResultCode()))
     126                   .arg(QObject::tr("Result&nbsp;Code: ", "error info"))
     127                   .arg(formatRCFull(comProgress.GetResultCode()))
    2684128                   .prepend("<!--EOM-->") /* move to details */;
    2685129}
    2686130
    2687131/* static */
    2688 QString UIMessageCenter::formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC /* = S_OK */)
    2689 {
    2690     QString formatted = errorInfoToString(info, wrapperRC);
    2691     return QString("<qt>%1</qt>").arg(formatted);
    2692 }
    2693 
    2694 /* static */
    2695 QString UIMessageCenter::formatErrorInfo(const CVirtualBoxErrorInfo &info)
    2696 {
    2697     return formatErrorInfo(COMErrorInfo(info));
    2698 }
    2699 
    2700 /* static */
    2701 QString UIMessageCenter::formatErrorInfo(const COMBaseWithEI &wrapper)
    2702 {
    2703     Assert(wrapper.lastRC() != S_OK);
    2704     return formatErrorInfo(wrapper.errorInfo(), wrapper.lastRC());
    2705 }
    2706 
    2707 /* static */
    2708 QString UIMessageCenter::formatErrorInfo(const COMResult &rc)
    2709 {
    2710     Assert(rc.rc() != S_OK);
    2711     return formatErrorInfo(rc.errorInfo(), rc.rc());
    2712 }
    2713 
    2714 void UIMessageCenter::sltShowHelpWebDialog()
    2715 {
    2716     vboxGlobal().openURL("https://www.virtualbox.org");
    2717 }
    2718 
    2719 void UIMessageCenter::sltShowBugTracker()
    2720 {
    2721     vboxGlobal().openURL("https://www.virtualbox.org/wiki/Bugtracker");
    2722 }
    2723 
    2724 void UIMessageCenter::sltShowForums()
    2725 {
    2726     vboxGlobal().openURL("https://forums.virtualbox.org/");
    2727 }
    2728 
    2729 void UIMessageCenter::sltShowOracle()
    2730 {
    2731     vboxGlobal().openURL("http://www.oracle.com/us/technologies/virtualization/virtualbox/overview/index.html");
    2732 }
    2733 
    2734 void UIMessageCenter::sltShowHelpAboutDialog()
    2735 {
    2736     CVirtualBox vbox = vboxGlobal().virtualBox();
    2737     QString strFullVersion;
    2738     if (vboxGlobal().brandingIsActive())
    2739     {
    2740         strFullVersion = QString("%1 r%2 - %3").arg(vbox.GetVersion())
    2741                                                .arg(vbox.GetRevision())
    2742                                                .arg(vboxGlobal().brandingGetKey("Name"));
    2743     }
    2744     else
    2745     {
    2746         strFullVersion = QString("%1 r%2").arg(vbox.GetVersion())
    2747                                           .arg(vbox.GetRevision());
    2748     }
    2749     AssertWrapperOk(vbox);
    2750 
    2751     (new VBoxAboutDlg(windowManager().mainWindowShown(), strFullVersion))->show();
    2752 }
    2753 
    2754 void UIMessageCenter::sltShowHelpHelpDialog()
    2755 {
    2756 #ifndef VBOX_OSE
    2757     /* For non-OSE version we just open it: */
    2758     sltShowUserManual(vboxGlobal().helpFile());
    2759 #else /* #ifndef VBOX_OSE */
    2760     /* For OSE version we have to check if it present first: */
    2761     QString strUserManualFileName1 = vboxGlobal().helpFile();
    2762     QString strShortFileName = QFileInfo(strUserManualFileName1).fileName();
    2763     QString strUserManualFileName2 = QDir(vboxGlobal().homeFolder()).absoluteFilePath(strShortFileName);
    2764     /* Show if user manual already present: */
    2765     if (QFile::exists(strUserManualFileName1))
    2766         sltShowUserManual(strUserManualFileName1);
    2767     else if (QFile::exists(strUserManualFileName2))
    2768         sltShowUserManual(strUserManualFileName2);
    2769     /* If downloader is running already: */
    2770     else if (UIDownloaderUserManual::current())
    2771     {
    2772         /* Just show network access manager: */
    2773         gNetworkManager->show();
    2774     }
    2775     /* Else propose to download user manual: */
    2776     else if (cannotFindUserManual(strUserManualFileName1))
    2777     {
    2778         /* Create User Manual downloader: */
    2779         UIDownloaderUserManual *pDl = UIDownloaderUserManual::create();
    2780         /* After downloading finished => show User Manual: */
    2781         connect(pDl, &UIDownloaderUserManual::sigDownloadFinished, this, &UIMessageCenter::sltShowUserManual);
    2782         /* Start downloading: */
    2783         pDl->start();
    2784     }
    2785 #endif /* #ifdef VBOX_OSE */
    2786 }
    2787 
    2788 void UIMessageCenter::sltResetSuppressedMessages()
    2789 {
    2790     /* Nullify suppressed message list: */
    2791     gEDataManager->setSuppressedMessages(QStringList());
    2792 }
    2793 
    2794 void UIMessageCenter::sltShowUserManual(const QString &strLocation)
    2795 {
    2796 #if defined (VBOX_WS_WIN)
    2797     HtmlHelp(GetDesktopWindow(), strLocation.utf16(), HH_DISPLAY_TOPIC, NULL);
    2798 #elif defined (VBOX_WS_X11)
    2799 # ifndef VBOX_OSE
    2800     char szViewerPath[RTPATH_MAX];
    2801     int rc;
    2802     rc = RTPathAppPrivateArch(szViewerPath, sizeof(szViewerPath));
    2803     AssertRC(rc);
    2804     QProcess::startDetached(QString(szViewerPath) + "/kchmviewer", QStringList(strLocation));
    2805 # else /* #ifndef VBOX_OSE */
    2806     vboxGlobal().openURL("file://" + strLocation);
    2807 # endif /* #ifdef VBOX_OSE */
    2808 #elif defined (VBOX_WS_MAC)
    2809     vboxGlobal().openURL("file://" + strLocation);
    2810 #endif
    2811 }
    2812 
    2813 void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType type,
    2814                                         const QString &strMessage, const QString &strDetails,
    2815                                         int iButton1, int iButton2, int iButton3,
    2816                                         const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
    2817                                         const QString &strAutoConfirmId) const
    2818 {
    2819     /* Now we can show a message-box directly: */
    2820     showMessageBox(pParent, type,
    2821                    strMessage, strDetails,
    2822                    iButton1, iButton2, iButton3,
    2823                    strButtonText1, strButtonText2, strButtonText3,
    2824                    strAutoConfirmId);
    2825 }
    2826 
    2827 UIMessageCenter::UIMessageCenter()
    2828 {
    2829     /* Assign instance: */
    2830     m_spInstance = this;
    2831 }
    2832 
    2833 UIMessageCenter::~UIMessageCenter()
    2834 {
    2835     /* Unassign instance: */
    2836     m_spInstance = 0;
    2837 }
    2838 
    2839 void UIMessageCenter::prepare()
    2840 {
    2841     /* Register required objects as meta-types: */
    2842     qRegisterMetaType<CProgress>();
    2843     qRegisterMetaType<CHost>();
    2844     qRegisterMetaType<CMachine>();
    2845     qRegisterMetaType<CConsole>();
    2846     qRegisterMetaType<CHostNetworkInterface>();
    2847     qRegisterMetaType<UIMediumType>();
    2848     qRegisterMetaType<StorageSlot>();
    2849 
    2850     /* Prepare interthread connection: */
    2851     qRegisterMetaType<MessageType>();
    2852     // Won't go until we are supporting C++11 or at least variadic templates everywhere.
    2853     // connect(this, &UIMessageCenter::sigToShowMessageBox,
    2854     //         this, &UIMessageCenter::sltShowMessageBox,
    2855     connect(this, SIGNAL(sigToShowMessageBox(QWidget*, MessageType,
    2856                                              const QString&, const QString&,
    2857                                              int, int, int,
    2858                                              const QString&, const QString&, const QString&,
    2859                                              const QString&)),
    2860             this, SLOT(sltShowMessageBox(QWidget*, MessageType,
    2861                                          const QString&, const QString&,
    2862                                          int, int, int,
    2863                                          const QString&, const QString&, const QString&,
    2864                                          const QString&)),
    2865             Qt::BlockingQueuedConnection);
    2866 
    2867     /* Translations for Main.
    2868      * Please make sure they corresponds to the strings coming from Main one-by-one symbol! */
    2869     tr("Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might not be installed on the host computer");
    2870     tr("VirtualBox is not currently allowed to access USB devices.  You can change this by adding your user to the 'vboxusers' group.  Please see the user manual for a more detailed explanation");
    2871     tr("VirtualBox is not currently allowed to access USB devices.  You can change this by allowing your user to access the 'usbfs' folder and files.  Please see the user manual for a more detailed explanation");
    2872     tr("The USB Proxy Service has not yet been ported to this host");
    2873     tr("Could not load the Host USB Proxy service");
    2874 }
    2875 
    2876 void UIMessageCenter::cleanup()
    2877 {
    2878      /* Nothing for now... */
    2879 }
    2880 
    2881 QString UIMessageCenter::errorInfoToString(const COMErrorInfo &info,
    2882                                            HRESULT wrapperRC /* = S_OK */)
     132QString UIErrorString::formatErrorInfo(const COMErrorInfo &comInfo, HRESULT wrapperRC /* = S_OK */)
     133{
     134    return QString("<qt>%1</qt>").arg(UIErrorString::errorInfoToString(comInfo, wrapperRC));
     135}
     136
     137/* static */
     138QString UIErrorString::formatErrorInfo(const CVirtualBoxErrorInfo &comInfo)
     139{
     140    return formatErrorInfo(COMErrorInfo(comInfo));
     141}
     142
     143/* static */
     144QString UIErrorString::formatErrorInfo(const COMBaseWithEI &comWrapper)
     145{
     146    Assert(comWrapper.lastRC() != S_OK);
     147    return formatErrorInfo(comWrapper.errorInfo(), comWrapper.lastRC());
     148}
     149
     150/* static */
     151QString UIErrorString::formatErrorInfo(const COMResult &comRc)
     152{
     153    Assert(comRc.rc() != S_OK);
     154    return formatErrorInfo(comRc.errorInfo(), comRc.rc());
     155}
     156
     157/* static */
     158QString UIErrorString::errorInfoToString(const COMErrorInfo &comInfo, HRESULT wrapperRC)
    2883159{
    2884160    /* Compose complex details string with internal <!--EOM--> delimiter to
    2885161     * make it possible to split string into info & details parts which will
    2886      * be used separately in QIMessageBox */
    2887     QString formatted;
     162     * be used separately in QIMessageBox. */
     163    QString strFormatted;
    2888164
    2889165    /* Check if details text is NOT empty: */
    2890     QString strDetailsInfo = info.text();
     166    const QString strDetailsInfo = comInfo.text();
    2891167    if (!strDetailsInfo.isEmpty())
    2892168    {
    2893169        /* Check if details text written in English (latin1) and translated: */
    2894         if (strDetailsInfo == QString::fromLatin1(strDetailsInfo.toLatin1()) &&
    2895             strDetailsInfo != tr(strDetailsInfo.toLatin1().constData()))
    2896             formatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(tr(strDetailsInfo.toLatin1().constData())));
     170        if (   strDetailsInfo == QString::fromLatin1(strDetailsInfo.toLatin1())
     171            && strDetailsInfo != QObject::tr(strDetailsInfo.toLatin1().constData()))
     172            strFormatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(QObject::tr(strDetailsInfo.toLatin1().constData())));
    2897173        else
    2898             formatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strDetailsInfo));
    2899     }
    2900 
    2901     formatted += "<!--EOM--><table bgcolor=#EEEEEE border=0 cellspacing=5 "
    2902                  "cellpadding=0 width=100%>";
    2903 
    2904     bool haveResultCode = false;
    2905 
    2906     if (info.isBasicAvailable())
    2907     {
    2908 #if defined (VBOX_WS_WIN)
    2909         haveResultCode = info.isFullAvailable();
    2910         bool haveComponent = true;
    2911         bool haveInterfaceID = true;
    2912 #else /* defined (VBOX_WS_WIN) */
    2913         haveResultCode = true;
    2914         bool haveComponent = info.isFullAvailable();
    2915         bool haveInterfaceID = info.isFullAvailable();
     174            strFormatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strDetailsInfo));
     175    }
     176
     177    strFormatted += "<!--EOM--><table bgcolor=#EEEEEE border=0 cellspacing=5 "
     178                    "cellpadding=0 width=100%>";
     179
     180    bool fHaveResultCode = false;
     181
     182    if (comInfo.isBasicAvailable())
     183    {
     184#ifdef VBOX_WS_WIN
     185        fHaveResultCode = comInfo.isFullAvailable();
     186        bool fHaveComponent = true;
     187        bool fHaveInterfaceID = true;
     188#else /* !VBOX_WS_WIN */
     189        fHaveResultCode = true;
     190        bool fHaveComponent = comInfo.isFullAvailable();
     191        bool fHaveInterfaceID = comInfo.isFullAvailable();
    2916192#endif
    2917193
    2918         if (haveResultCode)
     194        if (fHaveResultCode)
    2919195        {
    2920             formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
    2921                 .arg(tr("Result&nbsp;Code: ", "error info"))
    2922                 .arg(formatRCFull(info.resultCode()));
     196            strFormatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
     197                .arg(QObject::tr("Result&nbsp;Code: ", "error info"))
     198                .arg(formatRCFull(comInfo.resultCode()));
    2923199        }
    2924200
    2925         if (haveComponent)
    2926             formatted += QString("<tr><td>%1</td><td>%2</td></tr>")
    2927                 .arg(tr("Component: ", "error info"), info.component());
    2928 
    2929         if (haveInterfaceID)
     201        if (fHaveComponent)
     202            strFormatted += QString("<tr><td>%1</td><td>%2</td></tr>")
     203                .arg(QObject::tr("Component: ", "error info"), comInfo.component());
     204
     205        if (fHaveInterfaceID)
    2930206        {
    2931             QString s = info.interfaceID().toString();
    2932             if (!info.interfaceName().isEmpty())
    2933                 s = info.interfaceName() + ' ' + s;
    2934             formatted += QString("<tr><td>%1</td><td>%2</td></tr>")
    2935                 .arg(tr("Interface: ", "error info"), s);
     207            QString s = comInfo.interfaceID().toString();
     208            if (!comInfo.interfaceName().isEmpty())
     209                s = comInfo.interfaceName() + ' ' + s;
     210            strFormatted += QString("<tr><td>%1</td><td>%2</td></tr>")
     211                .arg(QObject::tr("Interface: ", "error info"), s);
    2936212        }
    2937213
    2938         if (!info.calleeIID().isNull() && info.calleeIID() != info.interfaceID())
     214        if (!comInfo.calleeIID().isNull() && comInfo.calleeIID() != comInfo.interfaceID())
    2939215        {
    2940             QString s = info.calleeIID().toString();
    2941             if (!info.calleeName().isEmpty())
    2942                 s = info.calleeName() + ' ' + s;
    2943             formatted += QString("<tr><td>%1</td><td>%2</td></tr>")
    2944                 .arg(tr("Callee: ", "error info"), s);
     216            QString s = comInfo.calleeIID().toString();
     217            if (!comInfo.calleeName().isEmpty())
     218                s = comInfo.calleeName() + ' ' + s;
     219            strFormatted += QString("<tr><td>%1</td><td>%2</td></tr>")
     220                .arg(QObject::tr("Callee: ", "error info"), s);
    2945221        }
    2946222    }
    2947223
    2948     if (FAILED (wrapperRC) &&
    2949         (!haveResultCode || wrapperRC != info.resultCode()))
    2950     {
    2951         formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
    2952             .arg(tr("Callee&nbsp;RC: ", "error info"))
     224    if (   FAILED(wrapperRC)
     225        && (!fHaveResultCode || wrapperRC != comInfo.resultCode()))
     226    {
     227        strFormatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
     228            .arg(QObject::tr("Callee&nbsp;RC: ", "error info"))
    2953229            .arg(formatRCFull(wrapperRC));
    2954230    }
    2955231
    2956     formatted += "</table>";
    2957 
    2958     if (info.next())
    2959         formatted = formatted + "<!--EOP-->" + errorInfoToString(*info.next());
    2960 
    2961     return formatted;
    2962 }
    2963 
    2964 int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType type,
    2965                                     const QString &strMessage, const QString &strDetails,
    2966                                     int iButton1, int iButton2, int iButton3,
    2967                                     const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
    2968                                     const QString &strAutoConfirmId) const
    2969 {
    2970     /* Choose the 'default' button: */
    2971     if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
    2972         iButton1 = AlertButton_Ok | AlertButtonOption_Default;
    2973 
    2974     /* Check if message-box was auto-confirmed before: */
    2975     QStringList confirmedMessageList;
    2976     if (!strAutoConfirmId.isEmpty())
    2977     {
    2978         const QString strID = vboxGlobal().isVMConsoleProcess() ? vboxGlobal().managedVMUuid() : UIExtraDataManager::GlobalID;
    2979         confirmedMessageList = gEDataManager->suppressedMessages(strID);
    2980         if (   confirmedMessageList.contains(strAutoConfirmId)
    2981             || confirmedMessageList.contains("allMessageBoxes")
    2982             || confirmedMessageList.contains("all") )
    2983         {
    2984             int iResultCode = AlertOption_AutoConfirmed;
    2985             if (iButton1 & AlertButtonOption_Default)
    2986                 iResultCode |= (iButton1 & AlertButtonMask);
    2987             if (iButton2 & AlertButtonOption_Default)
    2988                 iResultCode |= (iButton2 & AlertButtonMask);
    2989             if (iButton3 & AlertButtonOption_Default)
    2990                 iResultCode |= (iButton3 & AlertButtonMask);
    2991             return iResultCode;
    2992         }
    2993     }
    2994 
    2995     /* Choose title and icon: */
    2996     QString title;
    2997     AlertIconType icon;
    2998     switch (type)
    2999     {
    3000         default:
    3001         case MessageType_Info:
    3002             title = tr("VirtualBox - Information", "msg box title");
    3003             icon = AlertIconType_Information;
    3004             break;
    3005         case MessageType_Question:
    3006             title = tr("VirtualBox - Question", "msg box title");
    3007             icon = AlertIconType_Question;
    3008             break;
    3009         case MessageType_Warning:
    3010             title = tr("VirtualBox - Warning", "msg box title");
    3011             icon = AlertIconType_Warning;
    3012             break;
    3013         case MessageType_Error:
    3014             title = tr("VirtualBox - Error", "msg box title");
    3015             icon = AlertIconType_Critical;
    3016             break;
    3017         case MessageType_Critical:
    3018             title = tr("VirtualBox - Critical Error", "msg box title");
    3019             icon = AlertIconType_Critical;
    3020             break;
    3021         case MessageType_GuruMeditation:
    3022             title = "VirtualBox - Guru Meditation"; /* don't translate this */
    3023             icon = AlertIconType_GuruMeditation;
    3024             break;
    3025     }
    3026 
    3027     /* Create message-box: */
    3028     QWidget *pMessageBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
    3029     QPointer<QIMessageBox> pMessageBox = new QIMessageBox(title, strMessage, icon,
    3030                                                           iButton1, iButton2, iButton3,
    3031                                                           pMessageBoxParent);
    3032     windowManager().registerNewParent(pMessageBox, pMessageBoxParent);
    3033 
    3034     /* Prepare auto-confirmation check-box: */
    3035     if (!strAutoConfirmId.isEmpty())
    3036     {
    3037         pMessageBox->setFlagText(tr("Do not show this message again", "msg box flag"));
    3038         pMessageBox->setFlagChecked(false);
    3039     }
    3040 
    3041     /* Configure details: */
    3042     if (!strDetails.isEmpty())
    3043         pMessageBox->setDetailsText(strDetails);
    3044 
    3045     /* Configure button-text: */
    3046     if (!strButtonText1.isNull())
    3047         pMessageBox->setButtonText(0, strButtonText1);
    3048     if (!strButtonText2.isNull())
    3049         pMessageBox->setButtonText(1, strButtonText2);
    3050     if (!strButtonText3.isNull())
    3051         pMessageBox->setButtonText(2, strButtonText3);
    3052 
    3053     /* Show message-box: */
    3054     int iResultCode = pMessageBox->exec();
    3055 
    3056     /* Make sure message-box still valid: */
    3057     if (!pMessageBox)
    3058         return iResultCode;
    3059 
    3060     /* Remember auto-confirmation check-box value: */
    3061     if (!strAutoConfirmId.isEmpty())
    3062     {
    3063         if (pMessageBox->flagChecked())
    3064         {
    3065             confirmedMessageList << strAutoConfirmId;
    3066             gEDataManager->setSuppressedMessages(confirmedMessageList);
    3067         }
    3068     }
    3069 
    3070     /* Delete message-box: */
    3071     delete pMessageBox;
    3072 
    3073     /* Return result-code: */
    3074     return iResultCode;
    3075 }
    3076 
     232    strFormatted += "</table>";
     233
     234    if (comInfo.next())
     235        strFormatted = strFormatted + "<!--EOP-->" + errorInfoToString(*comInfo.next());
     236
     237    return strFormatted;
     238}
     239
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIErrorString.h

    r68433 r68435  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIMessageCenter class declaration.
     3 * VBox Qt GUI - UIErrorString class declaration.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 */
    1717
    18 #ifndef __UIMessageCenter_h__
    19 #define __UIMessageCenter_h__
     18#ifndef ___UIErrorString_h___
     19#define ___UIErrorString_h___
    2020
    2121/* Qt includes: */
    22 #include <QObject>
     22#include <QString>
    2323
    24 /* GUI includes: */
    25 #include "QIMessageBox.h"
    26 #include "UIMediumDefs.h"
    27 
    28 /* COM includes: */
    29 #include "COMEnums.h"
    30 #include "CProgress.h"
     24/* Other VBox includes: */
     25#include <VBox/com/defs.h>
    3126
    3227/* Forward declarations: */
    33 class UIMedium;
    34 struct StorageSlot;
    35 #ifdef VBOX_WITH_DRAG_AND_DROP
    36 class CGuest;
    37 #endif /* VBOX_WITH_DRAG_AND_DROP */
     28class COMBaseWithEI;
     29class COMErrorInfo;
     30class COMResult;
     31class CProgress;
     32class CVirtualBoxErrorInfo;
    3833
    39 /* Possible message types: */
    40 enum MessageType
     34
     35/** Namespace simplifying COM error formatting. */
     36class UIErrorString
    4137{
    42     MessageType_Info = 1,
    43     MessageType_Question,
    44     MessageType_Warning,
    45     MessageType_Error,
    46     MessageType_Critical,
    47     MessageType_GuruMeditation
    48 };
    49 Q_DECLARE_METATYPE(MessageType);
    50 
    51 /* Global message-center object: */
    52 class UIMessageCenter: public QObject
    53 {
    54     Q_OBJECT;
    55 
    56 signals:
    57 
    58     /* Notifier: Interthreading stuff: */
    59     void sigToShowMessageBox(QWidget *pParent, MessageType type,
    60                              const QString &strMessage, const QString &strDetails,
    61                              int iButton1, int iButton2, int iButton3,
    62                              const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
    63                              const QString &strAutoConfirmId) const;
    64 
    6538public:
    6639
    67     /* Static API: Create/destroy stuff: */
    68     static void create();
    69     static void destroy();
    70 
    71     /* API: Warning registration stuff: */
    72     bool warningShown(const QString &strWarningName) const;
    73     void setWarningShown(const QString &strWarningName, bool fWarningShown) const;
    74 
    75     /* API: Main message function, used directly only in exceptional cases: */
    76     int message(QWidget *pParent, MessageType type,
    77                 const QString &strMessage,
    78                 const QString &strDetails,
    79                 const char *pcszAutoConfirmId = 0,
    80                 int iButton1 = 0, int iButton2 = 0, int iButton3 = 0,
    81                 const QString &strButtonText1 = QString(),
    82                 const QString &strButtonText2 = QString(),
    83                 const QString &strButtonText3 = QString()) const;
    84 
    85     /* API: Wrapper to 'message' function.
    86      * Provides single OK button: */
    87     void error(QWidget *pParent, MessageType type,
    88                const QString &strMessage,
    89                const QString &strDetails,
    90                const char *pcszAutoConfirmId = 0) const;
    91 
    92     /* API: Wrapper to 'message' function,
    93      * Error with question providing two buttons (OK and Cancel by default): */
    94     bool errorWithQuestion(QWidget *pParent, MessageType type,
    95                            const QString &strMessage,
    96                            const QString &strDetails,
    97                            const char *pcszAutoConfirmId = 0,
    98                            const QString &strOkButtonText = QString(),
    99                            const QString &strCancelButtonText = QString()) const;
    100 
    101     /* API: Wrapper to 'error' function.
    102      * Omits details: */
    103     void alert(QWidget *pParent, MessageType type,
    104                const QString &strMessage,
    105                const char *pcszAutoConfirmId = 0) const;
    106 
    107     /* API: Wrapper to 'message' function.
    108      * Omits details, provides two or three buttons: */
    109     int question(QWidget *pParent, MessageType type,
    110                  const QString &strMessage,
    111                  const char *pcszAutoConfirmId = 0,
    112                  int iButton1 = 0, int iButton2 = 0, int iButton3 = 0,
    113                  const QString &strButtonText1 = QString(),
    114                  const QString &strButtonText2 = QString(),
    115                  const QString &strButtonText3 = QString()) const;
    116 
    117     /* API: Wrapper to 'question' function,
    118      * Question providing two buttons (OK and Cancel by default): */
    119     bool questionBinary(QWidget *pParent, MessageType type,
    120                         const QString &strMessage,
    121                         const char *pcszAutoConfirmId = 0,
    122                         const QString &strOkButtonText = QString(),
    123                         const QString &strCancelButtonText = QString(),
    124                         bool fDefaultFocusForOk = true) const;
    125 
    126     /* API: Wrapper to 'question' function,
    127      * Question providing three buttons (Yes, No and Cancel by default): */
    128     int questionTrinary(QWidget *pParent, MessageType type,
    129                         const QString &strMessage,
    130                         const char *pcszAutoConfirmId = 0,
    131                         const QString &strChoice1ButtonText = QString(),
    132                         const QString &strChoice2ButtonText = QString(),
    133                         const QString &strCancelButtonText = QString()) const;
    134 
    135     /* API: One more main function: */
    136     int messageWithOption(QWidget *pParent, MessageType type,
    137                           const QString &strMessage,
    138                           const QString &strOptionText,
    139                           bool fDefaultOptionValue = true,
    140                           int iButton1 = 0, int iButton2 = 0, int iButton3 = 0,
    141                           const QString &strButtonText1 = QString(),
    142                           const QString &strButtonText2 = QString(),
    143                           const QString &strButtonText3 = QString()) const;
    144 
    145     /* API: Progress-dialog stuff: */
    146     bool showModalProgressDialog(CProgress &progress, const QString &strTitle,
    147                                  const QString &strImage = "", QWidget *pParent = 0,
    148                                  int cMinDuration = 2000);
    149 
    150     /* API: Main (startup) warnings: */
    151 #ifdef RT_OS_LINUX
    152     void warnAboutWrongUSBMounted() const;
    153 #endif /* RT_OS_LINUX */
    154     void cannotStartSelector() const;
    155     void showBetaBuildWarning() const;
    156     void showExperimentalBuildWarning() const;
    157 
    158     /* API: COM startup warnings: */
    159     void cannotInitUserHome(const QString &strUserHome) const;
    160     void cannotInitCOM(HRESULT rc) const;
    161     void cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const;
    162     void cannotAcquireVirtualBox(const CVirtualBoxClient &client) const;
    163 
    164     /* API: Global warnings: */
    165     void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const;
    166     void cannotLoadLanguage(const QString &strLangFile) const;
    167     void cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const;
    168     void cannotFindMachineById(const CVirtualBox &vbox, const QString &strId) const;
    169     void cannotOpenSession(const CSession &session) const;
    170     void cannotOpenSession(const CMachine &machine) const;
    171     void cannotOpenSession(const CProgress &progress, const QString &strMachineName) const;
    172     void cannotGetMediaAccessibility(const UIMedium &medium) const;
    173     void cannotOpenURL(const QString &strUrl) const;
    174     void cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue);
    175     void cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue);
    176     void warnAboutInvalidEncryptionPassword(const QString &strPasswordId, QWidget *pParent = 0);
    177 
    178     /* API: Selector warnings: */
    179     void cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const;
    180     void cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) const;
    181     void cannotResolveCollisionAutomatically(const QString &strCollisionName, const QString &strGroupName) const;
    182     bool confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) const;
    183     void cannotSetGroups(const CMachine &machine) const;
    184     bool confirmMachineItemRemoval(const QStringList &names) const;
    185     int confirmMachineRemoval(const QList<CMachine> &machines) const;
    186     void cannotRemoveMachine(const CMachine &machine) const;
    187     void cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const;
    188     bool warnAboutInaccessibleMedia() const;
    189     bool confirmDiscardSavedState(const QString &strNames) const;
    190     bool confirmResetMachine(const QString &strNames) const;
    191     bool confirmACPIShutdownMachine(const QString &strNames) const;
    192     bool confirmPowerOffMachine(const QString &strNames) const;
    193     void cannotPauseMachine(const CConsole &console) const;
    194     void cannotResumeMachine(const CConsole &console) const;
    195     void cannotDiscardSavedState(const CMachine &machine) const;
    196     void cannotSaveMachineState(const CMachine &machine);
    197     void cannotSaveMachineState(const CProgress &progress, const QString &strMachineName);
    198     void cannotACPIShutdownMachine(const CConsole &console) const;
    199     void cannotPowerDownMachine(const CConsole &console) const;
    200     void cannotPowerDownMachine(const CProgress &progress, const QString &strMachineName) const;
    201     bool confirmStartMultipleMachines(const QString &strNames) const;
    202 
    203     /* API: Snapshot warnings: */
    204     int confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) const;
    205     bool confirmSnapshotRemoval(const QString &strSnapshotName) const;
    206     bool warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, const QString &strTargetImageName,
    207                                            const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree) const;
    208     void cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent = 0) const;
    209     void cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const;
    210     bool cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const;
    211     bool cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const;
    212     void cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const;
    213     void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const;
    214     void cannotFindSnapshotByName(const CMachine &comMachine, const QString &strName, QWidget *pParent = 0) const;
    215     void cannotFindSnapshotById(const CMachine &comMachine, const QString &strId, QWidget *pParent = 0) const;
    216     void cannotAcquireSnapshotAttributes(const CSnapshot &comSnapshot, QWidget *pParent = 0);
    217 
    218     /* API: Common settings warnings: */
    219     void cannotSaveSettings(const QString strDetails, QWidget *pParent = 0) const;
    220 
    221     /* API: Global settings warnings: */
    222     bool confirmNATNetworkRemoval(const QString &strName, QWidget *pParent = 0) const;
    223     void cannotSetSystemProperties(const CSystemProperties &properties, QWidget *pParent = 0) const;
    224 
    225     /* API: Machine settings warnings: */
    226     void warnAboutUnaccessibleUSB(const COMBaseWithEI &object, QWidget *pParent = 0) const;
    227     void warnAboutStateChange(QWidget *pParent = 0) const;
    228     bool confirmSettingsReloading(QWidget *pParent = 0) const;
    229     int confirmHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const;
    230     int confirmOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const;
    231     int confirmFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const;
    232     int confirmRemovingOfLastDVDDevice(QWidget *pParent = 0) const;
    233     void cannotAttachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0);
    234     bool warnAboutIncorrectPort(QWidget *pParent = 0) const;
    235     bool warnAboutIncorrectAddress(QWidget *pParent = 0) const;
    236     bool warnAboutEmptyGuestAddress(QWidget *pParent = 0) const;
    237     bool warnAboutNameShouldBeUnique(QWidget *pParent = 0) const;
    238     bool warnAboutRulesConflict(QWidget *pParent = 0) const;
    239     bool confirmCancelingPortForwardingDialog(QWidget *pParent = 0) const;
    240     void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0) const;
    241 
    242     /* API: Virtual Medium Manager warnings: */
    243     void cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent = 0) const;
    244     void cannotMoveMediumStorage(const CMedium &comMedium, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent = 0) const;
    245     void cannotMoveMediumStorage(const CProgress &comProgress, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent = 0) const;
    246     void cannotChangeMediumDescription(const CMedium &comMedium, const QString &strLocation, QWidget *pParent = 0) const;
    247     bool confirmMediumRelease(const UIMedium &medium, QWidget *pParent = 0) const;
    248     bool confirmMediumRemoval(const UIMedium &medium, QWidget *pParent = 0) const;
    249     int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const;
    250     void cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0) const;
    251     void cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0) const;
    252     void cannotResizeHardDiskStorage(const CMedium &comMedium, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent = 0) const;
    253     void cannotResizeHardDiskStorage(const CProgress &comProgress, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent = 0) const;
    254     void cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0) const;
    255     bool cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent = 0) const;
    256     void cannotOpenMedium(const CVirtualBox &vbox, UIMediumType type, const QString &strLocation, QWidget *pParent = 0) const;
    257     void cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent = 0) const;
    258 
    259     /* API: Host Network Manager warnings: */
    260     bool confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent = 0) const;
    261     void cannotAcquireHostNetworkInterfaces(const CHost &comHost, QWidget *pParent = 0) const;
    262     void cannotFindHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent = 0) const;
    263     void cannotCreateHostNetworkInterface(const CHost &comHost, QWidget *pParent = 0) const;
    264     void cannotCreateHostNetworkInterface(const CProgress &progress, QWidget *pParent = 0) const;
    265     void cannotRemoveHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent = 0) const;
    266     void cannotRemoveHostNetworkInterface(const CProgress &progress, const QString &strInterfaceName, QWidget *pParent = 0) const;
    267     void cannotAcquireHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent = 0) const;
    268     void cannotSaveHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent = 0) const;
    269     void cannotCreateDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent = 0) const;
    270     void cannotRemoveDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent = 0) const;
    271     void cannotAcquireDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent = 0) const;
    272     void cannotSaveDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent = 0) const;
    273 
    274     /* API: Wizards warnings: */
    275     bool confirmHardDisklessMachine(QWidget *pParent = 0) const;
    276     void cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent = 0) const;
    277     void cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent = 0) const;
    278     void cannotCreateClone(const CMachine &machine, QWidget *pParent = 0) const;
    279     void cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const;
    280     void cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const;
    281     void cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation,QWidget *pParent = 0) const;
    282     void cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0) const;
    283     void cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0) const;
    284     void cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent = 0) const;
    285     void cannotRewriteMachineFolder(const QString &strFolderName, QWidget *pParent = 0) const;
    286     void cannotCreateMachineFolder(const QString &strFolderName, QWidget *pParent = 0) const;
    287     void cannotImportAppliance(CAppliance &appliance, QWidget *pParent = 0) const;
    288     void cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const;
    289     void cannotCheckFiles(const CProgress &progress, QWidget *pParent = 0) const;
    290     void cannotRemoveFiles(const CProgress &progress, QWidget *pParent = 0) const;
    291     bool confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent = 0) const;
    292     void cannotExportAppliance(const CAppliance &appliance, QWidget *pParent = 0) const;
    293     void cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent = 0) const;
    294     void cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const;
    295     void cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent = 0);
    296 
    297     /* API: Runtime UI warnings: */
    298     void showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const;
    299     bool remindAboutGuruMeditation(const QString &strLogFolder);
    300     void warnAboutVBoxSVCUnavailable() const;
    301     bool warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const;
    302     bool warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const;
    303     bool cannotStartWithoutNetworkIf(const QString &strMachineName, const QString &strIfNames) const;
    304     void cannotStartMachine(const CConsole &console, const QString &strName) const;
    305     void cannotStartMachine(const CProgress &progress, const QString &strName) const;
    306     bool confirmInputCapture(bool &fAutoConfirmed) const;
    307     bool confirmGoingFullscreen(const QString &strHotKey) const;
    308     bool confirmGoingSeamless(const QString &strHotKey) const;
    309     bool confirmGoingScale(const QString &strHotKey) const;
    310     bool cannotEnterFullscreenMode(ULONG uWidth, ULONG uHeight, ULONG uBpp, ULONG64 uMinVRAM) const;
    311     void cannotEnterSeamlessMode(ULONG uWidth, ULONG uHeight, ULONG uBpp, ULONG64 uMinVRAM) const;
    312     bool cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const;
    313     void cannotSwitchScreenInSeamless(quint64 uMinVRAM) const;
    314     void cannotAttachUSBDevice(const CConsole &console, const QString &strDevice) const;
    315     void cannotAttachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const;
    316     void cannotDetachUSBDevice(const CConsole &console, const QString &strDevice) const;
    317     void cannotDetachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const;
    318     void cannotAttachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const;
    319     void cannotDetachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const;
    320     void cannotToggleVideoCapture(const CMachine &machine, bool fEnable);
    321     void cannotToggleVRDEServer(const CVRDEServer &server, const QString &strMachineName, bool fEnable);
    322     void cannotToggleNetworkAdapterCable(const CNetworkAdapter &adapter, const QString &strMachineName, bool fConnect);
    323     void remindAboutGuestAdditionsAreNotActive() const;
    324     void cannotMountGuestAdditions(const QString &strMachineName) const;
    325     void cannotAddDiskEncryptionPassword(const CConsole &console);
    326 
    327 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    328     /* API: Network management warnings: */
    329     bool confirmCancelingAllNetworkRequests() const;
    330     void showUpdateSuccess(const QString &strVersion, const QString &strLink) const;
    331     void showUpdateNotFound() const;
    332     void askUserToDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion) const;
    333 
    334     /* API: Downloading warnings: */
    335     bool cannotFindGuestAdditions() const;
    336     bool confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const;
    337     void cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const;
    338     bool proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const;
    339     void cannotValidateGuestAdditionsSHA256Sum(const QString &strUrl, const QString &strSrc) const;
    340     void cannotUpdateGuestAdditions(const CProgress &progress) const;
    341     bool cannotFindUserManual(const QString &strMissedLocation) const;
    342     bool confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const;
    343     void cannotSaveUserManual(const QString &strURL, const QString &strTarget) const;
    344     void warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) const;
    345     bool warAboutOutdatedExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const;
    346     bool confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const;
    347     void cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const;
    348     bool proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const;
    349     void cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const;
    350     bool proposeDeleteExtentionPack(const QString &strTo) const;
    351     bool proposeDeleteOldExtentionPacks(const QStringList &strFiles) const;
    352 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    353 
    354     /* API: Extension-pack warnings: */
    355     bool confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion, const QString &strPackDescription, QWidget *pParent = 0) const;
    356     bool confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew, const QString &strPackVersionOld,
    357                                      const QString &strPackDescription, QWidget *pParent = 0) const;
    358     bool confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent = 0) const;
    359     void cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent = 0) const;
    360     void warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent = 0) const;
    361     void cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent = 0) const;
    362     void cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent = 0) const;
    363     void cannotUninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent = 0) const;
    364     void cannotUninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent = 0) const;
    365     void warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent = 0) const;
    366 
    367 #ifdef VBOX_WITH_DRAG_AND_DROP
    368     /* API: Drag and drop warnings: */
    369     void cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const;
    370     void cannotDropDataToGuest(const CProgress &progress, QWidget *pParent = 0) const;
    371     void cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const;
    372     void cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent = 0) const;
    373     void cannotDropDataToHost(const CProgress &progress, QWidget *pParent = 0) const;
    374 #endif /* VBOX_WITH_DRAG_AND_DROP */
    375 
    376     /* API: License-viewer warnings: */
    377     void cannotOpenLicenseFile(const QString &strPath, QWidget *pParent = 0) const;
    378 
    379     /* API: File-dialog warnings: */
    380     bool confirmOverridingFile(const QString &strPath, QWidget *pParent = 0) const;
    381     bool confirmOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent = 0) const;
    382     bool confirmOverridingFileIfExists(const QString &strPath, QWidget *pParent = 0) const;
    383     bool confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent = 0) const;
    384 
    385     /* API: Static helpers: */
     40    /** Returns formatted @a rc information. */
    38641    static QString formatRC(HRESULT rc);
     42    /** Returns full formatted @a rc information. */
    38743    static QString formatRCFull(HRESULT rc);
    388     static QString formatErrorInfo(const CProgress &progress);
    389     static QString formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC = S_OK);
    390     static QString formatErrorInfo(const CVirtualBoxErrorInfo &info);
    391     static QString formatErrorInfo(const COMBaseWithEI &wrapper);
    392     static QString formatErrorInfo(const COMResult &rc);
    393 
    394 public slots:
    395 
    396     /* Handlers: Help menu stuff: */
    397     void sltShowHelpWebDialog();
    398     void sltShowBugTracker();
    399     void sltShowForums();
    400     void sltShowOracle();
    401     void sltShowHelpAboutDialog();
    402     void sltShowHelpHelpDialog();
    403     void sltResetSuppressedMessages();
    404     void sltShowUserManual(const QString &strLocation);
    405 
    406 private slots:
    407 
    408     /* Handler: Interthreading stuff: */
    409     void sltShowMessageBox(QWidget *pParent, MessageType type,
    410                            const QString &strMessage, const QString &strDetails,
    411                            int iButton1, int iButton2, int iButton3,
    412                            const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
    413                            const QString &strAutoConfirmId) const;
     44    /** Returns formatted error information for passed @a comProgress. */
     45    static QString formatErrorInfo(const CProgress &comProgress);
     46    /** Returns formatted error information for passed @a comInfo and @a wrapperRC. */
     47    static QString formatErrorInfo(const COMErrorInfo &comInfo, HRESULT wrapperRC = S_OK);
     48    /** Returns formatted error information for passed @a comInfo. */
     49    static QString formatErrorInfo(const CVirtualBoxErrorInfo &comInfo);
     50    /** Returns formatted error information for passed @a comWrapper. */
     51    static QString formatErrorInfo(const COMBaseWithEI &comWrapper);
     52    /** Returns formatted error information for passed @a comRc. */
     53    static QString formatErrorInfo(const COMResult &comRc);
    41454
    41555private:
    41656
    417     /* Constructor/destructor: */
    418     UIMessageCenter();
    419     ~UIMessageCenter();
    420 
    421     /* Helpers: Prepare/cleanup stuff: */
    422     void prepare();
    423     void cleanup();
    424 
    425     /* Helper: */
    426     static QString errorInfoToString(const COMErrorInfo &info, HRESULT wrapperRC = S_OK);
    427 
    428     /* Helper: Message-box stuff: */
    429     int showMessageBox(QWidget *pParent, MessageType type,
    430                        const QString &strMessage, const QString &strDetails,
    431                        int iButton1, int iButton2, int iButton3,
    432                        const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
    433                        const QString &strAutoConfirmId) const;
    434 
    435     /* Variables: */
    436     mutable QStringList m_warnings;
    437 
    438     /* API: Instance stuff: */
    439     static UIMessageCenter* m_spInstance;
    440     static UIMessageCenter* instance();
    441     friend UIMessageCenter& msgCenter();
     57    /** Converts passed @a comInfo and @a wrapperRC to string. */
     58    static QString errorInfoToString(const COMErrorInfo &comInfo, HRESULT wrapperRC = S_OK);
    44259};
    44360
    444 /* Shortcut to the static UIMessageCenter::instance() method: */
    445 inline UIMessageCenter& msgCenter() { return *UIMessageCenter::instance(); }
     61#endif /* !___UIErrorString_h___ */
    44662
    447 #endif // __UIMessageCenter_h__
    448 
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r68411 r68435  
    3636# include "UISelectorWindow.h"
    3737# include "UIProgressDialog.h"
     38# include "UIErrorString.h"
    3839# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    3940#  include "UINetworkManager.h"
     
    430431             "<p>The application will now terminate.</p>")
    431432             .arg(strUserHome),
    432           formatErrorInfo(COMErrorInfo()));
     433          UIErrorString::formatErrorInfo(COMErrorInfo()));
    433434}
    434435
     
    439440             "Most likely, the VirtualBox server is not running or failed to start.</p>"
    440441             "<p>The application will now terminate.</p>"),
    441           formatErrorInfo(COMErrorInfo(), rc));
     442          UIErrorString::formatErrorInfo(COMErrorInfo(), rc));
    442443}
    443444
     
    447448          tr("<p>Failed to create the VirtualBoxClient COM object.</p>"
    448449             "<p>The application will now terminate.</p>"),
    449           formatErrorInfo(client));
     450          UIErrorString::formatErrorInfo(client));
    450451}
    451452
     
    460461                  "<font color=blue>'/tmp'</font> and <font color=blue>'/tmp/.vbox-*-ipc/'</font></p>");
    461462#endif
    462     error(0, MessageType_Critical, err, formatErrorInfo(client));
     463    error(0, MessageType_Critical, err, UIErrorString::formatErrorInfo(client));
    463464}
    464465
     
    488489          tr("There is no virtual machine named <b>%1</b>.")
    489490             .arg(strName),
    490           formatErrorInfo(vbox));
     491          UIErrorString::formatErrorInfo(vbox));
    491492}
    492493
     
    496497          tr("There is no virtual machine with the identifier <b>%1</b>.")
    497498             .arg(strId),
    498           formatErrorInfo(vbox));
     499          UIErrorString::formatErrorInfo(vbox));
    499500}
    500501
     
    503504    error(0, MessageType_Error,
    504505          tr("Failed to create a new session."),
    505           formatErrorInfo(session));
     506          UIErrorString::formatErrorInfo(session));
    506507}
    507508
     
    511512          tr("Failed to open a session for the virtual machine <b>%1</b>.")
    512513             .arg(CMachine(machine).GetName()),
    513           formatErrorInfo(machine));
     514          UIErrorString::formatErrorInfo(machine));
    514515}
    515516
     
    519520          tr("Failed to open a session for the virtual machine <b>%1</b>.")
    520521             .arg(strMachineName),
    521           formatErrorInfo(progress));
     522          UIErrorString::formatErrorInfo(progress));
    522523}
    523524
     
    527528          tr("Failed to access the disk image file <nobr><b>%1</b></nobr>.")
    528529             .arg(medium.location()),
    529           formatErrorInfo(medium.result()));
     530          UIErrorString::formatErrorInfo(medium.result()));
    530531}
    531532
     
    543544          tr("Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.")
    544545             .arg(strKey, strValue),
    545           formatErrorInfo(vbox));
     546          UIErrorString::formatErrorInfo(vbox));
    546547}
    547548
     
    551552          tr("Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.")
    552553             .arg(strKey, CMachine(machine).GetName(), strValue),
    553           formatErrorInfo(machine));
     554          UIErrorString::formatErrorInfo(machine));
    554555}
    555556
     
    566567          tr("Failed to open virtual machine located in %1.")
    567568             .arg(strMachinePath),
    568           formatErrorInfo(vbox));
     569          UIErrorString::formatErrorInfo(vbox));
    569570}
    570571
     
    606607          tr("Failed to set groups of the virtual machine <b>%1</b>.")
    607608             .arg(strName),
    608           formatErrorInfo(machine));
     609          UIErrorString::formatErrorInfo(machine));
    609610}
    610611
     
    707708          tr("Failed to remove the virtual machine <b>%1</b>.")
    708709             .arg(CMachine(machine).GetName()),
    709           formatErrorInfo(machine));
     710          UIErrorString::formatErrorInfo(machine));
    710711}
    711712
     
    715716          tr("Failed to remove the virtual machine <b>%1</b>.")
    716717             .arg(CMachine(machine).GetName()),
    717           formatErrorInfo(progress));
     718          UIErrorString::formatErrorInfo(progress));
    718719}
    719720
     
    780781          tr("Failed to pause the execution of the virtual machine <b>%1</b>.")
    781782             .arg(CConsole(console).GetMachine().GetName()),
    782           formatErrorInfo(console));
     783          UIErrorString::formatErrorInfo(console));
    783784}
    784785
     
    788789          tr("Failed to resume the execution of the virtual machine <b>%1</b>.")
    789790             .arg(CConsole(console).GetMachine().GetName()),
    790           formatErrorInfo(console));
     791          UIErrorString::formatErrorInfo(console));
    791792}
    792793
     
    796797          tr("Failed to discard the saved state of the virtual machine <b>%1</b>.")
    797798             .arg(machine.GetName()),
    798           formatErrorInfo(machine));
     799          UIErrorString::formatErrorInfo(machine));
    799800}
    800801
     
    804805          tr("Failed to save the state of the virtual machine <b>%1</b>.")
    805806             .arg(machine.GetName()),
    806           formatErrorInfo(machine));
     807          UIErrorString::formatErrorInfo(machine));
    807808}
    808809
     
    812813          tr("Failed to save the state of the virtual machine <b>%1</b>.")
    813814             .arg(strMachineName),
    814           formatErrorInfo(progress));
     815          UIErrorString::formatErrorInfo(progress));
    815816}
    816817
     
    820821          tr("Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.")
    821822             .arg(CConsole(console).GetMachine().GetName()),
    822           formatErrorInfo(console));
     823          UIErrorString::formatErrorInfo(console));
    823824}
    824825
     
    828829          tr("Failed to stop the virtual machine <b>%1</b>.")
    829830             .arg(CConsole(console).GetMachine().GetName()),
    830           formatErrorInfo(console));
     831          UIErrorString::formatErrorInfo(console));
    831832}
    832833
     
    836837          tr("Failed to stop the virtual machine <b>%1</b>.")
    837838             .arg(strMachineName),
    838           formatErrorInfo(progress));
     839          UIErrorString::formatErrorInfo(progress));
    839840}
    840841
     
    909910          tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")
    910911             .arg(strMachineName),
    911           formatErrorInfo(machine));
     912          UIErrorString::formatErrorInfo(machine));
    912913}
    913914
     
    917918          tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")
    918919             .arg(strMachineName),
    919           formatErrorInfo(progress));
     920          UIErrorString::formatErrorInfo(progress));
    920921}
    921922
     
    925926          tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    926927             .arg(strSnapshotName, strMachineName),
    927           formatErrorInfo(machine));
     928          UIErrorString::formatErrorInfo(machine));
    928929    return false;
    929930}
     
    934935          tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    935936             .arg(strSnapshotName, strMachineName),
    936           formatErrorInfo(progress));
     937          UIErrorString::formatErrorInfo(progress));
    937938    return false;
    938939}
     
    943944          tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    944945             .arg(strSnapshotName, strMachineName),
    945           formatErrorInfo(machine));
     946          UIErrorString::formatErrorInfo(machine));
    946947}
    947948
     
    951952          tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    952953             .arg(strSnapshotName).arg(strMachineName),
    953           formatErrorInfo(progress));
     954          UIErrorString::formatErrorInfo(progress));
    954955}
    955956
     
    961962          tr("Can't find snapshot named <b>%1</b>.")
    962963             .arg(strName),
    963           formatErrorInfo(comMachine));
     964          UIErrorString::formatErrorInfo(comMachine));
    964965}
    965966
     
    971972          tr("Can't find snapshot with ID=<b>%1</b>.")
    972973             .arg(strId),
    973           formatErrorInfo(comMachine));
     974          UIErrorString::formatErrorInfo(comMachine));
    974975}
    975976
     
    979980    error(pParent, MessageType_Error,
    980981          tr("Can't acquire snapshot attributes."),
    981           formatErrorInfo(comSnapshot));
     982          UIErrorString::formatErrorInfo(comSnapshot));
    982983}
    983984
     
    10091010    error(pParent, MessageType_Critical,
    10101011          tr("Failed to set global VirtualBox properties."),
    1011           formatErrorInfo(properties));
     1012          UIErrorString::formatErrorInfo(properties));
    10121013}
    10131014
     
    10231024    error(pParent, res.isWarning() ? MessageType_Warning : MessageType_Error,
    10241025          tr("Failed to access the USB subsystem."),
    1025           formatErrorInfo(res),
     1026          UIErrorString::formatErrorInfo(res),
    10261027          "warnAboutUnaccessibleUSB");
    10271028}
     
    11241125    }
    11251126    error(pParent, MessageType_Error,
    1126           strMessage, formatErrorInfo(machine));
     1127          strMessage, UIErrorString::formatErrorInfo(machine));
    11271128}
    11281129
     
    11831184          tr("Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.")
    11841185             .arg(machine.GetName(), CMachine(machine).GetSettingsFilePath()),
    1185           formatErrorInfo(machine));
     1186          UIErrorString::formatErrorInfo(machine));
    11861187}
    11871188
     
    11911192          tr("<p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p>")
    11921193             .arg(gpConverter->toString(oldMediumType)).arg(gpConverter->toString(newMediumType)),
    1193           formatErrorInfo(medium));
     1194          UIErrorString::formatErrorInfo(medium));
    11941195}
    11951196
     
    11991200          tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.")
    12001201             .arg(strLocationOld, strLocationNew),
    1201           formatErrorInfo(comMedium));
     1202          UIErrorString::formatErrorInfo(comMedium));
    12021203}
    12031204
     
    12071208          tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.")
    12081209             .arg(strLocationOld, strLocationNew),
    1209           formatErrorInfo(comProgress));
     1210          UIErrorString::formatErrorInfo(comProgress));
    12101211}
    12111212
     
    12151216          tr("<p>Error changing the description of the disk image <b>%1</b>.</p>")
    12161217             .arg(strLocation),
    1217           formatErrorInfo(comMedium));
     1218          UIErrorString::formatErrorInfo(comMedium));
    12181219}
    12191220
     
    13151316          tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")
    13161317             .arg(strLocation),
    1317           formatErrorInfo(medium));
     1318          UIErrorString::formatErrorInfo(medium));
    13181319}
    13191320
     
    13231324          tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")
    13241325             .arg(strLocation),
    1325           formatErrorInfo(progress));
     1326          UIErrorString::formatErrorInfo(progress));
    13261327}
    13271328
     
    13311332          tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.")
    13321333             .arg(strLocation, strSizeOld, strSizeNew),
    1333           formatErrorInfo(comMedium));
     1334          UIErrorString::formatErrorInfo(comMedium));
    13341335}
    13351336
     
    13391340          tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.")
    13401341             .arg(strLocation, strSizeOld, strSizeNew),
    1341           formatErrorInfo(comProgress));
     1342          UIErrorString::formatErrorInfo(comProgress));
    13421343}
    13431344
     
    13701371    }
    13711372    /* Show the error: */
    1372     error(pParent, MessageType_Error, strMessage, formatErrorInfo(machine));
     1373    error(pParent, MessageType_Error, strMessage, UIErrorString::formatErrorInfo(machine));
    13731374}
    13741375
     
    14181419        return errorWithQuestion(pParent, MessageType_Question,
    14191420                                 strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()),
    1420                                  formatErrorInfo(machine),
     1421                                 UIErrorString::formatErrorInfo(machine),
    14211422                                 0 /* Auto Confirm ID */,
    14221423                                 tr("Force Unmount"));
    14231424    error(pParent, MessageType_Error,
    14241425          strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()),
    1425           formatErrorInfo(machine));
     1426          UIErrorString::formatErrorInfo(machine));
    14261427    return false;
    14271428}
     
    14311432    /* Show the error: */
    14321433    error(pParent, MessageType_Error,
    1433           tr("Failed to open the disk image file <nobr><b>%1</b></nobr>.").arg(strLocation), formatErrorInfo(vbox));
     1434          tr("Failed to open the disk image file <nobr><b>%1</b></nobr>.").arg(strLocation), UIErrorString::formatErrorInfo(vbox));
    14341435}
    14351436
     
    14381439    /* Show the error: */
    14391440    error(pParent, MessageType_Error,
    1440           tr("Failed to close the disk image file <nobr><b>%1</b></nobr>.").arg(medium.location()), formatErrorInfo(rc));
     1441          tr("Failed to close the disk image file <nobr><b>%1</b></nobr>.").arg(medium.location()), UIErrorString::formatErrorInfo(rc));
    14411442}
    14421443
     
    14631464    error(pParent, MessageType_Error,
    14641465          tr("Failed to acquire host network interfaces."),
    1465           formatErrorInfo(comHost));
     1466          UIErrorString::formatErrorInfo(comHost));
    14661467}
    14671468
     
    14711472          tr("Unable to find the host network interface <b>%1</b>.")
    14721473             .arg(strInterfaceName),
    1473           formatErrorInfo(comHost));
     1474          UIErrorString::formatErrorInfo(comHost));
    14741475}
    14751476
     
    14781479    error(pParent, MessageType_Error,
    14791480          tr("Failed to create a host network interface."),
    1480           formatErrorInfo(comHost));
     1481          UIErrorString::formatErrorInfo(comHost));
    14811482}
    14821483
     
    14851486    error(pParent, MessageType_Error,
    14861487          tr("Failed to create a host network interface."),
    1487           formatErrorInfo(progress));
     1488          UIErrorString::formatErrorInfo(progress));
    14881489}
    14891490
     
    14931494          tr("Failed to remove the host network interface <b>%1</b>.")
    14941495             .arg(strInterfaceName),
    1495           formatErrorInfo(comHost));
     1496          UIErrorString::formatErrorInfo(comHost));
    14961497}
    14971498
     
    15011502          tr("Failed to remove the host network interface <b>%1</b>.")
    15021503             .arg(strInterfaceName),
    1503           formatErrorInfo(progress));
     1504          UIErrorString::formatErrorInfo(progress));
    15041505}
    15051506
     
    15081509    error(pParent, MessageType_Error,
    15091510          tr("Failed to acquire host network interface parameter."),
    1510           formatErrorInfo(comInterface));
     1511          UIErrorString::formatErrorInfo(comInterface));
    15111512}
    15121513
     
    15151516    error(pParent, MessageType_Error,
    15161517          tr("Failed to save host network interface parameter."),
    1517           formatErrorInfo(comInterface));
     1518          UIErrorString::formatErrorInfo(comInterface));
    15181519}
    15191520
     
    15231524          tr("Failed to create a DHCP server for the network interface <b>%1</b>.")
    15241525             .arg(strInterfaceName),
    1525           formatErrorInfo(comVBox));
     1526          UIErrorString::formatErrorInfo(comVBox));
    15261527}
    15271528
     
    15311532          tr("Failed to remove the DHCP server for the network interface <b>%1</b>.")
    15321533             .arg(strInterfaceName),
    1533           formatErrorInfo(comVBox));
     1534          UIErrorString::formatErrorInfo(comVBox));
    15341535}
    15351536
     
    15381539    error(pParent, MessageType_Error,
    15391540          tr("Failed to acquire DHCP server parameter."),
    1540           formatErrorInfo(comServer));
     1541          UIErrorString::formatErrorInfo(comServer));
    15411542}
    15421543
     
    15451546    error(pParent, MessageType_Error,
    15461547          tr("Failed to save DHCP server parameter."),
    1547           formatErrorInfo(comServer));
     1548          UIErrorString::formatErrorInfo(comServer));
    15481549}
    15491550
     
    15641565    error(pParent, MessageType_Error,
    15651566          tr("Failed to create a new virtual machine."),
    1566           formatErrorInfo(vbox));
     1567          UIErrorString::formatErrorInfo(vbox));
    15671568}
    15681569
     
    15721573          tr("Failed to register the virtual machine <b>%1</b>.")
    15731574             .arg(strMachineName),
    1574           formatErrorInfo(vbox));
     1575          UIErrorString::formatErrorInfo(vbox));
    15751576}
    15761577
     
    15801581          tr("Failed to clone the virtual machine <b>%1</b>.")
    15811582             .arg(CMachine(machine).GetName()),
    1582           formatErrorInfo(machine));
     1583          UIErrorString::formatErrorInfo(machine));
    15831584}
    15841585
     
    15881589          tr("Failed to clone the virtual machine <b>%1</b>.")
    15891590             .arg(strMachineName),
    1590           formatErrorInfo(progress));
     1591          UIErrorString::formatErrorInfo(progress));
    15911592}
    15921593
     
    16061607          tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
    16071608             .arg(strLocation),
    1608           formatErrorInfo(vbox));
     1609          UIErrorString::formatErrorInfo(vbox));
    16091610}
    16101611
     
    16141615          tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
    16151616             .arg(strLocation),
    1616           formatErrorInfo(medium));
     1617          UIErrorString::formatErrorInfo(medium));
    16171618}
    16181619
     
    16221623          tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
    16231624             .arg(strLocation),
    1624           formatErrorInfo(progress));
     1625          UIErrorString::formatErrorInfo(progress));
    16251626}
    16261627
     
    16541655{
    16551656    /* Preserve error-info: */
    1656     QString strErrorInfo = formatErrorInfo(appliance);
     1657    QString strErrorInfo = UIErrorString::formatErrorInfo(appliance);
    16571658    /* Add the warnings in the case of an early error: */
    16581659    QString strWarningInfo;
     
    16731674          tr("Failed to import appliance <b>%1</b>.")
    16741675             .arg(strPath),
    1675           formatErrorInfo(progress));
     1676          UIErrorString::formatErrorInfo(progress));
    16761677}
    16771678
     
    16801681    error(pParent, MessageType_Error,
    16811682          tr("Failed to check files."),
    1682           formatErrorInfo(progress));
     1683          UIErrorString::formatErrorInfo(progress));
    16831684}
    16841685
     
    16871688    error(pParent, MessageType_Error,
    16881689          tr("Failed to remove file."),
    1689           formatErrorInfo(progress));
     1690          UIErrorString::formatErrorInfo(progress));
    16901691}
    16911692
     
    17091710          tr("Failed to prepare the export of the appliance <b>%1</b>.")
    17101711             .arg(CAppliance(appliance).GetPath()),
    1711           formatErrorInfo(appliance));
     1712          UIErrorString::formatErrorInfo(appliance));
    17121713}
    17131714
     
    17171718          tr("Failed to prepare the export of the appliance <b>%1</b>.")
    17181719             .arg(strPath),
    1719           formatErrorInfo(machine));
     1720          UIErrorString::formatErrorInfo(machine));
    17201721}
    17211722
     
    17251726          tr("Failed to export appliance <b>%1</b>.")
    17261727             .arg(strPath),
    1727           formatErrorInfo(progress));
     1728          UIErrorString::formatErrorInfo(progress));
    17281729}
    17291730
     
    17321733    error(pParent, MessageType_Error,
    17331734          tr("Bad password or authentication failure."),
    1734           formatErrorInfo(appliance));
     1735          UIErrorString::formatErrorInfo(appliance));
    17351736}
    17361737
     
    19241925          tr("Failed to start the virtual machine <b>%1</b>.")
    19251926             .arg(strName),
    1926           formatErrorInfo(console));
     1927          UIErrorString::formatErrorInfo(console));
    19271928}
    19281929
     
    19321933          tr("Failed to start the virtual machine <b>%1</b>.")
    19331934             .arg(strName),
    1934           formatErrorInfo(progress));
     1935          UIErrorString::formatErrorInfo(progress));
    19351936}
    19361937
     
    20462047          tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
    20472048             .arg(strDevice, CConsole(console).GetMachine().GetName()),
    2048           formatErrorInfo(console));
     2049          UIErrorString::formatErrorInfo(console));
    20492050}
    20502051
     
    20542055          tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
    20552056             .arg(strDevice, strMachineName),
    2056           formatErrorInfo(errorInfo));
     2057          UIErrorString::formatErrorInfo(errorInfo));
    20572058}
    20582059
     
    20622063          tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
    20632064             .arg(strDevice, CConsole(console).GetMachine().GetName()),
    2064           formatErrorInfo(console));
     2065          UIErrorString::formatErrorInfo(console));
    20652066}
    20662067
     
    20702071          tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
    20712072             .arg(strDevice, strMachineName),
    2072           formatErrorInfo(errorInfo));
     2073          UIErrorString::formatErrorInfo(errorInfo));
    20732074}
    20742075
     
    20782079          tr("Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.")
    20792080             .arg(strWebCamName, strMachineName),
    2080           formatErrorInfo(dispatcher));
     2081          UIErrorString::formatErrorInfo(dispatcher));
    20812082}
    20822083
     
    20862087          tr("Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.")
    20872088             .arg(strWebCamName, strMachineName),
    2088           formatErrorInfo(dispatcher));
     2089          UIErrorString::formatErrorInfo(dispatcher));
    20892090}
    20902091
     
    20972098              tr("Failed to enable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName) :
    20982099              tr("Failed to disable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName),
    2099           formatErrorInfo(machine));
     2100          UIErrorString::formatErrorInfo(machine));
    21002101}
    21012102
     
    21062107              tr("Failed to enable the remote desktop server for the virtual machine <b>%1</b>.").arg(strMachineName) :
    21072108              tr("Failed to disable the remote desktop server for the virtual machine <b>%1</b>.").arg(strMachineName),
    2108           formatErrorInfo(server));
     2109          UIErrorString::formatErrorInfo(server));
    21092110}
    21102111
     
    21152116              tr("Failed to connect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName) :
    21162117              tr("Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName),
    2117           formatErrorInfo(adapter));
     2118          UIErrorString::formatErrorInfo(adapter));
    21182119}
    21192120
     
    21422143    error(0, MessageType_Error,
    21432144          tr("Bad password or authentication failure."),
    2144           formatErrorInfo(console));
     2145          UIErrorString::formatErrorInfo(console));
    21452146}
    21462147
     
    22332234          tr("Failed to update Guest Additions. "
    22342235             "The Guest Additions disk image file will be inserted for user installation."),
    2235           formatErrorInfo(progress));
     2236          UIErrorString::formatErrorInfo(progress));
    22362237}
    22372238
     
    24392440    error(pParent, MessageType_Error,
    24402441          tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
    2441           formatErrorInfo(extPackManager));
     2442          UIErrorString::formatErrorInfo(extPackManager));
    24422443}
    24432444
     
    24542455          tr("Failed to install the Extension Pack <b>%1</b>.")
    24552456             .arg(strFilename),
    2456           formatErrorInfo(extPackFile));
     2457          UIErrorString::formatErrorInfo(extPackFile));
    24572458}
    24582459
     
    24622463          tr("Failed to install the Extension Pack <b>%1</b>.")
    24632464             .arg(strFilename),
    2464           formatErrorInfo(progress));
     2465          UIErrorString::formatErrorInfo(progress));
    24652466}
    24662467
     
    24702471          tr("Failed to uninstall the Extension Pack <b>%1</b>.")
    24712472             .arg(strPackName),
    2472           formatErrorInfo(extPackManager));
     2473          UIErrorString::formatErrorInfo(extPackManager));
    24732474}
    24742475
     
    24782479          tr("Failed to uninstall the Extension Pack <b>%1</b>.")
    24792480             .arg(strPackName),
    2480           formatErrorInfo(progress));
     2481          UIErrorString::formatErrorInfo(progress));
    24812482}
    24822483
     
    24932494    error(pParent, MessageType_Error,
    24942495          tr("Drag and drop operation from host to guest failed."),
    2495           formatErrorInfo(dndTarget));
     2496          UIErrorString::formatErrorInfo(dndTarget));
    24962497}
    24972498
     
    25002501    error(pParent, MessageType_Error,
    25012502          tr("Drag and drop operation from host to guest failed."),
    2502           formatErrorInfo(progress));
     2503          UIErrorString::formatErrorInfo(progress));
    25032504}
    25042505
     
    25072508    error(pParent, MessageType_Error,
    25082509          tr("Unable to cancel host to guest drag and drop operation."),
    2509           formatErrorInfo(dndTarget));
     2510          UIErrorString::formatErrorInfo(dndTarget));
    25102511}
    25112512
     
    25142515    error(pParent, MessageType_Error,
    25152516          tr("Drag and drop operation from guest to host failed."),
    2516           formatErrorInfo(dndSource));
     2517          UIErrorString::formatErrorInfo(dndSource));
    25172518}
    25182519
     
    25212522    error(pParent, MessageType_Error,
    25222523          tr("Drag and drop operation from guest to host failed."),
    2523           formatErrorInfo(progress));
     2524          UIErrorString::formatErrorInfo(progress));
    25242525}
    25252526#endif /* VBOX_WITH_DRAG_AND_DROP */
     
    25892590    else
    25902591        return true;
    2591 }
    2592 
    2593 /* static */
    2594 QString UIMessageCenter::formatRC(HRESULT rc)
    2595 {
    2596     QString str;
    2597 
    2598     PCRTCOMERRMSG msg = NULL;
    2599     const char *errMsg = NULL;
    2600 
    2601     /* First, try as is (only set bit 31 bit for warnings): */
    2602     if (SUCCEEDED_WARNING(rc))
    2603         msg = RTErrCOMGet(rc | 0x80000000);
    2604     else
    2605         msg = RTErrCOMGet(rc);
    2606 
    2607     if (msg != NULL)
    2608         errMsg = msg->pszDefine;
    2609 
    2610 #ifdef VBOX_WS_WIN
    2611     PCRTWINERRMSG winMsg = NULL;
    2612 
    2613     /* If not found, try again using RTErrWinGet with masked off top 16bit: */
    2614     if (msg == NULL)
    2615     {
    2616         winMsg = RTErrWinGet(rc & 0xFFFF);
    2617 
    2618         if (winMsg != NULL)
    2619             errMsg = winMsg->pszDefine;
    2620     }
    2621 #endif /* VBOX_WS_WIN */
    2622 
    2623     if (errMsg != NULL && *errMsg != '\0')
    2624         str.sprintf("%s", errMsg);
    2625 
    2626     return str;
    2627 }
    2628 
    2629 /* static */
    2630 QString UIMessageCenter::formatRCFull(HRESULT rc)
    2631 {
    2632     QString str;
    2633 
    2634     PCRTCOMERRMSG msg = NULL;
    2635     const char *errMsg = NULL;
    2636 
    2637     /* First, try as is (only set bit 31 bit for warnings): */
    2638     if (SUCCEEDED_WARNING(rc))
    2639         msg = RTErrCOMGet(rc | 0x80000000);
    2640     else
    2641         msg = RTErrCOMGet(rc);
    2642 
    2643     if (msg != NULL)
    2644         errMsg = msg->pszDefine;
    2645 
    2646 #ifdef VBOX_WS_WIN
    2647     PCRTWINERRMSG winMsg = NULL;
    2648 
    2649     /* If not found, try again using RTErrWinGet with masked off top 16bit: */
    2650     if (msg == NULL)
    2651     {
    2652         winMsg = RTErrWinGet(rc & 0xFFFF);
    2653 
    2654         if (winMsg != NULL)
    2655             errMsg = winMsg->pszDefine;
    2656     }
    2657 #endif /* VBOX_WS_WIN */
    2658 
    2659     if (errMsg != NULL && *errMsg != '\0')
    2660         str.sprintf("%s (0x%08X)", errMsg, rc);
    2661     else
    2662         str.sprintf("0x%08X", rc);
    2663 
    2664     return str;
    2665 }
    2666 
    2667 /* static */
    2668 QString UIMessageCenter::formatErrorInfo(const CProgress &progress)
    2669 {
    2670     /* Check for API errors first: */
    2671     if (!progress.isOk())
    2672         return formatErrorInfo(static_cast<COMBaseWithEI>(progress));
    2673 
    2674     /* For progress errors otherwise: */
    2675     CVirtualBoxErrorInfo errorInfo = progress.GetErrorInfo();
    2676     /* Handle valid error-info first: */
    2677     if (!errorInfo.isNull())
    2678         return formatErrorInfo(errorInfo);
    2679     /* Handle NULL error-info otherwise: */
    2680     return QString("<table bgcolor=#EEEEEE border=0 cellspacing=5 cellpadding=0 width=100%>"
    2681                    "<tr><td>%1</td><td><tt>%2</tt></td></tr></table>")
    2682                    .arg(tr("Result&nbsp;Code: ", "error info"))
    2683                    .arg(formatRCFull(progress.GetResultCode()))
    2684                    .prepend("<!--EOM-->") /* move to details */;
    2685 }
    2686 
    2687 /* static */
    2688 QString UIMessageCenter::formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC /* = S_OK */)
    2689 {
    2690     QString formatted = errorInfoToString(info, wrapperRC);
    2691     return QString("<qt>%1</qt>").arg(formatted);
    2692 }
    2693 
    2694 /* static */
    2695 QString UIMessageCenter::formatErrorInfo(const CVirtualBoxErrorInfo &info)
    2696 {
    2697     return formatErrorInfo(COMErrorInfo(info));
    2698 }
    2699 
    2700 /* static */
    2701 QString UIMessageCenter::formatErrorInfo(const COMBaseWithEI &wrapper)
    2702 {
    2703     Assert(wrapper.lastRC() != S_OK);
    2704     return formatErrorInfo(wrapper.errorInfo(), wrapper.lastRC());
    2705 }
    2706 
    2707 /* static */
    2708 QString UIMessageCenter::formatErrorInfo(const COMResult &rc)
    2709 {
    2710     Assert(rc.rc() != S_OK);
    2711     return formatErrorInfo(rc.errorInfo(), rc.rc());
    27122592}
    27132593
     
    28772757{
    28782758     /* Nothing for now... */
    2879 }
    2880 
    2881 QString UIMessageCenter::errorInfoToString(const COMErrorInfo &info,
    2882                                            HRESULT wrapperRC /* = S_OK */)
    2883 {
    2884     /* Compose complex details string with internal <!--EOM--> delimiter to
    2885      * make it possible to split string into info & details parts which will
    2886      * be used separately in QIMessageBox */
    2887     QString formatted;
    2888 
    2889     /* Check if details text is NOT empty: */
    2890     QString strDetailsInfo = info.text();
    2891     if (!strDetailsInfo.isEmpty())
    2892     {
    2893         /* Check if details text written in English (latin1) and translated: */
    2894         if (strDetailsInfo == QString::fromLatin1(strDetailsInfo.toLatin1()) &&
    2895             strDetailsInfo != tr(strDetailsInfo.toLatin1().constData()))
    2896             formatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(tr(strDetailsInfo.toLatin1().constData())));
    2897         else
    2898             formatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strDetailsInfo));
    2899     }
    2900 
    2901     formatted += "<!--EOM--><table bgcolor=#EEEEEE border=0 cellspacing=5 "
    2902                  "cellpadding=0 width=100%>";
    2903 
    2904     bool haveResultCode = false;
    2905 
    2906     if (info.isBasicAvailable())
    2907     {
    2908 #if defined (VBOX_WS_WIN)
    2909         haveResultCode = info.isFullAvailable();
    2910         bool haveComponent = true;
    2911         bool haveInterfaceID = true;
    2912 #else /* defined (VBOX_WS_WIN) */
    2913         haveResultCode = true;
    2914         bool haveComponent = info.isFullAvailable();
    2915         bool haveInterfaceID = info.isFullAvailable();
    2916 #endif
    2917 
    2918         if (haveResultCode)
    2919         {
    2920             formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
    2921                 .arg(tr("Result&nbsp;Code: ", "error info"))
    2922                 .arg(formatRCFull(info.resultCode()));
    2923         }
    2924 
    2925         if (haveComponent)
    2926             formatted += QString("<tr><td>%1</td><td>%2</td></tr>")
    2927                 .arg(tr("Component: ", "error info"), info.component());
    2928 
    2929         if (haveInterfaceID)
    2930         {
    2931             QString s = info.interfaceID().toString();
    2932             if (!info.interfaceName().isEmpty())
    2933                 s = info.interfaceName() + ' ' + s;
    2934             formatted += QString("<tr><td>%1</td><td>%2</td></tr>")
    2935                 .arg(tr("Interface: ", "error info"), s);
    2936         }
    2937 
    2938         if (!info.calleeIID().isNull() && info.calleeIID() != info.interfaceID())
    2939         {
    2940             QString s = info.calleeIID().toString();
    2941             if (!info.calleeName().isEmpty())
    2942                 s = info.calleeName() + ' ' + s;
    2943             formatted += QString("<tr><td>%1</td><td>%2</td></tr>")
    2944                 .arg(tr("Callee: ", "error info"), s);
    2945         }
    2946     }
    2947 
    2948     if (FAILED (wrapperRC) &&
    2949         (!haveResultCode || wrapperRC != info.resultCode()))
    2950     {
    2951         formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
    2952             .arg(tr("Callee&nbsp;RC: ", "error info"))
    2953             .arg(formatRCFull(wrapperRC));
    2954     }
    2955 
    2956     formatted += "</table>";
    2957 
    2958     if (info.next())
    2959         formatted = formatted + "<!--EOP-->" + errorInfoToString(*info.next());
    2960 
    2961     return formatted;
    29622759}
    29632760
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r68411 r68435  
    383383    bool confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent = 0) const;
    384384
    385     /* API: Static helpers: */
    386     static QString formatRC(HRESULT rc);
    387     static QString formatRCFull(HRESULT rc);
    388     static QString formatErrorInfo(const CProgress &progress);
    389     static QString formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC = S_OK);
    390     static QString formatErrorInfo(const CVirtualBoxErrorInfo &info);
    391     static QString formatErrorInfo(const COMBaseWithEI &wrapper);
    392     static QString formatErrorInfo(const COMResult &rc);
    393 
    394385public slots:
    395386
     
    423414    void cleanup();
    424415
    425     /* Helper: */
    426     static QString errorInfoToString(const COMErrorInfo &info, HRESULT wrapperRC = S_OK);
    427 
    428416    /* Helper: Message-box stuff: */
    429417    int showMessageBox(QWidget *pParent, MessageType type,
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp

    r68045 r68435  
    2525# include "VBoxGlobal.h"
    2626# include "UIConverter.h"
    27 # include "UIMessageCenter.h"
     27# include "UIErrorString.h"
    2828# include "UIExtraDataManager.h"
    2929# include "UIIconPool.h"
     
    411411                    /* Accessibility check (eg GetState()) itself failed: */
    412412                    m_strToolTip += m_sstrRow.arg("<hr>") + m_sstrRow.arg(VBoxGlobal::tr("Failed to check accessibility of disk image files.", "medium")) +
    413                                     m_sstrRow.arg(UIMessageCenter::formatErrorInfo(m_result) + ".");
     413                                    m_sstrRow.arg(UIErrorString::formatErrorInfo(m_result) + ".");
    414414                }
    415415                break;
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r68396 r68435  
    3333# include "UIActionPoolSelector.h"
    3434# include "UIDesktopServices.h"
     35# include "UIErrorString.h"
    3536# include "UIExtraDataManager.h"
    3637# include "UIGChooser.h"
     
    299300        {
    300301            /* The VM is inaccessible: */
    301             m_pPaneToolsMachine->setDetailsError(UIMessageCenter::formatErrorInfo(pItem->accessError()));
     302            m_pPaneToolsMachine->setDetailsError(UIErrorString::formatErrorInfo(pItem->accessError()));
    302303        }
    303304
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp

    r68394 r68435  
    3434# include "UIConverter.h"
    3535# include "UIGraphicsTextPane.h"
    36 # include "UIMessageCenter.h"
     36# include "UIErrorString.h"
    3737
    3838/* COM includes: */
     
    514514                AssertMsg(controller.isOk(),
    515515                          ("Unable to acquire controller data: %s\n",
    516                            msgCenter().formatRC(controller.lastRC()).toUtf8().constData()));
     516                           UIErrorString::formatRC(controller.lastRC()).toUtf8().constData()));
    517517                if (!controller.isOk())
    518518                    continue;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp

    r66626 r68435  
    2626# include "UIGlobalSettingsGeneral.h"
    2727# include "UIExtraDataManager.h"
    28 # include "UIMessageCenter.h"
     28# include "UIErrorString.h"
    2929# include "VBoxGlobal.h"
    3030
     
    211211        /* Show error message if necessary: */
    212212        if (!fSuccess)
    213             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_properties));
     213            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_properties));
    214214
    215215        /* Save new general data from the cache: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp

    r66761 r68435  
    2727# include "UIIconPool.h"
    2828# include "UIConverter.h"
     29# include "UIErrorString.h"
    2930# include "UIMessageCenter.h"
    3031# include "UIGlobalSettingsNetwork.h"
     
    709710        /* Show error message if necessary: */
    710711        if (!fSuccess)
    711             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comVBox));
     712            notifyOperationProgressError(UIErrorString::formatErrorInfo(comVBox));
    712713    }
    713714    /* Return result: */
     
    735736        /* Show error message if necessary: */
    736737        if (!fSuccess)
    737             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comVBox));
     738            notifyOperationProgressError(UIErrorString::formatErrorInfo(comVBox));
    738739        else
    739740        {
     
    811812            /* Show error message if necessary: */
    812813            if (!fSuccess)
    813                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comNetwork));
     814                notifyOperationProgressError(UIErrorString::formatErrorInfo(comNetwork));
    814815        }
    815816    }
     
    838839        /* Show error message if necessary: */
    839840        if (!fSuccess)
    840             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comVBox));
     841            notifyOperationProgressError(UIErrorString::formatErrorInfo(comVBox));
    841842        else
    842843        {
     
    940941            /* Show error message if necessary: */
    941942            if (!fSuccess)
    942                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comNetwork));
     943                notifyOperationProgressError(UIErrorString::formatErrorInfo(comNetwork));
    943944        }
    944945    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp

    r66626 r68435  
    2323# include "UIConverter.h"
    2424# include "UIMachineSettingsAudio.h"
    25 # include "UIMessageCenter.h"
     25# include "UIErrorString.h"
    2626
    2727/* COM includes: */
     
    273273        /* Show error message if necessary: */
    274274        if (!fSuccess)
    275             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     275            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    276276        else
    277277        {
     
    297297            /* Show error message if necessary: */
    298298            if (!fSuccess)
    299                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comAdapter));
     299                notifyOperationProgressError(UIErrorString::formatErrorInfo(comAdapter));
    300300        }
    301301    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r66626 r68435  
    2626# include "UIExtraDataManager.h"
    2727# include "UIMachineSettingsDisplay.h"
    28 # include "UIMessageCenter.h"
     28# include "UIErrorString.h"
    2929# include "VBoxGlobal.h"
    3030
     
    12751275        /* Show error message if necessary: */
    12761276        if (!fSuccess)
    1277             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1277            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    12781278
    12791279        /* Save guest-screen scale-factor: */
     
    13081308        /* Show error message if necessary: */
    13091309        if (!fSuccess)
    1310             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1310            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    13111311        else
    13121312        {
     
    13461346            /* Show error message if necessary: */
    13471347            if (!fSuccess)
    1348                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comServer));
     1348                notifyOperationProgressError(UIErrorString::formatErrorInfo(comServer));
    13491349        }
    13501350    }
     
    14851485        /* Show error message if necessary: */
    14861486        if (!fSuccess)
    1487             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1487            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    14881488    }
    14891489    /* Return result: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r66626 r68435  
    2828# include "UIConverter.h"
    2929# include "UIMachineSettingsGeneral.h"
    30 # include "UIMessageCenter.h"
     30# include "UIErrorString.h"
    3131# include "UIModalWindowManager.h"
    3232# include "UIProgressDialog.h"
     
    3737# include "CMedium.h"
    3838# include "CMediumAttachment.h"
     39# include "CProgress.h"
    3940
    4041#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    717718        /* Show error message if necessary: */
    718719        if (!fSuccess)
    719             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     720            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    720721    }
    721722    /* Return result: */
     
    764765        /* Show error message if necessary: */
    765766        if (!fSuccess)
    766             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     767            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    767768    }
    768769    /* Return result: */
     
    791792        /* Show error message if necessary: */
    792793        if (!fSuccess)
    793             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     794            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    794795    }
    795796    /* Return result: */
     
    834835            /* Show error message if necessary: */
    835836            if (!fSuccess)
    836                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     837                notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    837838
    838839            /* For each attachment: */
     
    859860                /* Show error message if necessary: */
    860861                if (!fSuccess)
    861                     notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comAttachment));
     862                    notifyOperationProgressError(UIErrorString::formatErrorInfo(comAttachment));
    862863                else
    863864                {
     
    937938                    /* Show error message if necessary: */
    938939                    if (!fSuccess)
    939                         notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comMedium));
     940                        notifyOperationProgressError(UIErrorString::formatErrorInfo(comMedium));
    940941                }
    941942            }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r66626 r68435  
    2727# include "UIIconPool.h"
    2828# include "UIMachineSettingsNetwork.h"
    29 # include "UIMessageCenter.h"
     29# include "UIErrorString.h"
    3030# include "VBoxGlobal.h"
    3131
     
    14991499        /* Show error message if necessary: */
    15001500        if (!fSuccess)
    1501             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1501            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    15021502        else
    15031503        {
     
    16011601            /* Show error message if necessary: */
    16021602            if (!fSuccess)
    1603                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comAdapter));
     1603                notifyOperationProgressError(UIErrorString::formatErrorInfo(comAdapter));
    16041604            else
    16051605            {
     
    16381638                    /* Show error message if necessary: */
    16391639                    if (!fSuccess)
    1640                         notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comEngine));
     1640                        notifyOperationProgressError(UIErrorString::formatErrorInfo(comEngine));
    16411641                }
    16421642            }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r66626 r68435  
    2828# include "UIMachineSettingsSF.h"
    2929# include "UIMachineSettingsSFDetails.h"
    30 # include "UIMessageCenter.h"
     30# include "UIErrorString.h"
    3131# include "VBoxGlobal.h"
    3232# include "VBoxUtils.h"
     
    869869                /* Show error message if necessary: */
    870870                if (!fSuccess)
    871                     notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     871                    notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    872872
    873873                break;
     
    883883                /* Show error message if necessary: */
    884884                if (!fSuccess)
    885                     notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_console));
     885                    notifyOperationProgressError(UIErrorString::formatErrorInfo(m_console));
    886886
    887887                break;
     
    915915        /* Show error message if necessary: */
    916916        if (!fSuccess)
    917             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comCurrentFolder));
     917            notifyOperationProgressError(UIErrorString::formatErrorInfo(comCurrentFolder));
    918918
    919919        /* If that's the folder we are looking for => take it: */
     
    988988                    {
    989989                        /* Show error message: */
    990                         notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     990                        notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    991991                    }
    992992                    break;
     
    10011001                    {
    10021002                        /* Show error message: */
    1003                         notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_console));
     1003                        notifyOperationProgressError(UIErrorString::formatErrorInfo(m_console));
    10041004                    }
    10051005                    break;
     
    10541054                    {
    10551055                        /* Show error message: */
    1056                         notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1056                        notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    10571057                    }
    10581058                    break;
     
    10671067                    {
    10681068                        /* Show error message: */
    1069                         notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_console));
     1069                        notifyOperationProgressError(UIErrorString::formatErrorInfo(m_console));
    10701070                    }
    10711071                    break;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r68394 r68435  
    2828# include "UIConverter.h"
    2929# include "UIMachineSettingsSerial.h"
    30 # include "UIMessageCenter.h"
     30# include "UIErrorString.h"
    3131# include "VBoxGlobal.h"
    3232
     
    630630        /* Show error message if necessary: */
    631631        if (!fSuccess)
    632             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     632            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    633633        else
    634634        {
     
    688688            /* Show error message if necessary: */
    689689            if (!fSuccess)
    690                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comPort));
     690                notifyOperationProgressError(UIErrorString::formatErrorInfo(comPort));
    691691        }
    692692    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r68339 r68435  
    3434# include "VBoxGlobal.h"
    3535# include "QIFileDialog.h"
     36# include "UIErrorString.h"
    3637# include "UIMessageCenter.h"
    3738# include "UIMachineSettingsStorage.h"
     
    40444045        /* Show error message if necessary: */
    40454046        if (!fSuccess)
    4046             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     4047            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    40474048    }
    40484049    /* Return result: */
     
    40764077        /* Show error message if necessary: */
    40774078        if (!fSuccess)
    4078             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     4079            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    40794080        else
    40804081        {
     
    41174118            /* Show error message if necessary: */
    41184119            if (!fSuccess)
    4119                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comController));
     4120                notifyOperationProgressError(UIErrorString::formatErrorInfo(comController));
    41204121
    41214122            /* For each attachment: */
     
    41544155        /* Show error message if necessary: */
    41554156        if (!fSuccess)
    4156             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     4157            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    41574158        else
    41584159        {
     
    41964197            /* Show error message if necessary: */
    41974198            if (!fSuccess)
    4198                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comController));
     4199                notifyOperationProgressError(UIErrorString::formatErrorInfo(comController));
    41994200
    42004201            // We need to separately remove attachments first because
     
    42694270        /* Show error message if necessary: */
    42704271        if (!fSuccess)
    4271             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     4272            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    42724273    }
    42734274    /* Return result: */
     
    43594360        /* Show error message if necessary: */
    43604361        if (!fSuccess)
    4361             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     4362            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    43624363    }
    43634364    /* Return result: */
     
    44474448        /* Show error message if necessary: */
    44484449        if (!fSuccess)
    4449             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     4450            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    44504451    }
    44514452    /* Return result: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r66626 r68435  
    2828# include "UIIconPool.h"
    2929# include "UIMachineSettingsSystem.h"
    30 # include "UIMessageCenter.h"
     30# include "UIErrorString.h"
    3131# include "VBoxGlobal.h"
    3232
     
    11391139        /* Show error message if necessary: */
    11401140        if (!fSuccess)
    1141             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1141            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    11421142    }
    11431143    /* Return result: */
     
    11781178        /* Show error message if necessary: */
    11791179        if (!fSuccess)
    1180             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1180            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    11811181    }
    11821182    /* Return result: */
     
    12171217        /* Show error message if necessary: */
    12181218        if (!fSuccess)
    1219             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1219            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    12201220    }
    12211221    /* Return result: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r66626 r68435  
    3131# include "UIMachineSettingsUSB.h"
    3232# include "UIMachineSettingsUSBFilterDetails.h"
    33 # include "UIMessageCenter.h"
     33# include "UIErrorString.h"
    3434# include "UIToolBar.h"
    3535# include "VBoxGlobal.h"
     
    10151015            /* Show error message if necessary: */
    10161016            if (!fSuccess)
    1017                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1017                notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    10181018            else
    10191019            {
     
    10601060        /* Show error message if necessary: */
    10611061        if (!fSuccess)
    1062             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1062            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    10631063
    10641064        /* For each controller: */
     
    10851085            /* Show error message if necessary: */
    10861086            if (!fSuccess)
    1087                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comController));
     1087                notifyOperationProgressError(UIErrorString::formatErrorInfo(comController));
    10881088            else
    10891089            {
     
    11011101                /* Show error message if necessary: */
    11021102                if (!fSuccess)
    1103                     notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1103                    notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    11041104            }
    11051105        }
     
    11381138        /* Show error message if necessary: */
    11391139        if (!fSuccess)
    1140             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1140            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    11411141        else
    11421142        {
     
    11601160                        /* Show error message if necessary: */
    11611161                        if (!fSuccess)
    1162                             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1162                            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    11631163                    }
    11641164
     
    11881188                        /* Show error message if necessary: */
    11891189                        if (!fSuccess)
    1190                             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1190                            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    11911191                    }
    11921192
     
    12091209                        /* Show error message if necessary: */
    12101210                        if (!fSuccess)
    1211                             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(m_machine));
     1211                            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
    12121212                    }
    12131213
     
    12361236        /* Show error message if necessary: */
    12371237        if (!fSuccess)
    1238             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comFiltersObject));
     1238            notifyOperationProgressError(UIErrorString::formatErrorInfo(comFiltersObject));
    12391239    }
    12401240    /* Return result: */
     
    12551255        /* Show error message if necessary: */
    12561256        if (!fSuccess)
    1257             notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comFiltersObject));
     1257            notifyOperationProgressError(UIErrorString::formatErrorInfo(comFiltersObject));
    12581258        else
    12591259        {
     
    13151315            /* Show error message if necessary: */
    13161316            if (!fSuccess)
    1317                 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comFilter));
     1317                notifyOperationProgressError(UIErrorString::formatErrorInfo(comFilter));
    13181318            else
    13191319            {
     
    13241324                /* Show error message if necessary: */
    13251325                if (!fSuccess)
    1326                     notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comFiltersObject));
     1326                    notifyOperationProgressError(UIErrorString::formatErrorInfo(comFiltersObject));
    13271327            }
    13281328        }
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp

    r62493 r68435  
    3030/* GUI includes: */
    3131# include "UIProgressDialog.h"
    32 # include "UIMessageCenter.h"
     32# include "UIErrorString.h"
    3333# include "UISpecialControls.h"
    3434# include "UIModalWindowManager.h"
     
    399399        /* Notify listeners about the operation progress error: */
    400400        if (!m_progress.isOk() || m_progress.GetResultCode() != 0)
    401             emit sigProgressError(UIMessageCenter::formatErrorInfo(m_progress));
     401            emit sigProgressError(UIErrorString::formatErrorInfo(m_progress));
    402402
    403403        /* Exit from the event-loop if there is any: */
Note: See TracChangeset for help on using the changeset viewer.

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