NOISSUE use QtConcurrent to run FS operations in worker threads

Not all operations - only the ones that aren't in error handling.
The API for QFuture is too nasty to do much more in a sensible way.
This commit is contained in:
Petr Mrázek
2016-10-26 18:12:33 +02:00
parent d66fdcd4cc
commit 1b4851a941
7 changed files with 70 additions and 19 deletions

View File

@ -4,10 +4,13 @@
#include "multimc_logic_export.h"
#include "net/NetJob.h"
#include <QUrl>
#include <QFuture>
#include <QFutureWatcher>
#include "settings/SettingsObject.h"
#include "BaseVersion.h"
#include "BaseInstance.h"
class BaseInstanceProvider;
class MULTIMC_LOGIC_EXPORT InstanceCopyTask : public Task
@ -20,6 +23,8 @@ public:
protected:
//! Entry point for tasks.
virtual void executeTask() override;
void copyFinished();
void copyAborted();
private: /* data */
SettingsObjectPtr m_globalSettings;
@ -28,7 +33,10 @@ private: /* data */
QString m_instName;
QString m_instIcon;
QString m_instGroup;
QString m_stagingPath;
bool m_copySaves = false;
QFuture<bool> m_copyFuture;
QFutureWatcher<bool> m_copyFutureWatcher;
};