2023-06-05 15:16:38 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "window-dock-browser.hpp"
|
|
|
|
#include "youtube-api-wrappers.hpp"
|
|
|
|
|
|
|
|
class QAction;
|
|
|
|
class QCefWidget;
|
|
|
|
|
|
|
|
class YouTubeAppDock : public BrowserDock {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-08-10 10:31:19 +02:00
|
|
|
YouTubeAppDock(const QString &title);
|
2023-06-05 15:16:38 +02:00
|
|
|
~YouTubeAppDock();
|
|
|
|
|
|
|
|
enum streaming_mode_t { YTSM_ACCOUNT, YTSM_STREAM_KEY };
|
|
|
|
|
|
|
|
void AccountConnected();
|
|
|
|
void AccountDisconnected();
|
|
|
|
void SettingsUpdated(bool cleanup = false);
|
|
|
|
void Update();
|
|
|
|
|
|
|
|
void BroadcastCreated(const char *stream_id);
|
|
|
|
void BroadcastSelected(const char *stream_id);
|
|
|
|
void IngestionStarted();
|
|
|
|
void IngestionStopped();
|
|
|
|
|
|
|
|
static bool IsYTServiceSelected();
|
|
|
|
static YoutubeApiWrappers *GetYTApi();
|
|
|
|
static void CleanupYouTubeUrls();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void IngestionStarted(const char *stream_id, streaming_mode_t mode);
|
|
|
|
void IngestionStopped(const char *stream_id, streaming_mode_t mode);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string InitYTUserUrl();
|
|
|
|
void SetVisibleYTAppDockInMenu(bool visible);
|
2023-08-10 10:31:19 +02:00
|
|
|
void AddYouTubeAppDock();
|
2023-06-05 15:16:38 +02:00
|
|
|
void CreateBrowserWidget(const std::string &url);
|
|
|
|
virtual void showEvent(QShowEvent *event) override;
|
|
|
|
virtual void closeEvent(QCloseEvent *event) override;
|
|
|
|
void DispatchYTEvent(const char *event, const char *video_id,
|
|
|
|
streaming_mode_t mode);
|
|
|
|
void UpdateChannelId();
|
|
|
|
void SetInitEvent(streaming_mode_t mode, const char *event = nullptr,
|
|
|
|
const char *video_id = nullptr,
|
|
|
|
const char *channelId = nullptr);
|
|
|
|
|
|
|
|
QString channelId;
|
|
|
|
QPointer<QCefWidget> dockBrowser;
|
|
|
|
QCefCookieManager *cookieManager; // is not a Qt object
|
|
|
|
};
|