From 41d9d15dda0a84b318a898728424b37632d5a825 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 13 Jul 2024 18:24:47 +0200 Subject: [PATCH] MainWindow: Only show sponsor dialog if update dialog is answered --- src/core/mainwindow.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 5731247d3..4c3e25dea 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -1071,17 +1071,25 @@ MainWindow::MainWindow(Application *app, SharedPtr tray_icon, OS #endif { + bool asked_permission = true; Settings s; - s.beginGroup(kSettingsGroup); - constexpr char do_not_show_sponsor_message_key[] = "do_not_show_sponsor_message"; - const bool do_not_show_sponsor_message = s.value(do_not_show_sponsor_message_key, false).toBool(); +#ifdef HAVE_QTSPARKLE + s.beginGroup("QtSparkle"); + asked_permission = s.value("asked_permission", false).toBool(); s.endGroup(); - if (!do_not_show_sponsor_message) { - MessageDialog *sponsor_message = new MessageDialog(this); - sponsor_message->set_settings_group(QLatin1String(kSettingsGroup)); - sponsor_message->set_do_not_show_message_again(QLatin1String(do_not_show_sponsor_message_key)); - sponsor_message->setAttribute(Qt::WA_DeleteOnClose); - sponsor_message->ShowMessage(tr("Sponsoring Strawberry"), tr("Strawberry is free and open source software. If you like Strawberry, please consider sponsoring the project. For more information about sponsorship see our website %1").arg(QStringLiteral("www.strawberrymusicplayer.org")), IconLoader::Load(QStringLiteral("dialog-information"))); +#endif + if (asked_permission) { + s.beginGroup(kSettingsGroup); + constexpr char do_not_show_sponsor_message_key[] = "do_not_show_sponsor_message"; + const bool do_not_show_sponsor_message = s.value(do_not_show_sponsor_message_key, false).toBool(); + s.endGroup(); + if (!do_not_show_sponsor_message) { + MessageDialog *sponsor_message = new MessageDialog(this); + sponsor_message->set_settings_group(QLatin1String(kSettingsGroup)); + sponsor_message->set_do_not_show_message_again(QLatin1String(do_not_show_sponsor_message_key)); + sponsor_message->setAttribute(Qt::WA_DeleteOnClose); + sponsor_message->ShowMessage(tr("Sponsoring Strawberry"), tr("Strawberry is free and open source software. If you like Strawberry, please consider sponsoring the project. For more information about sponsorship see our website %1").arg(QStringLiteral("www.strawberrymusicplayer.org")), IconLoader::Load(QStringLiteral("dialog-information"))); + } } }