Load Chat faster by delaying EventList loading

This commit is contained in:
miruka
2020-03-11 12:53:55 -04:00
parent 8a43690676
commit b26fe10810
4 changed files with 36 additions and 9 deletions

View File

@@ -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 } }
}

View File

@@ -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
}
}

View File

@@ -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