2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#include "channel.h"
|
2017-02-02 22:15:09 +01:00
|
|
|
#include "messages/limitedqueuesnapshot.h"
|
|
|
|
#include "messages/messageref.h"
|
2017-01-22 12:46:35 +01:00
|
|
|
#include "messages/word.h"
|
2017-02-02 22:15:09 +01:00
|
|
|
#include "messages/wordpart.h"
|
2017-01-18 21:30:23 +01:00
|
|
|
#include "widgets/chatwidgetheader.h"
|
|
|
|
#include "widgets/chatwidgetinput.h"
|
|
|
|
#include "widgets/chatwidgetview.h"
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QFont>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QWidget>
|
2017-01-29 11:38:00 +01:00
|
|
|
#include <boost/property_tree/ptree.hpp>
|
2017-02-02 22:15:09 +01:00
|
|
|
#include <boost/signals2/connection.hpp>
|
2017-01-18 04:33:30 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
class ChatWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChatWidget(QWidget *parent = 0);
|
2017-01-01 02:30:42 +01:00
|
|
|
~ChatWidget();
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
SharedChannel getChannel() const;
|
2017-05-27 17:45:40 +02:00
|
|
|
SharedChannel &getChannelRef();
|
2017-04-12 17:46:44 +02:00
|
|
|
const QString &getChannelName() const;
|
2017-01-17 00:15:44 +01:00
|
|
|
void setChannelName(const QString &name);
|
|
|
|
|
|
|
|
void showChangeChannelPopup();
|
2017-04-12 17:46:44 +02:00
|
|
|
messages::LimitedQueueSnapshot<messages::SharedMessageRef> getMessagesSnapshot();
|
|
|
|
void layoutMessages();
|
|
|
|
void updateGifEmotes();
|
2017-02-02 22:15:09 +01:00
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
protected:
|
2017-02-02 23:51:02 +01:00
|
|
|
void paintEvent(QPaintEvent *) override;
|
2016-12-29 17:31:07 +01:00
|
|
|
|
|
|
|
private:
|
2017-04-12 17:46:44 +02:00
|
|
|
void attachChannel(std::shared_ptr<Channel> _channel);
|
2017-05-29 21:02:01 +02:00
|
|
|
void detachChannel();
|
2017-04-12 17:46:44 +02:00
|
|
|
|
|
|
|
messages::LimitedQueue<messages::SharedMessageRef> _messages;
|
2017-02-02 22:15:09 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
SharedChannel _channel;
|
|
|
|
QString _channelName;
|
2017-01-18 04:33:30 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
QFont _font;
|
|
|
|
QVBoxLayout _vbox;
|
|
|
|
ChatWidgetHeader _header;
|
|
|
|
ChatWidgetView _view;
|
|
|
|
ChatWidgetInput _input;
|
2017-01-29 11:38:00 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
boost::signals2::connection _messageAppendedConnection;
|
|
|
|
boost::signals2::connection _messageRemovedConnection;
|
2017-02-02 22:15:09 +01:00
|
|
|
|
2017-01-29 11:38:00 +01:00
|
|
|
public:
|
|
|
|
void load(const boost::property_tree::ptree &tree);
|
|
|
|
boost::property_tree::ptree save();
|
2016-12-29 17:31:07 +01:00
|
|
|
};
|
2017-01-29 11:38:00 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|