You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
#pragma once |
|
|
|
#include <QWidget> |
|
#include <QStandardItemModel> |
|
#include <QHash> |
|
#include <QTimer> |
|
|
|
class ChatView; |
|
class InputBar; |
|
class InputBar; |
|
class EmojiPanel; |
|
class DbManager; |
|
class ChannelList; |
|
class AudioRecorder; |
|
|
|
class MessageList : public QWidget { |
|
Q_OBJECT |
|
public: |
|
explicit MessageList(DbManager* db = nullptr, AudioRecorder* recorder = nullptr, |
|
QWidget *parent = nullptr); |
|
|
|
void loadChannel(const QString& channelId); |
|
void refresh(); |
|
void reloadLocalNicks(); |
|
void saveChannelState(); |
|
static void cleanupAnimations(); |
|
void updateMessageProgress(const QString& chId, int64_t msgId, int blocksDone, int numBlocks); |
|
void onAttachmentDownloaded(const QString& chId, int64_t msgId); |
|
|
|
signals: |
|
void readPositionChanged(const QString& channelId, qint64 lastReadMsgId); |
|
void openVideoRequested(const QString& filePath); |
|
|
|
private: |
|
ChatView *m_view; |
|
QStandardItemModel *m_model; |
|
InputBar *m_inputBar; |
|
EmojiPanel *m_emojiPanel; |
|
DbManager *m_db; |
|
QString m_currentChannelId; |
|
bool m_animHoverActive = false; |
|
QHash<quint64, QColor> m_avatarCache; |
|
qint64 m_lastReadMsgId = 0; |
|
QTimer* m_readDebounce; |
|
qint64 m_savedTopMsgId = 0; |
|
bool m_wasAtBottom = false; |
|
QMap<quint64, QString> m_localNicks; |
|
AudioRecorder* m_recorder = nullptr; |
|
|
|
QString authorName(quint64 nodeId) const; |
|
void restoreScrollPosition(const QString& channelId); |
|
void updateReadPosition(); |
|
};
|
|
|