auth-twitch.hpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include <QDialog>
  3. #include <QTimer>
  4. #include <string>
  5. #include <memory>
  6. #include <json11.hpp>
  7. #include "auth-oauth.hpp"
  8. class BrowserDock;
  9. class TwitchAuth : public OAuthStreamKey {
  10. Q_OBJECT
  11. friend class TwitchLogin;
  12. QSharedPointer<BrowserDock> chat;
  13. QSharedPointer<BrowserDock> info;
  14. QSharedPointer<BrowserDock> stat;
  15. QSharedPointer<BrowserDock> feed;
  16. QSharedPointer<QAction> chatMenu;
  17. QSharedPointer<QAction> infoMenu;
  18. QSharedPointer<QAction> statMenu;
  19. QSharedPointer<QAction> feedMenu;
  20. bool uiLoaded = false;
  21. std::string name;
  22. virtual bool RetryLogin() override;
  23. virtual void SaveInternal() override;
  24. virtual bool LoadInternal() override;
  25. bool MakeApiRequest(const char *path, json11::Json &json_out);
  26. bool GetChannelInfo();
  27. virtual void LoadUI() override;
  28. public:
  29. TwitchAuth(const Def &d);
  30. static std::shared_ptr<Auth> Login(QWidget *parent,
  31. const std::string &service_name);
  32. QTimer uiLoadTimer;
  33. public slots:
  34. void TryLoadSecondaryUIPanes();
  35. void LoadSecondaryUIPanes();
  36. };