Files
tdesktop/Telegram/SourceFiles/boxes/sticker_set_box.h
allhaileris afb81b8278
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
init
2026-02-16 15:50:16 +03:00

102 lines
2.0 KiB
C++

/*
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/layers/box_content.h"
#include "base/timer.h"
#include "data/stickers/data_stickers.h"
#include "ui/rect_part.h"
namespace Window {
class SessionController;
} // namespace Window
namespace Ui {
class PlainShadow;
} // namespace Ui
namespace Data {
class StickersSet;
} // namespace Data
namespace ChatHelpers {
struct FileChosen;
class Show;
} // namespace ChatHelpers
class StickerPremiumMark final {
public:
StickerPremiumMark(
not_null<Main::Session*> session,
const style::icon &lockIcon,
RectPart part = RectPart::Bottom);
void paint(
QPainter &p,
const QImage &frame,
QImage &backCache,
QPoint position,
QSize singleSize,
int outerWidth);
private:
void validateLock(const QImage &frame, QImage &backCache);
void validateStar();
const style::icon &_lockIcon;
QImage _lockGray;
QImage _star;
RectPart _part = RectPart::Bottom;
bool _premium = false;
rpl::lifetime _lifetime;
};
class StickerSetBox final : public Ui::BoxContent {
public:
StickerSetBox(
QWidget*,
std::shared_ptr<ChatHelpers::Show> show,
const StickerSetIdentifier &set,
Data::StickersType type);
StickerSetBox(
QWidget*,
std::shared_ptr<ChatHelpers::Show> show,
not_null<Data::StickersSet*> set);
static base::weak_qptr<Ui::BoxContent> Show(
std::shared_ptr<ChatHelpers::Show> show,
not_null<DocumentData*> document);
protected:
void prepare() override;
void resizeEvent(QResizeEvent *e) override;
private:
enum class Error {
NotFound,
};
void updateTitleAndButtons();
void updateButtons();
void addStickers();
void copyStickersLink();
void handleError(Error error);
const std::shared_ptr<ChatHelpers::Show> _show;
const not_null<Main::Session*> _session;
const StickerSetIdentifier _set;
const Data::StickersType _type;
class Inner;
QPointer<Inner> _inner;
};