2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "widgets/BaseWidget.hpp"
|
2017-01-15 16:38:30 +01:00
|
|
|
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QPoint>
|
2018-08-08 15:35:54 +02:00
|
|
|
#include <memory>
|
2018-01-17 18:36:12 +01:00
|
|
|
#include <pajlada/settings/setting.hpp>
|
2018-04-11 01:06:13 +02:00
|
|
|
#include <pajlada/signals/connection.hpp>
|
2018-05-26 17:20:16 +02:00
|
|
|
#include <pajlada/signals/signalholder.hpp>
|
2018-04-11 01:06:13 +02:00
|
|
|
#include <vector>
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
2017-06-26 16:41:20 +02:00
|
|
|
|
2018-08-08 15:35:54 +02:00
|
|
|
class Button;
|
|
|
|
class EffectLabel;
|
2018-06-11 15:04:54 +02:00
|
|
|
class Label;
|
2018-08-08 15:35:54 +02:00
|
|
|
class Split;
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2018-08-08 15:35:54 +02:00
|
|
|
class SplitHeader final : public BaseWidget, pajlada::Signals::SignalHolder
|
2017-01-01 02:30:42 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-11-12 17:21:50 +01:00
|
|
|
explicit SplitHeader(Split *_chatWidget);
|
2018-01-13 04:05:38 +01:00
|
|
|
|
2018-09-04 21:39:54 +02:00
|
|
|
void setAddButtonVisible(bool value);
|
2020-10-10 17:24:53 +02:00
|
|
|
void setViewersButtonVisible(bool value);
|
2018-09-04 21:39:54 +02:00
|
|
|
|
2017-01-17 00:15:44 +01:00
|
|
|
void updateChannelText();
|
2018-01-17 16:52:51 +01:00
|
|
|
void updateModerationModeIcon();
|
2018-07-04 19:43:41 +02:00
|
|
|
void updateRoomModes();
|
2017-01-01 02:30:42 +01:00
|
|
|
|
|
|
|
protected:
|
2018-01-25 21:11:14 +01:00
|
|
|
virtual void scaleChangedEvent(float) override;
|
2018-07-06 17:11:37 +02:00
|
|
|
virtual void themeChangedEvent() override;
|
2018-01-25 21:11:14 +01:00
|
|
|
|
2017-06-10 22:48:28 +02:00
|
|
|
virtual void paintEvent(QPaintEvent *) override;
|
|
|
|
virtual void mousePressEvent(QMouseEvent *event) override;
|
2018-05-16 14:55:45 +02:00
|
|
|
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
2017-06-10 22:48:28 +02:00
|
|
|
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
2018-05-26 16:31:43 +02:00
|
|
|
virtual void enterEvent(QEvent *) override;
|
2017-12-23 22:17:38 +01:00
|
|
|
virtual void leaveEvent(QEvent *event) override;
|
2017-06-10 22:48:28 +02:00
|
|
|
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
|
2017-01-01 02:30:42 +01:00
|
|
|
|
|
|
|
private:
|
2018-08-08 15:35:54 +02:00
|
|
|
void initializeLayout();
|
|
|
|
void initializeModeSignals(EffectLabel &label);
|
2018-08-07 23:46:00 +02:00
|
|
|
std::unique_ptr<QMenu> createMainMenu();
|
|
|
|
std::unique_ptr<QMenu> createChatModeMenu();
|
2018-08-08 15:35:54 +02:00
|
|
|
void handleChannelChanged();
|
2018-07-04 13:05:54 +02:00
|
|
|
|
2018-08-08 15:35:54 +02:00
|
|
|
Split *const split_{};
|
|
|
|
QString tooltipText_{};
|
|
|
|
bool isLive_{false};
|
2020-05-24 11:57:15 +02:00
|
|
|
QString thumbnail_;
|
|
|
|
QElapsedTimer lastThumbnail_;
|
2017-01-15 16:38:30 +01:00
|
|
|
|
2018-08-08 15:35:54 +02:00
|
|
|
// ui
|
|
|
|
Button *dropdownButton_{};
|
2018-09-04 21:39:54 +02:00
|
|
|
Label *titleLabel_{};
|
2018-08-08 15:35:54 +02:00
|
|
|
EffectLabel *modeButton_{};
|
|
|
|
Button *moderationButton_{};
|
2020-10-10 17:24:53 +02:00
|
|
|
Button *viewersButton_{};
|
2018-09-04 21:39:54 +02:00
|
|
|
Button *addButton_{};
|
2017-01-15 16:38:30 +01:00
|
|
|
|
2018-08-08 15:35:54 +02:00
|
|
|
// states
|
|
|
|
QPoint dragStart_{};
|
|
|
|
bool dragging_{false};
|
|
|
|
bool doubleClicked_{false};
|
|
|
|
bool menuVisible_{false};
|
2018-08-07 09:38:18 +02:00
|
|
|
|
2018-08-08 15:35:54 +02:00
|
|
|
// signals
|
2018-07-04 13:05:54 +02:00
|
|
|
pajlada::Signals::NoArgSignal modeUpdateRequested_;
|
2018-07-06 19:23:47 +02:00
|
|
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
2018-08-08 15:35:54 +02:00
|
|
|
std::vector<pajlada::Signals::ScopedConnection> channelConnections_;
|
2018-04-11 01:06:13 +02:00
|
|
|
|
2017-06-10 23:53:39 +02:00
|
|
|
public slots:
|
2018-08-08 15:35:54 +02:00
|
|
|
void moveSplit();
|
|
|
|
void reloadChannelEmotes();
|
2018-10-04 22:34:57 +02:00
|
|
|
void reloadSubscriberEmotes();
|
2018-08-08 15:35:54 +02:00
|
|
|
void reconnect();
|
2017-01-01 02:30:42 +01:00
|
|
|
};
|
|
|
|
|
2017-06-07 10:09:24 +02:00
|
|
|
} // namespace chatterino
|