Added ability to override foreground color for date service messages.

This commit is contained in:
23rd 2021-05-31 20:18:56 +03:00 committed by John Preston
parent 7ee35bc80c
commit 2cd8b00610
2 changed files with 19 additions and 11 deletions

View File

@ -216,7 +216,8 @@ void paintPreparedDate(
int dateTextWidth,
int y,
int w,
const style::color &bg) {
const style::color &bg,
const style::color &fg) {
int left = st::msgServiceMargin.left();
int maxwidth = w;
if (Core::App().settings().chatWide()) {
@ -237,7 +238,7 @@ void paintPreparedDate(
bg);
p.setFont(st::msgServiceFont);
p.setPen(st::msgServiceFg);
p.setPen(fg);
p.drawText(left + st::msgServicePadding.left(), y + st::msgServiceMargin.top() + st::msgServicePadding.top() + st::msgServiceFont->ascent, dateText);
}
@ -261,10 +262,11 @@ void ServiceMessagePainter::paintDate(
const QDateTime &date,
int y,
int w,
const style::color &bg) {
const style::color &bg,
const style::color &fg) {
const auto dateText = langDayOfMonthFull(date.date());
const auto dateTextWidth = st::msgServiceFont->width(dateText);
paintPreparedDate(p, dateText, dateTextWidth, y, w, bg);
paintPreparedDate(p, dateText, dateTextWidth, y, w, bg, fg);
}
void ServiceMessagePainter::paintDate(
@ -272,14 +274,16 @@ void ServiceMessagePainter::paintDate(
const QString &dateText,
int y,
int w,
const style::color &bg) {
const style::color &bg,
const style::color &fg) {
paintPreparedDate(
p,
dateText,
st::msgServiceFont->width(dateText),
y,
w,
bg);
bg,
fg);
}
void ServiceMessagePainter::paintDate(
@ -288,8 +292,9 @@ void ServiceMessagePainter::paintDate(
int dateTextWidth,
int y,
int w,
const style::color &bg) {
paintPreparedDate(p, dateText, dateTextWidth, y, w, bg);
const style::color &bg,
const style::color &fg) {
paintPreparedDate(p, dateText, dateTextWidth, y, w, bg, fg);
}
void ServiceMessagePainter::paintBubble(

View File

@ -68,20 +68,23 @@ public:
const QDateTime &date,
int y,
int w,
const style::color &bg = st::msgServiceBg);
const style::color &bg = st::msgServiceBg,
const style::color &fg = st::msgServiceFg);
static void paintDate(
Painter &p,
const QString &dateText,
int y,
int w,
const style::color &bg = st::msgServiceBg);
const style::color &bg = st::msgServiceBg,
const style::color &fg = st::msgServiceFg);
static void paintDate(
Painter &p,
const QString &dateText,
int dateTextWidth,
int y,
int w,
const style::color &bg = st::msgServiceBg);
const style::color &bg = st::msgServiceBg,
const style::color &fg = st::msgServiceFg);
static void paintBubble(
Painter &p,