Spectral/src/spectralroom.h

89 lines
2.3 KiB
C
Raw Normal View History

#ifndef SpectralRoom_H
#define SpectralRoom_H
#include "room.h"
#include <QObject>
2018-08-20 14:40:36 +00:00
#include <QTimer>
using namespace QMatrixClient;
class SpectralRoom : public Room {
Q_OBJECT
2018-09-10 01:51:02 +00:00
Q_PROPERTY(QImage avatar READ getAvatar NOTIFY avatarChanged)
2018-08-20 14:40:36 +00:00
Q_PROPERTY(bool hasUsersTyping READ hasUsersTyping NOTIFY typingChanged)
Q_PROPERTY(QString usersTyping READ getUsersTyping NOTIFY typingChanged)
Q_PROPERTY(QString cachedInput READ cachedInput WRITE setCachedInput NOTIFY
cachedInputChanged)
Q_PROPERTY(bool busy READ busy NOTIFY busyChanged)
public:
explicit SpectralRoom(Connection* connection, QString roomId,
JoinState joinState = {});
2018-09-10 07:01:01 +00:00
QImage getAvatar() { return avatar(128); }
2018-09-10 01:51:02 +00:00
const QString& cachedInput() const { return m_cachedInput; }
void setCachedInput(const QString& input) {
if (input != m_cachedInput) {
m_cachedInput = input;
emit cachedInputChanged();
}
}
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();
QString getUsersTyping();
QString lastEvent();
2018-09-06 04:34:15 +00:00
bool isEventHighlighted(const QMatrixClient::RoomEvent* e) const;
QDateTime lastActiveTime();
2018-09-19 23:01:55 +00:00
Q_INVOKABLE float orderForTag(QString name);
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);
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;
bool m_busy;
QString getMIME(const QUrl& fileUrl) const;
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();
signals:
void cachedInputChanged();
void busyChanged();
public slots:
void chooseAndUploadFile();
void saveFileAs(QString eventId);
void acceptInvitation();
void forget();
2018-08-20 14:40:36 +00:00
void sendTypingNotification(bool isTyping);
void sendReply(QString userId, QString eventId, QString replyContent,
QString sendContent);
};
#endif // SpectralRoom_H