2021-06-28 00:30:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <random>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "auth-oauth.hpp"
|
|
|
|
|
2021-08-16 06:26:01 +02:00
|
|
|
#ifdef BROWSER_AVAILABLE
|
2022-05-08 16:50:36 +02:00
|
|
|
#include "window-dock-browser.hpp"
|
|
|
|
#include "lineedit-autoresize.hpp"
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
class YoutubeChatDock : public BrowserDock {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string apiChatId;
|
|
|
|
LineEditAutoResize *lineEdit;
|
|
|
|
QPushButton *sendButton;
|
|
|
|
QHBoxLayout *chatLayout;
|
|
|
|
|
|
|
|
public:
|
2024-06-09 14:09:57 +02:00
|
|
|
YoutubeChatDock(const QString &title);
|
2022-05-08 16:50:36 +02:00
|
|
|
void SetWidget(QCefWidget *widget_);
|
|
|
|
void SetApiChatId(const std::string &id);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void SendChatMessage();
|
|
|
|
void ShowErrorMessage(const QString &error);
|
|
|
|
void EnableChatInput();
|
|
|
|
};
|
2021-08-16 06:26:01 +02:00
|
|
|
#endif
|
|
|
|
|
2021-08-23 00:21:33 +02:00
|
|
|
inline const std::vector<Auth::Def> youtubeServices = {
|
2021-09-05 05:35:21 +02:00
|
|
|
{"YouTube - RTMP", Auth::Type::OAuth_LinkedAccount, true, true},
|
|
|
|
{"YouTube - RTMPS", Auth::Type::OAuth_LinkedAccount, true, true},
|
|
|
|
{"YouTube - HLS", Auth::Type::OAuth_LinkedAccount, true, true}};
|
2021-06-28 00:30:00 +02:00
|
|
|
|
|
|
|
class YoutubeAuth : public OAuthStreamKey {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
bool uiLoaded = false;
|
|
|
|
std::string section;
|
|
|
|
|
2021-08-16 06:26:01 +02:00
|
|
|
#ifdef BROWSER_AVAILABLE
|
2023-08-25 22:41:10 +02:00
|
|
|
YoutubeChatDock *chat = nullptr;
|
2021-08-16 06:26:01 +02:00
|
|
|
#endif
|
|
|
|
|
2021-06-28 00:30:00 +02:00
|
|
|
virtual bool RetryLogin() override;
|
|
|
|
virtual void SaveInternal() override;
|
|
|
|
virtual bool LoadInternal() override;
|
|
|
|
virtual void LoadUI() override;
|
|
|
|
|
|
|
|
QString GenerateState();
|
|
|
|
|
|
|
|
public:
|
|
|
|
YoutubeAuth(const Def &d);
|
2022-10-21 16:53:06 +02:00
|
|
|
~YoutubeAuth();
|
2021-06-28 00:30:00 +02:00
|
|
|
|
2022-05-08 16:50:36 +02:00
|
|
|
void SetChatId(const QString &chat_id, const std::string &api_chat_id);
|
2021-08-16 06:26:01 +02:00
|
|
|
void ResetChat();
|
|
|
|
|
2021-06-28 00:30:00 +02:00
|
|
|
static std::shared_ptr<Auth> Login(QWidget *parent,
|
|
|
|
const std::string &service);
|
|
|
|
};
|