#pragma once #include "basewindow.hpp" #include "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(SharedChannel _channel); void setName(const QString &name); void setChannel(SharedChannel _channel); public slots: void actuallyRefreshButtons(); signals: void refreshButtons(); protected: virtual void dpiMultiplierChanged(float oldDpi, 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 }; SharedChannel channel; QPixmap avatar; util::ConcurrentMap avatarMap; struct User { QString username; QString userID; UserType userType = UserType::User; void refreshUserType(const SharedChannel &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