ATLauncher: Pass the full pack name through to the install task
This commit is contained in:
parent
e7f35e6ca3
commit
a98b6663e1
@ -60,10 +60,11 @@ namespace ATLauncher {
|
|||||||
|
|
||||||
static Meta::VersionPtr getComponentVersion(const QString& uid, const QString& version);
|
static Meta::VersionPtr getComponentVersion(const QString& uid, const QString& version);
|
||||||
|
|
||||||
PackInstallTask::PackInstallTask(UserInteractionSupport *support, QString pack, QString version)
|
PackInstallTask::PackInstallTask(UserInteractionSupport *support, QString packName, QString version)
|
||||||
{
|
{
|
||||||
m_support = support;
|
m_support = support;
|
||||||
m_pack = pack;
|
m_pack_name = packName;
|
||||||
|
m_pack_safe_name = packName.replace(QRegularExpression("[^A-Za-z0-9]"), "");
|
||||||
m_version_name = version;
|
m_version_name = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ void PackInstallTask::executeTask()
|
|||||||
qDebug() << "PackInstallTask::executeTask: " << QThread::currentThreadId();
|
qDebug() << "PackInstallTask::executeTask: " << QThread::currentThreadId();
|
||||||
auto *netJob = new NetJob("ATLauncher::VersionFetch", APPLICATION->network());
|
auto *netJob = new NetJob("ATLauncher::VersionFetch", APPLICATION->network());
|
||||||
auto searchUrl = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.json")
|
auto searchUrl = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.json")
|
||||||
.arg(m_pack).arg(m_version_name);
|
.arg(m_pack_safe_name).arg(m_version_name);
|
||||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
||||||
jobPtr = netJob;
|
jobPtr = netJob;
|
||||||
jobPtr->start();
|
jobPtr->start();
|
||||||
@ -319,7 +320,7 @@ bool PackInstallTask::createLibrariesComponent(QString instanceRoot, std::shared
|
|||||||
auto patchFileName = FS::PathCombine(patchDir, target_id + ".json");
|
auto patchFileName = FS::PathCombine(patchDir, target_id + ".json");
|
||||||
|
|
||||||
auto f = std::make_shared<VersionFile>();
|
auto f = std::make_shared<VersionFile>();
|
||||||
f->name = m_pack + " " + m_version_name + " (libraries)";
|
f->name = m_pack_name + " " + m_version_name + " (libraries)";
|
||||||
|
|
||||||
const static QMap<QString, QString> liteLoaderMap = {
|
const static QMap<QString, QString> liteLoaderMap = {
|
||||||
{ "61179803bcd5fb7790789b790908663d", "1.12-SNAPSHOT" },
|
{ "61179803bcd5fb7790789b790908663d", "1.12-SNAPSHOT" },
|
||||||
@ -465,7 +466,7 @@ bool PackInstallTask::createPackComponent(QString instanceRoot, std::shared_ptr<
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto f = std::make_shared<VersionFile>();
|
auto f = std::make_shared<VersionFile>();
|
||||||
f->name = m_pack + " " + m_version_name;
|
f->name = m_pack_name + " " + m_version_name;
|
||||||
if (!mainClass.isEmpty() && !mainClasses.contains(mainClass)) {
|
if (!mainClass.isEmpty() && !mainClasses.contains(mainClass)) {
|
||||||
f->mainClass = mainClass;
|
f->mainClass = mainClass;
|
||||||
}
|
}
|
||||||
@ -507,9 +508,9 @@ void PackInstallTask::installConfigs()
|
|||||||
setStatus(tr("Downloading configs..."));
|
setStatus(tr("Downloading configs..."));
|
||||||
jobPtr = new NetJob(tr("Config download"), APPLICATION->network());
|
jobPtr = new NetJob(tr("Config download"), APPLICATION->network());
|
||||||
|
|
||||||
auto path = QString("Configs/%1/%2.zip").arg(m_pack).arg(m_version_name);
|
auto path = QString("Configs/%1/%2.zip").arg(m_pack_safe_name).arg(m_version_name);
|
||||||
auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.zip")
|
auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.zip")
|
||||||
.arg(m_pack).arg(m_version_name);
|
.arg(m_pack_safe_name).arg(m_version_name);
|
||||||
auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", path);
|
auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", path);
|
||||||
entry->setStale(true);
|
entry->setStale(true);
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class PackInstallTask : public InstanceTask
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PackInstallTask(UserInteractionSupport *support, QString pack, QString version);
|
explicit PackInstallTask(UserInteractionSupport *support, QString packName, QString version);
|
||||||
virtual ~PackInstallTask(){}
|
virtual ~PackInstallTask(){}
|
||||||
|
|
||||||
bool canAbort() const override { return true; }
|
bool canAbort() const override { return true; }
|
||||||
@ -117,7 +117,8 @@ private:
|
|||||||
NetJob::Ptr jobPtr;
|
NetJob::Ptr jobPtr;
|
||||||
QByteArray response;
|
QByteArray response;
|
||||||
|
|
||||||
QString m_pack;
|
QString m_pack_name;
|
||||||
|
QString m_pack_safe_name;
|
||||||
QString m_version_name;
|
QString m_version_name;
|
||||||
PackVersion m_version;
|
PackVersion m_version;
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void AtlPage::suggestCurrent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->setSuggestedPack(selected.name + " " + selectedVersion, new ATLauncher::PackInstallTask(this, selected.safeName, selectedVersion));
|
dialog->setSuggestedPack(selected.name + " " + selectedVersion, new ATLauncher::PackInstallTask(this, selected.name, selectedVersion));
|
||||||
auto editedLogoName = selected.safeName;
|
auto editedLogoName = selected.safeName;
|
||||||
auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/images/%1.png").arg(selected.safeName.toLower());
|
auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/images/%1.png").arg(selected.safeName.toLower());
|
||||||
listModel->getLogo(selected.safeName, url, [this, editedLogoName](QString logo)
|
listModel->getLogo(selected.safeName, url, [this, editedLogoName](QString logo)
|
||||||
|
Loading…
Reference in New Issue
Block a user