NOISSUE Split MultiMC app object into MultiMC and Env

This commit is contained in:
Petr Mrázek
2015-01-31 16:59:03 +01:00
parent e508728246
commit 6f3aa65bd6
44 changed files with 343 additions and 325 deletions

View File

@ -375,6 +375,7 @@ namespace Ui {
#include "logic/net/URLConstants.h"
#include "logic/net/NetJob.h"
#include "logic/Env.h"
#include "logic/BaseInstance.h"
#include "logic/OneSixInstance.h"
@ -572,7 +573,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
{
for (auto profile : account->profiles())
{
auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.name + ".png");
auto action = CacheDownload::make(
QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta);
skin_dls.append(action);
@ -619,7 +620,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
if (MMC->settings()->get("AutoUpdate").toBool())
{
auto updater = MMC->updateChecker();
updater->checkForUpdate(false);
updater->checkForUpdate(MMC->settings()->get("UpdateChannel").toString(), false);
}
m_notificationChecker.reset(new NotificationChecker());
connect(m_notificationChecker.get(),
@ -981,7 +982,7 @@ void MainWindow::downloadUpdates(QString repo, int versionId, bool installOnExit
// Doing so is a bit complicated, because we'd have to make sure it finished downloading
// before actually exiting MultiMC.
ProgressDialog updateDlg(this);
DownloadUpdateTask updateTask(repo, versionId, &updateDlg);
DownloadUpdateTask updateTask(MMC->root(), repo, versionId, &updateDlg);
// If the task succeeds, install the updates.
if (updateDlg.exec(&updateTask))
{
@ -1070,7 +1071,7 @@ void MainWindow::instanceFromZipPack(QString instName, QString instGroup, QStrin
else
{
const QString path = url.host() + '/' + url.path();
auto entry = MMC->metacache()->resolveEntry("general", path);
auto entry = ENV.metacache()->resolveEntry("general", path);
CacheDownloadPtr dl = CacheDownload::make(url, entry);
NetJob job(tr("Modpack download"));
job.addNetAction(dl);
@ -1357,7 +1358,7 @@ void MainWindow::on_actionConfig_Folder_triggered()
void MainWindow::on_actionCheckUpdate_triggered()
{
auto updater = MMC->updateChecker();
updater->checkForUpdate(true);
updater->checkForUpdate(MMC->settings()->get("UpdateChannel").toString(), true);
}
template <typename T>