WTF, I don't even...
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#include "instancemodel.h"
|
||||
#include <instance.h>
|
||||
#include <BaseInstance.h>
|
||||
#include <QIcon>
|
||||
#include "iconcache.h"
|
||||
|
||||
|
@ -72,14 +72,12 @@ void InstanceSettings::applySettings()
|
||||
m_obj->set("OverrideWindow", window);
|
||||
if(window)
|
||||
{
|
||||
m_obj->set("LaunchCompatMode", ui->compatModeCheckBox->isChecked());
|
||||
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("LaunchCompatMode");
|
||||
m_obj->reset("LaunchMaximized");
|
||||
m_obj->reset("MinecraftWinWidth");
|
||||
m_obj->reset("MinecraftWinHeight");
|
||||
@ -148,33 +146,33 @@ void InstanceSettings::applySettings()
|
||||
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());
|
||||
ui->consoleSettingsBox->setChecked(m_obj->get("OverrideConsole").toBool());
|
||||
|
||||
// Window Size
|
||||
ui->compatModeCheckBox->setChecked(m_obj->get("LaunchCompatMode").toBool());
|
||||
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());
|
||||
ui->windowSizeGroupBox->setChecked(m_obj->get("OverrideWindow").toBool());
|
||||
|
||||
|
||||
// Auto Login
|
||||
ui->autoLoginChecBox->setChecked(m_obj->get("AutoLogin").toBool());
|
||||
ui->accountSettingsGroupBox->setChecked(m_obj->get("OverrideLogin").toBool());
|
||||
ui->autoLoginChecBox->setChecked(m_obj->get("AutoLogin").toBool());
|
||||
|
||||
// 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->memoryGroupBox->setChecked(m_obj->get("OverrideMemory").toBool());
|
||||
|
||||
// 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());
|
||||
ui->javaSettingsGroupBox->setChecked(m_obj->get("OverrideJava").toBool());
|
||||
|
||||
// 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());
|
||||
ui->customCommandsGroupBox->setChecked(m_obj->get("OverrideCommands").toBool());
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ MainWindow::MainWindow ( QWidget *parent ) :
|
||||
view->setFrameShape ( QFrame::NoFrame );
|
||||
|
||||
ui->horizontalLayout->addWidget ( view );
|
||||
setWindowTitle ( QString ( "MultiMC %1" ).arg ( Version::current.toString() ) );
|
||||
setWindowTitle ( QString ( "MultiMC %1" ).arg ( AppVersion::current.toString() ) );
|
||||
// TODO: Make this work with the new settings system.
|
||||
// restoreGeometry(settings->getConfig().value("MainWindowGeometry", saveGeometry()).toByteArray());
|
||||
// restoreState(settings->getConfig().value("MainWindowState", saveState()).toByteArray());
|
||||
@ -199,7 +199,8 @@ void MainWindow::on_actionAddInstance_triggered()
|
||||
{
|
||||
case InstanceFactory::NoCreateError:
|
||||
newInstance->setName(newInstDlg->instName());
|
||||
newInstance->setIntendedVersion(newInstDlg->selectedVersion()->descriptor());
|
||||
// FIXME:HACKERY
|
||||
// newInstance->setIntendedVersion(newInstDlg->selectedVersion()->descriptor());
|
||||
instList.add(InstancePtr(newInstance));
|
||||
return;
|
||||
|
||||
@ -414,18 +415,18 @@ void MainWindow::doLogin(const QString& errorMsg)
|
||||
|
||||
void MainWindow::onLoginComplete(LoginResponse response)
|
||||
{
|
||||
Q_ASSERT_X(m_activeInst != NULL, "onLoginComplete", "no active instance is set");
|
||||
if(!m_activeInst)
|
||||
return;
|
||||
|
||||
if (!m_activeInst->shouldUpdate())
|
||||
GameUpdateTask *updateTask = m_activeInst->doUpdate();
|
||||
if(!updateTask)
|
||||
{
|
||||
launchInstance(m_activeInst, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskDialog *tDialog = new TaskDialog(this);
|
||||
GameUpdateTask *updateTask = new GameUpdateTask(response, m_activeInst);
|
||||
connect(updateTask, SIGNAL(gameUpdateComplete(LoginResponse)),
|
||||
SLOT(onGameUpdateComplete(LoginResponse)));
|
||||
connect(updateTask, SIGNAL(gameUpdateComplete(LoginResponse)),SLOT(onGameUpdateComplete(LoginResponse)));
|
||||
connect(updateTask, SIGNAL(gameUpdateError(QString)), SLOT(onGameUpdateError(QString)));
|
||||
tDialog->exec(updateTask);
|
||||
}
|
||||
@ -433,37 +434,24 @@ void MainWindow::onLoginComplete(LoginResponse response)
|
||||
|
||||
void MainWindow::onGameUpdateComplete(LoginResponse response)
|
||||
{
|
||||
launchInstance(response);
|
||||
launchInstance(m_activeInst, response);
|
||||
}
|
||||
|
||||
void MainWindow::onGameUpdateError(QString error)
|
||||
{
|
||||
QMessageBox::warning(this, "Error downloading instance", error);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::launchInstance(LoginResponse response)
|
||||
{
|
||||
Q_ASSERT_X(m_activeInst != NULL, "onLoginComplete", "no active instance is set");
|
||||
launchInstance(m_activeInst, response);
|
||||
}
|
||||
|
||||
void MainWindow::launchInstance(QString instID, LoginResponse response)
|
||||
{
|
||||
BaseInstance *instance = instList.getInstanceById(instID).data();
|
||||
Q_ASSERT_X(instance != NULL, "launchInstance", "instance ID does not correspond to a valid instance");
|
||||
launchInstance(instance, response);
|
||||
QMessageBox::warning(this, "Error updating instance", error);
|
||||
}
|
||||
|
||||
void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
|
||||
{
|
||||
Q_ASSERT_X(instance != NULL, "launchInstance", "instance is NULL");
|
||||
|
||||
console = new ConsoleWindow();
|
||||
proc = new MinecraftProcess(instance, response.username(), response.sessionID());
|
||||
proc = instance->prepareForLaunch(response.username(), response.sessionID());
|
||||
if(!proc)
|
||||
return;
|
||||
|
||||
console = new ConsoleWindow();
|
||||
console->show();
|
||||
//connect(proc, SIGNAL(ended()), SLOT(onTerminated()));
|
||||
connect(proc, SIGNAL(log(QString, MessageLevel::Enum)),
|
||||
console, SLOT(write(QString, MessageLevel::Enum)));
|
||||
proc->launch();
|
||||
@ -536,7 +524,8 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
|
||||
VersionSelectDialog *vselect = new VersionSelectDialog(inst->versionList(), this);
|
||||
if (vselect->exec() && vselect->selectedVersion())
|
||||
{
|
||||
inst->setIntendedVersion(vselect->selectedVersion()->descriptor());
|
||||
// FIXME:HACKERY
|
||||
// inst->setIntendedVersion(vselect->selectedVersion()->descriptor());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,12 +113,10 @@ private slots:
|
||||
public slots:
|
||||
void instanceActivated ( QModelIndex );
|
||||
|
||||
void instanceChanged ( QModelIndex );
|
||||
void instanceChanged ( QModelIndex );
|
||||
|
||||
void startTask(Task *task);
|
||||
|
||||
void launchInstance(LoginResponse response);
|
||||
void launchInstance(QString instID, LoginResponse response);
|
||||
void launchInstance(BaseInstance *inst, LoginResponse response);
|
||||
|
||||
private:
|
||||
|
@ -122,7 +122,6 @@ void SettingsDialog::applySettings(SettingsObject *s)
|
||||
s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->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());
|
||||
@ -159,7 +158,6 @@ void SettingsDialog::loadSettings(SettingsObject *s)
|
||||
ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").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());
|
||||
|
Reference in New Issue
Block a user