From 4f96957b9130955c9fd5260aa6a4c63677233286 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 11 Jan 2022 19:46:14 +0100 Subject: [PATCH] StudioWelcome: Show the splash screen at least once if the version changes The version of the last QDS instance launched is stored in QML/Designer/lastQDSVersion. Whenever the version does change we show the splash screen. Change-Id: Idf94e73446f0498203d979b45378d85e70bd4106 Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: Thomas Hartmann --- .../studiowelcome/studiowelcomeplugin.cpp | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 123e9154cc1..bead95e667d 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -28,6 +28,8 @@ #include "qdsnewdialog.h" +#include + #include #include #include @@ -490,6 +492,26 @@ bool StudioWelcomePlugin::initialize(const QStringList &arguments, QString *erro return true; } +static bool showSplashScreen() +{ + const QString lastQDSVersionEntry = "QML/Designer/lastQDSVersion"; + + QSettings *settings = Core::ICore::settings(); + + const QString lastQDSVersion = settings->value(lastQDSVersionEntry).toString(); + + + const QString currentVersion = Core::Constants::IDE_VERSION_DISPLAY; + + if (currentVersion != lastQDSVersion) { + settings->setValue(lastQDSVersionEntry, currentVersion); + return true; + } + + return Utils::CheckableMessageBox::shouldAskAgain(Core::ICore::settings(), + DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY); +} + void StudioWelcomePlugin::extensionsInitialized() { Core::ModeManager::activateMode(m_welcomeMode->id()); @@ -497,8 +519,7 @@ void StudioWelcomePlugin::extensionsInitialized() // Enable QDS new project dialog Core::ICore::setNewDialogFactory([](QWidget *parent) { return new QdsNewDialog(parent); }); - if (Utils::CheckableMessageBox::shouldAskAgain(Core::ICore::settings(), - DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY)) { + if (showSplashScreen()) { connect(Core::ICore::instance(), &Core::ICore::coreOpened, this, [this] { s_view = new QQuickWidget(Core::ICore::dialogParent()); s_view->setResizeMode(QQuickWidget::SizeRootObjectToView);