tdesktop/Telegram/SourceFiles/ui/effects/premium_graphics.h

112 lines
2.5 KiB
C
Raw Normal View History

/*
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
2022-05-31 10:32:07 +00:00
#include "ui/effects/round_checkbox.h"
2022-05-20 14:57:01 +00:00
namespace style {
struct PremiumLimits;
} // namespace style
namespace tr {
template <typename ...>
struct phrase;
} // namespace tr
enum lngtag_count : int;
namespace Data {
struct SubscriptionOption;
} // namespace Data
2022-05-31 10:32:07 +00:00
namespace style {
struct RoundImageCheckbox;
struct PremiumOption;
2022-05-31 10:32:07 +00:00
struct TextStyle;
} // namespace style
namespace Ui {
class GenericBox;
2022-05-31 10:32:07 +00:00
class RadiobuttonGroup;
class VerticalLayout;
namespace Premium {
inline constexpr auto kLimitRowRatio = 0.5;
void AddBubbleRow(
not_null<Ui::VerticalLayout*> parent,
rpl::producer<> showFinishes,
int min,
int current,
int max,
bool premiumPossible,
std::optional<tr::phrase<lngtag_count>> phrase,
const style::icon *icon);
2022-06-14 10:54:30 +00:00
void AddLimitRow(
not_null<Ui::VerticalLayout*> parent,
const style::PremiumLimits &st,
2022-06-14 10:54:30 +00:00
QString max,
QString min = {},
float64 ratio = kLimitRowRatio);
2022-06-14 10:54:30 +00:00
void AddLimitRow(
not_null<Ui::VerticalLayout*> parent,
const style::PremiumLimits &st,
int max,
2022-05-31 10:32:07 +00:00
std::optional<tr::phrase<lngtag_count>> phrase,
int min = 0,
float64 ratio = kLimitRowRatio);
2022-05-31 10:32:07 +00:00
struct AccountsRowArgs final {
std::shared_ptr<Ui::RadiobuttonGroup> group;
const style::RoundImageCheckbox &st;
const style::TextStyle &stName;
const style::color &stNameFg;
struct Entry final {
QString name;
Ui::RoundImageCheckbox::PaintRoundImage paintRoundImage;
};
std::vector<Entry> entries;
};
void AddAccountsRow(
not_null<Ui::VerticalLayout*> parent,
AccountsRowArgs &&args);
2022-05-20 14:57:01 +00:00
[[nodiscard]] QGradientStops LimitGradientStops();
[[nodiscard]] QGradientStops ButtonGradientStops();
[[nodiscard]] QGradientStops LockGradientStops();
[[nodiscard]] QGradientStops FullHeightGradientStops();
[[nodiscard]] QGradientStops GiftGradientStops();
struct ListEntry final {
2023-08-04 06:07:37 +00:00
rpl::producer<QString> title;
rpl::producer<TextWithEntities> about;
int leftNumber = 0;
int rightNumber = 0;
std::optional<QString> customRightText;
2023-08-04 06:07:37 +00:00
const style::icon *icon = nullptr;
};
void ShowListBox(
not_null<Ui::GenericBox*> box,
const style::PremiumLimits &st,
std::vector<ListEntry> entries);
2022-05-20 14:57:01 +00:00
void AddGiftOptions(
not_null<Ui::VerticalLayout*> parent,
std::shared_ptr<Ui::RadiobuttonGroup> group,
std::vector<Data::SubscriptionOption> gifts,
const style::PremiumOption &st,
bool topBadges = false);
} // namespace Premium
} // namespace Ui