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_types.h"
|
|
|
|
|
|
|
|
class PhotoData {
|
|
|
|
public:
|
|
|
|
PhotoData(
|
|
|
|
const PhotoId &id,
|
|
|
|
const uint64 &access = 0,
|
|
|
|
int32 date = 0,
|
|
|
|
const ImagePtr &thumb = ImagePtr(),
|
|
|
|
const ImagePtr &medium = ImagePtr(),
|
|
|
|
const ImagePtr &full = ImagePtr());
|
|
|
|
|
|
|
|
void automaticLoad(const HistoryItem *item);
|
|
|
|
void automaticLoadSettingsChanged();
|
|
|
|
|
|
|
|
void download();
|
|
|
|
bool loaded() const;
|
|
|
|
bool loading() const;
|
|
|
|
bool displayLoading() const;
|
|
|
|
void cancel();
|
|
|
|
float64 progress() const;
|
|
|
|
int32 loadOffset() const;
|
|
|
|
bool uploading() const;
|
|
|
|
|
2017-12-25 14:17:00 +00:00
|
|
|
void setWaitingForAlbum();
|
|
|
|
bool waitingForAlbum() const;
|
|
|
|
|
2017-09-26 11:49:16 +00:00
|
|
|
void forget();
|
|
|
|
ImagePtr makeReplyPreview();
|
|
|
|
|
|
|
|
PhotoId id;
|
|
|
|
uint64 access;
|
|
|
|
int32 date;
|
|
|
|
ImagePtr thumb, replyPreview;
|
|
|
|
ImagePtr medium;
|
|
|
|
ImagePtr full;
|
|
|
|
|
|
|
|
PeerData *peer = nullptr; // for chat and channel photos connection
|
|
|
|
// geo, caption
|
|
|
|
|
2017-12-25 14:17:00 +00:00
|
|
|
std::unique_ptr<Data::UploadState> uploadingData;
|
2017-09-26 11:49:16 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-12-18 13:13:41 +00:00
|
|
|
class PhotoClickHandler : public FileClickHandler {
|
2017-09-26 11:49:16 +00:00
|
|
|
public:
|
|
|
|
PhotoClickHandler(
|
|
|
|
not_null<PhotoData*> photo,
|
2017-12-15 16:25:47 +00:00
|
|
|
FullMsgId context = FullMsgId(),
|
2017-09-26 11:49:16 +00:00
|
|
|
PeerData *peer = nullptr)
|
2017-12-18 13:13:41 +00:00
|
|
|
: FileClickHandler(context)
|
|
|
|
, _photo(photo)
|
2017-12-15 16:25:47 +00:00
|
|
|
, _peer(peer) {
|
2017-09-26 11:49:16 +00:00
|
|
|
}
|
|
|
|
not_null<PhotoData*> photo() const {
|
|
|
|
return _photo;
|
|
|
|
}
|
|
|
|
PeerData *peer() const {
|
|
|
|
return _peer;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
not_null<PhotoData*> _photo;
|
2017-12-15 16:25:47 +00:00
|
|
|
PeerData *_peer = nullptr;
|
2017-09-26 11:49:16 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class PhotoOpenClickHandler : public PhotoClickHandler {
|
|
|
|
public:
|
|
|
|
using PhotoClickHandler::PhotoClickHandler;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void onClickImpl() const override;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class PhotoSaveClickHandler : public PhotoClickHandler {
|
|
|
|
public:
|
|
|
|
using PhotoClickHandler::PhotoClickHandler;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void onClickImpl() const override;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class PhotoCancelClickHandler : public PhotoClickHandler {
|
|
|
|
public:
|
|
|
|
using PhotoClickHandler::PhotoClickHandler;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void onClickImpl() const override;
|
|
|
|
|
|
|
|
};
|