aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cardlayout.cpp10
-rw-r--r--src/cardlayout.h10
2 files changed, 20 insertions, 0 deletions
diff --git a/src/cardlayout.cpp b/src/cardlayout.cpp
index d32935b..a9bbe52 100644
--- a/src/cardlayout.cpp
+++ b/src/cardlayout.cpp
@@ -175,6 +175,16 @@ CardLayout CardLayout::compute(const Input &input, const QRect &rect,
const int indent = depth * kIndentStep;
out.contentLeft = textLeft + kPaddingX + indent;
+ // The avatar, square, in the gutter between the indent and the text.
+ // Sized from the card's HEIGHT rather than from a pixel constant, so it
+ // follows the desktop's font exactly as markSide() does.
+ const int avatarSide = qMax(0, rect.height() - kPaddingY * 2);
+ out.avatarRect = QRect(out.contentLeft, rect.top() + kPaddingY,
+ avatarSide, avatarSide);
+ // Everything after it starts past the squircle. This is what the item's
+ // cost is: a deep reply loses the gutter on top of its indent.
+ out.contentLeft = out.avatarRect.right() + 1 + kAvatarGap;
+
// One spine per level actually indented, each running the card's full
// height so an expansion reads as one continuous block.
for (int level = 0; level < depth; ++level) {
diff --git a/src/cardlayout.h b/src/cardlayout.h
index 92edd96..cd4eb76 100644
--- a/src/cardlayout.h
+++ b/src/cardlayout.h
@@ -142,6 +142,16 @@ struct CardLayout
/// without ever drawing two lines. Empty on a reply.
QRect accentRect;
+ /// The sender's avatar squircle, in its own gutter before the text.
+ ///
+ /// On EVERY row, thread and reply alike: a reply is where the sender
+ /// actually changes, so it is the row whose author is most worth seeing.
+ /// Square, and inset vertically so it does not touch the card's edges.
+ QRect avatarRect;
+
+ /// Space between the avatar and the text that follows it.
+ static constexpr int kAvatarGap = 8;
+
/// One full-height vertical line per depth level, outermost first.
QVector<QRect> spines;