Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into metadata2

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-06-28 20:30:05 +03:00
commit 72dd3dfba5
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
67 changed files with 97 additions and 103 deletions

View File

@ -938,8 +938,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
[[fallthrough]]; [[fallthrough]];
default: { default: {
qDebug() << "Exiting because update lockfile is present"; qDebug() << "Exiting because update lockfile is present";
QMetaObject::invokeMethod( QMetaObject::invokeMethod(this, []() { exit(1); }, Qt::QueuedConnection);
this, []() { exit(1); }, Qt::QueuedConnection);
return; return;
} }
} }
@ -971,8 +970,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
[[fallthrough]]; [[fallthrough]];
default: { default: {
qDebug() << "Exiting because update lockfile is present"; qDebug() << "Exiting because update lockfile is present";
QMetaObject::invokeMethod( QMetaObject::invokeMethod(this, []() { exit(1); }, Qt::QueuedConnection);
this, []() { exit(1); }, Qt::QueuedConnection);
return; return;
} }
} }
@ -1666,8 +1664,7 @@ QString Application::getJarPath(QString jarFile)
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
FS::PathCombine(m_rootPath, "share", BuildConfig.LAUNCHER_NAME), FS::PathCombine(m_rootPath, "share", BuildConfig.LAUNCHER_NAME),
#endif #endif
FS::PathCombine(m_rootPath, "jars"), FS::PathCombine(m_rootPath, "jars"), FS::PathCombine(applicationDirPath(), "jars"),
FS::PathCombine(applicationDirPath(), "jars"),
FS::PathCombine(applicationDirPath(), "..", "jars") // from inside build dir, for debuging FS::PathCombine(applicationDirPath(), "..", "jars") // from inside build dir, for debuging
}; };
for (QString p : potentialPaths) { for (QString p : potentialPaths) {

View File

@ -79,11 +79,9 @@ QProcessEnvironment CleanEnviroment()
QStringList stripped = { QStringList stripped = {
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
"LD_LIBRARY_PATH", "LD_LIBRARY_PATH", "LD_PRELOAD",
"LD_PRELOAD",
#endif #endif
"QT_PLUGIN_PATH", "QT_PLUGIN_PATH", "QT_FONTPATH"
"QT_FONTPATH"
}; };
for (auto key : rawenv.keys()) { for (auto key : rawenv.keys()) {
auto value = rawenv.value(key); auto value = rawenv.value(key);

View File

@ -282,8 +282,7 @@ void ResourceFolderModel::resolveResource(Resource* res)
connect( connect(
task.get(), &Task::succeeded, this, [=] { onParseSucceeded(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection); task.get(), &Task::succeeded, this, [=] { onParseSucceeded(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
connect( connect(task.get(), &Task::failed, this, [=] { onParseFailed(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
task.get(), &Task::failed, this, [=] { onParseFailed(ticket, res->internal_id()); }, Qt::ConnectionType::QueuedConnection);
connect( connect(
task.get(), &Task::finished, this, task.get(), &Task::finished, this,
[=] { [=] {

View File

@ -131,8 +131,9 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArra
pack.versionsLoaded = true; pack.versionsLoaded = true;
} }
auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_type, QString preferred_file_name) auto Modrinth::loadIndexedPackVersion(QJsonObject& obj,
-> ModPlatform::IndexedVersion QString preferred_hash_type,
QString preferred_file_name) -> ModPlatform::IndexedVersion
{ {
ModPlatform::IndexedVersion file; ModPlatform::IndexedVersion file;
@ -246,8 +247,9 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t
return {}; return {};
} }
auto Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Dependency& m, QJsonArray& arr, const BaseInstance* inst) auto Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Dependency& m,
-> ModPlatform::IndexedVersion QJsonArray& arr,
const BaseInstance* inst) -> ModPlatform::IndexedVersion
{ {
auto profile = (dynamic_cast<const MinecraftInstance*>(inst))->getPackProfile(); auto profile = (dynamic_cast<const MinecraftInstance*>(inst))->getPackProfile();
QString mcVersion = profile->getComponentVersion("net.minecraft"); QString mcVersion = profile->getComponentVersion("net.minecraft");

View File

@ -90,8 +90,9 @@ auto intEntry(toml::table table, QString entry_name) -> int
return node.value_or(0); return node.value_or(0);
} }
auto V1::createModFormat([[maybe_unused]] QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version) auto V1::createModFormat([[maybe_unused]] QDir& index_dir,
-> Mod ModPlatform::IndexedPack& mod_pack,
ModPlatform::IndexedVersion& mod_version) -> Mod
{ {
Mod mod; Mod mod;

View File

@ -92,17 +92,15 @@ void ModUpdateDialog::checkCandidates()
if (!m_modrinth_to_update.empty()) { if (!m_modrinth_to_update.empty()) {
m_modrinth_check_task.reset(new ModrinthCheckUpdate(m_modrinth_to_update, versions, loaders, m_mod_model)); m_modrinth_check_task.reset(new ModrinthCheckUpdate(m_modrinth_to_update, versions, loaders, m_mod_model));
connect(m_modrinth_check_task.get(), &CheckUpdateTask::checkFailed, this, [this](Mod* mod, QString reason, QUrl recover_url) { connect(m_modrinth_check_task.get(), &CheckUpdateTask::checkFailed, this,
m_failed_check_update.append({ mod, reason, recover_url }); [this](Mod* mod, QString reason, QUrl recover_url) { m_failed_check_update.append({ mod, reason, recover_url }); });
});
check_task.addTask(m_modrinth_check_task); check_task.addTask(m_modrinth_check_task);
} }
if (!m_flame_to_update.empty()) { if (!m_flame_to_update.empty()) {
m_flame_check_task.reset(new FlameCheckUpdate(m_flame_to_update, versions, loaders, m_mod_model)); m_flame_check_task.reset(new FlameCheckUpdate(m_flame_to_update, versions, loaders, m_mod_model));
connect(m_flame_check_task.get(), &CheckUpdateTask::checkFailed, this, [this](Mod* mod, QString reason, QUrl recover_url) { connect(m_flame_check_task.get(), &CheckUpdateTask::checkFailed, this,
m_failed_check_update.append({ mod, reason, recover_url }); [this](Mod* mod, QString reason, QUrl recover_url) { m_failed_check_update.append({ mod, reason, recover_url }); });
});
check_task.addTask(m_flame_check_task); check_task.addTask(m_flame_check_task);
} }

View File

@ -469,8 +469,7 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar
target_dir = QDir(m_rootPath).absoluteFilePath(".."); target_dir = QDir(m_rootPath).absoluteFilePath("..");
} }
QMetaObject::invokeMethod( QMetaObject::invokeMethod(this, [this, target_dir]() { moveAndFinishUpdate(target_dir); }, Qt::QueuedConnection);
this, [this, target_dir]() { moveAndFinishUpdate(target_dir); }, Qt::QueuedConnection);
} else { } else {
QMetaObject::invokeMethod(this, &PrismUpdaterApp::loadReleaseList, Qt::QueuedConnection); QMetaObject::invokeMethod(this, &PrismUpdaterApp::loadReleaseList, Qt::QueuedConnection);

View File

@ -24,10 +24,7 @@ class Reader {
virtual void goToBeginning() = 0; virtual void goToBeginning() = 0;
}; };
uint32_t hash( uint32_t hash(Reader* file_stream, std::size_t buffer_size = 4 * MiB, std::function<bool(char)> filter_out = [](char) { return false; });
Reader* file_stream,
std::size_t buffer_size = 4 * MiB,
std::function<bool(char)> filter_out = [](char) { return false; });
struct IncrementalHashInfo { struct IncrementalHashInfo {
uint32_t h; uint32_t h;

View File

@ -19,7 +19,7 @@
}; };
}; };
tools.clang-tools = lib.mkForce pkgs.clang-tools_16; tools.clang-tools = lib.mkForce pkgs.clang-tools_18;
}; };
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {

View File

@ -203,7 +203,10 @@ class ResourceFolderModelTest : public QObject {
QCOMPARE(model.size(), 0); QCOMPARE(model.size(), 0);
{ EXEC_UPDATE_TASK(model.installResource(folder_resource), QVERIFY) } { {
EXEC_UPDATE_TASK(model.installResource(folder_resource), QVERIFY)
}
{
EXEC_UPDATE_TASK(model.installResource(file_mod), QVERIFY) EXEC_UPDATE_TASK(model.installResource(file_mod), QVERIFY)
} }