/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "ui/wrap/padding_wrap.h" #include "ui/abstract_button.h" #include "base/timer.h" namespace Window { class SessionController; } // namespace Window namespace Ui { class UserpicButton; class FlatLabel; template class SlideWrap; class RoundButton; } // namespace Ui namespace HistoryView { class StickerPlayer; } // namespace HistoryView namespace Data { class ForumTopic; } // namespace Data namespace Info { class Controller; class Section; } // namespace Info namespace style { struct InfoProfileCover; } // namespace style namespace Info::Profile { class EmojiStatusPanel; class Badge; class TopicIconView final { public: TopicIconView( not_null topic, Fn paused, Fn update); TopicIconView( not_null topic, Fn paused, Fn update, const style::color &generalIconFg); void paintInRect(QPainter &p, QRect rect); private: using StickerPlayer = HistoryView::StickerPlayer; void setup(not_null topic); void setupPlayer(not_null topic); void setupImage(not_null topic); const not_null _topic; const style::color &_generalIconFg; Fn _paused; Fn _update; std::shared_ptr _player; QImage _image; rpl::lifetime _lifetime; }; class TopicIconButton final : public Ui::AbstractButton { public: TopicIconButton( QWidget *parent, not_null controller, not_null topic); private: TopicIconView _view; }; class Cover final : public Ui::FixedHeightWidget { public: enum class Role { Info, EditContact, }; Cover( QWidget *parent, not_null controller, not_null peer); Cover( QWidget *parent, not_null controller, not_null topic); Cover( QWidget *parent, not_null controller, not_null peer, Role role, rpl::producer title); ~Cover(); Cover *setOnlineCount(rpl::producer &&count); [[nodiscard]] rpl::producer
showSection() const { return _showSection.events(); } [[nodiscard]] std::optional updatedPersonalPhoto() const; private: Cover( QWidget *parent, not_null controller, not_null peer, Data::ForumTopic *topic, Role role, rpl::producer title); void setupShowLastSeen(); void setupChildGeometry(); void initViewers(rpl::producer title); void refreshStatusText(); void refreshNameGeometry(int newWidth); void refreshStatusGeometry(int newWidth); void refreshUploadPhotoOverlay(); void setupChangePersonal(); const style::InfoProfileCover &_st; const Role _role = Role::Info; const not_null _controller; const not_null _peer; const std::unique_ptr _emojiStatusPanel; const std::unique_ptr _badge; rpl::variable _onlineCount; object_ptr _userpic; Ui::UserpicButton *_changePersonal = nullptr; std::optional _personalChosen; object_ptr _iconButton; object_ptr _name = { nullptr }; object_ptr _status = { nullptr }; object_ptr _showLastSeen = { nullptr }; //object_ptr _dropArea = { nullptr }; base::Timer _refreshStatusTimer; rpl::event_stream
_showSection; }; } // namespace Info::Profile