VirtualBox

Changeset 45280 in vbox for trunk/src


Ignore:
Timestamp:
Apr 2, 2013 10:48:56 AM (12 years ago)
Author:
vboxsync
Message:

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

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

Legend:

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

    r45278 r45280  
    478478void UIMessageCenter::cannotDiscardSavedState(const CConsole &console)
    479479{
    480     /* preserve the current error info before calling the object again */
     480    /* Preserve error-info: */
    481481    COMResult res(console);
    482 
     482    /* Show the message: */
    483483    message(mainWindowShown(), MessageType_Error,
    484         tr("Failed to discard the saved state of the virtual machine <b>%1</b>.")
    485             .arg(console.GetMachine().GetName()),
    486         formatErrorInfo(res));
    487 }
    488 
    489 void UIMessageCenter::notifyAboutCollisionOnGroupRemovingCantBeResolved(const QString &strName, const QString &strGroupName)
    490 {
    491     message(&vboxGlobal().selectorWnd(),
    492             MessageType_Error,
     484            tr("Failed to discard the saved state of the virtual machine <b>%1</b>.").arg(console.GetMachine().GetName()),
     485            formatErrorInfo(res));
     486}
     487
     488void UIMessageCenter::cannotSetGroups(const CMachine &machine)
     489{
     490    /* Preserve error-info: */
     491    COMResult res(machine);
     492    /* Compose machine name: */
     493    QString strName = machine.GetName();
     494    if (strName.isEmpty())
     495        strName = QFileInfo(machine.GetSettingsFilePath()).baseName();
     496    /* Show the message: */
     497    message(mainWindowShown(), MessageType_Error,
     498            tr("Failed to set groups of the virtual machine <b>%1</b>.").arg(strName),
     499            formatErrorInfo(res));
     500}
     501
     502void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName)
     503{
     504    message(mainWindowShown(), MessageType_Error,
    493505            tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> "
    494506               "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>"
    495507               "<p>Please resolve this name-conflict and try again.</p>")
    496                .arg(strName, strGroupName),
    497             0, /* auto-confirm id */
    498             QIMessageBox::Ok | QIMessageBox::Default);
    499 }
    500 
    501 int UIMessageCenter::askAboutCollisionOnGroupRemoving(const QString &strName, const QString &strGroupName)
    502 {
    503     return message(&vboxGlobal().selectorWnd(),
    504                    MessageType_Question,
    505                    tr("<p>You are trying to move group <nobr><b>%1</b></nobr> "
    506                       "to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>"
    507                       "<p>Would you like to automatically rename it?</p>")
    508                       .arg(strName, strGroupName),
    509                    0, /* auto-confirm id */
    510                    QIMessageBox::Ok,
    511                    QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
    512                    0,
    513                    tr("Rename"));
     508               .arg(strName, strGroupName));
     509}
     510
     511bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName)
     512{
     513    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),
     518                           0, /* auto-confirm id */
     519                           tr("Rename"));
    514520}
    515521
     
    622628        0 /* pcszAutoConfirmId */,
    623629        tr("Discard", "saved state"));
    624 }
    625 
    626 void UIMessageCenter::cannotSetGroups(const CMachine &machine)
    627 {
    628     /* Preserve error-info: */
    629     COMResult res(machine);
    630     /* Compose machine name: */
    631     QString strName = machine.GetName();
    632     if (strName.isEmpty())
    633         strName = QFileInfo(machine.GetSettingsFilePath()).baseName();
    634     /* Show the message: */
    635     message(mainWindowShown(), MessageType_Error,
    636             tr("Failed to set groups of the virtual machine <b>%1</b>.").arg(strName),
    637             formatErrorInfo(res));
    638630}
    639631
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r45278 r45280  
    215215    void cannotDeleteMachine(const CMachine &machine, const CProgress &progress);
    216216    void cannotDiscardSavedState(const CConsole &console);
    217     void notifyAboutCollisionOnGroupRemovingCantBeResolved(const QString &strName, const QString &strGroupName);
    218     int askAboutCollisionOnGroupRemoving(const QString &strName, const QString &strGroupName);
     217    void cannotSetGroups(const CMachine &machine);
     218    void cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName);
     219    bool confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName);
    219220    int confirmMachineItemRemoval(const QStringList &names);
    220221    int confirmMachineRemoval(const QList<CMachine> &machines);
    221222    bool confirmDiscardSavedState(const QString &strNames);
    222     void cannotSetGroups(const CMachine &machine);
    223223    bool remindAboutInaccessibleMedia();
    224224    bool confirmVMReset(const QString &strNames);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r45278 r45280  
    353353    /* Make sure this machine can be opened: */
    354354    CMachine newMachine = vbox.OpenMachine(strTmpFile);
    355     if (!vbox.isOk() || newMachine.isNull())
     355    if (!vbox.isOk())
    356356    {
    357357        msgCenter().cannotOpenMachine(vbox, strTmpFile);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp

    r45279 r45280  
    759759                else if (pCollisionSibling->type() == UIGChooserItemType_Group)
    760760                {
    761                     msgCenter().notifyAboutCollisionOnGroupRemovingCantBeResolved(strItemName, pParentItem->name());
     761                    msgCenter().cannotResolveCollisionAutomatically(strItemName, pParentItem->name());
    762762                    return;
    763763                }
     
    765765            else if (pItem->type() == UIGChooserItemType_Group)
    766766            {
    767                 if (msgCenter().askAboutCollisionOnGroupRemoving(strItemName, pParentItem->name()) == QIMessageBox::Ok)
     767                if (msgCenter().confirmAutomaticCollisionResolve(strItemName, pParentItem->name()))
    768768                    toBeRenamed << pItem;
    769769                else
     
    19991999        const QStringList &oldGroupList = m_oldLists.value(strId);
    20002000        const UIStringSet &oldGroupSet = UIStringSet::fromList(oldGroupList);
    2001         /* Make sure group set was changed: */
     2001        /* Make sure group set changed: */
    20022002        if (newGroupSet == oldGroupSet)
    20032003            continue;
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