2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Move some calls from App namespace.

This commit is contained in:
John Preston
2019-01-18 16:27:37 +04:00
parent e7804d014d
commit 4111da1dd0
74 changed files with 896 additions and 852 deletions

View File

@@ -139,13 +139,16 @@ Uploader::Uploader() {
connect(&stopSessionsTimer, SIGNAL(timeout()), this, SLOT(stopSessions()));
}
void Uploader::uploadMedia(const FullMsgId &msgId, const SendMediaReady &media) {
void Uploader::uploadMedia(
const FullMsgId &msgId,
const SendMediaReady &media) {
if (media.type == SendMediaType::Photo) {
Auth().data().photo(media.photo, media.photoThumbs);
} else if (media.type == SendMediaType::File || media.type == SendMediaType::Audio) {
Auth().data().processPhoto(media.photo, media.photoThumbs);
} else if (media.type == SendMediaType::File
|| media.type == SendMediaType::Audio) {
const auto document = media.photoThumbs.isEmpty()
? Auth().data().document(media.document)
: Auth().data().document(
? Auth().data().processDocument(media.document)
: Auth().data().processDocument(
media.document,
base::duplicate(media.photoThumbs.begin().value()));
if (!media.data.isEmpty()) {
@@ -171,15 +174,20 @@ void Uploader::upload(
const FullMsgId &msgId,
const std::shared_ptr<FileLoadResult> &file) {
if (file->type == SendMediaType::Photo) {
auto photo = Auth().data().photo(file->photo, file->photoThumbs);
photo->uploadingData = std::make_unique<Data::UploadState>(file->partssize);
} else if (file->type == SendMediaType::File || file->type == SendMediaType::Audio) {
auto document = file->thumb.isNull()
? Auth().data().document(file->document)
: Auth().data().document(
const auto photo = Auth().data().processPhoto(
file->photo,
file->photoThumbs);
photo->uploadingData = std::make_unique<Data::UploadState>(
file->partssize);
} else if (file->type == SendMediaType::File
|| file->type == SendMediaType::Audio) {
const auto document = file->thumb.isNull()
? Auth().data().processDocument(file->document)
: Auth().data().processDocument(
file->document,
std::move(file->thumb));
document->uploadingData = std::make_unique<Data::UploadState>(document->size);
document->uploadingData = std::make_unique<Data::UploadState>(
document->size);
document->setGoodThumbnail(
std::move(file->goodThumbnail),
std::move(file->goodThumbnailBytes));

View File

@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "data/data_user.h"
#include "data/data_session.h"
#include "ui/image/image.h"
namespace Serialize {
@@ -154,10 +155,10 @@ PeerData *readPeer(int streamAppVersion, QDataStream &stream) {
streamAppVersion,
stream);
PeerData *result = App::peerLoaded(peerId);
PeerData *result = Auth().data().peerLoaded(peerId);
bool wasLoaded = (result != nullptr);
if (!wasLoaded) {
result = App::peer(peerId);
result = Auth().data().peer(peerId);
result->loadedStatus = PeerData::FullLoaded;
}
if (const auto user = result->asUser()) {

View File

@@ -80,7 +80,7 @@ struct UserPhotosKey {
return !(*this == other);
}
PeerId userId = 0;
UserId userId = 0;
PhotoId photoId = 0;
};