2023-09-12 21:00:39 +04:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
|
2023-10-27 17:49:37 +04:00
|
|
|
#include "base/object_ptr.h"
|
|
|
|
|
2023-09-12 21:00:39 +04:00
|
|
|
namespace Ui {
|
|
|
|
|
2023-10-11 13:47:21 +04:00
|
|
|
void StartFireworks(not_null<QWidget*> parent);
|
|
|
|
|
2023-10-27 17:49:37 +04:00
|
|
|
class Show;
|
|
|
|
class RpWidget;
|
2023-09-12 21:00:39 +04:00
|
|
|
class GenericBox;
|
2023-10-12 00:46:40 +03:00
|
|
|
class VerticalLayout;
|
2024-08-06 16:08:55 +02:00
|
|
|
class FlatLabel;
|
2023-09-12 21:00:39 +04:00
|
|
|
|
|
|
|
struct BoostCounters {
|
|
|
|
int level = 0;
|
|
|
|
int boosts = 0;
|
|
|
|
int thisLevelBoosts = 0;
|
|
|
|
int nextLevelBoosts = 0; // Zero means no next level is available.
|
2023-11-07 17:58:20 +04:00
|
|
|
int mine = 0;
|
|
|
|
|
|
|
|
friend inline constexpr bool operator==(
|
|
|
|
BoostCounters,
|
|
|
|
BoostCounters) = default;
|
2023-09-12 21:00:39 +04:00
|
|
|
};
|
|
|
|
|
2024-02-07 12:20:59 +04:00
|
|
|
struct BoostFeatures {
|
|
|
|
base::flat_map<int, int> nameColorsByLevel;
|
|
|
|
base::flat_map<int, int> linkStylesByLevel;
|
|
|
|
int linkLogoLevel = 0;
|
2025-04-24 13:54:07 +04:00
|
|
|
int autotranslateLevel = 0;
|
2024-02-07 12:20:59 +04:00
|
|
|
int transcribeLevel = 0;
|
|
|
|
int emojiPackLevel = 0;
|
|
|
|
int emojiStatusLevel = 0;
|
|
|
|
int wallpaperLevel = 0;
|
|
|
|
int wallpapersCount = 0;
|
|
|
|
int customWallpaperLevel = 0;
|
2024-07-04 10:07:18 +03:00
|
|
|
int sponsoredLevel = 0;
|
2024-02-07 12:20:59 +04:00
|
|
|
};
|
|
|
|
|
2023-09-12 21:00:39 +04:00
|
|
|
struct BoostBoxData {
|
|
|
|
QString name;
|
|
|
|
BoostCounters boost;
|
2024-02-07 12:20:59 +04:00
|
|
|
BoostFeatures features;
|
2025-01-02 23:52:49 +04:00
|
|
|
int lifting = 0;
|
2023-11-08 13:31:01 +04:00
|
|
|
bool allowMulti = false;
|
2024-02-02 21:30:53 +04:00
|
|
|
bool group = false;
|
2023-09-12 21:00:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
void BoostBox(
|
|
|
|
not_null<GenericBox*> box,
|
|
|
|
BoostBoxData data,
|
2023-11-07 17:58:20 +04:00
|
|
|
Fn<void(Fn<void(BoostCounters)>)> boost);
|
2023-09-12 21:00:39 +04:00
|
|
|
|
2024-02-02 21:30:53 +04:00
|
|
|
void BoostBoxAlready(not_null<GenericBox*> box, bool group);
|
2023-11-08 13:31:01 +04:00
|
|
|
void GiftForBoostsBox(
|
|
|
|
not_null<GenericBox*> box,
|
|
|
|
QString channel,
|
|
|
|
int receive,
|
|
|
|
bool again);
|
2024-02-02 21:30:53 +04:00
|
|
|
void GiftedNoBoostsBox(not_null<GenericBox*> box, bool group);
|
|
|
|
void PremiumForBoostsBox(
|
|
|
|
not_null<GenericBox*> box,
|
|
|
|
bool group,
|
|
|
|
Fn<void()> buyPremium);
|
2023-11-08 13:31:01 +04:00
|
|
|
|
2023-11-14 14:35:57 +04:00
|
|
|
struct AskBoostChannelColor {
|
|
|
|
int requiredLevel = 0;
|
|
|
|
};
|
|
|
|
|
2025-04-24 13:54:07 +04:00
|
|
|
struct AskBoostAutotranslate {
|
|
|
|
int requiredLevel = 0;
|
|
|
|
};
|
|
|
|
|
2023-12-20 23:02:54 -04:00
|
|
|
struct AskBoostWallpaper {
|
|
|
|
int requiredLevel = 0;
|
2024-02-08 21:58:16 +04:00
|
|
|
bool group = false;
|
2023-12-20 23:02:54 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct AskBoostEmojiStatus {
|
|
|
|
int requiredLevel = 0;
|
2024-02-08 21:58:16 +04:00
|
|
|
bool group = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AskBoostEmojiPack {
|
|
|
|
int requiredLevel = 0;
|
2023-12-20 23:02:54 -04:00
|
|
|
};
|
|
|
|
|
2023-11-14 14:35:57 +04:00
|
|
|
struct AskBoostCustomReactions {
|
|
|
|
int count = 0;
|
|
|
|
};
|
|
|
|
|
2024-03-26 20:41:07 +03:00
|
|
|
struct AskBoostCpm {
|
|
|
|
int requiredLevel = 0;
|
|
|
|
};
|
|
|
|
|
2025-01-10 16:13:31 +04:00
|
|
|
struct AskBoostWearCollectible {
|
|
|
|
int requiredLevel = 0;
|
|
|
|
};
|
|
|
|
|
2023-11-14 14:35:57 +04:00
|
|
|
struct AskBoostReason {
|
|
|
|
std::variant<
|
|
|
|
AskBoostChannelColor,
|
2025-04-24 13:54:07 +04:00
|
|
|
AskBoostAutotranslate,
|
2023-12-20 23:02:54 -04:00
|
|
|
AskBoostWallpaper,
|
|
|
|
AskBoostEmojiStatus,
|
2024-02-08 21:58:16 +04:00
|
|
|
AskBoostEmojiPack,
|
2024-03-26 20:41:07 +03:00
|
|
|
AskBoostCustomReactions,
|
2025-01-10 16:13:31 +04:00
|
|
|
AskBoostCpm,
|
|
|
|
AskBoostWearCollectible> data;
|
2023-11-14 14:35:57 +04:00
|
|
|
};
|
|
|
|
|
2023-10-27 17:49:37 +04:00
|
|
|
struct AskBoostBoxData {
|
|
|
|
QString link;
|
|
|
|
BoostCounters boost;
|
2025-04-24 13:54:07 +04:00
|
|
|
BoostFeatures features;
|
2023-11-14 14:35:57 +04:00
|
|
|
AskBoostReason reason;
|
2025-04-24 13:54:07 +04:00
|
|
|
bool group = false;
|
2023-10-27 17:49:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
void AskBoostBox(
|
|
|
|
not_null<GenericBox*> box,
|
|
|
|
AskBoostBoxData data,
|
|
|
|
Fn<void()> openStatistics,
|
|
|
|
Fn<void()> startGiveaway);
|
|
|
|
|
|
|
|
[[nodiscard]] object_ptr<RpWidget> MakeLinkLabel(
|
|
|
|
not_null<QWidget*> parent,
|
|
|
|
rpl::producer<QString> text,
|
|
|
|
rpl::producer<QString> link,
|
|
|
|
std::shared_ptr<Show> show,
|
|
|
|
object_ptr<RpWidget> right);
|
|
|
|
|
2023-10-12 00:46:40 +03:00
|
|
|
void FillBoostLimit(
|
|
|
|
rpl::producer<> showFinished,
|
|
|
|
not_null<VerticalLayout*> container,
|
2023-11-07 17:58:20 +04:00
|
|
|
rpl::producer<BoostCounters> data,
|
2023-10-21 00:20:59 +03:00
|
|
|
style::margins limitLinePadding);
|
2023-10-12 00:46:40 +03:00
|
|
|
|
2024-08-06 16:08:55 +02:00
|
|
|
[[nodiscard]] object_ptr<Ui::FlatLabel> MakeBoostFeaturesBadge(
|
|
|
|
not_null<QWidget*> parent,
|
|
|
|
rpl::producer<QString> text,
|
|
|
|
Fn<QBrush(QRect)> bg);
|
|
|
|
|
2023-09-12 21:00:39 +04:00
|
|
|
} // namespace Ui
|