mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Revert "Make it repaint after downloading the image"
This reverts commit a56d6b084c
.
This commit is contained in:
parent
04c14a7792
commit
02fc3662d7
|
@ -24,7 +24,6 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
// Duration between each check of every Image instance
|
// Duration between each check of every Image instance
|
||||||
const auto IMAGE_POOL_CLEANUP_INTERVAL = std::chrono::minutes(1);
|
const auto IMAGE_POOL_CLEANUP_INTERVAL = std::chrono::minutes(1);
|
||||||
|
@ -428,7 +427,7 @@ bool Image::loaded() const
|
||||||
return this->frames_->current().has_value();
|
return this->frames_->current().has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QPixmap> Image::pixmapOrLoad(std::function<void()> cb)
|
std::optional<QPixmap> Image::pixmapOrLoad() const
|
||||||
{
|
{
|
||||||
assertInGuiThread();
|
assertInGuiThread();
|
||||||
|
|
||||||
|
@ -437,10 +436,6 @@ std::optional<QPixmap> Image::pixmapOrLoad(std::function<void()> cb)
|
||||||
// See src/messages/layouts/MessageLayoutElement.cpp ImageLayoutElement::paint, for example.
|
// See src/messages/layouts/MessageLayoutElement.cpp ImageLayoutElement::paint, for example.
|
||||||
this->lastUsed_ = std::chrono::steady_clock::now();
|
this->lastUsed_ = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
if (cb != nullptr)
|
|
||||||
{
|
|
||||||
this->finishedLoadingCb_ = std::move(cb);
|
|
||||||
}
|
|
||||||
this->load();
|
this->load();
|
||||||
|
|
||||||
return this->frames_->current();
|
return this->frames_->current();
|
||||||
|
@ -583,20 +578,6 @@ void Image::actuallyLoad()
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.finally([weak]() {
|
|
||||||
postToThread([weak]() {
|
|
||||||
auto shared = weak.lock();
|
|
||||||
if (!shared)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shared->finishedLoadingCb_ != nullptr)
|
|
||||||
{
|
|
||||||
shared->finishedLoadingCb_();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "common/Aliases.hpp"
|
#include "common/Aliases.hpp"
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
#include "common/network/NetworkResult.hpp"
|
|
||||||
|
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
#include <pajlada/signals/signal.hpp>
|
#include <pajlada/signals/signal.hpp>
|
||||||
|
@ -14,7 +13,6 @@
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <functional>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -83,7 +81,7 @@ public:
|
||||||
const Url &url() const;
|
const Url &url() const;
|
||||||
bool loaded() const;
|
bool loaded() const;
|
||||||
// either returns the current pixmap, or triggers loading it (lazy loading)
|
// either returns the current pixmap, or triggers loading it (lazy loading)
|
||||||
std::optional<QPixmap> pixmapOrLoad(std::function<void()> cb = nullptr);
|
std::optional<QPixmap> pixmapOrLoad() const;
|
||||||
void load() const;
|
void load() const;
|
||||||
qreal scale() const;
|
qreal scale() const;
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
@ -120,8 +118,6 @@ private:
|
||||||
// gui thread only
|
// gui thread only
|
||||||
std::unique_ptr<detail::Frames> frames_{};
|
std::unique_ptr<detail::Frames> frames_{};
|
||||||
|
|
||||||
std::function<void()> finishedLoadingCb_;
|
|
||||||
|
|
||||||
friend class ImageExpirationPool;
|
friend class ImageExpirationPool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue