VirtualBox

Changeset 35131 in vbox for trunk/src


Ignore:
Timestamp:
Dec 15, 2010 1:19:00 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: Prevent closing global/machine settings dialog while not all the settings pages loaded.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp

    r33778 r35131  
    328328                            reject();
    329329                            return true;
     330                        }
     331                        default:
    330332                            break;
    331                         }
    332333                    }
    333334                }
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h

    r28800 r35131  
    6767protected slots:
    6868
    69     void accept();
    70     void reject();
     69    virtual void accept();
     70    virtual void reject();
     71
    7172    void done (QDialog::DialogCode aRescode);
    72 
    7373    void setResult (QDialog::DialogCode aRescode);
    7474
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r34004 r35131  
    2222#include <QStackedWidget>
    2323#include <QTimer>
     24#include <QCloseEvent>
    2425
    2526/* Local includes */
     
    4950    /* Common variables: */
    5051    , m_fPolished(false)
     52    /* Loading stuff: */
     53    , m_fProcessed(false)
    5154    /* Error/Warning stuff: */
    5255    , m_fValid(true)
     
    188191}
    189192
     193void UISettingsDialog::sltMarkProcessed()
     194{
     195    m_fProcessed = true;
     196}
     197
    190198void UISettingsDialog::retranslateUi()
    191199{
     
    410418        pWhatsThisWidget->setToolTip(QString("<qt>%1</qt>").arg(strWhatsThisText));
    411419#endif
     420}
     421
     422void UISettingsDialog::reject()
     423{
     424    if (m_fProcessed)
     425        QIMainDialog::reject();
    412426}
    413427
     
    509523}
    510524
     525void UISettingsDialog::closeEvent(QCloseEvent *pEvent)
     526{
     527    m_fProcessed ? pEvent->accept() : pEvent->ignore();
     528}
     529
    511530void UISettingsDialog::assignValidator(UISettingsPage *pPage)
    512531{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r34004 r35131  
    5656    virtual void sltCategoryChanged(int cId);
    5757
     58    /* Mark dialog as processed: */
     59    virtual void sltMarkProcessed();
     60
    5861protected:
    5962
     
    9194    void sltUpdateWhatsThis(bool fGotFocus = false);
    9295
     96    /* Slot to handle reject: */
     97    void reject();
     98
    9399private:
    94100
     
    96102    bool eventFilter(QObject *pObject, QEvent *pEvent);
    97103    void showEvent(QShowEvent *pEvent);
     104    void closeEvent(QCloseEvent *pEvent);
    98105
    99106    void assignValidator(UISettingsPage *pPage);
     
    103110
    104111    /* Error & Warning stuff: */
     112    bool m_fProcessed;
    105113    bool m_fValid;
    106114    bool m_fSilent;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r34740 r35131  
    394394     * it will load global settings & delete itself in the appropriate time: */
    395395    UISettingsSerializer *pGlobalSettingsLoader = new UISettingsSerializer(this, QVariant::fromValue(data), UISettingsSerializeDirection_Load);
     396    connect(pGlobalSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkProcessed()));
    396397    /* Set pages to be loaded: */
    397398    pGlobalSettingsLoader->setPageList(m_pSelector->settingPages());
     
    692693     * it will load machine settings & delete itself in the appropriate time: */
    693694    UISettingsSerializer *pMachineSettingsLoader = new UISettingsSerializer(this, QVariant::fromValue(data), UISettingsSerializeDirection_Load);
     695    connect(pMachineSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkProcessed()));
    694696    connect(pMachineSettingsLoader, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltSetFirstRunFlag()));
    695697    /* Set pages to be loaded: */
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