BufferId bufferId = BufferId(chatScene()->idString().toInt());
MsgId lastSeenMsgId = Client::networkModel()->lastSeenMarkerMsgId(bufferId);
if(lastSeenMsgId < myMsgId && lastSeenMsgId >= prevMsgId) {
- QtUiStyleSettings s("Colors");
QLinearGradient gradient(0, 0, 0, contentsItem().fontMetrics()->lineSpacing());
- gradient.setColorAt(0, s.value("newMsgMarkerFG", QColor(Qt::red)).value<QColor>());
+ gradient.setColorAt(0, QtUi::style()->markerLineBrush().color()); // FIXME: Use full (gradient?) brush instead of just the color
gradient.setColorAt(0.1, Qt::transparent);
painter->fillRect(boundingRect(), gradient);
}
}
QString rolestr = line.left(idx).trimmed();
QString brushstr = line.mid(idx + 1).trimmed();
+
+ // We treat the marker line color as a palette role even though it isn't -> special casing
+ if(rolestr == "marker-line") {
+ _markerLineBrush = parseBrush(brushstr);
+ continue;
+ }
+
if(!_paletteColorRoles.contains(rolestr)) {
qWarning() << Q_FUNC_INFO << tr("Unknown palette role name: %1").arg(rolestr);
continue;
inline QPalette palette() const { return _palette; }
inline const QHash<quint64, QTextCharFormat>& formats() const { return _formats; }
+ inline QBrush markerLineBrush() const { return _markerLineBrush; }
protected:
typedef QList<qreal> ColorTuple;
private:
QPalette _palette;
QHash<quint64, QTextCharFormat> _formats;
+ QBrush _markerLineBrush;
int _maxSenderHash;
};
QssParser parser;
parser.processStyleSheet(styleSheet);
QApplication::setPalette(parser.palette());
+ _markerLineBrush = parser.markerLineBrush();
QTextCharFormat baseFmt = parser.formats().value(Base);
foreach(quint64 fmtType, parser.formats().keys()) {
QFontMetricsF *fontMetrics(quint32 formatType, quint32 messageLabel = 0);
inline QFont defaultFont() const { return _defaultFont; }
+ inline QBrush markerLineBrush() const { return _markerLineBrush; }
QList<QTextLayout::FormatRange> toTextLayoutList(const FormatList &, int textLength, quint32 messageLabel = 0);
private:
QFont _defaultFont;
+ QBrush _markerLineBrush;
QHash<quint64, QTextCharFormat> _formatCache;
QHash<quint64, QFontMetricsF *> _metricsCache;
static QHash<QString, FormatType> _formatCodes;