VirtualBox

Changeset 45281 in vbox


Ignore:
Timestamp:
Apr 2, 2013 11:08:27 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
84676
Message:

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

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

Legend:

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

    r45280 r45281  
    457457}
    458458
    459 void UIMessageCenter::cannotDeleteMachine(const CMachine &machine)
    460 {
    461     /* Preserve error-info: */
    462     COMResult res(machine);
    463     /* Show the message: */
    464     message(mainWindowShown(),
    465             MessageType_Error,
    466             tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
    467             !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res));
    468 }
    469 
    470 void UIMessageCenter::cannotDeleteMachine(const CMachine &machine, const CProgress &progress)
    471 {
    472     message(mainWindowShown(),
    473             MessageType_Error,
    474             tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
    475             formatErrorInfo(progress.GetErrorInfo()));
    476 }
    477 
    478 void UIMessageCenter::cannotDiscardSavedState(const CConsole &console)
    479 {
    480     /* Preserve error-info: */
    481     COMResult res(console);
    482     /* Show the message: */
     459void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName)
     460{
    483461    message(mainWindowShown(), MessageType_Error,
    484             tr("Failed to discard the saved state of the virtual machine <b>%1</b>.").arg(console.GetMachine().GetName()),
    485             formatErrorInfo(res));
     462            tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> "
     463               "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>"
     464               "<p>Please resolve this name-conflict and try again.</p>")
     465               .arg(strName, strGroupName));
     466}
     467
     468bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName)
     469{
     470    return messageOkCancel(mainWindowShown(), MessageType_Question,
     471                           tr("<p>You are trying to move group <nobr><b>%1</b></nobr> "
     472                              "to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>"
     473                              "<p>Would you like to automatically rename it?</p>")
     474                              .arg(strName, strGroupName),
     475                           0, /* auto-confirm id */
     476                           tr("Rename"));
    486477}
    487478
     
    500491}
    501492
    502 void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName)
    503 {
    504     message(mainWindowShown(), MessageType_Error,
    505             tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> "
    506                "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>"
    507                "<p>Please resolve this name-conflict and try again.</p>")
    508                .arg(strName, strGroupName));
    509 }
    510 
    511 bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName)
     493bool UIMessageCenter::confirmMachineItemRemoval(const QStringList &names)
    512494{
    513495    return messageOkCancel(mainWindowShown(), MessageType_Question,
    514                            tr("<p>You are trying to move group <nobr><b>%1</b></nobr> "
    515                               "to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>"
    516                               "<p>Would you like to automatically rename it?</p>")
    517                               .arg(strName, strGroupName),
     496                           tr("<p>You are about to remove following virtual "
     497                              "machine items from the machine list:</p>"
     498                              "<p><b>%1</b></p>"
     499                              "<p>Do you wish to proceed?</p>").arg(names.join(", ")),
    518500                           0, /* auto-confirm id */
    519                            tr("Rename"));
    520 }
    521 
    522 int UIMessageCenter::confirmMachineItemRemoval(const QStringList &names)
    523 {
    524     return message(&vboxGlobal().selectorWnd(),
    525                    MessageType_Question,
    526                    tr("<p>You are about to remove following virtual "
    527                       "machine items from the machine list:</p>"
    528                       "<p><b>%1</b></p>"
    529                       "<p>Do you wish to proceed?</p>").arg(names.join(", ")),
    530                    0, /* auto-confirm id */
    531                    QIMessageBox::Ok,
    532                    QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
    533                    0,
    534                    tr("Remove"));
     501                           tr("Remove"));
    535502}
    536503
     
    599566    /* Prepare message itself: */
    600567    return cInacessibleMachineCount == machines.size() ?
    601            message(mainWindowShown(),
    602                    MessageType_Question,
    603                    strText,
    604                    0, /* auto-confirm id */
    605                    QIMessageBox::Ok,
    606                    QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
     568           message(mainWindowShown(), MessageType_Question,
     569                   strText, 0, /* auto-confirm id */
     570                   QIMessageBox::Ok | QIMessageBox::Default,
     571                   QIMessageBox::Cancel | QIMessageBox::Escape,
    607572                   0,
    608573                   tr("Remove")) :
    609            message(mainWindowShown(),
    610                    MessageType_Question,
    611                    strText,
    612                    0, /* auto-confirm id */
     574           message(mainWindowShown(), MessageType_Question,
     575                   strText, 0, /* auto-confirm id */
    613576                   QIMessageBox::Yes,
    614                    QIMessageBox::No,
    615                    QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
     577                   QIMessageBox::No | QIMessageBox::Default,
     578                   QIMessageBox::Cancel | QIMessageBox::Escape,
    616579                   tr("Delete all files"),
    617580                   tr("Remove only"));
    618581}
    619582
     583void UIMessageCenter::cannotRemoveMachine(const CMachine &machine)
     584{
     585    /* Preserve error-info: */
     586    COMResult res(machine);
     587    /* Show the message: */
     588    message(mainWindowShown(),
     589            MessageType_Error,
     590            tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
     591            !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res));
     592}
     593
     594void UIMessageCenter::cannotRemoveMachine(const CMachine &machine, const CProgress &progress)
     595{
     596    message(mainWindowShown(),
     597            MessageType_Error,
     598            tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
     599            formatErrorInfo(progress.GetErrorInfo()));
     600}
     601
    620602bool UIMessageCenter::confirmDiscardSavedState(const QString &strNames)
    621603{
    622     return messageOkCancel(&vboxGlobal().selectorWnd(), MessageType_Question,
    623         tr("<p>Are you sure you want to discard the saved state of "
    624            "the following virtual machines?</p><p><b>%1</b></p>"
    625            "<p>This operation is equivalent to resetting or powering off "
    626            "the machine without doing a proper shutdown of the guest OS.</p>")
    627            .arg(strNames),
    628         0 /* pcszAutoConfirmId */,
    629         tr("Discard", "saved state"));
     604    return messageOkCancel(mainWindowShown(), MessageType_Question,
     605                           tr("<p>Are you sure you want to discard the saved state of "
     606                              "the following virtual machines?</p><p><b>%1</b></p>"
     607                              "<p>This operation is equivalent to resetting or powering off "
     608                              "the machine without doing a proper shutdown of the guest OS.</p>")
     609                              .arg(strNames),
     610                           0 /* pcszAutoConfirmId */,
     611                           tr("Discard", "saved state"));
     612}
     613
     614void UIMessageCenter::cannotDiscardSavedState(const CConsole &console)
     615{
     616    /* Preserve error-info: */
     617    COMResult res(console);
     618    /* Show the message: */
     619    message(mainWindowShown(), MessageType_Error,
     620            tr("Failed to discard the saved state of the virtual machine <b>%1</b>.").arg(console.GetMachine().GetName()),
     621            formatErrorInfo(res));
    630622}
    631623
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r45280 r45281  
    212212    void cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath);
    213213    void cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName);
    214     void cannotDeleteMachine(const CMachine &machine);
    215     void cannotDeleteMachine(const CMachine &machine, const CProgress &progress);
    216     void cannotDiscardSavedState(const CConsole &console);
    217     void cannotSetGroups(const CMachine &machine);
    218214    void cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName);
    219215    bool confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName);
    220     int confirmMachineItemRemoval(const QStringList &names);
     216    void cannotSetGroups(const CMachine &machine);
     217    bool confirmMachineItemRemoval(const QStringList &names);
    221218    int confirmMachineRemoval(const QList<CMachine> &machines);
     219    void cannotRemoveMachine(const CMachine &machine);
     220    void cannotRemoveMachine(const CMachine &machine, const CProgress &progress);
    222221    bool confirmDiscardSavedState(const QString &strNames);
     222    void cannotDiscardSavedState(const CConsole &console);
    223223    bool remindAboutInaccessibleMedia();
    224224    bool confirmVMReset(const QString &strNames);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp

    r45280 r45281  
    14221422void UIGChooserModel::removeItems(const QList<UIGChooserItem*> &itemsToRemove)
    14231423{
    1424     /* Show machine-items remove dialog: */
     1424    /* Confirm machine-items removal: */
    14251425    QStringList names;
    14261426    foreach (UIGChooserItem *pItem, itemsToRemove)
    14271427        names << pItem->name();
    1428     int rc = msgCenter().confirmMachineItemRemoval(names);
    1429     if (rc == QIMessageBox::Cancel)
     1428    if (!msgCenter().confirmMachineItemRemoval(names))
    14301429        return;
    14311430
     
    14731472            if (!machine.isOk())
    14741473            {
    1475                 msgCenter().cannotDeleteMachine(machine);
     1474                msgCenter().cannotRemoveMachine(machine);
    14761475                continue;
    14771476            }
     
    14801479            if (!machine.isOk())
    14811480            {
    1482                 msgCenter().cannotDeleteMachine(machine);
     1481                msgCenter().cannotRemoveMachine(machine);
    14831482                continue;
    14841483            }
     
    14871486            if (progress.GetResultCode() != 0)
    14881487            {
    1489                 msgCenter().cannotDeleteMachine(machine, progress);
     1488                msgCenter().cannotRemoveMachine(machine, progress);
    14901489                continue;
    14911490            }
     
    14971496            if (!machine.isOk())
    14981497            {
    1499                 msgCenter().cannotDeleteMachine(machine);
     1498                msgCenter().cannotRemoveMachine(machine);
    15001499                continue;
    15011500            }
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