diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 9782cd6fd..729f595e5 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -688,6 +688,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) { active, selected, ms, + videoPaused, showUnreadInSearchResults); p.translate(0, st::dialogsRowHeight); } diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 28061779d..dbe39e78e 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -259,7 +259,9 @@ void PaintListEntryText( QRect rect, bool active, bool selected, - not_null row) { + not_null row, + crl::time now, + bool paused) { if (rect.isEmpty()) { return; } @@ -285,6 +287,8 @@ void PaintListEntryText( ? st::dialogsTextPaletteOver : st::dialogsTextPalette)), .spoiler = Text::DefaultSpoilerCache(), + .now = now, + .paused = paused, .elisionLines = rect.height() / st::dialogsTextFont->height, }); } @@ -436,6 +440,8 @@ void paintRow( .position = { nameleft, texttop }, .availableWidth = availableWidth, .spoiler = Text::DefaultSpoilerCache(), + .now = ms, + .paused = bool(flags & Flag::VideoPaused), .elisionLines = 1, }); } else if (draft @@ -503,6 +509,8 @@ void paintRow( ? st::dialogsTextPaletteDraftOver : st::dialogsTextPaletteDraft)), .spoiler = Text::DefaultSpoilerCache(), + .now = ms, + .paused = bool(flags & Flag::VideoPaused), .elisionLines = 1, }); } @@ -953,7 +961,7 @@ void RowPainter::paint( ms) : false; if (const auto folder = row->folder()) { - PaintListEntryText(p, rect, active, selected, row); + PaintListEntryText(p, rect, active, selected, row, ms, paused); } else if (history && !actionWasPainted) { if (!history->lastItemDialogsView.prepared(item)) { history->lastItemDialogsView.prepare( @@ -961,7 +969,13 @@ void RowPainter::paint( [=] { history->updateChatListEntry(); }, {}); } - history->lastItemDialogsView.paint(p, rect, active, selected); + history->lastItemDialogsView.paint( + p, + rect, + active, + selected, + ms, + paused); } }; const auto paintCounterCallback = [&] { @@ -1006,6 +1020,7 @@ void RowPainter::paint( bool active, bool selected, crl::time ms, + bool paused, bool displayUnreadInfo) { auto item = row->item(); auto history = item->history(); @@ -1088,7 +1103,7 @@ void RowPainter::paint( if (!view.prepared(item)) { view.prepare(item, row->repaint(), previewOptions); } - row->itemView().paint(p, itemRect, active, selected); + row->itemView().paint(p, itemRect, active, selected, ms, paused); }; const auto paintCounterCallback = [&] { PaintNarrowCounter( @@ -1111,7 +1126,8 @@ void RowPainter::paint( | (selected ? Flag::Selected : Flag(0)) | Flag::SearchResult | (showSavedMessages ? Flag::SavedMessages : Flag(0)) - | (showRepliesMessages ? Flag::RepliesMessages : Flag(0)); + | (showRepliesMessages ? Flag::RepliesMessages : Flag(0)) + | (paused ? Flag::VideoPaused : Flag(0)); paintRow( p, row, diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.h b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.h index b9987fc6e..09770e10d 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.h +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.h @@ -46,6 +46,7 @@ public: bool active, bool selected, crl::time ms, + bool paused, bool displayUnreadInfo); static QRect sendActionAnimationRect( int animationLeft, diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp index 40d8eaa18..b1525e230 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp @@ -176,7 +176,9 @@ void MessageView::paint( Painter &p, const QRect &geometry, bool active, - bool selected) const { + bool selected, + crl::time now, + bool paused) const { if (geometry.isEmpty()) { return; } @@ -227,6 +229,8 @@ void MessageView::paint( .availableWidth = rect.width(), .palette = palette, .spoiler = Text::DefaultSpoilerCache(), + .now = now, + .paused = paused, .elisionLines = rect.height() / st::dialogsTextFont->height, }); } diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.h b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.h index 449932b52..8ae12b6a0 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.h +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.h @@ -49,7 +49,9 @@ public: Painter &p, const QRect &geometry, bool active, - bool selected) const; + bool selected, + crl::time now, + bool paused) const; private: struct LoadingContext; diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_search.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_search.cpp index 4a908ef8f..668914acf 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_search.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_search.cpp @@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/labels.h" #include "ui/widgets/multi_select.h" #include "ui/widgets/scroll_area.h" +#include "ui/painter.h" #include "window/window_session_controller.h" #include "styles/style_boxes.h" #include "styles/style_chat.h" @@ -40,7 +41,7 @@ using SearchRequest = Api::MessagesSearchMerged::Request; class Row final : public PeerListRow { public: - Row(std::unique_ptr fakeRow); + explicit Row(std::unique_ptr fakeRow); [[nodiscard]] FullMsgId fullId() const; @@ -99,7 +100,15 @@ void Row::elementsPaint( int selectedElement) { _outerWidth = outerWidth; using Row = Dialogs::Ui::RowPainter; - Row::paint(p, _fakeRow.get(), outerWidth, false, selected, 0, false); + Row::paint( + p, + _fakeRow.get(), + outerWidth, + false, + selected, + crl::now(), + p.inactive(), + false); } class ListController final : public PeerListController { diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index a3f44b4d5..7960e44ab 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1304,6 +1304,8 @@ void Message::paintText( .availableWidth = trect.width(), .palette = &stm->textPalette, .spoiler = Ui::Text::DefaultSpoilerCache(), + .now = context.now, + .paused = context.paused, .selection = context.selection, }); } diff --git a/Telegram/SourceFiles/history/view/history_view_service_message.cpp b/Telegram/SourceFiles/history/view/history_view_service_message.cpp index 7ce1ca2aa..e957ef736 100644 --- a/Telegram/SourceFiles/history/view/history_view_service_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_service_message.cpp @@ -546,6 +546,8 @@ void Service::draw(Painter &p, const PaintContext &context) const { .align = style::al_top, .palette = &st->serviceTextPalette(), .spoiler = Ui::Text::DefaultSpoilerCache(), + .now = context.now, + .paused = context.paused, .selection = context.selection, .fullWidthSelection = false, }); diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index 2bd2b967f..ed4297be8 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -701,6 +701,8 @@ void Document::draw( .availableWidth = captionw, .palette = &stm->textPalette, .spoiler = Ui::Text::DefaultSpoilerCache(), + .now = context.now, + .paused = context.paused, .selection = selection, }); } diff --git a/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp b/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp index efcaeb840..25a103151 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp @@ -238,6 +238,8 @@ void ExtendedPreview::draw(Painter &p, const PaintContext &context) const { .availableWidth = captionw, .palette = &stm->textPalette, .spoiler = Ui::Text::DefaultSpoilerCache(), + .now = context.now, + .paused = context.paused, .selection = context.selection, }); } else if (!inWebPage) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index e464192c2..f544fbb08 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -612,6 +612,8 @@ void Gif::draw(Painter &p, const PaintContext &context) const { .availableWidth = captionw, .palette = &stm->textPalette, .spoiler = Ui::Text::DefaultSpoilerCache(), + .now = context.now, + .paused = context.paused, .selection = context.selection, }); } else if (!inWebPage && !skipDrawingSurrounding) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp index 00f933539..a2e02abdf 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp @@ -353,6 +353,8 @@ void GroupedMedia::draw(Painter &p, const PaintContext &context) const { .availableWidth = captionw, .palette = &stm->textPalette, .spoiler = Ui::Text::DefaultSpoilerCache(), + .now = context.now, + .paused = context.paused, .selection = context.selection, }); } else if (_parent->media() == this) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index f592407db..2b16f65fc 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -305,6 +305,8 @@ void Photo::draw(Painter &p, const PaintContext &context) const { .availableWidth = captionw, .palette = &stm->textPalette, .spoiler = Ui::Text::DefaultSpoilerCache(), + .now = context.now, + .paused = context.paused, .selection = context.selection, }); } else if (!inWebPage) { diff --git a/Telegram/SourceFiles/ui/chat/chat_style.cpp b/Telegram/SourceFiles/ui/chat/chat_style.cpp index 18006ad47..dc179dd14 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.cpp +++ b/Telegram/SourceFiles/ui/chat/chat_style.cpp @@ -627,12 +627,13 @@ void ChatStyle::make( my.linkAlwaysActive = original.linkAlwaysActive; make(my.linkFg, original.linkFg); make(my.monoFg, original.monoFg); + make(my.spoilerFg, original.spoilerFg); make(my.selectBg, original.selectBg); make(my.selectFg, original.selectFg); make(my.selectLinkFg, original.selectLinkFg); make(my.selectMonoFg, original.selectMonoFg); + make(my.selectSpoilerFg, original.selectSpoilerFg); make(my.selectOverlay, original.selectOverlay); - make(my.spoilerFg, original.spoilerFg); } void ChatStyle::make( diff --git a/Telegram/SourceFiles/ui/chat/message_bar.cpp b/Telegram/SourceFiles/ui/chat/message_bar.cpp index 71b38ba76..e2a7e02ed 100644 --- a/Telegram/SourceFiles/ui/chat/message_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/message_bar.cpp @@ -409,6 +409,8 @@ void MessageBar::paint(Painter &p) { .availableWidth = body.width(), .palette = &_st.textPalette, .spoiler = Ui::Text::DefaultSpoilerCache(), + .now = crl::now(), + .paused = p.inactive(), .elisionLines = 1, }); } diff --git a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp index cdd8ef4da..958af993b 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp @@ -982,12 +982,13 @@ void Generator::paintHistoryShadows() { void Generator::setTextPalette(const style::TextPalette &st) { _textPalette.linkFg = st.linkFg[_palette].clone(); _textPalette.monoFg = st.monoFg[_palette].clone(); + _textPalette.spoilerFg = st.spoilerFg[_palette].clone(); _textPalette.selectBg = st.selectBg[_palette].clone(); _textPalette.selectFg = st.selectFg[_palette].clone(); _textPalette.selectLinkFg = st.selectLinkFg[_palette].clone(); _textPalette.selectMonoFg = st.selectMonoFg[_palette].clone(); + _textPalette.selectSpoilerFg = st.selectSpoilerFg[_palette].clone(); _textPalette.selectOverlay = st.selectOverlay[_palette].clone(); - _textPalette.spoilerFg = st.spoilerFg[_palette].clone(); _p->setTextPalette(_textPalette); } diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 4ff5bc577..a60fe582a 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 4ff5bc5773d95b07fd34485a564d1aacc3fb9d1a +Subproject commit a60fe582ad9ab797ead0a18a9ed18e1892681c60