aboutsummaryrefslogtreecommitdiff
path: root/depends
diff options
context:
space:
mode:
Diffstat (limited to 'depends')
-rw-r--r--depends/launcher/org/multimc/EntryPoint.java36
-rw-r--r--depends/settings/inisettingsobject.cpp5
-rw-r--r--depends/settings/inisettingsobject.h2
-rw-r--r--depends/settings/settingsobject.cpp9
-rw-r--r--depends/settings/settingsobject.h6
5 files changed, 53 insertions, 5 deletions
diff --git a/depends/launcher/org/multimc/EntryPoint.java b/depends/launcher/org/multimc/EntryPoint.java
index e2721ffa..f9fe68d6 100644
--- a/depends/launcher/org/multimc/EntryPoint.java
+++ b/depends/launcher/org/multimc/EntryPoint.java
@@ -29,7 +29,8 @@ public class EntryPoint
private enum Action
{
Proceed,
- Launch
+ Launch,
+ Abort
}
public static void main(String[] args)
@@ -61,27 +62,40 @@ public class EntryPoint
private Action parseLine(String inData) throws ParseException
{
String[] pair = inData.split(" ", 2);
+
+ if(pair.length == 1)
+ {
+ String command = pair[0];
+ if (pair[0].equals("launch"))
+ return Action.Launch;
+
+ else if (pair[0].equals("abort"))
+ return Action.Abort;
+
+ else throw new ParseException();
+ }
+
if(pair.length != 2)
throw new ParseException();
String command = pair[0];
String param = pair[1];
- if(command.equals("launch"))
+ if(command.equals("launcher"))
{
if(param.equals("legacy"))
{
m_launcher = new LegacyLauncher();
Utils.log("Using legacy launcher.");
Utils.log();
- return Action.Launch;
+ return Action.Proceed;
}
if(param.equals("onesix"))
{
m_launcher = new OneSixLauncher();
Utils.log("Using onesix launcher.");
Utils.log();
- return Action.Launch;
+ return Action.Proceed;
}
else
throw new ParseException();
@@ -105,6 +119,7 @@ public class EntryPoint
return 1;
}
boolean isListening = true;
+ boolean isAborted = false;
// Main loop
while (isListening)
{
@@ -115,7 +130,13 @@ public class EntryPoint
inData = buffer.readLine();
if (inData != null)
{
- if(parseLine(inData) == Action.Launch)
+ Action a = parseLine(inData);
+ if(a == Action.Abort)
+ {
+ isListening = false;
+ isAborted = true;
+ }
+ if(a == Action.Launch)
{
isListening = false;
}
@@ -134,6 +155,11 @@ public class EntryPoint
return 1;
}
}
+ if(isAborted)
+ {
+ System.err.println("Launch aborted by MultiMC.");
+ return 1;
+ }
if(m_launcher != null)
{
return m_launcher.launch(m_params);
diff --git a/depends/settings/inisettingsobject.cpp b/depends/settings/inisettingsobject.cpp
index 5e52a56f..2cee8e3c 100644
--- a/depends/settings/inisettingsobject.cpp
+++ b/depends/settings/inisettingsobject.cpp
@@ -28,6 +28,11 @@ void INISettingsObject::setFilePath(const QString &filePath)
m_filePath = filePath;
}
+bool INISettingsObject::reload()
+{
+ return m_ini.loadFile(m_filePath) && SettingsObject::reload();
+}
+
void INISettingsObject::changeSetting(const Setting &setting, QVariant value)
{
if (contains(setting.id()))
diff --git a/depends/settings/inisettingsobject.h b/depends/settings/inisettingsobject.h
index 8badc0c6..12370896 100644
--- a/depends/settings/inisettingsobject.h
+++ b/depends/settings/inisettingsobject.h
@@ -47,6 +47,8 @@ public:
*/
virtual void setFilePath(const QString &filePath);
+ bool reload() override;
+
protected
slots:
virtual void changeSetting(const Setting &setting, QVariant value);
diff --git a/depends/settings/settingsobject.cpp b/depends/settings/settingsobject.cpp
index 43fc989a..0e3030df 100644
--- a/depends/settings/settingsobject.cpp
+++ b/depends/settings/settingsobject.cpp
@@ -126,6 +126,15 @@ bool SettingsObject::contains(const QString &id)
return m_settings.contains(id);
}
+bool SettingsObject::reload()
+{
+ for (auto setting : m_settings.values())
+ {
+ setting->set(setting->get());
+ }
+ return true;
+}
+
void SettingsObject::connectSignals(const Setting &setting)
{
connect(&setting, SIGNAL(settingChanged(const Setting &, QVariant)),
diff --git a/depends/settings/settingsobject.h b/depends/settings/settingsobject.h
index 27746f2d..b1b26b09 100644
--- a/depends/settings/settingsobject.h
+++ b/depends/settings/settingsobject.h
@@ -113,6 +113,12 @@ public:
*/
bool contains(const QString &id);
+ /*!
+ * \brief Reloads the settings and emit signals for changed settings
+ * \return True if reloading was successful
+ */
+ virtual bool reload();
+
signals:
/*!
* \brief Signal emitted when one of this SettingsObject object's settings changes.