summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-03-24 15:36:00 +0100
committerPetr Mrázek <peterix@gmail.com>2013-03-24 15:36:00 +0100
commit40570c321069b832722b807227fd8ff9bbd7c10d (patch)
treec29a37baba94726c27ef2c19ab3d81980cb43abb
parente4f86893a899ee86cfa6d238f891bec04977c966 (diff)
downloadMultiMC-40570c321069b832722b807227fd8ff9bbd7c10d.tar
MultiMC-40570c321069b832722b807227fd8ff9bbd7c10d.tar.gz
MultiMC-40570c321069b832722b807227fd8ff9bbd7c10d.tar.lz
MultiMC-40570c321069b832722b807227fd8ff9bbd7c10d.tar.xz
MultiMC-40570c321069b832722b807227fd8ff9bbd7c10d.zip
Fix settings objects, instances can be started from the GUI now
-rw-r--r--gui/mainwindow.cpp20
-rw-r--r--gui/mainwindow.h4
-rw-r--r--libmultimc/src/instance.cpp6
-rw-r--r--libmultimc/src/minecraftprocess.cpp7
-rw-r--r--libsettings/src/basicsettingsobject.cpp5
-rw-r--r--libsettings/src/inisettingsobject.cpp5
-rw-r--r--libsettings/src/setting.cpp9
-rw-r--r--resources/icons/instances/clucker.svg12
8 files changed, 56 insertions, 12 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 5a915e8c..408a61c5 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -39,6 +39,7 @@
#include "gui/taskdialog.h"
#include "gui/browserdialog.h"
#include "gui/aboutdialog.h"
+#include "gui/consolewindow.h"
#include "kcategorizedview.h"
#include "kcategorydrawer.h"
@@ -49,6 +50,7 @@
#include "logintask.h"
#include <instance.h>
+#include "minecraftprocess.h"
#include "instancemodel.h"
#include "instancedelegate.h"
@@ -276,9 +278,27 @@ void MainWindow::doLogin ( QString inst, const QString& errorMsg )
void MainWindow::onLoginComplete ( QString inst, LoginResponse response )
{
+ // TODO: console
+ console = new ConsoleWindow();
+ auto instance = instList.getInstanceById(inst);
+ if(instance)
+ {
+ proc = new MinecraftProcess(instance, response.username(), response.sessionID());
+
+ console->show();
+ //connect(proc, SIGNAL(ended()), SLOT(onTerminated()));
+ connect(proc, SIGNAL(log(QString,MessageLevel::Enum)), console, SLOT(write(QString,MessageLevel::Enum)));
+ proc->launch();
+ }
+ else
+ {
+
+ }
+ /*
QMessageBox::information ( this, "Login Successful",
QString ( "Logged in as %1 with session ID %2. Instance: %3" ).
arg ( response.username(), response.sessionID(), inst ) );
+ */
}
void MainWindow::onLoginFailed ( QString inst, const QString& errorMsg )
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index 5d990639..eec09972 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -26,6 +26,8 @@ class InstanceModel;
class InstanceProxyModel;
class KCategorizedView;
class KCategoryDrawer;
+class MinecraftProcess;
+class ConsoleWindow;
namespace Ui
{
@@ -94,6 +96,8 @@ private:
InstanceModel * model;
InstanceProxyModel * proxymodel;
InstanceList instList;
+ MinecraftProcess *proc;
+ ConsoleWindow *console;
};
#endif // MAINWINDOW_H
diff --git a/libmultimc/src/instance.cpp b/libmultimc/src/instance.cpp
index 1af359d1..f9e105c7 100644
--- a/libmultimc/src/instance.cpp
+++ b/libmultimc/src/instance.cpp
@@ -48,6 +48,12 @@ Instance::Instance(const QString &rootDir, QObject *parent) :
settings().registerSetting(new OverrideSetting("PostExitCommand",
globalSettings->getSetting("PostExitCommand")));
+ // Window Size
+ settings().registerSetting(new OverrideSetting("LaunchCompatMode", globalSettings->getSetting("LaunchCompatMode")));
+ settings().registerSetting(new OverrideSetting("LaunchMaximized", globalSettings->getSetting("LaunchMaximized")));
+ settings().registerSetting(new OverrideSetting("MinecraftWinWidth", globalSettings->getSetting("MinecraftWinWidth")));
+ settings().registerSetting(new OverrideSetting("MinecraftWinHeight", globalSettings->getSetting("MinecraftWinHeight")));
+
// Memory
settings().registerSetting(new OverrideSetting("MinMemAlloc", globalSettings->getSetting("MinMemAlloc")));
settings().registerSetting(new OverrideSetting("MaxMemAlloc", globalSettings->getSetting("MaxMemAlloc")));
diff --git a/libmultimc/src/minecraftprocess.cpp b/libmultimc/src/minecraftprocess.cpp
index e22a536c..1239bc3a 100644
--- a/libmultimc/src/minecraftprocess.cpp
+++ b/libmultimc/src/minecraftprocess.cpp
@@ -182,9 +182,10 @@ void MinecraftProcess::launch()
genArgs();
emit log(QString("Minecraft folder is: '%1'").arg(workingDirectory()));
- emit log(QString("Instance launched with arguments: '%1'").arg(m_arguments.join("' '")));
-
- start(m_instance->settings().get("JavaPath").toString(), m_arguments);
+ QString JavaPath = m_instance->settings().get("JavaPath").toString();
+ emit log(QString("Java path: '%1'").arg(JavaPath));
+ emit log(QString("Arguments: '%1'").arg(m_arguments.join("' '")));
+ start(JavaPath, m_arguments);
if (!waitForStarted())
{
emit log("Could not launch minecraft!");
diff --git a/libsettings/src/basicsettingsobject.cpp b/libsettings/src/basicsettingsobject.cpp
index 66a2c2c8..484928c8 100644
--- a/libsettings/src/basicsettingsobject.cpp
+++ b/libsettings/src/basicsettingsobject.cpp
@@ -26,7 +26,10 @@ void BasicSettingsObject::changeSetting(const Setting &setting, QVariant value)
{
if (contains(setting.id()))
{
- config.setValue(setting.configKey(), value);
+ if(value.isValid())
+ config.setValue(setting.configKey(), value);
+ else
+ config.remove(setting.configKey());
}
}
diff --git a/libsettings/src/inisettingsobject.cpp b/libsettings/src/inisettingsobject.cpp
index 75228865..8c4cc89d 100644
--- a/libsettings/src/inisettingsobject.cpp
+++ b/libsettings/src/inisettingsobject.cpp
@@ -32,7 +32,10 @@ void INISettingsObject::changeSetting(const Setting &setting, QVariant value)
{
if (contains(setting.id()))
{
- m_ini.set(setting.configKey(), value);
+ if(value.isValid())
+ m_ini.set(setting.configKey(), value);
+ else
+ m_ini.remove(setting.configKey());
}
}
diff --git a/libsettings/src/setting.cpp b/libsettings/src/setting.cpp
index a224ad39..1a4f9e13 100644
--- a/libsettings/src/setting.cpp
+++ b/libsettings/src/setting.cpp
@@ -26,9 +26,16 @@ QVariant Setting::get() const
{
SettingsObject *sbase = qobject_cast<SettingsObject *>(parent());
if (!sbase)
+ {
return defValue();
+ }
else
- return sbase->retrieveValue(*this);
+ {
+ QVariant test = sbase->retrieveValue(*this);
+ if(!test.isValid())
+ return defValue();
+ return test;
+ }
}
QVariant Setting::defValue() const
diff --git a/resources/icons/instances/clucker.svg b/resources/icons/instances/clucker.svg
index 3ce6ad5c..0c1727eb 100644
--- a/resources/icons/instances/clucker.svg
+++ b/resources/icons/instances/clucker.svg
@@ -14,7 +14,7 @@
height="32"
id="svg2"
version="1.1"
- inkscape:version="0.48.3.1 r9886"
+ inkscape:version="0.48.4 r9939"
sodipodi:docname="clucker.svg"
inkscape:export-filename="/home/peterix/projects/MultiMC4/src/resources/insticons/chicken128.png"
inkscape:export-xdpi="360"
@@ -234,13 +234,13 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="2"
- inkscape:cx="-92.12757"
- inkscape:cy="71.871222"
+ inkscape:zoom="11.313708"
+ inkscape:cx="2.6058272"
+ inkscape:cy="11.408405"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="1607"
+ inkscape:window-width="1614"
inkscape:window-height="1030"
inkscape:window-x="1676"
inkscape:window-y="-3"
@@ -261,7 +261,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>