diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-16 22:25:55 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-16 22:25:55 -0500 |
| commit | b8eab5d248272cab886bc800f2d619a49d8af54a (patch) | |
| tree | 614d36adf27842249050666bf9369b66c19248af /src/loot.h | |
| parent | 9688f37bbe54568aba09e2dd755e0ea35eef2bb1 (diff) | |
threaded loot
Diffstat (limited to 'src/loot.h')
| -rw-r--r-- | src/loot.h | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -1,10 +1,47 @@ #ifndef MODORGANIZER_LOOT_H #define MODORGANIZER_LOOT_H +#include <windows.h> #include <QWidget> class OrganizerCore; +class Loot : public QObject +{ + Q_OBJECT; + +public: + Loot(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList); + ~Loot(); + + void start(); + void cancel(); + bool result() const; + +signals: + void output(const QString& s); + void progress(const QString& s); + void information(const QString& mod, const QString& info); + void errorMessage(const QString& s); + void error(const QString& s); + void finished(); + +private: + std::unique_ptr<QThread> m_thread; + std::atomic<bool> m_cancel; + std::atomic<bool> m_result; + QString m_outPath; + HANDLE m_lootProcess; + HANDLE m_stdOutRead; + + void createStdoutPipe(HANDLE *stdOutRead, HANDLE *stdOutWrite); + std::string readFromPipe(HANDLE stdOutRead); + + void processLOOTOut(const std::string &lootOut); + void lootThread(); +}; + + bool runLoot(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList); #endif // MODORGANIZER_LOOT_H |
