mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Use global threadpool
This commit is contained in:
parent
8edc46dc16
commit
1ea9dc469b
3 changed files with 7 additions and 18 deletions
|
@ -34,12 +34,12 @@ private:
|
|||
class BlurhashResponse : public QQuickImageResponse
|
||||
{
|
||||
public:
|
||||
BlurhashResponse(const QString &id, const QSize &requestedSize, QThreadPool *pool)
|
||||
BlurhashResponse(const QString &id, const QSize &requestedSize)
|
||||
{
|
||||
auto runnable = new BlurhashRunnable(id, requestedSize);
|
||||
connect(runnable, &BlurhashRunnable::done, this, &BlurhashResponse::handleDone);
|
||||
connect(runnable, &BlurhashRunnable::error, this, &BlurhashResponse::handleError);
|
||||
pool->start(runnable);
|
||||
QThreadPool::globalInstance()->start(runnable);
|
||||
}
|
||||
|
||||
QQuickTextureFactory *textureFactory() const override
|
||||
|
@ -72,9 +72,6 @@ public slots:
|
|||
QQuickImageResponse *
|
||||
requestImageResponse(const QString &id, const QSize &requestedSize) override
|
||||
{
|
||||
return new BlurhashResponse(id, requestedSize, &pool);
|
||||
return new BlurhashResponse(id, requestedSize);
|
||||
}
|
||||
|
||||
private:
|
||||
QThreadPool pool;
|
||||
};
|
||||
|
|
|
@ -70,12 +70,11 @@ clipRadius(QPixmap img, double radius)
|
|||
JdenticonResponse::JdenticonResponse(const QString &key,
|
||||
bool crop,
|
||||
double radius,
|
||||
const QSize &requestedSize,
|
||||
QThreadPool *pool)
|
||||
const QSize &requestedSize)
|
||||
{
|
||||
auto runnable = new JdenticonRunnable(key, crop, radius, requestedSize);
|
||||
connect(runnable, &JdenticonRunnable::done, this, &JdenticonResponse::handleDone);
|
||||
pool->start(runnable);
|
||||
QThreadPool::globalInstance()->start(runnable);
|
||||
}
|
||||
|
||||
JdenticonRunnable::JdenticonRunnable(const QString &key,
|
||||
|
|
|
@ -36,11 +36,7 @@ private:
|
|||
class JdenticonResponse : public QQuickImageResponse
|
||||
{
|
||||
public:
|
||||
JdenticonResponse(const QString &key,
|
||||
bool crop,
|
||||
double radius,
|
||||
const QSize &requestedSize,
|
||||
QThreadPool *pool);
|
||||
JdenticonResponse(const QString &key, bool crop, double radius, const QSize &requestedSize);
|
||||
|
||||
QQuickTextureFactory *textureFactory() const override
|
||||
{
|
||||
|
@ -86,9 +82,6 @@ public slots:
|
|||
}
|
||||
}
|
||||
|
||||
return new JdenticonResponse(id_, crop, radius, requestedSize, &pool);
|
||||
return new JdenticonResponse(id_, crop, radius, requestedSize);
|
||||
}
|
||||
|
||||
private:
|
||||
QThreadPool pool;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue