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()
|
||||
{
|
||||
m_zip_future = QtConcurrent::run(QThreadPool::globalInstance(), [this]() { return hash(m_path, m_alg); });
|
||||
connect(&m_zip_watcher, &QFutureWatcher<QString>::finished, this, [this] {
|
||||
if (m_zip_future.isCanceled()) {
|
||||
m_future = QtConcurrent::run(QThreadPool::globalInstance(), [this]() { return hash(m_path, m_alg); });
|
||||
connect(&m_watcher, &QFutureWatcher<QString>::finished, this, [this] {
|
||||
if (m_future.isCanceled()) {
|
||||
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!");
|
||||
} else {
|
||||
emitSucceeded();
|
||||
emit resultsReady(m_result);
|
||||
}
|
||||
});
|
||||
m_zip_watcher.setFuture(m_zip_future);
|
||||
m_watcher.setFuture(m_future);
|
||||
}
|
||||
|
||||
bool Hasher::abort()
|
||||
{
|
||||
if (m_zip_future.isRunning()) {
|
||||
m_zip_future.cancel();
|
||||
if (m_future.isRunning()) {
|
||||
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
|
||||
// occur immediately.
|
||||
return true;
|
||||
|
@ -41,8 +41,8 @@ class Hasher : public Task {
|
||||
QString m_path;
|
||||
Algorithm m_alg;
|
||||
|
||||
QFuture<QString> m_zip_future;
|
||||
QFutureWatcher<QString> m_zip_watcher;
|
||||
QFuture<QString> m_future;
|
||||
QFutureWatcher<QString> m_watcher;
|
||||
};
|
||||
|
||||
Hasher::Ptr createHasher(QString file_path, ModPlatform::ResourceProvider provider);
|
||||
|
Loading…
Reference in New Issue
Block a user