Commit Graph

49 Commits

Author SHA1 Message Date
Christophe Giboudeaux
1587ead53e Fix typos found by codespell
GIT_SILENT
2021-07-14 11:01:00 +02:00
Nate Graham
46b46c8135 Port to singleton Theme
We ported units to use the PlasmaCore.Units singleton earlier; now it's
time to do the same thing for PlasmaCore.Theme.

There are no UI changes or regressions detected.
2021-04-08 09:20:52 -06:00
Dan Leinir Turthra Jensen
8a35f83c4b Add a humanMoment unit to the various Units
Time in milliseconds equivalent to the theoretical human moment, which can be used
to determine whether how long to wait until the user should be informed of something,
or can be used as the limit for how long something should wait before being
automatically initiated.

Some examples:

- When the user types text in a search field, wait no longer than this duration after
  the user completes typing before starting the search
- When loading data which would commonly arrive rapidly enough to not require interaction,
  wait this long before showing a spinner

This might seem an arbitrary number, but given the psychological effect that three
seconds seems to be what humans consider a moment (and in the case of waiting for
something to happen, a moment is that time when you think "this is taking a bit long,
isn't it?"), the idea is to postpone for just before such a conceptual moment. The reason
for the two seconds, rather than three, is to function as a middle ground: Not long enough
that the user would think that something has taken too long, for also not so fast as to
happen too soon.

See also
https://www.psychologytoday.com/blog/all-about-addiction/201101/tick-tock-tick-hugs-and-life-in-3-second-intervals
(the actual paper is hidden behind an academic paywall and consequently not readily
available to us, so the source will have to be the blog entry above)

see also https://invent.kde.org/frameworks/kirigami/-/merge_requests/268
2021-03-31 14:44:50 +01:00
Ahmad Samir
c0274df69a Run clang-format on all cpp/h files
NO_CHANGELOG
2021-03-13 17:35:34 +00:00
Carson Black
aecf9237cc Add veryShortDuration
This adds an veryShortDuration for UI elements that should animate near instantly, but should have a hint of smoothness.
2020-12-21 14:00:22 -05:00
Noah Davis
fb883e2740 Improve the accuracy of Units.gridUnit documentation
It never held the width of an 'M', it held the height of a boundingRect that happened to contain an 'M'. The fact that there is an 'M' doesn't really matter since the bounding rect is much taller.
2020-09-19 09:58:43 -04:00
Andreas Cord-Landwehr
d10afb5d2a plasma-framework: Convert copyright statements to SPDX expressions 2020-08-13 19:08:54 +00:00
Nate Graham
0739113a44 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
2020-04-04 20:42:35 -06:00
Nate Graham
e2a13e9ac7 Revert "Make animation durations consistent with Kirigami values"
This reverts commit 049978008b.

This commit changes existing animation durations, and must be landed
simultaneously with Plasma 5.19's release so that rolling release
users don't suffer from very slow animations for a month. Will
re-land after Plasma 5.59 is tagged so it gets released with Frameworks
5.60, the dependency version for Plasma 5.19.
2020-03-24 08:36:30 -06:00
Nate Graham
049978008b 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
2020-03-20 09:43:45 -06:00
Kai Uwe Broulik
d5a5d07f0f Honor global animation speed factor
Multiplies the animation speed by the given factor.

Differential Revision: https://phabricator.kde.org/D23857
2019-09-25 15:55:17 +02:00
Laurent Montel
70a274ad3a Use override 2018-05-23 08:05:40 +02:00
Laurent Montel
a4eeca5190 Warning-- 2018-04-13 09:05:26 +02:00
Montel Laurent
7f0c023d3f Use nullptr + add explicit 2017-12-13 07:36:22 +01:00
Eike Hein
4f48901b05 Introduce units.iconSizeHints.* to provide user-configurable icon size hints
Summary:
In effect this is meant to resurrect the "Panel" icon size setting from
the Icons -> Advanced KCM in System Settings, for use as a ceiling on
panel icons to avoid them taking up too much space, especially in wide
vertical panels.

Previously, the actually-unused "Desktop" size hint was added to the
iconSizes map. I believe this was in error, as the size hints are
semantically different from the size classes. This patch marks the
"desktop" iconSizes map entry as deprecated and makes it available
under iconSizeHints instead.

The soon-to-be-updated D5592 will demonstrate this API in use.

CCBUG:378443

Reviewers: #plasma, mart

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5593
2017-04-26 20:41:06 +09:00
David Edmundson
66ebf2c84f Part Revert "[Units] Make iconSizes property constant"
Summary:
Though we can make the property constant, some applications still use the
signal (for example FolderView.qml) to know that one of the icons has
changed sizes and do some processing.

Whilst it would be possible to fix folderview, we should avoid public
API changes.

Reviewers: #plasma, #frameworks

Subscribers: plasma-devel

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4092
2017-01-12 11:51:17 +00:00
Kai Uwe Broulik
4479fdab7f [Units] Make iconSizes property constant
It's not the property that changes (we don't assign a new QQmlPropertyMap) but
the properties within and it's already smart enough to signal this.

Differential Revision: https://phabricator.kde.org/D4013
2017-01-08 16:02:56 +01:00
Kai Uwe Broulik
56773014e1 Introduce Units singleton
Every single (Frame)SvgItem would creates its own Units instance which in turn would
create a property map for icon sizes and lots of other stuff. Avoid this.

CHANGELOG: There is now a global "Units" instance reducing memory consumption and creation time of SVG items

Differential Revision: https://phabricator.kde.org/D4012
2017-01-08 16:00:20 +01:00
Montel Laurent
39adcec588 Add missing Q_dECL_OVERRIDE 2017-01-03 09:13:39 +01:00
David Edmundson
3f53070185 Q_INVOKABLE needs to be outside the /// @cond INTERNAL_DOCS 2016-07-20 12:05:12 -03:00
Aleix Pol
978529d175 Remove unused variable
Reviewed by Marco Martin
2016-02-18 17:03:49 +01:00
Marco Martin
a9d3d9a81a make event filters static to decrease installed filters on qApp
since seems there are so many event filters installed
on the QApplication installed that may give performanc
 issues, try to use separate, singleton watchers for them
to decrease the amount of eventfilters called

REVIEW:126113
2015-11-20 14:26:16 +01:00
Bhushan Shah
4fcb1c6dc5 Fix documentation of gridUnit
gridUnit doesn't correspond to milimetter but size of capital M

REVIEW: 125099
2015-09-08 12:25:40 +05:30
Kevin Funk
7e302a5236 Use Q_DECL_OVERRIDE where possible
REVIEW: 122542
2015-02-13 13:31:58 +01:00
David Edmundson
2de3f489d3 Don't create a Plasma::Theme in units which is unused
Unit now takes all fonts from the default system font, which we monitor
for with an eventFilter on the application object.

Change-Id: Ib17c01e2811c0c672be18a930d625d84ecd154a4
2014-12-11 18:33:16 +01:00
David Edmundson
901cc3e159 Do not keep reparsing plasmarc configuration
KConfig->reparseConfiguration is expensive. It throws away our cached
values.

The Units constructor was calling this every single time. Units is
created a _lot_; once per applet and once per FrameSVGItem.

This meant we were reloading the same config ~100 times on startup for
no reason.

Perf showed this as being ~5% of the total startup time.

-    7.47%     0.00%      plasmashell  libKF5ConfigCore.so.5.5.0
                   [.] KConfig::reparseConfiguration()

   - KConfig::reparseConfiguration()

      + 66.51% Units::settingsFileChanged(QString const&)

      + 25.95% KConfig::KConfig(QString const&,
QFlags<KConfig::OpenFlag>, QStandardPaths::StandardLocation)

      + 3.93% KDesktopFile::KDesktopFile(QString const&)

      + 3.61% Units::settingsFileChanged(QString const&)

Change-Id: Ia70b7001ba473c8063e6c999b8e4233ea5b206f5
2014-12-11 01:04:57 +01:00
Marco Martin
8aab4ac9c7 share icon rounding code between Units/IconItem
it should ensure both share the same behavior

Change-Id: I2de37f5fb43bdcdd482ede9252c68fc207efbe39
2014-09-25 14:48:45 +02:00
Marco Martin
b98fdd7753 introduce roundToIconSize(int size)
return a size rounded tothe nearest inferior standard icon size.
sizes larger than iconSizes.huge, it will be returned unmodified
Reviewed by: Kai Uwe Broulik <kde@privat.broulik.de>

Change-Id: I85c575ea1cc7965ae9bede9e5a8b7b4cb342580e
2014-09-19 16:38:22 +02:00
David Edmundson
9f18d8c9e1 hide non qml accessible internal member functions from QML docs 2014-08-13 00:57:42 +02:00
David Edmundson
5478c7e3c2 Add more missing @class and @short descriptors 2014-08-12 23:15:57 +02:00
Sebastian Kügler
f8422b903c Fix APIDOX for some properties 2014-06-19 03:10:43 +02:00
Marco Martin
06d8fea792 get rid of displayAspectRatio
this property is broken by design: units doesn't know anything about views, therefore it can't know what is the current screem
BUG:333068
2014-04-09 12:00:10 +02:00
Ivan Čukić
6008c889f5 Added the units.displayAspectRatio property 2014-03-06 20:24:41 +01:00
David Edmundson
aada92247c Fix documentation 2014-02-05 20:04:33 +01:00
Sebastian Kügler
52c489eee5 Units reads longDuration from config file.
This reads the global animation duration value from plasmarc, and gets
notified of changes: change the file, all animations are updated
automatically.

Put this into your plasmarc to disable animations globally:

[Units]
longDuration=0

As you might guess, other values will work as well.

shortDuration will always be 1/5 of this. (For now.)
2014-02-04 03:25:51 +01:00
Sebastian Kügler
90d2afb722 Cleanups in units 2014-02-03 16:32:29 +01:00
Sebastian Kügler
30e98ba8f7 units.longDuration and units.shortDuration properties
These centralize the duration of animations, currently set to 250 and 50
milliseconds. They're notifiable since we want to be able to switch off
animations at runtime.

CCMAIL:plasma-devel@kde.org
2014-02-03 16:30:50 +01:00
Sebastian Kügler
6dfb4f240b Make setDevicePixelRatio(qreal) a simple slot 2014-01-28 13:49:23 +01:00
Sebastian Kügler
2a217dff0a Remove unneeded API
- dpi(QQI*) and printScreenInfo(QQI*) goes away, they're mainly useful for
  testing.
- setDevicePixelRatio goes private
- clarify DPI computation
2014-01-28 01:15:38 +01:00
Sebastian Kügler
b102ae5e45 Complete apidocs for Units. 2014-01-27 19:51:08 +01:00
Sebastian Kügler
b1bc20259a units.dp and units.du be gone
- They're not used
- They're conceptually broken and arbitrary to our scaling concepts
- The implementation as Q_INVOKABLE isn't very useful
2014-01-25 03:35:00 +01:00
Sebastian Kügler
c8ba9746f2 iconSizes.default be gone
This is used nowhere, so better get rid of it before someone gets the
idea.

Leaves us with only one non-scaled icon size. Maybe worth considering to
get rid of this as well, and let Folderview decide?
2014-01-25 03:30:45 +01:00
Sebastian Kügler
124ae423c1 Scale units.iconSizes with dpi
This is still pretty rough. It seems to work fine for larger icons, but
smaller ones get misaligned. This will need some corrections, such as
locking the smaller sizes to 16, 22, 32, 48, 64, which should take care
of this issue.

With this change, parts of Plasma scale depending on the DPI. This is
noticeable in Kickoff.
2014-01-25 02:40:52 +01:00
Sebastian Kügler
6d9022dca2 Use int for units.gridUnit
It was an int already anyway, so let's be true about this and also
return an int. This reflects pixel-alignment in the API, not just in the
implementation.
2014-01-24 12:33:39 +01:00
Sebastian Kügler
e346c751ec Allow to reset devicePixelRatio
Setting devicePixelRatio to 0 re-reads it and resets it to its default
value.
2014-01-23 04:05:45 +01:00
Sebastian Kügler
cca8a86f98 Rename units.dpiScale to units.devicePixelRatio 2014-01-23 02:18:06 +01:00
Sebastian Kügler
a70dd8c299 theme.defaultIconSize moves to units.iconSizes.default 2014-01-23 01:47:42 +01:00
Sebastian Kügler
4da01ebce0 spacing hints move from theme to units 2014-01-23 01:26:19 +01:00
Sebastian Kügler
e10b77f236 Move units from PlasmaComponents into PlasmaCore 2014-01-23 00:06:43 +01:00