mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Removed virtual type getters in mtpFileLoader.
This commit is contained in:
parent
f48d6dc464
commit
0838d21a05
@ -1690,8 +1690,8 @@ void MainWidget::playerHeightUpdated() {
|
||||
}
|
||||
|
||||
void MainWidget::documentLoadProgress(FileLoader *loader) {
|
||||
if (auto mtpLoader = loader ? loader->mtpLoader() : nullptr) {
|
||||
documentLoadProgress(App::document(mtpLoader->objId()));
|
||||
if (auto documentId = loader ? loader->objId() : 0) {
|
||||
documentLoadProgress(App::document(documentId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1715,12 +1715,12 @@ void MainWidget::documentLoadProgress(DocumentData *document) {
|
||||
}
|
||||
|
||||
void MainWidget::documentLoadFailed(FileLoader *loader, bool started) {
|
||||
mtpFileLoader *l = loader ? loader->mtpLoader() : 0;
|
||||
if (!l) return;
|
||||
auto documentId = loader ? loader->objId() : 0;
|
||||
if (!documentId) return;
|
||||
|
||||
auto document = App::document(l->objId());
|
||||
auto document = App::document(documentId);
|
||||
if (started) {
|
||||
auto failedFileName = l->fileName();
|
||||
auto failedFileName = loader->fileName();
|
||||
Ui::show(Box<ConfirmBox>(lang(lng_download_finish_failed), base::lambda_guarded(this, [this, document, failedFileName] {
|
||||
Ui::hideLayer();
|
||||
if (document) document->save(failedFileName);
|
||||
|
@ -113,7 +113,6 @@ class FileLoader : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
FileLoader(const QString &toFile, int32 size, LocationType locationType, LoadToCacheSetting, LoadFromCloudSetting fromCloud, bool autoLoading);
|
||||
bool done() const {
|
||||
return _complete;
|
||||
@ -124,6 +123,9 @@ public:
|
||||
const QByteArray &bytes() const {
|
||||
return _data;
|
||||
}
|
||||
virtual uint64 objId() const {
|
||||
return 0;
|
||||
}
|
||||
QByteArray imageFormat(const QSize &shrinkBox = QSize()) const;
|
||||
QPixmap imagePixmap(const QSize &shrinkBox = QSize()) const;
|
||||
QString fileName() const {
|
||||
@ -156,18 +158,6 @@ public:
|
||||
return _autoLoading;
|
||||
}
|
||||
|
||||
virtual mtpFileLoader *mtpLoader() {
|
||||
return 0;
|
||||
}
|
||||
virtual const mtpFileLoader *mtpLoader() const {
|
||||
return 0;
|
||||
}
|
||||
virtual webFileLoader *webLoader() {
|
||||
return 0;
|
||||
}
|
||||
virtual const webFileLoader *webLoader() const {
|
||||
return 0;
|
||||
}
|
||||
virtual void stop() {
|
||||
}
|
||||
virtual ~FileLoader();
|
||||
@ -175,7 +165,6 @@ public:
|
||||
void localLoaded(const StorageImageSaved &result, const QByteArray &imageFormat = QByteArray(), const QPixmap &imagePixmap = QPixmap());
|
||||
|
||||
signals:
|
||||
|
||||
void progress(FileLoader *loader);
|
||||
void failed(FileLoader *loader, bool started);
|
||||
|
||||
@ -220,9 +209,6 @@ protected:
|
||||
mutable QByteArray _imageFormat;
|
||||
mutable QPixmap _imagePixmap;
|
||||
|
||||
private:
|
||||
void deleteLater();
|
||||
|
||||
};
|
||||
|
||||
class StorageImageLocation;
|
||||
@ -233,33 +219,26 @@ public:
|
||||
mtpFileLoader(const StorageImageLocation *location, int32 size, LoadFromCloudSetting fromCloud, bool autoLoading);
|
||||
mtpFileLoader(int32 dc, const uint64 &id, const uint64 &access, int32 version, LocationType type, const QString &toFile, int32 size, LoadToCacheSetting toCache, LoadFromCloudSetting fromCloud, bool autoLoading);
|
||||
|
||||
virtual int32 currentOffset(bool includeSkipped = false) const;
|
||||
int32 currentOffset(bool includeSkipped = false) const override;
|
||||
|
||||
uint64 objId() const {
|
||||
uint64 objId() const override {
|
||||
return _id;
|
||||
}
|
||||
|
||||
virtual mtpFileLoader *mtpLoader() {
|
||||
return this;
|
||||
}
|
||||
virtual const mtpFileLoader *mtpLoader() const {
|
||||
return this;
|
||||
}
|
||||
|
||||
virtual void stop() {
|
||||
void stop() override {
|
||||
rpcClear();
|
||||
}
|
||||
|
||||
~mtpFileLoader();
|
||||
|
||||
protected:
|
||||
virtual bool tryLoadLocal();
|
||||
virtual void cancelRequests();
|
||||
bool tryLoadLocal() override;
|
||||
void cancelRequests() override;
|
||||
|
||||
typedef QMap<mtpRequestId, int32> Requests;
|
||||
Requests _requests;
|
||||
|
||||
virtual bool loadPart();
|
||||
bool loadPart() override;
|
||||
void partLoaded(int32 offset, const MTPupload_File &result, mtpRequestId req);
|
||||
bool partFailed(const RPCError &error);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user