2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-06 09:26:18 +00:00

Don't unload all media on switching between chats.

This commit is contained in:
John Preston
2018-10-23 16:57:43 +04:00
parent 959859f57c
commit 8e7117fa22
21 changed files with 61 additions and 83 deletions

View File

@@ -37,7 +37,7 @@ QImage ImageSource::takeLoaded() {
return _data;
}
void ImageSource::forget() {
void ImageSource::unload() {
}
void ImageSource::automaticLoad(
@@ -161,7 +161,7 @@ QImage LocalFileSource::takeLoaded() {
return std::move(_data);
}
void LocalFileSource::forget() {
void LocalFileSource::unload() {
_data = QImage();
}
@@ -361,10 +361,6 @@ void RemoteSource::loadEvenCancelled(
return load(origin, loadFirst, prior);
}
RemoteSource::~RemoteSource() {
forget();
}
bool RemoteSource::displayLoading() {
return loaderValid()
&& (!_loader->loadingLocal() || !_loader->autoLoading());
@@ -380,7 +376,7 @@ void RemoteSource::cancel() {
std::unique_ptr<FileLoader>(loader));
}
void RemoteSource::forget() {
void RemoteSource::unload() {
if (loaderValid()) {
destroyLoaderDelayed();
}
@@ -394,6 +390,10 @@ int RemoteSource::loadOffset() {
return loaderValid() ? _loader->currentOffset() : 0;
}
RemoteSource::~RemoteSource() {
unload();
}
const StorageImageLocation &RemoteSource::location() {
return StorageImageLocation::Null;
}