Add direct chat && fix compilation issue.
This commit is contained in:
parent
ac12a9a3c3
commit
1ddfbddc74
|
@ -0,0 +1,5 @@
|
|||
import QtQuick 2.9
|
||||
|
||||
Item {
|
||||
|
||||
}
|
|
@ -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" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import QtQuick 2.9
|
||||
|
||||
Item {
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
2
res.qrc
2
res.qrc
|
@ -25,5 +25,7 @@
|
|||
<file>qml/component/AvatarContainer.qml</file>
|
||||
<file>qml/form/RoomListForm.qml</file>
|
||||
<file>qml/component/AudioBubble.qml</file>
|
||||
<file>qml/form/SettingForm.qml</file>
|
||||
<file>qml/Setting.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue