Launch an editor for the custom.json file. Also allow overriding of the system default editor
This commit is contained in:
parent
654f444f55
commit
3380bc7563
8 changed files with 117 additions and 5 deletions
18
MultiMC.cpp
18
MultiMC.cpp
|
@ -8,6 +8,7 @@
|
|||
#include <QLibraryInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QStringList>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include "gui/dialogs/VersionSelectDialog.h"
|
||||
#include "logic/lists/InstanceList.h"
|
||||
|
@ -382,6 +383,9 @@ void MultiMC::initGlobalSettings()
|
|||
m_settings->registerSetting(new Setting("CentralModsDir", "mods"));
|
||||
m_settings->registerSetting(new Setting("LWJGLDir", "lwjgl"));
|
||||
|
||||
// Editors
|
||||
m_settings->registerSetting(new Setting("JsonEditor", QString()));
|
||||
|
||||
// Console
|
||||
m_settings->registerSetting(new Setting("ShowConsole", true));
|
||||
m_settings->registerSetting(new Setting("AutoCloseConsole", true));
|
||||
|
@ -550,4 +554,18 @@ QString MultiMC::getExitUpdatePath() const
|
|||
return m_updateOnExitPath;
|
||||
}
|
||||
|
||||
void MultiMC::openJsonEditor(const QString &filename)
|
||||
{
|
||||
const QString file = QDir::current().absoluteFilePath(filename);
|
||||
if (m_settings->get("JsonEditor").toString().isEmpty())
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(file));
|
||||
}
|
||||
else
|
||||
{
|
||||
QProcess::startDetached(m_settings->get("JsonEditor").toString(),
|
||||
QStringList() << file);
|
||||
}
|
||||
}
|
||||
|
||||
#include "MultiMC.moc"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue