Receive typing notifications (#88)
This commit is contained in:
parent
88349eae90
commit
d60c2b76e3
10 changed files with 171 additions and 32 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include "TextInputWidget.h"
|
||||
#include "TimelineViewManager.h"
|
||||
#include "TopRoomBar.h"
|
||||
#include "TypingDisplay.h"
|
||||
#include "UserInfoWidget.h"
|
||||
|
||||
class ChatPage : public QWidget
|
||||
|
|
@ -68,6 +69,7 @@ protected:
|
|||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private:
|
||||
void updateTypingUsers(const QString &roomid, const QList<QString> &user_ids);
|
||||
void updateDisplayNames(const RoomState &state);
|
||||
void loadStateFromCache();
|
||||
void showQuickSwitcher();
|
||||
|
|
@ -92,6 +94,7 @@ private:
|
|||
|
||||
TopRoomBar *top_bar_;
|
||||
TextInputWidget *text_input_;
|
||||
TypingDisplay *typingDisplay_;
|
||||
|
||||
QTimer *sync_timer_;
|
||||
int sync_interval_;
|
||||
|
|
@ -104,6 +107,9 @@ private:
|
|||
QMap<QString, RoomState> state_manager_;
|
||||
QMap<QString, QSharedPointer<RoomSettings>> settingsManager_;
|
||||
|
||||
// Keeps track of the users currently typing on each room.
|
||||
QMap<QString, QList<QString>> typingUsers_;
|
||||
|
||||
QuickSwitcher *quickSwitcher_ = nullptr;
|
||||
OverlayModal *quickSwitcherModal_ = nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@
|
|||
namespace conf
|
||||
{
|
||||
// Global settings.
|
||||
static const int fontSize = 12;
|
||||
static const int emojiSize = 14;
|
||||
static const int headerFontSize = 21;
|
||||
static const int fontSize = 12;
|
||||
static const int emojiSize = 14;
|
||||
static const int headerFontSize = 21;
|
||||
static const int typingNotificationFontSize = 11;
|
||||
|
||||
// Window geometry.
|
||||
namespace window
|
||||
|
|
|
|||
|
|
@ -142,23 +142,30 @@ Timeline::limited() const
|
|||
return limited_;
|
||||
}
|
||||
|
||||
// TODO: Add support for ehpmeral, account_data, undread_notifications
|
||||
// TODO: Add support for account_data, undread_notifications
|
||||
class JoinedRoom : public Deserializable
|
||||
{
|
||||
public:
|
||||
inline State state() const;
|
||||
inline Timeline timeline() const;
|
||||
inline QList<QString> typingUserIDs() const;
|
||||
|
||||
void deserialize(const QJsonValue &data) override;
|
||||
|
||||
private:
|
||||
State state_;
|
||||
Timeline timeline_;
|
||||
/* Ephemeral ephemeral_; */
|
||||
QList<QString> typingUserIDs_;
|
||||
/* AccountData account_data_; */
|
||||
/* UnreadNotifications unread_notifications_; */
|
||||
};
|
||||
|
||||
inline QList<QString>
|
||||
JoinedRoom::typingUserIDs() const
|
||||
{
|
||||
return typingUserIDs_;
|
||||
}
|
||||
|
||||
inline State
|
||||
JoinedRoom::state() const
|
||||
{
|
||||
|
|
|
|||
21
include/TypingDisplay.h
Normal file
21
include/TypingDisplay.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include <QPaintEvent>
|
||||
#include <QWidget>
|
||||
|
||||
class TypingDisplay : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TypingDisplay(QWidget *parent = nullptr);
|
||||
|
||||
void setUsers(const QStringList &user_ids);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
QString text_;
|
||||
int leftPadding_;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue