VirtualBox

Changeset 98653 in vbox


Ignore:
Timestamp:
Feb 20, 2023 1:36:19 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155953
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking CConsole wrapper usage step-by-step; VM reset stuff this time.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r98621 r98653  
    10531053        QApplication::translate("UIMessageCenter", "Can't shutdown machine ..."),
    10541054        QApplication::translate("UIMessageCenter", "Failed to send the ACPI Power Button press event to the virtual machine "
     1055                                                   "<b>%1</b>.").arg(CConsole(comConsole).GetMachine().GetName()) +
     1056        UIErrorString::formatErrorInfo(comConsole));
     1057}
     1058
     1059/* static */
     1060void UINotificationMessage::cannotResetMachine(const CConsole &comConsole)
     1061{
     1062    createMessage(
     1063        QApplication::translate("UIMessageCenter", "Can't reset machine ..."),
     1064        QApplication::translate("UIMessageCenter", "Failed to reset the virtual machine "
    10551065                                                   "<b>%1</b>.").arg(CConsole(comConsole).GetMachine().GetName()) +
    10561066        UIErrorString::formatErrorInfo(comConsole));
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r98621 r98653  
    425425          * @param  comConsole  Brings console trying to shutdown machine. */
    426426        static void cannotACPIShutdownMachine(const CConsole &comConsole);
     427        /** Notifies about inability to reset machine.
     428          * @param  comConsole  Brings console trying to reset machine. */
     429        static void cannotResetMachine(const CConsole &comConsole);
    427430    /** @} */
    428431
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98621 r98653  
    324324{
    325325    return uisession()->isGuestScreenUnDrawable();
     326}
     327
     328bool UIMachine::reset()
     329{
     330    return uisession()->reset();
    326331}
    327332
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98621 r98653  
    233233        bool isGuestScreenUnDrawable() const;
    234234
     235        /** Resets VM. */
     236        bool reset();
    235237        /** Performes VM pausing. */
    236238        bool pause();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r98647 r98653  
    32023202void UIMachineLogic::reset(bool fShowConfirmation)
    32033203{
    3204     if (fShowConfirmation)
    3205     {
    3206         /* Confirm/Reset current console: */
    3207         if (msgCenter().confirmResetMachine(machineName()))
    3208             console().Reset();
    3209     }
    3210     else
    3211         console().Reset();
    3212 
    3213     /* TODO_NEW_CORE: On reset the additional screens didn't get a display
    3214        update. Emulate this for now until it get fixed. */
    3215     ulong uMonitorCount = machine().GetGraphicsAdapter().GetMonitorCount();
    3216     for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId)
    3217         machineWindows().at(uScreenId)->update();
    3218 }
     3204    if (   !fShowConfirmation
     3205        || msgCenter().confirmResetMachine(machineName()))
     3206    {
     3207        const bool fSuccess = uimachine()->reset();
     3208        if (fSuccess)
     3209        {
     3210            // WORKAROUND:
     3211            // On reset the additional screens didn't get a display
     3212            // update. Emulate this for now until it get fixed. */
     3213            const ulong uMonitorCount = machine().GetGraphicsAdapter().GetMonitorCount();
     3214            for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId)
     3215                machineWindows().at(uScreenId)->update();
     3216        }
     3217    }
     3218}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98621 r98653  
    257257{
    258258    return mainMachineWindow() ? mainMachineWindow()->winId() : 0;
     259}
     260
     261bool UISession::reset()
     262{
     263    CConsole comConsole = console();
     264    comConsole.Reset();
     265    const bool fSuccess = comConsole.isOk();
     266    if (!fSuccess)
     267        UINotificationMessage::cannotResetMachine(comConsole);
     268    return fSuccess;
    259269}
    260270
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98621 r98653  
    230230                                                      || machineState() == KMachineState_Saving; }
    231231
     232        /** Resets VM. */
     233        bool reset();
    232234        /** Performes VM pausing. */
    233235        bool pause() { return setPause(true); }
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