From 2cd8b00610bf95480a1d9a69d7125a5cd991ee0a Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 31 May 2021 20:18:56 +0300 Subject: [PATCH] Added ability to override foreground color for date service messages. --- .../view/history_view_service_message.cpp | 21 ++++++++++++------- .../view/history_view_service_message.h | 9 +++++--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_service_message.cpp b/Telegram/SourceFiles/history/view/history_view_service_message.cpp index cd8514414..b9fce0e04 100644 --- a/Telegram/SourceFiles/history/view/history_view_service_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_service_message.cpp @@ -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( diff --git a/Telegram/SourceFiles/history/view/history_view_service_message.h b/Telegram/SourceFiles/history/view/history_view_service_message.h index 0b152c55f..17b76a0c7 100644 --- a/Telegram/SourceFiles/history/view/history_view_service_message.h +++ b/Telegram/SourceFiles/history/view/history_view_service_message.h @@ -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,