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

Remove old download priority arguments.

This commit is contained in:
John Preston
2019-04-12 15:52:39 +04:00
parent b2895a39ed
commit eb438e35ee
14 changed files with 188 additions and 292 deletions

View File

@@ -913,18 +913,15 @@ void Image::automaticLoad(
}
}
void Image::load(Data::FileOrigin origin, bool loadFirst, bool prior) {
void Image::load(Data::FileOrigin origin) {
if (!loaded()) {
_source->load(origin, loadFirst, prior);
_source->load(origin);
}
}
void Image::loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
void Image::loadEvenCancelled(Data::FileOrigin origin) {
if (!loaded()) {
_source->loadEvenCancelled(origin, loadFirst, prior);
_source->loadEvenCancelled(origin);
}
}

View File

@@ -55,14 +55,8 @@ public:
Source &operator=(Source &&other) = delete;
virtual ~Source() = default;
virtual void load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) = 0;
virtual void loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) = 0;
virtual void load(Data::FileOrigin origin) = 0;
virtual void loadEvenCancelled(Data::FileOrigin origin) = 0;
virtual QImage takeLoaded() = 0;
virtual void unload() = 0;
@@ -211,14 +205,8 @@ public:
void setInformation(int size, int width, int height) {
_source->setInformation(size, width, height);
}
void load(
Data::FileOrigin origin,
bool loadFirst = false,
bool prior = true);
void loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst = false,
bool prior = true);
void load(Data::FileOrigin origin);
void loadEvenCancelled(Data::FileOrigin origin);
const StorageImageLocation &location() const {
return _source->location();
}

View File

@@ -24,24 +24,18 @@ ImageSource::ImageSource(QImage &&data, const QByteArray &format)
, _height(_data.height()) {
}
void ImageSource::load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
void ImageSource::load(Data::FileOrigin origin) {
if (_data.isNull() && !_bytes.isEmpty()) {
_data = App::readImage(_bytes, &_format, false);
}
}
void ImageSource::loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
load(origin, loadFirst, prior);
void ImageSource::loadEvenCancelled(Data::FileOrigin origin) {
load(origin);
}
QImage ImageSource::takeLoaded() {
load({}, false, false);
load({});
return _data;
}
@@ -60,8 +54,8 @@ void ImageSource::unload() {
}
void ImageSource::automaticLoad(
Data::FileOrigin origin,
const HistoryItem *item) {
Data::FileOrigin origin,
const HistoryItem *item) {
}
void ImageSource::automaticLoadSettingsChanged() {
@@ -156,10 +150,7 @@ LocalFileSource::LocalFileSource(
, _height(_data.height()) {
}
void LocalFileSource::load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
void LocalFileSource::load(Data::FileOrigin origin) {
if (!_data.isNull()) {
return;
}
@@ -179,11 +170,8 @@ void LocalFileSource::load(
_height = std::max(_data.height(), 1);
}
void LocalFileSource::loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
load(origin, loadFirst, prior);
void LocalFileSource::loadEvenCancelled(Data::FileOrigin origin) {
load(origin);
}
QImage LocalFileSource::takeLoaded() {
@@ -195,8 +183,8 @@ void LocalFileSource::unload() {
}
void LocalFileSource::automaticLoad(
Data::FileOrigin origin,
const HistoryItem *item) {
Data::FileOrigin origin,
const HistoryItem *item) {
}
void LocalFileSource::automaticLoadSettingsChanged() {
@@ -245,7 +233,7 @@ bool LocalFileSource::isDelayedStorageImage() const {
void LocalFileSource::setImageBytes(const QByteArray &bytes) {
_bytes = bytes;
load({}, false, true);
load({});
}
int LocalFileSource::width() {
@@ -273,7 +261,7 @@ void LocalFileSource::setInformation(int size, int width, int height) {
void LocalFileSource::ensureDimensionsKnown() {
if (!_width || !_height) {
load({}, false, false);
load({});
}
}
@@ -381,15 +369,12 @@ void RemoteSource::automaticLoadSettingsChanged() {
}
}
void RemoteSource::load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
void RemoteSource::load(Data::FileOrigin origin) {
if (!_loader) {
_loader = createLoader(origin, LoadFromCloudOrLocal, false);
}
if (loaderValid()) {
_loader->start(loadFirst, prior);
_loader->start();
}
}
@@ -397,14 +382,11 @@ bool RemoteSource::cancelled() const {
return (_loader == CancelledFileLoader);
}
void RemoteSource::loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
void RemoteSource::loadEvenCancelled(Data::FileOrigin origin) {
if (cancelled()) {
_loader = nullptr;
}
return load(origin, loadFirst, prior);
return load(origin);
}
bool RemoteSource::displayLoading() {
@@ -656,7 +638,7 @@ void DelayedStorageSource::performDelayedLoad(Data::FileOrigin origin) {
return;
}
if (base::take(_loadFromCloud)) {
load(origin, false, true);
load(origin);
} else {
loadLocal();
}
@@ -689,23 +671,17 @@ void DelayedStorageSource::automaticLoadSettingsChanged() {
StorageSource::automaticLoadSettingsChanged();
}
void DelayedStorageSource::load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
void DelayedStorageSource::load(Data::FileOrigin origin) {
if (_location.valid()) {
StorageSource::load(origin, loadFirst, prior);
StorageSource::load(origin);
} else {
_loadRequested = _loadFromCloud = true;
}
}
void DelayedStorageSource::loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) {
void DelayedStorageSource::loadEvenCancelled(Data::FileOrigin origin) {
_loadCancelled = false;
StorageSource::loadEvenCancelled(origin, loadFirst, prior);
StorageSource::loadEvenCancelled(origin);
}
bool DelayedStorageSource::displayLoading() {

View File

@@ -15,14 +15,8 @@ class ImageSource : public Source {
public:
ImageSource(QImage &&data, const QByteArray &format);
void load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) override;
void loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) override;
void load(Data::FileOrigin origin) override;
void loadEvenCancelled(Data::FileOrigin origin) override;
QImage takeLoaded() override;
void unload() override;
@@ -70,14 +64,8 @@ public:
const QByteArray &format = QByteArray(),
QImage &&data = QImage());
void load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) override;
void loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) override;
void load(Data::FileOrigin origin) override;
void loadEvenCancelled(Data::FileOrigin origin) override;
QImage takeLoaded() override;
void unload() override;
@@ -122,14 +110,8 @@ private:
class RemoteSource : public Source {
public:
void load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) override;
void loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) override;
void load(Data::FileOrigin origin) override;
void loadEvenCancelled(Data::FileOrigin origin) override;
QImage takeLoaded() override;
void unload() override;
@@ -263,14 +245,8 @@ public:
DelayedStorageSource();
DelayedStorageSource(int width, int height);
void load(
Data::FileOrigin origin,
bool loadFirst,
bool prior) override;
void loadEvenCancelled(
Data::FileOrigin origin,
bool loadFirst,
bool prior) override;
void load(Data::FileOrigin origin) override;
void loadEvenCancelled(Data::FileOrigin origin) override;
void setDelayedStorageLocation(
const StorageImageLocation &location) override;

View File

@@ -691,7 +691,7 @@ void UserpicButton::processPeerPhoto() {
_waiting = !_peer->userpicLoaded();
if (_waiting) {
_peer->loadUserpic(true);
_peer->loadUserpic();
}
if (_role == Role::OpenPhoto) {
if (_peer->userpicPhotoUnknown()) {