Calling constructor of Preference dialog take some time. Because of this user
have time to call the dialog twice. --HG-- branch : develop
This commit is contained in:
parent
595a7dcaff
commit
e6c85fa47a
|
@ -444,8 +444,16 @@ void TMainWindow::CreateFromExisting()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::Preferences()
|
void TMainWindow::Preferences()
|
||||||
{
|
{
|
||||||
TapeConfigDialog dlg(this);
|
// Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
|
||||||
dlg.exec();
|
static QPointer<TapeConfigDialog> guard;// Prevent any second run
|
||||||
|
if (guard.isNull())
|
||||||
|
{
|
||||||
|
TapeConfigDialog *config = new TapeConfigDialog(this);
|
||||||
|
// QScopedPointer needs to be sure any exception will never block guard
|
||||||
|
QScopedPointer<TapeConfigDialog> dlg(config);
|
||||||
|
guard = config;
|
||||||
|
dlg->exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -4017,15 +4017,23 @@ void MainWindow::ShowPaper(int index)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::Preferences()
|
void MainWindow::Preferences()
|
||||||
{
|
{
|
||||||
ConfigDialog dlg(this);
|
// Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
|
||||||
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first
|
static QPointer<ConfigDialog> guard;// Prevent any second run
|
||||||
connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions);
|
if (guard.isNull())
|
||||||
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::ToolBarStyles);
|
{
|
||||||
if (dlg.exec() == QDialog::Accepted)
|
ConfigDialog *config = new ConfigDialog(this);
|
||||||
|
// QScopedPointer needs to be sure any exception will never block guard
|
||||||
|
QScopedPointer<ConfigDialog> dlg(config);
|
||||||
|
guard = config;
|
||||||
|
connect(dlg.data(), &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first
|
||||||
|
connect(dlg.data(), &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions);
|
||||||
|
connect(dlg.data(), &ConfigDialog::UpdateProperties, this, &MainWindow::ToolBarStyles);
|
||||||
|
if (guard->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
InitAutoSave();
|
InitAutoSave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::CreateMeasurements()
|
void MainWindow::CreateMeasurements()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user