mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-09-04 06:00:17 +00:00
Fix settings objects, instances can be started from the GUI now
This commit is contained in:
parent
e4f86893a8
commit
40570c3210
@ -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 )
|
||||
|
@ -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
|
||||
|
@ -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")));
|
||||
|
@ -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!");
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue
Block a user