diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-02 00:55:24 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-02 00:55:24 +0100 |
commit | 6aa9bd0f77dcb5128167fae62e32aa5252fe85c6 (patch) | |
tree | 632994a61888929af9289927d338bd19a2b3f32c /gui/MainWindow.cpp | |
parent | 613699b3626aea750093ab7eaaeccaa28c0e87c6 (diff) | |
download | MultiMC-6aa9bd0f77dcb5128167fae62e32aa5252fe85c6.tar MultiMC-6aa9bd0f77dcb5128167fae62e32aa5252fe85c6.tar.gz MultiMC-6aa9bd0f77dcb5128167fae62e32aa5252fe85c6.tar.lz MultiMC-6aa9bd0f77dcb5128167fae62e32aa5252fe85c6.tar.xz MultiMC-6aa9bd0f77dcb5128167fae62e32aa5252fe85c6.zip |
Renew the updater branch
Now with some actual consensus on what the updater will do!
Diffstat (limited to 'gui/MainWindow.cpp')
-rw-r--r-- | gui/MainWindow.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 854091c6..a6796a29 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -59,6 +59,7 @@ #include "gui/dialogs/CopyInstanceDialog.h" #include "gui/dialogs/AccountListDialog.h" #include "gui/dialogs/AccountSelectDialog.h" +#include "gui/dialogs/UpdateDialog.h" #include "gui/dialogs/EditAccountDialog.h" #include "gui/ConsoleWindow.h" @@ -83,6 +84,7 @@ #include "logic/SkinUtils.h" #include "logic/LegacyInstance.h" +#include <logic/GoUpdate.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { @@ -236,6 +238,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi MMC->lwjgllist()->loadList(); } + // set up the updater object. + auto updater = MMC->goupdate(); + connect(updater.get(), SIGNAL(updateAvailable()), SLOT(updateAvailable())); + // if automatic update checks are allowed, start one. + if(MMC->settings()->get("AutoUpdate").toBool()) + on_actionCheckUpdate_triggered(); + assets_downloader = new OneSixAssets(); connect(assets_downloader, SIGNAL(indexStarted()), SLOT(assetsIndexStarted())); connect(assets_downloader, SIGNAL(filesStarted()), SLOT(assetsFilesStarted())); @@ -417,6 +426,24 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *ev) return QMainWindow::eventFilter(obj, ev); } +void MainWindow::updateAvailable() +{ + UpdateDialog dlg; + UpdateAction action = (UpdateAction) dlg.exec(); + switch(action) + { + case UPDATE_LATER: + QLOG_INFO() << "Don't install update yet!"; + break; + case UPDATE_NOW: + QLOG_INFO() << "Install update NOW!"; + break; + case UPDATE_ONEXIT: + QLOG_INFO() << "Install update on exit!"; + break; + } +} + void MainWindow::onCatToggled(bool state) { setCatBackground(state); @@ -604,6 +631,8 @@ void MainWindow::on_actionConfig_Folder_triggered() void MainWindow::on_actionCheckUpdate_triggered() { + auto updater = MMC->goupdate(); + updater->checkForUpdate(); } void MainWindow::on_actionSettings_triggered() |