diff --git a/components/mobileshell/mobileshellsettings.cpp b/components/mobileshell/mobileshellsettings.cpp index 5f9a1557..29db4b69 100644 --- a/components/mobileshell/mobileshellsettings.cpp +++ b/components/mobileshell/mobileshellsettings.cpp @@ -31,6 +31,7 @@ MobileShellSettings::MobileShellSettings(QObject *parent) Q_EMIT vibrationDurationChanged(); Q_EMIT animationsEnabledChanged(); Q_EMIT navigationPanelEnabledChanged(); + Q_EMIT taskSwitcherPreviewsEnabledChanged(); } else if (group.name() == QUICKSETTINGS_CONFIG_GROUP) { Q_EMIT enabledQuickSettingsChanged(); Q_EMIT disabledQuickSettingsChanged(); @@ -103,6 +104,19 @@ void MobileShellSettings::setNavigationPanelEnabled(bool navigationPanelEnabled) m_config->sync(); } +bool MobileShellSettings::taskSwitcherPreviewsEnabled() const +{ + auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP}; + return group.readEntry("taskSwitcherPreviewsEnabled", true); +} + +void MobileShellSettings::setTaskSwitcherPreviewsEnabled(bool taskSwitcherPreviewsEnabled) +{ + auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP}; + group.writeEntry("taskSwitcherPreviewsEnabled", taskSwitcherPreviewsEnabled, KConfigGroup::Notify); + m_config->sync(); +} + QList MobileShellSettings::enabledQuickSettings() const { auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP}; diff --git a/components/mobileshell/mobileshellsettings.h b/components/mobileshell/mobileshellsettings.h index 8ab2f5f7..8f2ab43c 100644 --- a/components/mobileshell/mobileshellsettings.h +++ b/components/mobileshell/mobileshellsettings.h @@ -19,12 +19,19 @@ class MobileShellSettings : public QObject { Q_OBJECT + + // general Q_PROPERTY(bool vibrationsEnabled READ vibrationsEnabled WRITE setVibrationsEnabled NOTIFY vibrationsEnabledChanged) Q_PROPERTY(int vibrationDuration READ vibrationDuration WRITE setVibrationDuration NOTIFY vibrationDurationChanged) Q_PROPERTY(qreal vibrationIntensity READ vibrationIntensity WRITE setVibrationIntensity NOTIFY vibrationIntensityChanged) Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled NOTIFY animationsEnabledChanged) + + // navigation panel Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged) + // task switcher + Q_PROPERTY(bool taskSwitcherPreviewsEnabled READ taskSwitcherPreviewsEnabled WRITE setTaskSwitcherPreviewsEnabled NOTIFY taskSwitcherPreviewsEnabledChanged) + public: static MobileShellSettings *self(); @@ -98,6 +105,18 @@ public: */ void setNavigationPanelEnabled(bool navigationPanelEnabled); + /** + * Whether task switcher application previews are enabled. + */ + bool taskSwitcherPreviewsEnabled() const; + + /** + * Set whether task switcher application previews are enabled. + * + * @param taskSwitcherPreviewsEnabled Whether task switcher previews are enabled. + */ + void setTaskSwitcherPreviewsEnabled(bool taskSwitcherPreviewsEnabled); + /** * Get the list of IDs of quick settings that are enabled. */ @@ -128,6 +147,7 @@ Q_SIGNALS: void vibrationDurationChanged(); void navigationPanelEnabledChanged(); void animationsEnabledChanged(); + void taskSwitcherPreviewsEnabledChanged(); void enabledQuickSettingsChanged(); void disabledQuickSettingsChanged(); diff --git a/components/mobileshell/qml/taskswitcher/Task.qml b/components/mobileshell/qml/taskswitcher/Task.qml index f9c67b97..241fd61a 100644 --- a/components/mobileshell/qml/taskswitcher/Task.qml +++ b/components/mobileshell/qml/taskswitcher/Task.qml @@ -228,7 +228,7 @@ Item { // attempt to load window preview Loader { id: pipeWireLoader - active: taskSwitcher.visible || taskSwitcher.tasksModel.taskReorderingEnabled + active: (taskSwitcher.visible || taskSwitcher.tasksModel.taskReorderingEnabled) && MobileShell.MobileShellSettings.taskSwitcherPreviewsEnabled anchors.fill: parent source: Qt.resolvedUrl("./Thumbnail.qml") diff --git a/kcms/mobileshell/package/contents/ui/main.qml b/kcms/mobileshell/package/contents/ui/main.qml index a25f2080..74d50da7 100644 --- a/kcms/mobileshell/package/contents/ui/main.qml +++ b/kcms/mobileshell/package/contents/ui/main.qml @@ -88,6 +88,30 @@ KCM.SimpleKCM { } } + MobileForm.FormCard { + Layout.fillWidth: true + Layout.topMargin: Kirigami.Units.largeSpacing + + contentItem: ColumnLayout { + spacing: 0 + + MobileForm.FormCardHeader { + title: i18n("Task Switcher") + } + + MobileForm.FormSwitchDelegate { + text: i18n("Show Application Previews") + description: i18n("Turning this off may help improve performance.") + checked: MobileShell.MobileShellSettings.taskSwitcherPreviewsEnabled + onCheckedChanged: { + if (checked != MobileShell.MobileShellSettings.taskSwitcherPreviewsEnabled) { + MobileShell.MobileShellSettings.taskSwitcherPreviewsEnabled = checked; + } + } + } + } + } + MobileForm.FormCard { Layout.fillWidth: true Layout.topMargin: Kirigami.Units.largeSpacing