mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Update Telegram button added to DialogsWidget/Intro. Three dot menu.
This commit is contained in:
@@ -44,12 +44,12 @@ introCountry: countryInput {
|
||||
}
|
||||
|
||||
introBtnTop: 288px;
|
||||
introSkip: 45px;
|
||||
introSkip: 25px;
|
||||
introFinishSkip: 15px;
|
||||
introPhotoSize: 98px;
|
||||
introHeaderFont: font(24px);
|
||||
introHeaderSkip: 14px;
|
||||
introIconSkip: 54px;
|
||||
introIconSkip: 50px;
|
||||
introFont: font(16px);
|
||||
introLink: linkButton(btnDefLink) {
|
||||
font: introFont;
|
||||
@@ -61,7 +61,7 @@ introLabel: flatLabel(labelDefFlat) {
|
||||
}
|
||||
|
||||
introStepSize: size(400px, 200px);
|
||||
introSize: size(400px, 400px);
|
||||
introSize: size(400px, 460px);
|
||||
introSlideShift: 500px; // intro hiding animation
|
||||
introSlideDuration: 200;
|
||||
introSlideDelta: 0; // between hide start and show start
|
||||
|
@@ -35,20 +35,25 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "ui/buttons/icon_button.h"
|
||||
#include "ui/effects/widget_fade_wrap.h"
|
||||
#include "styles/style_intro.h"
|
||||
#include "autoupdater.h"
|
||||
|
||||
IntroWidget::IntroWidget(QWidget *parent) : TWidget(parent)
|
||||
, _a_stage(animation(this, &IntroWidget::step_stage))
|
||||
, _a_show(animation(this, &IntroWidget::step_show))
|
||||
, _back(this, new Ui::IconButton(this, st::introBackButton), base::lambda_unique<void()>(), st::introSlideDuration) {
|
||||
, _back(this, new Ui::IconButton(this, st::introBackButton), base::lambda_unique<void()>(), st::introSlideDuration)
|
||||
, _settings(this, lang(lng_menu_settings), st::defaultBoxButton) {
|
||||
_back->entity()->setClickedCallback([this] { onBack(); });
|
||||
_back->hideFast();
|
||||
|
||||
_settings->setClickedCallback([] { App::wnd()->showSettings(); });
|
||||
|
||||
_countryForReg = psCurrentCountry();
|
||||
|
||||
MTP::send(MTPhelp_GetNearestDc(), rpcDone(&IntroWidget::gotNearestDC));
|
||||
|
||||
_stepHistory.push_back(new IntroStart(this));
|
||||
_back->raise();
|
||||
_settings->raise();
|
||||
|
||||
show();
|
||||
setFocus();
|
||||
@@ -58,10 +63,32 @@ IntroWidget::IntroWidget(QWidget *parent) : TWidget(parent)
|
||||
_back->moveToLeft(st::introBackPosition.x(), st::introBackPosition.y());
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
Sandbox::connect(SIGNAL(updateLatest()), this, SLOT(onCheckUpdateStatus()));
|
||||
Sandbox::connect(SIGNAL(updateFailed()), this, SLOT(onCheckUpdateStatus()));
|
||||
Sandbox::connect(SIGNAL(updateReady()), this, SLOT(onCheckUpdateStatus()));
|
||||
Sandbox::startUpdateCheck();
|
||||
onCheckUpdateStatus();
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
void IntroWidget::onCheckUpdateStatus() {
|
||||
if (Sandbox::updatingState() == Application::UpdatingReady) {
|
||||
if (_update) return;
|
||||
_update.create(this, lang(lng_menu_update).toUpper(), st::defaultBoxButton);
|
||||
_update->show();
|
||||
_update->setClickedCallback([] {
|
||||
checkReadyUpdate();
|
||||
App::restart();
|
||||
});
|
||||
} else {
|
||||
if (!_update) return;
|
||||
_update.destroy();
|
||||
}
|
||||
updateControlsGeometry();
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
void IntroWidget::langChangeTo(int32 langId) {
|
||||
_langChangeTo = langId;
|
||||
}
|
||||
@@ -136,6 +163,10 @@ void IntroWidget::historyMove(MoveType type) {
|
||||
void IntroWidget::pushStep(IntroStep *step, MoveType type) {
|
||||
_stepHistory.push_back(step);
|
||||
_back->raise();
|
||||
_settings->raise();
|
||||
if (_update) {
|
||||
_update->raise();
|
||||
}
|
||||
_stepHistory.back()->hide();
|
||||
|
||||
historyMove(type);
|
||||
@@ -335,6 +366,14 @@ void IntroWidget::resizeEvent(QResizeEvent *e) {
|
||||
for (auto step : _stepHistory) {
|
||||
step->setGeometry(r);
|
||||
}
|
||||
updateControlsGeometry();
|
||||
}
|
||||
|
||||
void IntroWidget::updateControlsGeometry() {
|
||||
_settings->moveToLeft(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _settings->height());
|
||||
if (_update) {
|
||||
_update->moveToLeft(st::boxButtonPadding.right() + _settings->width() + st::boxButtonPadding.left(), _settings->y());
|
||||
}
|
||||
}
|
||||
|
||||
void IntroWidget::finish(const MTPUser &user, const QImage &photo) {
|
||||
|
@@ -35,10 +35,6 @@ class IntroWidget : public TWidget, public RPCSender {
|
||||
public:
|
||||
IntroWidget(QWidget *window);
|
||||
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
void animShow(const QPixmap &bgAnimCache, bool back = false);
|
||||
void step_show(float64 ms, bool timer);
|
||||
void stop_show();
|
||||
@@ -87,7 +83,12 @@ public:
|
||||
pushStep(step, MoveReplace);
|
||||
}
|
||||
|
||||
~IntroWidget() override;
|
||||
~IntroWidget();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
public slots:
|
||||
void onStepSubmit();
|
||||
@@ -97,7 +98,13 @@ public slots:
|
||||
signals:
|
||||
void countryChanged();
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
private slots:
|
||||
void onCheckUpdateStatus();
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
private:
|
||||
void updateControlsGeometry();
|
||||
QPixmap grabStep(int skip = 0);
|
||||
|
||||
int _langChangeTo = 0;
|
||||
@@ -145,6 +152,8 @@ private:
|
||||
QString _firstname, _lastname;
|
||||
|
||||
ChildWidget<Ui::WidgetFadeWrap<Ui::IconButton>> _back;
|
||||
ChildWidget<BoxButton> _settings;
|
||||
ChildWidget<BoxButton> _update = { nullptr };
|
||||
|
||||
float64 _backFrom = 0.;
|
||||
float64 _backTo = 0.;
|
||||
|
Reference in New Issue
Block a user