Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
b7490b479c | |||
74120fe1f3 | |||
336f1f4f50 | |||
1c256d8876 | |||
1ce0f0e7a5 | |||
fbf1901d86 | |||
0382f33c46 | |||
13372f3f99 | |||
e741cb7f0a | |||
fb289c6b17 | |||
75a7ea55d4 | |||
86573a5ccd | |||
6fe55a79f1 | |||
1a6cb9ee99 | |||
a495d9eca5 | |||
65a945f968 | |||
0d35edbbf3 | |||
3aa2003951 | |||
0e473f4570 | |||
bfa824ee71 | |||
1157436a24 | |||
4596e78df0 | |||
813dfbd2d3 | |||
ba7dfb360c |
@ -81,7 +81,7 @@ set(Launcher_HELP_URL "https://polymc.org/wiki/help-pages/%1" CACHE STRING "URL
|
|||||||
######## Set version numbers ########
|
######## Set version numbers ########
|
||||||
set(Launcher_VERSION_MAJOR 1)
|
set(Launcher_VERSION_MAJOR 1)
|
||||||
set(Launcher_VERSION_MINOR 4)
|
set(Launcher_VERSION_MINOR 4)
|
||||||
set(Launcher_VERSION_HOTFIX 0)
|
set(Launcher_VERSION_HOTFIX 1)
|
||||||
|
|
||||||
# Build number
|
# Build number
|
||||||
set(Launcher_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
|
set(Launcher_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
|
||||||
|
@ -64,7 +64,7 @@ The translation effort for PolyMC is hosted on [Weblate](https://hosted.weblate.
|
|||||||
|
|
||||||
## Download information
|
## Download information
|
||||||
|
|
||||||
To modify download information or change packaging information send a pull request or issue to the website [Here](https://github.com/PolyMC/polymc.github.io/blob/master/src/download.md)
|
To modify download information or change packaging information send a pull request or issue to the website [here](https://github.com/PolyMC/polymc.github.io/tree/master/src/download).
|
||||||
|
|
||||||
## Forking/Redistributing/Custom builds policy
|
## Forking/Redistributing/Custom builds policy
|
||||||
|
|
||||||
|
@ -141,9 +141,10 @@ bool MMCZip::createModdedJar(QString sourceJarPath, QString targetJarPath, const
|
|||||||
QSet<QString> addedFiles;
|
QSet<QString> addedFiles;
|
||||||
|
|
||||||
// Modify the jar
|
// Modify the jar
|
||||||
for (auto i = mods.constEnd(); i != mods.constBegin(); --i)
|
// This needs to be done in reverse-order to ensure we respect the loading order of components
|
||||||
|
for (auto i = mods.crbegin(); i != mods.crend(); i++)
|
||||||
{
|
{
|
||||||
const Mod* mod = *i;
|
const auto* mod = *i;
|
||||||
// do not merge disabled mods.
|
// do not merge disabled mods.
|
||||||
if (!mod->enabled())
|
if (!mod->enabled())
|
||||||
continue;
|
continue;
|
||||||
|
@ -77,10 +77,12 @@ public:
|
|||||||
{
|
{
|
||||||
return m_ptr;
|
return m_ptr;
|
||||||
}
|
}
|
||||||
bool operator==(const shared_qobject_ptr<T>& other) {
|
template<typename U>
|
||||||
|
bool operator==(const shared_qobject_ptr<U>& other) const {
|
||||||
return m_ptr == other.m_ptr;
|
return m_ptr == other.m_ptr;
|
||||||
}
|
}
|
||||||
bool operator!=(const shared_qobject_ptr<T>& other) {
|
template<typename U>
|
||||||
|
bool operator!=(const shared_qobject_ptr<U>& other) const {
|
||||||
return m_ptr != other.m_ptr;
|
return m_ptr != other.m_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,35 +282,22 @@ void LaunchTask::emitFailed(QString reason)
|
|||||||
Task::emitFailed(reason);
|
Task::emitFailed(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaunchTask::substituteVariables(const QStringList &args) const
|
void LaunchTask::substituteVariables(QStringList &args) const
|
||||||
{
|
{
|
||||||
auto variables = m_instance->getVariables();
|
auto env = m_instance->createEnvironment();
|
||||||
auto envVariables = QProcessEnvironment::systemEnvironment();
|
|
||||||
|
|
||||||
for (auto arg : args) {
|
for (auto key : env.keys())
|
||||||
for (auto key : variables)
|
{
|
||||||
{
|
args.replaceInStrings("$" + key, env.value(key));
|
||||||
arg.replace("$" + key, variables.value(key));
|
|
||||||
}
|
|
||||||
for (auto env : envVariables.keys())
|
|
||||||
{
|
|
||||||
arg.replace("$" + env, envVariables.value(env));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LaunchTask::substituteVariables(const QString &cmd) const
|
void LaunchTask::substituteVariables(QString &cmd) const
|
||||||
{
|
{
|
||||||
QString out = cmd;
|
auto env = m_instance->createEnvironment();
|
||||||
auto variables = m_instance->getVariables();
|
|
||||||
for (auto it = variables.begin(); it != variables.end(); ++it)
|
for (auto key : env.keys())
|
||||||
{
|
{
|
||||||
out.replace("$" + it.key(), it.value());
|
cmd.replace("$" + key, env.value(key));
|
||||||
}
|
}
|
||||||
auto env = QProcessEnvironment::systemEnvironment();
|
|
||||||
for (auto var : env.keys())
|
|
||||||
{
|
|
||||||
out.replace("$" + var, env.value(var));
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,8 @@ public: /* methods */
|
|||||||
shared_qobject_ptr<LogModel> getLogModel();
|
shared_qobject_ptr<LogModel> getLogModel();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void substituteVariables(const QStringList &args) const;
|
void substituteVariables(QStringList &args) const;
|
||||||
QString substituteVariables(const QString &cmd) const;
|
void substituteVariables(QString &cmd) const;
|
||||||
QString censorPrivateInfo(QString in);
|
QString censorPrivateInfo(QString in);
|
||||||
|
|
||||||
protected: /* methods */
|
protected: /* methods */
|
||||||
|
@ -56,9 +56,10 @@ void PostLaunchCommand::executeTask()
|
|||||||
const QString program = args.takeFirst();
|
const QString program = args.takeFirst();
|
||||||
m_process.start(program, args);
|
m_process.start(program, args);
|
||||||
#else
|
#else
|
||||||
QString postlaunch_cmd = m_parent->substituteVariables(m_command);
|
m_parent->substituteVariables(m_command);
|
||||||
emit logLine(tr("Running Post-Launch command: %1").arg(postlaunch_cmd), MessageLevel::Launcher);
|
|
||||||
m_process.start(postlaunch_cmd);
|
emit logLine(tr("Running Post-Launch command: %1").arg(m_command), MessageLevel::Launcher);
|
||||||
|
m_process.start(m_command);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,9 +56,10 @@ void PreLaunchCommand::executeTask()
|
|||||||
const QString program = args.takeFirst();
|
const QString program = args.takeFirst();
|
||||||
m_process.start(program, args);
|
m_process.start(program, args);
|
||||||
#else
|
#else
|
||||||
QString prelaunch_cmd = m_parent->substituteVariables(m_command);
|
m_parent->substituteVariables(m_command);
|
||||||
emit logLine(tr("Running Pre-Launch command: %1").arg(prelaunch_cmd), MessageLevel::Launcher);
|
|
||||||
m_process.start(prelaunch_cmd);
|
emit logLine(tr("Running Pre-Launch command: %1").arg(m_command), MessageLevel::Launcher);
|
||||||
|
m_process.start(m_command);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +109,10 @@ QStringList AccountList::profileNames() const {
|
|||||||
|
|
||||||
void AccountList::addAccount(const MinecraftAccountPtr account)
|
void AccountList::addAccount(const MinecraftAccountPtr account)
|
||||||
{
|
{
|
||||||
// NOTE: Do not allow adding something that's already there
|
// NOTE: Do not allow adding something that's already there. We shouldn't let it continue
|
||||||
if(m_accounts.contains(account)) {
|
// because of the signal / slot connections after this.
|
||||||
|
if (m_accounts.contains(account)) {
|
||||||
|
qDebug() << "Tried to add account that's already on the accounts list!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +125,8 @@ void AccountList::addAccount(const MinecraftAccountPtr account)
|
|||||||
if(profileId.size()) {
|
if(profileId.size()) {
|
||||||
auto existingAccount = findAccountByProfileId(profileId);
|
auto existingAccount = findAccountByProfileId(profileId);
|
||||||
if(existingAccount != -1) {
|
if(existingAccount != -1) {
|
||||||
|
qDebug() << "Replacing old account with a new one with the same profile ID!";
|
||||||
|
|
||||||
MinecraftAccountPtr existingAccountPtr = m_accounts[existingAccount];
|
MinecraftAccountPtr existingAccountPtr = m_accounts[existingAccount];
|
||||||
m_accounts[existingAccount] = account;
|
m_accounts[existingAccount] = account;
|
||||||
if(m_defaultAccount == existingAccountPtr) {
|
if(m_defaultAccount == existingAccountPtr) {
|
||||||
@ -138,9 +142,12 @@ void AccountList::addAccount(const MinecraftAccountPtr account)
|
|||||||
|
|
||||||
// if we don't have this profileId yet, add the account to the end
|
// if we don't have this profileId yet, add the account to the end
|
||||||
int row = m_accounts.count();
|
int row = m_accounts.count();
|
||||||
|
qDebug() << "Inserting account at index" << row;
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), row, row);
|
beginInsertRows(QModelIndex(), row, row);
|
||||||
m_accounts.append(account);
|
m_accounts.append(account);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
onListChanged();
|
onListChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,13 @@ Flame::FileResolvingTask::FileResolvingTask(const shared_qobject_ptr<QNetworkAcc
|
|||||||
: m_network(network), m_toProcess(toProcess)
|
: m_network(network), m_toProcess(toProcess)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
bool Flame::FileResolvingTask::abort()
|
||||||
|
{
|
||||||
|
if (m_dljob)
|
||||||
|
return m_dljob->abort();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Flame::FileResolvingTask::executeTask()
|
void Flame::FileResolvingTask::executeTask()
|
||||||
{
|
{
|
||||||
setStatus(tr("Resolving mod IDs..."));
|
setStatus(tr("Resolving mod IDs..."));
|
||||||
|
@ -13,6 +13,9 @@ public:
|
|||||||
explicit FileResolvingTask(const shared_qobject_ptr<QNetworkAccessManager>& network, Flame::Manifest &toProcess);
|
explicit FileResolvingTask(const shared_qobject_ptr<QNetworkAccessManager>& network, Flame::Manifest &toProcess);
|
||||||
virtual ~FileResolvingTask() {};
|
virtual ~FileResolvingTask() {};
|
||||||
|
|
||||||
|
bool canAbort() const override { return true; }
|
||||||
|
bool abort() override;
|
||||||
|
|
||||||
const Flame::Manifest &getResults() const
|
const Flame::Manifest &getResults() const
|
||||||
{
|
{
|
||||||
return m_toProcess;
|
return m_toProcess;
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* PolyMC - Minecraft Launcher
|
* PolyMC - Minecraft Launcher
|
||||||
|
* Copyright (C) 2022 flowln <flowlnlnln@gmail.com>
|
||||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -40,103 +42,190 @@
|
|||||||
#include "Json.h"
|
#include "Json.h"
|
||||||
#include "minecraft/MinecraftInstance.h"
|
#include "minecraft/MinecraftInstance.h"
|
||||||
#include "minecraft/PackProfile.h"
|
#include "minecraft/PackProfile.h"
|
||||||
|
#include "modplatform/flame/PackManifest.h"
|
||||||
#include "net/ChecksumValidator.h"
|
#include "net/ChecksumValidator.h"
|
||||||
#include "settings/INISettingsObject.h"
|
#include "settings/INISettingsObject.h"
|
||||||
|
|
||||||
#include "BuildConfig.h"
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "BuildConfig.h"
|
||||||
|
#include "ui/dialogs/ScrollMessageBox.h"
|
||||||
|
|
||||||
namespace ModpacksCH {
|
namespace ModpacksCH {
|
||||||
|
|
||||||
PackInstallTask::PackInstallTask(Modpack pack, QString version)
|
PackInstallTask::PackInstallTask(Modpack pack, QString version, QWidget* parent)
|
||||||
{
|
: m_pack(std::move(pack)), m_version_name(std::move(version)), m_parent(parent)
|
||||||
m_pack = pack;
|
{}
|
||||||
m_version_name = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PackInstallTask::abort()
|
bool PackInstallTask::abort()
|
||||||
{
|
{
|
||||||
if(abortable)
|
bool aborted = true;
|
||||||
{
|
|
||||||
return jobPtr->abort();
|
if (m_net_job)
|
||||||
}
|
aborted &= m_net_job->abort();
|
||||||
return false;
|
if (m_mod_id_resolver_task)
|
||||||
|
aborted &= m_mod_id_resolver_task->abort();
|
||||||
|
|
||||||
|
// FIXME: This should be 'emitAborted()', but InstanceStaging doesn't connect to the abort signal yet...
|
||||||
|
if (aborted)
|
||||||
|
emitFailed(tr("Aborted"));
|
||||||
|
|
||||||
|
return aborted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackInstallTask::executeTask()
|
void PackInstallTask::executeTask()
|
||||||
{
|
{
|
||||||
|
setStatus(tr("Getting the manifest..."));
|
||||||
|
|
||||||
// Find pack version
|
// Find pack version
|
||||||
bool found = false;
|
auto version_it = std::find_if(m_pack.versions.constBegin(), m_pack.versions.constEnd(),
|
||||||
VersionInfo version;
|
[this](ModpacksCH::VersionInfo const& a) { return a.name == m_version_name; });
|
||||||
|
|
||||||
for(auto vInfo : m_pack.versions) {
|
if (version_it == m_pack.versions.constEnd()) {
|
||||||
if (vInfo.name == m_version_name) {
|
|
||||||
found = true;
|
|
||||||
version = vInfo;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!found) {
|
|
||||||
emitFailed(tr("Failed to find pack version %1").arg(m_version_name));
|
emitFailed(tr("Failed to find pack version %1").arg(m_version_name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *netJob = new NetJob("ModpacksCH::VersionFetch", APPLICATION->network());
|
auto version = *version_it;
|
||||||
auto searchUrl = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/%1/%2").arg(m_pack.id).arg(version.id);
|
|
||||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
|
||||||
jobPtr = netJob;
|
|
||||||
jobPtr->start();
|
|
||||||
|
|
||||||
QObject::connect(netJob, &NetJob::succeeded, this, &PackInstallTask::onDownloadSucceeded);
|
auto* netJob = new NetJob("ModpacksCH::VersionFetch", APPLICATION->network());
|
||||||
QObject::connect(netJob, &NetJob::failed, this, &PackInstallTask::onDownloadFailed);
|
|
||||||
|
auto searchUrl = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/%1/%2").arg(m_pack.id).arg(version.id);
|
||||||
|
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &m_response));
|
||||||
|
|
||||||
|
QObject::connect(netJob, &NetJob::succeeded, this, &PackInstallTask::onManifestDownloadSucceeded);
|
||||||
|
QObject::connect(netJob, &NetJob::failed, this, &PackInstallTask::onManifestDownloadFailed);
|
||||||
|
QObject::connect(netJob, &NetJob::progress, this, &PackInstallTask::setProgress);
|
||||||
|
|
||||||
|
m_net_job = netJob;
|
||||||
|
|
||||||
|
netJob->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackInstallTask::onDownloadSucceeded()
|
void PackInstallTask::onManifestDownloadSucceeded()
|
||||||
{
|
{
|
||||||
jobPtr.reset();
|
m_net_job.reset();
|
||||||
|
|
||||||
QJsonParseError parse_error;
|
QJsonParseError parse_error{};
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(response, &parse_error);
|
QJsonDocument doc = QJsonDocument::fromJson(m_response, &parse_error);
|
||||||
if(parse_error.error != QJsonParseError::NoError) {
|
if (parse_error.error != QJsonParseError::NoError) {
|
||||||
qWarning() << "Error while parsing JSON response from ModpacksCH at " << parse_error.offset << " reason: " << parse_error.errorString();
|
qWarning() << "Error while parsing JSON response from ModpacksCH at " << parse_error.offset
|
||||||
qWarning() << response;
|
<< " reason: " << parse_error.errorString();
|
||||||
|
qWarning() << m_response;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto obj = doc.object();
|
|
||||||
|
|
||||||
ModpacksCH::Version version;
|
ModpacksCH::Version version;
|
||||||
try
|
try {
|
||||||
{
|
auto obj = Json::requireObject(doc);
|
||||||
ModpacksCH::loadVersion(version, obj);
|
ModpacksCH::loadVersion(version, obj);
|
||||||
}
|
} catch (const JSONValidationError& e) {
|
||||||
catch (const JSONValidationError &e)
|
|
||||||
{
|
|
||||||
emitFailed(tr("Could not understand pack manifest:\n") + e.cause());
|
emitFailed(tr("Could not understand pack manifest:\n") + e.cause());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_version = version;
|
m_version = version;
|
||||||
|
|
||||||
downloadPack();
|
resolveMods();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackInstallTask::onDownloadFailed(QString reason)
|
void PackInstallTask::resolveMods()
|
||||||
{
|
{
|
||||||
jobPtr.reset();
|
setStatus(tr("Resolving mods..."));
|
||||||
emitFailed(reason);
|
setProgress(0, 100);
|
||||||
|
|
||||||
|
m_file_id_map.clear();
|
||||||
|
|
||||||
|
Flame::Manifest manifest;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for (auto const& file : m_version.files) {
|
||||||
|
if (!file.serverOnly && file.url.isEmpty()) {
|
||||||
|
if (file.curseforge.file_id <= 0) {
|
||||||
|
emitFailed(tr("Invalid manifest: There's no information available to download the file '%1'!").arg(file.name));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Flame::File flame_file;
|
||||||
|
flame_file.projectId = file.curseforge.project_id;
|
||||||
|
flame_file.fileId = file.curseforge.file_id;
|
||||||
|
flame_file.hash = file.sha1;
|
||||||
|
|
||||||
|
manifest.files.insert(flame_file.fileId, flame_file);
|
||||||
|
m_file_id_map.append(flame_file.fileId);
|
||||||
|
} else {
|
||||||
|
m_file_id_map.append(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_mod_id_resolver_task = new Flame::FileResolvingTask(APPLICATION->network(), manifest);
|
||||||
|
|
||||||
|
connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::succeeded, this, &PackInstallTask::onResolveModsSucceeded);
|
||||||
|
connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::failed, this, &PackInstallTask::onResolveModsFailed);
|
||||||
|
connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::progress, this, &PackInstallTask::setProgress);
|
||||||
|
|
||||||
|
m_mod_id_resolver_task->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PackInstallTask::onResolveModsSucceeded()
|
||||||
|
{
|
||||||
|
m_abortable = false;
|
||||||
|
|
||||||
|
QString text;
|
||||||
|
auto anyBlocked = false;
|
||||||
|
|
||||||
|
Flame::Manifest results = m_mod_id_resolver_task->getResults();
|
||||||
|
for (int index = 0; index < m_file_id_map.size(); index++) {
|
||||||
|
auto const file_id = m_file_id_map.at(index);
|
||||||
|
if (file_id < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Flame::File results_file = results.files[file_id];
|
||||||
|
VersionFile& local_file = m_version.files[index];
|
||||||
|
|
||||||
|
// First check for blocked mods
|
||||||
|
if (!results_file.resolved || results_file.url.isEmpty()) {
|
||||||
|
QString type(local_file.type);
|
||||||
|
|
||||||
|
type[0] = type[0].toUpper();
|
||||||
|
text += QString("%1: %2 - <a href='%3'>%3</a><br/>").arg(type, local_file.name, results_file.websiteUrl);
|
||||||
|
anyBlocked = true;
|
||||||
|
} else {
|
||||||
|
local_file.url = results_file.url.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_mod_id_resolver_task.reset();
|
||||||
|
|
||||||
|
if (anyBlocked) {
|
||||||
|
qDebug() << "Blocked files found, displaying file list";
|
||||||
|
|
||||||
|
auto message_dialog = new ScrollMessageBox(m_parent, tr("Blocked files found"),
|
||||||
|
tr("The following files are not available for download in third party launchers.<br/>"
|
||||||
|
"You will need to manually download them and add them to the instance."),
|
||||||
|
text);
|
||||||
|
|
||||||
|
if (message_dialog->exec() == QDialog::Accepted)
|
||||||
|
downloadPack();
|
||||||
|
else
|
||||||
|
abort();
|
||||||
|
} else {
|
||||||
|
downloadPack();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackInstallTask::downloadPack()
|
void PackInstallTask::downloadPack()
|
||||||
{
|
{
|
||||||
setStatus(tr("Downloading mods..."));
|
setStatus(tr("Downloading mods..."));
|
||||||
|
|
||||||
jobPtr = new NetJob(tr("Mod download"), APPLICATION->network());
|
auto* jobPtr = new NetJob(tr("Mod download"), APPLICATION->network());
|
||||||
for(auto file : m_version.files) {
|
for (auto const& file : m_version.files) {
|
||||||
if(file.serverOnly) continue;
|
if (file.serverOnly || file.url.isEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
QFileInfo fileName(file.name);
|
QFileInfo file_info(file.name);
|
||||||
auto cacheName = fileName.completeBaseName() + "-" + file.sha1 + "." + fileName.suffix();
|
auto cacheName = file_info.completeBaseName() + "-" + file.sha1 + "." + file_info.suffix();
|
||||||
|
|
||||||
auto entry = APPLICATION->metacache()->resolveEntry("ModpacksCHPacks", cacheName);
|
auto entry = APPLICATION->metacache()->resolveEntry("ModpacksCHPacks", cacheName);
|
||||||
entry->setStale(true);
|
entry->setStale(true);
|
||||||
@ -144,58 +233,64 @@ void PackInstallTask::downloadPack()
|
|||||||
auto relpath = FS::PathCombine("minecraft", file.path, file.name);
|
auto relpath = FS::PathCombine("minecraft", file.path, file.name);
|
||||||
auto path = FS::PathCombine(m_stagingPath, relpath);
|
auto path = FS::PathCombine(m_stagingPath, relpath);
|
||||||
|
|
||||||
if (filesToCopy.contains(path)) {
|
if (m_files_to_copy.contains(path)) {
|
||||||
qWarning() << "Ignoring" << file.url << "as a file of that path is already downloading.";
|
qWarning() << "Ignoring" << file.url << "as a file of that path is already downloading.";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Will download" << file.url << "to" << path;
|
qDebug() << "Will download" << file.url << "to" << path;
|
||||||
filesToCopy[path] = entry->getFullPath();
|
m_files_to_copy[path] = entry->getFullPath();
|
||||||
|
|
||||||
auto dl = Net::Download::makeCached(file.url, entry);
|
auto dl = Net::Download::makeCached(file.url, entry);
|
||||||
if (!file.sha1.isEmpty()) {
|
if (!file.sha1.isEmpty()) {
|
||||||
auto rawSha1 = QByteArray::fromHex(file.sha1.toLatin1());
|
auto rawSha1 = QByteArray::fromHex(file.sha1.toLatin1());
|
||||||
dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawSha1));
|
dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawSha1));
|
||||||
}
|
}
|
||||||
|
|
||||||
jobPtr->addNetAction(dl);
|
jobPtr->addNetAction(dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(jobPtr.get(), &NetJob::succeeded, this, [&]()
|
connect(jobPtr, &NetJob::succeeded, this, &PackInstallTask::onModDownloadSucceeded);
|
||||||
{
|
connect(jobPtr, &NetJob::failed, this, &PackInstallTask::onModDownloadFailed);
|
||||||
abortable = false;
|
connect(jobPtr, &NetJob::progress, this, &PackInstallTask::setProgress);
|
||||||
jobPtr.reset();
|
|
||||||
install();
|
|
||||||
});
|
|
||||||
connect(jobPtr.get(), &NetJob::failed, [&](QString reason)
|
|
||||||
{
|
|
||||||
abortable = false;
|
|
||||||
jobPtr.reset();
|
|
||||||
emitFailed(reason);
|
|
||||||
});
|
|
||||||
connect(jobPtr.get(), &NetJob::progress, [&](qint64 current, qint64 total)
|
|
||||||
{
|
|
||||||
abortable = true;
|
|
||||||
setProgress(current, total);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
m_net_job = jobPtr;
|
||||||
jobPtr->start();
|
jobPtr->start();
|
||||||
|
|
||||||
|
m_abortable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PackInstallTask::onModDownloadSucceeded()
|
||||||
|
{
|
||||||
|
m_net_job.reset();
|
||||||
|
install();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackInstallTask::install()
|
void PackInstallTask::install()
|
||||||
{
|
{
|
||||||
setStatus(tr("Copying modpack files"));
|
setStatus(tr("Copying modpack files..."));
|
||||||
|
setProgress(0, m_files_to_copy.size());
|
||||||
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
for (auto iter = filesToCopy.begin(); iter != filesToCopy.end(); iter++) {
|
m_abortable = false;
|
||||||
auto &to = iter.key();
|
|
||||||
auto &from = iter.value();
|
int i = 0;
|
||||||
|
for (auto iter = m_files_to_copy.constBegin(); iter != m_files_to_copy.constEnd(); iter++) {
|
||||||
|
auto& to = iter.key();
|
||||||
|
auto& from = iter.value();
|
||||||
FS::copy fileCopyOperation(from, to);
|
FS::copy fileCopyOperation(from, to);
|
||||||
if(!fileCopyOperation()) {
|
if (!fileCopyOperation()) {
|
||||||
qWarning() << "Failed to copy" << from << "to" << to;
|
qWarning() << "Failed to copy" << from << "to" << to;
|
||||||
emitFailed(tr("Failed to copy files"));
|
emitFailed(tr("Failed to copy files"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setProgress(i++, m_files_to_copy.size());
|
||||||
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatus(tr("Installing modpack"));
|
setStatus(tr("Installing modpack..."));
|
||||||
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
auto instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg");
|
auto instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg");
|
||||||
auto instanceSettings = std::make_shared<INISettingsObject>(instanceConfigPath);
|
auto instanceSettings = std::make_shared<INISettingsObject>(instanceConfigPath);
|
||||||
@ -205,20 +300,20 @@ void PackInstallTask::install()
|
|||||||
auto components = instance.getPackProfile();
|
auto components = instance.getPackProfile();
|
||||||
components->buildingFromScratch();
|
components->buildingFromScratch();
|
||||||
|
|
||||||
for(auto target : m_version.targets) {
|
for (auto target : m_version.targets) {
|
||||||
if(target.type == "game" && target.name == "minecraft") {
|
if (target.type == "game" && target.name == "minecraft") {
|
||||||
components->setComponentVersion("net.minecraft", target.version, true);
|
components->setComponentVersion("net.minecraft", target.version, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto target : m_version.targets) {
|
for (auto target : m_version.targets) {
|
||||||
if(target.type != "modloader") continue;
|
if (target.type != "modloader")
|
||||||
|
continue;
|
||||||
|
|
||||||
if(target.name == "forge") {
|
if (target.name == "forge") {
|
||||||
components->setComponentVersion("net.minecraftforge", target.version);
|
components->setComponentVersion("net.minecraftforge", target.version);
|
||||||
}
|
} else if (target.name == "fabric") {
|
||||||
else if(target.name == "fabric") {
|
|
||||||
components->setComponentVersion("net.fabricmc.fabric-loader", target.version);
|
components->setComponentVersion("net.fabricmc.fabric-loader", target.version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,4 +340,20 @@ void PackInstallTask::install()
|
|||||||
emitSucceeded();
|
emitSucceeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PackInstallTask::onManifestDownloadFailed(QString reason)
|
||||||
|
{
|
||||||
|
m_net_job.reset();
|
||||||
|
emitFailed(reason);
|
||||||
}
|
}
|
||||||
|
void PackInstallTask::onResolveModsFailed(QString reason)
|
||||||
|
{
|
||||||
|
m_net_job.reset();
|
||||||
|
emitFailed(reason);
|
||||||
|
}
|
||||||
|
void PackInstallTask::onModDownloadFailed(QString reason)
|
||||||
|
{
|
||||||
|
m_net_job.reset();
|
||||||
|
emitFailed(reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ModpacksCH
|
||||||
|
@ -1,18 +1,38 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
|
* PolyMC - Minecraft Launcher
|
||||||
* Copyright 2020-2021 Petr Mrazek <peterix@gmail.com>
|
* Copyright (C) 2022 flowln <flowlnlnln@gmail.com>
|
||||||
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* you may not use this file except in compliance with the License.
|
* it under the terms of the GNU General Public License as published by
|
||||||
* You may obtain a copy of the License at
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* You should have received a copy of the GNU General Public License
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
*
|
||||||
* See the License for the specific language governing permissions and
|
* This file incorporates work covered by the following copyright and
|
||||||
* limitations under the License.
|
* permission notice:
|
||||||
|
*
|
||||||
|
* Copyright 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
|
* Copyright 2020-2021 Petr Mrazek <peterix@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -20,44 +40,60 @@
|
|||||||
#include "FTBPackManifest.h"
|
#include "FTBPackManifest.h"
|
||||||
|
|
||||||
#include "InstanceTask.h"
|
#include "InstanceTask.h"
|
||||||
|
#include "QObjectPtr.h"
|
||||||
|
#include "modplatform/flame/FileResolvingTask.h"
|
||||||
#include "net/NetJob.h"
|
#include "net/NetJob.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
namespace ModpacksCH {
|
namespace ModpacksCH {
|
||||||
|
|
||||||
class PackInstallTask : public InstanceTask
|
class PackInstallTask final : public InstanceTask
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PackInstallTask(Modpack pack, QString version);
|
explicit PackInstallTask(Modpack pack, QString version, QWidget* parent = nullptr);
|
||||||
virtual ~PackInstallTask(){}
|
~PackInstallTask() override = default;
|
||||||
|
|
||||||
bool canAbort() const override { return true; }
|
bool canAbort() const override { return m_abortable; }
|
||||||
bool abort() override;
|
bool abort() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void executeTask() override;
|
void executeTask() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDownloadSucceeded();
|
void onManifestDownloadSucceeded();
|
||||||
void onDownloadFailed(QString reason);
|
void onResolveModsSucceeded();
|
||||||
|
void onModDownloadSucceeded();
|
||||||
|
|
||||||
|
void onManifestDownloadFailed(QString reason);
|
||||||
|
void onResolveModsFailed(QString reason);
|
||||||
|
void onModDownloadFailed(QString reason);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void resolveMods();
|
||||||
void downloadPack();
|
void downloadPack();
|
||||||
void install();
|
void install();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool abortable = false;
|
bool m_abortable = true;
|
||||||
|
|
||||||
NetJob::Ptr jobPtr;
|
NetJob::Ptr m_net_job = nullptr;
|
||||||
QByteArray response;
|
shared_qobject_ptr<Flame::FileResolvingTask> m_mod_id_resolver_task = nullptr;
|
||||||
|
|
||||||
|
QList<int> m_file_id_map;
|
||||||
|
|
||||||
|
QByteArray m_response;
|
||||||
|
|
||||||
Modpack m_pack;
|
Modpack m_pack;
|
||||||
QString m_version_name;
|
QString m_version_name;
|
||||||
Version m_version;
|
Version m_version;
|
||||||
|
|
||||||
QMap<QString, QString> filesToCopy;
|
QMap<QString, QString> m_files_to_copy;
|
||||||
|
|
||||||
|
//FIXME: nuke
|
||||||
|
QWidget* m_parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,37 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright 2020 Jamie Mansfield <jmansfield@cadixdev.org>
|
* PolyMC - Minecraft Launcher
|
||||||
* Copyright 2020-2021 Petr Mrazek <peterix@gmail.com>
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* you may not use this file except in compliance with the License.
|
* it under the terms of the GNU General Public License as published by
|
||||||
* You may obtain a copy of the License at
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* You should have received a copy of the GNU General Public License
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
*
|
||||||
* See the License for the specific language governing permissions and
|
* This file incorporates work covered by the following copyright and
|
||||||
* limitations under the License.
|
* permission notice:
|
||||||
|
*
|
||||||
|
* Copyright 2020 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
|
* Copyright 2020-2021 Petr Mrazek <peterix@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FTBPackManifest.h"
|
#include "FTBPackManifest.h"
|
||||||
@ -127,13 +146,16 @@ static void loadVersionFile(ModpacksCH::VersionFile & a, QJsonObject & obj)
|
|||||||
a.path = Json::requireString(obj, "path");
|
a.path = Json::requireString(obj, "path");
|
||||||
a.name = Json::requireString(obj, "name");
|
a.name = Json::requireString(obj, "name");
|
||||||
a.version = Json::requireString(obj, "version");
|
a.version = Json::requireString(obj, "version");
|
||||||
a.url = Json::requireString(obj, "url");
|
a.url = Json::ensureString(obj, "url"); // optional
|
||||||
a.sha1 = Json::requireString(obj, "sha1");
|
a.sha1 = Json::requireString(obj, "sha1");
|
||||||
a.size = Json::requireInteger(obj, "size");
|
a.size = Json::requireInteger(obj, "size");
|
||||||
a.clientOnly = Json::requireBoolean(obj, "clientonly");
|
a.clientOnly = Json::requireBoolean(obj, "clientonly");
|
||||||
a.serverOnly = Json::requireBoolean(obj, "serveronly");
|
a.serverOnly = Json::requireBoolean(obj, "serveronly");
|
||||||
a.optional = Json::requireBoolean(obj, "optional");
|
a.optional = Json::requireBoolean(obj, "optional");
|
||||||
a.updated = Json::requireInteger(obj, "updated");
|
a.updated = Json::requireInteger(obj, "updated");
|
||||||
|
auto curseforgeObj = Json::ensureObject(obj, "curseforge"); // optional
|
||||||
|
a.curseforge.project_id = Json::ensureInteger(curseforgeObj, "project");
|
||||||
|
a.curseforge.file_id = Json::ensureInteger(curseforgeObj, "file");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModpacksCH::loadVersion(ModpacksCH::Version & m, QJsonObject & obj)
|
void ModpacksCH::loadVersion(ModpacksCH::Version & m, QJsonObject & obj)
|
||||||
|
@ -1,18 +1,37 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
|
* PolyMC - Minecraft Launcher
|
||||||
* Copyright 2020 Petr Mrazek <peterix@gmail.com>
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* you may not use this file except in compliance with the License.
|
* it under the terms of the GNU General Public License as published by
|
||||||
* You may obtain a copy of the License at
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* You should have received a copy of the GNU General Public License
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
*
|
||||||
* See the License for the specific language governing permissions and
|
* This file incorporates work covered by the following copyright and
|
||||||
* limitations under the License.
|
* permission notice:
|
||||||
|
*
|
||||||
|
* Copyright 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
|
* Copyright 2020 Petr Mrazek <peterix@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -97,6 +116,12 @@ struct VersionTarget
|
|||||||
int64_t updated;
|
int64_t updated;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct VersionFileCurseForge
|
||||||
|
{
|
||||||
|
int project_id;
|
||||||
|
int file_id;
|
||||||
|
};
|
||||||
|
|
||||||
struct VersionFile
|
struct VersionFile
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
@ -111,6 +136,7 @@ struct VersionFile
|
|||||||
bool serverOnly;
|
bool serverOnly;
|
||||||
bool optional;
|
bool optional;
|
||||||
int64_t updated;
|
int64_t updated;
|
||||||
|
VersionFileCurseForge curseforge;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Version
|
struct Version
|
||||||
|
@ -43,8 +43,8 @@ void ProgressDialog::setSkipButton(bool present, QString label)
|
|||||||
void ProgressDialog::on_skipButton_clicked(bool checked)
|
void ProgressDialog::on_skipButton_clicked(bool checked)
|
||||||
{
|
{
|
||||||
Q_UNUSED(checked);
|
Q_UNUSED(checked);
|
||||||
task->abort();
|
if (task->abort())
|
||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressDialog::~ProgressDialog()
|
ProgressDialog::~ProgressDialog()
|
||||||
|
@ -32,13 +32,13 @@ class SortProxy : public QSortFilterProxyModel {
|
|||||||
|
|
||||||
const auto& mod = model->at(source_row);
|
const auto& mod = model->at(source_row);
|
||||||
|
|
||||||
if (mod.name().contains(filterRegularExpression()))
|
if (filterRegularExpression().match(mod.name()).hasMatch())
|
||||||
return true;
|
return true;
|
||||||
if (mod.description().contains(filterRegularExpression()))
|
if (filterRegularExpression().match(mod.description()).hasMatch())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (auto& author : mod.authors()) {
|
for (auto& author : mod.authors()) {
|
||||||
if (author.contains(filterRegularExpression())) {
|
if (filterRegularExpression().match(author).hasMatch()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ void ExternalResourcesPage::retranslate()
|
|||||||
void ExternalResourcesPage::filterTextChanged(const QString& newContents)
|
void ExternalResourcesPage::filterTextChanged(const QString& newContents)
|
||||||
{
|
{
|
||||||
m_viewFilter = newContents;
|
m_viewFilter = newContents;
|
||||||
m_filterModel->setFilterFixedString(m_viewFilter);
|
m_filterModel->setFilterRegularExpression(m_viewFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalResourcesPage::runningStateChanged(bool running)
|
void ExternalResourcesPage::runningStateChanged(bool running)
|
||||||
|
@ -349,7 +349,7 @@ void InstanceSettingsPage::loadSettings()
|
|||||||
ui->useDiscreteGpuCheck->setChecked(m_settings->get("UseDiscreteGpu").toBool());
|
ui->useDiscreteGpuCheck->setChecked(m_settings->get("UseDiscreteGpu").toBool());
|
||||||
|
|
||||||
#if !defined(Q_OS_LINUX)
|
#if !defined(Q_OS_LINUX)
|
||||||
ui->perfomanceGroupBox->setVisible(false);
|
ui->settingsTabs->setTabVisible(ui->settingsTabs->indexOf(ui->performancePage), false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Miscellanous
|
// Miscellanous
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* PolyMC - Minecraft Launcher
|
* PolyMC - Minecraft Launcher
|
||||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -126,7 +127,7 @@ void FtbPage::suggestCurrent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->setSuggestedPack(selected.name + " " + selectedVersion, new ModpacksCH::PackInstallTask(selected, selectedVersion));
|
dialog->setSuggestedPack(selected.name + " " + selectedVersion, new ModpacksCH::PackInstallTask(selected, selectedVersion, this));
|
||||||
for(auto art : selected.art) {
|
for(auto art : selected.art) {
|
||||||
if(art.type == "square") {
|
if(art.type == "square") {
|
||||||
QString editedLogoName;
|
QString editedLogoName;
|
||||||
|
Reference in New Issue
Block a user