obs-studio/UI/auth-twitch.hpp
derrod 2c7b14bc37 UI: Add UUID to Twitch panel URLs
Some Twitch dashboard panels now require a UUID, it is not used for
anything but local storage right now, and according to Twitch we can
generate it ourselves (or even use a static string). To be safe we can
just use QUuid to generate a "real" UUID and then store it locally until
the user disconnects the account.
2021-12-11 14:39:19 -08:00

53 lines
1 KiB
C++

#pragma once
#include <QDialog>
#include <QTimer>
#include <string>
#include <memory>
#include <json11.hpp>
#include "auth-oauth.hpp"
class BrowserDock;
class TwitchAuth : public OAuthStreamKey {
Q_OBJECT
friend class TwitchLogin;
QSharedPointer<BrowserDock> chat;
QSharedPointer<BrowserDock> info;
QSharedPointer<BrowserDock> stat;
QSharedPointer<BrowserDock> feed;
QSharedPointer<QAction> chatMenu;
QSharedPointer<QAction> infoMenu;
QSharedPointer<QAction> statMenu;
QSharedPointer<QAction> feedMenu;
bool uiLoaded = false;
std::string name;
std::string uuid;
virtual bool RetryLogin() override;
virtual void SaveInternal() override;
virtual bool LoadInternal() override;
bool MakeApiRequest(const char *path, json11::Json &json_out);
bool GetChannelInfo();
virtual void LoadUI() override;
public:
TwitchAuth(const Def &d);
static std::shared_ptr<Auth> Login(QWidget *parent,
const std::string &service_name);
QTimer uiLoadTimer;
public slots:
void TryLoadSecondaryUIPanes();
void LoadSecondaryUIPanes();
};