#pragma once #include "basewindow.hpp" #include "providers/twitch/twitchchannel.hpp" #include "util/concurrentmap.hpp" #include #include #include namespace Ui { class AccountPopup; } namespace chatterino { class Channel; namespace widgets { class AccountPopupWidget : public BaseWindow { Q_OBJECT public: AccountPopupWidget(ChannelPtr _channel); void setName(const QString &name); void setChannel(ChannelPtr _channel); public slots: void actuallyRefreshButtons(); signals: void refreshButtons(); protected: virtual void scaleChangedEvent(float newDpi) override; private: Ui::AccountPopup *ui; void getUserId(); void getUserData(); void loadAvatar(const QUrl &avatarUrl); void updateButtons(QWidget *layout, bool state); void timeout(QPushButton *button, int time); void sendCommand(QPushButton *button, QString command); void refreshLayouts(); enum class UserType { User, Mod, Owner }; ChannelPtr channel; QPixmap avatar; util::ConcurrentMap avatarMap; struct User { QString username; QString userID; UserType userType = UserType::User; void refreshUserType(const ChannelPtr &channel, bool loggedInUser); }; User loggedInUser; User popupWidgetUser; struct { bool following = false; bool ignoring = false; } relationship; protected: virtual void focusOutEvent(QFocusEvent *event) override; virtual void showEvent(QShowEvent *event) override; }; } // namespace widgets } // namespace chatterino