Genesis commit.
Not really, but a lot of renaming.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "controller.h"
|
||||
|
||||
#include "matriqueroom.h"
|
||||
#include "matriqueuser.h"
|
||||
#include "spectralroom.h"
|
||||
#include "spectraluser.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "events/eventcontent.h"
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
Controller::Controller(QObject* parent) : QObject(parent) {
|
||||
tray->setIcon(QIcon(":/asset/img/icon.png"));
|
||||
tray->setToolTip("Matrique");
|
||||
tray->setToolTip("Spectral");
|
||||
connect(tray, &QSystemTrayIcon::activated,
|
||||
[this](QSystemTrayIcon::ActivationReason r) {
|
||||
if (r != QSystemTrayIcon::Context) emit showWindow();
|
||||
@@ -39,8 +39,8 @@ Controller::Controller(QObject* parent) : QObject(parent) {
|
||||
tray->setContextMenu(trayMenu);
|
||||
tray->show();
|
||||
|
||||
Connection::setRoomType<MatriqueRoom>();
|
||||
Connection::setUserType<MatriqueUser>();
|
||||
Connection::setRoomType<SpectralRoom>();
|
||||
Connection::setUserType<SpectralUser>();
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(invokeLogin()));
|
||||
}
|
||||
@@ -67,7 +67,7 @@ void Controller::loginWithCredentials(QString serverAddr, QString user,
|
||||
account.clearAccessToken(); // Drop the legacy - just in case
|
||||
account.setHomeserver(m_connection->homeserver());
|
||||
account.setDeviceId(m_connection->deviceId());
|
||||
account.setDeviceName("Matrique");
|
||||
account.setDeviceName("Spectral");
|
||||
if (!saveAccessToken(account, m_connection->accessToken()))
|
||||
qWarning() << "Couldn't save access token";
|
||||
account.sync();
|
||||
|
||||
30
src/main.cpp
30
src/main.cpp
@@ -8,7 +8,7 @@
|
||||
#include "emojimodel.h"
|
||||
#include "imageitem.h"
|
||||
#include "imageprovider.h"
|
||||
#include "matriqueroom.h"
|
||||
#include "spectralroom.h"
|
||||
#include "messageeventmodel.h"
|
||||
#include "room.h"
|
||||
#include "roomlistmodel.h"
|
||||
@@ -28,27 +28,27 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
app.setOrganizationName("ENCOM");
|
||||
app.setOrganizationDomain("encom.eu.org");
|
||||
app.setApplicationName("Matrique");
|
||||
app.setApplicationName("Spectral");
|
||||
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
qRegisterMetaType<MatriqueRoom *>("MatriqueRoom*");
|
||||
qRegisterMetaType<SpectralRoom *>("SpectralRoom*");
|
||||
qRegisterMetaType<User *>("User*");
|
||||
qRegisterMetaType<MessageEventType>("MessageEventType");
|
||||
qRegisterMetaType<MatriqueRoom *>("MatriqueRoom");
|
||||
qRegisterMetaType<SpectralRoom *>("SpectralRoom");
|
||||
|
||||
qmlRegisterType<ImageItem>("Matrique", 0, 1, "ImageItem");
|
||||
qmlRegisterType<Controller>("Matrique", 0, 1, "Controller");
|
||||
qmlRegisterType<AccountListModel>("Matrique", 0, 1, "AccountListModel");
|
||||
qmlRegisterType<RoomListModel>("Matrique", 0, 1, "RoomListModel");
|
||||
qmlRegisterType<UserListModel>("Matrique", 0, 1, "UserListModel");
|
||||
qmlRegisterType<MessageEventModel>("Matrique", 0, 1, "MessageEventModel");
|
||||
qmlRegisterType<EmojiModel>("Matrique", 0, 1, "EmojiModel");
|
||||
qmlRegisterUncreatableType<RoomMessageEvent>("Matrique", 0, 1,
|
||||
qmlRegisterType<ImageItem>("Spectral", 0, 1, "ImageItem");
|
||||
qmlRegisterType<Controller>("Spectral", 0, 1, "Controller");
|
||||
qmlRegisterType<AccountListModel>("Spectral", 0, 1, "AccountListModel");
|
||||
qmlRegisterType<RoomListModel>("Spectral", 0, 1, "RoomListModel");
|
||||
qmlRegisterType<UserListModel>("Spectral", 0, 1, "UserListModel");
|
||||
qmlRegisterType<MessageEventModel>("Spectral", 0, 1, "MessageEventModel");
|
||||
qmlRegisterType<EmojiModel>("Spectral", 0, 1, "EmojiModel");
|
||||
qmlRegisterUncreatableType<RoomMessageEvent>("Spectral", 0, 1,
|
||||
"RoomMessageEvent", "ENUM");
|
||||
qmlRegisterUncreatableType<RoomType>("Matrique", 0, 1, "RoomType", "ENUM");
|
||||
qmlRegisterSingletonType(QUrl("qrc:/qml/MatriqueSettings.qml"),
|
||||
"Matrique.Settings", 0, 1, "MSettings");
|
||||
qmlRegisterUncreatableType<RoomType>("Spectral", 0, 1, "RoomType", "ENUM");
|
||||
qmlRegisterSingletonType(QUrl("qrc:/qml/SpectralSettings.qml"),
|
||||
"Spectral.Settings", 0, 1, "MSettings");
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#include "matriqueuser.h"
|
||||
|
||||
MatriqueUser::MatriqueUser(QString userId, Connection* connection)
|
||||
: User(userId, connection) {
|
||||
connect(this, &User::avatarChanged, this, &MatriqueUser::inheritedAvatarChanged);
|
||||
}
|
||||
@@ -42,12 +42,12 @@ MessageEventModel::MessageEventModel(QObject* parent)
|
||||
qmlRegisterType<FileTransferInfo>();
|
||||
qRegisterMetaType<FileTransferInfo>();
|
||||
qmlRegisterUncreatableType<EventStatus>(
|
||||
"Matrique", 0, 1, "EventStatus", "EventStatus is not an creatable type");
|
||||
"Spectral", 0, 1, "EventStatus", "EventStatus is not an creatable type");
|
||||
}
|
||||
|
||||
MessageEventModel::~MessageEventModel() {}
|
||||
|
||||
void MessageEventModel::setRoom(MatriqueRoom* room) {
|
||||
void MessageEventModel::setRoom(SpectralRoom* room) {
|
||||
if (room == m_currentRoom) return;
|
||||
|
||||
beginResetModel();
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef MESSAGEEVENTMODEL_H
|
||||
#define MESSAGEEVENTMODEL_H
|
||||
|
||||
#include "matriqueroom.h"
|
||||
#include "spectralroom.h"
|
||||
#include "room.h"
|
||||
|
||||
#include <QtCore/QAbstractListModel>
|
||||
|
||||
class MessageEventModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(MatriqueRoom* room READ getRoom WRITE setRoom NOTIFY roomChanged)
|
||||
Q_PROPERTY(SpectralRoom* room READ getRoom WRITE setRoom NOTIFY roomChanged)
|
||||
|
||||
public:
|
||||
enum EventRoles {
|
||||
@@ -37,8 +37,8 @@ class MessageEventModel : public QAbstractListModel {
|
||||
explicit MessageEventModel(QObject* parent = nullptr);
|
||||
~MessageEventModel();
|
||||
|
||||
MatriqueRoom* getRoom() { return m_currentRoom; }
|
||||
void setRoom(MatriqueRoom* room);
|
||||
SpectralRoom* getRoom() { return m_currentRoom; }
|
||||
void setRoom(SpectralRoom* room);
|
||||
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex& index,
|
||||
@@ -50,7 +50,7 @@ class MessageEventModel : public QAbstractListModel {
|
||||
void refreshRow(int row);
|
||||
|
||||
private:
|
||||
MatriqueRoom* m_currentRoom = nullptr;
|
||||
SpectralRoom* m_currentRoom = nullptr;
|
||||
QString lastReadEventId;
|
||||
int rowBelowInserted = -1;
|
||||
bool movingEvent = 0;
|
||||
|
||||
@@ -27,7 +27,7 @@ void RoomListModel::setConnection(Connection* connection) {
|
||||
|
||||
m_connection = connection;
|
||||
|
||||
for (MatriqueRoom* room : m_rooms) room->disconnect(this);
|
||||
for (SpectralRoom* room : m_rooms) room->disconnect(this);
|
||||
|
||||
connect(connection, &Connection::connected, this,
|
||||
&RoomListModel::doResetModel);
|
||||
@@ -49,10 +49,10 @@ void RoomListModel::doResetModel() {
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
MatriqueRoom* RoomListModel::roomAt(int row) { return m_rooms.at(row); }
|
||||
SpectralRoom* RoomListModel::roomAt(int row) { return m_rooms.at(row); }
|
||||
|
||||
void RoomListModel::doAddRoom(Room* r) {
|
||||
if (auto* room = static_cast<MatriqueRoom*>(r)) {
|
||||
if (auto* room = static_cast<SpectralRoom*>(r)) {
|
||||
m_rooms.append(room);
|
||||
connectRoomSignals(room);
|
||||
emit roomAdded(room);
|
||||
@@ -62,7 +62,7 @@ void RoomListModel::doAddRoom(Room* r) {
|
||||
}
|
||||
}
|
||||
|
||||
void RoomListModel::connectRoomSignals(MatriqueRoom* room) {
|
||||
void RoomListModel::connectRoomSignals(SpectralRoom* room) {
|
||||
connect(room, &Room::displaynameChanged, this, [=] { namesChanged(room); });
|
||||
connect(room, &Room::unreadMessagesChanged, this,
|
||||
[=] { unreadMessagesChanged(room); });
|
||||
@@ -94,7 +94,7 @@ void RoomListModel::updateRoom(Room* room, Room* prev) {
|
||||
// the previously left room (in both cases prev has the previous state).
|
||||
if (prev == room) {
|
||||
qCritical() << "RoomListModel::updateRoom: room tried to replace itself";
|
||||
refresh(static_cast<MatriqueRoom*>(room));
|
||||
refresh(static_cast<SpectralRoom*>(room));
|
||||
return;
|
||||
}
|
||||
if (prev && room->id() != prev->id()) {
|
||||
@@ -103,10 +103,10 @@ void RoomListModel::updateRoom(Room* room, Room* prev) {
|
||||
// That doesn't look right but technically we still can do it.
|
||||
}
|
||||
// Ok, we're through with pre-checks, now for the real thing.
|
||||
auto* newRoom = static_cast<MatriqueRoom*>(room);
|
||||
auto* newRoom = static_cast<SpectralRoom*>(room);
|
||||
const auto it = std::find_if(
|
||||
m_rooms.begin(), m_rooms.end(),
|
||||
[=](const MatriqueRoom* r) { return r == prev || r == newRoom; });
|
||||
[=](const SpectralRoom* r) { return r == prev || r == newRoom; });
|
||||
if (it != m_rooms.end()) {
|
||||
const int row = it - m_rooms.begin();
|
||||
// There's no guarantee that prev != newRoom
|
||||
@@ -146,7 +146,7 @@ QVariant RoomListModel::data(const QModelIndex& index, int role) const {
|
||||
qDebug() << "UserListModel: something wrong here...";
|
||||
return QVariant();
|
||||
}
|
||||
MatriqueRoom* room = m_rooms.at(index.row());
|
||||
SpectralRoom* room = m_rooms.at(index.row());
|
||||
if (role == NameRole) return room->displayName();
|
||||
if (role == AvatarRole) {
|
||||
if (!room->avatarUrl().isEmpty()) return room->avatar(64, 64);
|
||||
@@ -167,12 +167,12 @@ QVariant RoomListModel::data(const QModelIndex& index, int role) const {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void RoomListModel::namesChanged(MatriqueRoom* room) {
|
||||
void RoomListModel::namesChanged(SpectralRoom* room) {
|
||||
int row = m_rooms.indexOf(room);
|
||||
emit dataChanged(index(row), index(row));
|
||||
}
|
||||
|
||||
void RoomListModel::refresh(MatriqueRoom* room, const QVector<int>& roles) {
|
||||
void RoomListModel::refresh(SpectralRoom* room, const QVector<int>& roles) {
|
||||
const auto it = std::find(m_rooms.begin(), m_rooms.end(), room);
|
||||
if (it == m_rooms.end()) {
|
||||
qCritical() << "Room" << room->id() << "not found in the room list";
|
||||
@@ -182,7 +182,7 @@ void RoomListModel::refresh(MatriqueRoom* room, const QVector<int>& roles) {
|
||||
emit dataChanged(idx, idx, roles);
|
||||
}
|
||||
|
||||
void RoomListModel::unreadMessagesChanged(MatriqueRoom* room) {
|
||||
void RoomListModel::unreadMessagesChanged(SpectralRoom* room) {
|
||||
int row = m_rooms.indexOf(room);
|
||||
emit dataChanged(index(row), index(row));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "connection.h"
|
||||
#include "events/roomevent.h"
|
||||
#include "matriqueroom.h"
|
||||
#include "spectralroom.h"
|
||||
#include "room.h"
|
||||
|
||||
#include <QtCore/QAbstractListModel>
|
||||
@@ -47,7 +47,7 @@ class RoomListModel : public QAbstractListModel {
|
||||
void setConnection(Connection* connection);
|
||||
void doResetModel();
|
||||
|
||||
Q_INVOKABLE MatriqueRoom* roomAt(int row);
|
||||
Q_INVOKABLE SpectralRoom* roomAt(int row);
|
||||
|
||||
QVariant data(const QModelIndex& index,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
@@ -57,22 +57,22 @@ class RoomListModel : public QAbstractListModel {
|
||||
QHash<int, QByteArray> roleNames() const;
|
||||
|
||||
private slots:
|
||||
void namesChanged(MatriqueRoom* room);
|
||||
void unreadMessagesChanged(MatriqueRoom* room);
|
||||
void namesChanged(SpectralRoom* room);
|
||||
void unreadMessagesChanged(SpectralRoom* room);
|
||||
|
||||
void doAddRoom(Room* room);
|
||||
void updateRoom(Room* room, Room* prev);
|
||||
void deleteRoom(Room* room);
|
||||
void refresh(MatriqueRoom* room, const QVector<int>& roles = {});
|
||||
void refresh(SpectralRoom* room, const QVector<int>& roles = {});
|
||||
|
||||
private:
|
||||
Connection* m_connection = nullptr;
|
||||
QList<MatriqueRoom*> m_rooms;
|
||||
void connectRoomSignals(MatriqueRoom* room);
|
||||
QList<SpectralRoom*> m_rooms;
|
||||
void connectRoomSignals(SpectralRoom* room);
|
||||
|
||||
signals:
|
||||
void connectionChanged();
|
||||
void roomAdded(MatriqueRoom* room);
|
||||
void roomAdded(SpectralRoom* room);
|
||||
void newMessage(const QString& roomName, const QString& content,
|
||||
const QIcon& icon);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "matriqueroom.h"
|
||||
#include "spectralroom.h"
|
||||
|
||||
#include "connection.h"
|
||||
#include "user.h"
|
||||
@@ -10,16 +10,16 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMimeDatabase>
|
||||
|
||||
MatriqueRoom::MatriqueRoom(Connection* connection, QString roomId,
|
||||
SpectralRoom::SpectralRoom(Connection* connection, QString roomId,
|
||||
JoinState joinState)
|
||||
: Room(connection, std::move(roomId), joinState) {
|
||||
connect(this, &MatriqueRoom::notificationCountChanged, this,
|
||||
&MatriqueRoom::countChanged);
|
||||
connect(this, &MatriqueRoom::highlightCountChanged, this,
|
||||
&MatriqueRoom::countChanged);
|
||||
connect(this, &SpectralRoom::notificationCountChanged, this,
|
||||
&SpectralRoom::countChanged);
|
||||
connect(this, &SpectralRoom::highlightCountChanged, this,
|
||||
&SpectralRoom::countChanged);
|
||||
}
|
||||
|
||||
void MatriqueRoom::chooseAndUploadFile() {
|
||||
void SpectralRoom::chooseAndUploadFile() {
|
||||
auto localFile = QFileDialog::getOpenFileUrl(Q_NULLPTR, tr("Save File as"));
|
||||
if (!localFile.isEmpty()) {
|
||||
uploadFile(localFile.toString(), localFile, getMIME(localFile));
|
||||
@@ -32,7 +32,7 @@ void MatriqueRoom::chooseAndUploadFile() {
|
||||
}
|
||||
}
|
||||
|
||||
void MatriqueRoom::postFile(const QUrl& localFile, const QUrl& mxcUrl) {
|
||||
void SpectralRoom::postFile(const QUrl& localFile, const QUrl& mxcUrl) {
|
||||
const QString mime = getMIME(localFile);
|
||||
const QString fileName = localFile.fileName();
|
||||
QString msgType = "m.file";
|
||||
@@ -46,21 +46,21 @@ void MatriqueRoom::postFile(const QUrl& localFile, const QUrl& mxcUrl) {
|
||||
postJson("m.room.message", json);
|
||||
}
|
||||
|
||||
QString MatriqueRoom::getMIME(const QUrl& fileUrl) const {
|
||||
QString SpectralRoom::getMIME(const QUrl& fileUrl) const {
|
||||
return QMimeDatabase().mimeTypeForFile(fileUrl.toLocalFile()).name();
|
||||
}
|
||||
|
||||
void MatriqueRoom::saveFileAs(QString eventId) {
|
||||
void SpectralRoom::saveFileAs(QString eventId) {
|
||||
auto fileName = QFileDialog::getSaveFileName(Q_NULLPTR, tr("Save File as"),
|
||||
fileNameToDownload(eventId));
|
||||
if (!fileName.isEmpty()) downloadFile(eventId, QUrl::fromLocalFile(fileName));
|
||||
}
|
||||
|
||||
void MatriqueRoom::acceptInvitation() { connection()->joinRoom(id()); }
|
||||
void SpectralRoom::acceptInvitation() { connection()->joinRoom(id()); }
|
||||
|
||||
void MatriqueRoom::forget() { connection()->forgetRoom(id()); }
|
||||
void SpectralRoom::forget() { connection()->forgetRoom(id()); }
|
||||
|
||||
bool MatriqueRoom::hasUsersTyping() {
|
||||
bool SpectralRoom::hasUsersTyping() {
|
||||
QList<User*> users = usersTyping();
|
||||
if (users.isEmpty()) return false;
|
||||
int count = users.length();
|
||||
@@ -68,7 +68,7 @@ bool MatriqueRoom::hasUsersTyping() {
|
||||
return count != 0;
|
||||
}
|
||||
|
||||
QString MatriqueRoom::getUsersTyping() {
|
||||
QString SpectralRoom::getUsersTyping() {
|
||||
QString usersTypingStr;
|
||||
QList<User*> users = usersTyping();
|
||||
users.removeOne(localUser());
|
||||
@@ -80,12 +80,12 @@ QString MatriqueRoom::getUsersTyping() {
|
||||
return usersTypingStr;
|
||||
}
|
||||
|
||||
void MatriqueRoom::sendTypingNotification(bool isTyping) {
|
||||
void SpectralRoom::sendTypingNotification(bool isTyping) {
|
||||
connection()->callApi<SetTypingJob>(BackgroundRequest, localUser()->id(),
|
||||
id(), isTyping, 10000);
|
||||
}
|
||||
|
||||
QString MatriqueRoom::lastEvent() {
|
||||
QString SpectralRoom::lastEvent() {
|
||||
if (timelineSize() == 0) return "";
|
||||
const RoomEvent* lastEvent = messageEvents().rbegin()->get();
|
||||
if (lastEvent->contentJson().value("body").toString() == "") return "";
|
||||
@@ -93,11 +93,11 @@ QString MatriqueRoom::lastEvent() {
|
||||
lastEvent->contentJson().value("body").toString();
|
||||
}
|
||||
|
||||
bool MatriqueRoom::isEventHighlighted(const RoomEvent* e) const {
|
||||
bool SpectralRoom::isEventHighlighted(const RoomEvent* e) const {
|
||||
return highlights.contains(e);
|
||||
}
|
||||
|
||||
void MatriqueRoom::checkForHighlights(const QMatrixClient::TimelineItem& ti) {
|
||||
void SpectralRoom::checkForHighlights(const QMatrixClient::TimelineItem& ti) {
|
||||
auto localUserId = localUser()->id();
|
||||
if (ti->senderId() == localUserId) return;
|
||||
if (auto* e = ti.viewAs<RoomMessageEvent>()) {
|
||||
@@ -108,30 +108,31 @@ void MatriqueRoom::checkForHighlights(const QMatrixClient::TimelineItem& ti) {
|
||||
}
|
||||
}
|
||||
|
||||
void MatriqueRoom::onAddNewTimelineEvents(timeline_iter_t from) {
|
||||
void SpectralRoom::onAddNewTimelineEvents(timeline_iter_t from) {
|
||||
std::for_each(from, messageEvents().cend(),
|
||||
[this](const TimelineItem& ti) { checkForHighlights(ti); });
|
||||
}
|
||||
|
||||
void MatriqueRoom::onAddHistoricalTimelineEvents(rev_iter_t from) {
|
||||
void SpectralRoom::onAddHistoricalTimelineEvents(rev_iter_t from) {
|
||||
std::for_each(from, messageEvents().crend(),
|
||||
[this](const TimelineItem& ti) { checkForHighlights(ti); });
|
||||
}
|
||||
|
||||
void MatriqueRoom::countChanged() {
|
||||
void SpectralRoom::countChanged() {
|
||||
if (displayed() && !hasUnreadMessages()) {
|
||||
resetNotificationCount();
|
||||
resetHighlightCount();
|
||||
}
|
||||
}
|
||||
|
||||
void MatriqueRoom::sendReply(QString userId, QString eventId,
|
||||
void SpectralRoom::sendReply(QString userId, QString eventId,
|
||||
QString replyContent, QString sendContent) {
|
||||
QJsonObject json{
|
||||
{"msgtype", "m.text"},
|
||||
{"body", "> <" + userId + "> " + replyContent + "\n\n" + sendContent},
|
||||
{"format", "org.matrix.custom.html"},
|
||||
{"m.relates_to", QJsonObject{{"m.in_reply_to", QJsonObject{{"event_id", eventId}}}}},
|
||||
{"m.relates_to",
|
||||
QJsonObject{{"m.in_reply_to", QJsonObject{{"event_id", eventId}}}}},
|
||||
{"formatted_body",
|
||||
"<mx-reply><blockquote><a href=\"https://matrix.to/#/" + id() + "/" +
|
||||
eventId + "\">In reply to</a> <a href=\"https://matrix.to/#/" +
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef MATRIQUEROOM_H
|
||||
#define MATRIQUEROOM_H
|
||||
#ifndef SpectralRoom_H
|
||||
#define SpectralRoom_H
|
||||
|
||||
#include "room.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
using namespace QMatrixClient;
|
||||
|
||||
class MatriqueRoom : public Room {
|
||||
class SpectralRoom : public Room {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY avatarChanged)
|
||||
Q_PROPERTY(bool hasUsersTyping READ hasUsersTyping NOTIFY typingChanged)
|
||||
@@ -16,7 +16,7 @@ class MatriqueRoom : public Room {
|
||||
Q_PROPERTY(QString cachedInput READ cachedInput WRITE setCachedInput NOTIFY
|
||||
cachedInputChanged)
|
||||
public:
|
||||
explicit MatriqueRoom(Connection* connection, QString roomId,
|
||||
explicit SpectralRoom(Connection* connection, QString roomId,
|
||||
JoinState joinState = {});
|
||||
|
||||
QImage getAvatar() { return avatar(128); }
|
||||
@@ -62,4 +62,4 @@ class MatriqueRoom : public Room {
|
||||
void sendReply(QString userId, QString eventId, QString replyContent, QString sendContent);
|
||||
};
|
||||
|
||||
#endif // MATRIQUEROOM_H
|
||||
#endif // SpectralRoom_H
|
||||
6
src/spectraluser.cpp
Normal file
6
src/spectraluser.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "spectraluser.h"
|
||||
|
||||
SpectralUser::SpectralUser(QString userId, Connection* connection)
|
||||
: User(userId, connection) {
|
||||
connect(this, &User::avatarChanged, this, &SpectralUser::inheritedAvatarChanged);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef MATRIQUEUSER_H
|
||||
#define MATRIQUEUSER_H
|
||||
#ifndef SpectralUser_H
|
||||
#define SpectralUser_H
|
||||
|
||||
#include "user.h"
|
||||
#include "room.h"
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
using namespace QMatrixClient;
|
||||
|
||||
class MatriqueUser : public User {
|
||||
class SpectralUser : public User {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY inheritedAvatarChanged)
|
||||
public:
|
||||
MatriqueUser(QString userId, Connection* connection);
|
||||
SpectralUser(QString userId, Connection* connection);
|
||||
|
||||
QImage getAvatar() { return avatar(128); }
|
||||
|
||||
@@ -20,4 +20,4 @@ class MatriqueUser : public User {
|
||||
void inheritedAvatarChanged(User* user, const Room* roomContext); // https://bugreports.qt.io/browse/QTBUG-7684
|
||||
};
|
||||
|
||||
#endif // MATRIQUEUSER_H
|
||||
#endif // SpectralUser_H
|
||||
Reference in New Issue
Block a user