From fce0f5df045f1d956cabeda41406001a037c9ab7 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 14 Jan 2013 17:42:38 -0600 Subject: Added stuff. --- data/appsettings.cpp | 22 ++++++++++++++ data/appsettings.h | 27 +++++++++++++++++ data/inifile.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++ data/inifile.h | 36 ++++++++++++++++++++++ data/instancebase.cpp | 22 ++++++++------ data/instancebase.h | 13 ++++---- data/instancelist.cpp | 52 ++++++++++++++++++++++++++++++++ data/instancelist.h | 38 +++++++++++++++++++++++ data/settingsbase.cpp | 22 ++++++++++++++ data/settingsbase.h | 33 ++++++++++++++++++++ data/settingsmacros.h | 35 ++++++++++++++++++++++ data/settingsmacrosundef.h | 26 ++++++++++++++++ data/stdinstance.cpp | 22 ++++++++++++++ data/stdinstance.h | 28 +++++++++++++++++ 14 files changed, 436 insertions(+), 15 deletions(-) create mode 100644 data/appsettings.cpp create mode 100644 data/appsettings.h create mode 100644 data/inifile.cpp create mode 100644 data/inifile.h create mode 100644 data/instancelist.cpp create mode 100644 data/instancelist.h create mode 100644 data/settingsbase.cpp create mode 100644 data/settingsbase.h create mode 100644 data/settingsmacros.h create mode 100644 data/settingsmacrosundef.h create mode 100644 data/stdinstance.cpp create mode 100644 data/stdinstance.h (limited to 'data') diff --git a/data/appsettings.cpp b/data/appsettings.cpp new file mode 100644 index 00000000..525def6e --- /dev/null +++ b/data/appsettings.cpp @@ -0,0 +1,22 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "appsettings.h" + +AppSettings::AppSettings(QString fileName) : + SettingsBase(fileName) +{ + +} diff --git a/data/appsettings.h b/data/appsettings.h new file mode 100644 index 00000000..f8c7ff73 --- /dev/null +++ b/data/appsettings.h @@ -0,0 +1,27 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APPSETTINGS_H +#define APPSETTINGS_H + +#include "settingsbase.h" + +class AppSettings : public SettingsBase +{ +public: + AppSettings(QString fileName); +}; + +#endif // APPSETTINGS_H diff --git a/data/inifile.cpp b/data/inifile.cpp new file mode 100644 index 00000000..df94e43e --- /dev/null +++ b/data/inifile.cpp @@ -0,0 +1,75 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "inifile.h" + +#include +#include +#include + +INIFile::INIFile() +{ + +} + +bool INIFile::saveFile(QString fileName) +{ + // TODO Handle errors. + QFile file(fileName); + file.open(QIODevice::WriteOnly); + QTextStream out(&file); + + for (Iterator iter = begin(); iter != end(); iter++) + { + out << iter.key() << "=" << iter.value().toString() << "\n"; + } + + return true; +} + +bool INIFile::loadFile(QString fileName) +{ + // TODO Handle errors. + QFile file(fileName); + file.open(QIODevice::ReadOnly); + QTextStream in(&file); + + QStringList lines = in.readAll().split('\n'); + for (int i = 0; i < lines.count(); i++) + { + // Ignore comments. + QString line = lines[i].left('#').trimmed(); + + QString key = line.section('=', 0).trimmed(); + QVariant value(line.section('=', 1).trimmed()); + + this->operator [](key) = value; + } + + return true; +} + +QVariant INIFile::get(QString key, QVariant def) const +{ + if (!this->contains(key)) + return def; + else + return this->operator [](key); +} + +void INIFile::set(QString key, QVariant val) +{ + this->operator [](key) = val; +} diff --git a/data/inifile.h b/data/inifile.h new file mode 100644 index 00000000..75783859 --- /dev/null +++ b/data/inifile.h @@ -0,0 +1,36 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INIFILE_H +#define INIFILE_H + +#include +#include +#include + +// Sectionless INI parser (for instance config files) +class INIFile : public QMap +{ +public: + explicit INIFile(); + + bool loadFile(QString fileName); + bool saveFile(QString fileName); + + QVariant get(QString key, QVariant def) const; + void set(QString key, QVariant val); +}; + +#endif // INIFILE_H diff --git a/data/instancebase.cpp b/data/instancebase.cpp index 2e0a65df..15dc54f4 100644 --- a/data/instancebase.cpp +++ b/data/instancebase.cpp @@ -15,31 +15,35 @@ #include "instancebase.h" +#include + #include "../util/pathutils.h" -InstanceBase::InstanceBase(QString rootDir, QObject *parent) : +InstanceBase::InstanceBase(QString dir, QObject *parent) : QObject(parent), - m_rootDir(rootDir), - m_config(PathCombine(rootDir, "instance.cfg"), QSettings::IniFormat) + rootDir(dir) { + QFileInfo cfgFile; + if (cfgFile.exists()) + config.loadFile(PathCombine(rootDir, "instance.cfg")); } -QString InstanceBase::GetRootDir() const +QString InstanceBase::getRootDir() const { - return m_rootDir; + return rootDir; } ///////////// Config Values ///////////// // Name -QString InstanceBase::GetInstName() const +QString InstanceBase::getInstName() const { - return m_config.value("name", "Unnamed").toString(); + return config.get("name", "Unnamed").toString(); } -void InstanceBase::SetInstName(QString name) +void InstanceBase::setInstName(QString name) { - m_config.setValue("name", name); + config.set("name", name); } diff --git a/data/instancebase.h b/data/instancebase.h index df23b1b0..8c61aee0 100644 --- a/data/instancebase.h +++ b/data/instancebase.h @@ -18,7 +18,8 @@ #include #include -#include + +#include "../data/inifile.h" class InstanceBase : public QObject { @@ -26,18 +27,18 @@ class InstanceBase : public QObject public: explicit InstanceBase(QString rootDir, QObject *parent = 0); - QString GetRootDir() const; + QString getRootDir() const; - QString GetInstName() const; - void SetInstName(QString name); + QString getInstName() const; + void setInstName(QString name); protected: private: - QString m_rootDir; + QString rootDir; - QSettings m_config; + INIFile config; }; #endif // INSTANCEBASE_H diff --git a/data/instancelist.cpp b/data/instancelist.cpp new file mode 100644 index 00000000..7385ba86 --- /dev/null +++ b/data/instancelist.cpp @@ -0,0 +1,52 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "instancelist.h" + +#include +#include + +#include "stdinstance.h" + +#include "../util/pathutils.h" + +InstanceList::InstanceList() : + QList() +{ + +} + +void InstanceList::addInstance(InstanceBase *inst) +{ + append(inst); +} + +void InstanceList::loadInstances(QString dir) +{ + qDebug("Loading instances"); + QDir instDir(dir); + QDirIterator iter(instDir); + + while (iter.hasNext()) + { + QString subDir = iter.next(); + if (QFileInfo(PathCombine(subDir, "instance.cfg")).exists()) + { + // TODO Differentiate between different instance types. + InstanceBase* inst = new StdInstance(subDir); + addInstance(inst); + } + } +} diff --git a/data/instancelist.h b/data/instancelist.h new file mode 100644 index 00000000..83ea48e2 --- /dev/null +++ b/data/instancelist.h @@ -0,0 +1,38 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INSTANCELIST_H +#define INSTANCELIST_H + +#include + +#include "instancebase.h" + +class InstanceList : public QList +{ +public: + explicit InstanceList(); + + void addInstance(InstanceBase *inst); + + void loadInstances(QString dir); + +signals: + +public slots: + +}; + +#endif // INSTANCELIST_H diff --git a/data/settingsbase.cpp b/data/settingsbase.cpp new file mode 100644 index 00000000..66195603 --- /dev/null +++ b/data/settingsbase.cpp @@ -0,0 +1,22 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "settingsbase.h" + +SettingsBase::SettingsBase(QString fileName) : + QSettings(fileName, QSettings::IniFormat) +{ + +} diff --git a/data/settingsbase.h b/data/settingsbase.h new file mode 100644 index 00000000..8a7e7e77 --- /dev/null +++ b/data/settingsbase.h @@ -0,0 +1,33 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SETTINGSBASE_H +#define SETTINGSBASE_H + +#include + +#include "../util/settingsmacros.h" + +class SettingsBase : public QSettings +{ +public: + SettingsBase(QString fileName); + + +}; + +#include "../util/settingsmacrosundef.h" + +#endif // SETTINGSBASE_H diff --git a/data/settingsmacros.h b/data/settingsmacros.h new file mode 100644 index 00000000..94e52155 --- /dev/null +++ b/data/settingsmacros.h @@ -0,0 +1,35 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SETTINGSMACROS_H +#define SETTINGSMACROS_H + +#define STR_VAL(val) # val + +#define DEFINE_SETTING(funcName, name, defVal, typeName, toFunc) \ + virtual typeName Get ## funcName() const { return value(name). ## toFunc(); } \ + virtual void Set ## funcName(typeName value) { setValue(name, value); } \ + virtual void Reset ## funcName() { + +#define DEFINE_SETTING_STR(name, defVal) \ + DEFINE_SETTING(name, STR_VAL(name), defVal, QString, toString) + +#define DEFINE_SETTING_BOOL(name, defVal) \ + DEFINE_SETTING(name, STR_VAL(name), defVal, bool, toBool) + +#define DEFINE_SETTING_INT(name, defVal) \ + DEFINE_SETTING(name, STR_VAL(name), defVal, int, toInt) + +#endif // SETTINGSMACROS_H diff --git a/data/settingsmacrosundef.h b/data/settingsmacrosundef.h new file mode 100644 index 00000000..85b13bac --- /dev/null +++ b/data/settingsmacrosundef.h @@ -0,0 +1,26 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SETTINGSMACROSUNDEF_H +#define SETTINGSMACROSUNDEF_H + +#undef DEFINE_SETTING +#undef DEFINE_SETTING_STR +#undef DEFINE_SETTING_BOOL +#undef DEFINE_SETTING_INT + +#undef STR_VAL + +#endif // SETTINGSMACROSUNDEF_H diff --git a/data/stdinstance.cpp b/data/stdinstance.cpp new file mode 100644 index 00000000..8bb74097 --- /dev/null +++ b/data/stdinstance.cpp @@ -0,0 +1,22 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "stdinstance.h" + +StdInstance::StdInstance(QString dir) : + InstanceBase(dir) +{ + +} diff --git a/data/stdinstance.h b/data/stdinstance.h new file mode 100644 index 00000000..0bb8a0c3 --- /dev/null +++ b/data/stdinstance.h @@ -0,0 +1,28 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef STDINSTANCE_H +#define STDINSTANCE_H + +#include "instancebase.h" + +// Standard client instance. +class StdInstance : public InstanceBase +{ +public: + StdInstance(QString dir); +}; + +#endif // STDINSTANCE_H -- cgit From f7e9a7523fdd8c9e2aaaf59f36fc4a702690b760 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 15 Jan 2013 18:46:27 -0600 Subject: Added settings dialog. --- MultiMC.pro | 9 +- MultiMC.pro.user | 2 +- data/stdinstance.cpp | 4 +- data/stdinstance.h | 2 +- gui/mainwindow.cpp | 8 +- gui/mainwindow.h | 5 +- gui/settingsdialog.cpp | 77 +++++++ gui/settingsdialog.h | 50 +++++ gui/settingsdialog.ui | 541 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 684 insertions(+), 14 deletions(-) create mode 100644 gui/settingsdialog.cpp create mode 100644 gui/settingsdialog.h create mode 100644 gui/settingsdialog.ui (limited to 'data') diff --git a/MultiMC.pro b/MultiMC.pro index 81d72aee..34d297c0 100644 --- a/MultiMC.pro +++ b/MultiMC.pro @@ -18,16 +18,19 @@ SOURCES += main.cpp\ util/pathutils.cpp \ data/instancelist.cpp \ data/stdinstance.cpp \ - data/inifile.cpp + data/inifile.cpp \ + gui/settingsdialog.cpp HEADERS += gui/mainwindow.h \ data/instancebase.h \ util/pathutils.h \ data/instancelist.h \ data/stdinstance.h \ - data/inifile.h + data/inifile.h \ + gui/settingsdialog.h -FORMS += gui/mainwindow.ui +FORMS += gui/mainwindow.ui \ + gui/settingsdialog.ui RESOURCES += \ multimc.qrc diff --git a/MultiMC.pro.user b/MultiMC.pro.user index f23af787..84f78217 100644 --- a/MultiMC.pro.user +++ b/MultiMC.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/data/stdinstance.cpp b/data/stdinstance.cpp index 8bb74097..1324b510 100644 --- a/data/stdinstance.cpp +++ b/data/stdinstance.cpp @@ -15,8 +15,8 @@ #include "stdinstance.h" -StdInstance::StdInstance(QString dir) : - InstanceBase(dir) +StdInstance::StdInstance(QString rootDir) : + InstanceBase(rootDir) { } diff --git a/data/stdinstance.h b/data/stdinstance.h index 0bb8a0c3..59b1c8ab 100644 --- a/data/stdinstance.h +++ b/data/stdinstance.h @@ -22,7 +22,7 @@ class StdInstance : public InstanceBase { public: - StdInstance(QString dir); + explicit StdInstance(QString rootDir); }; #endif // STDINSTANCE_H diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index ff9d0461..8f7372c8 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -19,15 +19,14 @@ #include #include +#include "../gui/settingsdialog.h" + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); instList.loadInstances("instances"); - - model.setInstanceList(&instList); - ui->instListView->setModel(&model); } MainWindow::~MainWindow() @@ -62,7 +61,8 @@ void MainWindow::on_actionCheckUpdate_triggered() void MainWindow::on_actionSettings_triggered() { - + SettingsDialog dialog(this); + dialog.exec(); } void MainWindow::on_actionReportBug_triggered() diff --git a/gui/mainwindow.h b/gui/mainwindow.h index a735d78e..09cd0817 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -19,9 +19,9 @@ #include #include "../data/instancelist.h" -#include "../data/instancelistmodel.h" -namespace Ui { +namespace Ui +{ class MainWindow; } @@ -56,7 +56,6 @@ private: Ui::MainWindow *ui; InstanceList instList; - InstanceListModel model; }; #endif // MAINWINDOW_H diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp new file mode 100644 index 00000000..46569340 --- /dev/null +++ b/gui/settingsdialog.cpp @@ -0,0 +1,77 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "settingsdialog.h" +#include "ui_settingsdialog.h" + +#include + +SettingsDialog::SettingsDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::SettingsDialog) +{ + ui->setupUi(this); +} + +SettingsDialog::~SettingsDialog() +{ + delete ui; +} + +void SettingsDialog::updateCheckboxStuff() +{ + ui->minMemSpinBox->setEnabled(!(ui->compatModeCheckBox->isChecked() || + ui->maximizedCheckBox->isChecked())); + ui->maxMemSpinBox->setEnabled(!(ui->compatModeCheckBox->isChecked() || + ui->maximizedCheckBox->isChecked())); + + ui->maximizedCheckBox->setEnabled(!ui->compatModeCheckBox->isChecked()); +} + +void SettingsDialog::on_instDirBrowseBtn_clicked() +{ + QString dir = QFileDialog::getExistingDirectory(this, "Instance Directory", + ui->instDirTextBox->text()); + if (!dir.isEmpty()) + ui->instDirTextBox->setText(dir); +} + +void SettingsDialog::on_modsDirBrowseBtn_clicked() +{ + QString dir = QFileDialog::getExistingDirectory(this, "Mods Directory", + ui->modsDirTextBox->text()); + if (!dir.isEmpty()) + ui->modsDirTextBox->setText(dir); +} + +void SettingsDialog::on_lwjglDirBrowseBtn_clicked() +{ + QString dir = QFileDialog::getExistingDirectory(this, "LWJGL Directory", + ui->lwjglDirTextBox->text()); + if (!dir.isEmpty()) + ui->lwjglDirTextBox->setText(dir); +} + +void SettingsDialog::on_compatModeCheckBox_clicked(bool checked) +{ + Q_UNUSED(checked); + updateCheckboxStuff(); +} + +void SettingsDialog::on_maximizedCheckBox_clicked(bool checked) +{ + Q_UNUSED(checked); + updateCheckboxStuff(); +} diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h new file mode 100644 index 00000000..3e9d9e0f --- /dev/null +++ b/gui/settingsdialog.h @@ -0,0 +1,50 @@ +/* Copyright 2013 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include + +namespace Ui { +class SettingsDialog; +} + +class SettingsDialog : public QDialog +{ + Q_OBJECT + +public: + explicit SettingsDialog(QWidget *parent = 0); + ~SettingsDialog(); + + void updateCheckboxStuff(); + +private slots: + void on_instDirBrowseBtn_clicked(); + + void on_modsDirBrowseBtn_clicked(); + + void on_lwjglDirBrowseBtn_clicked(); + + void on_compatModeCheckBox_clicked(bool checked); + + void on_maximizedCheckBox_clicked(bool checked); + +private: + Ui::SettingsDialog *ui; +}; + +#endif // SETTINGSDIALOG_H diff --git a/gui/settingsdialog.ui b/gui/settingsdialog.ui new file mode 100644 index 00000000..315686ca --- /dev/null +++ b/gui/settingsdialog.ui @@ -0,0 +1,541 @@ + + + SettingsDialog + + + + 0 + 0 + 400 + 420 + + + + Settings + + + + :/icons/toolbar/settings:/icons/toolbar/settings + + + true + + + + + + QTabWidget::Rounded + + + 0 + + + + General + + + + + + true + + + Sorting Mode + + + + + + By last launched + + + + + + + By name + + + + + + + + + + Update Settings + + + + + + Use development builds? + + + + + + + Check for updates when MultiMC starts? + + + + + + + + + + Folders + + + + + + Instances: + + + + + + + + + + ... + + + + + + + Mods: + + + + + + + + + + ... + + + + + + + LWJGL: + + + + + + + + + + ... + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Console + + + + + + Console Settings + + + + + + Show console while the game is running? + + + + + + + Automatically close console when the game quits? + + + + + + + + + + Instance Console Colors + + + + + + System message color: + + + + + + + + + + Output message color: + + + + + + + + + + Error message color: + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Minecraft + + + + + + Window Size + + + + + + Compatibility mode? + + + + + + + Start Minecraft maximized? + + + + + + + + + Window height: + + + + + + + Window width: + + + + + + + 854 + + + 65536 + + + 1 + + + 854 + + + + + + + 480 + + + 65536 + + + 480 + + + + + + + + + + + + Login automatically when an instance launches? + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Java + + + + + + Memory + + + + + + 512 + + + 65536 + + + 128 + + + 1024 + + + + + + + Minimum memory allocation: + + + + + + + Maximum memory allocation: + + + + + + + 256 + + + 65536 + + + 128 + + + 256 + + + + + + + + + + Java Settings + + + + + + Java path: + + + + + + + + + + JVM arguments: + + + + + + + Auto-detect + + + + + + + + + + + + + Custom Commands + + + + + + Post-exit command: + + + + + + + Pre-launch command: + + + + + + + + + + + + + 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. + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + SettingsDialog + accept() + + + 257 + 410 + + + 157 + 274 + + + + + buttonBox + rejected() + SettingsDialog + reject() + + + 325 + 410 + + + 286 + 274 + + + + + -- cgit