2017-06-06 17:18:23 +02:00
|
|
|
#pragma once
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "channel.hpp"
|
|
|
|
#include "messages/lazyloadedimage.hpp"
|
|
|
|
#include "messages/messageref.hpp"
|
|
|
|
#include "messages/word.hpp"
|
|
|
|
#include "widgets/accountpopup.hpp"
|
|
|
|
#include "widgets/scrollbar.hpp"
|
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
|
|
|
|
{
|
|
|
|
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-04-12 17:46:44 +02:00
|
|
|
void updateGifEmotes();
|
|
|
|
ScrollBar *getScrollbar();
|
2017-02-07 00:03:15 +01:00
|
|
|
|
2017-01-03 21:19:33 +01:00
|
|
|
protected:
|
2017-04-20 21:34:51 +02:00
|
|
|
void resizeEvent(QResizeEvent *) override;
|
2017-01-03 21:19:33 +01:00
|
|
|
|
2017-04-20 21:34:51 +02:00
|
|
|
void paintEvent(QPaintEvent *) override;
|
|
|
|
void wheelEvent(QWheelEvent *event) override;
|
2017-01-26 04:26:40 +01:00
|
|
|
|
2017-04-20 21:34:51 +02:00
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
2017-02-17 23:51:35 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
bool tryGetMessageAt(QPoint p, std::shared_ptr<messages::MessageRef> &message,
|
2017-02-17 23:51:35 +01:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
std::vector<GifEmoteData> _gifEmotes;
|
|
|
|
|
|
|
|
ChatWidget *_chatWidget;
|
|
|
|
|
|
|
|
ScrollBar _scrollbar;
|
2017-02-07 00:03:15 +01:00
|
|
|
|
2017-06-06 17:22:16 +02:00
|
|
|
// This variable can be used to decide whether or not we should render the "Show latest
|
|
|
|
// messages" button
|
|
|
|
bool showingLatestMessages = true;
|
|
|
|
|
2017-04-19 15:24:19 +02:00
|
|
|
AccountPopupWidget _userPopupWidget;
|
2017-04-12 17:46:44 +02:00
|
|
|
bool _onlyUpdateEmotes;
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
// Mouse event variables
|
|
|
|
bool _mouseDown;
|
|
|
|
QPointF _lastPressPosition;
|
2017-01-22 12:46:35 +01:00
|
|
|
|
|
|
|
private slots:
|
2017-04-12 17:46:44 +02:00
|
|
|
void wordTypeMaskChanged()
|
2017-01-22 12:46:35 +01:00
|
|
|
{
|
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-06-06 17:18:23 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|