SCRATCH separate the generic updater logic from the application
This commit is contained in:
@ -369,7 +369,7 @@ namespace Ui {
|
||||
#include "logic/auth/flows/AuthenticateTask.h"
|
||||
#include "logic/auth/flows/RefreshTask.h"
|
||||
|
||||
#include "logic/updater/DownloadUpdateTask.h"
|
||||
#include "logic/updater/DownloadTask.h"
|
||||
|
||||
#include "logic/news/NewsChecker.h"
|
||||
|
||||
@ -913,7 +913,7 @@ void MainWindow::updateNewsLabel()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateAvailable(QString repo, QString versionName, int versionId)
|
||||
void MainWindow::updateAvailable(GoUpdate::Status status)
|
||||
{
|
||||
UpdateDialog dlg;
|
||||
UpdateAction action = (UpdateAction)dlg.exec();
|
||||
@ -923,10 +923,10 @@ void MainWindow::updateAvailable(QString repo, QString versionName, int versionI
|
||||
qDebug() << "Update will be installed later.";
|
||||
break;
|
||||
case UPDATE_NOW:
|
||||
downloadUpdates(repo, versionId);
|
||||
downloadUpdates(status);
|
||||
break;
|
||||
case UPDATE_ONEXIT:
|
||||
downloadUpdates(repo, versionId, true);
|
||||
downloadUpdates(status, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -977,7 +977,7 @@ void MainWindow::notificationsChanged()
|
||||
MMC->settings()->set("ShownNotifications", intListToString(shownNotifications));
|
||||
}
|
||||
|
||||
void MainWindow::downloadUpdates(QString repo, int versionId, bool installOnExit)
|
||||
void MainWindow::downloadUpdates(GoUpdate::Status status, bool installOnExit)
|
||||
{
|
||||
qDebug() << "Downloading updates.";
|
||||
// TODO: If the user chooses to update on exit, we should download updates in the
|
||||
@ -985,7 +985,9 @@ 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(MMC->root(), repo, versionId, &updateDlg);
|
||||
status.rootPath = MMC->rootPath;
|
||||
|
||||
GoUpdate::DownloadTask updateTask(status, &updateDlg);
|
||||
// If the task succeeds, install the updates.
|
||||
if (updateDlg.exec(&updateTask))
|
||||
{
|
||||
@ -1827,6 +1829,7 @@ void MainWindow::launchInstance(InstancePtr instance, AuthSessionPtr session,
|
||||
console = new ConsoleWindow(proc);
|
||||
connect(console, SIGNAL(isClosing()), this, SLOT(instanceEnded()));
|
||||
|
||||
proc->setHeader("MultiMC version: " + BuildConfig.printableVersionString() + "\n\n");
|
||||
proc->arm();
|
||||
|
||||
if (profiler)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "logic/BaseInstance.h"
|
||||
#include "logic/auth/MojangAccount.h"
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "logic/updater/GoUpdate.h"
|
||||
|
||||
class NewsChecker;
|
||||
class NotificationChecker;
|
||||
@ -157,7 +158,7 @@ slots:
|
||||
|
||||
void startTask(Task *task);
|
||||
|
||||
void updateAvailable(QString repo, QString versionName, int versionId);
|
||||
void updateAvailable(GoUpdate::Status status);
|
||||
|
||||
void updateNotAvailable();
|
||||
|
||||
@ -172,9 +173,9 @@ slots:
|
||||
void updateNewsLabel();
|
||||
|
||||
/*!
|
||||
* Runs the DownloadUpdateTask and installs updates.
|
||||
* Runs the DownloadTask and installs updates.
|
||||
*/
|
||||
void downloadUpdates(QString repo, int versionId, bool installOnExit = false);
|
||||
void downloadUpdates(GoUpdate::Status status, bool installOnExit = false);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
Reference in New Issue
Block a user