Skip to content

Add MODL schema handling#24

Merged
Silarn merged 7 commits into
masterfrom
dev/modl-handler
May 4, 2026
Merged

Add MODL schema handling#24
Silarn merged 7 commits into
masterfrom
dev/modl-handler

Conversation

@Silarn

@Silarn Silarn commented May 1, 2026

Copy link
Copy Markdown
Member
  • Extends entries with 'schema' attribute
  • Adds ability to init games with an arg string
  • MODL URIs will parse 'name' 'modname' 'version' and 'source' parameters
  • Utilizes replacement strings in the launch arg
  • Should automigrate old entries to 'nxm' schema
  • Should automatically ask to register for MODL

@Silarn Silarn requested review from Al12rs and Holt59 May 1, 2026 03:56
@Silarn Silarn force-pushed the dev/modl-handler branch 2 times, most recently from 97849e2 to bbae698 Compare May 2, 2026 05:09
Comment thread src/handlerstorage.cpp Outdated
Comment on lines +26 to +48
void HandlerStorage::registerNxmProxy(const QString& proxyPath)
{
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes\\nxm\\", QSettings::NativeFormat);
QString myExe = QString("\"%1\" ").arg(QDir::toNativeSeparators(proxyPath)).append("\"%1\"");
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes\\nxm\\",
QSettings::NativeFormat);
QString myExe =
QString("\"%1\" ").arg(QDir::toNativeSeparators(proxyPath)).append("\"%1\"");
settings.setValue("Default", "URL:NXM Protocol");
settings.setValue("URL Protocol", "");
settings.setValue("shell/open/command/Default", myExe);
settings.sync();
}

void HandlerStorage::registerHandler(const QString &executable, const QString &arguments, bool prepend)
void HandlerStorage::registerModlProxy(const QString& proxyPath)
{
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes\\modl\\",
QSettings::NativeFormat);
QString myExe =
QString("\"%1\" ").arg(QDir::toNativeSeparators(proxyPath)).append("\"%1\"");
settings.setValue("Default", "URL:MODL Protocol");
settings.setValue("URL Protocol", "");
settings.setValue("shell/open/command/Default", myExe);
settings.sync();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could most likely be merged with an extra argument for the URL type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking I might do something like this to potentially support additional schemas. Though I'm not sure how that would work unless we assume they would follow some basic rules, like the game being the domain and data being passed by parameter.

Honestly one thing we aren't doing at the moment is trying to enforce the actual game when passing the download over, which we might want to do.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we only pass the URL to the final handler, so I don't think it's worth separating the two. If we want to extract information in NXM Handler and then forward it to the actual handler, that would probably require a bit more work to allow the user to customize the way the handler passes the information, and I think we can postpone this for now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think adding an argument to tell MO2 which game the download is for would be good, but expanding the schema handling is definitely a next iteration idea.

Though it might be nice to be able to dynamically add and assign parameters as well, if we go that route.

Comment thread src/handlerwindow.cpp Outdated
Comment on lines +35 to +53
{
if (handlerPath == QCoreApplication::applicationFilePath()) {
ui->registerButton->setEnabled(false);
ui->handlerView->setText(tr("<Current>"));
ui->registerNXMButton->setEnabled(false);
ui->nxmHandlerView->setText(tr("<Current>"));
} else {
ui->handlerView->setText(handlerPath);
ui->nxmHandlerView->setText(handlerPath);
}
}

void HandlerWindow::setHandlerStorage(HandlerStorage *storage)
void HandlerWindow::setMODLHandler(const QString& handlerPath)
{
if (handlerPath == QCoreApplication::applicationFilePath()) {
ui->registerMODLButton->setEnabled(false);
ui->modlHandlerView->setText(tr("<Current>"));
} else {
ui->modlHandlerView->setText(handlerPath);
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, this can probably be merged into a single function with an extra argument.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are actual UI elements, I'm not sure how much a unified function would benefit here? You're just changing it to a big if statement instead.

@Holt59 Holt59 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think another PR should be made for clang formatting because as it is it's hard to distinguish between simple formatting change vs. actual changes when reviewing. I can do it, you would just need to rebase this branch.

@Silarn

Silarn commented May 3, 2026

Copy link
Copy Markdown
Member Author

I think another PR should be made for clang formatting because as it is it's hard to distinguish between simple formatting change vs. actual changes when reviewing. I can do it, you would just need to rebase this branch.

Well I did put that in a separate commit so you could see the changes independently, but that's fine.

@Holt59

Holt59 commented May 3, 2026

Copy link
Copy Markdown
Member

I think another PR should be made for clang formatting because as it is it's hard to distinguish between simple formatting change vs. actual changes when reviewing. I can do it, you would just need to rebase this branch.

Well I did put that in a separate commit so you could see the changes independently, but that's fine.

I mostly use the "Files Changed" view to see all the changes at once to avoid going commit-by-commit. 😅

Silarn added 4 commits May 3, 2026 14:09
- Extends entries with 'schema' attribute
- Adds ability to init games with an arg string
- MODL URIs will parse 'name' 'modname' 'version' and 'source' parameters
- Utilizes replacement strings in the launch arg
- Should automigrate old entries to 'nxm' schema
- Should automatically ask to register for MODL
@Silarn Silarn force-pushed the dev/modl-handler branch from dbc74e6 to c3634f8 Compare May 3, 2026 19:11
@Silarn Silarn requested a review from Holt59 May 3, 2026 22:50
@Silarn

Silarn commented May 4, 2026

Copy link
Copy Markdown
Member Author

@Holt59 doesn't look like we have the squash and merge workflow set up here. Would you prefer I squash this first?

@Holt59

Holt59 commented May 4, 2026

Copy link
Copy Markdown
Member

@Holt59 doesn't look like we have the squash and merge workflow set up here. Would you prefer I squash this first?

Yes, it's better IMO, I updated the settings. I did not squash the previous PR because I needed to keep the exact commit hash for the git-blame-ignore-revs file.

@Silarn Silarn merged commit 374eead into master May 4, 2026
4 checks passed
@Silarn Silarn deleted the dev/modl-handler branch May 4, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants