2017-01-01 02:30:42 +01:00
|
|
|
#ifndef CHATVIEW_H
|
|
|
|
#define CHATVIEW_H
|
|
|
|
|
2017-01-05 16:07:20 +01:00
|
|
|
#include "channel.h"
|
2017-02-07 00:03:15 +01:00
|
|
|
#include "messages/lazyloadedimage.h"
|
2017-02-02 22:15:09 +01:00
|
|
|
#include "messages/messageref.h"
|
2017-01-22 12:46:35 +01:00
|
|
|
#include "messages/word.h"
|
2017-01-18 21:30:23 +01:00
|
|
|
#include "widgets/scrollbar.h"
|
2017-03-23 23:23:32 +01:00
|
|
|
#include "widgets/userpopupwidget.h"
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QPaintEvent>
|
2017-01-26 04:26:40 +01:00
|
|
|
#include <QScroller>
|
|
|
|
#include <QWheelEvent>
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QWidget>
|
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
2017-01-17 00:15:44 +01:00
|
|
|
class ChatWidget;
|
|
|
|
|
2017-01-01 02:30:42 +01:00
|
|
|
class ChatWidgetView : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-01-18 21:30:23 +01:00
|
|
|
explicit ChatWidgetView(ChatWidget *parent);
|
2017-01-22 12:46:35 +01:00
|
|
|
~ChatWidgetView();
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-16 03:15:07 +01:00
|
|
|
bool layoutMessages();
|
|
|
|
|
2017-02-07 00:03:15 +01:00
|
|
|
void
|
|
|
|
updateGifEmotes()
|
|
|
|
{
|
|
|
|
this->onlyUpdateEmotes = true;
|
|
|
|
this->update();
|
|
|
|
}
|
|
|
|
|
2017-01-03 21:19:33 +01:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *);
|
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
void paintEvent(QPaintEvent *);
|
2017-01-26 04:26:40 +01:00
|
|
|
void wheelEvent(QWheelEvent *event);
|
|
|
|
|
2017-02-17 23:51:35 +01:00
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
2017-03-23 23:23:32 +01:00
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event);
|
2017-02-17 23:51:35 +01:00
|
|
|
|
|
|
|
bool tryGetMessageAt(QPoint p,
|
|
|
|
std::shared_ptr<messages::MessageRef> &message,
|
|
|
|
QPoint &relativePos);
|
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
private:
|
2017-02-07 00:03:15 +01:00
|
|
|
struct GifEmoteData {
|
|
|
|
messages::LazyLoadedImage *image;
|
|
|
|
QRect rect;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<GifEmoteData> gifEmotes;
|
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
ChatWidget *chatWidget;
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
ScrollBar scrollbar;
|
2017-03-23 23:23:32 +01:00
|
|
|
|
|
|
|
UserPopupWidget userPopupWidget;
|
|
|
|
bool onlyUpdateEmotes = false;
|
|
|
|
|
|
|
|
// Mouse event variables
|
|
|
|
bool mouseDown = false;
|
|
|
|
QPointF latestPressPosition;
|
2017-01-22 12:46:35 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void
|
|
|
|
wordTypeMaskChanged()
|
|
|
|
{
|
2017-02-17 23:51:35 +01:00
|
|
|
layoutMessages();
|
2017-02-07 00:03:15 +01:00
|
|
|
update();
|
2017-01-22 12:46:35 +01:00
|
|
|
}
|
2017-01-01 02:30:42 +01:00
|
|
|
};
|
2017-01-18 21:30:23 +01:00
|
|
|
}
|
|
|
|
}
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#endif // CHATVIEW_H
|