2015-05-19 18:46:45 +03:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2015-05-19 18:46:45 +03:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2015-05-19 18:46:45 +03:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2023-11-15 03:52:41 +03:00
|
|
|
#include "ui/layers/box_content.h"
|
2018-11-21 22:14:48 +04:00
|
|
|
#include "base/timer.h"
|
2020-06-08 21:24:36 +04:00
|
|
|
#include "data/stickers/data_stickers.h"
|
2024-09-24 21:09:05 +04:00
|
|
|
#include "ui/rect_part.h"
|
2015-05-19 18:46:45 +03:00
|
|
|
|
2019-06-24 17:09:37 +02:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
2016-10-12 22:34:25 +03:00
|
|
|
namespace Ui {
|
|
|
|
class PlainShadow;
|
|
|
|
} // namespace Ui
|
2016-07-15 18:58:52 +03:00
|
|
|
|
2022-07-22 14:39:28 +03:00
|
|
|
namespace Data {
|
|
|
|
class StickersSet;
|
|
|
|
} // namespace Data
|
|
|
|
|
2023-05-02 13:33:19 +04:00
|
|
|
namespace ChatHelpers {
|
|
|
|
struct FileChosen;
|
|
|
|
class Show;
|
|
|
|
} // namespace ChatHelpers
|
|
|
|
|
2022-08-02 16:47:53 +03:00
|
|
|
class StickerPremiumMark final {
|
|
|
|
public:
|
2024-05-14 12:16:39 +04:00
|
|
|
StickerPremiumMark(
|
|
|
|
not_null<Main::Session*> session,
|
2024-09-24 21:09:05 +04:00
|
|
|
const style::icon &lockIcon,
|
|
|
|
RectPart part = RectPart::Bottom);
|
2022-08-02 16:47:53 +03:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2024-05-14 12:16:39 +04:00
|
|
|
const style::icon &_lockIcon;
|
2022-08-02 16:47:53 +03:00
|
|
|
QImage _lockGray;
|
|
|
|
QImage _star;
|
2024-09-24 21:09:05 +04:00
|
|
|
RectPart _part = RectPart::Bottom;
|
2022-08-02 16:47:53 +03:00
|
|
|
bool _premium = false;
|
|
|
|
|
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-06-11 20:09:46 +04:00
|
|
|
class StickerSetBox final : public Ui::BoxContent {
|
2015-05-19 18:46:45 +03:00
|
|
|
public:
|
2019-06-24 17:09:37 +02:00
|
|
|
StickerSetBox(
|
|
|
|
QWidget*,
|
2023-05-02 13:33:19 +04:00
|
|
|
std::shared_ptr<ChatHelpers::Show> show,
|
2022-07-22 14:39:28 +03:00
|
|
|
const StickerSetIdentifier &set,
|
|
|
|
Data::StickersType type);
|
|
|
|
StickerSetBox(
|
|
|
|
QWidget*,
|
2023-05-02 13:33:19 +04:00
|
|
|
std::shared_ptr<ChatHelpers::Show> show,
|
2022-07-22 14:39:28 +03:00
|
|
|
not_null<Data::StickersSet*> set);
|
2016-10-20 19:32:15 +03:00
|
|
|
|
2025-07-18 10:07:39 +04:00
|
|
|
static base::weak_qptr<Ui::BoxContent> Show(
|
2023-05-02 13:33:19 +04:00
|
|
|
std::shared_ptr<ChatHelpers::Show> show,
|
2019-06-24 17:09:37 +02:00
|
|
|
not_null<DocumentData*> document);
|
2018-11-26 15:55:02 +04:00
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
2016-10-20 19:32:15 +03:00
|
|
|
private:
|
2021-06-17 11:06:17 +04:00
|
|
|
enum class Error {
|
|
|
|
NotFound,
|
|
|
|
};
|
|
|
|
|
2018-11-21 22:14:48 +04:00
|
|
|
void updateTitleAndButtons();
|
2016-12-13 20:07:56 +03:00
|
|
|
void updateButtons();
|
2018-11-21 22:14:48 +04:00
|
|
|
void addStickers();
|
2020-08-31 16:55:47 +03:00
|
|
|
void copyStickersLink();
|
2021-06-17 11:06:17 +04:00
|
|
|
void handleError(Error error);
|
2016-12-13 20:07:56 +03:00
|
|
|
|
2023-05-02 13:33:19 +04:00
|
|
|
const std::shared_ptr<ChatHelpers::Show> _show;
|
|
|
|
const not_null<Main::Session*> _session;
|
2021-07-08 19:42:57 +03:00
|
|
|
const StickerSetIdentifier _set;
|
2022-07-22 14:39:28 +03:00
|
|
|
const Data::StickersType _type;
|
2016-11-18 16:34:58 +03:00
|
|
|
|
2016-10-20 19:32:15 +03:00
|
|
|
class Inner;
|
2016-12-13 20:07:56 +03:00
|
|
|
QPointer<Inner> _inner;
|
|
|
|
|
2016-10-20 19:32:15 +03:00
|
|
|
};
|