YouTubeChatDock.cpp 991 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "YouTubeChatDock.hpp"
  2. #include <docks/YouTubeAppDock.hpp>
  3. #include <utility/YoutubeApiWrappers.hpp>
  4. #include <widgets/OBSBasic.hpp>
  5. #include <qt-wrappers.hpp>
  6. #include <QHBoxLayout>
  7. #include <QPushButton>
  8. #include "moc_YouTubeChatDock.cpp"
  9. #ifdef BROWSER_AVAILABLE
  10. void YoutubeChatDock::YoutubeCookieCheck()
  11. {
  12. QPointer<YoutubeChatDock> this_ = this;
  13. auto cb = [this_](bool currentlyLoggedIn) {
  14. bool previouslyLoggedIn = this_->isLoggedIn;
  15. this_->isLoggedIn = currentlyLoggedIn;
  16. bool loginStateChanged = (currentlyLoggedIn && !previouslyLoggedIn) ||
  17. (!currentlyLoggedIn && previouslyLoggedIn);
  18. if (loginStateChanged) {
  19. OBSBasic *main = OBSBasic::Get();
  20. if (main->GetYouTubeAppDock() != nullptr) {
  21. QMetaObject::invokeMethod(main->GetYouTubeAppDock(), "SettingsUpdated",
  22. Qt::QueuedConnection, Q_ARG(bool, !currentlyLoggedIn));
  23. }
  24. }
  25. };
  26. if (panel_cookies) {
  27. panel_cookies->CheckForCookie("https://www.youtube.com", "SID", cb);
  28. }
  29. }
  30. #endif