mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +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
|
class BlurhashResponse : public QQuickImageResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlurhashResponse(const QString &id, const QSize &requestedSize, QThreadPool *pool)
|
BlurhashResponse(const QString &id, const QSize &requestedSize)
|
||||||
{
|
{
|
||||||
auto runnable = new BlurhashRunnable(id, requestedSize);
|
auto runnable = new BlurhashRunnable(id, requestedSize);
|
||||||
connect(runnable, &BlurhashRunnable::done, this, &BlurhashResponse::handleDone);
|
connect(runnable, &BlurhashRunnable::done, this, &BlurhashResponse::handleDone);
|
||||||
connect(runnable, &BlurhashRunnable::error, this, &BlurhashResponse::handleError);
|
connect(runnable, &BlurhashRunnable::error, this, &BlurhashResponse::handleError);
|
||||||
pool->start(runnable);
|
QThreadPool::globalInstance()->start(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickTextureFactory *textureFactory() const override
|
QQuickTextureFactory *textureFactory() const override
|
||||||
|
@ -72,9 +72,6 @@ public slots:
|
||||||
QQuickImageResponse *
|
QQuickImageResponse *
|
||||||
requestImageResponse(const QString &id, const QSize &requestedSize) override
|
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,
|
JdenticonResponse::JdenticonResponse(const QString &key,
|
||||||
bool crop,
|
bool crop,
|
||||||
double radius,
|
double radius,
|
||||||
const QSize &requestedSize,
|
const QSize &requestedSize)
|
||||||
QThreadPool *pool)
|
|
||||||
{
|
{
|
||||||
auto runnable = new JdenticonRunnable(key, crop, radius, requestedSize);
|
auto runnable = new JdenticonRunnable(key, crop, radius, requestedSize);
|
||||||
connect(runnable, &JdenticonRunnable::done, this, &JdenticonResponse::handleDone);
|
connect(runnable, &JdenticonRunnable::done, this, &JdenticonResponse::handleDone);
|
||||||
pool->start(runnable);
|
QThreadPool::globalInstance()->start(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
JdenticonRunnable::JdenticonRunnable(const QString &key,
|
JdenticonRunnable::JdenticonRunnable(const QString &key,
|
||||||
|
|
|
@ -36,11 +36,7 @@ private:
|
||||||
class JdenticonResponse : public QQuickImageResponse
|
class JdenticonResponse : public QQuickImageResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
JdenticonResponse(const QString &key,
|
JdenticonResponse(const QString &key, bool crop, double radius, const QSize &requestedSize);
|
||||||
bool crop,
|
|
||||||
double radius,
|
|
||||||
const QSize &requestedSize,
|
|
||||||
QThreadPool *pool);
|
|
||||||
|
|
||||||
QQuickTextureFactory *textureFactory() const override
|
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