NOISSUE Split MultiMC app object into MultiMC and Env
This commit is contained in:
@ -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>
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "logic/LegacyInstance.h"
|
||||
#include "logic/forge/ForgeVersion.h"
|
||||
#include "logic/forge/ForgeVersionList.h"
|
||||
#include "logic/Env.h"
|
||||
#include "MultiMC.h"
|
||||
|
||||
LegacyJarModPage::LegacyJarModPage(LegacyInstance *inst, QWidget *parent)
|
||||
@ -109,7 +110,7 @@ void LegacyJarModPage::on_addForgeBtn_clicked()
|
||||
std::dynamic_pointer_cast<ForgeVersion>(vselect.selectedVersion());
|
||||
if (!forge)
|
||||
return;
|
||||
auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename());
|
||||
auto entry = Env::getInstance().metacache()->resolveEntry("minecraftforge", forge->filename());
|
||||
if (entry->stale)
|
||||
{
|
||||
NetJob *fjob = new NetJob("Forge download");
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "logic/net/URLConstants.h"
|
||||
#include "logic/Env.h"
|
||||
|
||||
#include "gui/dialogs/EditAccountDialog.h"
|
||||
#include "gui/dialogs/ProgressDialog.h"
|
||||
@ -129,7 +130,7 @@ void AccountListPage::addAccount(const QString &errMsg)
|
||||
|
||||
for (AccountProfile 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);
|
||||
job->addNetAction(action);
|
||||
|
@ -74,8 +74,6 @@ void MinecraftPage::on_maximizedCheckBox_clicked(bool checked)
|
||||
void MinecraftPage::applySettings()
|
||||
{
|
||||
auto s = MMC->settings();
|
||||
// Minecraft version updates
|
||||
s->set("AutoUpdateMinecraftVersions", ui->autoupdateMinecraft->isChecked());
|
||||
|
||||
// Window Size
|
||||
s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
|
||||
@ -86,8 +84,6 @@ void MinecraftPage::applySettings()
|
||||
void MinecraftPage::loadSettings()
|
||||
{
|
||||
auto s = MMC->settings();
|
||||
// Minecraft version updates
|
||||
ui->autoupdateMinecraft->setChecked(s->get("AutoUpdateMinecraftVersions").toBool());
|
||||
|
||||
// Window Size
|
||||
ui->maximizedCheckBox->setChecked(s->get("LaunchMaximized").toBool());
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>545</width>
|
||||
<height>270</height>
|
||||
<height>195</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -49,22 +49,6 @@
|
||||
<string>Minecraft</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Minecraft Version Updates</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoupdateMinecraft">
|
||||
<property name="text">
|
||||
<string>Automatically update to latest version revision</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="windowSizeGroupBox">
|
||||
<property name="title">
|
||||
@ -155,7 +139,6 @@
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>autoupdateMinecraft</tabstop>
|
||||
<tabstop>maximizedCheckBox</tabstop>
|
||||
<tabstop>windowWidthSpinBox</tabstop>
|
||||
<tabstop>windowHeightSpinBox</tabstop>
|
||||
|
Reference in New Issue
Block a user