aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod/tasks/LocalModParseTask.h
blob: ed92394ce452e36b39ad209bf529a322d088e85a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <QDebug>
#include <QObject>
#include <QRunnable>

#include "minecraft/mod/Mod.h"
#include "minecraft/mod/ModDetails.h"

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;
};