diff --git a/qml/Room.qml b/qml/Room.qml
index 9a8e3f7..c62f3e6 100644
--- a/qml/Room.qml
+++ b/qml/Room.qml
@@ -15,7 +15,8 @@ Page {
connection: page.connection
- onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName)
+ onRoomAdded: setting.lazyLoad ? {} : room.getPreviousContent(20)
+ onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName)
}
RowLayout {
diff --git a/qml/Setting.qml b/qml/Setting.qml
index 4eaa742..82cca7d 100644
--- a/qml/Setting.qml
+++ b/qml/Setting.qml
@@ -7,8 +7,10 @@ import "component"
import "form"
Page {
+ property alias lazyLoad: generalForm.lazyLoad
property alias darkTheme: appearanceForm.darkTheme
property alias miniMode: appearanceForm.miniMode
+
property var connection
SettingAccountForm {
@@ -16,6 +18,11 @@ Page {
parent: null
}
+ SettingGeneralForm {
+ id: generalForm
+ parent: null
+ }
+
SettingAppearanceForm {
id: appearanceForm
parent: null
@@ -36,6 +43,13 @@ Page {
onClicked: pushToStack(accountForm)
}
+ ItemDelegate {
+ Layout.fillWidth: true
+
+ text: "General"
+ onClicked: pushToStack(generalForm)
+ }
+
ItemDelegate {
Layout.fillWidth: true
diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml
index c82d7c8..c5588d7 100644
--- a/qml/form/RoomForm.qml
+++ b/qml/form/RoomForm.qml
@@ -43,9 +43,16 @@ Item {
Label {
width: parent.width
+ horizontalAlignment: Text.AlignHCenter
text: currentRoom && currentRoom.id ? currentRoom.id : ""
}
+ Label {
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ text: currentRoom && currentRoom.canonicalAlias ? currentRoom.canonicalAlias : "No Canonical Alias"
+ }
+
RowLayout {
width: parent.width
@@ -109,6 +116,12 @@ Item {
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: roomDrawer.open()
+ }
+
RowLayout {
anchors.fill: parent
anchors.margins: 16
@@ -122,12 +135,17 @@ Item {
displayText: currentRoom ? currentRoom.displayName : ""
}
- Column {
+ ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+
+ visible: parent.width > 80
Label {
- width: parent.width
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
text: currentRoom ? currentRoom.displayName : ""
font.pointSize: 16
elide: Text.ElideRight
@@ -135,18 +153,14 @@ Item {
}
Label {
- width: parent.width
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
text: currentRoom ? currentRoom.topic : ""
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
-
- ToolButton {
- contentItem: MaterialIcon { icon: "\ue5d2" }
-
- onClicked: roomDrawer.open()
- }
}
}
diff --git a/qml/form/RoomListForm.qml b/qml/form/RoomListForm.qml
index bb5975a..f8b42bc 100644
--- a/qml/form/RoomListForm.qml
+++ b/qml/form/RoomListForm.qml
@@ -226,5 +226,5 @@ Item {
}
}
- onCurrentRoomChanged: if (currentRoom && !currentRoom.timelineSize) currentRoom.getPreviousContent(20)
+ onCurrentRoomChanged: setting.lazyLoad && currentRoom && !currentRoom.timelineSize ? currentRoom.getPreviousContent(20) : {}
}
diff --git a/qml/form/SettingGeneralForm.qml b/qml/form/SettingGeneralForm.qml
new file mode 100644
index 0000000..75bfc14
--- /dev/null
+++ b/qml/form/SettingGeneralForm.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.9
+import QtQuick.Controls 2.2
+
+Page {
+ property alias lazyLoad: lazyLoadSwitch.checked
+
+ Column {
+ Switch {
+ id: lazyLoadSwitch
+ text: "Lazy Load at Initial Sync"
+ }
+ }
+}
diff --git a/qml/main.qml b/qml/main.qml
index 1effbad..34bcb56 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -32,6 +32,8 @@ ApplicationWindow {
property alias userID: matriqueController.userID
property alias token: matriqueController.token
+ property alias lazyLoad: settingPage.lazyLoad
+
property alias darkTheme: settingPage.darkTheme
property alias miniMode: settingPage.miniMode
}
diff --git a/res.qrc b/res.qrc
index 5f96f1e..93f5142 100644
--- a/res.qrc
+++ b/res.qrc
@@ -29,5 +29,6 @@
qml/form/SettingAppearanceForm.qml
qml/component/TextDelegate.qml
qml/component/MessageContextMenu.qml
+ qml/form/SettingGeneralForm.qml
diff --git a/src/roomlistmodel.cpp b/src/roomlistmodel.cpp
index bb6018b..bd19340 100644
--- a/src/roomlistmodel.cpp
+++ b/src/roomlistmodel.cpp
@@ -42,6 +42,7 @@ void RoomListModel::doAddRoom(Room* r) {
if (auto* room = r) {
m_rooms.append(room);
connectRoomSignals(room);
+ emit roomAdded(room);
} else {
qCritical() << "Attempt to add nullptr to the room list";
Q_ASSERT(false);
diff --git a/src/roomlistmodel.h b/src/roomlistmodel.h
index fb4d02f..fb86e83 100644
--- a/src/roomlistmodel.h
+++ b/src/roomlistmodel.h
@@ -53,6 +53,7 @@ class RoomListModel : public QAbstractListModel {
signals:
void connectionChanged();
+ void roomAdded(Room* room);
void newMessage(Room* room);
};