2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-12-16 02:22:35 +01:00
|
|
|
|
2017-12-17 16:45:15 +01:00
|
|
|
#include "basewidget.hpp"
|
2017-09-23 19:23:10 +02:00
|
|
|
#include "twitch/twitchchannel.hpp"
|
2018-01-04 02:19:35 +01:00
|
|
|
#include "util/concurrentmap.hpp"
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-09-23 19:23:10 +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:
|
2018-01-11 20:16:25 +01:00
|
|
|
AccountPopupWidget(SharedChannel _channel);
|
2017-04-12 17:46:44 +02:00
|
|
|
|
|
|
|
void setName(const QString &name);
|
2018-01-11 20:16:25 +01:00
|
|
|
void setChannel(SharedChannel _channel);
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-09-23 19:23:10 +02:00
|
|
|
void updatePermissions();
|
|
|
|
|
2017-12-18 01:17:02 +01:00
|
|
|
protected:
|
2017-12-18 02:47:01 +01:00
|
|
|
virtual void dpiMultiplierChanged(float oldDpi, float newDpi) override;
|
2017-12-18 01:17:02 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
private:
|
2017-12-19 01:25:57 +01:00
|
|
|
Ui::AccountPopup *ui;
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-07-31 22:14:54 +02:00
|
|
|
void getUserId();
|
|
|
|
void getUserData();
|
|
|
|
void loadAvatar(const QUrl &avatarUrl);
|
|
|
|
|
2017-12-16 02:22:35 +01:00
|
|
|
void updateButtons(QWidget *layout, bool state);
|
|
|
|
void timeout(QPushButton *button, int time);
|
|
|
|
void sendCommand(QPushButton *button, QString command);
|
2017-09-23 19:23:10 +02:00
|
|
|
|
|
|
|
enum class permissions { User, Mod, Owner };
|
|
|
|
permissions permission;
|
|
|
|
|
2018-01-11 20:16:25 +01:00
|
|
|
SharedChannel channel;
|
2017-07-31 22:14:54 +02:00
|
|
|
|
|
|
|
QString userID;
|
|
|
|
QPixmap avatar;
|
|
|
|
|
2017-12-31 22:58:35 +01:00
|
|
|
util::ConcurrentMap<QString, QPixmap> avatarMap;
|
2017-07-31 22:14:54 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void focusOutEvent(QFocusEvent *event) override;
|
2017-09-23 19:23:10 +02:00
|
|
|
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
|