mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
parent
2201ebd1d7
commit
62e7dce24a
8 changed files with 80 additions and 11 deletions
|
|
@ -27,6 +27,7 @@ MobileShellSettings::MobileShellSettings(QObject *parent)
|
||||||
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) -> void {
|
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) -> void {
|
||||||
if (group.name() == GENERAL_CONFIG_GROUP) {
|
if (group.name() == GENERAL_CONFIG_GROUP) {
|
||||||
Q_EMIT vibrationsEnabledChanged();
|
Q_EMIT vibrationsEnabledChanged();
|
||||||
|
Q_EMIT animationsEnabledChanged();
|
||||||
Q_EMIT navigationPanelEnabledChanged();
|
Q_EMIT navigationPanelEnabledChanged();
|
||||||
} else if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
} else if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
||||||
Q_EMIT enabledQuickSettingsChanged();
|
Q_EMIT enabledQuickSettingsChanged();
|
||||||
|
|
@ -48,6 +49,19 @@ void MobileShellSettings::setVibrationsEnabled(bool vibrationsEnabled)
|
||||||
m_config->sync();
|
m_config->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MobileShellSettings::animationsEnabled() const
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
return group.readEntry("animationsEnabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MobileShellSettings::setAnimationsEnabled(bool animationsEnabled)
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
group.writeEntry("animationsEnabled", animationsEnabled, KConfigGroup::Notify);
|
||||||
|
m_config->sync();
|
||||||
|
}
|
||||||
|
|
||||||
bool MobileShellSettings::navigationPanelEnabled() const
|
bool MobileShellSettings::navigationPanelEnabled() const
|
||||||
{
|
{
|
||||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ class MobileShellSettings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool vibrationsEnabled READ vibrationsEnabled WRITE setVibrationsEnabled NOTIFY vibrationsEnabledChanged)
|
Q_PROPERTY(bool vibrationsEnabled READ vibrationsEnabled WRITE setVibrationsEnabled NOTIFY vibrationsEnabledChanged)
|
||||||
|
Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled NOTIFY animationsEnabledChanged)
|
||||||
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -25,6 +26,9 @@ public:
|
||||||
bool vibrationsEnabled() const;
|
bool vibrationsEnabled() const;
|
||||||
void setVibrationsEnabled(bool vibrationsEnabled);
|
void setVibrationsEnabled(bool vibrationsEnabled);
|
||||||
|
|
||||||
|
bool animationsEnabled() const;
|
||||||
|
void setAnimationsEnabled(bool animationsEnabled);
|
||||||
|
|
||||||
bool navigationPanelEnabled() const;
|
bool navigationPanelEnabled() const;
|
||||||
void setNavigationPanelEnabled(bool navigationPanelEnabled);
|
void setNavigationPanelEnabled(bool navigationPanelEnabled);
|
||||||
|
|
||||||
|
|
@ -37,6 +41,7 @@ public:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void vibrationsEnabledChanged();
|
void vibrationsEnabledChanged();
|
||||||
void navigationPanelEnabledChanged();
|
void navigationPanelEnabledChanged();
|
||||||
|
void animationsEnabledChanged();
|
||||||
void enabledQuickSettingsChanged();
|
void enabledQuickSettingsChanged();
|
||||||
void disabledQuickSettingsChanged();
|
void disabledQuickSettingsChanged();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,11 +136,49 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
]
|
]
|
||||||
|
|
||||||
transitions: [
|
transitions: [
|
||||||
|
|
||||||
|
// no-animation mode transition
|
||||||
Transition {
|
Transition {
|
||||||
from: "closed"
|
from: "closed"
|
||||||
|
enabled: !MobileShell.MobileShellSettings.animationsEnabled
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
ScriptAction {
|
ScriptAction {
|
||||||
script: {
|
script: {
|
||||||
|
root.opacity = 0;
|
||||||
|
root.visible = true;
|
||||||
|
background.scale = 1;
|
||||||
|
iconParent.scale = 1;
|
||||||
|
backgroundParent.x = 0;
|
||||||
|
backgroundParent.y = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
properties: "opacity"
|
||||||
|
from: 0
|
||||||
|
to: 1
|
||||||
|
duration: PlasmaCore.Units.longDuration
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
|
||||||
|
ScriptAction {
|
||||||
|
script: {
|
||||||
|
// close the app drawer after it isn't visible
|
||||||
|
MobileShell.HomeScreenControls.resetHomeScreenPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// full animation transition
|
||||||
|
Transition {
|
||||||
|
from: "closed"
|
||||||
|
enabled: MobileShell.MobileShellSettings.animationsEnabled
|
||||||
|
SequentialAnimation {
|
||||||
|
ScriptAction {
|
||||||
|
script: {
|
||||||
|
root.opacity = 1;
|
||||||
root.visible = true;
|
root.visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import QtQuick.Controls 2.2 as QQC2
|
||||||
import org.kde.taskmanager 0.1 as TaskManager
|
import org.kde.taskmanager 0.1 as TaskManager
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
|
@ -195,7 +196,7 @@ Item {
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
// scale animation on press
|
// scale animation on press
|
||||||
property real zoomScale: tapHandler.pressed ? 0.9 : 1
|
property real zoomScale: (MobileShell.MobileShellSettings.animationsEnabled && tapHandler.pressed) ? 0.9 : 1
|
||||||
Behavior on zoomScale {
|
Behavior on zoomScale {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 200
|
duration: 200
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ QtObject {
|
||||||
target: root
|
target: root
|
||||||
property: "yPosition"
|
property: "yPosition"
|
||||||
to: openedYPosition
|
to: openedYPosition
|
||||||
duration: 300
|
duration: MobileShell.MobileShellSettings.animationsEnabled ? 300 : 0
|
||||||
easing.type: Easing.OutBack
|
easing.type: Easing.OutBack
|
||||||
|
|
||||||
onFinished: {
|
onFinished: {
|
||||||
|
|
@ -213,7 +213,7 @@ QtObject {
|
||||||
target: root
|
target: root
|
||||||
property: "yPosition"
|
property: "yPosition"
|
||||||
to: 0
|
to: 0
|
||||||
duration: PlasmaCore.Units.longDuration
|
duration: MobileShell.MobileShellSettings.animationsEnabled ? PlasmaCore.Units.longDuration : 0
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
|
|
||||||
onFinished: {
|
onFinished: {
|
||||||
|
|
@ -230,7 +230,7 @@ QtObject {
|
||||||
target: root
|
target: root
|
||||||
property: "yPosition"
|
property: "yPosition"
|
||||||
to: 0
|
to: 0
|
||||||
duration: 300
|
duration: MobileShell.MobileShellSettings.animationsEnabled ? 300 : 0
|
||||||
easing.type: Easing.OutQuint
|
easing.type: Easing.OutQuint
|
||||||
|
|
||||||
onFinished: {
|
onFinished: {
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,8 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
NumberAnimation on zoomScale {
|
NumberAnimation on zoomScale {
|
||||||
id: shrinkAnim
|
id: shrinkAnim
|
||||||
running: false
|
running: false
|
||||||
duration: 80
|
duration: MobileShell.MobileShellSettings.animationsEnabled ? 80 : 1
|
||||||
to: 0.8
|
to: MobileShell.MobileShellSettings.animationsEnabled ? 0.8 : 1
|
||||||
onFinished: {
|
onFinished: {
|
||||||
if (!mouseArea.pressed) {
|
if (!mouseArea.pressed) {
|
||||||
growAnim.restart();
|
growAnim.restart();
|
||||||
|
|
@ -126,7 +126,7 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
NumberAnimation on zoomScale {
|
NumberAnimation on zoomScale {
|
||||||
id: growAnim
|
id: growAnim
|
||||||
running: false
|
running: false
|
||||||
duration: 80
|
duration: MobileShell.MobileShellSettings.animationsEnabled ? 80 : 1
|
||||||
to: 1
|
to: 1
|
||||||
onFinished: {
|
onFinished: {
|
||||||
if (mouseArea.launchAppRequested) {
|
if (mouseArea.launchAppRequested) {
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,8 @@ MouseArea {
|
||||||
NumberAnimation on zoomScale {
|
NumberAnimation on zoomScale {
|
||||||
id: shrinkAnim
|
id: shrinkAnim
|
||||||
running: false
|
running: false
|
||||||
duration: 80
|
duration: MobileShell.MobileShellSettings.animationsEnabled ? 80 : 1
|
||||||
to: 0.8
|
to: MobileShell.MobileShellSettings.animationsEnabled ? 0.8 : 1
|
||||||
onFinished: {
|
onFinished: {
|
||||||
if (!delegate.pressed) {
|
if (!delegate.pressed) {
|
||||||
growAnim.restart();
|
growAnim.restart();
|
||||||
|
|
@ -70,7 +70,7 @@ MouseArea {
|
||||||
NumberAnimation on zoomScale {
|
NumberAnimation on zoomScale {
|
||||||
id: growAnim
|
id: growAnim
|
||||||
running: false
|
running: false
|
||||||
duration: 80
|
duration: MobileShell.MobileShellSettings.animationsEnabled ? 80 : 1
|
||||||
to: 1
|
to: 1
|
||||||
onFinished: {
|
onFinished: {
|
||||||
if (delegate.launchAppRequested) {
|
if (delegate.launchAppRequested) {
|
||||||
|
|
|
||||||
|
|
@ -40,13 +40,24 @@ KCM.SimpleKCM {
|
||||||
MobileForm.FormSwitchDelegate {
|
MobileForm.FormSwitchDelegate {
|
||||||
text: i18n("Shell Vibrations")
|
text: i18n("Shell Vibrations")
|
||||||
description: i18n("Whether to have vibrations enabled in the shell.")
|
description: i18n("Whether to have vibrations enabled in the shell.")
|
||||||
checked: !MobileShell.MobileShellSettings.vibrationsEnabled
|
checked: MobileShell.MobileShellSettings.vibrationsEnabled
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
if (checked != !MobileShell.MobileShellSettings.vibrationsEnabled) {
|
if (checked != !MobileShell.MobileShellSettings.vibrationsEnabled) {
|
||||||
MobileShell.MobileShellSettings.vibrationsEnabled = !checked;
|
MobileShell.MobileShellSettings.vibrationsEnabled = !checked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MobileForm.FormSwitchDelegate {
|
||||||
|
text: i18n("Animations")
|
||||||
|
description: i18n("If this is off, animations will be reduced as much as possible.")
|
||||||
|
checked: MobileShell.MobileShellSettings.animationsEnabled
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (checked != !MobileShell.MobileShellSettings.animationsEnabled) {
|
||||||
|
MobileShell.MobileShellSettings.animationsEnabled = !checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue