mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Change InputField::font to InputField::style in styles.
This commit is contained in:
parent
8ad5117495
commit
501cae2200
18 changed files with 32 additions and 46 deletions
|
@ -237,7 +237,7 @@ shareColumnSkip: 6px;
|
||||||
shareActivateDuration: 150;
|
shareActivateDuration: 150;
|
||||||
shareScrollDuration: 300;
|
shareScrollDuration: 300;
|
||||||
shareComment: InputField(defaultInputField) {
|
shareComment: InputField(defaultInputField) {
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
textMargins: margins(8px, 8px, 8px, 6px);
|
textMargins: margins(8px, 8px, 8px, 6px);
|
||||||
heightMin: 36px;
|
heightMin: 36px;
|
||||||
heightMax: 72px;
|
heightMax: 72px;
|
||||||
|
@ -585,7 +585,7 @@ groupStickersRemovePosition: point(6px, 6px);
|
||||||
groupStickersFieldPadding: margins(8px, 6px, 8px, 6px);
|
groupStickersFieldPadding: margins(8px, 6px, 8px, 6px);
|
||||||
groupStickersField: InputField(defaultMultiSelectSearchField) {
|
groupStickersField: InputField(defaultMultiSelectSearchField) {
|
||||||
placeholderFont: boxTextFont;
|
placeholderFont: boxTextFont;
|
||||||
font: boxTextFont;
|
style: boxTextStyle;
|
||||||
placeholderMargins: margins(0px, 0px, 0px, 0px);
|
placeholderMargins: margins(0px, 0px, 0px, 0px);
|
||||||
textMargins: margins(0px, 7px, 0px, 0px);
|
textMargins: margins(0px, 7px, 0px, 0px);
|
||||||
textBg: boxBg;
|
textBg: boxBg;
|
||||||
|
@ -672,7 +672,6 @@ themesMenuToggle: IconButton(defaultIconButton) {
|
||||||
themesMenuPosition: point(-2px, 25px);
|
themesMenuPosition: point(-2px, 25px);
|
||||||
|
|
||||||
createPollField: InputField(defaultInputField) {
|
createPollField: InputField(defaultInputField) {
|
||||||
font: boxTextFont;
|
|
||||||
textMargins: margins(0px, 4px, 0px, 4px);
|
textMargins: margins(0px, 4px, 0px, 4px);
|
||||||
textAlign: align(left);
|
textAlign: align(left);
|
||||||
heightMin: 36px;
|
heightMin: 36px;
|
||||||
|
@ -877,7 +876,6 @@ scheduleDateField: InputField(defaultInputField) {
|
||||||
placeholderScale: 0.;
|
placeholderScale: 0.;
|
||||||
heightMin: 30px;
|
heightMin: 30px;
|
||||||
textAlign: align(top);
|
textAlign: align(top);
|
||||||
font: font(14px);
|
|
||||||
}
|
}
|
||||||
scheduleTimeField: InputField(scheduleDateField) {
|
scheduleTimeField: InputField(scheduleDateField) {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
|
@ -905,7 +903,6 @@ muteBoxTimeField: InputField(scheduleDateField) {
|
||||||
placeholderScale: 0.;
|
placeholderScale: 0.;
|
||||||
heightMin: 30px;
|
heightMin: 30px;
|
||||||
textAlign: align(left);
|
textAlign: align(left);
|
||||||
font: font(14px);
|
|
||||||
}
|
}
|
||||||
muteBoxTimeFieldPadding: margins(5px, 0px, 5px, 0px);
|
muteBoxTimeFieldPadding: margins(5px, 0px, 5px, 0px);
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,8 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) {
|
||||||
auto option = QTextOption(style::al_left);
|
auto option = QTextOption(style::al_left);
|
||||||
option.setWrapMode(QTextOption::WrapAnywhere);
|
option.setWrapMode(QTextOption::WrapAnywhere);
|
||||||
p.setFont(_linkOver
|
p.setFont(_linkOver
|
||||||
? st::defaultInputField.font->underline()
|
? st::defaultInputField.style.font->underline()
|
||||||
: st::defaultInputField.font);
|
: st::defaultInputField.style.font);
|
||||||
p.setPen(st::defaultLinkButton.color);
|
p.setPen(st::defaultLinkButton.color);
|
||||||
const auto inviteLinkText = _channel->inviteLink().isEmpty()
|
const auto inviteLinkText = _channel->inviteLink().isEmpty()
|
||||||
? tr::lng_group_invite_create(tr::now)
|
? tr::lng_group_invite_create(tr::now)
|
||||||
|
|
|
@ -1393,7 +1393,6 @@ groupCallScheduleDateField: InputField(groupCallField) {
|
||||||
placeholderScale: 0.;
|
placeholderScale: 0.;
|
||||||
heightMin: 30px;
|
heightMin: 30px;
|
||||||
textAlign: align(top);
|
textAlign: align(top);
|
||||||
font: font(14px);
|
|
||||||
}
|
}
|
||||||
groupCallScheduleTimeField: InputField(groupCallScheduleDateField) {
|
groupCallScheduleTimeField: InputField(groupCallScheduleDateField) {
|
||||||
textBg: groupCallMembersBg;
|
textBg: groupCallMembersBg;
|
||||||
|
|
|
@ -990,7 +990,7 @@ historyUnreadReactions: TwoIconButton(historyToDown) {
|
||||||
historyUnreadThingsSkip: 4px;
|
historyUnreadThingsSkip: 4px;
|
||||||
|
|
||||||
historyComposeField: InputField(defaultInputField) {
|
historyComposeField: InputField(defaultInputField) {
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
textMargins: margins(0px, 0px, 0px, 0px);
|
textMargins: margins(0px, 0px, 0px, 0px);
|
||||||
textAlign: align(left);
|
textAlign: align(left);
|
||||||
textFg: historyComposeAreaFg;
|
textFg: historyComposeAreaFg;
|
||||||
|
|
|
@ -569,10 +569,10 @@ void InitMessageFieldFade(
|
||||||
Ui::DestroyChild(b.data());
|
Ui::DestroyChild(b.data());
|
||||||
}, topFade->lifetime());
|
}, topFade->lifetime());
|
||||||
|
|
||||||
|
const auto descent = field->st().style.font->descent;
|
||||||
topFade->show();
|
topFade->show();
|
||||||
bottomFade->showOn(
|
bottomFade->showOn(field->scrollTop().value(
|
||||||
field->scrollTop().value(
|
) | rpl::map([field, descent](int scroll) {
|
||||||
) | rpl::map([field, descent = field->st().font->descent](int scroll) {
|
|
||||||
return (scroll + descent) < field->scrollTopMax();
|
return (scroll + descent) < field->scrollTopMax();
|
||||||
}) | rpl::distinct_until_changed());
|
}) | rpl::distinct_until_changed());
|
||||||
}
|
}
|
||||||
|
@ -766,11 +766,7 @@ bool MessageLinksParser::eventFilter(QObject *object, QEvent *event) {
|
||||||
const auto text = static_cast<QKeyEvent*>(event)->text();
|
const auto text = static_cast<QKeyEvent*>(event)->text();
|
||||||
if (!text.isEmpty() && text.size() < 3) {
|
if (!text.isEmpty() && text.size() < 3) {
|
||||||
const auto ch = text[0];
|
const auto ch = text[0];
|
||||||
if (false
|
if (IsSpace(ch)) {
|
||||||
|| ch == '\n'
|
|
||||||
|| ch == '\r'
|
|
||||||
|| ch.isSpace()
|
|
||||||
|| ch == QChar::LineSeparator) {
|
|
||||||
_timer.callOnce(0);
|
_timer.callOnce(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1117,8 +1113,8 @@ void SelectTextInFieldWithMargins(
|
||||||
auto textCursor = field->textCursor();
|
auto textCursor = field->textCursor();
|
||||||
// Try to set equal margins for top and bottom sides.
|
// Try to set equal margins for top and bottom sides.
|
||||||
const auto charsCountInLine = field->width()
|
const auto charsCountInLine = field->width()
|
||||||
/ field->st().font->width('W');
|
/ field->st().style.font->width('W');
|
||||||
const auto linesCount = (field->height() / field->st().font->height);
|
const auto linesCount = field->height() / field->st().style.font->height;
|
||||||
const auto selectedLines = (selection.to - selection.from)
|
const auto selectedLines = (selection.to - selection.from)
|
||||||
/ charsCountInLine;
|
/ charsCountInLine;
|
||||||
constexpr auto kMinDiff = ushort(3);
|
constexpr auto kMinDiff = ushort(3);
|
||||||
|
|
|
@ -285,7 +285,7 @@ dialogsFilter: InputField(defaultInputField) {
|
||||||
borderRadius: 18px;
|
borderRadius: 18px;
|
||||||
borderDenominator: 2;
|
borderDenominator: 2;
|
||||||
|
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
|
|
||||||
heightMin: 35px;
|
heightMin: 35px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -701,7 +701,7 @@ manageGroupReactionsField: InputField(defaultInputField) {
|
||||||
placeholderScale: 0.;
|
placeholderScale: 0.;
|
||||||
placeholderFont: normalFont;
|
placeholderFont: normalFont;
|
||||||
placeholderShift: -50px;
|
placeholderShift: -50px;
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
heightMin: 36px;
|
heightMin: 36px;
|
||||||
heightMax: 158px;
|
heightMax: 158px;
|
||||||
}
|
}
|
||||||
|
@ -764,8 +764,6 @@ editPeerDescription: InputField(defaultInputField) {
|
||||||
borderActive: 0px;
|
borderActive: 0px;
|
||||||
|
|
||||||
heightMin: 32px;
|
heightMin: 32px;
|
||||||
|
|
||||||
font: boxTextFont;
|
|
||||||
}
|
}
|
||||||
editPeerDescriptionMargins: margins(22px, 3px, 22px, 2px);
|
editPeerDescriptionMargins: margins(22px, 3px, 22px, 2px);
|
||||||
editPeerPrivaciesMargins: margins(15px, 7px, 22px, 0px);
|
editPeerPrivaciesMargins: margins(15px, 7px, 22px, 0px);
|
||||||
|
|
|
@ -96,7 +96,9 @@ introPhoneTop: 6px;
|
||||||
introLinkTop: 24px;
|
introLinkTop: 24px;
|
||||||
introCountry: InputField(defaultInputField) {
|
introCountry: InputField(defaultInputField) {
|
||||||
textMargins: margins(3px, 27px, 3px, 6px);
|
textMargins: margins(3px, 27px, 3px, 6px);
|
||||||
font: font(16px);
|
style: TextStyle(defaultTextStyle) {
|
||||||
|
font: font(16px);
|
||||||
|
}
|
||||||
width: 300px;
|
width: 300px;
|
||||||
heightMin: 61px;
|
heightMin: 61px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ passportDetailsField: InputField(defaultInputField) {
|
||||||
placeholderScale: 0.;
|
placeholderScale: 0.;
|
||||||
placeholderFont: normalFont;
|
placeholderFont: normalFont;
|
||||||
heightMin: 32px;
|
heightMin: 32px;
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
}
|
}
|
||||||
passportDetailsDateField: InputField(passportDetailsField) {
|
passportDetailsDateField: InputField(passportDetailsField) {
|
||||||
textMargins: margins(2px, 8px, 2px, 0px);
|
textMargins: margins(2px, 8px, 2px, 0px);
|
||||||
|
@ -178,7 +178,7 @@ passportDetailsSeparator: FlatLabel(passportPasswordLabelBold) {
|
||||||
}
|
}
|
||||||
passportDetailsSeparatorPadding: margins(5px, 8px, 5px, 0px);
|
passportDetailsSeparatorPadding: margins(5px, 8px, 5px, 0px);
|
||||||
passportContactField: InputField(defaultInputField) {
|
passportContactField: InputField(defaultInputField) {
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
}
|
}
|
||||||
passportDetailsFieldLeft: 116px;
|
passportDetailsFieldLeft: 116px;
|
||||||
passportDetailsFieldTop: 2px;
|
passportDetailsFieldTop: 2px;
|
||||||
|
|
|
@ -305,7 +305,7 @@ struct SimpleFieldState {
|
||||||
.st = st::paymentsMoneyField,
|
.st = st::paymentsMoneyField,
|
||||||
});
|
});
|
||||||
const auto &rule = state->rule;
|
const auto &rule = state->rule;
|
||||||
state->currencySkip = rule.space ? state->st.font->spacew : 0;
|
state->currencySkip = rule.space ? state->st.style.font->spacew : 0;
|
||||||
state->currencyText = ((!rule.left && rule.space)
|
state->currencyText = ((!rule.left && rule.space)
|
||||||
? QString(QChar(' '))
|
? QString(QChar(' '))
|
||||||
: QString()) + (*rule.international
|
: QString()) + (*rule.international
|
||||||
|
@ -343,7 +343,7 @@ struct SimpleFieldState {
|
||||||
}
|
}
|
||||||
const auto updateRight = [=] {
|
const auto updateRight = [=] {
|
||||||
const auto text = result->getLastText();
|
const auto text = result->getLastText();
|
||||||
const auto width = state->st.font->width(text);
|
const auto width = state->st.style.font->width(text);
|
||||||
const auto &rule = state->rule;
|
const auto &rule = state->rule;
|
||||||
const auto symbol = QChar(rule.decimal);
|
const auto symbol = QChar(rule.decimal);
|
||||||
const auto decimal = text.indexOf(symbol);
|
const auto decimal = text.indexOf(symbol);
|
||||||
|
|
|
@ -214,8 +214,6 @@ settingsBio: InputField(defaultInputField) {
|
||||||
borderActive: 0px;
|
borderActive: 0px;
|
||||||
|
|
||||||
heightMin: 32px;
|
heightMin: 32px;
|
||||||
|
|
||||||
font: boxTextFont;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsBioMargins: margins(22px, 6px, 22px, 4px);
|
settingsBioMargins: margins(22px, 6px, 22px, 4px);
|
||||||
|
@ -309,8 +307,6 @@ settingsDeviceName: InputField(defaultInputField) {
|
||||||
placeholderFont: normalFont;
|
placeholderFont: normalFont;
|
||||||
|
|
||||||
heightMin: 29px;
|
heightMin: 29px;
|
||||||
|
|
||||||
font: boxTextFont;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dictionariesSectionButton: SettingsButton(settingsUpdateToggle) {
|
dictionariesSectionButton: SettingsButton(settingsUpdateToggle) {
|
||||||
|
@ -677,5 +673,5 @@ settingsChatLinkField: InputField(defaultInputField) {
|
||||||
|
|
||||||
heightMin: 32px;
|
heightMin: 32px;
|
||||||
|
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1162,5 +1162,5 @@ factcheckField: InputField(defaultInputField) {
|
||||||
|
|
||||||
heightMin: 24px;
|
heightMin: 24px;
|
||||||
|
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ void CountryInput::paintEvent(QPaintEvent *e) {
|
||||||
st::introCountryIconPosition.y(),
|
st::introCountryIconPosition.y(),
|
||||||
width());
|
width());
|
||||||
|
|
||||||
p.setFont(_st.font);
|
p.setFont(_st.style.font);
|
||||||
p.setPen(_st.textFg);
|
p.setPen(_st.textFg);
|
||||||
p.drawText(rect().marginsRemoved(_st.textMargins), _text, _st.textAlign);
|
p.drawText(rect().marginsRemoved(_st.textMargins), _text, _st.textAlign);
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ rpl::producer<QString> CountryInput::codeChanged() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountryInput::setText(const QString &newText) {
|
void CountryInput::setText(const QString &newText) {
|
||||||
_text = _st.font->elided(
|
_text = _st.style.font->elided(
|
||||||
newText,
|
newText,
|
||||||
width() - _st.textMargins.left() - _st.textMargins.right());
|
width() - _st.textMargins.left() - _st.textMargins.right());
|
||||||
}
|
}
|
||||||
|
|
|
@ -704,7 +704,7 @@ void ColorEditor::Field::correctValue(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorEditor::Field::paintAdditionalPlaceholder(QPainter &p) {
|
void ColorEditor::Field::paintAdditionalPlaceholder(QPainter &p) {
|
||||||
p.setFont(_st.font);
|
p.setFont(_st.style.font);
|
||||||
p.setPen(_st.placeholderFg);
|
p.setPen(_st.placeholderFg);
|
||||||
const auto inner = QRect(
|
const auto inner = QRect(
|
||||||
_st.textMargins.right(),
|
_st.textMargins.right(),
|
||||||
|
@ -829,7 +829,7 @@ void ColorEditor::ResultField::correctValue(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorEditor::ResultField::paintAdditionalPlaceholder(QPainter &p) {
|
void ColorEditor::ResultField::paintAdditionalPlaceholder(QPainter &p) {
|
||||||
p.setFont(_st.font);
|
p.setFont(_st.style.font);
|
||||||
p.setPen(_st.placeholderFg);
|
p.setPen(_st.placeholderFg);
|
||||||
p.drawText(
|
p.drawText(
|
||||||
QRect(
|
QRect(
|
||||||
|
|
|
@ -267,14 +267,14 @@ UsernameInput::UsernameInput(
|
||||||
void UsernameInput::setLinkPlaceholder(const QString &placeholder) {
|
void UsernameInput::setLinkPlaceholder(const QString &placeholder) {
|
||||||
_linkPlaceholder = placeholder;
|
_linkPlaceholder = placeholder;
|
||||||
if (!_linkPlaceholder.isEmpty()) {
|
if (!_linkPlaceholder.isEmpty()) {
|
||||||
setTextMargins(style::margins(_st.textMargins.left() + _st.font->width(_linkPlaceholder), _st.textMargins.top(), _st.textMargins.right(), _st.textMargins.bottom()));
|
setTextMargins(style::margins(_st.textMargins.left() + _st.style.font->width(_linkPlaceholder), _st.textMargins.top(), _st.textMargins.right(), _st.textMargins.bottom()));
|
||||||
setPlaceholderHidden(true);
|
setPlaceholderHidden(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameInput::paintAdditionalPlaceholder(QPainter &p) {
|
void UsernameInput::paintAdditionalPlaceholder(QPainter &p) {
|
||||||
if (!_linkPlaceholder.isEmpty()) {
|
if (!_linkPlaceholder.isEmpty()) {
|
||||||
p.setFont(_st.font);
|
p.setFont(_st.style.font);
|
||||||
p.setPen(_st.placeholderFg);
|
p.setPen(_st.placeholderFg);
|
||||||
p.drawText(QRect(_st.textMargins.left(), _st.textMargins.top(), width(), height() - _st.textMargins.top() - _st.textMargins.bottom()), _linkPlaceholder, style::al_topleft);
|
p.drawText(QRect(_st.textMargins.left(), _st.textMargins.top(), width(), height() - _st.textMargins.top() - _st.textMargins.bottom()), _linkPlaceholder, style::al_topleft);
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,7 +604,7 @@ void Generator::paintComposeArea() {
|
||||||
|
|
||||||
_p->setClipRect(field);
|
_p->setClipRect(field);
|
||||||
_p->save();
|
_p->save();
|
||||||
_p->setFont(st::historyComposeField.font);
|
_p->setFont(st::historyComposeField.style.font);
|
||||||
_p->setPen(st::historyComposeField.placeholderFg[_palette]);
|
_p->setPen(st::historyComposeField.placeholderFg[_palette]);
|
||||||
|
|
||||||
auto placeholderRect = QRect(
|
auto placeholderRect = QRect(
|
||||||
|
@ -658,7 +658,7 @@ void Generator::paintDialogs() {
|
||||||
_p->save();
|
_p->save();
|
||||||
_p->setClipRect(filter);
|
_p->setClipRect(filter);
|
||||||
auto phRect = QRect(filter.x() + st::dialogsFilter.textMargins.left() + st::dialogsFilter.placeholderMargins.left(), filter.y() + st::dialogsFilter.textMargins.top() + st::dialogsFilter.placeholderMargins.top(), filter.width() - st::dialogsFilter.textMargins.left() - st::dialogsFilter.textMargins.right(), filter.height() - st::dialogsFilter.textMargins.top() - st::dialogsFilter.textMargins.bottom());
|
auto phRect = QRect(filter.x() + st::dialogsFilter.textMargins.left() + st::dialogsFilter.placeholderMargins.left(), filter.y() + st::dialogsFilter.textMargins.top() + st::dialogsFilter.placeholderMargins.top(), filter.width() - st::dialogsFilter.textMargins.left() - st::dialogsFilter.textMargins.right(), filter.height() - st::dialogsFilter.textMargins.top() - st::dialogsFilter.textMargins.bottom());
|
||||||
_p->setFont(st::dialogsFilter.font);
|
_p->setFont(st::dialogsFilter.style.font);
|
||||||
_p->setPen(st::dialogsFilter.placeholderFg[_palette]);
|
_p->setPen(st::dialogsFilter.placeholderFg[_palette]);
|
||||||
_p->drawText(phRect, tr::lng_dlg_filter(tr::now), QTextOption(st::dialogsFilter.placeholderAlign));
|
_p->drawText(phRect, tr::lng_dlg_filter(tr::now), QTextOption(st::dialogsFilter.placeholderAlign));
|
||||||
_p->restore();
|
_p->restore();
|
||||||
|
|
|
@ -61,7 +61,7 @@ notifyActionsDuration: 200;
|
||||||
notifyHideAllHeight: 36px;
|
notifyHideAllHeight: 36px;
|
||||||
|
|
||||||
notifyReplyArea: InputField(defaultInputField) {
|
notifyReplyArea: InputField(defaultInputField) {
|
||||||
font: normalFont;
|
style: defaultTextStyle;
|
||||||
textMargins: margins(8px, 8px, 8px, 6px);
|
textMargins: margins(8px, 8px, 8px, 6px);
|
||||||
heightMin: 36px;
|
heightMin: 36px;
|
||||||
heightMax: 72px;
|
heightMax: 72px;
|
||||||
|
@ -235,8 +235,6 @@ createThemeLink: InputField(defaultInputField) {
|
||||||
placeholderFont: boxTextFont;
|
placeholderFont: boxTextFont;
|
||||||
|
|
||||||
heightMin: 34px;
|
heightMin: 34px;
|
||||||
|
|
||||||
font: boxTextFont;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
windowFiltersWidth: 72px;
|
windowFiltersWidth: 72px;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 599b4d0517dcbd70e2367aa7af0e8986e6c22052
|
Subproject commit 924301cd62d918ef25ab81d758ed4b2fff903f2e
|
Loading…
Add table
Reference in a new issue