Prefetch messages when adding room && wire setting.
This commit is contained in:
parent
6f6a7da414
commit
c330bb4ff5
|
@ -26,7 +26,7 @@ Page {
|
||||||
id: roomListForm
|
id: roomListForm
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: settingPage.miniMode ? 80 : page.width * 0.4
|
Layout.preferredWidth: setting.miniMode ? 80 : page.width * 0.35
|
||||||
Layout.minimumWidth: 80
|
Layout.minimumWidth: 80
|
||||||
Layout.maximumWidth: 360
|
Layout.maximumWidth: 360
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,6 @@ Item {
|
||||||
model: MessageEventModel{
|
model: MessageEventModel{
|
||||||
id: messageEventModel
|
id: messageEventModel
|
||||||
room: currentRoom
|
room: currentRoom
|
||||||
|
|
||||||
onRoomChanged: room.timelineSize === 0 ? room.getPreviousContent(50) : {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: MessageDelegate {}
|
delegate: MessageDelegate {}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import "qrc:/qml/component"
|
||||||
Item {
|
Item {
|
||||||
property alias listModel: roomListProxyModel.sourceModel
|
property alias listModel: roomListProxyModel.sourceModel
|
||||||
property int currentIndex: roomListProxyModel.mapToSource(listView.currentIndex)
|
property int currentIndex: roomListProxyModel.mapToSource(listView.currentIndex)
|
||||||
readonly property bool mini: settingPage.miniMode // Used as an indicator of whether the listform should be displayed as "Mini mode".
|
readonly property bool mini: setting.miniMode // Used as an indicator of whether the listform should be displayed as "Mini mode".
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
29
qml/main.qml
29
qml/main.qml
|
@ -15,19 +15,26 @@ ApplicationWindow {
|
||||||
visible: true
|
visible: true
|
||||||
width: 960
|
width: 960
|
||||||
height: 640
|
height: 640
|
||||||
minimumWidth: 480
|
minimumWidth: 640
|
||||||
minimumHeight: 320
|
minimumHeight: 480
|
||||||
title: qsTr("Matrique")
|
title: qsTr("Matrique")
|
||||||
|
|
||||||
Material.theme: settingPage.darkTheme ? Material.Dark : Material.Light
|
Material.theme: setting.darkTheme ? Material.Dark : Material.Light
|
||||||
|
|
||||||
FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" }
|
FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" }
|
||||||
|
|
||||||
Settings.Settings {
|
Settings.Settings {
|
||||||
id: setting
|
id: setting
|
||||||
|
|
||||||
|
property alias windowWidth: window.width
|
||||||
|
property alias windowHeight: window.height
|
||||||
|
|
||||||
property alias homeserver: matriqueController.homeserver
|
property alias homeserver: matriqueController.homeserver
|
||||||
property alias userID: matriqueController.userID
|
property alias userID: matriqueController.userID
|
||||||
property alias token: matriqueController.token
|
property alias token: matriqueController.token
|
||||||
|
|
||||||
|
property alias darkTheme: settingPage.darkTheme
|
||||||
|
property alias miniMode: settingPage.miniMode
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.SystemTrayIcon {
|
Platform.SystemTrayIcon {
|
||||||
|
@ -36,7 +43,21 @@ ApplicationWindow {
|
||||||
visible: true
|
visible: true
|
||||||
iconSource: "qrc:/asset/img/icon.png"
|
iconSource: "qrc:/asset/img/icon.png"
|
||||||
|
|
||||||
onActivated: {
|
menu: Platform.Menu {
|
||||||
|
MenuItem {
|
||||||
|
text: "Hide/Show"
|
||||||
|
onTriggered: window.active ? window.hide() : raiseWindow()
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
text: "Quit"
|
||||||
|
onTriggered: Qt.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onActivated: window.active ? window.hide() : raiseWindow()
|
||||||
|
|
||||||
|
function raiseWindow() {
|
||||||
window.show()
|
window.show()
|
||||||
window.raise()
|
window.raise()
|
||||||
window.requestActivate()
|
window.requestActivate()
|
||||||
|
|
|
@ -43,6 +43,7 @@ void RoomListModel::doAddRoom(QMatrixClient::Room* r) {
|
||||||
if (auto* room = r) {
|
if (auto* room = r) {
|
||||||
m_rooms.append(room);
|
m_rooms.append(room);
|
||||||
connectRoomSignals(room);
|
connectRoomSignals(room);
|
||||||
|
if (room->timelineSize() == 0) room->getPreviousContent(50);
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "Attempt to add nullptr to the room list";
|
qCritical() << "Attempt to add nullptr to the room list";
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
|
|
Loading…
Reference in New Issue