VirtualBox

Changeset 37138 in vbox


Ignore:
Timestamp:
May 18, 2011 2:53:25 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: Settings dialog: Separate loading/saving handlers; Disconnecting reloading handlers for the time loading procedure is in progress.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
4 edited

Legend:

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

    r37109 r37138  
    5353    , m_fPolished(false)
    5454    /* Loading/saving stuff: */
    55     , m_fProcessed(false)
     55    , m_fLoaded(false)
     56    , m_fSaved(false)
    5657    /* Status bar stuff: */
    5758    , m_pStatusBar(new QStackedWidget(this))
     
    217218}
    218219
    219 void UISettingsDialog::sltMarkProcessed()
    220 {
    221     m_fProcessed = true;
     220void UISettingsDialog::sltMarkLoaded()
     221{
     222    m_fLoaded = true;
     223}
     224
     225void UISettingsDialog::sltMarkSaved()
     226{
     227    m_fSaved = true;
    222228}
    223229
     
    238244            m_pStatusBar->setCurrentIndex(0);
    239245    }
     246}
     247
     248void UISettingsDialog::loadData()
     249{
     250    m_fLoaded = false;
     251}
     252
     253void UISettingsDialog::saveData()
     254{
     255    m_fSaved = false;
    240256}
    241257
     
    488504void UISettingsDialog::reject()
    489505{
    490     if (m_fProcessed)
     506    if (m_fLoaded)
    491507        QIMainDialog::reject();
    492508}
     
    591607void UISettingsDialog::closeEvent(QCloseEvent *pEvent)
    592608{
    593     if (m_fProcessed)
     609    if (m_fLoaded)
    594610        QIMainDialog::closeEvent(pEvent);
    595611    else
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r37109 r37138  
    6060    virtual void sltCategoryChanged(int cId);
    6161
    62     /* Mark dialog as processed: */
    63     virtual void sltMarkProcessed();
     62    /* Mark dialog as loaded: */
     63    virtual void sltMarkLoaded();
     64    /* Mark dialog as saved: */
     65    virtual void sltMarkSaved();
    6466
    6567    /* Handlers for process bar: */
     
    7072
    7173    /* Save/load API: */
    72     virtual void loadData() = 0;
    73     virtual void saveData() = 0;
     74    virtual void loadData();
     75    virtual void saveData();
    7476
    7577    /* UI translator: */
     
    126128
    127129    /* Loading/saving stuff: */
    128     bool m_fProcessed;
     130    bool m_fLoaded;
     131    bool m_fSaved;
    129132
    130133    /* Status bar widget: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r37126 r37138  
    405405void UISettingsDialogGlobal::loadData()
    406406{
     407    /* Call for base-class: */
     408    UISettingsDialog::loadData();
     409
    407410    /* Prepare global data: */
    408411    qRegisterMetaType<UISettingsDataGlobal>();
     
    411414     * it will load global settings & delete itself in the appropriate time: */
    412415    UISettingsSerializer *pGlobalSettingsLoader = new UISettingsSerializer(this, QVariant::fromValue(data), UISettingsSerializeDirection_Load);
    413     connect(pGlobalSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkProcessed()));
     416    connect(pGlobalSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkLoaded()));
    414417    /* Set pages to be loaded: */
    415418    pGlobalSettingsLoader->setPageList(m_pSelector->settingPages());
     
    422425void UISettingsDialogGlobal::saveData()
    423426{
     427    /* Call for base-class: */
     428    UISettingsDialog::saveData();
     429
    424430    /* Get properties and settings: */
    425431    CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
     
    447453    else if (!(newSettings == settings))
    448454        vboxGlobal().setSettings(newSettings);
     455
     456    /* Mark page processed: */
     457    sltMarkSaved();
    449458}
    450459
     
    700709    else
    701710        m_pSelector->selectById(0);
    702 
    703     /* Make sure settings dialog will be updated on machine state changes: */
    704     connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
    705             this, SLOT(sltMachineStateChanged(QString, KMachineState)));
    706     connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)),
    707             this, SLOT(sltMachineDataChanged(QString)));
    708711}
    709712
     
    713716    if (!m_session.isNull())
    714717        return;
     718
     719    /* Call for base-class: */
     720    UISettingsDialog::loadData();
     721
     722    /* Disconnect global VBox events from this dialog: */
     723    gVBoxEvents->disconnect(this);
    715724
    716725    /* Prepare session: */
     
    731740     * it will load machine settings & delete itself in the appropriate time: */
    732741    UISettingsSerializer *pMachineSettingsLoader = new UISettingsSerializer(this, QVariant::fromValue(data), UISettingsSerializeDirection_Load);
    733     connect(pMachineSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkProcessed()));
     742    connect(pMachineSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkLoaded()));
    734743    connect(pMachineSettingsLoader, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltSetFirstRunFlag()));
    735744    /* Set pages to be loaded: */
     
    748757    if (!m_session.isNull())
    749758        return;
     759
     760    /* Call for base-class: */
     761    UISettingsDialog::saveData();
    750762
    751763    /* Prepare session: */
     
    821833
    822834    /* Mark page processed: */
    823     sltMarkProcessed();
     835    sltMarkSaved();
    824836}
    825837
     
    10141026}
    10151027
    1016 void UISettingsDialogMachine::sltMarkProcessed()
     1028void UISettingsDialogMachine::sltMarkLoaded()
    10171029{
    10181030    /* Call for base-class: */
    1019     UISettingsDialog::sltMarkProcessed();
     1031    UISettingsDialog::sltMarkLoaded();
     1032
     1033    /* Unlock the session if exists: */
     1034    if (!m_session.isNull())
     1035    {
     1036        m_session.UnlockMachine();
     1037        m_session = CSession();
     1038        m_machine = CMachine();
     1039        m_console = CConsole();
     1040    }
     1041
     1042    /* Make sure settings dialog will be updated on machine state/data changes: */
     1043    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
     1044            this, SLOT(sltMachineStateChanged(QString, KMachineState)));
     1045    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)),
     1046            this, SLOT(sltMachineDataChanged(QString)));
     1047}
     1048
     1049void UISettingsDialogMachine::sltMarkSaved()
     1050{
     1051    /* Call for base-class: */
     1052    UISettingsDialog::sltMarkSaved();
    10201053
    10211054    /* Unlock the session if exists: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h

    r37109 r37138  
    9898private slots:
    9999
    100     void sltMarkProcessed();
     100    void sltMarkLoaded();
     101    void sltMarkSaved();
    101102    void sltMachineStateChanged(QString strMachineId, KMachineState machineState);
    102103    void sltMachineDataChanged(QString strMachineId);
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