2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-22 18:27:17 +00:00

96 lines
2.1 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
2019-11-26 14:10:44 +03:00
#include "intro/intro_step.h"
2019-11-27 12:45:23 +03:00
#include "intro/intro_widget.h"
#include "ui/widgets/fields/masked_input_field.h"
2019-11-27 11:33:18 +03:00
#include "base/timer.h"
namespace Ui {
class RoundButton;
class LinkButton;
2016-11-24 22:28:23 +03:00
class FlatLabel;
class CodeInput;
} // namespace Ui
2016-11-24 22:28:23 +03:00
namespace Intro {
2019-11-26 14:10:44 +03:00
namespace details {
enum class CallStatus;
2016-11-24 22:28:23 +03:00
2019-11-27 11:33:18 +03:00
class CodeWidget final : public Step {
public:
2019-07-24 10:46:23 +02:00
CodeWidget(
QWidget *parent,
not_null<Main::Account*> account,
2019-11-26 14:10:44 +03:00
not_null<Data*> data);
bool hasBack() const override {
return true;
}
2016-11-24 22:28:23 +03:00
void setInnerFocus() override;
void activate() override;
void finished() override;
void cancelled() override;
2016-11-24 22:28:23 +03:00
void submit() override;
rpl::producer<QString> nextButtonText() const override;
rpl::producer<const style::RoundButton*> nextButtonStyle() const override;
void updateDescText();
2016-11-24 22:28:23 +03:00
protected:
void resizeEvent(QResizeEvent *e) override;
private:
2019-11-27 11:33:18 +03:00
void noTelegramCode();
void sendCall();
void checkRequest();
2019-11-26 17:27:09 +03:00
int errorTop() const override;
2016-11-24 22:28:23 +03:00
void updateCallText();
void refreshLang();
void updateControlsGeometry();
2016-11-24 22:28:23 +03:00
void codeSubmitDone(const MTPauth_Authorization &result);
2021-03-12 16:48:00 +04:00
void codeSubmitFail(const MTP::Error &error);
2016-11-24 22:28:23 +03:00
void showCodeError(rpl::producer<QString> text);
2023-01-10 17:10:34 +04:00
void callDone(const MTPauth_SentCode &result);
void gotPassword(const MTPaccount_Password &result);
void noTelegramCodeDone(const MTPauth_SentCode &result);
2021-03-12 16:48:00 +04:00
void noTelegramCodeFail(const MTP::Error &result);
void submitCode(const QString &text);
void stopCheck();
object_ptr<Ui::LinkButton> _noTelegramCode;
2016-11-24 22:28:23 +03:00
mtpRequestId _noTelegramCodeRequestId = 0;
object_ptr<Ui::CodeInput> _code;
QString _sentCode;
mtpRequestId _sentRequest = 0;
2016-11-24 22:28:23 +03:00
rpl::variable<bool> _isFragment = false;
2019-11-27 11:33:18 +03:00
base::Timer _callTimer;
2019-11-26 14:10:44 +03:00
CallStatus _callStatus = CallStatus();
2016-11-24 22:28:23 +03:00
int _callTimeout;
mtpRequestId _callRequestId = 0;
object_ptr<Ui::FlatLabel> _callLabel;
2019-11-27 11:33:18 +03:00
base::Timer _checkRequestTimer;
};
2016-11-24 22:28:23 +03:00
2019-11-26 14:10:44 +03:00
} // namespace details
2016-11-24 22:28:23 +03:00
} // namespace Intro