2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-24 11:17:10 +00:00

93 lines
1.9 KiB
C
Raw Normal View History

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 {
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;
class VerticalLayout;
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.
int mine = 0;
friend inline constexpr bool operator==(
BoostCounters,
BoostCounters) = default;
2023-09-12 21:00:39 +04:00
};
struct BoostBoxData {
QString name;
BoostCounters boost;
2023-11-08 13:31:01 +04:00
bool allowMulti = false;
2023-09-12 21:00:39 +04:00
};
void BoostBox(
not_null<GenericBox*> box,
BoostBoxData data,
Fn<void(Fn<void(BoostCounters)>)> boost);
2023-09-12 21:00:39 +04:00
2023-11-08 13:31:01 +04:00
void BoostBoxAlready(not_null<GenericBox*> box);
void GiftForBoostsBox(
not_null<GenericBox*> box,
QString channel,
int receive,
bool again);
void GiftedNoBoostsBox(not_null<GenericBox*> box);
void PremiumForBoostsBox(not_null<GenericBox*> box, Fn<void()> buyPremium);
2023-11-14 14:35:57 +04:00
struct AskBoostChannelColor {
int requiredLevel = 0;
};
struct AskBoostCustomReactions {
int count = 0;
};
struct AskBoostReason {
std::variant<
AskBoostChannelColor,
AskBoostCustomReactions> data;
};
2023-10-27 17:49:37 +04:00
struct AskBoostBoxData {
QString link;
BoostCounters boost;
2023-11-14 14:35:57 +04:00
AskBoostReason reason;
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);
void FillBoostLimit(
rpl::producer<> showFinished,
not_null<VerticalLayout*> container,
rpl::producer<BoostCounters> data,
2023-10-21 00:20:59 +03:00
style::margins limitLinePadding);
2023-09-12 21:00:39 +04:00
} // namespace Ui