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"
|
|
|
|
|
2018-10-31 10:11:01 +00:00
|
|
|
enum class WebPageType {
|
|
|
|
Photo,
|
|
|
|
Video,
|
|
|
|
Profile,
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
};
|