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]] 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,

View File

@ -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) {

View File

@ -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);
}

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