From b14ea6e0fc72ccad6d93cb22a8394c8d34a41153 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 20 Jun 2023 13:37:59 +0200 Subject: [PATCH] Improve scan dialog modal behaviour Signed-off-by: falkTX --- source/frontend/pluginlist/pluginlistdialog.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/frontend/pluginlist/pluginlistdialog.cpp b/source/frontend/pluginlist/pluginlistdialog.cpp index bc2125dce..52bad48b6 100644 --- a/source/frontend/pluginlist/pluginlistdialog.cpp +++ b/source/frontend/pluginlist/pluginlistdialog.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef __clang__ # pragma clang diagnostic pop @@ -1020,7 +1021,9 @@ void PluginListDialog::done(const int r) { QTableWidgetItem* const widget = ui.tableWidget->item(ui.tableWidget->currentRow(), TW_NAME); p->retPlugin = asPluginInfo(widget->data(Qt::UserRole + UR_PLUGIN_INFO)); - } else { + } + else + { p->retPlugin = {}; } @@ -1044,7 +1047,6 @@ void PluginListDialog::showEvent(QShowEvent* const event) p->discovery.dialog->ch_invalid->setChecked(false); p->discovery.dialog->group->setEnabled(false); p->discovery.dialog->progressBar->setFormat("Starting initial discovery..."); - p->discovery.dialog->show(); QObject::connect(p->discovery.dialog->b_skip, &QPushButton::clicked, this, &PluginListDialog::refreshPluginsSkip); @@ -1052,6 +1054,8 @@ void PluginListDialog::showEvent(QShowEvent* const event) this, &PluginListDialog::refreshPluginsStop); p->timerId = startTimer(0); + + QTimer::singleShot(0, p->discovery.dialog, &QDialog::exec); } } @@ -1147,6 +1151,9 @@ void PluginListDialog::timerEvent(QTimerEvent* const event) if (p->timerId == 0) break; + if (p->discovery.dialog) + p->discovery.dialog->progressBar->setFormat(ui.label->text()); + p->discovery.handle = carla_plugin_discovery_start(p->discovery.tool.toUtf8().constData(), p->discovery.ptype, path.toUtf8().constData(), @@ -1752,7 +1759,6 @@ void PluginListDialog::refreshPlugins() refreshPluginsStop(); p->discovery.dialog = new PluginRefreshDialog(this); - p->discovery.dialog->show(); QObject::connect(p->discovery.dialog->b_start, &QPushButton::clicked, this, &PluginListDialog::refreshPluginsStart); @@ -1760,6 +1766,8 @@ void PluginListDialog::refreshPlugins() this, &PluginListDialog::refreshPluginsSkip); QObject::connect(p->discovery.dialog, &QDialog::finished, this, &PluginListDialog::refreshPluginsStop); + + p->discovery.dialog->exec(); } void PluginListDialog::refreshPluginsStart()