mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
kcm & taskswitcher: Add option to toggle application previews
This commit is contained in:
parent
427c177a44
commit
2c61bb1723
4 changed files with 59 additions and 1 deletions
|
|
@ -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<QString> MobileShellSettings::enabledQuickSettings() const
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue