VirtualBox

Changeset 91094 in vbox


Ignore:
Timestamp:
Sep 2, 2021 1:35:13 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: Moving some of general messages from UIMessageCenter to UINotificationCenter; Refactoring rest of them.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r91079 r91094  
    612612#endif
    613613        if (enmOptType == OptType_VMRunner && m_enmType != UIType_RuntimeUI)
    614             msgCenter().warnAboutUnrelatedOptionType(arg);
     614            msgCenter().cannotHandleRuntimeOption(arg);
    615615
    616616        i++;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMachineAttributeSetter.cpp

    r90758 r91094  
    142142                if (!comMachine.isOk())
    143143                {
    144                     msgCenter().cannotAcquireMachineParameter(comMachine);
     144                    UINotificationMessage::cannotAcquireMachineParameter(comMachine);
    145145                    fErrorHappened = true;
    146146                    break;
     
    161161                if (!comMachine.isOk())
    162162                {
    163                     msgCenter().cannotAcquireMachineParameter(comMachine);
     163                    UINotificationMessage::cannotAcquireMachineParameter(comMachine);
    164164                    fErrorHappened = true;
    165165                    break;
     
    180180                if (!comMachine.isOk())
    181181                {
    182                     msgCenter().cannotAcquireMachineParameter(comMachine);
     182                    UINotificationMessage::cannotAcquireMachineParameter(comMachine);
    183183                    fErrorHappened = true;
    184184                    break;
     
    199199                if (!comMachine.isOk())
    200200                {
    201                     msgCenter().cannotAcquireMachineParameter(comMachine);
     201                    UINotificationMessage::cannotAcquireMachineParameter(comMachine);
    202202                    fErrorHappened = true;
    203203                    break;
     
    220220                if (!comMachine.isOk())
    221221                {
    222                     msgCenter().cannotAcquireMachineParameter(comMachine);
     222                    UINotificationMessage::cannotAcquireMachineParameter(comMachine);
    223223                    fErrorHappened = true;
    224224                    break;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r91076 r91094  
    3939#include "UIMessageCenter.h"
    4040#include "UIModalWindowManager.h"
     41#include "UINotificationCenter.h"
    4142#include "UIProgressDialog.h"
    4243#include "UITranslator.h"
     
    408409}
    409410
    410 void UIMessageCenter::warnAboutUnrelatedOptionType(const QString &strOption) const
     411void UIMessageCenter::cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const
     412{
     413    alert(0, MessageType_Error,
     414          tr("<p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>"
     415             "<p>The language will be temporarily reset to the system default language. "
     416             "Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the "
     417             "VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>")
     418             .arg(strLangId).arg(strNlsPath));
     419}
     420
     421void UIMessageCenter::cannotLoadLanguage(const QString &strLangFile) const
     422{
     423    alert(0, MessageType_Error,
     424          tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. "
     425             "<p>The language will be temporarily reset to English (built-in). "
     426             "Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the "
     427             "VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>")
     428             .arg(strLangFile));
     429}
     430
     431void UIMessageCenter::cannotInitUserHome(const QString &strUserHome) const
     432{
     433    error(0, MessageType_Critical,
     434          tr("<p>Failed to initialize COM because the VirtualBox global "
     435             "configuration directory <b><nobr>%1</nobr></b> is not accessible. "
     436             "Please check the permissions of this directory and of its parent directory.</p>"
     437             "<p>The application will now terminate.</p>")
     438             .arg(strUserHome),
     439          UIErrorString::formatErrorInfo(COMErrorInfo()));
     440}
     441
     442void UIMessageCenter::cannotInitCOM(HRESULT rc) const
     443{
     444    error(0, MessageType_Critical,
     445          tr("<p>Failed to initialize COM or to find the VirtualBox COM server. "
     446             "Most likely, the VirtualBox server is not running or failed to start.</p>"
     447             "<p>The application will now terminate.</p>"),
     448          UIErrorString::formatErrorInfo(COMErrorInfo(), rc));
     449}
     450
     451void UIMessageCenter::cannotHandleRuntimeOption(const QString &strOption) const
    411452{
    412453    alert(0, MessageType_Error,
     
    453494}
    454495
    455 void UIMessageCenter::cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const
    456 {
    457     alert(0, MessageType_Error,
    458           tr("<p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>"
    459              "<p>The language will be temporarily reset to the system default language. "
    460              "Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the "
    461              "VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>")
    462              .arg(strLangId).arg(strNlsPath));
    463 }
    464 
    465 void UIMessageCenter::cannotLoadLanguage(const QString &strLangFile) const
    466 {
    467     alert(0, MessageType_Error,
    468           tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. "
    469              "<p>The language will be temporarily reset to English (built-in). "
    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(strLangFile));
    473 }
    474 
    475 void UIMessageCenter::cannotInitUserHome(const QString &strUserHome) const
    476 {
    477     error(0, MessageType_Critical,
    478           tr("<p>Failed to initialize COM because the VirtualBox global "
    479              "configuration directory <b><nobr>%1</nobr></b> is not accessible. "
    480              "Please check the permissions of this directory and of its parent directory.</p>"
    481              "<p>The application will now terminate.</p>")
    482              .arg(strUserHome),
    483           UIErrorString::formatErrorInfo(COMErrorInfo()));
    484 }
    485 
    486 void UIMessageCenter::cannotInitCOM(HRESULT rc) const
    487 {
    488     error(0, MessageType_Critical,
    489           tr("<p>Failed to initialize COM or to find the VirtualBox COM server. "
    490              "Most likely, the VirtualBox server is not running or failed to start.</p>"
    491              "<p>The application will now terminate.</p>"),
    492           UIErrorString::formatErrorInfo(COMErrorInfo(), rc));
    493 }
    494 
    495 void UIMessageCenter::cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const
     496void UIMessageCenter::cannotCreateVirtualBoxClient(const CVirtualBoxClient &comClient) const
    496497{
    497498    error(0, MessageType_Critical,
    498499          tr("<p>Failed to create the VirtualBoxClient COM object.</p>"
    499500             "<p>The application will now terminate.</p>"),
    500           UIErrorString::formatErrorInfo(client));
    501 }
    502 
    503 void UIMessageCenter::cannotAcquireVirtualBox(const CVirtualBoxClient &client) const
     501          UIErrorString::formatErrorInfo(comClient));
     502}
     503
     504void UIMessageCenter::cannotAcquireVirtualBox(const CVirtualBoxClient &comClient) const
    504505{
    505506    QString err = tr("<p>Failed to acquire the VirtualBox COM object.</p>"
    506507                     "<p>The application will now terminate.</p>");
    507508#if defined(VBOX_WS_X11) || defined(VBOX_WS_MAC)
    508     if (client.lastRC() == NS_ERROR_SOCKET_FAIL)
     509    if (comClient.lastRC() == NS_ERROR_SOCKET_FAIL)
    509510        err += tr("<p>The reason for this error are most likely wrong permissions of the IPC "
    510511                  "daemon socket due to an installation problem. Please check the permissions of "
    511512                  "<font color=blue>'/tmp'</font> and <font color=blue>'/tmp/.vbox-*-ipc/'</font></p>");
    512513#endif
    513     error(0, MessageType_Critical, err, UIErrorString::formatErrorInfo(client));
    514 }
    515 
    516 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const
     514    error(0, MessageType_Critical, err, UIErrorString::formatErrorInfo(comClient));
     515}
     516
     517void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &comVBox, const QString &strName) const
    517518{
    518519    error(0, MessageType_Error,
    519520          tr("There is no virtual machine named <b>%1</b>.")
    520521             .arg(strName),
    521           UIErrorString::formatErrorInfo(vbox));
    522 }
    523 
    524 void UIMessageCenter::cannotFindMachineById(const CVirtualBox &vbox, const QUuid &uId) const
     522          UIErrorString::formatErrorInfo(comVBox));
     523}
     524
     525void UIMessageCenter::cannotFindMachineById(const CVirtualBox &comVBox, const QUuid &uId) const
    525526{
    526527    error(0, MessageType_Error,
    527528          tr("There is no virtual machine with the identifier <b>%1</b>.")
    528529             .arg(uId.toString()),
    529           UIErrorString::formatErrorInfo(vbox));
    530 }
    531 
    532 void UIMessageCenter::cannotOpenSession(const CSession &session) const
     530          UIErrorString::formatErrorInfo(comVBox));
     531}
     532
     533void UIMessageCenter::cannotSetExtraData(const CVirtualBox &comVBox, const QString &strKey, const QString &strValue)
     534{
     535    error(0, MessageType_Error,
     536          tr("Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.")
     537             .arg(strKey, strValue),
     538          UIErrorString::formatErrorInfo(comVBox));
     539}
     540
     541void UIMessageCenter::cannotOpenSession(const CSession &comSession) const
    533542{
    534543    error(0, MessageType_Error,
    535544          tr("Failed to create a new session."),
    536           UIErrorString::formatErrorInfo(session));
    537 }
    538 
    539 void UIMessageCenter::cannotOpenSession(const CMachine &machine) const
     545          UIErrorString::formatErrorInfo(comSession));
     546}
     547
     548void UIMessageCenter::cannotOpenSession(const CMachine &comMachine) const
    540549{
    541550    error(0, MessageType_Error,
    542551          tr("Failed to open a session for the virtual machine <b>%1</b>.")
    543              .arg(CMachine(machine).GetName()),
    544           UIErrorString::formatErrorInfo(machine));
    545 }
    546 
    547 void UIMessageCenter::cannotOpenSession(const CProgress &progress, const QString &strMachineName) const
     552             .arg(CMachine(comMachine).GetName()),
     553          UIErrorString::formatErrorInfo(comMachine));
     554}
     555
     556void UIMessageCenter::cannotOpenSession(const CProgress &comProgress, const QString &strMachineName) const
    548557{
    549558    error(0, MessageType_Error,
    550559          tr("Failed to open a session for the virtual machine <b>%1</b>.")
    551560             .arg(strMachineName),
    552           UIErrorString::formatErrorInfo(progress));
    553 }
    554 
    555 void UIMessageCenter::cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue)
    556 {
    557     error(0, MessageType_Error,
    558           tr("Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.")
    559              .arg(strKey, strValue),
    560           UIErrorString::formatErrorInfo(vbox));
     561          UIErrorString::formatErrorInfo(comProgress));
    561562}
    562563
     
    567568             .arg(strKey, CMachine(machine).GetName(), strValue),
    568569          UIErrorString::formatErrorInfo(machine));
    569 }
    570 
    571 void UIMessageCenter::cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const
    572 {
    573     /* Show the error: */
    574     error(pParent, MessageType_Error,
    575           tr("Failed to acquire VirtualBox parameter."), UIErrorString::formatErrorInfo(comVBox));
    576 }
    577 
    578 void UIMessageCenter::cannotAcquireSessionParameter(const CSession &comSession, QWidget *pParent /* = 0 */) const
    579 {
    580     /* Show the error: */
    581     error(pParent, MessageType_Error,
    582           tr("Failed to acquire session parameter."), UIErrorString::formatErrorInfo(comSession));
    583 }
    584 
    585 void UIMessageCenter::cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent /* = 0 */) const
    586 {
    587     /* Show the error: */
    588     error(pParent, MessageType_Error,
    589           tr("Failed to acquire machine parameter."), UIErrorString::formatErrorInfo(comMachine));
    590 }
    591 
    592 void UIMessageCenter::cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot, QWidget *pParent /* = 0 */) const
    593 {
    594     /* Show the error: */
    595     error(pParent, MessageType_Error,
    596           tr("Failed to acquire snapshot parameter."), UIErrorString::formatErrorInfo(comSnapshot));
    597 }
    598 
    599 void UIMessageCenter::cannotFindHelpFile(const QString &strFileLocation) const
    600 {
    601     alert(0, MessageType_Error, QString("<p>%1:</p>%2").arg(tr("Failed to find the following help file")).arg(strFileLocation));
    602 }
    603 
    604 void UIMessageCenter::cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const
    605 {
    606     error(0, MessageType_Error,
    607           tr("Failed to open virtual machine located in %1.")
    608              .arg(strMachinePath),
    609           UIErrorString::formatErrorInfo(vbox));
    610570}
    611571
     
    33743334}
    33753335
     3336void UIMessageCenter::sltHelpBrowserClosed()
     3337{
     3338    m_pHelpBrowserDialog = 0;
     3339}
     3340
     3341void UIMessageCenter::sltHandleHelpRequest()
     3342{
     3343#if defined(VBOX_WITH_QHELP_VIEWER)
     3344    sltHandleHelpRequestWithKeyword(uiCommon().helpKeyword(sender()));
     3345#endif /* #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))&& (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) */
     3346}
     3347
     3348void UIMessageCenter::sltHandleHelpRequestWithKeyword(const QString &strHelpKeyword)
     3349{
     3350#if defined(VBOX_WITH_QHELP_VIEWER)
     3351    /* First open or show the help browser: */
     3352    showHelpBrowser(uiCommon().helpFile());
     3353    /* Show the help page for the @p strHelpKeyword: */
     3354    if (m_pHelpBrowserDialog)
     3355        m_pHelpBrowserDialog->showHelpForKeyword(strHelpKeyword);
     3356#else
     3357    Q_UNUSED(strHelpKeyword);
     3358# endif /* #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))&& (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) */
     3359}
     3360
    33763361void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType enmType,
    33773362                                        const QString &strMessage, const QString &strDetails,
     
    35643549    if (!QFileInfo(strHelpFilePath).exists())
    35653550    {
    3566         cannotFindHelpFile(strHelpFilePath);
     3551        UINotificationMessage::cannotFindHelpFile(strHelpFilePath);
    35673552        return;
    35683553    }
     
    35813566#endif
    35823567}
    3583 
    3584 void UIMessageCenter::sltHelpBrowserClosed()
    3585 {
    3586     m_pHelpBrowserDialog = 0;
    3587 }
    3588 
    3589 void UIMessageCenter::sltHandleHelpRequest()
    3590 {
    3591 #if defined(VBOX_WITH_QHELP_VIEWER)
    3592     sltHandleHelpRequestWithKeyword(uiCommon().helpKeyword(sender()));
    3593 #endif /* #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))&& (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) */
    3594 }
    3595 
    3596 void UIMessageCenter::sltHandleHelpRequestWithKeyword(const QString &strHelpKeyword)
    3597 {
    3598 #if defined(VBOX_WITH_QHELP_VIEWER)
    3599     /* First open or show the help browser: */
    3600     showHelpBrowser(uiCommon().helpFile());
    3601     /* Show the help page for the @p strHelpKeyword: */
    3602     if (m_pHelpBrowserDialog)
    3603         m_pHelpBrowserDialog->showHelpForKeyword(strHelpKeyword);
    3604 #else
    3605     Q_UNUSED(strHelpKeyword);
    3606 # endif /* #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))&& (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) */
    3607 }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r91076 r91094  
    242242                                 int cMinDuration = 2000);
    243243
    244     /** @name General (startup) warnings.
     244    /** @name Startup warnings.
    245245      * @{ */
    246         void warnAboutUnrelatedOptionType(const QString &strOption) const;
     246        void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const;
     247        void cannotLoadLanguage(const QString &strLangFile) const;
     248
     249        void cannotInitUserHome(const QString &strUserHome) const;
     250        void cannotInitCOM(HRESULT rc) const;
     251
     252        void cannotHandleRuntimeOption(const QString &strOption) const;
     253
    247254#ifdef RT_OS_LINUX
    248255        void warnAboutWrongUSBMounted() const;
    249256#endif
     257
    250258        void cannotStartSelector() const;
    251259        void cannotStartRuntime() const;
    252 
    253         void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const;
    254         void cannotLoadLanguage(const QString &strLangFile) const;
    255260    /** @} */
    256261
    257     /** @name COM (startup) warnings.
     262    /** @name General COM warnings.
    258263      * @{ */
    259         void cannotInitUserHome(const QString &strUserHome) const;
    260         void cannotInitCOM(HRESULT rc) const;
    261         void cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const;
    262         void cannotAcquireVirtualBox(const CVirtualBoxClient &client) const;
     264        void cannotCreateVirtualBoxClient(const CVirtualBoxClient &comClient) const;
     265        void cannotAcquireVirtualBox(const CVirtualBoxClient &comClient) const;
     266
     267        void cannotFindMachineByName(const CVirtualBox &comVBox, const QString &strName) const;
     268        void cannotFindMachineById(const CVirtualBox &comVBox, const QUuid &uId) const;
     269        void cannotSetExtraData(const CVirtualBox &comVBox, const QString &strKey, const QString &strValue);
     270
     271        void cannotOpenSession(const CSession &comSession) const;
     272        void cannotOpenSession(const CMachine &comMachine) const;
     273        void cannotOpenSession(const CProgress &comProgress, const QString &strMachineName) const;
     274
     275        void cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue);
    263276    /** @} */
    264277
    265     /* API: Global warnings: */
    266     void cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const;
    267     void cannotFindMachineById(const CVirtualBox &vbox, const QUuid &uId) const;
    268     void cannotOpenSession(const CSession &session) const;
    269     void cannotOpenSession(const CMachine &machine) const;
    270     void cannotOpenSession(const CProgress &progress, const QString &strMachineName) const;
    271     void cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue);
    272     void cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue);
    273     void cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox, QWidget *pParent = 0) const;
    274     void cannotAcquireSessionParameter(const CSession &comSession, QWidget *pParent = 0) const;
    275     void cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent = 0) const;
    276     void cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot, QWidget *pParent = 0) const;
    277     void cannotFindHelpFile(const QString &strFileLocation) const;
    278 
    279278    /* API: Selector warnings: */
    280     void cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const;
    281279    void cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) const;
    282280    void cannotResolveCollisionAutomatically(const QString &strCollisionName, const QString &strGroupName) const;
     
    581579    void sltResetSuppressedMessages();
    582580    void sltShowUserManual(const QString &strLocation);
     581
     582    /// @todo move it away ..
    583583    void sltHelpBrowserClosed();
    584584    void sltHandleHelpRequest();
     
    636636                       const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
    637637                       const QString &strAutoConfirmId, const QString &strHelpKeyword) const;
     638
     639    /// @todo move it away ..
    638640    void showHelpBrowser(const QString &strHelpFilePath, QWidget *pParent = 0);
    639641
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r91079 r91094  
    24612461    if (!comVBox.isOk())
    24622462    {
    2463         msgCenter().cannotOpenMachine(comVBox, strTmpFile);
     2463        UINotificationMessage::cannotOpenMachine(comVBox, strTmpFile);
    24642464        return;
    24652465    }
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r90751 r91094  
    3030#include "UIExtraDataManager.h"
    3131#include "UIMessageCenter.h"
     32#include "UINotificationCenter.h"
    3233#include "UIProgressTaskReadCloudMachineList.h"
    3334#include "UIVirtualBoxEventHandler.h"
     
    10341035    /* Show error message if necessary: */
    10351036    if (!comVBox.isOk())
    1036         msgCenter().cannotAcquireVirtualBoxParameter(comVBox);
     1037        UINotificationMessage::cannotAcquireVirtualBoxParameter(comVBox);
    10371038    else
    10381039    {
     
    10491050            if (!comMachine.isOk())
    10501051            {
    1051                 msgCenter().cannotAcquireMachineParameter(comMachine);
     1052                UINotificationMessage::cannotAcquireMachineParameter(comMachine);
    10521053                continue;
    10531054            }
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r90939 r91094  
    2323#include "UIMediumEnumerator.h"
    2424#include "UIMessageCenter.h"
     25#include "UINotificationCenter.h"
    2526#include "UITask.h"
    2627#include "UIThreadPool.h"
     
    555556                {
    556557                    LogRel2(("GUI: UIMediumEnumerator:  Unable to acquire machine ID!\n"));
    557                     msgCenter().cannotAcquireMachineParameter(comMachine);
     558                    UINotificationMessage::cannotAcquireMachineParameter(comMachine);
    558559                }
    559560                else
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r91077 r91094  
    5656/* static */
    5757QMap<QString, QUuid> UINotificationMessage::m_messages = QMap<QString, QUuid>();
     58
     59/* static */
     60void UINotificationMessage::cannotFindHelpFile(const QString &strLocation)
     61{
     62    createMessage(
     63        QApplication::translate("UIMessageCenter", "Can't fina help file ..."),
     64        QApplication::translate("UIMessageCenter", "Failed to find the following help file:")
     65                                                   .arg(strLocation));
     66}
    5867
    5968/* static */
     
    225234
    226235/* static */
     236void UINotificationMessage::cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox)
     237{
     238    createMessage(
     239        QApplication::translate("UIMessageCenter", "VirtualBox failure ..."),
     240        QApplication::translate("UIMessageCenter", "Failed to acquire VirtualBox parameter.") +
     241        UIErrorString::formatErrorInfo(comVBox));
     242}
     243
     244/* static */
     245void UINotificationMessage::cannotAcquireSessionParameter(const CSession &comSession)
     246{
     247    createMessage(
     248        QApplication::translate("UIMessageCenter", "Session failure ..."),
     249        QApplication::translate("UIMessageCenter", "Failed to acquire session parameter.") +
     250        UIErrorString::formatErrorInfo(comSession));
     251}
     252
     253/* static */
     254void UINotificationMessage::cannotAcquireMachineParameter(const CMachine &comMachine)
     255{
     256    createMessage(
     257        QApplication::translate("UIMessageCenter", "Machine failure ..."),
     258        QApplication::translate("UIMessageCenter", "Failed to acquire machine parameter.") +
     259        UIErrorString::formatErrorInfo(comMachine));
     260}
     261
     262/* static */
     263void UINotificationMessage::cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot)
     264{
     265    createMessage(
     266        QApplication::translate("UIMessageCenter", "Snapshot failure ..."),
     267        QApplication::translate("UIMessageCenter", "Failed to acquire snapshot parameter.") +
     268        UIErrorString::formatErrorInfo(comSnapshot));
     269}
     270
     271/* static */
    227272void UINotificationMessage::cannotAttachUSBDevice(const CConsole &comConsole, const QString &strDevice)
    228273{
     
    308353        "cannotEnumerateHostUSBDevices",
    309354        strHelpKeyword);
     355}
     356
     357/* static */
     358void UINotificationMessage::cannotOpenMachine(const CVirtualBox &comVBox, const QString &strLocation)
     359{
     360    createMessage(
     361        QApplication::translate("UIMessageCenter", "Can't open machine ..."),
     362        QApplication::translate("UIMessageCenter", "Failed to open virtual machine located in %1.")
     363                                                   .arg(strLocation) +
     364        UIErrorString::formatErrorInfo(comVBox));
    310365}
    311366
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r91076 r91094  
    6161public:
    6262
     63    /** Notifies about inability to find help file at certain @a strLocation. */
     64    static void cannotFindHelpFile(const QString &strLocation);
    6365    /** Notifies about inability to open @a strUrl. */
    6466    static void cannotOpenURL(const QString &strUrl);
     
    9496    /** Reminds about GA not affected. */
    9597    static void remindAboutGuestAdditionsAreNotActive();
     98
     99    /** Notifies about inability to acquire IVirtualBox parameter.
     100      * @param  comVBox  Brings the object paramter get acquired from. */
     101    static void cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox);
     102    /** Notifies about inability to acquire ISession parameter.
     103      * @param  comSession  Brings the object paramter get acquired from. */
     104    static void cannotAcquireSessionParameter(const CSession &comSession);
     105    /** Notifies about inability to acquire IMachine parameter.
     106      * @param  comSession  Brings the object paramter get acquired from. */
     107    static void cannotAcquireMachineParameter(const CMachine &comMachine);
     108    /** Notifies about inability to acquire ISnapshot parameter.
     109      * @param  comSnapshot  Brings the object paramter get acquired from. */
     110    static void cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot);
    96111
    97112    /** Notifies about inability to attach USB device.
     
    130145      * @param  comHost  Brings the host devices enumerated for. */
    131146    static void cannotEnumerateHostUSBDevices(const CHost &comHost);
     147    /** Notifies about inability to open machine.
     148      * @param  comVBox      Brings common VBox object trying to open machine.
     149      * @param  strLocation  Brings the machine location. */
     150    static void cannotOpenMachine(const CVirtualBox &comVBox, const QString &strLocation);
    132151    /** Notifies about inability to open medium.
    133152      * @param  comVBox      Brings common VBox object trying to open medium.
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r91057 r91094  
    24022402    CMediumVector comMedia = comVBox.GetDVDImages();
    24032403    if (!comVBox.isOk())
    2404         msgCenter().cannotAcquireVirtualBoxParameter(comVBox);
     2404        UINotificationMessage::cannotAcquireVirtualBoxParameter(comVBox);
    24052405    else
    24062406    {
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp

    r91060 r91094  
    149149        /* Acquire machine name beforehand: */
    150150        const QString strMachineName = m_machine.GetName();
    151         if (!m_machine.isOk())
    152         {
    153             msgCenter().cannotAcquireMachineParameter(m_machine);
    154             return false;
    155         }
    156151
    157152        /* Open session: */
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