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 <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2022-01-11 19:46:14 +01:00
parent 1c8baecaf2
commit 4f96957b91

View File

@@ -28,6 +28,8 @@
#include "qdsnewdialog.h" #include "qdsnewdialog.h"
#include <app/app_version.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/dialogs/restartdialog.h> #include <coreplugin/dialogs/restartdialog.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
@@ -490,6 +492,26 @@ bool StudioWelcomePlugin::initialize(const QStringList &arguments, QString *erro
return true; 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() void StudioWelcomePlugin::extensionsInitialized()
{ {
Core::ModeManager::activateMode(m_welcomeMode->id()); Core::ModeManager::activateMode(m_welcomeMode->id());
@@ -497,8 +519,7 @@ void StudioWelcomePlugin::extensionsInitialized()
// Enable QDS new project dialog // Enable QDS new project dialog
Core::ICore::setNewDialogFactory([](QWidget *parent) { return new QdsNewDialog(parent); }); Core::ICore::setNewDialogFactory([](QWidget *parent) { return new QdsNewDialog(parent); });
if (Utils::CheckableMessageBox::shouldAskAgain(Core::ICore::settings(), if (showSplashScreen()) {
DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY)) {
connect(Core::ICore::instance(), &Core::ICore::coreOpened, this, [this] { connect(Core::ICore::instance(), &Core::ICore::coreOpened, this, [this] {
s_view = new QQuickWidget(Core::ICore::dialogParent()); s_view = new QQuickWidget(Core::ICore::dialogParent());
s_view->setResizeMode(QQuickWidget::SizeRootObjectToView); s_view->setResizeMode(QQuickWidget::SizeRootObjectToView);