parent
245fdb1917
commit
146aaa8746
11 changed files with 139 additions and 7 deletions
|
|
@ -26,6 +26,12 @@
|
|||
#include "RoomSettings.h"
|
||||
#include "RoomState.h"
|
||||
|
||||
struct DescInfo {
|
||||
QString username;
|
||||
QString body;
|
||||
QString timestamp;
|
||||
};
|
||||
|
||||
class RoomInfoListItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -46,6 +52,7 @@ public:
|
|||
inline RoomState state() const;
|
||||
inline void setAvatar(const QImage &avatar_image);
|
||||
inline int unreadMessageCount() const;
|
||||
inline void setDescriptionMessage(const DescInfo &info);
|
||||
|
||||
signals:
|
||||
void clicked(const QString &room_id);
|
||||
|
|
@ -71,8 +78,8 @@ private:
|
|||
|
||||
QString roomId_;
|
||||
QString roomName_;
|
||||
QString lastMessage_;
|
||||
QString lastTimestamp_;
|
||||
|
||||
DescInfo lastMsgInfo_;
|
||||
|
||||
QPixmap roomAvatar_;
|
||||
|
||||
|
|
@ -107,3 +114,8 @@ inline void RoomInfoListItem::setAvatar(const QImage &img)
|
|||
roomAvatar_ = QPixmap::fromImage(img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
update();
|
||||
}
|
||||
|
||||
inline void RoomInfoListItem::setDescriptionMessage(const DescInfo &info)
|
||||
{
|
||||
lastMsgInfo_ = info;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ public slots:
|
|||
void updateRoomAvatar(const QString &roomid, const QPixmap &img);
|
||||
void highlightSelectedRoom(const QString &room_id);
|
||||
void updateUnreadMessageCount(const QString &roomid, int count);
|
||||
void updateRoomDescription(const QString &roomid, const DescInfo &info);
|
||||
|
||||
private:
|
||||
void calculateUnreadMessageCount();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "Image.h"
|
||||
#include "MessageEvent.h"
|
||||
#include "Notice.h"
|
||||
#include "RoomInfoListItem.h"
|
||||
#include "Text.h"
|
||||
|
||||
namespace events = matrix::events;
|
||||
|
|
@ -48,6 +49,7 @@ public:
|
|||
TimelineItem(ImageItem *img, const events::MessageEvent<msgs::Image> &e, QWidget *parent);
|
||||
|
||||
void setUserAvatar(const QImage &pixmap);
|
||||
inline DescInfo descriptionMessage() const;
|
||||
|
||||
~TimelineItem();
|
||||
|
||||
|
|
@ -57,12 +59,15 @@ private:
|
|||
void generateBody(const QString &body);
|
||||
void generateBody(const QString &userid, const QString &color, const QString &body);
|
||||
void generateTimestamp(const QDateTime &time);
|
||||
QString descriptiveTime(const QDateTime &then);
|
||||
|
||||
void setupAvatarLayout(const QString &userName);
|
||||
void setupSimpleLayout();
|
||||
|
||||
QString replaceEmoji(const QString &body);
|
||||
|
||||
DescInfo descriptionMsg_;
|
||||
|
||||
QHBoxLayout *topLayout_;
|
||||
QVBoxLayout *sideLayout_; // Avatar or Timestamp
|
||||
QVBoxLayout *mainLayout_; // Header & Message body
|
||||
|
|
@ -77,3 +82,8 @@ private:
|
|||
QLabel *userName_;
|
||||
QLabel *body_;
|
||||
};
|
||||
|
||||
inline DescInfo TimelineItem::descriptionMessage() const
|
||||
{
|
||||
return descriptionMsg_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "Image.h"
|
||||
#include "Notice.h"
|
||||
#include "RoomInfoListItem.h"
|
||||
#include "Text.h"
|
||||
|
||||
namespace msgs = matrix::events::messages;
|
||||
|
|
@ -83,11 +84,15 @@ public slots:
|
|||
// Add old events at the top of the timeline.
|
||||
void addBackwardsEvents(const QString &room_id, const RoomMessages &msgs);
|
||||
|
||||
signals:
|
||||
void updateLastTimelineMessage(const QString &user, const DescInfo &info);
|
||||
|
||||
private:
|
||||
void init();
|
||||
void removePendingMessage(const events::MessageEvent<msgs::Text> &e);
|
||||
void addTimelineItem(TimelineItem *item, TimelineDirection direction);
|
||||
void updateLastSender(const QString &user_id, TimelineDirection direction);
|
||||
void notifyForLastEvent();
|
||||
|
||||
// Used to determine whether or not we should prefix a message with the sender's name.
|
||||
bool isSenderRendered(const QString &user_id, TimelineDirection direction);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <QWidget>
|
||||
|
||||
#include "MatrixClient.h"
|
||||
#include "RoomInfoListItem.h"
|
||||
#include "Sync.h"
|
||||
#include "TimelineView.h"
|
||||
|
||||
|
|
@ -50,6 +51,7 @@ public:
|
|||
|
||||
signals:
|
||||
void unreadMessages(QString roomid, int count);
|
||||
void updateRoomsLastMessage(const QString &user, const DescInfo &info);
|
||||
|
||||
public slots:
|
||||
void setHistoryView(const QString &room_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue