VirtualBox

Changeset 90888 in vbox for trunk/src


Ignore:
Timestamp:
Aug 25, 2021 4:33:13 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: Runtime UI: Rework r146491 by moving save VM stuff to the place where it belongs (UISession).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r90883 r90888  
    400400    if (fSuccess)
    401401        uisession()->closeRuntimeUI();
    402 }
    403 
    404 void UIMachineLogic::saveState()
    405 {
    406     /* Do we save state? */
    407     bool fSaveState = true;
    408 
    409     /* If VM is not paused, we should pause it first: */
    410     if (!uisession()->isPaused())
    411         fSaveState = uisession()->pause();
    412 
    413     /* Saving state: */
    414     if (fSaveState)
    415     {
    416         /* Enable 'manual-override',
    417          * preventing automatic Runtime UI closing: */
    418         uisession()->setManualOverrideMode(true);
    419 
    420         /* Saving VM state: */
    421         LogRel(("GUI: Passing request to save VM state from machine-logic to UI session.\n"));
    422         UINotificationProgressMachineSaveState *pNotification = new UINotificationProgressMachineSaveState(machine());
    423         connect(pNotification, &UINotificationProgressMachineSaveState::sigMachineStateSaved,
    424                 this, &UIMachineLogic::sltHandleMachineStateSaved);
    425         gpNotificationCenter->append(pNotification);
    426     }
    427402}
    428403
     
    19091884
    19101885    LogRel(("GUI: User requested to save VM state.\n"));
    1911     saveState();
    1912 }
    1913 
    1914 void UIMachineLogic::sltHandleMachineStateSaved(bool fSuccess)
    1915 {
    1916     /* Disable 'manual-override' finally: */
    1917     uisession()->setManualOverrideMode(false);
    1918 
    1919     /* Close Runtime UI if state was saved: */
    1920     if (fSuccess)
    1921         uisession()->closeRuntimeUI();
     1886    uisession()->saveState();
    19221887}
    19231888
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r90883 r90888  
    145145    /** Detach and close Runtime UI. */
    146146    void detach();
    147     /** Save VM state, then close Runtime UI. */
    148     void saveState();
    149147    /** Call for guest shutdown to close Runtime UI. */
    150148    void shutdown();
     
    285283    void sltDetach();
    286284    void sltSaveState();
    287     /** Handles machine state saved. */
    288     void sltHandleMachineStateSaved(bool fSuccess);
    289285    void sltShutdown();
    290286    void sltPowerOff();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r90706 r90888  
    455455            /* Save VM state: */
    456456            LogRel(("GUI: Request for close-action to save VM state.\n"));
    457             machineLogic()->saveState();
     457            uisession()->saveState();
    458458            break;
    459459        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r90883 r90888  
    326326}
    327327
     328void UISession::saveState()
     329{
     330    /* Saving state? */
     331    bool fSaveState = true;
     332
     333    /* If VM is not paused, we should pause it first: */
     334    if (!isPaused())
     335        fSaveState = pause();
     336
     337    /* Save state: */
     338    if (fSaveState)
     339    {
     340        /* Enable 'manual-override',
     341         * preventing automatic Runtime UI closing: */
     342        setManualOverrideMode(true);
     343
     344        /* Now, do the magic: */
     345        LogRel(("GUI: Saving VM state..\n"));
     346        UINotificationProgressMachineSaveState *pNotification = new UINotificationProgressMachineSaveState(machine());
     347        connect(pNotification, &UINotificationProgressMachineSaveState::sigMachineStateSaved,
     348                this, &UISession::sltHandleMachineStateSaved);
     349        gpNotificationCenter->append(pNotification);
     350    }
     351}
     352
    328353bool UISession::shutdown()
    329354{
     
    802827    /* Notify current machine-logic: */
    803828    emit sigHostScreenAvailableAreaChange();
     829}
     830
     831void UISession::sltHandleMachineStateSaved(bool fSuccess)
     832{
     833    /* Disable 'manual-override' finally: */
     834    setManualOverrideMode(false);
     835
     836    /* Close Runtime UI if state was saved: */
     837    if (fSuccess)
     838        closeRuntimeUI();
    804839}
    805840
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r90883 r90888  
    7575    /* API: Runtime UI stuff: */
    7676    bool initialize();
     77    /** Powers VM up. */
    7778    bool powerUp();
     79    /** Detaches and closes Runtime UI. */
    7880    bool detach();
     81    /** Saves VM state, then closes Runtime UI. */
     82    void saveState();
     83    /** Calls for guest shutdown to close Runtime UI. */
    7984    bool shutdown();
     85    /** Powers VM down, then closes Runtime UI. */
    8086    bool powerOff(bool fIncludingDiscard, bool &fServerCrashed);
    8187
     
    394400    void sltHandleHostScreenAvailableAreaChange();
    395401
     402    /** Handles signal about machine state saved.
     403      * @param  fSuccess  Brings whether state was saved successfully. */
     404    void sltHandleMachineStateSaved(bool fSuccess);
     405
    396406private:
    397407
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