From 6f7a44c4506d16d6e496c34405fb385645a8d1ff Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 25 Jul 2017 14:19:01 +0300 Subject: [PATCH] the user can disable the Latte Info window --which is mainly used to inform the user for a dynamic layout switching --- app/layoutmanager.cpp | 13 +++++++++---- app/universalsettings.cpp | 18 ++++++++++++++++++ app/universalsettings.h | 7 +++++++ .../contents/configuration/TweaksConfig.qml | 11 +++++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/app/layoutmanager.cpp b/app/layoutmanager.cpp index 9de55efa2..30ad6779c 100644 --- a/app/layoutmanager.cpp +++ b/app/layoutmanager.cpp @@ -202,11 +202,16 @@ void LayoutManager::confirmDynamicSwitch() if (m_shouldSwitchToLayout == tempShouldSwitch && m_shouldSwitchToLayout != currentLayoutName()) { qDebug() << "dynamic switch to layout :: " << m_shouldSwitchToLayout; - showInfoWindow(i18n("Switching to layout %0 ...").arg(m_shouldSwitchToLayout), 4500); + if (m_corona->universalSettings()->showInfoWindow()) { + showInfoWindow(i18n("Switching to layout %0 ...").arg(m_shouldSwitchToLayout), 4000); + + QTimer::singleShot(500, [this, tempShouldSwitch]() { + switchToLayout(tempShouldSwitch); + }); + } else { + switchToLayout(m_shouldSwitchToLayout); + } - QTimer::singleShot(500, [this, tempShouldSwitch]() { - switchToLayout(tempShouldSwitch); - }); } else { m_shouldSwitchToLayout = tempShouldSwitch; m_dynamicSwitchTimer.start(); diff --git a/app/universalsettings.cpp b/app/universalsettings.cpp index 6f52dc214..f7840001b 100644 --- a/app/universalsettings.cpp +++ b/app/universalsettings.cpp @@ -32,6 +32,7 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent) connect(this, &UniversalSettings::currentLayoutNameChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::lastNonAssignedLayoutNameChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::launchersChanged, this, &UniversalSettings::saveConfig); + connect(this, &UniversalSettings::showInfoWindowChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::versionChanged, this, &UniversalSettings::saveConfig); } @@ -54,6 +55,21 @@ void UniversalSettings::load() loadConfig(); } +bool UniversalSettings::showInfoWindow() const +{ + return m_showInfoWindow; +} + +void UniversalSettings::setShowInfoWindow(bool show) +{ + if (m_showInfoWindow == show) { + return; + } + + m_showInfoWindow = show; + emit showInfoWindowChanged(); +} + int UniversalSettings::version() const { return m_version; @@ -176,6 +192,7 @@ void UniversalSettings::loadConfig() m_lastNonAssignedLayoutName = m_universalGroup.readEntry("lastNonAssignedLayout", QString()); m_layoutsWindowSize = m_universalGroup.readEntry("layoutsWindowSize", QSize(700, 450)); m_launchers = m_universalGroup.readEntry("launchers", QStringList()); + m_showInfoWindow = m_universalGroup.readEntry("showInfoWindow", true); } void UniversalSettings::saveConfig() @@ -185,6 +202,7 @@ void UniversalSettings::saveConfig() m_universalGroup.writeEntry("lastNonAssignedLayout", m_lastNonAssignedLayoutName); m_universalGroup.writeEntry("layoutsWindowSize", m_layoutsWindowSize); m_universalGroup.writeEntry("launchers", m_launchers); + m_universalGroup.writeEntry("showInfoWindow", m_showInfoWindow); m_universalGroup.sync(); } diff --git a/app/universalsettings.h b/app/universalsettings.h index 900957c46..45ec42204 100644 --- a/app/universalsettings.h +++ b/app/universalsettings.h @@ -35,6 +35,7 @@ namespace Latte { class UniversalSettings : public QObject { Q_OBJECT Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged) + Q_PROPERTY(bool showInfoWindow READ showInfoWindow WRITE setShowInfoWindow NOTIFY showInfoWindowChanged) Q_PROPERTY(QString currentLayoutName READ currentLayoutName WRITE setCurrentLayoutName NOTIFY currentLayoutNameChanged) @@ -48,6 +49,9 @@ public: bool autostart() const; void setAutostart(bool state); + bool showInfoWindow() const; + void setShowInfoWindow(bool show); + int version() const; void setVersion(int ver); @@ -69,6 +73,7 @@ signals: void lastNonAssignedLayoutNameChanged(); void layoutsWindowSizeChanged(); void launchersChanged(); + void showInfoWindowChanged(); void versionChanged(); private slots: @@ -79,6 +84,8 @@ private: void cleanupSettings(); private: + bool m_showInfoWindow{true}; + //when there isnt a version it is an old universal file int m_version{1}; diff --git a/shell/package/contents/configuration/TweaksConfig.qml b/shell/package/contents/configuration/TweaksConfig.qml index 36d7c96f9..9b82fb838 100644 --- a/shell/package/contents/configuration/TweaksConfig.qml +++ b/shell/package/contents/configuration/TweaksConfig.qml @@ -156,6 +156,17 @@ PlasmaComponents.Page { } } + PlasmaComponents.CheckBox { + Layout.leftMargin: units.smallSpacing * 2 + text: i18n("Show info for layouts automatic switching") + checked: universalSettings.showInfoWindow + tooltip: i18n("It shows a Latte specific info window") + + onClicked: { + universalSettings.showInfoWindow = checked; + } + } + PlasmaComponents.CheckBox { Layout.leftMargin: units.smallSpacing * 2 text: i18n("Raise dock on desktop change")