Implemented sending of typing notifications (#105)
This commit is contained in:
parent
91b8427795
commit
287b5aa4c0
6 changed files with 130 additions and 6 deletions
|
|
@ -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_;
|
||||
|
|
|
|||
|
|
@ -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_; };
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue