diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index fb0a19ef5..4dba7e723 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -24,6 +24,11 @@ UserpicButton { uploadIcon: icon; uploadIconPosition: point; } +ShortInfoBox { + label: FlatLabel; + labeled: FlatLabel; + labeledOneLine: FlatLabel; +} countryRowHeight: 36px; countryRowNameFont: semiboldFont; @@ -961,3 +966,26 @@ ringtonesBoxSkip: 7px; gradientButtonGlareDuration: 700; gradientButtonGlareTimeout: 2000; gradientButtonGlareWidth: 100px; + +infoLabeledOneLine: FlatLabel(defaultFlatLabel) { + maxHeight: 20px; + style: TextStyle(defaultTextStyle) { + lineHeight: 19px; + } + margin: margins(5px, 5px, 5px, 5px); +} +infoLabelSkip: 2px; +infoLabeled: FlatLabel(infoLabeledOneLine) { + minWidth: 180px; + maxHeight: 0px; + margin: margins(5px, 5px, 5px, 5px); +} +infoLabel: FlatLabel(infoLabeled) { + textFg: windowSubTextFg; +} + +shortInfoBox: ShortInfoBox { + label: infoLabel; + labeled: infoLabeled; + labeledOneLine: infoLabeledOneLine; +} diff --git a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp index 619542edb..1bf236db1 100644 --- a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp @@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "media/streaming/media_streaming_player.h" #include "base/event_filter.h" #include "lang/lang_keys.h" +#include "styles/style_boxes.h" #include "styles/style_layers.h" #include "styles/style_info.h" @@ -614,8 +615,10 @@ PeerShortInfoBox::PeerShortInfoBox( rpl::producer fields, rpl::producer status, rpl::producer userpic, - Fn videoPaused) -: _type(type) + Fn videoPaused, + const style::ShortInfoBox *stOverride) +: _st(stOverride ? *stOverride : st::shortInfoBox) +, _type(type) , _fields(std::move(fields)) , _topRoundBackground(this) , _scroll(this, st::shortInfoScroll) @@ -691,11 +694,12 @@ void PeerShortInfoBox::prepareRows() { auto addInfoLineGeneric = [&]( rpl::producer &&label, rpl::producer &&text, - const style::FlatLabel &textSt = st::infoLabeled) { + const style::FlatLabel &textSt) { auto line = CreateTextWithLabel( _rows, rpl::duplicate(label) | Ui::Text::ToWithEntities(), rpl::duplicate(text), + _st.label, textSt, st::shortInfoLabeledPadding); _rows->add(object_ptr( @@ -715,7 +719,7 @@ void PeerShortInfoBox::prepareRows() { auto addInfoLine = [&]( rpl::producer &&label, rpl::producer &&text, - const style::FlatLabel &textSt = st::infoLabeled) { + const style::FlatLabel &textSt) { return addInfoLineGeneric( std::move(label), std::move(text), @@ -728,7 +732,7 @@ void PeerShortInfoBox::prepareRows() { auto result = addInfoLine( std::move(label), std::move(text), - st::infoLabeledOneLine); + _st.labeledOneLine); result->setDoubleClickSelectsParagraph(true); result->setContextCopyText(contextCopyText); return result; @@ -744,7 +748,7 @@ void PeerShortInfoBox::prepareRows() { auto label = _fields.current().isBio ? tr::lng_info_bio_label() : tr::lng_info_about_label(); - addInfoLine(std::move(label), aboutValue()); + addInfoLine(std::move(label), aboutValue(), _st.labeled); addInfoOneLine( tr::lng_info_username_label(), usernameValue() | Ui::Text::ToWithEntities(), diff --git a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h index fc29b7062..07e60132a 100644 --- a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h +++ b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace style { struct ShortInfoCover; +struct ShortInfoBox; } // namespace style namespace Media::Streaming { @@ -144,7 +145,8 @@ public: rpl::producer fields, rpl::producer status, rpl::producer userpic, - Fn videoPaused); + Fn videoPaused, + const style::ShortInfoBox *stOverride); ~PeerShortInfoBox(); [[nodiscard]] rpl::producer<> openRequests() const; @@ -166,6 +168,7 @@ private: [[nodiscard]] rpl::producer usernameValue() const; [[nodiscard]] rpl::producer aboutValue() const; + const style::ShortInfoBox &_st; const PeerShortInfoType _type = PeerShortInfoType::User; rpl::variable _fields; diff --git a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp index a39b7eb47..8baf378b5 100644 --- a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp @@ -420,7 +420,8 @@ bool ProcessCurrent( object_ptr PrepareShortInfoBox( not_null peer, Fn open, - Fn videoPaused) { + Fn videoPaused, + const style::ShortInfoBox *stOverride) { const auto type = peer->isUser() ? PeerShortInfoType::User : peer->isBroadcast() @@ -432,7 +433,8 @@ object_ptr PrepareShortInfoBox( FieldsValue(peer), StatusValue(peer), std::move(userpic.value), - std::move(videoPaused)); + std::move(videoPaused), + stOverride); result->openRequests( ) | rpl::start_with_next(open, result->lifetime()); @@ -445,7 +447,8 @@ object_ptr PrepareShortInfoBox( object_ptr PrepareShortInfoBox( not_null peer, - not_null navigation) { + not_null navigation, + const style::ShortInfoBox *stOverride) { const auto open = [=] { navigation->showPeerHistory(peer); }; const auto videoIsPaused = [=] { return navigation->parentController()->isGifPausedAtLeastFor( @@ -454,7 +457,8 @@ object_ptr PrepareShortInfoBox( return PrepareShortInfoBox( peer, open, - videoIsPaused); + videoIsPaused, + stOverride); } rpl::producer PrepareShortInfoStatus(not_null peer) { diff --git a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.h b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.h index f50a23bf7..327ce373b 100644 --- a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.h +++ b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.h @@ -13,6 +13,7 @@ class PeerData; namespace style { struct ShortInfoCover; +struct ShortInfoBox; } // namespace style namespace Ui { @@ -33,11 +34,13 @@ struct PreparedShortInfoUserpic { [[nodiscard]] object_ptr PrepareShortInfoBox( not_null peer, Fn open, - Fn videoPaused); + Fn videoPaused, + const style::ShortInfoBox *stOverride = nullptr); [[nodiscard]] object_ptr PrepareShortInfoBox( not_null peer, - not_null navigation); + not_null navigation, + const style::ShortInfoBox *stOverride = nullptr); [[nodiscard]] rpl::producer PrepareShortInfoStatus( not_null peer); diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index d4c146ce7..a106a9586 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -389,22 +389,6 @@ infoNotificationsIconPosition: point(20px, 5px); infoSharedMediaButtonIconPosition: point(20px, 3px); infoGroupMembersIconPosition: point(20px, 10px); infoChannelMembersIconPosition: point(20px, 19px); -infoLabeledOneLine: FlatLabel(defaultFlatLabel) { - maxHeight: 20px; - style: TextStyle(defaultTextStyle) { - lineHeight: 19px; - } - margin: margins(5px, 5px, 5px, 5px); -} -infoLabelSkip: 2px; -infoLabeled: FlatLabel(infoLabeledOneLine) { - minWidth: 180px; - maxHeight: 0px; - margin: margins(5px, 5px, 5px, 5px); -} -infoLabel: FlatLabel(infoLabeled) { - textFg: windowSubTextFg; -} infoBlockHeaderLabel: FlatLabel(infoProfileStatus) { textFg: windowBoldFg; diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 82e0e5720..ad6b8519f 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -350,6 +350,7 @@ object_ptr DetailsFiller::setupInfo() { result, v::text::take_marked(std::move(label)), std::move(text), + st::infoLabel, textSt, padding); tracker.track(result->add(std::move(line.wrap))); diff --git a/Telegram/SourceFiles/info/profile/info_profile_text.cpp b/Telegram/SourceFiles/info/profile/info_profile_text.cpp index d6655dc7e..b09e35484 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_text.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_text.cpp @@ -22,6 +22,7 @@ TextWithLabel CreateTextWithLabel( QWidget *parent, rpl::producer &&label, rpl::producer &&text, + const style::FlatLabel &labelSt, const style::FlatLabel &textSt, const style::margins &padding) { auto result = object_ptr>( @@ -58,7 +59,7 @@ TextWithLabel CreateTextWithLabel( ) | rpl::after_next([=] { layout->resizeToWidth(layout->widthNoMargins()); }), - st::infoLabel)); + labelSt)); result->finishAnimating(); return { std::move(result), labeled, subtext }; } diff --git a/Telegram/SourceFiles/info/profile/info_profile_text.h b/Telegram/SourceFiles/info/profile/info_profile_text.h index dbf8b8384..50c97681a 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_text.h +++ b/Telegram/SourceFiles/info/profile/info_profile_text.h @@ -35,6 +35,7 @@ TextWithLabel CreateTextWithLabel( QWidget *parent, rpl::producer &&label, rpl::producer &&text, + const style::FlatLabel &labelSt, const style::FlatLabel &textSt, const style::margins &padding); diff --git a/Telegram/SourceFiles/media/stories/media_stories_recent_views.cpp b/Telegram/SourceFiles/media/stories/media_stories_recent_views.cpp index cb6077bf2..306e1a1f0 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_recent_views.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_recent_views.cpp @@ -8,17 +8,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "media/stories/media_stories_recent_views.h" #include "api/api_who_reacted.h" // FormatReadDate. +#include "boxes/peers/prepare_short_info_box.h" +#include "core/application.h" #include "data/data_peer.h" #include "data/data_stories.h" #include "main/main_session.h" #include "media/stories/media_stories_controller.h" #include "lang/lang_keys.h" #include "ui/chat/group_call_userpics.h" -#include "ui/widgets/popup_menu.h" #include "ui/controls/who_reacted_context_action.h" +#include "ui/layers/box_content.h" +#include "ui/widgets/popup_menu.h" #include "ui/painter.h" #include "ui/rp_widget.h" #include "ui/userpic_view.h" +#include "window/window_controller.h" +#include "window/window_session_controller.h" #include "styles/style_chat_helpers.h" #include "styles/style_media_view.h" @@ -324,8 +329,27 @@ void RecentViews::addMenuRow(Data::StoryView entry, const QDateTime &now) { const auto peer = entry.peer; const auto date = Api::FormatReadDate(entry.date, now); + const auto show = _controller->uiShow(); const auto prepare = [&](Ui::PeerUserpicView &view) { const auto size = st::storiesWhoViewed.photoSize; + auto callback = [=] { + const auto open = [=] { + if (const auto window = Core::App().windowFor(peer)) { + window->invokeForSessionController( + &peer->session().account(), + peer, + [&](not_null controller) { + Core::App().hideMediaView(); + controller->showPeerHistory(peer); + }); + } + }; + show->show(PrepareShortInfoBox( + peer, + open, + [] { return false; }, + &st::storiesShortInfoBox)); + }; auto userpic = peer->generateUserpicImage( view, size * style::DevicePixelRatio()); @@ -334,7 +358,7 @@ void RecentViews::addMenuRow(Data::StoryView entry, const QDateTime &now) { .text = peer->name(), .date = date, .userpic = std::move(userpic), - .callback = [] {}, + .callback = std::move(callback), }; }; if (_menuPlaceholderCount > 0) { diff --git a/Telegram/SourceFiles/media/view/media_view.style b/Telegram/SourceFiles/media/view/media_view.style index fc94f4dba..bf2f7624e 100644 --- a/Telegram/SourceFiles/media/view/media_view.style +++ b/Telegram/SourceFiles/media/view/media_view.style @@ -793,3 +793,21 @@ storiesUnsupportedLabel: FlatLabel(defaultFlatLabel) { align: align(top); } storiesUnsupportedUpdate: themePreviewApplyButton; +storiesShortInfoBox: ShortInfoBox(shortInfoBox) { + label: FlatLabel(infoLabel) { + textFg: storiesComposeGrayText; + palette: TextPalette(mediaviewTextPalette) { + linkFg: mediaviewTextLinkFg; + monoFg: storiesComposeGrayText; + spoilerFg: storiesComposeGrayText; + } + } + labeled: FlatLabel(infoLabeled) { + textFg: mediaviewCaptionFg; + palette: mediaviewTextPalette; + } + labeledOneLine: FlatLabel(infoLabeledOneLine) { + textFg: mediaviewCaptionFg; + palette: mediaviewTextPalette; + } +}