diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index d840de4e0..f39485d5f 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -24,7 +24,6 @@ #include #include #include -#include // Duration between each check of every Image instance const auto IMAGE_POOL_CLEANUP_INTERVAL = std::chrono::minutes(1); @@ -428,7 +427,7 @@ bool Image::loaded() const return this->frames_->current().has_value(); } -std::optional Image::pixmapOrLoad(std::function cb) +std::optional Image::pixmapOrLoad() const { assertInGuiThread(); @@ -437,10 +436,6 @@ std::optional Image::pixmapOrLoad(std::function cb) // See src/messages/layouts/MessageLayoutElement.cpp ImageLayoutElement::paint, for example. this->lastUsed_ = std::chrono::steady_clock::now(); - if (cb != nullptr) - { - this->finishedLoadingCb_ = std::move(cb); - } this->load(); return this->frames_->current(); @@ -583,20 +578,6 @@ void Image::actuallyLoad() return true; }) - .finally([weak]() { - postToThread([weak]() { - auto shared = weak.lock(); - if (!shared) - { - return; - } - - if (shared->finishedLoadingCb_ != nullptr) - { - shared->finishedLoadingCb_(); - } - }); - }) .execute(); } diff --git a/src/messages/Image.hpp b/src/messages/Image.hpp index fc3b84a5c..2eb0fcf04 100644 --- a/src/messages/Image.hpp +++ b/src/messages/Image.hpp @@ -2,7 +2,6 @@ #include "common/Aliases.hpp" #include "common/Common.hpp" -#include "common/network/NetworkResult.hpp" #include #include @@ -14,7 +13,6 @@ #include #include -#include #include #include #include @@ -83,7 +81,7 @@ public: const Url &url() const; bool loaded() const; // either returns the current pixmap, or triggers loading it (lazy loading) - std::optional pixmapOrLoad(std::function cb = nullptr); + std::optional pixmapOrLoad() const; void load() const; qreal scale() const; bool isEmpty() const; @@ -120,8 +118,6 @@ private: // gui thread only std::unique_ptr frames_{}; - std::function finishedLoadingCb_; - friend class ImageExpirationPool; };