summaryrefslogtreecommitdiffstats
path: root/application/main.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-09-30 00:11:00 +0200
committerPetr Mrázek <peterix@gmail.com>2015-09-30 00:11:00 +0200
commite2fd299fc588962b19b91d3e11f7bf274080de84 (patch)
treeec3ac3be97edfc42976847ceb50fd8adf4cf1fd2 /application/main.cpp
parente993b1152df6ba7ca343e66263f2860e4c4ecee6 (diff)
downloadMultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.tar
MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.tar.gz
MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.tar.lz
MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.tar.xz
MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.zip
GH-253 implement launching instances from command line
Diffstat (limited to 'application/main.cpp')
-rw-r--r--application/main.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/application/main.cpp b/application/main.cpp
index 12c97f09..c134facb 100644
--- a/application/main.cpp
+++ b/application/main.cpp
@@ -1,10 +1,11 @@
#include "MultiMC.h"
#include "MainWindow.h"
+#include "LaunchInteraction.h"
+#include <InstanceList.h>
+#include <QDebug>
-int main_gui(MultiMC &app)
+int launchMainWindow(MultiMC &app)
{
- // show main window
- app.setIconTheme(MMC->settings()->get("IconTheme").toString());
MainWindow mainWin;
mainWin.restoreState(QByteArray::fromBase64(MMC->settings()->get("MainWindowState").toByteArray()));
mainWin.restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("MainWindowGeometry").toByteArray()));
@@ -13,6 +14,29 @@ int main_gui(MultiMC &app)
mainWin.checkInstancePathForProblems();
return app.exec();
}
+
+int launchInstance(MultiMC &app, InstancePtr inst)
+{
+ app.minecraftlist();
+ LaunchController launchController;
+ launchController.setInstance(inst);
+ launchController.setOnline(true);
+ launchController.launch();
+ return app.exec();
+}
+
+int main_gui(MultiMC &app)
+{
+ app.setIconTheme(MMC->settings()->get("IconTheme").toString());
+ // show main window
+ auto inst = app.instances()->getInstanceById(app.launchId);
+ if(inst)
+ {
+ return launchInstance(app, inst);
+ }
+ return launchMainWindow(app);
+}
+
int main(int argc, char *argv[])
{
// initialize Qt