2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "channel.hpp"
|
2018-01-11 20:16:25 +01:00
|
|
|
#include "messages/layouts/messagelayout.hpp"
|
|
|
|
#include "messages/layouts/messagelayoutelement.hpp"
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "messages/limitedqueuesnapshot.hpp"
|
2018-01-11 20:16:25 +01:00
|
|
|
#include "messages/messageelement.hpp"
|
2018-02-05 15:11:50 +01:00
|
|
|
#include "util/serialize-custom.hpp"
|
2017-06-26 16:41:20 +02:00
|
|
|
#include "widgets/basewidget.hpp"
|
2017-11-12 17:21:50 +01:00
|
|
|
#include "widgets/helper/channelview.hpp"
|
|
|
|
#include "widgets/helper/rippleeffectlabel.hpp"
|
|
|
|
#include "widgets/helper/splitheader.hpp"
|
|
|
|
#include "widgets/helper/splitinput.hpp"
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QFont>
|
2017-06-10 23:53:39 +02:00
|
|
|
#include <QShortcut>
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QWidget>
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
class SplitContainer;
|
2017-06-26 16:41:20 +02:00
|
|
|
|
2018-04-06 16:37:30 +02:00
|
|
|
class xD
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2017-06-10 22:48:28 +02:00
|
|
|
// Each ChatWidget consists of three sub-elements that handle their own part of the chat widget:
|
|
|
|
// ChatWidgetHeader
|
|
|
|
// - Responsible for rendering which channel the ChatWidget is in, and the menu in the top-left of
|
|
|
|
// the chat widget
|
|
|
|
// ChatWidgetView
|
|
|
|
// - Responsible for rendering all chat messages, and the scrollbar
|
|
|
|
// ChatWidgetInput
|
|
|
|
// - Responsible for rendering and handling user text input
|
|
|
|
//
|
|
|
|
// Each sub-element has a reference to the parent Chat Widget
|
2017-11-12 17:21:50 +01:00
|
|
|
class Split : public BaseWidget
|
2016-12-29 17:31:07 +01:00
|
|
|
{
|
2017-11-12 17:21:50 +01:00
|
|
|
friend class SplitInput;
|
2017-09-21 02:20:02 +02:00
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-04-06 23:31:34 +02:00
|
|
|
Split(SplitContainer *parent);
|
2018-03-31 13:44:15 +02:00
|
|
|
~Split() override;
|
2017-11-12 17:21:50 +01:00
|
|
|
|
2018-04-03 02:55:32 +02:00
|
|
|
pajlada::Signals::NoArgSignal channelChanged;
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-12-26 12:32:24 +01:00
|
|
|
ChannelView &getChannelView()
|
|
|
|
{
|
|
|
|
return this->view;
|
|
|
|
}
|
|
|
|
|
2018-01-24 13:15:41 +01:00
|
|
|
ChannelPtr getChannel() const;
|
2018-04-06 23:31:34 +02:00
|
|
|
void setChannel(ChannelPtr newChannel);
|
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
void setFlexSizeX(double x);
|
|
|
|
double getFlexSizeX();
|
|
|
|
void setFlexSizeY(double y);
|
|
|
|
double getFlexSizeY();
|
2017-01-17 00:15:44 +01:00
|
|
|
|
2018-01-17 16:52:51 +01:00
|
|
|
void setModerationMode(bool value);
|
|
|
|
bool getModerationMode() const;
|
|
|
|
|
2017-07-31 01:36:42 +02:00
|
|
|
bool showChangeChannelPopup(const char *dialogTitle, bool empty = false);
|
2017-08-12 15:41:14 +02:00
|
|
|
void giveFocus(Qt::FocusReason reason);
|
|
|
|
bool hasFocus() const;
|
2017-10-11 10:34:04 +02:00
|
|
|
void layoutMessages();
|
2017-09-16 00:05:06 +02:00
|
|
|
void updateGifEmotes();
|
2018-01-23 22:48:33 +01:00
|
|
|
void updateLastReadMessage();
|
2017-11-04 14:57:29 +01:00
|
|
|
|
2018-01-17 01:19:42 +01:00
|
|
|
void drag();
|
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
protected:
|
2018-03-31 13:44:15 +02:00
|
|
|
void paintEvent(QPaintEvent *) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *) override;
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
void keyPressEvent(QKeyEvent *) override;
|
|
|
|
void keyReleaseEvent(QKeyEvent *) override;
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-07-23 14:16:13 +02:00
|
|
|
private:
|
2017-11-12 17:21:50 +01:00
|
|
|
SplitContainer &parentPage;
|
2018-01-24 13:15:41 +01:00
|
|
|
ChannelPtr channel;
|
2017-01-18 04:33:30 +01:00
|
|
|
|
2017-06-11 11:36:42 +02:00
|
|
|
QVBoxLayout vbox;
|
2017-11-12 17:21:50 +01:00
|
|
|
SplitHeader header;
|
2017-09-16 00:05:06 +02:00
|
|
|
ChannelView view;
|
2017-11-12 17:21:50 +01:00
|
|
|
SplitInput input;
|
|
|
|
double flexSizeX;
|
|
|
|
double flexSizeY;
|
2017-01-29 11:38:00 +01:00
|
|
|
|
2018-01-17 16:52:51 +01:00
|
|
|
bool moderationMode;
|
|
|
|
|
2018-04-03 02:55:32 +02:00
|
|
|
pajlada::Signals::Connection channelIDChangedConnection;
|
|
|
|
pajlada::Signals::Connection usermodeChangedConnection;
|
2017-11-12 17:21:50 +01:00
|
|
|
void doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user);
|
2018-02-05 15:11:50 +01:00
|
|
|
void channelNameUpdated(const QString &newChannelName);
|
2018-01-17 01:19:42 +01:00
|
|
|
void handleModifiers(QEvent *event, Qt::KeyboardModifiers modifiers);
|
2017-06-10 23:53:39 +02:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
// Add new split to the notebook page that this chat widget is in
|
|
|
|
// Maybe we should use this chat widget as a hint to where the new split should be created
|
|
|
|
void doAddSplit();
|
|
|
|
|
|
|
|
// Close current split (chat widget)
|
|
|
|
void doCloseSplit();
|
|
|
|
|
|
|
|
// Show a dialog for changing the current splits/chat widgets channel
|
|
|
|
void doChangeChannel();
|
2017-06-11 09:11:55 +02:00
|
|
|
|
|
|
|
// Open popup copy of this chat widget
|
|
|
|
// XXX: maybe make current chatwidget a popup instead?
|
|
|
|
void doPopup();
|
|
|
|
|
|
|
|
// Clear chat from all messages
|
|
|
|
void doClearChat();
|
|
|
|
|
|
|
|
// Open link to twitch channel in default browser
|
|
|
|
void doOpenChannel();
|
|
|
|
|
|
|
|
// Open popup player of twitch channel in default browser
|
|
|
|
void doOpenPopupPlayer();
|
2017-08-12 14:44:27 +02:00
|
|
|
|
|
|
|
// Open twitch channel stream through streamlink
|
|
|
|
void doOpenStreamlink();
|
2017-09-12 19:06:16 +02:00
|
|
|
|
|
|
|
// Copy text from chat
|
|
|
|
void doCopy();
|
2017-09-12 19:12:02 +02:00
|
|
|
|
2018-01-05 13:42:23 +01:00
|
|
|
// Open a search popup
|
|
|
|
void doSearch();
|
|
|
|
|
2017-09-11 22:37:39 +02:00
|
|
|
// Open viewer list of the channel
|
|
|
|
void doOpenViewerList();
|
2017-09-17 04:36:48 +02:00
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
void doIncFlexX();
|
|
|
|
void doDecFlexX();
|
|
|
|
void doIncFlexY();
|
|
|
|
void doDecFlexY();
|
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
|