VirtualBox

Changeset 45270 in vbox


Ignore:
Timestamp:
Apr 1, 2013 11:33:42 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Message-center cleanup (part 10).

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

Legend:

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

    r45269 r45270  
    346346{
    347347    message(0, MessageType_Error,
    348         tr("<p>Could not find a language file for the language "
    349             "<b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>"
    350             "<p>The language will be temporarily reset to the system "
    351             "default language. Please go to the <b>Preferences</b> "
    352             "dialog which you can open from the <b>File</b> menu of the "
    353             "main VirtualBox window, and select one of the existing "
    354             "languages on the <b>Language</b> page.</p>")
    355              .arg(strLangId).arg(strNlsPath));
     348            tr("<p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>"
     349               "<p>The language will be temporarily reset to the system default language. "
     350               "Please go to the <b>Preferences</b> dialog which you can open from the <b>File</b> menu "
     351               "of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p>")
     352               .arg(strLangId).arg(strNlsPath));
    356353}
    357354
     
    359356{
    360357    message(0, MessageType_Error,
    361         tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. "
    362             "<p>The language will be temporarily reset to English (built-in). "
    363             "Please go to the <b>Preferences</b> "
    364             "dialog which you can open from the <b>File</b> menu of the "
    365             "main VirtualBox window, and select one of the existing "
    366             "languages on the <b>Language</b> page.</p>")
    367              .arg(strLangFile));
     358            tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. "
     359               "<p>The language will be temporarily reset to English (built-in). "
     360               "Please go to the <b>Preferences</b> dialog which you can open from the <b>File</b> menu "
     361               "of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p>")
     362               .arg(strLangFile));
    368363}
    369364
    370365void UIMessageCenter::cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError)
    371366{
    372     /* preserve the current error info before calling the object again */
     367    /* Preserve error-info: */
    373368    COMResult res(vbox);
    374 
    375     message(mainWindowShown(), MessageType_Critical,
    376         tr("<p>Failed to load the global GUI configuration from "
    377             "<b><nobr>%1</nobr></b>.</p>"
    378             "<p>The application will now terminate.</p>")
    379              .arg(vbox.GetSettingsFilePath()),
    380         !res.isOk() ? formatErrorInfo(res)
    381                     : QString("<!--EOM--><p>%1</p>").arg(vboxGlobal().emphasize(strError)));
     369    /* Show the message: */
     370    message(0, MessageType_Critical,
     371            tr("<p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p>"
     372               "<p>The application will now terminate.</p>").arg(vbox.GetSettingsFilePath()),
     373            !res.isOk() ? formatErrorInfo(res)
     374                        : QString("<!--EOM--><p>%1</p>").arg(vboxGlobal().emphasize(strError)));
    382375}
    383376
    384377void UIMessageCenter::cannotSaveGlobalConfig(const CVirtualBox &vbox)
    385378{
    386     /* preserve the current error info before calling the object again */
     379    /* Preserve error-info: */
    387380    COMResult res(vbox);
    388 
    389     message(mainWindowShown(), MessageType_Critical,
    390         tr("<p>Failed to save the global GUI configuration to "
    391             "<b><nobr>%1</nobr></b>.</p>"
    392             "<p>The application will now terminate.</p>")
    393              .arg(vbox.GetSettingsFilePath()),
    394         formatErrorInfo(res));
    395 }
    396 
    397 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &props)
    398 {
    399     message(mainWindowShown(), MessageType_Critical,
    400         tr("Failed to set global VirtualBox properties."),
    401         formatErrorInfo(props));
    402 }
    403 
    404 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox,
    405                                               const QString &name)
    406 {
    407     message(
    408         QApplication::desktop()->screen(QApplication::desktop()->primaryScreen()),
    409         MessageType_Error,
    410         tr("There is no virtual machine named <b>%1</b>.")
    411             .arg(name),
    412         formatErrorInfo(vbox)
    413     );
     381    /* Show the message: */
     382    message(0, MessageType_Critical,
     383            tr("<p>Failed to save the global GUI configuration to <b><nobr>%1</nobr></b>.</p>"
     384               "<p>The application will now terminate.</p>").arg(vbox.GetSettingsFilePath()),
     385            formatErrorInfo(res));
     386}
     387
     388void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, const QString &name)
     389{
     390    message(0, MessageType_Error,
     391            tr("There is no virtual machine named <b>%1</b>.").arg(name),
     392            formatErrorInfo(vbox));
    414393}
    415394
     
    417396{
    418397    Assert(session.isNull());
    419 
    420     message(
    421         mainWindowShown(),
    422         MessageType_Error,
    423         tr("Failed to create a new session."),
    424         formatErrorInfo(session)
    425     );
    426 }
    427 
    428 void UIMessageCenter::cannotOpenSession(const CVirtualBox &vbox,
    429                                         const CMachine &machine,
    430                                         const CProgress &progress)
     398    /* Show the message: */
     399    message(mainWindowShown(), MessageType_Error,
     400            tr("Failed to create a new session."),
     401            formatErrorInfo(session));
     402}
     403
     404void UIMessageCenter::cannotOpenSession(const CVirtualBox &vbox, const CMachine &machine,
     405                                        const CProgress &progress /* = CProgress() */)
    431406{
    432407    Assert(!vbox.isOk() || progress.isOk());
    433 
    434     QString name = machine.GetName();
    435     if (name.isEmpty())
    436         name = QFileInfo(machine.GetSettingsFilePath()).baseName();
    437 
    438     message(
    439         mainWindowShown(),
    440         MessageType_Error,
    441         tr("Failed to open a session for the virtual machine <b>%1</b>.")
    442             .arg(name),
    443         !vbox.isOk() ? formatErrorInfo(vbox) :
    444                        formatErrorInfo(progress.GetErrorInfo())
    445     );
     408    /* Compose machine name: */
     409    QString strName = machine.GetName();
     410    if (strName.isEmpty())
     411        strName = QFileInfo(machine.GetSettingsFilePath()).baseName();
     412    /* Show the message: */
     413    message(mainWindowShown(), MessageType_Error,
     414            tr("Failed to open a session for the virtual machine <b>%1</b>.").arg(strName),
     415            !vbox.isOk() ? formatErrorInfo(vbox) : formatErrorInfo(progress.GetErrorInfo()));
    446416}
    447417
    448418void UIMessageCenter::cannotOpenSession(const CMachine &machine)
    449419{
     420    /* Preserve error-info: */
    450421    COMResult res(machine);
    451     QString name = machine.GetName();
    452     if (name.isEmpty())
    453         name = QFileInfo(machine.GetSettingsFilePath()).baseName();
    454 
     422    /* Compose machine name: */
     423    QString strName = machine.GetName();
     424    if (strName.isEmpty())
     425        strName = QFileInfo(machine.GetSettingsFilePath()).baseName();
     426    /* Show the message: */
    455427    message(mainWindowShown(), MessageType_Error,
    456             tr("Failed to open a session for the virtual machine <b>%1</b>.").arg(name),
     428            tr("Failed to open a session for the virtual machine <b>%1</b>.").arg(strName),
    457429            formatErrorInfo(res));
    458430}
    459431
    460 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &aMedium)
    461 {
    462     message(qApp->activeWindow(), MessageType_Error,
    463         tr("Failed to determine the accessibility state of the medium "
    464             "<nobr><b>%1</b></nobr>.")
    465             .arg(aMedium.location()),
    466         formatErrorInfo(aMedium.result()));
     432void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &medium)
     433{
     434    message(mainWindowShown(), MessageType_Error,
     435            tr("Failed to determine the accessibility state of the medium <nobr><b>%1</b></nobr>.")
     436               .arg(medium.location()),
     437            formatErrorInfo(medium.result()));
    467438}
    468439
    469440void UIMessageCenter::cannotOpenURL(const QString &strUrl)
    470441{
    471     message
    472         (mainWindowShown(), MessageType_Error,
    473          tr("Failed to open <tt>%1</tt>. Make sure your desktop environment "
    474              "can properly handle URLs of this type.")
    475          .arg(strUrl));
     442    message(mainWindowShown(), MessageType_Error,
     443            tr("Failed to open <tt>%1</tt>. "
     444               "Make sure your desktop environment can properly handle URLs of this type.")
     445               .arg(strUrl));
    476446}
    477447
     
    836806             formatErrorInfo(machine)
    837807    );
     808}
     809
     810void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties)
     811{
     812    message(mainWindowShown(), MessageType_Critical,
     813            tr("Failed to set global VirtualBox properties."),
     814            formatErrorInfo(properties));
    838815}
    839816
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r45269 r45270  
    202202    void cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError);
    203203    void cannotSaveGlobalConfig(const CVirtualBox &vbox);
    204     void cannotSetSystemProperties(const CSystemProperties &props);
    205204    void cannotFindMachineByName(const CVirtualBox &vbox, const QString &name);
    206205    void cannotOpenSession(const CSession &session);
    207206    void cannotOpenSession(const CVirtualBox &vbox, const CMachine &machine, const CProgress &progress = CProgress());
    208207    void cannotOpenSession(const CMachine &machine);
    209     void cannotGetMediaAccessibility(const UIMedium &aMedium);
     208    void cannotGetMediaAccessibility(const UIMedium &medium);
    210209    void cannotOpenURL(const QString &strUrl);
    211210
     
    241240
    242241    /* API: Settings warnings: */
     242    void cannotSetSystemProperties(const CSystemProperties &properties);
    243243    void cannotAccessUSB(const COMBaseWithEI &object);
    244244    void cannotLoadMachineSettings(const CMachine &machine, bool fStrict = true, QWidget *pParent = 0);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r45193 r45270  
    475475        CSession session = vboxGlobal().openSession(pItem->id());
    476476        if (session.isNull())
    477         {
    478             msgCenter().cannotOpenSession(session);
    479477            return;
    480         }
    481478
    482479        /* Get session console: */
     
    523520        CSession session = vboxGlobal().openExistingSession(pItem->id());
    524521        if (session.isNull())
    525         {
    526             msgCenter().cannotOpenSession(session);
    527522            return;
    528         }
    529523
    530524        /* Get session console: */
     
    576570        CSession session = vboxGlobal().openExistingSession(pItem->id());
    577571        if (session.isNull())
    578         {
    579             msgCenter().cannotOpenSession(session);
    580572            return;
    581         }
    582573
    583574        /* Get session console: */
     
    607598        CSession session = vboxGlobal().openExistingSession(pItem->id());
    608599        if (session.isNull())
    609         {
    610             msgCenter().cannotOpenSession(session);
    611600            return;
    612         }
    613601
    614602        /* Get session console: */
     
    659647        CSession session = vboxGlobal().openExistingSession(pItem->id());
    660648        if (session.isNull())
    661         {
    662             msgCenter().cannotOpenSession(session);
    663649            return;
    664         }
    665650
    666651        /* Get session console: */
     
    701686        CSession session = vboxGlobal().openExistingSession(pItem->id());
    702687        if (session.isNull())
    703         {
    704             msgCenter().cannotOpenSession(session);
    705688            return;
    706         }
    707689
    708690        /* Get session console: */
     
    17951777        CSession session = vboxGlobal().openExistingSession(pItem->id());
    17961778        if (session.isNull())
    1797         {
    1798             msgCenter().cannotOpenSession(session);
    17991779            return false;
    1800         }
    18011780        CConsole console = session.GetConsole();
    18021781        if (console.isNull())
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r45233 r45270  
    521521bool UISettingsDialogGlobal::isPageAvailable(int iPageId)
    522522{
    523     /* Show the host error message for particular group if present.
    524      * We don't use the generic cannotLoadGlobalConfig()
    525      * call here because we want this message to be suppressible: */
    526523    switch (iPageId)
    527524    {
     
    539536            if (host.lastRC() == E_NOTIMPL)
    540537                return false;
    541 #else
     538#else /* ENABLE_GLOBAL_USB */
    542539            return false;
    543 #endif
     540#endif /* !ENABLE_GLOBAL_USB */
    544541            break;
    545542        }
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