Set wait cursor to inform a user that the program is busy when openning

Preferences dialog.

Because Preferences dialog reads data about installed localizations each time
a user opens it in some cases it's take some time. Especially when a hard drive
is busy.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-06-14 11:48:51 +03:00
parent 45ced25561
commit debcabf1a3
2 changed files with 4 additions and 0 deletions

View file

@ -486,6 +486,7 @@ void TMainWindow::Preferences()
static QPointer<DialogTapePreferences> guard;// Prevent any second run
if (guard.isNull())
{
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
DialogTapePreferences *preferences = new DialogTapePreferences(this);
// QScopedPointer needs to be sure any exception will never block guard
QScopedPointer<DialogTapePreferences> dlg(preferences);
@ -493,6 +494,7 @@ void TMainWindow::Preferences()
// Must be first
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, this, &TMainWindow::WindowsLocale);
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, this, &TMainWindow::ToolBarStyles);
QGuiApplication::restoreOverrideCursor();
dlg->exec();
}
}

View file

@ -4310,6 +4310,7 @@ void MainWindow::Preferences()
static QPointer<DialogPreferences> guard;// Prevent any second run
if (guard.isNull())
{
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
DialogPreferences *preferences = new DialogPreferences(this);
// QScopedPointer needs to be sure any exception will never block guard
QScopedPointer<DialogPreferences> dlg(preferences);
@ -4318,6 +4319,7 @@ void MainWindow::Preferences()
connect(dlg.data(), &DialogPreferences::UpdateProperties, toolOptions,
&VToolOptionsPropertyBrowser::RefreshOptions);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
QGuiApplication::restoreOverrideCursor();
if (guard->exec() == QDialog::Accepted)
{