tdesktop/Telegram/SourceFiles/boxes/sticker_set_box.h

100 lines
1.9 KiB
C
Raw Normal View History

2015-05-19 15:46:45 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2015-05-19 15:46:45 +00:00
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
2015-05-19 15:46:45 +00:00
*/
#pragma once
2017-04-06 14:38:10 +00:00
#include "boxes/abstract_box.h"
#include "base/timer.h"
#include "data/stickers/data_stickers.h"
2015-05-19 15:46:45 +00:00
namespace Window {
class SessionController;
} // namespace Window
namespace Ui {
class PlainShadow;
} // namespace Ui
2016-07-15 15:58:52 +00:00
2022-07-22 11:39:28 +00:00
namespace Data {
class StickersSet;
} // namespace Data
namespace SendMenu {
enum class Type;
} // namespace SendMenu
namespace ChatHelpers {
struct FileChosen;
class Show;
} // namespace ChatHelpers
class StickerPremiumMark final {
public:
explicit StickerPremiumMark(not_null<Main::Session*> session);
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();
QImage _lockGray;
QImage _star;
bool _premium = false;
rpl::lifetime _lifetime;
};
class StickerSetBox final : public Ui::BoxContent {
2015-05-19 15:46:45 +00:00
public:
StickerSetBox(
QWidget*,
std::shared_ptr<ChatHelpers::Show> show,
2022-07-22 11:39:28 +00:00
const StickerSetIdentifier &set,
Data::StickersType type);
StickerSetBox(
QWidget*,
std::shared_ptr<ChatHelpers::Show> show,
2022-07-22 11:39:28 +00:00
not_null<Data::StickersSet*> set);
2019-09-18 11:19:05 +00:00
static QPointer<Ui::BoxContent> Show(
std::shared_ptr<ChatHelpers::Show> show,
not_null<DocumentData*> document);
protected:
void prepare() override;
void resizeEvent(QResizeEvent *e) override;
private:
2021-06-17 07:06:17 +00:00
enum class Error {
NotFound,
};
void updateTitleAndButtons();
void updateButtons();
void addStickers();
void copyStickersLink();
2021-06-17 07:06:17 +00:00
void handleError(Error error);
const std::shared_ptr<ChatHelpers::Show> _show;
const not_null<Main::Session*> _session;
const StickerSetIdentifier _set;
2022-07-22 11:39:28 +00:00
const Data::StickersType _type;
class Inner;
QPointer<Inner> _inner;
};