mirror-chatterino2/widgets/chatwidget.h

85 lines
1.7 KiB
C
Raw Normal View History

2016-12-29 17:31:07 +01:00
#ifndef CHATWIDGET_H
#define CHATWIDGET_H
2017-01-11 18:52:09 +01:00
#include "channel.h"
#include "messages/limitedqueuesnapshot.h"
#include "messages/messageref.h"
2017-01-22 12:46:35 +01:00
#include "messages/word.h"
#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>
#include <boost/signals2/connection.hpp>
2017-01-18 04:33:30 +01:00
2017-01-18 21:30:23 +01:00
namespace chatterino {
namespace widgets {
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
ChatWidgetView &
2017-01-18 04:33:30 +01:00
getView()
{
2017-01-18 04:33:30 +01:00
return view;
}
2017-01-30 19:14:25 +01:00
std::shared_ptr<Channel>
2017-01-18 04:33:30 +01:00
getChannel() const
{
2017-01-18 04:33:30 +01:00
return channel;
}
2017-01-17 00:15:44 +01:00
const QString &
2017-01-18 04:33:30 +01:00
getChannelName() const
2017-01-17 00:15:44 +01:00
{
2017-01-18 04:33:30 +01:00
return channelName;
2017-01-17 00:15:44 +01:00
}
void setChannelName(const QString &name);
void showChangeChannelPopup();
messages::LimitedQueueSnapshot<std::shared_ptr<messages::MessageRef>>
getMessagesSnapshot()
{
return messages.getSnapshot();
}
2016-12-29 17:31:07 +01:00
protected:
void paintEvent(QPaintEvent *) override;
2016-12-29 17:31:07 +01:00
private:
messages::LimitedQueue<std::shared_ptr<messages::MessageRef>> messages;
2017-01-30 19:14:25 +01:00
std::shared_ptr<Channel> channel;
2017-01-18 04:33:30 +01:00
QString channelName;
QFont font;
QVBoxLayout vbox;
ChatWidgetHeader header;
ChatWidgetView view;
ChatWidgetInput input;
2017-01-29 11:38:00 +01:00
boost::signals2::connection messageAppendedConnection;
boost::signals2::connection messageRemovedConnection;
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
} // namespace widgets
} // namespace chatterino
2016-12-29 17:31:07 +01:00
2017-01-11 18:52:09 +01:00
#endif // CHATWIDGET_H