summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorSky <git@bunnies.cc>2014-01-01 14:56:26 +0000
committerSky <git@bunnies.cc>2014-01-01 14:56:26 +0000
commit821fb5e0ae5b231224fdc56a053109b675006f34 (patch)
tree587eb8659952c42e628f5d12c52ab8c98ca54394 /gui
parentf2e8a8c904b5a84d2bce7e96ef58d3a135291637 (diff)
downloadMultiMC-821fb5e0ae5b231224fdc56a053109b675006f34.tar
MultiMC-821fb5e0ae5b231224fdc56a053109b675006f34.tar.gz
MultiMC-821fb5e0ae5b231224fdc56a053109b675006f34.tar.lz
MultiMC-821fb5e0ae5b231224fdc56a053109b675006f34.tar.xz
MultiMC-821fb5e0ae5b231224fdc56a053109b675006f34.zip
Move assets migration to a task. Needs threading.
Diffstat (limited to 'gui')
-rw-r--r--gui/MainWindow.cpp26
-rw-r--r--gui/MainWindow.h1
2 files changed, 25 insertions, 2 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index 9cb79ea3..42470bb0 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -88,6 +88,7 @@
#include "logic/LegacyInstance.h"
#include "logic/assets/AssetsUtils.h"
+#include "logic/assets/AssetsMigrateTask.h"
#include <logic/updater/UpdateChecker.h>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
@@ -286,8 +287,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
// removing this looks stupid
view->setFocus();
-
- AssetsUtils::migrateOldAssets();
}
MainWindow::~MainWindow()
@@ -1163,6 +1162,29 @@ void MainWindow::instanceEnded()
this->show();
}
+void MainWindow::checkMigrateLegacyAssets()
+{
+ int legacyAssets = AssetsUtils::findLegacyAssets();
+ if(legacyAssets > 0)
+ {
+ ProgressDialog migrateDlg(this);
+ AssetsMigrateTask migrateTask(legacyAssets, &migrateDlg);
+
+ if (migrateDlg.exec(&migrateTask))
+ {
+ QLOG_INFO() << "Assets migration task completed successfully";
+ }
+ else
+ {
+ QLOG_INFO() << "Assets migration task reported failure";
+ }
+ }
+ else
+ {
+ QLOG_INFO() << "Didn't find any legacy assets to migrate";
+ }
+}
+
void MainWindow::checkSetDefaultJava()
{
bool askForJava = false;
diff --git a/gui/MainWindow.h b/gui/MainWindow.h
index 007c2e34..d6b7b845 100644
--- a/gui/MainWindow.h
+++ b/gui/MainWindow.h
@@ -51,6 +51,7 @@ public:
void openWebPage(QUrl url);
void checkSetDefaultJava();
+ void checkMigrateLegacyAssets();
private
slots: