1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-01-30 09:05:04 +01:00

MainWindow: Only show sponsor dialog if update dialog is answered

This commit is contained in:
Jonas Kvinge 2024-07-13 18:24:47 +02:00
parent 124b97c024
commit 41d9d15dda

View File

@ -1071,17 +1071,25 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
#endif #endif
{ {
bool asked_permission = true;
Settings s; Settings s;
s.beginGroup(kSettingsGroup); #ifdef HAVE_QTSPARKLE
constexpr char do_not_show_sponsor_message_key[] = "do_not_show_sponsor_message"; s.beginGroup("QtSparkle");
const bool do_not_show_sponsor_message = s.value(do_not_show_sponsor_message_key, false).toBool(); asked_permission = s.value("asked_permission", false).toBool();
s.endGroup(); s.endGroup();
if (!do_not_show_sponsor_message) { #endif
MessageDialog *sponsor_message = new MessageDialog(this); if (asked_permission) {
sponsor_message->set_settings_group(QLatin1String(kSettingsGroup)); s.beginGroup(kSettingsGroup);
sponsor_message->set_do_not_show_message_again(QLatin1String(do_not_show_sponsor_message_key)); constexpr char do_not_show_sponsor_message_key[] = "do_not_show_sponsor_message";
sponsor_message->setAttribute(Qt::WA_DeleteOnClose); const bool do_not_show_sponsor_message = s.value(do_not_show_sponsor_message_key, false).toBool();
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("<a href= \"https://www.strawberrymusicplayer.org/\">www.strawberrymusicplayer.org</a>")), IconLoader::Load(QStringLiteral("dialog-information"))); 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("<a href= \"https://www.strawberrymusicplayer.org/\">www.strawberrymusicplayer.org</a>")), IconLoader::Load(QStringLiteral("dialog-information")));
}
} }
} }