aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2019-04-17 18:17:23 +0200
committerAlessandro Portale <alessandro.portale@qt.io>2019-04-18 09:11:56 +0000
commit43d83f2a69ff7b74012368e14098f3fa14e7acc6 (patch)
tree834367853ec7c71438fbd422724fef197d70b4fa
parentfa11c2f022ae660c0de0f275a2a26edcd6f523fd (diff)
StudioWelcome: Make the hidden splashscreen recoverable
The user choice made on dialogs with a "Don't show/ask again" checkbox should be resettable via the "Environment->Interface->Reset Warnings" setting. This patch let's the StudioWelcome splashscreen use the dontshow/reset mechanism of CheckableMessageBox for that. Task-number: QDS-303 Change-Id: Iec4ea8bc58c6cfdd8803741610b6fd411fb7f5ef Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml2
-rw-r--r--src/plugins/studiowelcome/qml/splashscreen/main.qml3
-rw-r--r--src/plugins/studiowelcome/studiowelcomeplugin.cpp24
-rw-r--r--src/plugins/studiowelcome/studiowelcomeplugin.h1
4 files changed, 13 insertions, 17 deletions
diff --git a/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml b/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml
index 310861184d..8bee408f4f 100644
--- a/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml
+++ b/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml
@@ -37,7 +37,7 @@ Image {
signal goNext
signal closeClicked
- property alias showSplashScreen: do_not_show_checkBox.checked
+ property alias doNotShowAgain: do_not_show_checkBox.checked
property bool loadingPlugins: true
Image {
diff --git a/src/plugins/studiowelcome/qml/splashscreen/main.qml b/src/plugins/studiowelcome/qml/splashscreen/main.qml
index 190f41e2e5..be88704784 100644
--- a/src/plugins/studiowelcome/qml/splashscreen/main.qml
+++ b/src/plugins/studiowelcome/qml/splashscreen/main.qml
@@ -33,11 +33,10 @@ Item {
signal closeClicked
signal checkBoxToggled
- property alias showSplashScreen: welcome_splash.showSplashScreen
+ property alias doNotShowAgain: welcome_splash.doNotShowAgain
property alias loadingPlugins: welcome_splash.loadingPlugins
Welcome_splash {
- onShowSplashScreenChanged: root.checkBoxToggled()
id: welcome_splash
x: 0
y: 0
diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp
index 435edd33fd..01388686eb 100644
--- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp
+++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp
@@ -35,6 +35,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectmanager.h>
+#include <utils/checkablemessagebox.h>
#include <utils/icon.h>
#include <utils/stringutils.h>
#include <utils/theme/theme.h>
@@ -54,7 +55,7 @@
namespace StudioWelcome {
namespace Internal {
-const char SHOW_SPLASHSCREEN[] = "Studiowelcomeplugin/showSplashScreen";
+const char DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY[] = "StudioSplashScreen";
QPointer<QQuickWidget> s_view = nullptr;
@@ -165,17 +166,14 @@ private:
void StudioWelcomePlugin::closeSplashScreen()
{
- if (!s_view.isNull())
- s_view->deleteLater();
-}
+ if (!s_view.isNull()) {
+ const bool doNotShowAgain = s_view->rootObject()->property("doNotShowAgain").toBool();
+ if (doNotShowAgain)
+ Utils::CheckableMessageBox::doNotAskAgain(Core::ICore::settings(),
+ DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY);
-void StudioWelcomePlugin::handleSplashCheckBoxChanged()
-{
- if (s_view.isNull())
- return;
-
- bool show = s_view->rootObject()->property("showSplashScreen").toBool();
- Core::ICore::settings()->setValue(SHOW_SPLASHSCREEN, !show);
+ s_view->deleteLater();
+ }
}
StudioWelcomePlugin::~StudioWelcomePlugin()
@@ -197,7 +195,8 @@ bool StudioWelcomePlugin::initialize(const QStringList &arguments, QString *erro
void StudioWelcomePlugin::extensionsInitialized()
{
Core::ModeManager::activateMode(m_welcomeMode->id());
- if (Core::ICore::settings()->value(SHOW_SPLASHSCREEN, true).toBool()) {
+ if (Utils::CheckableMessageBox::shouldAskAgain(Core::ICore::settings(),
+ DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY)) {
connect(Core::ICore::instance(), &Core::ICore::coreOpened, this, [this] (){
s_view = new QQuickWidget(Core::ICore::dialogParent());
s_view->setResizeMode(QQuickWidget::SizeRootObjectToView);
@@ -219,7 +218,6 @@ void StudioWelcomePlugin::extensionsInitialized()
return);
connect(s_view->rootObject(), SIGNAL(closeClicked()), this, SLOT(closeSplashScreen()));
- connect(s_view->rootObject(), SIGNAL(checkBoxToggled()), this, SLOT(handleSplashCheckBoxChanged()));
s_view->show();
s_view->raise();
diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.h b/src/plugins/studiowelcome/studiowelcomeplugin.h
index 28834b4a07..2250d7b1b6 100644
--- a/src/plugins/studiowelcome/studiowelcomeplugin.h
+++ b/src/plugins/studiowelcome/studiowelcomeplugin.h
@@ -37,7 +37,6 @@ class StudioWelcomePlugin : public ExtensionSystem::IPlugin
public slots:
void closeSplashScreen();
- void handleSplashCheckBoxChanged();
public:
~StudioWelcomePlugin() final;