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