VirtualBox

Ignore:
Timestamp:
Mar 24, 2015 2:02:55 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Machine settings Serializer: Cleanup rework to prepare to the encryption settings integration (step 3).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r54886 r54919  
    208208void UISettingsDialogGlobal::loadData()
    209209{
    210     /* Call for base-class: */
     210    /* Call to base-class: */
    211211    UISettingsDialog::loadData();
    212212
     213    /* Get properties and settings: */
     214    CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
     215    VBoxGlobalSettings settings = vboxGlobal().settings();
    213216    /* Prepare global data: */
    214217    qRegisterMetaType<UISettingsDataGlobal>();
    215     UISettingsDataGlobal data(vboxGlobal().virtualBox().GetSystemProperties(), vboxGlobal().settings());
    216     /* Create global settings loader,
    217      * it will load global settings & delete itself in the appropriate time: */
     218    UISettingsDataGlobal data(properties, settings);
     219    /* Create global settings loader: */
    218220    UISettingsSerializer *pGlobalSettingsLoader = new UISettingsSerializer(this,
    219221                                                                           UISettingsSerializer::Load,
     
    227229void UISettingsDialogGlobal::saveData()
    228230{
    229     /* Call for base-class: */
     231    /* Call to base-class: */
    230232    UISettingsDialog::saveData();
    231233
     
    236238    qRegisterMetaType<UISettingsDataGlobal>();
    237239    UISettingsDataGlobal data(properties, settings);
    238     /* Create global settings saver,
    239      * it will save global settings & delete itself in the appropriate time: */
     240    /* Create global settings saver: */
    240241    UISettingsSerializer *pGlobalSettingsSaver = new UISettingsSerializer(this,
    241242                                                                          UISettingsSerializer::Save,
     
    511512        return;
    512513
    513     /* Call for base-class: */
     514    /* Call to base-class: */
    514515    UISettingsDialog::loadData();
    515516
     
    518519
    519520    /* Prepare session: */
    520     m_session = configurationAccessLevel() == ConfigurationAccessLevel_Null ? CSession() : vboxGlobal().openExistingSession(m_strMachineId);
     521    m_session = configurationAccessLevel() == ConfigurationAccessLevel_Null ? CSession() :
     522                configurationAccessLevel() == ConfigurationAccessLevel_Full ? vboxGlobal().openSession(m_strMachineId) :
     523                                                                              vboxGlobal().openExistingSession(m_strMachineId);
    521524    /* Check that session was created: */
    522525    if (m_session.isNull())
    523526        return;
    524527
    525     /* Get machine from session: */
     528    /* Get machine and console: */
    526529    m_machine = m_session.GetMachine();
    527     /* Get console from session: */
    528530    m_console = configurationAccessLevel() == ConfigurationAccessLevel_Full ? CConsole() : m_session.GetConsole();
    529 
    530531    /* Prepare machine data: */
    531532    qRegisterMetaType<UISettingsDataMachine>();
    532533    UISettingsDataMachine data(m_machine, m_console);
    533     /* Create machine settings loader,
    534      * it will load machine settings & delete itself in the appropriate time: */
     534    /* Create machine settings loader: */
    535535    UISettingsSerializer *pMachineSettingsLoader = new UISettingsSerializer(this,
    536536                                                                            UISettingsSerializer::Load,
     
    551551        return;
    552552
    553     /* Call for base-class: */
     553    /* Call to base-class: */
    554554    UISettingsDialog::saveData();
    555555
     
    558558
    559559    /* Prepare session: */
    560     if (configurationAccessLevel() == ConfigurationAccessLevel_Null)
    561         m_session = CSession();
    562     else if (configurationAccessLevel() != ConfigurationAccessLevel_Full)
    563         m_session = vboxGlobal().openExistingSession(m_strMachineId);
    564     else
    565         m_session = vboxGlobal().openSession(m_strMachineId);
     560    m_session = configurationAccessLevel() == ConfigurationAccessLevel_Null ? CSession() :
     561                configurationAccessLevel() == ConfigurationAccessLevel_Full ? vboxGlobal().openSession(m_strMachineId) :
     562                                                                              vboxGlobal().openExistingSession(m_strMachineId);
    566563    /* Check that session was created: */
    567564    if (m_session.isNull())
    568565        return;
    569566
    570     /* Get machine from session: */
     567    /* Get machine and console: */
    571568    m_machine = m_session.GetMachine();
    572     /* Get console from session: */
    573569    m_console = configurationAccessLevel() == ConfigurationAccessLevel_Full ? CConsole() : m_session.GetConsole();
    574 
    575570    /* Prepare machine data: */
    576571    qRegisterMetaType<UISettingsDataMachine>();
    577572    UISettingsDataMachine data(m_machine, m_console);
    578     /* Create machine settings saver,
    579      * it will save machine settings & delete itself in the appropriate time: */
     573    /* Create machine settings saver: */
    580574    UISettingsSerializer *pMachineSettingsSaver = new UISettingsSerializer(this,
    581575                                                                           UISettingsSerializer::Save,
     
    587581    /* Get updated machine: */
    588582    m_machine = pMachineSettingsSaver->data().value<UISettingsDataMachine>().m_machine;
    589     /* If machine is ok => perform final operations: */
     583    /* If machine is OK => perform final operations: */
    590584    if (m_machine.isOk())
    591585    {
     
    622616    }
    623617
    624     /* If machine is NOT ok => show the error message: */
     618    /* If machine is NOT OK => show the error message: */
    625619    if (!m_machine.isOk())
    626620        msgCenter().cannotSaveMachineSettings(m_machine, this);
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