VirtualBox

Changeset 100925 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 21, 2023 3:09:13 PM (16 months ago)
Author:
vboxsync
Message:

FE/Qt: UISettingsDialog: Cleanup for polishing and serialization stuff.

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

Legend:

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

    r100924 r100925  
    7171    , m_fPolished(false)
    7272    , m_fSerializationIsInProgress(false)
    73     , m_fSerializationClean(true)
     73    , m_fSerializationClean(false)
    7474    , m_fClosed(false)
    7575    , m_pStatusBar(0)
     
    9696    save();
    9797
    98     /* If serialization was clean: */
    99     if (m_fSerializationClean)
    100     {
    101         /* Tell the listener to close us (once): */
    102         if (!m_fClosed)
    103         {
    104             m_fClosed = true;
    105             emit sigClose();
    106         }
    107     }
     98    /* Close if theere is no ongoing serialization: */
     99    if (!isSerializationInProgress())
     100        close();
    108101}
    109102
    110103void UISettingsDialog::reject()
    111104{
     105    /* Close if theere is no ongoing serialization: */
    112106    if (!isSerializationInProgress())
    113107        close();
     
    163157}
    164158
    165 void UISettingsDialog::sltHandleSerializationFinished()
    166 {
    167     /* Delete serializer if exists: */
    168     if (serializeProcess())
    169     {
    170         delete m_pSerializeProcess;
    171         m_pSerializeProcess = 0;
    172     }
    173 
    174     /* Mark serialization finished: */
    175     m_fSerializationIsInProgress = false;
    176 }
    177 
    178 void UISettingsDialog::sltHandleProcessStarted()
     159void UISettingsDialog::sltHandleSerializationStarted()
    179160{
    180161    m_pProcessBar->setValue(0);
     
    182163}
    183164
    184 void UISettingsDialog::sltHandleProcessProgressChange(int iValue)
     165void UISettingsDialog::sltHandleSerializationProgressChange(int iValue)
    185166{
    186167    m_pProcessBar->setValue(iValue);
     
    192173            m_pStatusBar->setCurrentIndex(0);
    193174    }
     175}
     176
     177void UISettingsDialog::sltHandleSerializationFinished()
     178{
     179    /* Delete serializer if exists: */
     180    delete m_pSerializeProcess;
     181    m_pSerializeProcess = 0;
     182
     183    /* Mark serialization finished: */
     184    m_fSerializationIsInProgress = false;
    194185}
    195186
     
    219210    {
    220211        m_fPolished = true;
    221         polishEvent(pEvent);
     212        polishEvent();
    222213    }
    223214
     
    226217}
    227218
    228 void UISettingsDialog::polishEvent(QShowEvent*)
     219void UISettingsDialog::polishEvent()
    229220{
    230221    /* Check what's the minimum selector size: */
     
    293284    pEvent->ignore();
    294285
    295     /* Check whether there are unsaved settings
    296      * which will be lost in such case: */
    297     if (   !isSettingsChanged()
     286    /* Check whether serialization was clean (save)
     287     * or there are no unsaved settings to be lost (cancel): */
     288    if (   m_fSerializationClean
     289        || !isSettingsChanged()
    298290        || msgCenter().confirmSettingsDiscarding(this))
    299291    {
     
    355347    {
    356348        /* Configure settings loader: */
    357         connect(m_pSerializeProcess, &UISettingsSerializer::sigNotifyAboutProcessStarted, this, &UISettingsDialog::sltHandleProcessStarted);
    358         connect(m_pSerializeProcess, &UISettingsSerializer::sigNotifyAboutProcessProgressChanged, this, &UISettingsDialog::sltHandleProcessProgressChange);
    359         connect(m_pSerializeProcess, &UISettingsSerializer::sigNotifyAboutProcessFinished, this, &UISettingsDialog::sltHandleSerializationFinished);
     349        connect(m_pSerializeProcess, &UISettingsSerializer::sigNotifyAboutProcessStarted,
     350                this, &UISettingsDialog::sltHandleSerializationStarted);
     351        connect(m_pSerializeProcess, &UISettingsSerializer::sigNotifyAboutProcessProgressChanged,
     352                this, &UISettingsDialog::sltHandleSerializationProgressChange);
     353        connect(m_pSerializeProcess, &UISettingsSerializer::sigNotifyAboutProcessFinished,
     354                this, &UISettingsDialog::sltHandleSerializationFinished);
    360355
    361356        /* Raise current page priority: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r100924 r100925  
    9999    virtual void sltCategoryChanged(int cId);
    100100
     101    /** Handles serializartion start. */
     102    virtual void sltHandleSerializationStarted();
     103    /** Handles serializartion progress change to @a iValue. */
     104    virtual void sltHandleSerializationProgressChange(int iValue);
    101105    /** Handle serializartion finished. */
    102106    virtual void sltHandleSerializationFinished();
    103 
    104     /** Handles process start. */
    105     void sltHandleProcessStarted();
    106     /** Handles process progress change to @a iValue. */
    107     void sltHandleProcessProgressChange(int iValue);
    108107
    109108protected:
     
    113112    /** Handles show @a pEvent. */
    114113    virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
    115     /** Handles first show @a pEvent. */
    116     virtual void polishEvent(QShowEvent *pEvent);
     114    /** Handles first show event. */
     115    virtual void polishEvent();
    117116    /** Handles close @a pEvent. */
    118117    virtual void closeEvent(QCloseEvent *pEvent) RT_OVERRIDE;
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