rename variable
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
ac8c7baff2
commit
888b22b4c7
@ -138,24 +138,24 @@ QString hash(QByteArray data, Algorithm type)
|
|||||||
|
|
||||||
void Hasher::executeTask()
|
void Hasher::executeTask()
|
||||||
{
|
{
|
||||||
m_zip_future = QtConcurrent::run(QThreadPool::globalInstance(), [this]() { return hash(m_path, m_alg); });
|
m_future = QtConcurrent::run(QThreadPool::globalInstance(), [this]() { return hash(m_path, m_alg); });
|
||||||
connect(&m_zip_watcher, &QFutureWatcher<QString>::finished, this, [this] {
|
connect(&m_watcher, &QFutureWatcher<QString>::finished, this, [this] {
|
||||||
if (m_zip_future.isCanceled()) {
|
if (m_future.isCanceled()) {
|
||||||
emitAborted();
|
emitAborted();
|
||||||
} else if (m_result = m_zip_future.result(); m_result.isEmpty()) {
|
} else if (m_result = m_future.result(); m_result.isEmpty()) {
|
||||||
emitFailed("Empty hash!");
|
emitFailed("Empty hash!");
|
||||||
} else {
|
} else {
|
||||||
emitSucceeded();
|
emitSucceeded();
|
||||||
emit resultsReady(m_result);
|
emit resultsReady(m_result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
m_zip_watcher.setFuture(m_zip_future);
|
m_watcher.setFuture(m_future);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Hasher::abort()
|
bool Hasher::abort()
|
||||||
{
|
{
|
||||||
if (m_zip_future.isRunning()) {
|
if (m_future.isRunning()) {
|
||||||
m_zip_future.cancel();
|
m_future.cancel();
|
||||||
// NOTE: Here we don't do `emitAborted()` because it will be done when `m_build_zip_future` actually cancels, which may not
|
// NOTE: Here we don't do `emitAborted()` because it will be done when `m_build_zip_future` actually cancels, which may not
|
||||||
// occur immediately.
|
// occur immediately.
|
||||||
return true;
|
return true;
|
||||||
|
@ -41,8 +41,8 @@ class Hasher : public Task {
|
|||||||
QString m_path;
|
QString m_path;
|
||||||
Algorithm m_alg;
|
Algorithm m_alg;
|
||||||
|
|
||||||
QFuture<QString> m_zip_future;
|
QFuture<QString> m_future;
|
||||||
QFutureWatcher<QString> m_zip_watcher;
|
QFutureWatcher<QString> m_watcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
Hasher::Ptr createHasher(QString file_path, ModPlatform::ResourceProvider provider);
|
Hasher::Ptr createHasher(QString file_path, ModPlatform::ResourceProvider provider);
|
||||||
|
Loading…
Reference in New Issue
Block a user