forked from qt-creator/qt-creator
StudioWelcome: Pause splash close timer while restart dialog is active
Fixes: QDS-3332 Change-Id: I16e6646202c97453b76a5e3a848b733ad460514c Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -64,6 +64,7 @@ namespace Internal {
|
|||||||
const char DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY[] = "StudioSplashScreen";
|
const char DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY[] = "StudioSplashScreen";
|
||||||
|
|
||||||
QPointer<QQuickWidget> s_view = nullptr;
|
QPointer<QQuickWidget> s_view = nullptr;
|
||||||
|
static StudioWelcomePlugin *s_pluginInstance = nullptr;
|
||||||
|
|
||||||
static bool isUsageStatistic(const ExtensionSystem::PluginSpec *spec)
|
static bool isUsageStatistic(const ExtensionSystem::PluginSpec *spec)
|
||||||
{
|
{
|
||||||
@@ -115,10 +116,14 @@ public:
|
|||||||
plugin->setEnabledBySettings(b);
|
plugin->setEnabledBySettings(b);
|
||||||
ExtensionSystem::PluginManager::writeSettings();
|
ExtensionSystem::PluginManager::writeSettings();
|
||||||
|
|
||||||
|
// pause remove splash timer while dialog is open otherwise splash crashes upon removal
|
||||||
|
s_pluginInstance->pauseRemoveSplashTimer();
|
||||||
|
|
||||||
const QString restartText = tr("The change will take effect after restart.");
|
const QString restartText = tr("The change will take effect after restart.");
|
||||||
Core::RestartDialog restartDialog(Core::ICore::dialogParent(), restartText);
|
Core::RestartDialog restartDialog(Core::ICore::dialogParent(), restartText);
|
||||||
restartDialog.exec();
|
restartDialog.exec();
|
||||||
|
|
||||||
|
s_pluginInstance->resumeRemoveSplashTimer();
|
||||||
setupModel();
|
setupModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,10 +275,14 @@ void StudioWelcomePlugin::showSystemSettings()
|
|||||||
Core::ICore::infoBar()->globallySuppressInfo("WarnCrashReporting");
|
Core::ICore::infoBar()->globallySuppressInfo("WarnCrashReporting");
|
||||||
|
|
||||||
// pause remove splash timer while settings dialog is open otherwise splash crashes upon removal
|
// pause remove splash timer while settings dialog is open otherwise splash crashes upon removal
|
||||||
int splashAutoCloseRemainingTime = m_removeSplashTimer.remainingTime(); // milliseconds
|
pauseRemoveSplashTimer();
|
||||||
m_removeSplashTimer.stop();
|
|
||||||
Core::ICore::showOptionsDialog(Core::Constants::SETTINGS_ID_SYSTEM);
|
Core::ICore::showOptionsDialog(Core::Constants::SETTINGS_ID_SYSTEM);
|
||||||
m_removeSplashTimer.start(splashAutoCloseRemainingTime);
|
resumeRemoveSplashTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
StudioWelcomePlugin::StudioWelcomePlugin()
|
||||||
|
{
|
||||||
|
s_pluginInstance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
StudioWelcomePlugin::~StudioWelcomePlugin()
|
StudioWelcomePlugin::~StudioWelcomePlugin()
|
||||||
@@ -359,6 +368,20 @@ bool StudioWelcomePlugin::delayedInitialize()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StudioWelcomePlugin::pauseRemoveSplashTimer()
|
||||||
|
{
|
||||||
|
if (m_removeSplashTimer.isActive()) {
|
||||||
|
m_removeSplashRemainingTime = m_removeSplashTimer.remainingTime(); // milliseconds
|
||||||
|
m_removeSplashTimer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StudioWelcomePlugin::resumeRemoveSplashTimer()
|
||||||
|
{
|
||||||
|
if (!m_removeSplashTimer.isActive())
|
||||||
|
m_removeSplashTimer.start(m_removeSplashRemainingTime);
|
||||||
|
}
|
||||||
|
|
||||||
WelcomeMode::WelcomeMode()
|
WelcomeMode::WelcomeMode()
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Studio"));
|
setDisplayName(tr("Studio"));
|
||||||
|
|||||||
@@ -42,15 +42,20 @@ public slots:
|
|||||||
void showSystemSettings();
|
void showSystemSettings();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
StudioWelcomePlugin();
|
||||||
~StudioWelcomePlugin() final;
|
~StudioWelcomePlugin() final;
|
||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *errorString) override;
|
bool initialize(const QStringList &arguments, QString *errorString) override;
|
||||||
void extensionsInitialized() override;
|
void extensionsInitialized() override;
|
||||||
bool delayedInitialize() override;
|
bool delayedInitialize() override;
|
||||||
|
|
||||||
|
void pauseRemoveSplashTimer();
|
||||||
|
void resumeRemoveSplashTimer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class WelcomeMode *m_welcomeMode = nullptr;
|
class WelcomeMode *m_welcomeMode = nullptr;
|
||||||
QTimer m_removeSplashTimer;
|
QTimer m_removeSplashTimer;
|
||||||
|
int m_removeSplashRemainingTime = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user