Instance settings moved to a page.
This commit is contained in:
		@@ -56,7 +56,6 @@
 | 
			
		||||
#include "gui/dialogs/VersionSelectDialog.h"
 | 
			
		||||
#include "gui/dialogs/CustomMessageBox.h"
 | 
			
		||||
#include "gui/dialogs/LwjglSelectDialog.h"
 | 
			
		||||
#include "gui/dialogs/InstanceSettings.h"
 | 
			
		||||
#include "gui/dialogs/IconPickerDialog.h"
 | 
			
		||||
#include "gui/dialogs/EditNotesDialog.h"
 | 
			
		||||
#include "gui/dialogs/CopyInstanceDialog.h"
 | 
			
		||||
@@ -944,12 +943,13 @@ void MainWindow::on_actionSettings_triggered()
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionInstanceSettings_triggered()
 | 
			
		||||
{
 | 
			
		||||
	if (m_selectedInstance)
 | 
			
		||||
	{
 | 
			
		||||
		InstanceSettings settings(&m_selectedInstance->settings(), this);
 | 
			
		||||
		settings.setWindowTitle(tr("Instance settings"));
 | 
			
		||||
		settings.exec();
 | 
			
		||||
	}
 | 
			
		||||
	if (!m_selectedInstance)
 | 
			
		||||
		return;
 | 
			
		||||
	auto provider = std::dynamic_pointer_cast<BasePageProvider>(m_selectedInstance);
 | 
			
		||||
	if(!provider)
 | 
			
		||||
		return;
 | 
			
		||||
	PageDialog dlg(provider, "settings" , this);
 | 
			
		||||
	dlg.exec();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionManageAccounts_triggered()
 | 
			
		||||
@@ -1042,19 +1042,13 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered()
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionEditInstance_triggered()
 | 
			
		||||
{
 | 
			
		||||
	if (m_selectedInstance)
 | 
			
		||||
	{
 | 
			
		||||
		auto provider = std::dynamic_pointer_cast<BasePageProvider>(m_selectedInstance);
 | 
			
		||||
		if(!provider)
 | 
			
		||||
		{
 | 
			
		||||
			QLOG_ERROR() << "Instance can't be converted to BasePageProvider (NYI)";
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		auto dialog = new PageDialog(provider, this);
 | 
			
		||||
		if (dialog)
 | 
			
		||||
			dialog->exec();
 | 
			
		||||
		dialog->deleteLater();
 | 
			
		||||
	}
 | 
			
		||||
	if (!m_selectedInstance)
 | 
			
		||||
		return;
 | 
			
		||||
	auto provider = std::dynamic_pointer_cast<BasePageProvider>(m_selectedInstance);
 | 
			
		||||
	if(!provider)
 | 
			
		||||
		return;
 | 
			
		||||
	PageDialog dlg(provider, "" , this);
 | 
			
		||||
	dlg.exec();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::closeEvent(QCloseEvent *event)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,244 +0,0 @@
 | 
			
		||||
/* Copyright 2013 MultiMC Contributors
 | 
			
		||||
 *
 | 
			
		||||
 * Authors: Andrew Okin
 | 
			
		||||
 *          Peterix
 | 
			
		||||
 *          Orochimarufan <orochimarufan.x3@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * 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 "MultiMC.h"
 | 
			
		||||
#include "InstanceSettings.h"
 | 
			
		||||
#include "ui_InstanceSettings.h"
 | 
			
		||||
#include "gui/Platform.h"
 | 
			
		||||
#include "gui/dialogs/VersionSelectDialog.h"
 | 
			
		||||
 | 
			
		||||
#include "logic/NagUtils.h"
 | 
			
		||||
 | 
			
		||||
#include "logic/java/JavaUtils.h"
 | 
			
		||||
#include "logic/java/JavaVersionList.h"
 | 
			
		||||
#include "logic/java/JavaChecker.h"
 | 
			
		||||
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
 | 
			
		||||
InstanceSettings::InstanceSettings(SettingsObject *obj, QWidget *parent)
 | 
			
		||||
	: QDialog(parent), ui(new Ui::InstanceSettings), m_obj(obj)
 | 
			
		||||
{
 | 
			
		||||
	MultiMCPlatform::fixWM_CLASS(this);
 | 
			
		||||
	ui->setupUi(this);
 | 
			
		||||
 | 
			
		||||
	restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("SettingsGeometry").toByteArray()));
 | 
			
		||||
 | 
			
		||||
	loadSettings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
InstanceSettings::~InstanceSettings()
 | 
			
		||||
{
 | 
			
		||||
	delete ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::showEvent(QShowEvent *ev)
 | 
			
		||||
{
 | 
			
		||||
	QDialog::showEvent(ev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::closeEvent(QCloseEvent *ev)
 | 
			
		||||
{
 | 
			
		||||
	MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
 | 
			
		||||
 | 
			
		||||
	QDialog::closeEvent(ev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::on_customCommandsGroupBox_toggled(bool state)
 | 
			
		||||
{
 | 
			
		||||
	ui->labelCustomCmdsDescription->setEnabled(state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::on_buttonBox_accepted()
 | 
			
		||||
{
 | 
			
		||||
	MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
 | 
			
		||||
 | 
			
		||||
	applySettings();
 | 
			
		||||
	accept();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::on_buttonBox_rejected()
 | 
			
		||||
{
 | 
			
		||||
	MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
 | 
			
		||||
 | 
			
		||||
	reject();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::applySettings()
 | 
			
		||||
{
 | 
			
		||||
	// Console
 | 
			
		||||
	bool console = ui->consoleSettingsBox->isChecked();
 | 
			
		||||
	m_obj->set("OverrideConsole", console);
 | 
			
		||||
	if (console)
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->set("ShowConsole", ui->showConsoleCheck->isChecked());
 | 
			
		||||
		m_obj->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->reset("ShowConsole");
 | 
			
		||||
		m_obj->reset("AutoCloseConsole");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Window Size
 | 
			
		||||
	bool window = ui->windowSizeGroupBox->isChecked();
 | 
			
		||||
	m_obj->set("OverrideWindow", window);
 | 
			
		||||
	if (window)
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
 | 
			
		||||
		m_obj->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
 | 
			
		||||
		m_obj->set("MinecraftWinHeight", ui->windowHeightSpinBox->value());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->reset("LaunchMaximized");
 | 
			
		||||
		m_obj->reset("MinecraftWinWidth");
 | 
			
		||||
		m_obj->reset("MinecraftWinHeight");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Memory
 | 
			
		||||
	bool memory = ui->memoryGroupBox->isChecked();
 | 
			
		||||
	m_obj->set("OverrideMemory", memory);
 | 
			
		||||
	if (memory)
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->set("MinMemAlloc", ui->minMemSpinBox->value());
 | 
			
		||||
		m_obj->set("MaxMemAlloc", ui->maxMemSpinBox->value());
 | 
			
		||||
		m_obj->set("PermGen", ui->permGenSpinBox->value());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->reset("MinMemAlloc");
 | 
			
		||||
		m_obj->reset("MaxMemAlloc");
 | 
			
		||||
		m_obj->reset("PermGen");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Java Settings
 | 
			
		||||
	bool java = ui->javaSettingsGroupBox->isChecked();
 | 
			
		||||
	m_obj->set("OverrideJava", java);
 | 
			
		||||
	if (java)
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->set("JavaPath", ui->javaPathTextBox->text());
 | 
			
		||||
		m_obj->set("JvmArgs", ui->jvmArgsTextBox->text());
 | 
			
		||||
 | 
			
		||||
		NagUtils::checkJVMArgs(m_obj->get("JvmArgs").toString(), this->parentWidget());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->reset("JavaPath");
 | 
			
		||||
		m_obj->reset("JvmArgs");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Custom Commands
 | 
			
		||||
	bool custcmd = ui->customCommandsGroupBox->isChecked();
 | 
			
		||||
	m_obj->set("OverrideCommands", custcmd);
 | 
			
		||||
	if (custcmd)
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
 | 
			
		||||
		m_obj->set("PostExitCommand", ui->postExitCmdTextBox->text());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_obj->reset("PreLaunchCommand");
 | 
			
		||||
		m_obj->reset("PostExitCommand");
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::loadSettings()
 | 
			
		||||
{
 | 
			
		||||
	// Console
 | 
			
		||||
	ui->consoleSettingsBox->setChecked(m_obj->get("OverrideConsole").toBool());
 | 
			
		||||
	ui->showConsoleCheck->setChecked(m_obj->get("ShowConsole").toBool());
 | 
			
		||||
	ui->autoCloseConsoleCheck->setChecked(m_obj->get("AutoCloseConsole").toBool());
 | 
			
		||||
 | 
			
		||||
	// Window Size
 | 
			
		||||
	ui->windowSizeGroupBox->setChecked(m_obj->get("OverrideWindow").toBool());
 | 
			
		||||
	ui->maximizedCheckBox->setChecked(m_obj->get("LaunchMaximized").toBool());
 | 
			
		||||
	ui->windowWidthSpinBox->setValue(m_obj->get("MinecraftWinWidth").toInt());
 | 
			
		||||
	ui->windowHeightSpinBox->setValue(m_obj->get("MinecraftWinHeight").toInt());
 | 
			
		||||
 | 
			
		||||
	// Memory
 | 
			
		||||
	ui->memoryGroupBox->setChecked(m_obj->get("OverrideMemory").toBool());
 | 
			
		||||
	ui->minMemSpinBox->setValue(m_obj->get("MinMemAlloc").toInt());
 | 
			
		||||
	ui->maxMemSpinBox->setValue(m_obj->get("MaxMemAlloc").toInt());
 | 
			
		||||
	ui->permGenSpinBox->setValue(m_obj->get("PermGen").toInt());
 | 
			
		||||
 | 
			
		||||
	// Java Settings
 | 
			
		||||
	ui->javaSettingsGroupBox->setChecked(m_obj->get("OverrideJava").toBool());
 | 
			
		||||
	ui->javaPathTextBox->setText(m_obj->get("JavaPath").toString());
 | 
			
		||||
	ui->jvmArgsTextBox->setText(m_obj->get("JvmArgs").toString());
 | 
			
		||||
 | 
			
		||||
	// Custom Commands
 | 
			
		||||
	ui->customCommandsGroupBox->setChecked(m_obj->get("OverrideCommands").toBool());
 | 
			
		||||
	ui->preLaunchCmdTextBox->setText(m_obj->get("PreLaunchCommand").toString());
 | 
			
		||||
	ui->postExitCmdTextBox->setText(m_obj->get("PostExitCommand").toString());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::on_javaDetectBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	JavaVersionPtr java;
 | 
			
		||||
 | 
			
		||||
	VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true);
 | 
			
		||||
	vselect.setResizeOn(2);
 | 
			
		||||
	vselect.exec();
 | 
			
		||||
 | 
			
		||||
	if (vselect.result() == QDialog::Accepted && vselect.selectedVersion())
 | 
			
		||||
	{
 | 
			
		||||
		java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
 | 
			
		||||
		ui->javaPathTextBox->setText(java->path);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::on_javaBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString dir = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
 | 
			
		||||
	if (!dir.isNull())
 | 
			
		||||
	{
 | 
			
		||||
		ui->javaPathTextBox->setText(dir);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::on_javaTestBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	checker.reset(new JavaChecker());
 | 
			
		||||
	connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this,
 | 
			
		||||
			SLOT(checkFinished(JavaCheckResult)));
 | 
			
		||||
	checker->path = ui->javaPathTextBox->text();
 | 
			
		||||
	checker->performCheck();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettings::checkFinished(JavaCheckResult result)
 | 
			
		||||
{
 | 
			
		||||
	if (result.valid)
 | 
			
		||||
	{
 | 
			
		||||
		QString text;
 | 
			
		||||
		text += "Java test succeeded!\n";
 | 
			
		||||
		if (result.is_64bit)
 | 
			
		||||
			text += "Using 64bit java.\n";
 | 
			
		||||
		text += "\n";
 | 
			
		||||
		text += "Platform reported: " + result.realPlatform;
 | 
			
		||||
		QMessageBox::information(this, tr("Java test success"), text);
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::warning(
 | 
			
		||||
			this, tr("Java test failure"),
 | 
			
		||||
			tr("The specified java binary didn't work. You should use the auto-detect feature, "
 | 
			
		||||
			   "or set the path to the java executable."));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -50,7 +50,7 @@ protected:
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
PageDialog::PageDialog(BasePageProviderPtr pageProvider, QWidget *parent) : QDialog(parent)
 | 
			
		||||
PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWidget *parent) : QDialog(parent)
 | 
			
		||||
{
 | 
			
		||||
	MultiMCPlatform::fixWM_CLASS(this);
 | 
			
		||||
	createUI();
 | 
			
		||||
@@ -60,13 +60,16 @@ PageDialog::PageDialog(BasePageProviderPtr pageProvider, QWidget *parent) : QDia
 | 
			
		||||
	m_model = new PageModel(this);
 | 
			
		||||
	m_proxyModel = new PageEntryFilterModel(this);
 | 
			
		||||
	int firstIndex = -1;
 | 
			
		||||
	int counter = 0;
 | 
			
		||||
	auto pages = pageProvider->getPages();
 | 
			
		||||
	for(auto page: pages)
 | 
			
		||||
	{
 | 
			
		||||
		page->index = m_pageStack->addWidget(dynamic_cast<QWidget *>(page));
 | 
			
		||||
		page->stackIndex = m_pageStack->addWidget(dynamic_cast<QWidget *>(page));
 | 
			
		||||
		page->listIndex = counter;
 | 
			
		||||
		counter++;
 | 
			
		||||
		if(firstIndex == -1)
 | 
			
		||||
		{
 | 
			
		||||
			firstIndex = page->index;
 | 
			
		||||
			firstIndex = page->stackIndex;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	m_model->setPages(pages);
 | 
			
		||||
@@ -80,9 +83,21 @@ PageDialog::PageDialog(BasePageProviderPtr pageProvider, QWidget *parent) : QDia
 | 
			
		||||
	m_pageList->setModel(m_proxyModel);
 | 
			
		||||
    connect(m_pageList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
 | 
			
		||||
            this, SLOT(currentChanged(QModelIndex)));
 | 
			
		||||
	
 | 
			
		||||
	m_pageStack->setStackingMode(QStackedLayout::StackOne);
 | 
			
		||||
	m_pageList->setFocus();
 | 
			
		||||
	// now find what we want to have selected...
 | 
			
		||||
	auto page = m_model->findPageEntryById(defaultId);
 | 
			
		||||
	QModelIndex index;
 | 
			
		||||
	if(page)
 | 
			
		||||
	{
 | 
			
		||||
		index = m_proxyModel->mapFromSource(m_model->index(page->listIndex));
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		index = m_proxyModel->index(0,0);
 | 
			
		||||
	}
 | 
			
		||||
	if(index.isValid())
 | 
			
		||||
		m_pageList->setCurrentIndex(index);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PageDialog::createUI()
 | 
			
		||||
@@ -112,6 +127,7 @@ void PageDialog::createUI()
 | 
			
		||||
	m_pageStack->setMargin(0);
 | 
			
		||||
	m_pageStack->addWidget(new QWidget(this));
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	QDialogButtonBox *buttons =
 | 
			
		||||
		new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok |
 | 
			
		||||
							 QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
 | 
			
		||||
@@ -119,6 +135,7 @@ void PageDialog::createUI()
 | 
			
		||||
	connect(buttons->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
 | 
			
		||||
	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
 | 
			
		||||
	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
 | 
			
		||||
	*/
 | 
			
		||||
 | 
			
		||||
	QGridLayout *mainGridLayout = new QGridLayout;
 | 
			
		||||
	mainGridLayout->addLayout(headerHLayout, 0, 1, 1, 1);
 | 
			
		||||
@@ -132,7 +149,7 @@ void PageDialog::createUI()
 | 
			
		||||
void PageDialog::showPage(int row)
 | 
			
		||||
{
 | 
			
		||||
	auto page = m_model->pages().at(row);
 | 
			
		||||
	m_pageStack->setCurrentIndex(page->index);
 | 
			
		||||
	m_pageStack->setCurrentIndex(page->stackIndex);
 | 
			
		||||
	m_header->setText(page->displayName());
 | 
			
		||||
	m_iconHeader->setIcon(page->icon());
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,11 +30,14 @@ class PageDialog : public QDialog
 | 
			
		||||
{
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
	explicit PageDialog(BasePageProviderPtr pageProvider, QWidget *parent = 0);
 | 
			
		||||
	explicit PageDialog(BasePageProviderPtr pageProvider, QString defaultId = QString(),
 | 
			
		||||
						QWidget *parent = 0);
 | 
			
		||||
	virtual ~PageDialog() {};
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	void createUI();
 | 
			
		||||
private slots:
 | 
			
		||||
private
 | 
			
		||||
slots:
 | 
			
		||||
	void apply();
 | 
			
		||||
	virtual void reject();
 | 
			
		||||
	virtual void accept();
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@
 | 
			
		||||
#include <QEvent>
 | 
			
		||||
#include <QScrollBar>
 | 
			
		||||
 | 
			
		||||
class BasePage;
 | 
			
		||||
const int pageIconSize = 24;
 | 
			
		||||
 | 
			
		||||
class PageViewDelegate : public QStyledItemDelegate
 | 
			
		||||
@@ -63,7 +64,6 @@ public:
 | 
			
		||||
		return m_pages;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	BasePage * findPageEntryById(QString id)
 | 
			
		||||
	{
 | 
			
		||||
		for(auto page: m_pages)
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,8 @@ public:
 | 
			
		||||
	{
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
	int index = -1;
 | 
			
		||||
	int stackIndex = -1;
 | 
			
		||||
	int listIndex = -1;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef std::shared_ptr<BasePage> BasePagePtr;
 | 
			
		||||
							
								
								
									
										228
									
								
								gui/pages/InstanceSettingsPage.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										228
									
								
								gui/pages/InstanceSettingsPage.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,228 @@
 | 
			
		||||
#include "InstanceSettingsPage.h"
 | 
			
		||||
#include <gui/dialogs/VersionSelectDialog.h>
 | 
			
		||||
#include "logic/NagUtils.h"
 | 
			
		||||
#include <logic/java/JavaVersionList.h>
 | 
			
		||||
#include "MultiMC.h"
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include "ui_InstanceSettingsPage.h"
 | 
			
		||||
 | 
			
		||||
QString InstanceSettingsPage::displayName()
 | 
			
		||||
{
 | 
			
		||||
	return tr("Settings");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QIcon InstanceSettingsPage::icon()
 | 
			
		||||
{
 | 
			
		||||
	return QIcon::fromTheme("settings");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString InstanceSettingsPage::id()
 | 
			
		||||
{
 | 
			
		||||
	return "settings";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
InstanceSettingsPage::InstanceSettingsPage(SettingsObject *s, QWidget *parent)
 | 
			
		||||
	: QWidget(parent), ui(new Ui::InstanceSettingsPage), m_settings(s)
 | 
			
		||||
{
 | 
			
		||||
	ui->setupUi(this);
 | 
			
		||||
	loadSettings();
 | 
			
		||||
	connect(ui->buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked(bool)), this,
 | 
			
		||||
			SLOT(applySettings()));
 | 
			
		||||
	connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked(bool)), this,
 | 
			
		||||
			SLOT(loadSettings()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
InstanceSettingsPage::~InstanceSettingsPage()
 | 
			
		||||
{
 | 
			
		||||
	delete ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool InstanceSettingsPage::apply()
 | 
			
		||||
{
 | 
			
		||||
	applySettings();
 | 
			
		||||
	loadSettings();
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettingsPage::applySettings()
 | 
			
		||||
{
 | 
			
		||||
	// Console
 | 
			
		||||
	bool console = ui->consoleSettingsBox->isChecked();
 | 
			
		||||
	m_settings->set("OverrideConsole", console);
 | 
			
		||||
	if (console)
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->set("ShowConsole", ui->showConsoleCheck->isChecked());
 | 
			
		||||
		m_settings->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->reset("ShowConsole");
 | 
			
		||||
		m_settings->reset("AutoCloseConsole");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Window Size
 | 
			
		||||
	bool window = ui->windowSizeGroupBox->isChecked();
 | 
			
		||||
	m_settings->set("OverrideWindow", window);
 | 
			
		||||
	if (window)
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
 | 
			
		||||
		m_settings->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
 | 
			
		||||
		m_settings->set("MinecraftWinHeight", ui->windowHeightSpinBox->value());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->reset("LaunchMaximized");
 | 
			
		||||
		m_settings->reset("MinecraftWinWidth");
 | 
			
		||||
		m_settings->reset("MinecraftWinHeight");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Memory
 | 
			
		||||
	bool memory = ui->memoryGroupBox->isChecked();
 | 
			
		||||
	m_settings->set("OverrideMemory", memory);
 | 
			
		||||
	if (memory)
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->set("MinMemAlloc", ui->minMemSpinBox->value());
 | 
			
		||||
		m_settings->set("MaxMemAlloc", ui->maxMemSpinBox->value());
 | 
			
		||||
		m_settings->set("PermGen", ui->permGenSpinBox->value());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->reset("MinMemAlloc");
 | 
			
		||||
		m_settings->reset("MaxMemAlloc");
 | 
			
		||||
		m_settings->reset("PermGen");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Java Install Settings
 | 
			
		||||
	bool javaInstall = ui->javaSettingsGroupBox->isChecked();
 | 
			
		||||
	m_settings->set("OverrideJavaLocation", javaInstall);
 | 
			
		||||
	if (javaInstall)
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->set("JavaPath", ui->javaPathTextBox->text());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->reset("JavaPath");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Java arguments
 | 
			
		||||
	bool javaArgs = ui->javaArgumentsGroupBox->isChecked();
 | 
			
		||||
	m_settings->set("OverrideJavaArgs", javaArgs);
 | 
			
		||||
	if(javaArgs)
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " "));
 | 
			
		||||
		NagUtils::checkJVMArgs(m_settings->get("JvmArgs").toString(), this->parentWidget());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->reset("JvmArgs");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// old generic 'override both' is removed.
 | 
			
		||||
	m_settings->reset("OverrideJava");
 | 
			
		||||
 | 
			
		||||
	// Custom Commands
 | 
			
		||||
	bool custcmd = ui->customCommandsGroupBox->isChecked();
 | 
			
		||||
	m_settings->set("OverrideCommands", custcmd);
 | 
			
		||||
	if (custcmd)
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
 | 
			
		||||
		m_settings->set("PostExitCommand", ui->postExitCmdTextBox->text());
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		m_settings->reset("PreLaunchCommand");
 | 
			
		||||
		m_settings->reset("PostExitCommand");
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettingsPage::loadSettings()
 | 
			
		||||
{
 | 
			
		||||
	// Console
 | 
			
		||||
	ui->consoleSettingsBox->setChecked(m_settings->get("OverrideConsole").toBool());
 | 
			
		||||
	ui->showConsoleCheck->setChecked(m_settings->get("ShowConsole").toBool());
 | 
			
		||||
	ui->autoCloseConsoleCheck->setChecked(m_settings->get("AutoCloseConsole").toBool());
 | 
			
		||||
 | 
			
		||||
	// Window Size
 | 
			
		||||
	ui->windowSizeGroupBox->setChecked(m_settings->get("OverrideWindow").toBool());
 | 
			
		||||
	ui->maximizedCheckBox->setChecked(m_settings->get("LaunchMaximized").toBool());
 | 
			
		||||
	ui->windowWidthSpinBox->setValue(m_settings->get("MinecraftWinWidth").toInt());
 | 
			
		||||
	ui->windowHeightSpinBox->setValue(m_settings->get("MinecraftWinHeight").toInt());
 | 
			
		||||
 | 
			
		||||
	// Memory
 | 
			
		||||
	ui->memoryGroupBox->setChecked(m_settings->get("OverrideMemory").toBool());
 | 
			
		||||
	ui->minMemSpinBox->setValue(m_settings->get("MinMemAlloc").toInt());
 | 
			
		||||
	ui->maxMemSpinBox->setValue(m_settings->get("MaxMemAlloc").toInt());
 | 
			
		||||
	ui->permGenSpinBox->setValue(m_settings->get("PermGen").toInt());
 | 
			
		||||
 | 
			
		||||
	// Java Settings
 | 
			
		||||
	bool overrideJava = m_settings->get("OverrideJava").toBool();
 | 
			
		||||
	bool overrideLocation = m_settings->get("OverrideJavaLocation").toBool() || overrideJava;
 | 
			
		||||
	bool overrideArgs = m_settings->get("OverrideJavaArgs").toBool() || overrideJava;
 | 
			
		||||
	
 | 
			
		||||
	ui->javaSettingsGroupBox->setChecked(overrideLocation);
 | 
			
		||||
	ui->javaPathTextBox->setText(m_settings->get("JavaPath").toString());
 | 
			
		||||
 | 
			
		||||
	ui->javaArgumentsGroupBox->setChecked(overrideArgs);
 | 
			
		||||
	ui->jvmArgsTextBox->setPlainText(m_settings->get("JvmArgs").toString());
 | 
			
		||||
 | 
			
		||||
	// Custom Commands
 | 
			
		||||
	ui->customCommandsGroupBox->setChecked(m_settings->get("OverrideCommands").toBool());
 | 
			
		||||
	ui->preLaunchCmdTextBox->setText(m_settings->get("PreLaunchCommand").toString());
 | 
			
		||||
	ui->postExitCmdTextBox->setText(m_settings->get("PostExitCommand").toString());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettingsPage::on_javaDetectBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	JavaVersionPtr java;
 | 
			
		||||
 | 
			
		||||
	VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true);
 | 
			
		||||
	vselect.setResizeOn(2);
 | 
			
		||||
	vselect.exec();
 | 
			
		||||
 | 
			
		||||
	if (vselect.result() == QDialog::Accepted && vselect.selectedVersion())
 | 
			
		||||
	{
 | 
			
		||||
		java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
 | 
			
		||||
		ui->javaPathTextBox->setText(java->path);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettingsPage::on_javaBrowseBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	QString dir = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
 | 
			
		||||
	if (!dir.isNull())
 | 
			
		||||
	{
 | 
			
		||||
		ui->javaPathTextBox->setText(dir);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettingsPage::on_javaTestBtn_clicked()
 | 
			
		||||
{
 | 
			
		||||
	checker.reset(new JavaChecker());
 | 
			
		||||
	connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this,
 | 
			
		||||
			SLOT(checkFinished(JavaCheckResult)));
 | 
			
		||||
	checker->path = ui->javaPathTextBox->text();
 | 
			
		||||
	checker->performCheck();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void InstanceSettingsPage::checkFinished(JavaCheckResult result)
 | 
			
		||||
{
 | 
			
		||||
	if (result.valid)
 | 
			
		||||
	{
 | 
			
		||||
		QString text;
 | 
			
		||||
		text += "Java test succeeded!\n";
 | 
			
		||||
		if (result.is_64bit)
 | 
			
		||||
			text += "Using 64bit java.\n";
 | 
			
		||||
		text += "\n";
 | 
			
		||||
		text += "Platform reported: " + result.realPlatform;
 | 
			
		||||
		QMessageBox::information(this, tr("Java test success"), text);
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		QMessageBox::warning(
 | 
			
		||||
			this, tr("Java test failure"),
 | 
			
		||||
			tr("The specified java binary didn't work. You should use the auto-detect feature, "
 | 
			
		||||
			   "or set the path to the java executable."));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* Copyright 2013 MultiMC Contributors
 | 
			
		||||
/* Copyright 2014 MultiMC Contributors
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
@@ -14,38 +14,34 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
#include "settingsobject.h"
 | 
			
		||||
#include "logic/java/JavaChecker.h"
 | 
			
		||||
#include <logic/OneSixInstance.h>
 | 
			
		||||
#include <logic/net/NetJob.h>
 | 
			
		||||
#include <logic/java/JavaChecker.h>
 | 
			
		||||
#include "BasePage.h"
 | 
			
		||||
 | 
			
		||||
class JavaChecker;
 | 
			
		||||
namespace Ui
 | 
			
		||||
{
 | 
			
		||||
class InstanceSettings;
 | 
			
		||||
class InstanceSettingsPage;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class InstanceSettings : public QDialog
 | 
			
		||||
class InstanceSettingsPage : public QWidget, public BasePage
 | 
			
		||||
{
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	explicit InstanceSettings(SettingsObject *s, QWidget *parent = 0);
 | 
			
		||||
	~InstanceSettings();
 | 
			
		||||
	explicit InstanceSettingsPage(SettingsObject *s, QWidget *parent = 0);
 | 
			
		||||
	virtual ~InstanceSettingsPage();
 | 
			
		||||
	virtual QString displayName() override;
 | 
			
		||||
	virtual QIcon icon() override;
 | 
			
		||||
	virtual QString id() override;
 | 
			
		||||
	virtual bool apply();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	void updateCheckboxStuff();
 | 
			
		||||
 | 
			
		||||
	void applySettings();
 | 
			
		||||
	void loadSettings();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	virtual void showEvent(QShowEvent *);
 | 
			
		||||
	virtual void closeEvent(QCloseEvent *);
 | 
			
		||||
private
 | 
			
		||||
slots:
 | 
			
		||||
	void on_customCommandsGroupBox_toggled(bool arg1);
 | 
			
		||||
	void on_buttonBox_accepted();
 | 
			
		||||
	void on_buttonBox_rejected();
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
	void on_javaDetectBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void on_javaTestBtn_clicked();
 | 
			
		||||
@@ -53,8 +49,11 @@ slots:
 | 
			
		||||
	void on_javaBrowseBtn_clicked();
 | 
			
		||||
 | 
			
		||||
	void checkFinished(JavaCheckResult result);
 | 
			
		||||
 | 
			
		||||
	void applySettings();
 | 
			
		||||
	void loadSettings();
 | 
			
		||||
private:
 | 
			
		||||
	Ui::InstanceSettings *ui;
 | 
			
		||||
	SettingsObject *m_obj;
 | 
			
		||||
	Ui::InstanceSettingsPage *ui;
 | 
			
		||||
	SettingsObject *m_settings;
 | 
			
		||||
	std::shared_ptr<JavaChecker> checker;
 | 
			
		||||
};
 | 
			
		||||
@@ -1,17 +1,17 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>InstanceSettings</class>
 | 
			
		||||
 <widget class="QDialog" name="InstanceSettings">
 | 
			
		||||
 <class>InstanceSettingsPage</class>
 | 
			
		||||
 <widget class="QWidget" name="InstanceSettingsPage">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>526</width>
 | 
			
		||||
    <height>637</height>
 | 
			
		||||
    <width>458</width>
 | 
			
		||||
    <height>476</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Instance Settings</string>
 | 
			
		||||
   <string>Form</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
@@ -23,134 +23,52 @@
 | 
			
		||||
      <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="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>
 | 
			
		||||
        <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="javaSettingsGroupBox">
 | 
			
		||||
         <property name="enabled">
 | 
			
		||||
          <bool>true</bool>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="title">
 | 
			
		||||
          <string>Java installation</string>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="checkable">
 | 
			
		||||
          <bool>true</bool>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="checked">
 | 
			
		||||
          <bool>false</bool>
 | 
			
		||||
         </property>
 | 
			
		||||
         <layout class="QGridLayout" name="gridLayout">
 | 
			
		||||
          <item row="0" column="0" colspan="3">
 | 
			
		||||
           <widget class="QLineEdit" name="javaPathTextBox"/>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="1" column="0">
 | 
			
		||||
           <widget class="QPushButton" name="javaDetectBtn">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Auto-detect...</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="1" column="1">
 | 
			
		||||
           <widget class="QPushButton" name="javaBrowseBtn">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Browse...</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="1" column="2">
 | 
			
		||||
           <widget class="QPushButton" name="javaTestBtn">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Test</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QGroupBox" name="memoryGroupBox">
 | 
			
		||||
         <property name="enabled">
 | 
			
		||||
@@ -257,12 +175,12 @@
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QGroupBox" name="javaSettingsGroupBox">
 | 
			
		||||
        <widget class="QGroupBox" name="javaArgumentsGroupBox">
 | 
			
		||||
         <property name="enabled">
 | 
			
		||||
          <bool>true</bool>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="title">
 | 
			
		||||
          <string>Java Settings</string>
 | 
			
		||||
          <string>Java arguments</string>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="checkable">
 | 
			
		||||
          <bool>true</bool>
 | 
			
		||||
@@ -270,51 +188,157 @@
 | 
			
		||||
         <property name="checked">
 | 
			
		||||
          <bool>false</bool>
 | 
			
		||||
         </property>
 | 
			
		||||
         <layout class="QGridLayout" name="gridLayout_3">
 | 
			
		||||
          <item row="2" column="4">
 | 
			
		||||
           <widget class="QPushButton" name="javaTestBtn">
 | 
			
		||||
         <layout class="QGridLayout" name="gridLayout_5">
 | 
			
		||||
          <item row="1" column="1">
 | 
			
		||||
           <widget class="QPlainTextEdit" name="jvmArgsTextBox"/>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <spacer name="verticalSpacerMinecraft">
 | 
			
		||||
         <property name="orientation">
 | 
			
		||||
          <enum>Qt::Vertical</enum>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="sizeHint" stdset="0">
 | 
			
		||||
          <size>
 | 
			
		||||
           <width>0</width>
 | 
			
		||||
           <height>0</height>
 | 
			
		||||
          </size>
 | 
			
		||||
         </property>
 | 
			
		||||
        </spacer>
 | 
			
		||||
       </item>
 | 
			
		||||
      </layout>
 | 
			
		||||
     </widget>
 | 
			
		||||
     <widget class="QWidget" name="javaTab">
 | 
			
		||||
      <attribute name="title">
 | 
			
		||||
       <string>Game windows</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>Game Window</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="maximizedCheckBox">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Test</string>
 | 
			
		||||
             <string>Start Minecraft maximized?</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="0" column="0">
 | 
			
		||||
           <widget class="QLabel" name="labelJavaPath">
 | 
			
		||||
          <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>Java path:</string>
 | 
			
		||||
             <string>Show console while the game is running?</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="3" column="0">
 | 
			
		||||
           <widget class="QLabel" name="labelJVMArgs">
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QCheckBox" name="autoCloseConsoleCheck">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>JVM arguments:</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="3" column="2" colspan="3">
 | 
			
		||||
           <widget class="QLineEdit" name="jvmArgsTextBox"/>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="0" column="2" colspan="3">
 | 
			
		||||
           <widget class="QLineEdit" name="javaPathTextBox"/>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="2" column="3">
 | 
			
		||||
           <widget class="QPushButton" name="javaBrowseBtn">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Browse...</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="2" column="2">
 | 
			
		||||
           <widget class="QPushButton" name="javaDetectBtn">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Auto-detect...</string>
 | 
			
		||||
             <string>Automatically close console when the game quits?</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <spacer name="verticalSpacerMinecraft_2">
 | 
			
		||||
         <property name="orientation">
 | 
			
		||||
          <enum>Qt::Vertical</enum>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="sizeHint" stdset="0">
 | 
			
		||||
          <size>
 | 
			
		||||
           <width>88</width>
 | 
			
		||||
           <height>125</height>
 | 
			
		||||
          </size>
 | 
			
		||||
         </property>
 | 
			
		||||
        </spacer>
 | 
			
		||||
       </item>
 | 
			
		||||
      </layout>
 | 
			
		||||
     </widget>
 | 
			
		||||
     <widget class="QWidget" name="tab">
 | 
			
		||||
      <attribute name="title">
 | 
			
		||||
       <string>Custom commands</string>
 | 
			
		||||
      </attribute>
 | 
			
		||||
      <layout class="QVBoxLayout" name="verticalLayout_6">
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QGroupBox" name="customCommandsGroupBox">
 | 
			
		||||
         <property name="enabled">
 | 
			
		||||
@@ -358,12 +382,6 @@
 | 
			
		||||
         <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>
 | 
			
		||||
@@ -378,6 +396,19 @@
 | 
			
		||||
         </property>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <spacer name="verticalSpacerMinecraft_3">
 | 
			
		||||
         <property name="orientation">
 | 
			
		||||
          <enum>Qt::Vertical</enum>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="sizeHint" stdset="0">
 | 
			
		||||
          <size>
 | 
			
		||||
           <width>88</width>
 | 
			
		||||
           <height>186</height>
 | 
			
		||||
          </size>
 | 
			
		||||
         </property>
 | 
			
		||||
        </spacer>
 | 
			
		||||
       </item>
 | 
			
		||||
      </layout>
 | 
			
		||||
     </widget>
 | 
			
		||||
    </widget>
 | 
			
		||||
@@ -388,32 +419,12 @@
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
 | 
			
		||||
      <set>QDialogButtonBox::Apply|QDialogButtonBox::Reset</set>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <tabstops>
 | 
			
		||||
  <tabstop>settingsTabs</tabstop>
 | 
			
		||||
  <tabstop>buttonBox</tabstop>
 | 
			
		||||
  <tabstop>windowSizeGroupBox</tabstop>
 | 
			
		||||
  <tabstop>maximizedCheckBox</tabstop>
 | 
			
		||||
  <tabstop>windowWidthSpinBox</tabstop>
 | 
			
		||||
  <tabstop>windowHeightSpinBox</tabstop>
 | 
			
		||||
  <tabstop>consoleSettingsBox</tabstop>
 | 
			
		||||
  <tabstop>showConsoleCheck</tabstop>
 | 
			
		||||
  <tabstop>autoCloseConsoleCheck</tabstop>
 | 
			
		||||
  <tabstop>memoryGroupBox</tabstop>
 | 
			
		||||
  <tabstop>minMemSpinBox</tabstop>
 | 
			
		||||
  <tabstop>maxMemSpinBox</tabstop>
 | 
			
		||||
  <tabstop>permGenSpinBox</tabstop>
 | 
			
		||||
  <tabstop>javaSettingsGroupBox</tabstop>
 | 
			
		||||
  <tabstop>jvmArgsTextBox</tabstop>
 | 
			
		||||
  <tabstop>customCommandsGroupBox</tabstop>
 | 
			
		||||
  <tabstop>preLaunchCmdTextBox</tabstop>
 | 
			
		||||
  <tabstop>postExitCmdTextBox</tabstop>
 | 
			
		||||
 </tabstops>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
		Reference in New Issue
	
	Block a user