From 9661bac87624f2af32dc0c865528a30924bd7df4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 13 Oct 2023 16:22:38 +0400 Subject: [PATCH] Show blockquote icon. --- Telegram/Resources/icons/chat/mini_quote.png | Bin 0 -> 374 bytes .../Resources/icons/chat/mini_quote@2x.png | Bin 0 -> 570 bytes .../Resources/icons/chat/mini_quote@3x.png | Bin 0 -> 849 bytes .../settings/settings_scale_preview.cpp | 39 +++++++++++------- Telegram/SourceFiles/ui/chat/chat.style | 23 +++++++---- Telegram/SourceFiles/ui/chat/chat_style.cpp | 2 +- Telegram/lib_ui | 2 +- 7 files changed, 43 insertions(+), 23 deletions(-) create mode 100644 Telegram/Resources/icons/chat/mini_quote.png create mode 100644 Telegram/Resources/icons/chat/mini_quote@2x.png create mode 100644 Telegram/Resources/icons/chat/mini_quote@3x.png diff --git a/Telegram/Resources/icons/chat/mini_quote.png b/Telegram/Resources/icons/chat/mini_quote.png new file mode 100644 index 0000000000000000000000000000000000000000..08a844820e4623791cdd92909d45cdcaf4cd7efd GIT binary patch literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(-uuz(rC1}QWNE&K$e9(cMqhG>Xh z?f2($4Ujnc^^dQb(FP`FwiMo zvdl}2eX9(3EZ?k44ofy`glX(f`xTHpSruq6Z zXaU(A42G$TlC0TWzSVF5FO4N|zKE$K5**%D6|#}E(R zw^MenI^-bG_EkWDTl%A0z(&C}B5&S&=4x8I{sHq1uFRt$Vp#$@HO$ppJq2}Cd?!3m zO;Bic@n9)UOprADSTw76R?gS=b)V0lJC`Ta*`oZ$;YQ>C*A8~`=bueme)*(9&%=Tl zK5B)!H*>QYX51QW`3HgxN ze=?=%?}F;RayL{wKV7cd|6ft_*b?1;BCD@*C2hOCc7C3j^qj_5@~bv<9DiKFwJSiQ zp~7D>`2*YQud_OpgM&W`s>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be56d..c3cd775a1 100644 --- a/Telegram/SourceFiles/settings/settings_scale_preview.cpp +++ b/Telegram/SourceFiles/settings/settings_scale_preview.cpp @@ -76,11 +76,13 @@ private: [[nodiscard]] QPoint scaled(QPoint value) const; [[nodiscard]] QMargins scaled(QMargins value) const; [[nodiscard]] style::font scaled( - const style::font &value, int size) const; + const style::font &value, + int size) const; + [[nodiscard]] style::ParagraphStyle scaled( + const style::ParagraphStyle &value) const; [[nodiscard]] style::TextStyle scaled( const style::TextStyle &value, - int fontSize, - int lineHeight) const; + int fontSize) const; [[nodiscard]] QImage scaled( const style::icon &icon, const QColor &color) const; @@ -325,21 +327,30 @@ style::font Preview::scaled(const style::font &font, int size) const { return style::font(scaled(size), font->flags(), font->family()); } +style::ParagraphStyle Preview::scaled( + const style::ParagraphStyle &value) const { + return { + .padding = scaled(value.padding), + .verticalSkip = scaled(value.verticalSkip), + .header = scaled(value.header), + .headerPosition = scaled(value.headerPosition), + .icon = value.icon, + .iconPosition = scaled(value.iconPosition), + .outline = scaled(value.outline), + .radius = scaled(value.radius), + .scrollable = value.scrollable, + }; +} + style::TextStyle Preview::scaled( const style::TextStyle &value, - int fontSize, - int lineHeight) const { + int fontSize) const { return { .font = scaled(value.font, fontSize), .linkUnderline = value.linkUnderline, - .blockPadding = scaled(value.blockPadding), - .blockVerticalSkip = scaled(value.blockVerticalSkip), - .blockHeader = scaled(value.blockHeader), - .blockHeaderPosition = scaled(value.blockHeaderPosition), - .blockOutline = scaled(value.blockOutline), - .blockRadius = scaled(value.blockRadius), - .preScrollable = value.preScrollable, .lineHeight = scaled(value.lineHeight), + .blockquote = scaled(value.blockquote), + .pre = scaled(value.pre), }; } @@ -356,8 +367,8 @@ void Preview::updateToScale(int scale) { return; } _scale = scale; - _nameStyle = scaled(_nameStyle, 13, 0); - _textStyle = scaled(_textStyle, 13, 0); + _nameStyle = scaled(_nameStyle, 13); + _textStyle = scaled(_textStyle, 13); _nameText.setText( _nameStyle, u"Bob Harris"_q, diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index 4e7fab143..16be12f27 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -40,14 +40,23 @@ msgDateDelta: point(2px, 5px); msgDateImgDelta: 4px; msgDateImgPadding: point(8px, 2px); +messageParagraphStyle: ParagraphStyle(defaultParagraphStyle) { + padding: margins(10px, 2px, 4px, 2px); + verticalSkip: 4px; + outline: 3px; + radius: 5px; +} messageTextStyle: TextStyle(defaultTextStyle) { - blockPadding: margins(10px, 4px, 6px, 4px); - blockVerticalSkip: 4px; - blockHeader: 20px; - blockHeaderPosition: point(10px, 2px); - blockOutline: 3px; - blockRadius: 5px; - preScrollable: true; + blockquote: ParagraphStyle(messageParagraphStyle) { + padding: margins(10px, 2px, 20px, 2px); + icon: icon{{ "chat/mini_quote", windowFg }}; + iconPosition: point(4px, 2px); + } + pre: ParagraphStyle(messageParagraphStyle) { + header: 20px; + headerPosition: point(10px, 2px); + scrollable: true; + } } msgDateTextStyle: defaultTextStyle; serviceTextPalette: TextPalette(defaultTextPalette) { diff --git a/Telegram/SourceFiles/ui/chat/chat_style.cpp b/Telegram/SourceFiles/ui/chat/chat_style.cpp index df19dbb45..c5d3bafdb 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.cpp +++ b/Telegram/SourceFiles/ui/chat/chat_style.cpp @@ -40,6 +40,7 @@ void EnsureBlockquoteCache( cache->bg.setAlphaF(0.12); cache->outline = color->c; cache->outline.setAlphaF(0.9); + cache->icon = cache->outline; } void EnsurePreCache( @@ -57,7 +58,6 @@ void EnsurePreCache( } cache->outline = color->c; cache->outline.setAlphaF(0.9); - cache->withHeader = true; cache->header = color->c; cache->header.setAlphaF(0.25); } diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 7ed87d049..46465fc5c 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 7ed87d049f1fdd21e4e1d36743bb3cbefe069a0d +Subproject commit 46465fc5ce14c4ca356870f0a8d51eb0285112a9