mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03: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 vibrationDurationChanged();
|
||||||
Q_EMIT animationsEnabledChanged();
|
Q_EMIT animationsEnabledChanged();
|
||||||
Q_EMIT navigationPanelEnabledChanged();
|
Q_EMIT navigationPanelEnabledChanged();
|
||||||
|
Q_EMIT taskSwitcherPreviewsEnabledChanged();
|
||||||
} else if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
} else if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
||||||
Q_EMIT enabledQuickSettingsChanged();
|
Q_EMIT enabledQuickSettingsChanged();
|
||||||
Q_EMIT disabledQuickSettingsChanged();
|
Q_EMIT disabledQuickSettingsChanged();
|
||||||
|
|
@ -103,6 +104,19 @@ void MobileShellSettings::setNavigationPanelEnabled(bool navigationPanelEnabled)
|
||||||
m_config->sync();
|
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
|
QList<QString> MobileShellSettings::enabledQuickSettings() const
|
||||||
{
|
{
|
||||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,19 @@
|
||||||
class MobileShellSettings : public QObject
|
class MobileShellSettings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
// general
|
||||||
Q_PROPERTY(bool vibrationsEnabled READ vibrationsEnabled WRITE setVibrationsEnabled NOTIFY vibrationsEnabledChanged)
|
Q_PROPERTY(bool vibrationsEnabled READ vibrationsEnabled WRITE setVibrationsEnabled NOTIFY vibrationsEnabledChanged)
|
||||||
Q_PROPERTY(int vibrationDuration READ vibrationDuration WRITE setVibrationDuration NOTIFY vibrationDurationChanged)
|
Q_PROPERTY(int vibrationDuration READ vibrationDuration WRITE setVibrationDuration NOTIFY vibrationDurationChanged)
|
||||||
Q_PROPERTY(qreal vibrationIntensity READ vibrationIntensity WRITE setVibrationIntensity NOTIFY vibrationIntensityChanged)
|
Q_PROPERTY(qreal vibrationIntensity READ vibrationIntensity WRITE setVibrationIntensity NOTIFY vibrationIntensityChanged)
|
||||||
Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled NOTIFY animationsEnabledChanged)
|
Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled NOTIFY animationsEnabledChanged)
|
||||||
|
|
||||||
|
// navigation panel
|
||||||
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
||||||
|
|
||||||
|
// task switcher
|
||||||
|
Q_PROPERTY(bool taskSwitcherPreviewsEnabled READ taskSwitcherPreviewsEnabled WRITE setTaskSwitcherPreviewsEnabled NOTIFY taskSwitcherPreviewsEnabledChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static MobileShellSettings *self();
|
static MobileShellSettings *self();
|
||||||
|
|
||||||
|
|
@ -98,6 +105,18 @@ public:
|
||||||
*/
|
*/
|
||||||
void setNavigationPanelEnabled(bool navigationPanelEnabled);
|
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.
|
* Get the list of IDs of quick settings that are enabled.
|
||||||
*/
|
*/
|
||||||
|
|
@ -128,6 +147,7 @@ Q_SIGNALS:
|
||||||
void vibrationDurationChanged();
|
void vibrationDurationChanged();
|
||||||
void navigationPanelEnabledChanged();
|
void navigationPanelEnabledChanged();
|
||||||
void animationsEnabledChanged();
|
void animationsEnabledChanged();
|
||||||
|
void taskSwitcherPreviewsEnabledChanged();
|
||||||
void enabledQuickSettingsChanged();
|
void enabledQuickSettingsChanged();
|
||||||
void disabledQuickSettingsChanged();
|
void disabledQuickSettingsChanged();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ Item {
|
||||||
// attempt to load window preview
|
// attempt to load window preview
|
||||||
Loader {
|
Loader {
|
||||||
id: pipeWireLoader
|
id: pipeWireLoader
|
||||||
active: taskSwitcher.visible || taskSwitcher.tasksModel.taskReorderingEnabled
|
active: (taskSwitcher.visible || taskSwitcher.tasksModel.taskReorderingEnabled) && MobileShell.MobileShellSettings.taskSwitcherPreviewsEnabled
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: Qt.resolvedUrl("./Thumbnail.qml")
|
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 {
|
MobileForm.FormCard {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue