2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 10:47:38 +00:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2014-12-01 10:47:38 +00:00
|
|
|
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class Window;
|
|
|
|
class IntroSteps;
|
|
|
|
class IntroPhone;
|
|
|
|
class IntroCode;
|
|
|
|
class IntroSignup;
|
2015-04-02 10:33:19 +00:00
|
|
|
class IntroPwdCheck;
|
2014-05-30 08:53:19 +00:00
|
|
|
class IntroStage;
|
|
|
|
class Text;
|
|
|
|
|
|
|
|
class IntroWidget : public QWidget, public Animated {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
IntroWidget(Window *window);
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
void mousePressEvent(QMouseEvent *e);
|
|
|
|
void keyPressEvent(QKeyEvent *e);
|
2015-03-02 12:34:16 +00:00
|
|
|
|
2014-12-12 16:27:03 +00:00
|
|
|
void updateWideMode();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void animShow(const QPixmap &bgAnimCache, bool back = false);
|
|
|
|
bool animStep(float64 ms);
|
|
|
|
|
|
|
|
QRect innerRect() const;
|
|
|
|
QString currentCountry() const;
|
|
|
|
|
|
|
|
void setPhone(const QString &phone, const QString &phone_hash, bool registered);
|
|
|
|
void setCode(const QString &code);
|
|
|
|
void setCallTimeout(int32 callTimeout);
|
2015-04-02 10:33:19 +00:00
|
|
|
void setPwdSalt(const QByteArray &salt);
|
|
|
|
void setHasRecovery(bool hasRecovery);
|
|
|
|
void setPwdHint(const QString &hint);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
const QString &getPhone() const;
|
|
|
|
const QString &getPhoneHash() const;
|
|
|
|
const QString &getCode() const;
|
|
|
|
int32 getCallTimeout() const;
|
2015-04-02 10:33:19 +00:00
|
|
|
const QByteArray &getPwdSalt() const;
|
|
|
|
bool getHasRecovery() const;
|
|
|
|
const QString &getPwdHint() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void finish(const MTPUser &user, const QImage &photo = QImage());
|
|
|
|
|
2014-08-01 11:09:46 +00:00
|
|
|
void rpcInvalidate();
|
2014-12-19 21:20:30 +00:00
|
|
|
void langChangeTo(int32 langId);
|
2014-08-01 11:09:46 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
~IntroWidget();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onIntroNext();
|
|
|
|
void onIntroBack();
|
|
|
|
void onDoneStateChanged(int oldState, ButtonStateChangeSource source);
|
|
|
|
void onParentResize(const QSize &newSize);
|
2014-12-19 21:20:30 +00:00
|
|
|
void onChangeLang();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
void countryChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void makeHideCache(int stage = -1);
|
|
|
|
void makeShowCache(int stage = -1);
|
|
|
|
void prepareMove();
|
|
|
|
bool createNext();
|
|
|
|
|
2014-12-19 21:20:30 +00:00
|
|
|
int32 _langChangeTo;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
QPixmap cacheForHide, cacheForShow;
|
|
|
|
int cacheForHideInd, cacheForShowInd;
|
|
|
|
anim::ivalue xCoordHide, xCoordShow;
|
|
|
|
anim::fvalue cAlphaHide, cAlphaShow;
|
|
|
|
|
|
|
|
QPixmap _animCache, _bgAnimCache;
|
|
|
|
anim::ivalue a_coord, a_bgCoord;
|
|
|
|
anim::fvalue a_alpha, a_bgAlpha;
|
|
|
|
|
|
|
|
Window *wnd;
|
|
|
|
IntroSteps *steps;
|
|
|
|
IntroPhone *phone;
|
|
|
|
IntroCode *code;
|
|
|
|
IntroSignup *signup;
|
2015-04-02 10:33:19 +00:00
|
|
|
IntroPwdCheck *pwdcheck;
|
2015-04-04 20:01:34 +00:00
|
|
|
IntroStage *stages[5];
|
2014-05-30 08:53:19 +00:00
|
|
|
int current, moving, visibilityChanging;
|
|
|
|
|
|
|
|
QString _phone, _phone_hash;
|
|
|
|
int32 _callTimeout;
|
|
|
|
bool _registered;
|
|
|
|
|
|
|
|
QString _code;
|
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
QByteArray _pwdSalt;
|
|
|
|
bool _hasRecovery;
|
|
|
|
QString _pwdHint;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
QString _firstname, _lastname;
|
|
|
|
|
2014-11-26 16:45:52 +00:00
|
|
|
IconedButton _back;
|
|
|
|
float64 _backFrom, _backTo;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IntroStage : public QWidget {
|
|
|
|
public:
|
|
|
|
|
|
|
|
IntroStage(IntroWidget *parent) : QWidget(parent) {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void activate() = 0; // show and activate
|
2015-04-04 20:01:34 +00:00
|
|
|
virtual void prepareShow() {
|
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
virtual void deactivate() = 0; // deactivate and hide
|
|
|
|
virtual void onNext() = 0;
|
|
|
|
virtual void onBack() = 0;
|
2014-11-26 16:45:52 +00:00
|
|
|
virtual bool hasBack() const {
|
|
|
|
return false;
|
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
IntroWidget *intro() {
|
|
|
|
return qobject_cast<IntroWidget*>(parent());
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|