|
|
@@ -1,6 +1,8 @@
|
|
|
#pragma once
|
|
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
+#include <QHash>
|
|
|
+#include <QList>
|
|
|
#include <QPixmap>
|
|
|
#include <QJsonObject>
|
|
|
#include <QSet>
|
|
|
@@ -8,6 +10,7 @@
|
|
|
|
|
|
class QShowEvent;
|
|
|
class QCloseEvent;
|
|
|
+class QResizeEvent;
|
|
|
class QEvent;
|
|
|
class QPoint;
|
|
|
class TitleBar;
|
|
|
@@ -42,6 +45,7 @@ protected:
|
|
|
void showEvent(QShowEvent *event) override;
|
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
void changeEvent(QEvent *event) override;
|
|
|
+ void resizeEvent(QResizeEvent *event) override;
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
|
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
|
|
@@ -99,9 +103,30 @@ private:
|
|
|
QPixmap peerAvatar(qint64 uid, const QString &name, int size) const;
|
|
|
QWidget *addBubble(bool mine, const QString &name, const QString &text, const QString &time,
|
|
|
int msgType = 1, int sendStatus = 0, qint64 msgId = 0, qint64 peerUid = 0);
|
|
|
+ QWidget *findMsgRow(qint64 msgId) const;
|
|
|
+ int chatTextMaxWidth(bool mine) const;
|
|
|
+ void relayoutTextBubbles();
|
|
|
QWidget *findOutgoingRow(qint64 localId) const;
|
|
|
void setBubbleSendState(QWidget *row, bool failed, bool sending = false);
|
|
|
void scrollChatToBottom();
|
|
|
+ struct ChatPage
|
|
|
+ {
|
|
|
+ QScrollArea *scroll = nullptr;
|
|
|
+ QWidget *host = nullptr;
|
|
|
+ QVBoxLayout *lay = nullptr;
|
|
|
+ int scrollValue = 0;
|
|
|
+ int laidOutW = -1;
|
|
|
+ bool stickBottom = true;
|
|
|
+ QString fp;
|
|
|
+ };
|
|
|
+ ChatPage createChatPage();
|
|
|
+ void bindChatScroll(QScrollArea *scroll);
|
|
|
+ void stashChatPage(qint64 peerUid);
|
|
|
+ bool activateChatPage(qint64 peerUid);
|
|
|
+ bool chatPageHasAll(const QJsonArray &list) const;
|
|
|
+ void dropChatPage(qint64 peerUid);
|
|
|
+ void trimChatPages();
|
|
|
+ void rememberChatPageState();
|
|
|
void clearBubbles();
|
|
|
void enterMsgSelectMode(qint64 preselectId = 0);
|
|
|
void exitMsgSelectMode();
|
|
|
@@ -178,6 +203,15 @@ private:
|
|
|
QPushButton *m_newFriendsBtn = nullptr;
|
|
|
QLabel *m_pendingBadge = nullptr;
|
|
|
class StickerPanel *m_stickerPanel = nullptr;
|
|
|
+ QPushButton *m_emojiBtn = nullptr;
|
|
|
+ qint64 m_stickerDismissedAt = 0;
|
|
|
+ int m_lastTextBubbleMaxW = -1;
|
|
|
+ bool m_buildingHistory = false;
|
|
|
+ qint64 m_historyPeerUid = 0;
|
|
|
+ QString m_historyFp;
|
|
|
+ QHash<qint64, ChatPage> m_chatPages;
|
|
|
+ QList<qint64> m_chatPageOrder;
|
|
|
+ QStackedWidget *m_chatPageStack = nullptr;
|
|
|
|
|
|
QStackedWidget *m_chatStack = nullptr;
|
|
|
QWidget *m_chatEmpty = nullptr;
|