-
Notifications
You must be signed in to change notification settings - Fork 66
Tray load animation #1555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Tray load animation #1555
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,11 @@ import org.deepin.ds.dock.tray 1.0 as DDT | |
| Control { | ||
| id: root | ||
| property bool itemVisible: { | ||
| // Startup phase: hide all items without triggering animations | ||
| if (DDT.TraySortOrderModel.startupPhase) { | ||
| return false | ||
| } | ||
| // Update phase: hide to avoid layout flicker | ||
| if (DDT.TraySortOrderModel.isUpdating) { | ||
| return false | ||
| } | ||
|
|
@@ -54,6 +59,13 @@ Control { | |
| NumberAnimation { duration: 200; easing.type: collapsed || !DDT.TraySortOrderModel.isCollapsing ? Easing.OutQuad : Easing.InQuad } | ||
| } | ||
| states: [ | ||
| State { | ||
| name: "startup-hidden" | ||
| when: DDT.TraySortOrderModel.startupPhase | ||
| PropertyChanges { target: root; opacity: 0.0 } | ||
| PropertyChanges { target: root; scale: 0.8 } | ||
| PropertyChanges { target: root; visible: false } | ||
| }, | ||
| State { | ||
| when: root.itemVisible | ||
| PropertyChanges { target: root; opacity: 1.0 } | ||
|
|
@@ -68,6 +80,17 @@ Control { | |
| } | ||
| ] | ||
| transitions: [ | ||
| Transition { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Transition from "startup-hidden" to "*" may override the dedicated "item-invisible" transition. Since |
||
| from: "startup-hidden" | ||
| to: "*" | ||
| SequentialAnimation { | ||
| PropertyAction { target: root; property: "visible"; value: true } | ||
| ParallelAnimation { | ||
| NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 300; easing.type: Easing.OutQuad } | ||
| NumberAnimation { property: "scale"; from: 0.8; to: 1.0; duration: 300; easing.type: Easing.OutBack } | ||
| } | ||
| } | ||
| }, | ||
| Transition { | ||
| to: "item-invisible" | ||
| SequentialAnimation { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,11 +6,12 @@ | |
| #include "constants.h" | ||
| #include "trayitempositionmanager.h" | ||
|
|
||
| #include <QDebug> | ||
| #include <QDBusMessage> | ||
| #include <QDBusConnection> | ||
| #include <QTimer> | ||
|
|
||
| #include <DConfig> | ||
|
|
||
| namespace docktray { | ||
|
|
||
|
|
@@ -63,6 +64,18 @@ | |
| qDebug() << "actionsAlwaysVisibleChanged"; | ||
| updateVisualIndexes(); | ||
| }); | ||
|
|
||
| // Startup phase timer: end startup phase after 500ms of no new surfaces | ||
| m_startupTimer = new QTimer(this); | ||
| m_startupTimer->setSingleShot(true); | ||
| m_startupTimer->setInterval(500); | ||
|
Comment on lines
+68
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: Consider a fallback to end startupPhase even when no surfaces ever appear. Since the timer only starts in onAvailableSurfacesChanged, m_startupPhase never ends if no tray surfaces ever appear and QML will keep items hidden indefinitely. Consider starting the timer once in the constructor (or adding an initial one-shot) so startupPhase finishes even when there are no surfaces. |
||
| connect(m_startupTimer, &QTimer::timeout, this, [this](){ | ||
| if (m_startupPhase) { | ||
| qDebug() << "Startup phase ended, showing all tray items"; | ||
| setStartupPhase(false); | ||
| } | ||
| }); | ||
|
|
||
| updateVisualIndexes(); | ||
| } | ||
|
|
||
|
|
@@ -577,6 +590,24 @@ | |
| updateVisualIndexes(); | ||
| // and also save the current sort order | ||
| saveDataToDConfig(); | ||
|
|
||
| // During startup phase, reset timer on each new surface to batch updates | ||
| if (m_startupPhase && m_startupTimer) { | ||
| m_startupTimer->start(); | ||
| } | ||
| } | ||
|
|
||
| bool TraySortOrderModel::startupPhase() const | ||
| { | ||
| return m_startupPhase; | ||
| } | ||
|
|
||
| void TraySortOrderModel::setStartupPhase(bool phase) | ||
| { | ||
| if (m_startupPhase == phase) | ||
| return; | ||
| m_startupPhase = phase; | ||
| emit startupPhaseChanged(phase); | ||
| } | ||
|
|
||
| void TraySortOrderModel::handlePluginVisibleChanged(const QString &surfaceId, bool visible) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Same transition precedence issue for stashed items as in TrayItemPositioner.
In this case
from: "startup-hidden"; to: "*"also matchesstartup-hidden -> item-invisible, so the show animation runs even when the item should stay hidden. Restrict thetostate (e.g., only the visible state) or adjust transition order to prevent animations for items that remain invisible after startup.