Show blockquote icon.

This commit is contained in:
John Preston 2023-10-13 16:22:38 +04:00
parent 4b618a3578
commit 9661bac876
7 changed files with 43 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

View file

@ -76,11 +76,13 @@ private:
[[nodiscard]] QPoint scaled(QPoint value) const; [[nodiscard]] QPoint scaled(QPoint value) const;
[[nodiscard]] QMargins scaled(QMargins value) const; [[nodiscard]] QMargins scaled(QMargins value) const;
[[nodiscard]] style::font scaled( [[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( [[nodiscard]] style::TextStyle scaled(
const style::TextStyle &value, const style::TextStyle &value,
int fontSize, int fontSize) const;
int lineHeight) const;
[[nodiscard]] QImage scaled( [[nodiscard]] QImage scaled(
const style::icon &icon, const style::icon &icon,
const QColor &color) const; 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()); 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( style::TextStyle Preview::scaled(
const style::TextStyle &value, const style::TextStyle &value,
int fontSize, int fontSize) const {
int lineHeight) const {
return { return {
.font = scaled(value.font, fontSize), .font = scaled(value.font, fontSize),
.linkUnderline = value.linkUnderline, .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), .lineHeight = scaled(value.lineHeight),
.blockquote = scaled(value.blockquote),
.pre = scaled(value.pre),
}; };
} }
@ -356,8 +367,8 @@ void Preview::updateToScale(int scale) {
return; return;
} }
_scale = scale; _scale = scale;
_nameStyle = scaled(_nameStyle, 13, 0); _nameStyle = scaled(_nameStyle, 13);
_textStyle = scaled(_textStyle, 13, 0); _textStyle = scaled(_textStyle, 13);
_nameText.setText( _nameText.setText(
_nameStyle, _nameStyle,
u"Bob Harris"_q, u"Bob Harris"_q,

View file

@ -40,14 +40,23 @@ msgDateDelta: point(2px, 5px);
msgDateImgDelta: 4px; msgDateImgDelta: 4px;
msgDateImgPadding: point(8px, 2px); msgDateImgPadding: point(8px, 2px);
messageParagraphStyle: ParagraphStyle(defaultParagraphStyle) {
padding: margins(10px, 2px, 4px, 2px);
verticalSkip: 4px;
outline: 3px;
radius: 5px;
}
messageTextStyle: TextStyle(defaultTextStyle) { messageTextStyle: TextStyle(defaultTextStyle) {
blockPadding: margins(10px, 4px, 6px, 4px); blockquote: ParagraphStyle(messageParagraphStyle) {
blockVerticalSkip: 4px; padding: margins(10px, 2px, 20px, 2px);
blockHeader: 20px; icon: icon{{ "chat/mini_quote", windowFg }};
blockHeaderPosition: point(10px, 2px); iconPosition: point(4px, 2px);
blockOutline: 3px; }
blockRadius: 5px; pre: ParagraphStyle(messageParagraphStyle) {
preScrollable: true; header: 20px;
headerPosition: point(10px, 2px);
scrollable: true;
}
} }
msgDateTextStyle: defaultTextStyle; msgDateTextStyle: defaultTextStyle;
serviceTextPalette: TextPalette(defaultTextPalette) { serviceTextPalette: TextPalette(defaultTextPalette) {

View file

@ -40,6 +40,7 @@ void EnsureBlockquoteCache(
cache->bg.setAlphaF(0.12); cache->bg.setAlphaF(0.12);
cache->outline = color->c; cache->outline = color->c;
cache->outline.setAlphaF(0.9); cache->outline.setAlphaF(0.9);
cache->icon = cache->outline;
} }
void EnsurePreCache( void EnsurePreCache(
@ -57,7 +58,6 @@ void EnsurePreCache(
} }
cache->outline = color->c; cache->outline = color->c;
cache->outline.setAlphaF(0.9); cache->outline.setAlphaF(0.9);
cache->withHeader = true;
cache->header = color->c; cache->header = color->c;
cache->header.setAlphaF(0.25); cache->header.setAlphaF(0.25);
} }

@ -1 +1 @@
Subproject commit 7ed87d049f1fdd21e4e1d36743bb3cbefe069a0d Subproject commit 46465fc5ce14c4ca356870f0a8d51eb0285112a9