summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/MainWindow.cpp30
-rw-r--r--gui/dialogs/CopyInstanceDialog.cpp1
-rw-r--r--gui/dialogs/NewInstanceDialog.cpp1
3 files changed, 14 insertions, 18 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index 059f6d3b..8aa2e635 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -378,7 +378,6 @@ namespace Ui {
#include "logic/BaseInstance.h"
#include "logic/OneSixInstance.h"
-#include "logic/InstanceFactory.h"
#include "logic/BaseProcess.h"
#include "logic/OneSixUpdate.h"
#include "logic/java/JavaUtils.h"
@@ -1061,7 +1060,7 @@ void MainWindow::instanceFromZipPack(QString instName, QString instGroup, QStrin
QString instancesDir = MMC->settings()->get("InstanceDir").toString();
QString instDirName = DirNameFromString(instName, instancesDir);
QString instDir = PathCombine(instancesDir, instDirName);
- auto &loader = InstanceFactory::get();
+
QString archivePath;
if (url.isLocalFile())
{
@@ -1105,15 +1104,15 @@ void MainWindow::instanceFromZipPack(QString instName, QString instGroup, QStrin
return;
}
- auto error = loader.loadInstance(newInstance, instDir);
+ auto error = MMC->instances()->loadInstance(newInstance, instDir);
QString errorMsg = tr("Failed to load instance %1: ").arg(instDirName);
switch (error)
{
- case InstanceFactory::UnknownLoadError:
+ case InstanceList::UnknownLoadError:
errorMsg += tr("Unkown error");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
return;
- case InstanceFactory::NotAnInstance:
+ case InstanceList::NotAnInstance:
errorMsg += tr("Not an instance");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
return;
@@ -1135,20 +1134,21 @@ void MainWindow::instanceFromVersion(QString instName, QString instGroup, QStrin
QString instancesDir = MMC->settings()->get("InstanceDir").toString();
QString instDirName = DirNameFromString(instName, instancesDir);
QString instDir = PathCombine(instancesDir, instDirName);
- auto &loader = InstanceFactory::get();
- auto error = loader.createInstance(newInstance, version, instDir);
+ auto error = MMC->instances()->createInstance(newInstance, version, instDir);
QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName);
switch (error)
{
- case InstanceFactory::NoCreateError: break;
- case InstanceFactory::InstExists:
+ case InstanceList::NoCreateError:
+ break;
+
+ case InstanceList::InstExists:
{
errorMsg += tr("An instance with the given directory name already exists.");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
return;
}
- case InstanceFactory::CantCreateDir:
+ case InstanceList::CantCreateDir:
{
errorMsg += tr("Failed to create the instance directory.");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
@@ -1231,29 +1231,27 @@ void MainWindow::on_actionCopyInstance_triggered()
QString instDirName = DirNameFromString(copyInstDlg.instName(), instancesDir);
QString instDir = PathCombine(instancesDir, instDirName);
- auto &loader = InstanceFactory::get();
-
InstancePtr newInstance;
- auto error = loader.copyInstance(newInstance, m_selectedInstance, instDir);
+ auto error = MMC->instances()->copyInstance(newInstance, m_selectedInstance, instDir);
QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName);
switch (error)
{
- case InstanceFactory::NoCreateError:
+ case InstanceList::NoCreateError:
newInstance->setName(copyInstDlg.instName());
newInstance->setGroupInitial(copyInstDlg.instGroup());
newInstance->setIconKey(copyInstDlg.iconKey());
MMC->instances()->add(newInstance);
return;
- case InstanceFactory::InstExists:
+ case InstanceList::InstExists:
{
errorMsg += tr("An instance with the given directory name already exists.");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
break;
}
- case InstanceFactory::CantCreateDir:
+ case InstanceList::CantCreateDir:
{
errorMsg += tr("Failed to create the instance directory.");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
diff --git a/gui/dialogs/CopyInstanceDialog.cpp b/gui/dialogs/CopyInstanceDialog.cpp
index fffcee56..80418e14 100644
--- a/gui/dialogs/CopyInstanceDialog.cpp
+++ b/gui/dialogs/CopyInstanceDialog.cpp
@@ -25,7 +25,6 @@
#include "gui/dialogs/ProgressDialog.h"
#include "gui/dialogs/IconPickerDialog.h"
-#include "logic/InstanceFactory.h"
#include "logic/BaseVersion.h"
#include "logic/icons/IconList.h"
#include "logic/tasks/Task.h"
diff --git a/gui/dialogs/NewInstanceDialog.cpp b/gui/dialogs/NewInstanceDialog.cpp
index adb5c950..bba1f785 100644
--- a/gui/dialogs/NewInstanceDialog.cpp
+++ b/gui/dialogs/NewInstanceDialog.cpp
@@ -17,7 +17,6 @@
#include "NewInstanceDialog.h"
#include "ui_NewInstanceDialog.h"
-#include "logic/InstanceFactory.h"
#include "logic/BaseVersion.h"
#include "logic/icons/IconList.h"
#include "logic/minecraft/MinecraftVersionList.h"