VirtualBox

Changeset 98724 in vbox


Ignore:
Timestamp:
Feb 24, 2023 2:10:32 PM (21 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking CMachine wrapper usage step-by-step; Data related stuff, settings save procedure.

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

Legend:

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

    r98722 r98724  
    354354{
    355355    return uisession()->setPause(fPause);
     356}
     357
     358bool UIMachine::saveSettings()
     359{
     360    return uisession()->saveSettings();
    356361}
    357362
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98722 r98724  
    246246        /** Performes VM pausing/resuming depending on @a fPause state. */
    247247        bool setPause(bool fPause);
     248    /** @} */
     249
     250    /** @name Machine-data stuff.
     251     ** @{ */
     252        /** Saves machine data. */
     253        bool saveSettings();
    248254    /** @} */
    249255
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r98722 r98724  
    19801980    }
    19811981
    1982     /* Save machine-settings: */
    1983     machine().SaveSettings();
    1984     if (!machine().isOk())
    1985     {
    1986         /* Make sure action is updated: */
    1987         uimachine()->updateStateRecordingAction();
    1988         /* Notify about the error: */
    1989         return UINotificationMessage::cannotSaveMachineSettings(machine());
    1990     }
     1982    /* Save machine-settings, make sure action is updated in case of failure: */
     1983    if (!uimachine()->saveSettings())
     1984        return uimachine()->updateStateRecordingAction();
    19911985}
    19921986
     
    20162010    }
    20172011
    2018     /* Save machine-settings: */
    2019     machine().SaveSettings();
    2020     if (!machine().isOk())
    2021     {
    2022         /* Make sure action is updated: */
    2023         uimachine()->updateStateVRDEServerAction();
    2024         /* Notify about the error: */
    2025         return UINotificationMessage::cannotSaveMachineSettings(machine());
    2026     }
     2012    /* Save machine-settings, make sure action is updated in case of failure: */
     2013    if (!uimachine()->saveSettings())
     2014        return uimachine()->updateStateVRDEServerAction();
    20272015}
    20282016
     
    22172205    }
    22182206
    2219     /* Save machine-settings: */
    2220     machine().SaveSettings();
    2221     if (!machine().isOk())
    2222     {
    2223         /* Make sure action is updated: */
    2224         uimachine()->updateStateAudioActions();
    2225         /* Notify about the error: */
    2226         return UINotificationMessage::cannotSaveMachineSettings(machine());
    2227     }
     2207    /* Save machine-settings, make sure action is updated in case of failure: */
     2208    if (!uimachine()->saveSettings())
     2209        return uimachine()->updateStateAudioActions();
    22282210}
    22292211
     
    22542236    }
    22552237
    2256     /* Save machine-settings: */
    2257     machine().SaveSettings();
    2258     if (!machine().isOk())
    2259     {
    2260         /* Make sure action is updated: */
    2261         uimachine()->updateStateAudioActions();
    2262         /* Notify about the error: */
    2263         return UINotificationMessage::cannotSaveMachineSettings(machine());
    2264     }
     2238    /* Save machine-settings, make sure action is updated in case of failure: */
     2239    if (!uimachine()->saveSettings())
     2240        return uimachine()->updateStateAudioActions();
    22652241}
    22662242
     
    23502326
    23512327    /* Save machine-settings: */
    2352     machine().SaveSettings();
    2353     if (!machine().isOk())
    2354         return UINotificationMessage::cannotSaveMachineSettings(machine());
     2328    uimachine()->saveSettings();
    23552329}
    23562330
     
    31873161        msgCenter().cannotRemountMedium(comMachine, guiMedium, true /* mount? */, false /* retry? */, pParent);
    31883162    else
    3189     {
    3190         /* Save machine settings: */
    3191         comMachine.SaveSettings();
    3192         fSuccess = comMachine.isOk();
    3193 
    3194         /* Show error message if necessary: */
    3195         if (!fSuccess)
    3196             UINotificationMessage::cannotSaveMachineSettings(machine());
    3197     }
     3163        fSuccess = uimachine()->saveSettings();
    31983164    return fSuccess;
    31993165}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98722 r98724  
    296296            UINotificationMessage::cannotResumeMachine(comConsole);
    297297    }
     298    return fSuccess;
     299}
     300
     301bool UISession::saveSettings()
     302{
     303    CMachine comMachine = machine();
     304    comMachine.SaveSettings();
     305    const bool fSuccess = comMachine.isOk();
     306    if (!fSuccess)
     307        UINotificationMessage::cannotSaveMachineSettings(comMachine);
    298308    return fSuccess;
    299309}
     
    18301840
    18311841    /* Save machine settings: */
    1832     machine().SaveSettings();
    1833 
    1834     /* Show error message if necessary: */
    1835     if (!machine().isOk())
    1836     {
    1837         UINotificationMessage::cannotSaveMachineSettings(machine());
    1838         return false;
    1839     }
     1842    if (!saveSettings())
     1843        return false;
    18401844
    18411845    /* True by default: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98722 r98724  
    243243        /** Performes VM pausing/resuming depending on @a fPause state. */
    244244        bool setPause(bool fPause);
     245    /** @} */
     246
     247    /** @name Machine-data stuff.
     248     ** @{ */
     249        /** Saves machine data. */
     250        bool saveSettings();
    245251    /** @} */
    246252
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