summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2017-10-31 19:11:49 +0100
committermujx <mujx@users.noreply.github.com>2017-10-31 20:11:49 +0200
commit287b5aa4c0d52e1ac80a0785ab136aa0f98b3e9f (patch)
tree8535d6ec3717ba551b17fc70f0cc80306273e82c /include
parentAdd missing headers (diff)
downloadnheko-287b5aa4c0d52e1ac80a0785ab136aa0f98b3e9f.tar.xz
Implemented sending of typing notifications (#105)
Diffstat (limited to 'include')
-rw-r--r--include/ChatPage.h6
-rw-r--r--include/MatrixClient.h2
-rw-r--r--include/TextInputWidget.h13
3 files changed, 19 insertions, 2 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h

index 416f7870..849d60e7 100644 --- a/include/ChatPage.h +++ b/include/ChatPage.h
@@ -45,8 +45,9 @@ class UserInfoWidget; class JoinedRoom; class LeftRoom; -constexpr int CONSENSUS_TIMEOUT = 1000; -constexpr int SHOW_CONTENT_TIMEOUT = 3000; +constexpr int CONSENSUS_TIMEOUT = 1000; +constexpr int SHOW_CONTENT_TIMEOUT = 3000; +constexpr int TYPING_REFRESH_TIMEOUT = 10000; class ChatPage : public QWidget { @@ -141,6 +142,7 @@ private: // Keeps track of the users currently typing on each room. QMap<QString, QList<QString>> typingUsers_; + QTimer *typingRefresher_; QSharedPointer<QuickSwitcher> quickSwitcher_; QSharedPointer<OverlayModal> quickSwitcherModal_; diff --git a/include/MatrixClient.h b/include/MatrixClient.h
index ef9e82e6..d6dd7162 100644 --- a/include/MatrixClient.h +++ b/include/MatrixClient.h
@@ -56,6 +56,8 @@ public: void uploadImage(const QString &roomid, const QString &filename); void joinRoom(const QString &roomIdOrAlias); void leaveRoom(const QString &roomId); + void sendTypingNotification(const QString &roomid, int timeoutInMillis = 20000); + void removeTypingNotification(const QString &roomid); QUrl getHomeServer() { return server_; }; int transactionId() { return txn_id_; }; diff --git a/include/TextInputWidget.h b/include/TextInputWidget.h
index 08b62f45..e32ce2ff 100644 --- a/include/TextInputWidget.h +++ b/include/TextInputWidget.h
@@ -35,12 +35,20 @@ static const QString JOIN_COMMAND("/join "); class FilteredTextEdit : public QTextEdit { Q_OBJECT + +private: + QTimer *typingTimer_; + public: explicit FilteredTextEdit(QWidget *parent = nullptr); void keyPressEvent(QKeyEvent *event); + void stopTyping(); + signals: void enterPressed(); + void startedTyping(); + void stoppedTyping(); }; class TextInputWidget : public QFrame @@ -51,6 +59,8 @@ public: TextInputWidget(QWidget *parent = 0); ~TextInputWidget(); + void stopTyping(); + public slots: void onSendButtonClicked(); void openFileSelection(); @@ -66,6 +76,9 @@ signals: void uploadImage(QString filename); void sendJoinRoomRequest(const QString &room); + void startedTyping(); + void stoppedTyping(); + private: void showUploadSpinner(); QString parseEmoteCommand(const QString &cmd);