2018-09-17 13:01:02 +00:00
|
|
|
#ifndef SpectralRoom_H
|
|
|
|
#define SpectralRoom_H
|
2018-08-18 08:02:47 +00:00
|
|
|
|
|
|
|
#include "room.h"
|
2018-10-22 13:08:24 +00:00
|
|
|
#include "spectraluser.h"
|
2018-08-18 08:02:47 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
2018-11-07 08:29:24 +00:00
|
|
|
#include <QPointer>
|
2018-08-20 14:40:36 +00:00
|
|
|
#include <QTimer>
|
2018-08-18 08:02:47 +00:00
|
|
|
|
|
|
|
using namespace QMatrixClient;
|
|
|
|
|
2018-09-17 13:01:02 +00:00
|
|
|
class SpectralRoom : public Room {
|
2018-08-18 08:02:47 +00:00
|
|
|
Q_OBJECT
|
2018-08-20 14:40:36 +00:00
|
|
|
Q_PROPERTY(bool hasUsersTyping READ hasUsersTyping NOTIFY typingChanged)
|
2018-12-23 03:24:01 +00:00
|
|
|
Q_PROPERTY(QVariantList usersTyping READ getUsersTyping NOTIFY typingChanged)
|
2018-08-18 08:02:47 +00:00
|
|
|
Q_PROPERTY(QString cachedInput READ cachedInput WRITE setCachedInput NOTIFY
|
|
|
|
cachedInputChanged)
|
2018-10-20 14:06:44 +00:00
|
|
|
Q_PROPERTY(bool hasFileUploading READ hasFileUploading NOTIFY
|
|
|
|
hasFileUploadingChanged)
|
|
|
|
Q_PROPERTY(int fileUploadingProgress READ fileUploadingProgress NOTIFY
|
|
|
|
fileUploadingProgressChanged)
|
2018-09-30 14:13:54 +00:00
|
|
|
Q_PROPERTY(bool busy READ busy NOTIFY busyChanged)
|
|
|
|
|
2018-08-18 08:02:47 +00:00
|
|
|
public:
|
2018-09-17 13:01:02 +00:00
|
|
|
explicit SpectralRoom(Connection* connection, QString roomId,
|
2018-08-18 08:02:47 +00:00
|
|
|
JoinState joinState = {});
|
|
|
|
|
|
|
|
const QString& cachedInput() const { return m_cachedInput; }
|
|
|
|
void setCachedInput(const QString& input) {
|
|
|
|
if (input != m_cachedInput) {
|
|
|
|
m_cachedInput = input;
|
|
|
|
emit cachedInputChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-30 14:13:54 +00:00
|
|
|
bool busy() { return m_busy; }
|
|
|
|
void setBusy(bool value) {
|
|
|
|
if (m_busy != value) {
|
|
|
|
m_busy = value;
|
|
|
|
emit busyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-20 14:40:36 +00:00
|
|
|
bool hasUsersTyping();
|
2018-12-23 03:24:01 +00:00
|
|
|
QVariantList getUsersTyping();
|
2018-08-20 14:40:36 +00:00
|
|
|
|
2018-08-22 15:21:39 +00:00
|
|
|
QString lastEvent();
|
2018-09-06 04:34:15 +00:00
|
|
|
bool isEventHighlighted(const QMatrixClient::RoomEvent* e) const;
|
2018-08-22 15:21:39 +00:00
|
|
|
|
2018-09-18 12:57:38 +00:00
|
|
|
QDateTime lastActiveTime();
|
|
|
|
|
2018-10-20 14:06:44 +00:00
|
|
|
bool hasFileUploading() { return m_hasFileUploading; }
|
|
|
|
void setHasFileUploading(bool value) {
|
|
|
|
if (m_hasFileUploading != value) {
|
|
|
|
m_hasFileUploading = value;
|
|
|
|
emit hasFileUploadingChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int fileUploadingProgress() { return m_fileUploadingProgress; }
|
|
|
|
void setFileUploadingProgress(int value) {
|
|
|
|
if (m_fileUploadingProgress != value) {
|
|
|
|
m_fileUploadingProgress = value;
|
|
|
|
emit fileUploadingProgressChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-28 11:47:17 +00:00
|
|
|
Q_INVOKABLE int savedTopVisibleIndex() const;
|
|
|
|
Q_INVOKABLE int savedBottomVisibleIndex() const;
|
|
|
|
Q_INVOKABLE void saveViewport(int topIndex, int bottomIndex);
|
2018-09-19 23:01:55 +00:00
|
|
|
|
2018-10-07 12:38:30 +00:00
|
|
|
Q_INVOKABLE void getPreviousContent(int limit = 10);
|
|
|
|
|
2018-10-22 13:08:24 +00:00
|
|
|
Q_INVOKABLE QVariantList getUsers(const QString& prefix);
|
|
|
|
|
2018-08-18 08:02:47 +00:00
|
|
|
private:
|
2018-08-19 06:32:18 +00:00
|
|
|
QString m_cachedInput;
|
2018-09-06 04:34:15 +00:00
|
|
|
QSet<const QMatrixClient::RoomEvent*> highlights;
|
2018-08-18 08:02:47 +00:00
|
|
|
|
2018-10-20 14:06:44 +00:00
|
|
|
bool m_hasFileUploading = false;
|
|
|
|
int m_fileUploadingProgress = 0;
|
|
|
|
|
2018-11-07 08:29:24 +00:00
|
|
|
bool m_busy = false;
|
2018-09-30 14:13:54 +00:00
|
|
|
|
2018-08-18 08:02:47 +00:00
|
|
|
void postFile(const QUrl& localFile, const QUrl& mxcUrl);
|
|
|
|
|
2018-09-06 04:34:15 +00:00
|
|
|
void checkForHighlights(const QMatrixClient::TimelineItem& ti);
|
|
|
|
|
|
|
|
void onAddNewTimelineEvents(timeline_iter_t from) override;
|
|
|
|
void onAddHistoricalTimelineEvents(rev_iter_t from) override;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void countChanged();
|
|
|
|
|
2018-08-18 08:02:47 +00:00
|
|
|
signals:
|
|
|
|
void cachedInputChanged();
|
2018-09-30 14:13:54 +00:00
|
|
|
void busyChanged();
|
2018-10-20 14:06:44 +00:00
|
|
|
void hasFileUploadingChanged();
|
|
|
|
void fileUploadingProgressChanged();
|
2018-08-18 08:02:47 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void chooseAndUploadFile();
|
|
|
|
void saveFileAs(QString eventId);
|
|
|
|
void acceptInvitation();
|
|
|
|
void forget();
|
2018-08-20 14:40:36 +00:00
|
|
|
void sendTypingNotification(bool isTyping);
|
2018-09-18 12:57:38 +00:00
|
|
|
void sendReply(QString userId, QString eventId, QString replyContent,
|
|
|
|
QString sendContent);
|
2018-08-18 08:02:47 +00:00
|
|
|
};
|
|
|
|
|
2018-09-17 13:01:02 +00:00
|
|
|
#endif // SpectralRoom_H
|