mirror-chatterino2/src/widgets/dialogs/UserInfoPopup.hpp

86 lines
2 KiB
C++
Raw Normal View History

#pragma once
#include "widgets/BaseWindow.hpp"
#include "widgets/helper/ChannelView.hpp"
#include <pajlada/signals/scoped-connection.hpp>
#include <pajlada/signals/signal.hpp>
class QCheckBox;
namespace chatterino {
class Channel;
using ChannelPtr = std::shared_ptr<Channel>;
class Label;
class UserInfoPopup final : public BaseWindow
{
Q_OBJECT
public:
UserInfoPopup(bool closeAutomatically, QWidget *parent);
void setData(const QString &name, const ChannelPtr &channel);
protected:
virtual void themeChangedEvent() override;
virtual void scaleChangedEvent(float scale) override;
private:
void installEvents();
void updateUserData();
void updateLatestMessages();
void loadAvatar(const QUrl &url);
bool isMod_;
bool isBroadcaster_;
QString userName_;
QString userId_;
QString avatarUrl_;
ChannelPtr channel_;
pajlada::Signals::NoArgSignal userStateChanged_;
std::unique_ptr<pajlada::Signals::ScopedConnection> refreshConnection_;
std::shared_ptr<bool> hack_;
struct {
Button *avatarButton = nullptr;
Button *localizedNameCopyButton = nullptr;
Label *nameLabel = nullptr;
Label *localizedNameLabel = nullptr;
Label *viewCountLabel = nullptr;
Label *followerCountLabel = nullptr;
Label *createdDateLabel = nullptr;
Label *userIDLabel = nullptr;
Label *followageLabel = nullptr;
Label *subageLabel = nullptr;
QCheckBox *block = nullptr;
QCheckBox *ignoreHighlights = nullptr;
Label *noMessagesLabel = nullptr;
ChannelView *latestMessages = nullptr;
QPushButton *refreshButton = nullptr;
} ui_;
class TimeoutWidget : public BaseWidget
{
public:
enum Action { Ban, Unban, Timeout };
TimeoutWidget();
pajlada::Signals::Signal<std::pair<Action, int>> buttonClicked;
protected:
void paintEvent(QPaintEvent *event) override;
};
};
} // namespace chatterino