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"
|
|
|
|
|
|
|
|
enum WebPageType {
|
|
|
|
WebPagePhoto,
|
|
|
|
WebPageVideo,
|
|
|
|
WebPageProfile,
|
|
|
|
WebPageArticle
|
|
|
|
};
|
|
|
|
|
|
|
|
inline WebPageType toWebPageType(const QString &type) {
|
|
|
|
if (type == qstr("photo")) return WebPagePhoto;
|
|
|
|
if (type == qstr("video")) return WebPageVideo;
|
|
|
|
if (type == qstr("profile")) return WebPageProfile;
|
|
|
|
return WebPageArticle;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct WebPageData {
|
|
|
|
WebPageData(const WebPageId &id) : id(id) {
|
|
|
|
}
|
|
|
|
WebPageData(
|
|
|
|
const WebPageId &id,
|
|
|
|
WebPageType type,
|
|
|
|
const QString &url,
|
|
|
|
const QString &displayUrl,
|
|
|
|
const QString &siteName,
|
|
|
|
const QString &title,
|
|
|
|
const TextWithEntities &description,
|
|
|
|
DocumentData *document,
|
|
|
|
PhotoData *photo,
|
2017-12-31 09:39:21 +00:00
|
|
|
int duration,
|
2017-09-26 11:49:16 +00:00
|
|
|
const QString &author,
|
2017-12-31 09:39:21 +00:00
|
|
|
int pendingTill)
|
2017-09-26 11:49:16 +00:00
|
|
|
: id(id)
|
|
|
|
, type(type)
|
|
|
|
, url(url)
|
|
|
|
, displayUrl(displayUrl)
|
|
|
|
, siteName(siteName)
|
|
|
|
, title(title)
|
|
|
|
, description(description)
|
|
|
|
, duration(duration)
|
|
|
|
, author(author)
|
|
|
|
, photo(photo)
|
|
|
|
, document(document)
|
|
|
|
, pendingTill(pendingTill) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void forget() {
|
|
|
|
if (document) document->forget();
|
|
|
|
if (photo) photo->forget();
|
|
|
|
}
|
|
|
|
|
2017-12-31 09:39:21 +00:00
|
|
|
bool applyChanges(
|
|
|
|
const QString &newType,
|
|
|
|
const QString &newUrl,
|
|
|
|
const QString &newDisplayUrl,
|
|
|
|
const QString &newSiteName,
|
|
|
|
const QString &newTitle,
|
|
|
|
const TextWithEntities &newDescription,
|
|
|
|
PhotoData *newPhoto,
|
|
|
|
DocumentData *newDocument,
|
|
|
|
int newDuration,
|
|
|
|
const QString &newAuthor,
|
|
|
|
int newPendingTill);
|
|
|
|
|
2017-09-26 11:49:16 +00:00
|
|
|
WebPageId id = 0;
|
|
|
|
WebPageType type = WebPageArticle;
|
|
|
|
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;
|
2017-12-31 09:39:21 +00:00
|
|
|
int pendingTill = 0;
|
|
|
|
int version = 0;
|
2017-09-26 11:49:16 +00:00
|
|
|
|
|
|
|
};
|