Errr... I forgot.

This commit is contained in:
Petr Mrázek
2013-08-03 23:58:39 +02:00
parent 13b1b98f7c
commit 4f73091bb5
19 changed files with 269 additions and 382 deletions

View File

@ -192,15 +192,13 @@ void MainWindow::on_actionAddInstance_triggered()
QString instDir = PathCombine(globalSettings->get("InstanceDir").toString(), instDirName);
auto &loader = InstanceFactory::get();
auto error = loader.createInstance(newInstance, instDir);
QString errorMsg = QString("Failed to create instance %1: ").arg(instDirName);
auto error = loader.createInstance(newInstance, newInstDlg->selectedVersion(), instDir);
QString errorMsg = QString("Failed to create instance %1: ").arg(instDirName);
switch (error)
{
case InstanceFactory::NoCreateError:
newInstance->setName(newInstDlg->instName());
// FIXME:HACKERY
// newInstance->setIntendedVersion(newInstDlg->selectedVersion()->descriptor());
instList.add(InstancePtr(newInstance));
return;
@ -417,24 +415,25 @@ void MainWindow::onLoginComplete(LoginResponse response)
{
if(!m_activeInst)
return;
m_activeLogin = LoginResponse(response);
GameUpdateTask *updateTask = m_activeInst->doUpdate();
if(!updateTask)
{
launchInstance(m_activeInst, response);
launchInstance(m_activeInst, m_activeLogin);
}
else
{
TaskDialog *tDialog = new TaskDialog(this);
connect(updateTask, SIGNAL(gameUpdateComplete(LoginResponse)),SLOT(onGameUpdateComplete(LoginResponse)));
connect(updateTask, SIGNAL(gameUpdateComplete()),SLOT(onGameUpdateComplete()));
connect(updateTask, SIGNAL(gameUpdateError(QString)), SLOT(onGameUpdateError(QString)));
tDialog->exec(updateTask);
}
}
void MainWindow::onGameUpdateComplete(LoginResponse response)
void MainWindow::onGameUpdateComplete()
{
launchInstance(m_activeInst, response);
launchInstance(m_activeInst, m_activeLogin);
}
void MainWindow::onGameUpdateError(QString error)
@ -446,7 +445,7 @@ void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response)
{
Q_ASSERT_X(instance != NULL, "launchInstance", "instance is NULL");
proc = instance->prepareForLaunch(response.username(), response.sessionID());
proc = instance->prepareForLaunch(response.username, response.sessionID);
if(!proc)
return;
@ -524,8 +523,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
VersionSelectDialog *vselect = new VersionSelectDialog(inst->versionList(), this);
if (vselect->exec() && vselect->selectedVersion())
{
// FIXME:HACKERY
// inst->setIntendedVersion(vselect->selectedVersion()->descriptor());
inst->setIntendedVersionId(vselect->selectedVersion()->descriptor());
}
}

View File

@ -19,7 +19,7 @@
#include <QMainWindow>
#include "lists/InstanceList.h"
#include "tasks/LoginResponse.h"
#include "tasks/LoginTask.h"
#include "BaseInstance.h"
class InstanceModel;
@ -100,7 +100,7 @@ private slots:
void onLoginComplete(LoginResponse response);
void onGameUpdateComplete(LoginResponse response);
void onGameUpdateComplete();
void onGameUpdateError(QString error);
void taskStart(Task *task);
@ -133,6 +133,7 @@ private:
// This is set when the user launches an instance and is used to refer to that
// instance throughout the launching process.
BaseInstance *m_activeInst;
LoginResponse m_activeLogin;
Task *m_versionLoadTask;
};