/* 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 template class object_ptr; class PeerData; struct ShareBoxStyleOverrides; namespace ChatHelpers { class Show; } // namespace ChatHelpers namespace Data { struct Boost; struct CreditsHistoryEntry; struct SubscriptionEntry; struct GiftCode; struct CreditTopupOption; struct SavedStarGift; struct StarGift; } // namespace Data namespace HistoryView { struct ScheduleBoxStyleArgs; } // namespace HistoryView namespace Main { class Session; class SessionShow; } // namespace Main namespace Window { class SessionController; } // namespace Window namespace style { struct Box; struct Table; struct FlatLabel; struct PopupMenu; struct PeerListItem; } // namespace style namespace Ui { class GenericBox; class RpWidget; class VerticalLayout; class PopupMenu; } // namespace Ui namespace Settings { struct SubscriptionRightLabel { Fn draw; QSize size; }; SubscriptionRightLabel PaintSubscriptionRightLabelCallback( not_null session, const style::PeerListItem &st, int amount); void FillCreditOptions( std::shared_ptr show, not_null container, not_null peer, StarsAmount minCredits, Fn paid, rpl::producer subtitle, std::vector preloadedTopupOptions); [[nodiscard]] not_null AddBalanceWidget( not_null parent, rpl::producer balanceValue, bool rightAlign, rpl::producer opacityValue = nullptr); void AddWithdrawalWidget( not_null container, not_null controller, not_null peer, rpl::producer secondButtonUrl, rpl::producer availableBalanceValue, rpl::producer dateValue, bool withdrawalEnabled, rpl::producer usdValue); struct GiftWearBoxStyleOverride { const style::Box *box = nullptr; const style::FlatLabel *title = nullptr; const style::FlatLabel *subtitle = nullptr; const style::icon *radiantIcon = nullptr; const style::icon *proofIcon = nullptr; const style::FlatLabel *infoTitle = nullptr; const style::FlatLabel *infoAbout = nullptr; }; [[nodiscard]] GiftWearBoxStyleOverride DarkGiftWearBoxStyle(); struct CreditsEntryBoxStyleOverrides { const style::Box *box = nullptr; const style::PopupMenu *menu = nullptr; const style::Table *table = nullptr; const style::FlatLabel *tableValueMultiline = nullptr; const style::FlatLabel *tableValueMessage = nullptr; const style::icon *link = nullptr; const style::icon *share = nullptr; const style::icon *transfer = nullptr; const style::icon *wear = nullptr; const style::icon *takeoff = nullptr; const style::icon *show = nullptr; const style::icon *hide = nullptr; const style::icon *pin = nullptr; const style::icon *unpin = nullptr; std::shared_ptr shareBox; std::shared_ptr giftWearBox; }; [[nodiscard]] CreditsEntryBoxStyleOverrides DarkCreditsEntryBoxStyle(); void GenericCreditsEntryBox( not_null box, std::shared_ptr show, const Data::CreditsHistoryEntry &e, const Data::SubscriptionEntry &s, CreditsEntryBoxStyleOverrides st = {}); void ReceiptCreditsBox( not_null box, not_null controller, const Data::CreditsHistoryEntry &e, const Data::SubscriptionEntry &s); void BoostCreditsBox( not_null box, not_null controller, const Data::Boost &b); void GiftedCreditsBox( not_null box, not_null controller, not_null from, not_null to, int count, TimeId date); void CreditsPrizeBox( not_null box, not_null controller, const Data::GiftCode &data, TimeId date); void GlobalStarGiftBox( not_null box, std::shared_ptr show, const Data::StarGift &data, CreditsEntryBoxStyleOverrides st = {}); [[nodiscard]] Data::CreditsHistoryEntry SavedStarGiftEntry( not_null owner, const Data::SavedStarGift &data); void SavedStarGiftBox( not_null box, not_null controller, not_null owner, const Data::SavedStarGift &data); enum class SavedStarGiftMenuType { List, View, }; void FillSavedStarGiftMenu( std::shared_ptr show, not_null menu, const Data::CreditsHistoryEntry &e, SavedStarGiftMenuType type, CreditsEntryBoxStyleOverrides st = {}); void StarGiftViewBox( not_null box, not_null controller, const Data::GiftCode &data, not_null item); void ShowRefundInfoBox( not_null controller, FullMsgId refundItemId); [[nodiscard]] object_ptr GenericEntryPhoto( not_null parent, Fn(Fn update)> callback, int photoSize); [[nodiscard]] object_ptr HistoryEntryPhoto( not_null parent, not_null photo, int photoSize); [[nodiscard]] object_ptr PaidMediaThumbnail( not_null parent, not_null photo, PhotoData *second, int totalCount, int photoSize); [[nodiscard]] object_ptr SubscriptionUserpic( not_null parent, not_null peer, int photoSize); struct SmallBalanceBot { UserId botId = 0; }; struct SmallBalanceReaction { ChannelId channelId = 0; }; struct SmallBalanceSubscription { QString name; }; struct SmallBalanceDeepLink { QString purpose; }; struct SmallBalanceStarGift { PeerId recipientId; }; struct SmallBalanceForMessage { PeerId recipientId; }; struct SmallBalanceSource : std::variant< SmallBalanceBot, SmallBalanceReaction, SmallBalanceSubscription, SmallBalanceDeepLink, SmallBalanceStarGift, SmallBalanceForMessage> { using variant::variant; }; void SmallBalanceBox( not_null box, std::shared_ptr show, uint64 wholeCredits, SmallBalanceSource source, Fn paid); enum class SmallBalanceResult { Already, Success, Blocked, Cancelled, }; void MaybeRequestBalanceIncrease( std::shared_ptr show, uint64 credits, SmallBalanceSource source, Fn done); void AddMiniStars( not_null content, not_null widget, int photoSize, int boxWidth, float64 heightRatio); } // namespace Settings