Show progress bar when loading past room events
This commit is contained in:
parent
026c049d62
commit
c99ca8de44
1
TODO.md
1
TODO.md
|
@ -135,7 +135,6 @@
|
||||||
- Server selection
|
- Server selection
|
||||||
- Register/Reset for AddAccount page
|
- Register/Reset for AddAccount page
|
||||||
- Prevent using an alias if that user is not in the room or no permission
|
- Prevent using an alias if that user is not in the room or no permission
|
||||||
- Spinner when loading past room events
|
|
||||||
|
|
||||||
- Theming
|
- Theming
|
||||||
- Bundle fonts
|
- Bundle fonts
|
||||||
|
|
|
@ -27,7 +27,7 @@ ProgressBar {
|
||||||
Behavior on color { HColorAnimation {} }
|
Behavior on color { HColorAnimation {} }
|
||||||
|
|
||||||
HNumberAnimation on x {
|
HNumberAnimation on x {
|
||||||
running: bar.indeterminate
|
running: bar.visible && bar.indeterminate
|
||||||
duration: theme.animationDuration * 8
|
duration: theme.animationDuration * 8
|
||||||
from: 0
|
from: 0
|
||||||
to: bar.width - indicator.width
|
to: bar.width - indicator.width
|
||||||
|
|
|
@ -12,6 +12,7 @@ Item {
|
||||||
property string userId: ""
|
property string userId: ""
|
||||||
property string roomId: ""
|
property string roomId: ""
|
||||||
|
|
||||||
|
property bool loadingMessages: false
|
||||||
property bool ready: userInfo !== "waiting" && roomInfo !== "waiting"
|
property bool ready: userInfo !== "waiting" && roomInfo !== "waiting"
|
||||||
|
|
||||||
readonly property var userInfo:
|
readonly property var userInfo:
|
||||||
|
|
|
@ -22,6 +22,10 @@ HPage {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadingRoomProgressBar {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
EventList {
|
EventList {
|
||||||
id: eventList
|
id: eventList
|
||||||
|
|
||||||
|
|
11
src/qml/Chat/LoadingRoomProgressBar.qml
Normal file
11
src/qml/Chat/LoadingRoomProgressBar.qml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import QtQuick 2.12
|
||||||
|
import QtQuick.Layouts 1.12
|
||||||
|
import "../Base"
|
||||||
|
|
||||||
|
HProgressBar {
|
||||||
|
indeterminate: true
|
||||||
|
height: chat.loadingMessages ? implicitHeight : 0
|
||||||
|
visible: height > 0
|
||||||
|
|
||||||
|
Behavior on height { HNumberAnimation {} }
|
||||||
|
}
|
|
@ -128,7 +128,8 @@ Rectangle {
|
||||||
// component is destroyed but func is still running
|
// component is destroyed but func is still running
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eventList.canLoad = false
|
eventList.canLoad = false
|
||||||
|
chat.loadingMessages = true
|
||||||
|
|
||||||
py.callClientCoro(
|
py.callClientCoro(
|
||||||
chat.userId, "load_past_events", [chat.roomId],
|
chat.userId, "load_past_events", [chat.roomId],
|
||||||
|
@ -136,9 +137,12 @@ Rectangle {
|
||||||
try {
|
try {
|
||||||
eventList.canLoad = moreToLoad
|
eventList.canLoad = moreToLoad
|
||||||
|
|
||||||
// If loaded messages aren't enough to fill
|
// Call yPosChanged() to run this func again
|
||||||
// the screen, ensure this function runs again
|
// if the loaded messages aren't enough to fill
|
||||||
|
// the screen.
|
||||||
if (moreToLoad) yPosChanged()
|
if (moreToLoad) yPosChanged()
|
||||||
|
|
||||||
|
chat.loadingMessages = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user