Make animation durations consistent with Kirigami values

Summary:
Right now longDuration is 120ms and shortDuration is 24ms. This presents three problems:
- The durations are far too fast, especially shortDuration, which is so fast that it seems like there is no animation at all.
- The durations are not consistent with Kirigami, which uses 150 for short and 250 for
 long.
- There is no longer value available, as with the one being added to Kirigami in D28143.

Accordingly, this patch makes the short and long values consistent with Kirigami's values,
and adds a new `veryLongDuration` value to match the one being added to Kirigami in D28143.

Reviewers: #plasma, davidedmundson, mart

Reviewed By: #plasma, mart

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28144
This commit is contained in:
Nate Graham 2020-04-04 20:42:18 -06:00
parent f363df626a
commit 0739113a44
5 changed files with 32 additions and 2 deletions

View File

@ -882,6 +882,7 @@ Module {
Property { name: "devicePixelRatio"; type: "double"; isReadonly: true }
Property { name: "longDuration"; type: "int"; isReadonly: true }
Property { name: "shortDuration"; type: "int"; isReadonly: true }
Property { name: "veryLongDuration"; type: "int"; isReadonly: true }
Signal { name: "spacingChanged" }
Signal { name: "durationChanged" }
Method {

View File

@ -33,7 +33,7 @@
#include <KConfigWatcher>
#include <KIconLoader>
const int defaultLongDuration = 120;
const int defaultLongDuration = 250;
SharedAppFilter::SharedAppFilter(QObject *parent)
@ -272,7 +272,12 @@ int Units::longDuration() const
int Units::shortDuration() const
{
return qMax(1, m_longDuration / 5);
return qMax(1, qRound(m_longDuration * 0.6));
}
int Units::veryLongDuration() const
{
return m_longDuration * 2;
}
#include "moc_units.cpp"

View File

@ -132,6 +132,12 @@ class Units : public QObject
*/
Q_PROPERTY(int shortDuration READ shortDuration NOTIFY durationChanged)
/**
* units.veryLongDuration should be used for specialty animations that benefit
* from being even longer than longDuration.
*/
Q_PROPERTY(int veryLongDuration READ veryLongDuration NOTIFY durationChanged)
public:
/// @cond INTERNAL_DOCS
@ -187,6 +193,12 @@ public:
* @since 5.0
*/
int shortDuration() const;
/**
* @return Duration for very long animations, in milliseconds.
* @since 5.69
*/
int veryLongDuration() const;
/// @endcond
/**

View File

@ -99,6 +99,12 @@ QtObject {
*/
property int shortDuration: units.shortDuration
/**
* units.veryLongDuration should be used for specialty animations that benefit
* from being even longer than longDuration.
*/
property int veryLongDuration: units.veryLongDuration
readonly property QtObject __styleItem: QtQuickControlsPrivate.StyleItem {elementType: "frame" }
/**

View File

@ -93,6 +93,12 @@ QtObject {
*/
property int shortDuration: units.shortDuration
/**
* units.veryLongDuration should be used for specialty animations that benefit
* from being even longer than longDuration.
*/
property int veryLongDuration: units.veryLongDuration
/**
* How much the mouse scroll wheel scrolls, expressed in lines of text.
* Note: this is strictly for classical mouse wheels, touchpads 2 figer scrolling won't be affected