| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #pragma once
- #include <QDialog>
- #include <QString>
- #include <QThread>
- #include "ui_OBSYoutubeActions.h"
- #include "youtube-api-wrappers.hpp"
- class WorkerThread : public QThread {
- Q_OBJECT
- public:
- WorkerThread(YoutubeApiWrappers *api) : QThread(), apiYouTube(api) {}
- void stop() { pending = false; }
- protected:
- YoutubeApiWrappers *apiYouTube;
- bool pending = true;
- public slots:
- void run() override;
- signals:
- void ready();
- void new_item(const QString &title, const QString &dateTimeString,
- const QString &broadcast, const QString &status,
- bool astart, bool astop);
- void failed();
- };
- class OBSYoutubeActions : public QDialog {
- Q_OBJECT
- std::unique_ptr<Ui::OBSYoutubeActions> ui;
- signals:
- void ok(const QString &id, const QString &key, bool autostart,
- bool autostop, bool start_now);
- protected:
- void UpdateOkButtonStatus();
- bool CreateEventAction(YoutubeApiWrappers *api,
- StreamDescription &stream, bool stream_later,
- bool ready_broadcast = false);
- bool ChooseAnEventAction(YoutubeApiWrappers *api,
- StreamDescription &stream);
- void ShowErrorDialog(QWidget *parent, QString text);
- public:
- explicit OBSYoutubeActions(QWidget *parent, Auth *auth,
- bool broadcastReady);
- virtual ~OBSYoutubeActions() override;
- bool Valid() { return valid; };
- private:
- void InitBroadcast();
- void ReadyBroadcast();
- void UiToBroadcast(BroadcastDescription &broadcast);
- void OpenYouTubeDashboard();
- void Cancel();
- void Accept();
- QString selectedBroadcast;
- bool autostart, autostop;
- bool valid = false;
- bool broadcastReady = false;
- YoutubeApiWrappers *apiYouTube;
- WorkerThread *workerThread;
- };
|