Load Chat faster by delaying EventList loading
This commit is contained in:
parent
8a43690676
commit
b26fe10810
|
@ -37,6 +37,8 @@ HLoader {
|
|||
property var history: []
|
||||
property int historyLength: 20
|
||||
|
||||
readonly property alias appearAnimation: appearAnimation
|
||||
|
||||
|
||||
function _show(componentUrl, properties={}) {
|
||||
history.unshift([componentUrl, properties])
|
||||
|
@ -89,6 +91,6 @@ HLoader {
|
|||
from: -300
|
||||
to: 0
|
||||
easing.type: Easing.OutBack
|
||||
duration: theme.animationDuration * 2
|
||||
duration: theme.animationDuration * 1.5
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,9 @@ Item {
|
|||
width: 96 * theme.uiScale
|
||||
height: width
|
||||
|
||||
source: opacity > 0 ? "../../Base/HBusyIndicator.qml" : ""
|
||||
opacity: ready ? 0 : 1
|
||||
source: "../../Base/HBusyIndicator.qml"
|
||||
active: ready ? 0 : 1
|
||||
opacity: active ? 1 : 0
|
||||
|
||||
Behavior on opacity { HNumberAnimation { factor: 2 } }
|
||||
}
|
||||
|
|
|
@ -17,18 +17,38 @@ HColumnPage {
|
|||
|
||||
|
||||
readonly property alias composer: composer
|
||||
readonly property bool loadEventList: ! pageLoader.appearAnimation.running
|
||||
|
||||
|
||||
RoomHeader {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
EventList {
|
||||
id: eventList
|
||||
Timer {
|
||||
id: delayEventListLoadingTimer
|
||||
interval: 150
|
||||
running: true
|
||||
}
|
||||
|
||||
HLoader {
|
||||
id: eventListLoader
|
||||
sourceComponent: loadEventList ? evListComponent : placeholder
|
||||
opacity: loadEventList ? 1 : 0
|
||||
|
||||
// Avoid a certain binding loop
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Behavior on opacity { HNumberAnimation {} }
|
||||
|
||||
Component {
|
||||
id: placeholder
|
||||
Item {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: evListComponent
|
||||
EventList {}
|
||||
}
|
||||
}
|
||||
|
||||
TypingMembersBar {
|
||||
|
@ -60,8 +80,9 @@ HColumnPage {
|
|||
|
||||
Composer {
|
||||
id: composer
|
||||
visible: ! chat.roomInfo.left &&
|
||||
! chat.roomInfo.inviter_id
|
||||
eventList: loadEventList ? eventListLoader.item : null
|
||||
visible:
|
||||
! chat.roomInfo.left && ! chat.roomInfo.inviter_id
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ Rectangle {
|
|||
Layout.maximumHeight: pageLoader.height / 2
|
||||
|
||||
|
||||
property Item eventList
|
||||
|
||||
property string indent: " "
|
||||
|
||||
property var aliases: window.settings.writeAliases
|
||||
|
@ -150,7 +152,7 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
area.onSelectedTextChanged: if (area.selectedText) {
|
||||
area.onSelectedTextChanged: if (area.selectedText && eventList) {
|
||||
eventList.selectableLabelContainer.clearSelection()
|
||||
}
|
||||
|
||||
|
@ -192,6 +194,7 @@ Rectangle {
|
|||
|
||||
area.Keys.onPressed.connect(ev => {
|
||||
if (ev.matches(StandardKey.Copy) &&
|
||||
eventList &&
|
||||
eventList.selectableLabelContainer.joinedSelection
|
||||
) {
|
||||
ev.accepted = true
|
||||
|
|
Loading…
Reference in New Issue
Block a user