2018-02-28 18:42:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "net/NetJob.h"
|
|
|
|
#include <QTemporaryDir>
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <QObject>
|
|
|
|
#include "PackHelpers.h"
|
|
|
|
|
2019-11-03 22:48:12 +00:00
|
|
|
namespace LegacyFTB {
|
|
|
|
|
2021-07-25 18:11:59 +01:00
|
|
|
class PackFetchTask : public QObject {
|
2018-02-28 18:42:30 +00:00
|
|
|
|
2018-07-15 13:51:05 +01:00
|
|
|
Q_OBJECT
|
2018-02-28 18:42:30 +00:00
|
|
|
|
|
|
|
public:
|
2019-11-03 22:48:12 +00:00
|
|
|
PackFetchTask() = default;
|
|
|
|
virtual ~PackFetchTask() = default;
|
2018-02-28 18:42:30 +00:00
|
|
|
|
2018-07-15 13:51:05 +01:00
|
|
|
void fetch();
|
2018-08-01 23:52:31 +01:00
|
|
|
void fetchPrivate(const QStringList &toFetch);
|
2018-02-28 18:42:30 +00:00
|
|
|
|
|
|
|
private:
|
2018-07-15 13:51:05 +01:00
|
|
|
NetJobPtr jobPtr;
|
2018-02-28 18:42:30 +00:00
|
|
|
|
2018-07-15 13:51:05 +01:00
|
|
|
QByteArray publicModpacksXmlFileData;
|
|
|
|
QByteArray thirdPartyModpacksXmlFileData;
|
2018-04-01 19:24:28 +01:00
|
|
|
|
2019-11-03 22:48:12 +00:00
|
|
|
bool parseAndAddPacks(QByteArray &data, PackType packType, ModpackList &list);
|
|
|
|
ModpackList publicPacks;
|
|
|
|
ModpackList thirdPartyPacks;
|
2018-02-28 18:42:30 +00:00
|
|
|
|
|
|
|
protected slots:
|
2018-07-15 13:51:05 +01:00
|
|
|
void fileDownloadFinished();
|
|
|
|
void fileDownloadFailed(QString reason);
|
2018-02-28 18:42:30 +00:00
|
|
|
|
|
|
|
signals:
|
2019-11-03 22:48:12 +00:00
|
|
|
void finished(ModpackList publicPacks, ModpackList thirdPartyPacks);
|
2018-07-15 13:51:05 +01:00
|
|
|
void failed(QString reason);
|
2018-02-28 18:42:30 +00:00
|
|
|
|
2019-11-03 22:48:12 +00:00
|
|
|
void privateFileDownloadFinished(Modpack modpack);
|
2018-08-01 23:52:31 +01:00
|
|
|
void privateFileDownloadFailed(QString reason, QString packCode);
|
2018-02-28 18:42:30 +00:00
|
|
|
};
|
2019-11-03 22:48:12 +00:00
|
|
|
|
|
|
|
}
|