-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: timestamp shows yesterday for a message received 3 days ago
- introduce one global update timer, to be used in various components for date/time sensitive updates (StatusSharedUpdateTimer) - this timer runs only when the app is/becomes active - use the timer's `triggered()` signal to update the timestamp label when needed; ie. if it's to display a relative timestamp and it's currently visible Fixes #11460
- Loading branch information
Showing
4 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pragma Singleton | ||
|
||
import QtQml 2.15 | ||
|
||
QtObject { | ||
id: root | ||
|
||
readonly property alias secondsActive: d.secondsActive | ||
|
||
signal triggered() | ||
|
||
readonly property Timer d: Timer { | ||
id: d | ||
property int secondsActive: 0 | ||
interval: 1000 | ||
running: Qt.application.state === Qt.ApplicationActive | ||
repeat: true | ||
onTriggered: { | ||
d.secondsActive++ | ||
root.triggered() | ||
} | ||
onRunningChanged: { | ||
if (running) { | ||
d.secondsActive++ | ||
root.triggered() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters