tdesktop/Telegram/SourceFiles/intro/intro_phone.h

76 lines
1.5 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
#include "ui/countryinput.h"
2019-11-26 11:10:44 +00:00
#include "intro/intro_step.h"
2019-11-27 08:33:18 +00:00
#include "base/timer.h"
namespace Ui {
class PhonePartInput;
class CountryCodeInput;
class RoundButton;
class FlatLabel;
} // namespace Ui
2016-11-24 19:28:23 +00:00
namespace Intro {
2019-11-26 11:10:44 +00:00
namespace details {
2016-11-24 19:28:23 +00:00
2019-11-27 08:33:18 +00:00
class PhoneWidget final : public Step {
public:
2019-07-24 08:46:23 +00:00
PhoneWidget(
QWidget *parent,
not_null<Main::Account*> account,
2019-11-26 11:10:44 +00:00
not_null<Data*> data);
void selectCountry(const QString &country);
2016-11-24 19:28:23 +00:00
void setInnerFocus() override;
void activate() override;
void finished() override;
void cancelled() override;
2016-11-24 19:28:23 +00:00
void submit() override;
2016-11-24 19:28:23 +00:00
bool hasBack() const override {
return true;
}
2016-11-24 19:28:23 +00:00
protected:
void resizeEvent(QResizeEvent *e) override;
private:
2019-11-27 09:45:23 +00:00
void setupQrLogin();
2019-11-27 08:33:18 +00:00
void phoneChanged();
void checkRequest();
2016-11-24 19:28:23 +00:00
void countryChanged();
void phoneSubmitDone(const MTPauth_SentCode &result);
2020-06-11 13:07:14 +00:00
void phoneSubmitFail(const RPCError &error);
2016-11-24 19:28:23 +00:00
QString fullNumber() const;
void stopCheck();
void showPhoneError(rpl::producer<QString> text);
2016-11-24 19:28:23 +00:00
void hidePhoneError();
bool _changed = false;
object_ptr<CountryInput> _country;
object_ptr<Ui::CountryCodeInput> _code;
object_ptr<Ui::PhonePartInput> _phone;
QString _sentPhone;
mtpRequestId _sentRequest = 0;
2019-11-27 08:33:18 +00:00
base::Timer _checkRequestTimer;
};
2016-11-24 19:28:23 +00:00
2019-11-26 11:10:44 +00:00
} // namespace details
2016-11-24 19:28:23 +00:00
} // namespace Intro