/* 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/widgets/checkbox.h" #include "base/timer.h" #include "base/flags.h" namespace Window { class SessionController; } // namespace Window namespace style { struct InfoToggle; struct InfoPeerBadge; } // namespace style namespace ChatHelpers { class TabbedPanel; } // namespace ChatHelpers namespace Ui { class AbstractButton; class UserpicButton; class FlatLabel; template class SlideWrap; } // namespace Ui namespace Ui::Text { struct CustomEmojiColored; } // namespace Ui::Text namespace Info { class Controller; class Section; } // namespace Info namespace Info { namespace Profile { enum class Badge { None = 0x00, Verified = 0x01, Premium = 0x02, Scam = 0x04, Fake = 0x08, }; inline constexpr bool is_flag_type(Badge) { return true; } class BadgeView final { public: BadgeView( not_null parent, const style::InfoPeerBadge &st, not_null peer, Fn animationPaused, int customStatusLoopsLimit = 0, base::flags allowed = base::flags::from_raw(-1)); [[nodiscard]] Ui::RpWidget *widget() const; void setPremiumClickCallback(Fn callback); [[nodiscrd]] rpl::producer<> updated() const; void move(int left, int top, int bottom); private: void setBadge(Badge badge, DocumentId emojiStatusId); const not_null _parent; const style::InfoPeerBadge &_st; const not_null _peer; const int _customStatusLoopsLimit = 0; DocumentId _emojiStatusId = 0; std::unique_ptr _emojiStatus; std::unique_ptr _emojiStatusColored; base::flags _allowed; Badge _badge = Badge(); Fn _premiumClickCallback; Fn _animationPaused; object_ptr _view = { nullptr }; rpl::event_stream<> _updated; rpl::lifetime _lifetime; }; class EmojiStatusPanel final { public: void show( not_null controller, not_null button); private: void create(not_null controller); base::unique_qptr _panel; }; class Cover final : public Ui::FixedHeightWidget { public: Cover( QWidget *parent, not_null peer, not_null controller); Cover( QWidget *parent, not_null peer, not_null controller, rpl::producer title); Cover *setOnlineCount(rpl::producer &&count); rpl::producer
showSection() const { return _showSection.events(); } ~Cover(); private: void setupChildGeometry(); void initViewers(rpl::producer title); void refreshStatusText(); void refreshNameGeometry(int newWidth); void refreshStatusGeometry(int newWidth); void refreshUploadPhotoOverlay(); const not_null _controller; const not_null _peer; BadgeView _badge; EmojiStatusPanel _emojiStatusPanel; int _onlineCount = 0; object_ptr _userpic; object_ptr _name = { nullptr }; object_ptr _status = { nullptr }; //object_ptr _dropArea = { nullptr }; base::Timer _refreshStatusTimer; rpl::event_stream
_showSection; }; } // namespace Profile } // namespace Info