aboutsummaryrefslogtreecommitdiffstats
path: root/src/carddelegate.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/carddelegate.h')
-rw-r--r--src/carddelegate.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/carddelegate.h b/src/carddelegate.h
index 1846359..cfbd23e 100644
--- a/src/carddelegate.h
+++ b/src/carddelegate.h
@@ -18,6 +18,7 @@
#pragma once
+#include "businesssenders.h"
#include "tagchip.h"
/// Paints a whole card: three lines, all of it, including the tag chips.
@@ -77,6 +78,23 @@ public:
/// Falls back to threadLineColour() for a thread with no account tag.
static QColor accentLineColour(const QColor &accountColour);
+ /// Where the account's fade runs, given the card and the row's innermost
+ /// spine (an empty rect for a thread root, which has none).
+ ///
+ /// Runs RIGHT to left: opaque at the card's right edge and gone 60% of the
+ /// width in, so the only hard stop is the card's own boundary and the
+ /// accent bar is left to state the account on its own. A reply is clamped
+ /// at its own spine, which IS its coloured left border, so its wash is
+ /// shorter as well as further right.
+ ///
+ /// Static and rect-in, rect-out so the geometry is assertable without a
+ /// painter, for the same reason CardLayout is.
+ static QRect fadeRectFor(const QRect &card, const QRect &innermostSpine);
+
+ /// How far back across the card, from its right edge, the account's
+ /// colour reaches.
+ static constexpr qreal kFadeFraction = 0.60;
+
/// A tag chip's colour, drained for the SIBLING tier (item 111).
///
/// Saturation only: hue stays so the tag is still recognisable, and
@@ -94,4 +112,31 @@ public:
/// survived exactly that kind of test.
static QSize chipSize(const QFontMetrics &metrics, const QString &text,
bool own);
+
+ /// The squircle for one row, resolved from what the model supplies.
+ ///
+ /// Falls back to the ACCOUNT when the row has no sender address, so every
+ /// card carries an avatar rather than a hole: the seed becomes the
+ /// account's own address and the letters come from its label.
+ static QPixmap avatarFor(const QString &senderAddress,
+ const QString &senderName,
+ const QString &accountAddress,
+ const QString &accountLabel,
+ bool isBusinessSender, int side,
+ const QFont &font);
+
+ void setAccountAddress(const QString &address)
+ {
+ m_accountAddress = address;
+ }
+ void setAccountLabel(const QString &label) { m_accountLabel = label; }
+ void setBusinessSenders(const BusinessSenders::List &list)
+ {
+ m_businessSenders = list;
+ }
+
+private:
+ QString m_accountAddress;
+ QString m_accountLabel;
+ BusinessSenders::List m_businessSenders;
};