2015-05-19 15:46:45 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2015-05-19 15:46:45 +00:00
|
|
|
|
2018-01-03 10:23:14 +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"
|
2018-11-21 18:14:48 +00:00
|
|
|
#include "base/timer.h"
|
2020-06-08 17:24:36 +00:00
|
|
|
#include "data/stickers/data_stickers.h"
|
2015-05-19 15:46:45 +00:00
|
|
|
|
2019-06-24 15:09:37 +00:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
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
|
|
|
|
|
2023-05-02 09:33:19 +00:00
|
|
|
namespace SendMenu {
|
|
|
|
enum class Type;
|
|
|
|
} // namespace SendMenu
|
|
|
|
|
|
|
|
namespace ChatHelpers {
|
|
|
|
struct FileChosen;
|
|
|
|
class Show;
|
|
|
|
} // namespace ChatHelpers
|
|
|
|
|
2022-08-02 13:47:53 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-06-11 16:09:46 +00:00
|
|
|
class StickerSetBox final : public Ui::BoxContent {
|
2015-05-19 15:46:45 +00:00
|
|
|
public:
|
2019-06-24 15:09:37 +00:00
|
|
|
StickerSetBox(
|
|
|
|
QWidget*,
|
2023-05-02 09:33:19 +00:00
|
|
|
std::shared_ptr<ChatHelpers::Show> show,
|
2022-07-22 11:39:28 +00:00
|
|
|
const StickerSetIdentifier &set,
|
|
|
|
Data::StickersType type);
|
|
|
|
StickerSetBox(
|
|
|
|
QWidget*,
|
2023-05-02 09:33:19 +00:00
|
|
|
std::shared_ptr<ChatHelpers::Show> show,
|
2022-07-22 11:39:28 +00:00
|
|
|
not_null<Data::StickersSet*> set);
|
2016-10-20 16:32:15 +00:00
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
static QPointer<Ui::BoxContent> Show(
|
2023-05-02 09:33:19 +00:00
|
|
|
std::shared_ptr<ChatHelpers::Show> show,
|
2019-06-24 15:09:37 +00:00
|
|
|
not_null<DocumentData*> document);
|
2018-11-26 11:55:02 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
2016-10-20 16:32:15 +00:00
|
|
|
private:
|
2021-06-17 07:06:17 +00:00
|
|
|
enum class Error {
|
|
|
|
NotFound,
|
|
|
|
};
|
|
|
|
|
2018-11-21 18:14:48 +00:00
|
|
|
void updateTitleAndButtons();
|
2016-12-13 17:07:56 +00:00
|
|
|
void updateButtons();
|
2018-11-21 18:14:48 +00:00
|
|
|
void addStickers();
|
2020-08-31 13:55:47 +00:00
|
|
|
void copyStickersLink();
|
2021-06-17 07:06:17 +00:00
|
|
|
void handleError(Error error);
|
2016-12-13 17:07:56 +00:00
|
|
|
|
2023-05-02 09:33:19 +00:00
|
|
|
const std::shared_ptr<ChatHelpers::Show> _show;
|
|
|
|
const not_null<Main::Session*> _session;
|
2021-07-08 16:42:57 +00:00
|
|
|
const StickerSetIdentifier _set;
|
2022-07-22 11:39:28 +00:00
|
|
|
const Data::StickersType _type;
|
2016-11-18 13:34:58 +00:00
|
|
|
|
2016-10-20 16:32:15 +00:00
|
|
|
class Inner;
|
2016-12-13 17:07:56 +00:00
|
|
|
QPointer<Inner> _inner;
|
|
|
|
|
2016-10-20 16:32:15 +00:00
|
|
|
};
|