1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

SetupWizard: Store a flag if the wizard is running to prevent starting two.

This is still not as good as getting that dialog modal since the user can get
it lost behind the main window.
This commit is contained in:
James Cotton 2012-10-13 10:35:36 -05:00 committed by PT_Dreamer
parent b99b221a6d
commit 28d3cdcd7a
2 changed files with 17 additions and 5 deletions

View File

@ -37,9 +37,8 @@
#include <QKeySequence>
#include <coreplugin/modemanager.h>
SetupWizardPlugin::SetupWizardPlugin()
SetupWizardPlugin::SetupWizardPlugin() : wizardRunning(false)
{
// Do nothing
}
SetupWizardPlugin::~SetupWizardPlugin()
@ -82,9 +81,19 @@ void SetupWizardPlugin::shutdown()
void SetupWizardPlugin::showSetupWizard()
{
SetupWizard *m_wiz = new SetupWizard();
m_wiz->setAttribute( Qt::WA_DeleteOnClose, true );
m_wiz->show();
if (!wizardRunning) {
wizardRunning = true;
SetupWizard *m_wiz = new SetupWizard();
connect(m_wiz, SIGNAL(finished(int)), this, SLOT(wizardTerminated()));
m_wiz->setAttribute( Qt::WA_DeleteOnClose, true );
m_wiz->show();
}
}
void SetupWizardPlugin::wizardTerminated()
{
wizardRunning = false;
disconnect(this,SLOT(wizardTerminated()));
}
Q_EXPORT_PLUGIN(SetupWizardPlugin)

View File

@ -44,7 +44,10 @@ public:
private slots:
void showSetupWizard();
void wizardTerminated();
private:
bool wizardRunning;
};
#endif // SETUPWIZARDPLUGIN_H