2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-04-07 18:05:28 +00:00
|
|
|
#include "ui/countryinput.h"
|
2016-03-14 16:59:18 +00:00
|
|
|
#include "intro/introwidget.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
namespace Ui {
|
2016-11-15 11:56:49 +00:00
|
|
|
class PhonePartInput;
|
|
|
|
class CountryCodeInput;
|
2016-11-04 19:50:35 +00:00
|
|
|
class RoundButton;
|
2016-11-16 10:44:06 +00:00
|
|
|
class FlatLabel;
|
2016-11-04 19:50:35 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
namespace Intro {
|
|
|
|
|
2017-02-18 11:29:19 +00:00
|
|
|
class PhoneWidget : public Widget::Step {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-11-24 19:28:23 +00:00
|
|
|
PhoneWidget(QWidget *parent, Widget::Data *data);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void selectCountry(const QString &country);
|
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
void setInnerFocus() override;
|
2016-03-14 16:59:18 +00:00
|
|
|
void activate() override;
|
|
|
|
void finished() override;
|
|
|
|
void cancelled() override;
|
2016-11-24 19:28:23 +00:00
|
|
|
void submit() override;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
bool hasBack() const override {
|
|
|
|
return true;
|
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
|
|
|
private slots:
|
2014-05-30 08:53:19 +00:00
|
|
|
void onInputChange();
|
|
|
|
void onCheckRequest();
|
|
|
|
|
|
|
|
private:
|
2016-11-24 19:28:23 +00:00
|
|
|
void updateSignupGeometry();
|
|
|
|
void countryChanged();
|
|
|
|
|
2018-04-09 17:48:29 +00:00
|
|
|
//void phoneCheckDone(const MTPauth_CheckedPhone &result);
|
2016-11-24 19:28:23 +00:00
|
|
|
void phoneSubmitDone(const MTPauth_SentCode &result);
|
|
|
|
bool phoneSubmitFail(const RPCError &error);
|
|
|
|
|
2018-04-09 17:48:29 +00:00
|
|
|
//void toSignUp();
|
2016-11-16 10:44:06 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
QString fullNumber() const;
|
|
|
|
void stopCheck();
|
|
|
|
|
2018-06-04 15:35:11 +00:00
|
|
|
void showPhoneError(Fn<QString()> textFactory);
|
2016-11-24 19:28:23 +00:00
|
|
|
void hidePhoneError();
|
2018-04-09 17:48:29 +00:00
|
|
|
//void showSignup();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
bool _changed = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<CountryInput> _country;
|
|
|
|
object_ptr<Ui::CountryCodeInput> _code;
|
|
|
|
object_ptr<Ui::PhonePartInput> _phone;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _signup = { nullptr };
|
2016-11-04 19:50:35 +00:00
|
|
|
|
|
|
|
QString _sentPhone;
|
|
|
|
mtpRequestId _sentRequest = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<QTimer> _checkRequest;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
};
|
2016-11-24 19:28:23 +00:00
|
|
|
|
|
|
|
} // namespace Intro
|