| 1 |
|
| 2 |
|
| 3 |
#ifndef MESSAGEBROWSER_H |
| 4 |
#define MESSAGEBROWSER_H |
| 5 |
|
| 6 |
#include "core/message.h" |
| 7 |
#include "services/abstract/rootitem.h" |
| 8 |
|
| 9 |
#include <QPointer> |
| 10 |
#include <QWidget> |
| 11 |
|
| 12 |
class RootItem; |
| 13 |
class QVBoxLayout; |
| 14 |
class MessageTextBrowser; |
| 15 |
class SearchTextWidget; |
| 16 |
|
| 17 |
class MessageBrowser : public QWidget { |
| 18 |
Q_OBJECT |
| 19 |
|
| 20 |
public: |
| 21 |
explicit MessageBrowser(bool should_resize_to_fit, QWidget* parent = nullptr); |
| 22 |
|
| 23 |
double verticalScrollBarPosition() const; |
| 24 |
|
| 25 |
public slots: |
| 26 |
void setVerticalScrollBarPosition(double pos); |
| 27 |
void clear(bool also_hide); |
| 28 |
void reloadFontSettings(); |
| 29 |
void loadUrl(const QString& url); |
| 30 |
void loadMessage(const Message& message, RootItem* root); |
| 31 |
|
| 32 |
protected: |
| 33 |
bool eventFilter(QObject* watched, QEvent* event); |
| 34 |
|
| 35 |
private slots: |
| 36 |
void onAnchorClicked(const QUrl& url); |
| 37 |
|
| 38 |
private: |
| 39 |
QString prepareHtmlForMessage(const Message& message); |
| 40 |
|
| 41 |
private: |
| 42 |
MessageTextBrowser* m_txtBrowser; |
| 43 |
SearchTextWidget* m_searchWidget; |
| 44 |
QVBoxLayout* m_layout; |
| 45 |
QStringList m_pictures; |
| 46 |
QPointer<RootItem> m_root; |
| 47 |
}; |
| 48 |
|
| 49 |
#endif |