VirtualBox

Changeset 45282 in vbox for trunk/src


Ignore:
Timestamp:
Apr 2, 2013 11:29:53 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Message-center cleanup (part 16): Make sure VM selector actions confirmation dialogs have valid parents.

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

Legend:

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

    r45281 r45282  
    588588    message(mainWindowShown(),
    589589            MessageType_Error,
    590             tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
     590            tr("Failed to remove the virtual machine <b>%1</b>.")
     591               .arg(machine.GetName()),
    591592            !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res));
    592593}
     
    596597    message(mainWindowShown(),
    597598            MessageType_Error,
    598             tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
     599            tr("Failed to remove the virtual machine <b>%1</b>.")
     600               .arg(machine.GetName()),
    599601            formatErrorInfo(progress.GetErrorInfo()));
     602}
     603
     604bool UIMessageCenter::remindAboutInaccessibleMedia()
     605{
     606    return messageOkCancel(mainWindowShown(), MessageType_Warning,
     607                           tr("<p>One or more virtual hard disks, CD/DVD or "
     608                              "floppy media are not currently accessible. As a result, you will "
     609                              "not be able to operate virtual machines that use these media until "
     610                              "they become accessible later.</p>"
     611                              "<p>Press <b>Check</b> to open the Virtual Media Manager window and "
     612                              "see what media are inaccessible, or press <b>Ignore</b> to "
     613                              "ignore this message.</p>"),
     614                           "remindAboutInaccessibleMedia",
     615                           tr("Check", "inaccessible media message box"));
    600616}
    601617
     
    612628}
    613629
     630bool UIMessageCenter::confirmVMReset(const QString &strNames)
     631{
     632    return messageOkCancel(mainWindowShown(), MessageType_Question,
     633                           tr("<p>Do you really want to reset the following virtual machines?</p>"
     634                              "<p><b>%1</b></p><p>This will cause any unsaved data "
     635                              "in applications running inside it to be lost.</p>")
     636                              .arg(strNames),
     637                           "confirmVMReset" /* pcszAutoConfirmId */,
     638                           tr("Reset", "machine"));
     639}
     640
     641bool UIMessageCenter::confirmVMACPIShutdown(const QString &strNames)
     642{
     643    return messageOkCancel(mainWindowShown(), MessageType_Question,
     644                           tr("<p>Do you really want to send an ACPI shutdown signal "
     645                              "to the following virtual machines?</p><p><b>%1</b></p>")
     646                              .arg(strNames),
     647                           "confirmVMACPIShutdown" /* pcszAutoConfirmId */,
     648                           tr("ACPI Shutdown", "machine"));
     649}
     650
     651bool UIMessageCenter::confirmVMPowerOff(const QString &strNames)
     652{
     653    return messageOkCancel(mainWindowShown(), MessageType_Question,
     654                           tr("<p>Do you really want to power off the following virtual machines?</p>"
     655                              "<p><b>%1</b></p><p>This will cause any unsaved data in applications "
     656                              "running inside it to be lost.</p>")
     657                              .arg(strNames),
     658                           "confirmVMPowerOff" /* pcszAutoConfirmId */,
     659                           tr("Power Off", "machine"));
     660}
     661
    614662void UIMessageCenter::cannotDiscardSavedState(const CConsole &console)
    615663{
     
    618666    /* Show the message: */
    619667    message(mainWindowShown(), MessageType_Error,
    620             tr("Failed to discard the saved state of the virtual machine <b>%1</b>.").arg(console.GetMachine().GetName()),
     668            tr("Failed to discard the saved state of the virtual machine <b>%1</b>.")
     669               .arg(console.GetMachine().GetName()),
    621670            formatErrorInfo(res));
    622671}
    623672
    624 bool UIMessageCenter::remindAboutInaccessibleMedia()
    625 {
    626     int rc = message(&vboxGlobal().selectorWnd(), MessageType_Warning,
    627         tr("<p>One or more virtual hard disks, CD/DVD or "
    628            "floppy media are not currently accessible. As a result, you will "
    629            "not be able to operate virtual machines that use these media until "
    630            "they become accessible later.</p>"
    631            "<p>Press <b>Check</b> to open the Virtual Media Manager window and "
    632            "see what media are inaccessible, or press <b>Ignore</b> to "
    633            "ignore this message.</p>"),
    634         "remindAboutInaccessibleMedia",
    635         QIMessageBox::Ok | QIMessageBox::Default,
    636         QIMessageBox::Ignore | QIMessageBox::Escape,
    637         0,
    638         tr("Check", "inaccessible media message box"));
    639 
    640     return rc == QIMessageBox::Ok; /* implies !AutoConfirmed */
    641 }
    642 
    643 bool UIMessageCenter::confirmVMReset(const QString &strNames)
    644 {
    645     return messageOkCancel(mainMachineWindowShown(), MessageType_Question,
    646         tr("<p>Do you really want to reset the following virtual machines?</p>"
    647            "<p><b>%1</b></p><p>This will cause any unsaved data "
    648            "in applications running inside it to be lost.</p>")
    649            .arg(strNames),
    650         "confirmVMReset" /* pcszAutoConfirmId */,
    651         tr("Reset", "machine"));
    652 }
    653 
    654 bool UIMessageCenter::confirmVMACPIShutdown(const QString &strNames)
    655 {
    656     return messageOkCancel(mainMachineWindowShown(), MessageType_Question,
    657         tr("<p>Do you really want to send an ACPI shutdown signal "
    658            "to the following virtual machines?</p><p><b>%1</b></p>")
    659            .arg(strNames),
    660         "confirmVMACPIShutdown" /* pcszAutoConfirmId */,
    661         tr("ACPI Shutdown", "machine"));
    662 }
    663 
    664 bool UIMessageCenter::confirmVMPowerOff(const QString &strNames)
    665 {
    666     return messageOkCancel(mainMachineWindowShown(), MessageType_Question,
    667         tr("<p>Do you really want to power off the following virtual machines?</p>"
    668            "<p><b>%1</b></p><p>This will cause any unsaved data in applications "
    669            "running inside it to be lost.</p>")
    670            .arg(strNames),
    671         "confirmVMPowerOff" /* pcszAutoConfirmId */,
    672         tr("Power Off", "machine"));
     673void UIMessageCenter::cannotStopMachine(const CConsole &console)
     674{
     675    /* Preserve error-info: */
     676    COMResult res(console);
     677    /* Show the message: */
     678    message(mainWindowShown(), MessageType_Error,
     679            tr("Failed to stop the virtual machine <b>%1</b>.")
     680               .arg(console.GetMachine().GetName()),
     681            formatErrorInfo(res));
    673682}
    674683
     
    16711680        formatErrorInfo(progress.GetErrorInfo())
    16721681    );
    1673 }
    1674 
    1675 void UIMessageCenter::cannotStopMachine(const CConsole &console)
    1676 {
    1677     /* preserve the current error info before calling the object again */
    1678     COMResult res(console);
    1679 
    1680     message(mainWindowShown(), MessageType_Error,
    1681         tr("Failed to stop the virtual machine <b>%1</b>.")
    1682             .arg(console.GetMachine().GetName()),
    1683         formatErrorInfo(res));
    16841682}
    16851683
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r45281 r45282  
    219219    void cannotRemoveMachine(const CMachine &machine);
    220220    void cannotRemoveMachine(const CMachine &machine, const CProgress &progress);
     221    bool remindAboutInaccessibleMedia();
    221222    bool confirmDiscardSavedState(const QString &strNames);
    222     void cannotDiscardSavedState(const CConsole &console);
    223     bool remindAboutInaccessibleMedia();
    224223    bool confirmVMReset(const QString &strNames);
    225224    bool confirmVMACPIShutdown(const QString &strNames);
    226225    bool confirmVMPowerOff(const QString &strNames);
     226    void cannotDiscardSavedState(const CConsole &console);
     227    void cannotStopMachine(const CConsole &console);
    227228
    228229    /* API: Snapshot warnings: */
     
    309310    void cannotTakeSnapshot(const CConsole &console);
    310311    void cannotTakeSnapshot(const CProgress &progress);
    311     void cannotStopMachine(const CConsole &console);
    312312    void cannotStopMachine(const CProgress &progress);
    313313    void cannotSendACPIToMachine();
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r45280 r45282  
    692692        /* Power Off: */
    693693        console.PowerDown();
     694        if (!console.isOk())
     695            msgCenter().cannotStopMachine(console);
    694696
    695697        /* Unlock machine finally: */
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