diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2013-12-29 17:51:16 +0100 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2013-12-29 17:51:16 +0100 |
commit | 3380bc75633c63e8569b76981ac29528c58943ce (patch) | |
tree | 50df3e448edcb6ecfc68702698b318609327f360 /MultiMC.cpp | |
parent | 654f444f55de58f5cf0477e3b08b8f18e8d60831 (diff) | |
download | MultiMC-3380bc75633c63e8569b76981ac29528c58943ce.tar MultiMC-3380bc75633c63e8569b76981ac29528c58943ce.tar.gz MultiMC-3380bc75633c63e8569b76981ac29528c58943ce.tar.lz MultiMC-3380bc75633c63e8569b76981ac29528c58943ce.tar.xz MultiMC-3380bc75633c63e8569b76981ac29528c58943ce.zip |
Launch an editor for the custom.json file. Also allow overriding of the system default editor
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r-- | MultiMC.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp index 71d0e5a7..24cdd077 100644 --- a/MultiMC.cpp +++ b/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" |