2019-08-04 02:27:53 +01:00
|
|
|
#pragma once
|
2022-04-16 00:35:17 +01:00
|
|
|
|
2019-08-04 02:27:53 +01:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QObject>
|
2022-04-16 00:35:17 +01:00
|
|
|
#include <QRunnable>
|
|
|
|
|
|
|
|
#include "minecraft/mod/Mod.h"
|
|
|
|
#include "minecraft/mod/ModDetails.h"
|
2019-08-04 02:27:53 +01:00
|
|
|
|
|
|
|
class LocalModParseTask : public QObject, public QRunnable
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
struct Result {
|
|
|
|
QString id;
|
|
|
|
std::shared_ptr<ModDetails> details;
|
|
|
|
};
|
|
|
|
using ResultPtr = std::shared_ptr<Result>;
|
|
|
|
ResultPtr result() const {
|
|
|
|
return m_result;
|
|
|
|
}
|
|
|
|
|
|
|
|
LocalModParseTask(int token, Mod::ModType type, const QFileInfo & modFile);
|
|
|
|
void run();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void finished(int token);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void processAsZip();
|
|
|
|
void processAsFolder();
|
|
|
|
void processAsLitemod();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_token;
|
|
|
|
Mod::ModType m_type;
|
|
|
|
QFileInfo m_modFile;
|
|
|
|
ResultPtr m_result;
|
|
|
|
};
|