@@ -12,6 +12,7 @@
|
||||
#include "room.h"
|
||||
#include "roomlistmodel.h"
|
||||
#include "spectralroom.h"
|
||||
#include "spectraluser.h"
|
||||
#include "userlistmodel.h"
|
||||
|
||||
#include "csapi/joining.h"
|
||||
@@ -50,6 +51,7 @@ int main(int argc, char *argv[]) {
|
||||
qRegisterMetaType<Room *>("Room*");
|
||||
qRegisterMetaType<MessageEventType>("MessageEventType");
|
||||
qRegisterMetaType<SpectralRoom *>("SpectralRoom*");
|
||||
qRegisterMetaType<SpectralUser *>("SpectralUser*");
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
|
||||
@@ -195,3 +195,13 @@ void SpectralRoom::getPreviousContent(int limit) {
|
||||
setBusy(true);
|
||||
Room::getPreviousContent(limit);
|
||||
}
|
||||
|
||||
QVariantList SpectralRoom::getUsers(const QString& prefix) {
|
||||
auto userList = users();
|
||||
QVariantList matchedList;
|
||||
for (auto u : userList)
|
||||
if (u->displayname(this).toLower().startsWith(prefix.toLower()))
|
||||
matchedList.append(QVariant::fromValue(u));
|
||||
|
||||
return matchedList;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define SpectralRoom_H
|
||||
|
||||
#include "room.h"
|
||||
#include "spectraluser.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
@@ -74,6 +75,8 @@ class SpectralRoom : public Room {
|
||||
|
||||
Q_INVOKABLE void getPreviousContent(int limit = 10);
|
||||
|
||||
Q_INVOKABLE QVariantList getUsers(const QString& prefix);
|
||||
|
||||
private:
|
||||
QString m_cachedInput;
|
||||
QSet<const QMatrixClient::RoomEvent*> highlights;
|
||||
|
||||
Reference in New Issue
Block a user