summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStiepen <stiepen22@gmx.de>2013-07-14 20:26:53 +0200
committerStiepen <stiepen22@gmx.de>2013-07-14 20:26:53 +0200
commitce253ded0e0d2ae90a971c2e074d561f5e7baeb2 (patch)
treed44cbbd0773b0ab813bc65756d316bffae53942b
parent33b9b25da7d3d29f949c9418295de257d437c9f8 (diff)
downloadMultiMC-ce253ded0e0d2ae90a971c2e074d561f5e7baeb2.tar
MultiMC-ce253ded0e0d2ae90a971c2e074d561f5e7baeb2.tar.gz
MultiMC-ce253ded0e0d2ae90a971c2e074d561f5e7baeb2.tar.lz
MultiMC-ce253ded0e0d2ae90a971c2e074d561f5e7baeb2.tar.xz
MultiMC-ce253ded0e0d2ae90a971c2e074d561f5e7baeb2.zip
Added Per-Instance settings
-rw-r--r--MultiMC.pro9
-rw-r--r--gui/instancesettings.cpp89
-rw-r--r--gui/instancesettings.h32
-rw-r--r--gui/instancesettings.ui386
-rw-r--r--gui/mainwindow.cpp16
5 files changed, 529 insertions, 3 deletions
diff --git a/MultiMC.pro b/MultiMC.pro
index 3f480529..6af1ec0d 100644
--- a/MultiMC.pro
+++ b/MultiMC.pro
@@ -21,7 +21,8 @@ SOURCES += main.cpp\
data/inifile.cpp \
gui/settingsdialog.cpp \
gui/modeditwindow.cpp \
- util/appsettings.cpp
+ util/appsettings.cpp \
+ gui/instancesettings.cpp
HEADERS += gui/mainwindow.h \
data/instancebase.h \
@@ -32,11 +33,13 @@ HEADERS += gui/mainwindow.h \
gui/settingsdialog.h \
gui/modeditwindow.h \
util/apputils.h \
- util/appsettings.h
+ util/appsettings.h \
+ gui/instancesettings.h
FORMS += gui/mainwindow.ui \
gui/settingsdialog.ui \
- gui/modeditwindow.ui
+ gui/modeditwindow.ui \
+ gui/instancesettings.ui
RESOURCES += \
multimc.qrc
diff --git a/gui/instancesettings.cpp b/gui/instancesettings.cpp
new file mode 100644
index 00000000..7e82e1d6
--- /dev/null
+++ b/gui/instancesettings.cpp
@@ -0,0 +1,89 @@
+#include "instancesettings.h"
+#include "ui_instancesettings.h"
+
+InstanceSettings::InstanceSettings(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::InstanceSettings)
+{
+ ui->setupUi(this);
+}
+
+InstanceSettings::~InstanceSettings()
+{
+ delete ui;
+}
+
+void InstanceSettings::on_customCommandsGroupBox_toggled(bool state)
+{
+ ui->labelCustomCmdsDescription->setEnabled(state);
+}
+
+
+void InstanceSettings::applySettings(SettingsObject *s)
+{
+
+ // Console
+ s->set("ShowConsole", ui->showConsoleCheck->isChecked());
+ s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
+ s->set("OverrideConsole", ui->consoleSettingsBox->isChecked());
+
+ // Window Size
+ s->set("LaunchCompatMode", ui->compatModeCheckBox->isChecked());
+ s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
+ s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
+ s->set("MinecraftWinHeight", ui->windowHeightSpinBox->value());
+ s->set("OverrideWindow", ui->windowSizeGroupBox->isChecked());
+
+ // Auto Login
+ s->set("AutoLogin", ui->autoLoginCheckBox->isChecked());
+ s->set("OverrideLogin", ui->accountSettingsGroupBox->isChecked());
+
+ // Memory
+ s->set("MinMemAlloc", ui->minMemSpinBox->value());
+ s->set("MaxMemAlloc", ui->maxMemSpinBox->value());
+ s->set("OverrideMemory", ui->memoryGroupBox->isChecked());
+
+ // Java Settings
+ s->set("JavaPath", ui->javaPathTextBox->text());
+ s->set("JvmArgs", ui->jvmArgsTextBox->text());
+ s->set("OverrideJava", ui->javaSettingsGroupBox->isChecked());
+
+ // Custom Commands
+ s->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
+ s->set("PostExitCommand", ui->postExitCmdTextBox->text());
+ s->set("OverrideCommands", ui->customCommandsGroupBox->isChecked());
+}
+
+void InstanceSettings::loadSettings(SettingsObject *s)
+{
+ // Console
+ ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool());
+ ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool());
+ ui->consoleSettingsBox->setChecked(s->get("OverrideConsole").toBool());
+
+ // Window Size
+ ui->compatModeCheckBox->setChecked(s->get("LaunchCompatMode").toBool());
+ ui->maximizedCheckBox->setChecked(s->get("LaunchMaximized").toBool());
+ ui->windowWidthSpinBox->setValue(s->get("MinecraftWinWidth").toInt());
+ ui->windowHeightSpinBox->setValue(s->get("MinecraftWinHeight").toInt());
+ ui->windowSizeGroupBox->setChecked(s->get("OverrideWindow").toBool());
+
+ // Auto Login
+ ui->autoLoginCheckBox->setChecked(s->get("AutoLogin").toBool());
+ ui->accountSettingsGroupBox->setChecked(s->get("OverrideLogin").toBool());
+
+ // Memory
+ ui->minMemSpinBox->setValue(s->get("MinMemAlloc").toInt());
+ ui->maxMemSpinBox->setValue(s->get("MaxMemAlloc").toInt());
+ ui->memoryGroupBox->setChecked(s->get("OverrideMemory").toBool());
+
+ // Java Settings
+ ui->javaPathTextBox->setText(s->get("JavaPath").toString());
+ ui->jvmArgsTextBox->setText(s->get("JvmArgs").toString());
+ ui->javaSettingsGroupBox->setChecked(s->get("OverrideJava").toBool());
+
+ // Custom Commands
+ ui->preLaunchCmdTextBox->setText(s->get("PreLaunchCommand").toString());
+ ui->postExitCmdTextBox->setText(s->get("PostExitCommand").toString());
+ ui->customCommandsGroupBox->setChecked(s->get("OverrideCommands").toBool());
+}
diff --git a/gui/instancesettings.h b/gui/instancesettings.h
new file mode 100644
index 00000000..af75a0f1
--- /dev/null
+++ b/gui/instancesettings.h
@@ -0,0 +1,32 @@
+#ifndef INSTANCESETTINGS_H
+#define INSTANCESETTINGS_H
+
+#include <QDialog>
+
+namespace Ui {
+class InstanceSettings;
+}
+
+class InstanceSettings : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit InstanceSettings(QWidget *parent = 0);
+ ~InstanceSettings();
+
+ void updateCheckboxStuff();
+
+ void applySettings(SettingsObject *s);
+ void loadSettings(SettingsObject* s);
+
+private slots:
+ void on_overrideGlobalMcCheck_clicked(bool checked);
+
+ void on_customCommandsGroupBox_toggled(bool arg1);
+
+private:
+ Ui::InstanceSettings *ui;
+};
+
+#endif // INSTANCESETTINGS_H
diff --git a/gui/instancesettings.ui b/gui/instancesettings.ui
new file mode 100644
index 00000000..1fb8b023
--- /dev/null
+++ b/gui/instancesettings.ui
@@ -0,0 +1,386 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>InstanceSettings</class>
+ <widget class="QDialog" name="InstanceSettings">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>453</width>
+ <height>563</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <widget class="QTabWidget" name="settingsTabs">
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>9</y>
+ <width>435</width>
+ <height>516</height>
+ </rect>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Rounded</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="minecraftTab">
+ <attribute name="title">
+ <string>Minecraft</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="windowSizeGroupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>Window Size</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QCheckBox" name="compatModeCheckBox">
+ <property name="text">
+ <string>Compatibility mode?</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="maximizedCheckBox">
+ <property name="text">
+ <string>Start Minecraft maximized?</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayoutWindowSize">
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelWindowHeight">
+ <property name="text">
+ <string>Window height:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelWindowWidth">
+ <property name="text">
+ <string>Window width:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="windowWidthSpinBox">
+ <property name="minimum">
+ <number>854</number>
+ </property>
+ <property name="maximum">
+ <number>65536</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>854</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="windowHeightSpinBox">
+ <property name="minimum">
+ <number>480</number>
+ </property>
+ <property name="maximum">
+ <number>65536</number>
+ </property>
+ <property name="value">
+ <number>480</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="consoleSettingsBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>Console Settings</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="showConsoleCheck">
+ <property name="text">
+ <string>Show console while the game is running?</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="autoCloseConsoleCheck">
+ <property name="text">
+ <string>Automatically close console when the game quits?</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="accountSettingsGroupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>Account Settings</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <widget class="QCheckBox" name="autoLoginChecBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Login automatically when an instance icon is double clicked?</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacerMinecraft">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="javaTab">
+ <attribute name="title">
+ <string>Java</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QGroupBox" name="memoryGroupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>Memory</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="maxMemSpinBox">
+ <property name="minimum">
+ <number>512</number>
+ </property>
+ <property name="maximum">
+ <number>65536</number>
+ </property>
+ <property name="singleStep">
+ <number>128</number>
+ </property>
+ <property name="value">
+ <number>1024</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelMinMem">
+ <property name="text">
+ <string>Minimum memory allocation:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelMaxMem">
+ <property name="text">
+ <string>Maximum memory allocation:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="minMemSpinBox">
+ <property name="minimum">
+ <number>256</number>
+ </property>
+ <property name="maximum">
+ <number>65536</number>
+ </property>
+ <property name="singleStep">
+ <number>128</number>
+ </property>
+ <property name="value">
+ <number>256</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="javaSettingsGroupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>Java Settings</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelJavaPath">
+ <property name="text">
+ <string>Java path:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="javaPathTextBox"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelJVMArgs">
+ <property name="text">
+ <string>JVM arguments:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="pushButton">
+ <property name="text">
+ <string>Auto-detect</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QLineEdit" name="jvmArgsTextBox"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="customCommandsGroupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>Custom Commands</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelPostExitCmd">
+ <property name="text">
+ <string>Post-exit command:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelPreLaunchCmd">
+ <property name="text">
+ <string>Pre-launch command:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="preLaunchCmdTextBox"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="postExitCmdTextBox"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelCustomCmdsDescription">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Pre-launch command runs before the instance launches and post-exit command runs after it exits. Both will be run in MultiMC's working directory with INST_ID, INST_DIR, and INST_NAME as environment variables.</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="geometry">
+ <rect>
+ <x>270</x>
+ <y>530</y>
+ <width>166</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 8ba988c5..0b592cf0 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -553,3 +553,19 @@ void MainWindow::on_actionChangeInstLWJGLVersion_triggered()
}
}
+
+void MainWindow::on_actionInstanceSettings_triggered()
+{
+ if (view->selectionModel()->selectedIndexes().count() < 1)
+ return;
+
+ Instance *inst = selectedInstance();
+ SettingsObject *s;
+ s = &inst->settings();
+ InstanceSettings *settings = new InstanceSettings (this);
+ settings->loadSettings(s);
+ if (settings->exec()) {
+ settings->applySettings(s);
+ }
+ delete settings;
+}