mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Palette usage improvements.
This commit is contained in:
@@ -43,8 +43,106 @@ introCountry: countryInput {
|
||||
align: align(left);
|
||||
}
|
||||
|
||||
introErrLabel: flatLabel(labelDefFlat) {
|
||||
font: introErrFont;
|
||||
introBtnTop: 288px;
|
||||
introSkip: 45px;
|
||||
introFinishSkip: 15px;
|
||||
introPhotoSize: 98px;
|
||||
introHeaderFont: font(24px);
|
||||
introHeaderSkip: 14px;
|
||||
introIconSkip: 54px;
|
||||
introFont: font(16px);
|
||||
introLink: linkButton(btnDefLink) {
|
||||
font: introFont;
|
||||
overFont: font(16px underline);
|
||||
}
|
||||
introLabel: flatLabel(labelDefFlat) {
|
||||
font: introFont;
|
||||
align: align(center);
|
||||
}
|
||||
|
||||
introStepSize: size(400px, 200px);
|
||||
introSize: size(400px, 400px);
|
||||
introSlideShift: 500px; // intro hiding animation
|
||||
introSlideDuration: 200;
|
||||
introSlideDelta: 0; // between hide start and show start
|
||||
introHideFunc: transition(easeInCirc);
|
||||
introShowFunc: transition(easeOutCirc);
|
||||
introAlphaHideFunc: transition(easeOutCirc);
|
||||
introAlphaShowFunc: transition(easeInCirc);
|
||||
introTextTop: 22px;
|
||||
introTextSize: size(400px, 93px);
|
||||
introCallSkip: 15px;
|
||||
introPwdTextSize: size(400px, 73px);
|
||||
|
||||
introNextButton: flatButton {
|
||||
duration: 200;
|
||||
cursor: cursor(pointer);
|
||||
|
||||
color: #ffffff;
|
||||
overColor: #ffffff;
|
||||
downColor: #ffffff;
|
||||
bgColor: #2fa9e2;
|
||||
overBgColor: #279ad0;
|
||||
downBgColor: #279ad0;
|
||||
|
||||
textTop: 16px;
|
||||
overTextTop: 16px;
|
||||
downTextTop: 17px;
|
||||
|
||||
font: font(17px);
|
||||
overFont: font(17px);
|
||||
|
||||
width: 300px;
|
||||
height: 56px;
|
||||
|
||||
radius: buttonRadius;
|
||||
}
|
||||
|
||||
introPhoneTop: 8px;
|
||||
inpIntroCountryCode: flatInput(inpDefGray) {
|
||||
width: 70px;
|
||||
height: 41px;
|
||||
align: align(center);
|
||||
}
|
||||
inpIntroPhone: flatInput(inpDefGray) {
|
||||
textMrg: margins(12px, 5px, 12px, 6px);
|
||||
width: 225px;
|
||||
height: 41px;
|
||||
}
|
||||
inpIntroCode: flatInput(inpDefGray) {
|
||||
textMrg: margins(12px, 5px, 12px, 6px);
|
||||
width: 106px;
|
||||
height: 41px;
|
||||
align: align(center);
|
||||
|
||||
phPos: point(0px, 0px);
|
||||
phAlign: align(center);
|
||||
phShift: 0px;
|
||||
}
|
||||
inpIntroName: flatInput(inpIntroPhone) {
|
||||
width: 192px;
|
||||
}
|
||||
inpIntroPassword: flatInput(inpIntroPhone) {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
introSelectDelta: 30px;
|
||||
|
||||
introErrorWidth: 450px;
|
||||
introErrorDuration: 200;
|
||||
introErrorTop: 15px;
|
||||
introErrorHeight: 40px;
|
||||
introErrorFont: font(16px);
|
||||
|
||||
introLabelTextStyle: textStyle(defaultTextStyle) {
|
||||
lineHeight: 30px;
|
||||
}
|
||||
introErrorLabelTextStyle: textStyle(defaultTextStyle) {
|
||||
lineHeight: 27px;
|
||||
}
|
||||
|
||||
introErrorLabel: flatLabel(labelDefFlat) {
|
||||
font: introErrorFont;
|
||||
align: align(center);
|
||||
}
|
||||
introBackButton: IconButton(defaultIconButton) {
|
||||
|
@@ -75,7 +75,7 @@ void CodeInput::correctValue(const QString &was, QString &now) {
|
||||
IntroCode::IntroCode(IntroWidget *parent) : IntroStep(parent)
|
||||
, a_errorAlpha(0)
|
||||
, _a_error(animation(this, &IntroCode::step_error))
|
||||
, next(this, lang(lng_intro_next), st::btnIntroNext)
|
||||
, next(this, lang(lng_intro_next), st::introNextButton)
|
||||
, _desc(st::introTextSize.width())
|
||||
, _noTelegramCode(this, lang(lng_code_no_telegram), st::introLink)
|
||||
, _noTelegramCodeRequestId(0)
|
||||
@@ -149,14 +149,14 @@ void IntroCode::paintEvent(QPaintEvent *e) {
|
||||
} break;
|
||||
}
|
||||
if (!callText.isEmpty()) {
|
||||
p.drawText(QRect(textRect.left(), code.y() + code.height() + st::introCallSkip, st::introTextSize.width(), st::introErrHeight), callText, style::al_center);
|
||||
p.drawText(QRect(textRect.left(), code.y() + code.height() + st::introCallSkip, st::introTextSize.width(), st::introErrorHeight), callText, style::al_center);
|
||||
}
|
||||
}
|
||||
if (_a_error.animating() || error.length()) {
|
||||
p.setOpacity(a_errorAlpha.current());
|
||||
p.setFont(st::introErrFont->f);
|
||||
p.setPen(st::introErrColor->p);
|
||||
p.drawText(QRect(textRect.left(), next.y() + next.height() + st::introErrTop, st::introTextSize.width(), st::introErrHeight), error, style::al_center);
|
||||
p.setFont(st::introErrorFont);
|
||||
p.setPen(st::introErrorFg);
|
||||
p.drawText(QRect(textRect.left(), next.y() + next.height() + st::introErrorTop, st::introTextSize.width(), st::introErrorHeight), error, style::al_center);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ void IntroCode::resizeEvent(QResizeEvent *e) {
|
||||
code.move((width() - code.width()) / 2, st::introTextTop + st::introTextSize.height() + st::introCountry.top);
|
||||
}
|
||||
textRect = QRect((width() - st::introTextSize.width()) / 2, st::introTextTop, st::introTextSize.width(), st::introTextSize.height());
|
||||
_noTelegramCode.move(textRect.left() + (st::introTextSize.width() - _noTelegramCode.width()) / 2, code.y() + code.height() + st::introCallSkip + (st::introErrHeight - _noTelegramCode.height()) / 2);
|
||||
_noTelegramCode.move(textRect.left() + (st::introTextSize.width() - _noTelegramCode.width()) / 2, code.y() + code.height() + st::introCallSkip + (st::introErrorHeight - _noTelegramCode.height()) / 2);
|
||||
}
|
||||
|
||||
void IntroCode::showError(const QString &err) {
|
||||
@@ -183,7 +183,7 @@ void IntroCode::showError(const QString &err) {
|
||||
}
|
||||
|
||||
void IntroCode::step_error(float64 ms, bool timer) {
|
||||
float64 dt = ms / st::introErrDuration;
|
||||
float64 dt = ms / st::introErrorDuration;
|
||||
|
||||
if (dt >= 1) {
|
||||
_a_error.stop();
|
||||
@@ -192,7 +192,7 @@ void IntroCode::step_error(float64 ms, bool timer) {
|
||||
error.clear();
|
||||
}
|
||||
} else {
|
||||
a_errorAlpha.update(dt, st::introErrFunc);
|
||||
a_errorAlpha.update(dt, anim::linear);
|
||||
}
|
||||
if (timer) update();
|
||||
}
|
||||
|
@@ -47,11 +47,11 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent)
|
||||
, a_errorAlpha(0)
|
||||
, _a_error(animation(this, &IntroPhone::step_error))
|
||||
, changed(false)
|
||||
, next(this, lang(lng_intro_next), st::btnIntroNext)
|
||||
, next(this, lang(lng_intro_next), st::introNextButton)
|
||||
, country(this, st::introCountry)
|
||||
, phone(this, st::inpIntroPhone)
|
||||
, code(this, st::inpIntroCountryCode)
|
||||
, _signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), FlatLabel::InitType::Rich, st::introErrLabel, st::introErrLabelTextStyle)
|
||||
, _signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), FlatLabel::InitType::Rich, st::introErrorLabel, st::introErrorLabelTextStyle)
|
||||
, _showSignup(false)
|
||||
, sentRequest(0) {
|
||||
setVisible(false);
|
||||
@@ -94,11 +94,11 @@ void IntroPhone::paintEvent(QPaintEvent *e) {
|
||||
p.drawText(textRect, lang(lng_phone_desc), style::al_bottom);
|
||||
}
|
||||
if (_a_error.animating() || error.length()) {
|
||||
int32 errorY = _showSignup ? ((phone.y() + phone.height() + next.y() - st::introErrFont->height) / 2) : (next.y() + next.height() + st::introErrTop);
|
||||
int32 errorY = _showSignup ? ((phone.y() + phone.height() + next.y() - st::introErrorFont->height) / 2) : (next.y() + next.height() + st::introErrorTop);
|
||||
p.setOpacity(a_errorAlpha.current());
|
||||
p.setFont(st::introErrFont->f);
|
||||
p.setPen(st::introErrColor->p);
|
||||
p.drawText(QRect(textRect.x(), errorY, textRect.width(), st::introErrFont->height), error, style::al_top);
|
||||
p.setFont(st::introErrorFont);
|
||||
p.setPen(st::introErrorFg);
|
||||
p.drawText(QRect(textRect.x(), errorY, textRect.width(), st::introErrorFont->height), error, style::al_top);
|
||||
|
||||
if (_signup.isHidden() && _showSignup) {
|
||||
p.drawPixmap(_signup.x(), _signup.y(), _signupCache);
|
||||
@@ -114,7 +114,7 @@ void IntroPhone::resizeEvent(QResizeEvent *e) {
|
||||
phone.move((width() - country.width()) / 2 + country.width() - st::inpIntroPhone.width, phoneTop);
|
||||
code.move((width() - country.width()) / 2, phoneTop);
|
||||
}
|
||||
_signup.move((width() - _signup.width()) / 2, next.y() + next.height() + st::introErrTop - ((st::introErrLabelTextStyle.lineHeight - st::introErrFont->height) / 2));
|
||||
_signup.move((width() - _signup.width()) / 2, next.y() + next.height() + st::introErrorTop - ((st::introErrorLabelTextStyle.lineHeight - st::introErrorFont->height) / 2));
|
||||
textRect = QRect((width() - st::introTextSize.width()) / 2, st::introTextTop, st::introTextSize.width(), st::introTextSize.height());
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void IntroPhone::showError(const QString &err, bool signUp) {
|
||||
}
|
||||
|
||||
void IntroPhone::step_error(float64 ms, bool timer) {
|
||||
float64 dt = ms / st::introErrDuration;
|
||||
float64 dt = ms / st::introErrorDuration;
|
||||
|
||||
if (dt >= 1) {
|
||||
_a_error.stop();
|
||||
@@ -149,7 +149,7 @@ void IntroPhone::step_error(float64 ms, bool timer) {
|
||||
_signup.show();
|
||||
}
|
||||
} else {
|
||||
a_errorAlpha.update(dt, st::introErrFunc);
|
||||
a_errorAlpha.update(dt, anim::linear);
|
||||
}
|
||||
if (timer) update();
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStep(parent)
|
||||
, a_errorAlpha(0)
|
||||
, _a_error(animation(this, &IntroPwdCheck::step_error))
|
||||
, _next(this, lang(lng_intro_submit), st::btnIntroNext)
|
||||
, _next(this, lang(lng_intro_submit), st::introNextButton)
|
||||
, _salt(parent->getPwdSalt())
|
||||
, _hasRecovery(parent->getHasRecovery())
|
||||
, _hint(parent->getPwdHint())
|
||||
@@ -88,9 +88,9 @@ void IntroPwdCheck::paintEvent(QPaintEvent *e) {
|
||||
if (_a_error.animating() || error.length()) {
|
||||
p.setOpacity(a_errorAlpha.current());
|
||||
|
||||
QRect errRect((width() - st::introErrWidth) / 2, (_pwdField.y() + _pwdField.height() + st::introFinishSkip + st::introFont->height + _next.y() - st::introErrHeight) / 2, st::introErrWidth, st::introErrHeight);
|
||||
p.setFont(st::introErrFont->f);
|
||||
p.setPen(st::introErrColor->p);
|
||||
QRect errRect((width() - st::introErrorWidth) / 2, (_pwdField.y() + _pwdField.height() + st::introFinishSkip + st::introFont->height + _next.y() - st::introErrorHeight) / 2, st::introErrorWidth, st::introErrorHeight);
|
||||
p.setFont(st::introErrorFont);
|
||||
p.setPen(st::introErrorFg);
|
||||
p.drawText(errRect, error, QTextOption(style::al_center));
|
||||
|
||||
p.setOpacity(1);
|
||||
@@ -122,7 +122,7 @@ void IntroPwdCheck::showError(const QString &err) {
|
||||
}
|
||||
|
||||
void IntroPwdCheck::step_error(float64 ms, bool timer) {
|
||||
float64 dt = ms / st::introErrDuration;
|
||||
float64 dt = ms / st::introErrorDuration;
|
||||
|
||||
if (dt >= 1) {
|
||||
_a_error.stop();
|
||||
@@ -131,7 +131,7 @@ void IntroPwdCheck::step_error(float64 ms, bool timer) {
|
||||
error.clear();
|
||||
}
|
||||
} else {
|
||||
a_errorAlpha.update(dt, st::introErrFunc);
|
||||
a_errorAlpha.update(dt, anim::linear);
|
||||
}
|
||||
if (timer) update();
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "intro/introsignup.h"
|
||||
|
||||
#include "styles/style_intro.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "ui/filedialog.h"
|
||||
#include "boxes/photocropbox.h"
|
||||
#include "lang.h"
|
||||
@@ -32,7 +33,7 @@ IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent)
|
||||
, a_photoOver(0)
|
||||
, _a_error(animation(this, &IntroSignup::step_error))
|
||||
, _a_photo(animation(this, &IntroSignup::step_photo))
|
||||
, next(this, lang(lng_intro_finish), st::btnIntroNext)
|
||||
, next(this, lang(lng_intro_finish), st::introNextButton)
|
||||
, first(this, st::inpIntroName, lang(lng_signup_firstname))
|
||||
, last(this, st::inpIntroName, lang(lng_signup_lastname))
|
||||
, sentRequest(0)
|
||||
@@ -112,12 +113,12 @@ void IntroSignup::paintEvent(QPaintEvent *e) {
|
||||
|
||||
QRect errRect;
|
||||
if (_invertOrder) {
|
||||
errRect = QRect((width() - st::introErrWidth) / 2, (first.y() + first.height() + next.y() - st::introErrHeight) / 2, st::introErrWidth, st::introErrHeight);
|
||||
errRect = QRect((width() - st::introErrorWidth) / 2, (first.y() + first.height() + next.y() - st::introErrorHeight) / 2, st::introErrorWidth, st::introErrorHeight);
|
||||
} else {
|
||||
errRect = QRect((width() - st::introErrWidth) / 2, (last.y() + last.height() + next.y() - st::introErrHeight) / 2, st::introErrWidth, st::introErrHeight);
|
||||
errRect = QRect((width() - st::introErrorWidth) / 2, (last.y() + last.height() + next.y() - st::introErrorHeight) / 2, st::introErrorWidth, st::introErrorHeight);
|
||||
}
|
||||
p.setFont(st::introErrFont->f);
|
||||
p.setPen(st::introErrColor->p);
|
||||
p.setFont(st::introErrorFont);
|
||||
p.setPen(st::introErrorFg);
|
||||
p.drawText(errRect, error, QTextOption(style::al_center));
|
||||
|
||||
p.setOpacity(1);
|
||||
@@ -174,7 +175,7 @@ void IntroSignup::showError(const QString &err) {
|
||||
}
|
||||
|
||||
void IntroSignup::step_error(float64 ms, bool timer) {
|
||||
float64 dt = ms / st::introErrDuration;
|
||||
float64 dt = ms / st::introErrorDuration;
|
||||
|
||||
if (dt >= 1) {
|
||||
_a_error.stop();
|
||||
@@ -183,13 +184,13 @@ void IntroSignup::step_error(float64 ms, bool timer) {
|
||||
error.clear();
|
||||
}
|
||||
} else {
|
||||
a_errorAlpha.update(dt, st::introErrFunc);
|
||||
a_errorAlpha.update(dt, anim::linear);
|
||||
}
|
||||
if (timer) update();
|
||||
}
|
||||
|
||||
void IntroSignup::step_photo(float64 ms, bool timer) {
|
||||
float64 dt = ms / st::introErrDuration;
|
||||
float64 dt = ms / st::introErrorDuration;
|
||||
|
||||
if (dt >= 1) {
|
||||
_a_photo.stop();
|
||||
|
@@ -29,7 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent)
|
||||
, _intro(this, lang(lng_intro), FlatLabel::InitType::Rich, st::introLabel, st::introLabelTextStyle)
|
||||
, _changeLang(this, QString())
|
||||
, _next(this, lang(lng_start_msgs), st::btnIntroNext) {
|
||||
, _next(this, lang(lng_start_msgs), st::introNextButton) {
|
||||
_changeLang.hide();
|
||||
if (cLang() == languageDefault) {
|
||||
int32 l = Sandbox::LangSystem();
|
||||
@@ -68,8 +68,8 @@ void IntroStart::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
int32 hy = _intro.y() - st::introHeaderFont->height - st::introHeaderSkip + st::introHeaderFont->ascent;
|
||||
|
||||
p.setFont(st::introHeaderFont->f);
|
||||
p.setPen(st::introColor->p);
|
||||
p.setFont(st::introHeaderFont);
|
||||
p.setPen(st::introHeaderFg);
|
||||
p.drawText((width() - _headerWidth) / 2, hy, qsl("Telegram Desktop"));
|
||||
|
||||
st::aboutIcon.paint(p, QPoint((width() - st::aboutIcon.width()) / 2, hy - st::introIconSkip - st::aboutIcon.height()), width());
|
||||
|
@@ -248,12 +248,12 @@ void IntroWidget::paintEvent(QPaintEvent *e) {
|
||||
if (!trivial) {
|
||||
p.setClipRect(e->rect());
|
||||
}
|
||||
p.fillRect(e->rect(), st::white->b);
|
||||
p.fillRect(e->rect(), st::windowBg);
|
||||
if (_a_show.animating()) {
|
||||
if (a_coordOver.current() > 0) {
|
||||
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * cRetinaFactor(), 0, a_coordOver.current() * cRetinaFactor(), height() * cRetinaFactor()));
|
||||
p.setOpacity(a_shadow.current() * st::slideFadeOut);
|
||||
p.fillRect(0, 0, a_coordOver.current(), height(), st::black->b);
|
||||
p.setOpacity(a_shadow.current());
|
||||
p.fillRect(0, 0, a_coordOver.current(), height(), st::slideFadeOutBg);
|
||||
p.setOpacity(1);
|
||||
}
|
||||
p.drawPixmap(a_coordOver.current(), 0, _cacheOver);
|
||||
|
Reference in New Issue
Block a user