2018-08-18 08:02:47 +00:00
|
|
|
#ifndef MATRIQUEROOM_H
|
|
|
|
#define MATRIQUEROOM_H
|
|
|
|
|
|
|
|
#include "room.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
2018-08-20 14:40:36 +00:00
|
|
|
#include <QTimer>
|
2018-08-18 08:02:47 +00:00
|
|
|
|
|
|
|
using namespace QMatrixClient;
|
|
|
|
|
|
|
|
class MatriqueRoom : public Room {
|
|
|
|
Q_OBJECT
|
2018-08-20 14:40:36 +00:00
|
|
|
Q_PROPERTY(
|
|
|
|
bool isTyping READ isTyping WRITE setIsTyping NOTIFY isTypingChanged)
|
|
|
|
Q_PROPERTY(bool hasUsersTyping READ hasUsersTyping NOTIFY typingChanged)
|
|
|
|
Q_PROPERTY(QString usersTyping READ getUsersTyping NOTIFY typingChanged)
|
2018-08-18 08:02:47 +00:00
|
|
|
Q_PROPERTY(QString cachedInput READ cachedInput WRITE setCachedInput NOTIFY
|
|
|
|
cachedInputChanged)
|
|
|
|
public:
|
|
|
|
explicit MatriqueRoom(Connection* connection, QString roomId,
|
|
|
|
JoinState joinState = {});
|
|
|
|
|
2018-08-20 14:40:36 +00:00
|
|
|
bool isTyping() { return m_isTyping; }
|
|
|
|
void setIsTyping(bool isTyping) {
|
|
|
|
if (isTyping) m_timeoutTimer->start();
|
|
|
|
if (isTyping != m_isTyping) {
|
|
|
|
m_isTyping = isTyping;
|
|
|
|
emit isTypingChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-18 08:02:47 +00:00
|
|
|
const QString& cachedInput() const { return m_cachedInput; }
|
|
|
|
void setCachedInput(const QString& input) {
|
|
|
|
if (input != m_cachedInput) {
|
|
|
|
m_cachedInput = input;
|
|
|
|
emit cachedInputChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-20 14:40:36 +00:00
|
|
|
bool hasUsersTyping();
|
|
|
|
QString getUsersTyping();
|
|
|
|
|
2018-08-18 08:02:47 +00:00
|
|
|
private:
|
2018-08-19 06:32:18 +00:00
|
|
|
QString m_cachedInput;
|
2018-08-20 14:40:36 +00:00
|
|
|
bool m_isTyping;
|
|
|
|
QTimer* m_timeoutTimer = new QTimer();
|
|
|
|
QTimer* m_repeatTimer = new QTimer();
|
2018-08-18 08:02:47 +00:00
|
|
|
|
|
|
|
QString getMIME(const QUrl& fileUrl) const;
|
|
|
|
void postFile(const QUrl& localFile, const QUrl& mxcUrl);
|
|
|
|
|
|
|
|
signals:
|
2018-08-20 14:40:36 +00:00
|
|
|
void isTypingChanged();
|
2018-08-18 08:02:47 +00:00
|
|
|
void cachedInputChanged();
|
|
|
|
|
|
|
|
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-08-18 08:02:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MATRIQUEROOM_H
|