Add initial support for unread message count
- Add border width on Badge
This commit is contained in:
parent
793c2136b7
commit
3b0ff1a4cd
11 changed files with 102 additions and 11 deletions
|
|
@ -54,7 +54,7 @@ public:
|
|||
~HistoryView();
|
||||
|
||||
void addHistoryItem(const Event &event, const QString &color, bool with_sender);
|
||||
void addEvents(const QList<Event> &events);
|
||||
int addEvents(const QList<Event> &events);
|
||||
void addUserTextMessage(const QString &msg, int txn_id);
|
||||
void updatePendingMessage(int txn_id, QString event_id);
|
||||
void clear();
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ public:
|
|||
static QString getUserColor(const QString &userid);
|
||||
static QMap<QString, QString> NICK_COLORS;
|
||||
|
||||
signals:
|
||||
void unreadMessages(QString roomid, int count);
|
||||
|
||||
public slots:
|
||||
void setHistoryView(const RoomInfo &info);
|
||||
void sendTextMessage(const QString &msg);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <QtWidgets/QWidget>
|
||||
|
||||
#include "Avatar.h"
|
||||
#include "Badge.h"
|
||||
#include "RippleOverlay.h"
|
||||
#include "RoomInfo.h"
|
||||
|
||||
|
|
@ -35,6 +36,9 @@ public:
|
|||
RoomInfoListItem(RoomInfo info, QWidget *parent = 0);
|
||||
~RoomInfoListItem();
|
||||
|
||||
void updateUnreadMessageCount(int count);
|
||||
void clearUnreadMessageCount();
|
||||
|
||||
inline bool isPressed();
|
||||
inline RoomInfo info();
|
||||
inline void setAvatar(const QImage &avatar_image);
|
||||
|
|
@ -67,12 +71,15 @@ private:
|
|||
QLabel *roomTopic_;
|
||||
|
||||
Avatar *roomAvatar_;
|
||||
Badge *unreadMessagesBadge_;
|
||||
|
||||
QString pressed_style_;
|
||||
QString normal_style_;
|
||||
|
||||
bool is_pressed_;
|
||||
|
||||
int max_height_;
|
||||
int unread_msg_count_;
|
||||
};
|
||||
|
||||
inline bool RoomInfoListItem::isPressed()
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ signals:
|
|||
public slots:
|
||||
void updateRoomAvatar(const QString &roomid, const QPixmap &img);
|
||||
void highlightSelectedRoom(const RoomInfo &info);
|
||||
void updateUnreadMessageCount(const QString &roomid, int count);
|
||||
|
||||
private:
|
||||
Ui::RoomList *ui;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public:
|
|||
void setRelativeXPosition(qreal x);
|
||||
void setRelativeYPosition(qreal y);
|
||||
void setText(const QString &text);
|
||||
void setDiameter(int diameter);
|
||||
|
||||
QIcon icon() const;
|
||||
QString text() const;
|
||||
|
|
@ -40,9 +41,10 @@ public:
|
|||
qreal relativeXPosition() const;
|
||||
qreal relativeYPosition() const;
|
||||
|
||||
int diameter() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
int getDiameter() const;
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
|
@ -55,6 +57,7 @@ private:
|
|||
QString text_;
|
||||
|
||||
int padding_;
|
||||
int diameter_;
|
||||
|
||||
qreal x_;
|
||||
qreal y_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue