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 17:11:59 +00:00
|
|
|
class PackFetchTask : public QObject {
|
2018-02-28 18:42:30 +00:00
|
|
|
|
2018-07-15 12:51:05 +00: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 12:51:05 +00:00
|
|
|
void fetch();
|
2018-08-01 22:52:31 +00:00
|
|
|
void fetchPrivate(const QStringList &toFetch);
|
2018-02-28 18:42:30 +00:00
|
|
|
|
|
|
|
private:
|
2018-07-15 12:51:05 +00:00
|
|
|
NetJobPtr jobPtr;
|
2018-02-28 18:42:30 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
QByteArray publicModpacksXmlFileData;
|
|
|
|
QByteArray thirdPartyModpacksXmlFileData;
|
2018-04-01 18:24:28 +00: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 12:51:05 +00: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 12:51:05 +00: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 22:52:31 +00:00
|
|
|
void privateFileDownloadFailed(QString reason, QString packCode);
|
2018-02-28 18:42:30 +00:00
|
|
|
};
|
2019-11-03 22:48:12 +00:00
|
|
|
|
|
|
|
}
|