summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2026-05-03 03:04:49 -0500
committerGitHub <noreply@github.com>2026-05-03 03:04:49 -0500
commitef7499aade74a148416b5fde7e8c03a75ea381c3 (patch)
tree28b596b09fd5849392d963684e38303ed6ab9b0f /src/settings.cpp
parent2e393aa3cc9adba5a5e82ecc0006b11bf024d3e0 (diff)
Extended MODL / direct download handling (#2384)
* Extended MODL / direct download handling - name, modname, version, and source options added to download command - nxmhandler init adds schemas and MODL entry with default launch args - Add MODL register button to general tab - On window display, call meta function to trigger both registrations
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index ef1785b1..4f484590 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -417,6 +417,35 @@ void Settings::setKeepBackupOnInstall(bool b)
set(m_Settings, "General", "backup_install", b);
}
+void Settings::registerDownloadHandlers(bool force)
+{
+ m_Nexus.registerAsNXMHandler(force);
+ registerAsMODLHandler(force);
+}
+
+void Settings::registerAsMODLHandler(bool force)
+{
+ const auto nxmPath = QCoreApplication::applicationDirPath() + "/" +
+ QString::fromStdWString(AppConfig::nxmHandlerExe());
+
+ const auto executable = QCoreApplication::applicationFilePath();
+
+ QString mode = force ? "forcereg" : "reg";
+ QString parameters = mode + " modl " + m_Game.plugin()->gameShortName();
+ for (const QString& altGame : m_Game.plugin()->validShortNames()) {
+ parameters += "," + altGame;
+ }
+ parameters +=
+ " \"" + executable + "\" \"-n %name% -m %modname% -v %version% -s %source%\"";
+
+ const auto r = shell::Execute(nxmPath, parameters);
+ if (!r.success()) {
+ QMessageBox::critical(
+ nullptr, QObject::tr("Failed"),
+ QObject::tr("Failed to start the helper application: %1").arg(r.toString()));
+ }
+}
+
GameSettings& Settings::game()
{
return m_Game;
@@ -1992,14 +2021,13 @@ void NexusSettings::registerAsNXMHandler(bool force)
const auto executable = QCoreApplication::applicationFilePath();
QString mode = force ? "forcereg" : "reg";
- QString parameters = mode + " " + m_Parent.game().plugin()->gameShortName();
+ QString parameters = mode + " nxm " + m_Parent.game().plugin()->gameShortName();
for (const QString& altGame : m_Parent.game().plugin()->validShortNames()) {
parameters += "," + altGame;
}
parameters += " \"" + executable + "\"";
const auto r = shell::Execute(nxmPath, parameters);
-
if (!r.success()) {
QMessageBox::critical(
nullptr, QObject::tr("Failed"),