diff --git a/qml/Setting.qml b/qml/Setting.qml
new file mode 100644
index 0000000..2859cca
--- /dev/null
+++ b/qml/Setting.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.9
+
+Item {
+
+}
diff --git a/qml/form/RoomListForm.qml b/qml/form/RoomListForm.qml
index 88ec700..b9d3eb0 100644
--- a/qml/form/RoomListForm.qml
+++ b/qml/form/RoomListForm.qml
@@ -100,11 +100,13 @@ Item {
}
proxyRoles: [
ExpressionRole { name: "isFavorite"; expression: category === "Favorites" },
+ ExpressionRole { name: "isDirectChat"; expression: category === "People" },
ExpressionRole { name: "isLowPriority"; expression: category === "Low Priorities" }
]
sorters: [
RoleSorter { roleName: "isFavorite"; sortOrder: Qt.DescendingOrder },
RoleSorter { roleName: "isLowPriority" },
+ RoleSorter { roleName: "isDirectChat" },
StringSorter { roleName: "name" }
]
}
diff --git a/qml/form/SettingForm.qml b/qml/form/SettingForm.qml
new file mode 100644
index 0000000..2859cca
--- /dev/null
+++ b/qml/form/SettingForm.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.9
+
+Item {
+
+}
diff --git a/qml/main.qml b/qml/main.qml
index 6f5ceb3..53bbfb8 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -3,7 +3,7 @@ import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.2
import QtGraphicalEffects 1.0
-import Qt.labs.settings 1.0
+import Qt.labs.settings 1.0 as Settings
import Qt.labs.platform 1.0 as Platform
import Matrique 0.1
@@ -21,7 +21,7 @@ ApplicationWindow {
FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" }
- Settings {
+ Settings.Settings {
id: setting
property alias homeserver: matriqueController.homeserver
property alias userID: matriqueController.userID
diff --git a/res.qrc b/res.qrc
index 1f2d682..ce9cec1 100644
--- a/res.qrc
+++ b/res.qrc
@@ -25,5 +25,7 @@
qml/component/AvatarContainer.qml
qml/form/RoomListForm.qml
qml/component/AudioBubble.qml
+ qml/form/SettingForm.qml
+ qml/Setting.qml
diff --git a/src/roomlistmodel.cpp b/src/roomlistmodel.cpp
index 06b97a9..29134ad 100644
--- a/src/roomlistmodel.cpp
+++ b/src/roomlistmodel.cpp
@@ -12,10 +12,10 @@ void RoomListModel::setConnection(QMatrixClient::Connection* connection) {
Q_ASSERT(connection);
using QMatrixClient::Room;
- beginResetModel();
m_connection = connection;
- m_rooms.clear();
+ connect(connection, &QMatrixClient::Connection::connected, this,
+ &RoomListModel::doResetModel);
connect(connection, &QMatrixClient::Connection::invitedRoom, this,
&RoomListModel::updateRoom);
connect(connection, &QMatrixClient::Connection::joinedRoom, this,
@@ -25,8 +25,13 @@ void RoomListModel::setConnection(QMatrixClient::Connection* connection) {
connect(connection, &QMatrixClient::Connection::aboutToDeleteRoom, this,
&RoomListModel::deleteRoom);
- for (auto r : connection->roomMap()) doAddRoom(r);
+ doResetModel();
+}
+void RoomListModel::doResetModel() {
+ beginResetModel();
+ m_rooms.clear();
+ for (auto r : m_connection->roomMap()) doAddRoom(r);
endResetModel();
}
@@ -129,7 +134,10 @@ QVariant RoomListModel::data(const QModelIndex& index, int role) const {
return room->topic();
}
if (role == CategoryRole) {
+ // if (!room->isDirectChat())
+ // qDebug() << room->displayName() << "is not direct.";
if (room->isFavourite()) return "Favorites";
+ if (room->isDirectChat()) return "People";
if (room->isLowPriority()) return "Low Priorities";
return "Rooms";
}
diff --git a/src/roomlistmodel.h b/src/roomlistmodel.h
index f0c3c6f..4d87348 100644
--- a/src/roomlistmodel.h
+++ b/src/roomlistmodel.h
@@ -24,6 +24,7 @@ class RoomListModel : public QAbstractListModel {
QMatrixClient::Connection* getConnection() { return m_connection; }
void setConnection(QMatrixClient::Connection* connection);
+ void doResetModel();
Q_INVOKABLE QMatrixClient::Room* roomAt(int row);