Add MODL schema handling#24
Conversation
Silarn
commented
May 1, 2026
- 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
97849e2 to
bbae698
Compare
| 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(); | ||
| } |
There was a problem hiding this comment.
These could most likely be merged with an extra argument for the URL type.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| { | ||
| 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); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Same as above, this can probably be merged into a single function with an extra argument.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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. 😅 |
- 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
- We can decide if we want to rename the exe itself later
|
@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. |