2017-09-26 11:49:16 +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.
|
2017-09-26 11:49:16 +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
|
2017-09-26 11:49:16 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "data/data_photo.h"
|
|
|
|
#include "data/data_document.h"
|
|
|
|
|
2020-06-05 09:03:45 +00:00
|
|
|
class ChannelData;
|
|
|
|
|
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2018-10-31 10:11:01 +00:00
|
|
|
enum class WebPageType {
|
|
|
|
Photo,
|
|
|
|
Video,
|
|
|
|
Profile,
|
2019-01-16 12:25:29 +00:00
|
|
|
WallPaper,
|
2019-09-09 11:56:05 +00:00
|
|
|
Theme,
|
2018-10-31 10:11:01 +00:00
|
|
|
Article,
|
|
|
|
ArticleWithIV,
|
2017-09-26 11:49:16 +00:00
|
|
|
};
|
|
|
|
|
2018-10-31 10:11:01 +00:00
|
|
|
WebPageType ParseWebPageType(const MTPDwebPage &type);
|
2017-09-26 11:49:16 +00:00
|
|
|
|
2018-10-24 11:52:31 +00:00
|
|
|
struct WebPageCollage {
|
|
|
|
using Item = base::variant<PhotoData*, DocumentData*>;
|
|
|
|
|
|
|
|
WebPageCollage() = default;
|
|
|
|
explicit WebPageCollage(const MTPDwebPage &data);
|
|
|
|
|
|
|
|
std::vector<Item> items;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-09-26 11:49:16 +00:00
|
|
|
struct WebPageData {
|
|
|
|
WebPageData(const WebPageId &id) : id(id) {
|
|
|
|
}
|
|
|
|
|
2017-12-31 09:39:21 +00:00
|
|
|
bool applyChanges(
|
2018-10-31 10:11:01 +00:00
|
|
|
WebPageType newType,
|
2017-12-31 09:39:21 +00:00
|
|
|
const QString &newUrl,
|
|
|
|
const QString &newDisplayUrl,
|
|
|
|
const QString &newSiteName,
|
|
|
|
const QString &newTitle,
|
|
|
|
const TextWithEntities &newDescription,
|
|
|
|
PhotoData *newPhoto,
|
|
|
|
DocumentData *newDocument,
|
2018-10-24 11:52:31 +00:00
|
|
|
WebPageCollage &&newCollage,
|
2017-12-31 09:39:21 +00:00
|
|
|
int newDuration,
|
|
|
|
const QString &newAuthor,
|
|
|
|
int newPendingTill);
|
|
|
|
|
2020-06-05 09:03:45 +00:00
|
|
|
static void ApplyChanges(
|
|
|
|
not_null<Main::Session*> session,
|
|
|
|
ChannelData *channel,
|
|
|
|
const MTPmessages_Messages &result);
|
|
|
|
|
2017-09-26 11:49:16 +00:00
|
|
|
WebPageId id = 0;
|
2018-10-31 10:11:01 +00:00
|
|
|
WebPageType type = WebPageType::Article;
|
2017-09-26 11:49:16 +00:00
|
|
|
QString url;
|
|
|
|
QString displayUrl;
|
|
|
|
QString siteName;
|
|
|
|
QString title;
|
|
|
|
TextWithEntities description;
|
2017-12-31 09:39:21 +00:00
|
|
|
int duration = 0;
|
2017-09-26 11:49:16 +00:00
|
|
|
QString author;
|
|
|
|
PhotoData *photo = nullptr;
|
|
|
|
DocumentData *document = nullptr;
|
2018-10-24 11:52:31 +00:00
|
|
|
WebPageCollage collage;
|
2017-12-31 09:39:21 +00:00
|
|
|
int pendingTill = 0;
|
|
|
|
int version = 0;
|
2017-09-26 11:49:16 +00:00
|
|
|
|
2018-10-25 09:24:45 +00:00
|
|
|
private:
|
|
|
|
void replaceDocumentGoodThumbnail();
|
|
|
|
|
2017-09-26 11:49:16 +00:00
|
|
|
};
|