2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2018-06-26 15:33:51 +02:00
|
|
|
#include "common/Channel.hpp"
|
|
|
|
#include "common/NullablePtr.hpp"
|
2018-06-26 17:20:03 +02:00
|
|
|
#include "messages/LimitedQueueSnapshot.hpp"
|
|
|
|
#include "messages/MessageElement.hpp"
|
|
|
|
#include "messages/layouts/MessageLayout.hpp"
|
|
|
|
#include "messages/layouts/MessageLayoutElement.hpp"
|
2018-08-10 19:00:14 +02:00
|
|
|
#include "uril/RapidJsonSerializeQString.hpp"
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "widgets/BaseWidget.hpp"
|
|
|
|
#include "widgets/helper/ChannelView.hpp"
|
2018-08-08 15:35:54 +02:00
|
|
|
#include "widgets/helper/EffectLabel.hpp"
|
2018-06-26 14:39:22 +02:00
|
|
|
#include "widgets/splits/SplitHeader.hpp"
|
|
|
|
#include "widgets/splits/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 {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
class SplitContainer;
|
2018-05-08 15:12:04 +02:00
|
|
|
class SplitOverlay;
|
2018-06-24 11:45:30 +02:00
|
|
|
class SelectChannelDialog;
|
2017-06-26 16:41:20 +02:00
|
|
|
|
2018-08-06 21:17:03 +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
|
2017-06-10 22:48:28 +02:00
|
|
|
// 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
|
2018-05-08 15:12:04 +02:00
|
|
|
class Split : public BaseWidget, pajlada::Signals::SignalHolder
|
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-28 22:00:05 +02:00
|
|
|
explicit Split(SplitContainer *parent);
|
2018-04-27 22:11:19 +02:00
|
|
|
explicit Split(QWidget *parent);
|
2018-04-28 22:00:05 +02:00
|
|
|
|
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;
|
2018-05-25 14:57:17 +02:00
|
|
|
pajlada::Signals::NoArgSignal focused;
|
2018-06-23 13:54:00 +02:00
|
|
|
pajlada::Signals::NoArgSignal focusLost;
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2018-05-10 19:50:31 +02:00
|
|
|
ChannelView &getChannelView();
|
|
|
|
SplitContainer *getContainer();
|
2017-12-26 12:32:24 +01:00
|
|
|
|
2018-04-20 19:54:45 +02:00
|
|
|
IndirectChannel getIndirectChannel();
|
|
|
|
ChannelPtr getChannel();
|
|
|
|
void setChannel(IndirectChannel newChannel);
|
2018-04-06 23:31:34 +02:00
|
|
|
|
2018-01-17 16:52:51 +01:00
|
|
|
void setModerationMode(bool value);
|
|
|
|
bool getModerationMode() const;
|
|
|
|
|
2018-07-10 18:27:42 +02:00
|
|
|
void insertTextToInput(const QString &text);
|
|
|
|
|
2018-04-18 09:12:29 +02:00
|
|
|
void showChangeChannelPopup(const char *dialogTitle, bool empty,
|
|
|
|
std::function<void(bool)> callback);
|
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();
|
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
bool isInContainer() const;
|
|
|
|
|
2018-05-10 23:58:07 +02:00
|
|
|
void setContainer(SplitContainer *container);
|
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
static pajlada::Signals::Signal<Qt::KeyboardModifiers>
|
|
|
|
modifierStatusChanged;
|
2018-05-10 23:58:07 +02:00
|
|
|
static Qt::KeyboardModifiers modifierStatus;
|
2018-05-10 19:50:31 +02:00
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
protected:
|
2018-04-07 12:53:10 +02:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
void keyReleaseEvent(QKeyEvent *event) override;
|
2018-05-08 15:12:04 +02:00
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
void enterEvent(QEvent *event) override;
|
|
|
|
void leaveEvent(QEvent *event) override;
|
2018-05-31 16:02:20 +02:00
|
|
|
void focusInEvent(QFocusEvent *event) override;
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-07-23 14:16:13 +02:00
|
|
|
private:
|
2018-08-02 14:23:27 +02:00
|
|
|
void showUserInfoPopup(const QString &userName)
|
|
|
|
{
|
|
|
|
this->showUserInfoPopup(UserName{userName});
|
|
|
|
}
|
|
|
|
void showUserInfoPopup(const UserName &user);
|
2018-07-06 19:23:47 +02:00
|
|
|
void channelNameUpdated(const QString &newChannelName);
|
|
|
|
void handleModifiers(Qt::KeyboardModifiers modifiers);
|
2017-01-18 04:33:30 +01:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
SplitContainer *container_;
|
|
|
|
IndirectChannel channel_;
|
2018-05-08 15:12:04 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
QVBoxLayout vbox_;
|
|
|
|
SplitHeader header_;
|
|
|
|
ChannelView view_;
|
|
|
|
SplitInput input_;
|
|
|
|
SplitOverlay *overlay_;
|
2018-06-24 11:45:30 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
NullablePtr<SelectChannelDialog> selectChannelDialog_;
|
2018-01-17 16:52:51 +01:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
bool moderationMode_ = false;
|
2018-05-08 15:12:04 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
bool isMouseOver_ = false;
|
|
|
|
bool isDragging_ = false;
|
2018-05-24 08:58:34 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
pajlada::Signals::Connection channelIDChangedConnection_;
|
|
|
|
pajlada::Signals::Connection usermodeChangedConnection_;
|
|
|
|
pajlada::Signals::Connection roomModeChangedConnection_;
|
2018-04-25 14:49:30 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
pajlada::Signals::Connection indirectChannelChangedConnection_;
|
2018-04-27 22:11:19 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
2017-06-10 23:53:39 +02:00
|
|
|
|
|
|
|
public slots:
|
2018-08-08 15:35:54 +02:00
|
|
|
void addSibling();
|
|
|
|
void deleteFromContainer();
|
|
|
|
void changeChannel();
|
|
|
|
void popup();
|
|
|
|
void clear();
|
2018-08-02 14:23:27 +02:00
|
|
|
void openInBrowser();
|
2018-08-08 15:35:54 +02:00
|
|
|
void openBrowserPlayer();
|
2018-08-02 14:23:27 +02:00
|
|
|
void openInStreamlink();
|
|
|
|
void copyToClipboard();
|
2018-08-08 15:35:54 +02:00
|
|
|
void showSearch();
|
2018-08-02 14:23:27 +02:00
|
|
|
void showViewerList();
|
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 chatterino
|