intro_qr.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "ui/countryinput.h"
  9. #include "intro/intro_step.h"
  10. #include "base/timer.h"
  11. namespace Intro {
  12. namespace details {
  13. class QrWidget final : public Step {
  14. public:
  15. QrWidget(
  16. QWidget *parent,
  17. not_null<Main::Account*> account,
  18. not_null<Data*> data);
  19. void activate() override;
  20. void finished() override;
  21. void cancelled() override;
  22. void submit() override;
  23. rpl::producer<QString> nextButtonText() const override;
  24. bool hasBack() const override {
  25. return true;
  26. }
  27. private:
  28. int errorTop() const override;
  29. void sendCheckPasswordRequest();
  30. void setupControls();
  31. void refreshCode();
  32. void checkForTokenUpdate(const MTPUpdates &updates);
  33. void checkForTokenUpdate(const MTPUpdate &update);
  34. void handleTokenResult(const MTPauth_LoginToken &result);
  35. void showTokenError(const MTP::Error &error);
  36. void importTo(MTP::DcId dcId, const QByteArray &token);
  37. void showToken(const QByteArray &token);
  38. void done(const MTPauth_Authorization &authorization);
  39. rpl::event_stream<QByteArray> _qrCodes;
  40. base::Timer _refreshTimer;
  41. mtpRequestId _requestId = 0;
  42. bool _forceRefresh = false;
  43. };
  44. [[nodiscard]] QImage TelegramLogoImage();
  45. } // namespace details
  46. } // namespace Intro