mirror-chatterino2/src/widgets/accountpopup.hpp

64 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
2017-12-17 16:45:15 +01:00
#include "basewidget.hpp"
#include "concurrentmap.hpp"
#include "twitch/twitchchannel.hpp"
2017-04-12 17:46:44 +02:00
#include <QPushButton>
2017-04-12 17:46:44 +02:00
#include <QWidget>
#include <memory>
2017-04-14 17:52:22 +02:00
namespace Ui {
2017-04-19 15:24:19 +02:00
class AccountPopup;
2017-04-12 17:46:44 +02:00
}
2017-04-14 17:52:22 +02:00
namespace chatterino {
2017-04-12 17:46:44 +02:00
class Channel;
2017-04-14 17:52:22 +02:00
namespace widgets {
2017-04-12 17:46:44 +02:00
2017-12-17 16:45:15 +01:00
class AccountPopupWidget : public BaseWidget
2017-04-12 17:46:44 +02:00
{
Q_OBJECT
public:
2017-09-12 22:10:30 +02:00
AccountPopupWidget(std::shared_ptr<Channel> channel);
2017-04-12 17:46:44 +02:00
void setName(const QString &name);
2017-09-12 22:10:30 +02:00
void setChannel(std::shared_ptr<Channel> channel);
2017-04-12 17:46:44 +02:00
void updatePermissions();
protected:
virtual void dpiMultiplyerChanged(float oldDpi, float newDpi) override;
2017-04-12 17:46:44 +02:00
private:
2017-04-19 15:24:19 +02:00
Ui::AccountPopup *_ui;
2017-04-12 17:46:44 +02:00
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);
enum class permissions { User, Mod, Owner };
permissions permission;
2017-09-12 22:10:30 +02:00
std::shared_ptr<Channel> _channel;
QString userID;
QPixmap avatar;
2017-08-12 12:09:26 +02:00
ConcurrentMap<QString, QPixmap> avatarMap;
protected:
virtual void focusOutEvent(QFocusEvent *event) override;
virtual void showEvent(QShowEvent *event) override;
2017-04-12 17:46:44 +02:00
};
2017-04-14 17:52:22 +02:00
} // namespace widgets
} // namespace chatterino