mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-21 00:23:56 +08:00
Slightly improved photo editor. (Combined commit.)
This commit is contained in:
@@ -1270,21 +1270,14 @@ void DocumentData::save(
|
||||
status = FileReady;
|
||||
auto reader = owner().streaming().sharedReader(this, origin, true);
|
||||
if (reader) {
|
||||
_loader = std::make_unique<Storage::StreamedFileDownloader>(
|
||||
&session(),
|
||||
id,
|
||||
_dc,
|
||||
origin,
|
||||
Data::DocumentCacheKey(_dc, id),
|
||||
mediaKey(),
|
||||
_loader = createStreamedDownloader(
|
||||
std::move(reader),
|
||||
origin,
|
||||
mediaKey(),
|
||||
toFile,
|
||||
size,
|
||||
locationType(),
|
||||
(saveToCache() ? LoadToCacheAsWell : LoadToFileOnly),
|
||||
fromCloud,
|
||||
autoLoading,
|
||||
cacheTag());
|
||||
autoLoading);
|
||||
} else if (hasWebLocation()) {
|
||||
_loader = std::make_unique<mtpFileLoader>(
|
||||
&session(),
|
||||
@@ -1655,6 +1648,32 @@ bool DocumentData::hasRemoteLocation() const {
|
||||
return (_dc != 0 && _access != 0);
|
||||
}
|
||||
|
||||
auto DocumentData::createStreamedDownloader(
|
||||
std::shared_ptr<Media::Streaming::Reader> reader,
|
||||
Data::FileOrigin origin,
|
||||
std::optional<MediaKey> fileLocationKey,
|
||||
const QString &toFile,
|
||||
LoadToCacheSetting toCache,
|
||||
LoadFromCloudSetting fromCloud,
|
||||
bool autoLoading) const
|
||||
-> std::unique_ptr<Storage::StreamedFileDownloader> {
|
||||
return std::make_unique<Storage::StreamedFileDownloader>(
|
||||
&session(),
|
||||
id,
|
||||
_dc,
|
||||
origin,
|
||||
Data::DocumentCacheKey(_dc, id),
|
||||
fileLocationKey,
|
||||
std::move(reader),
|
||||
toFile,
|
||||
size,
|
||||
locationType(),
|
||||
toCache,
|
||||
fromCloud,
|
||||
autoLoading,
|
||||
cacheTag());
|
||||
}
|
||||
|
||||
bool DocumentData::useStreamingLoader() const {
|
||||
if (size <= 0) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user