mirror-chatterino2/src/widgets/splits/SplitHeader.hpp

90 lines
2.3 KiB
C++
Raw Normal View History

#pragma once
2017-01-01 02:30:42 +01:00
2018-06-26 14:09:39 +02:00
#include "widgets/BaseWidget.hpp"
#include "widgets/helper/RippleEffectLabel.hpp"
#include "widgets/helper/SignalLabel.hpp"
2017-01-15 16:38:30 +01:00
#include <QAction>
#include <QHBoxLayout>
#include <QLabel>
#include <QMenu>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QPoint>
#include <QWidget>
2018-01-17 18:36:12 +01:00
#include <pajlada/settings/setting.hpp>
#include <pajlada/signals/connection.hpp>
#include <pajlada/signals/signalholder.hpp>
#include <vector>
2017-01-01 02:30:42 +01:00
2017-04-14 17:52:22 +02:00
namespace chatterino {
2017-11-12 17:21:50 +01:00
class Split;
2018-06-11 15:04:54 +02:00
class Label;
2017-01-01 02:30:42 +01:00
class SplitHeader : 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);
virtual ~SplitHeader() override;
2018-01-13 04:05:38 +01:00
2017-06-10 22:48:28 +02:00
// Update channel text from chat widget
2017-01-17 00:15:44 +01:00
void updateChannelText();
2018-01-17 16:52:51 +01:00
void updateModerationModeIcon();
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;
virtual void enterEvent(QEvent *) override;
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-07-04 13:05:54 +02:00
void rightButtonClicked();
void initializeChannelSignals();
void setupModeLabel(RippleEffectLabel &label);
std::unique_ptr<QMenu> createMainMenu();
std::unique_ptr<QMenu> createChatModeMenu();
2018-07-04 13:05:54 +02:00
Split *split_;
2017-01-16 18:27:51 +01:00
2018-07-06 19:23:47 +02:00
QPoint dragStart_;
bool dragging_ = false;
bool doubleClicked_ = false;
bool showingHelpTooltip_ = false;
2017-01-15 16:38:30 +01:00
2018-07-06 19:23:47 +02:00
pajlada::Signals::Connection onlineStatusChangedConnection_;
2018-08-07 09:38:18 +02:00
RippleEffectButton *dropdownButton_{};
// Label *titleLabel{};
Label *titleLabel{};
RippleEffectLabel *modeButton_{};
RippleEffectButton *moderationButton_{};
2017-01-15 16:38:30 +01:00
2018-08-07 09:38:18 +02:00
bool menuVisible_{};
2018-07-04 13:05:54 +02:00
pajlada::Signals::NoArgSignal modeUpdateRequested_;
2018-07-06 19:23:47 +02:00
QString tooltip_;
bool isLive_;
2018-07-06 19:23:47 +02:00
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
public slots:
2017-01-15 16:38:30 +01:00
void menuMoveSplit();
void menuReloadChannelEmotes();
void menuManualReconnect();
void menuShowChangelog();
2017-01-01 02:30:42 +01:00
};
} // namespace chatterino