summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2018-05-25 00:19:36 +0200
committerspycrab <spycrab@users.noreply.github.com>2018-05-27 04:12:21 +0200
commitec322271ee219c6e8c1145ff9db2f6913fdf8049 (patch)
tree09662ea1b62740e5e8d21a2b6aac1a1a6c0b5680 /Source/Core
parentdfb1dbad47efeec60490f910254d53fe70b54477 (diff)
Qt: Add option to invoke the updater manually
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt2/MenuBar.cpp29
-rw-r--r--Source/Core/DolphinQt2/MenuBar.h4
-rw-r--r--Source/Core/DolphinQt2/Updater.cpp12
-rw-r--r--Source/Core/DolphinQt2/Updater.h2
4 files changed, 46 insertions, 1 deletions
diff --git a/Source/Core/DolphinQt2/MenuBar.cpp b/Source/Core/DolphinQt2/MenuBar.cpp
index 41e818ebf0..178beb12d6 100644
--- a/Source/Core/DolphinQt2/MenuBar.cpp
+++ b/Source/Core/DolphinQt2/MenuBar.cpp
@@ -49,6 +49,7 @@
#include "DolphinQt2/Host.h"
#include "DolphinQt2/QtUtils/ActionHelper.h"
#include "DolphinQt2/Settings.h"
+#include "DolphinQt2/Updater.h"
#include "UICommon/GameFile.h"
@@ -490,9 +491,31 @@ void MenuBar::AddOptionsMenu()
m_change_font = AddAction(options_menu, tr("&Font..."), this, &MenuBar::ChangeDebugFont);
}
+#ifdef _WIN32
+void MenuBar::InstallUpdateManually()
+{
+ auto& track = SConfig::GetInstance().m_auto_update_track;
+ auto previous_value = track;
+
+ track = "dev";
+
+ auto* updater = new Updater(this);
+
+ if (!updater->CheckForUpdate())
+ {
+ QMessageBox::information(
+ this, tr("Update"),
+ tr("You are running the latest version available on this update track"));
+ }
+
+ track = previous_value;
+}
+#endif
+
void MenuBar::AddHelpMenu()
{
QMenu* help_menu = addMenu(tr("&Help"));
+
QAction* website = help_menu->addAction(tr("&Website"));
connect(website, &QAction::triggered, this,
[]() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/"))); });
@@ -505,6 +528,12 @@ void MenuBar::AddHelpMenu()
QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/dolphin-emu/dolphin")));
});
+#ifdef _WIN32
+ help_menu->addSeparator();
+
+ AddAction(help_menu, tr("&Check for Updates..."), this, &MenuBar::InstallUpdateManually);
+#endif
+
help_menu->addSeparator();
AddAction(help_menu, tr("&About"), this, &MenuBar::ShowAboutDialog);
}
diff --git a/Source/Core/DolphinQt2/MenuBar.h b/Source/Core/DolphinQt2/MenuBar.h
index 8998c8f3d5..b61a4347e8 100644
--- a/Source/Core/DolphinQt2/MenuBar.h
+++ b/Source/Core/DolphinQt2/MenuBar.h
@@ -36,6 +36,10 @@ public:
void UpdateStateSlotMenu();
void UpdateToolsMenu(bool emulation_started);
+#ifdef _WIN32
+ void InstallUpdateManually();
+#endif
+
signals:
// File
void Open();
diff --git a/Source/Core/DolphinQt2/Updater.cpp b/Source/Core/DolphinQt2/Updater.cpp
index 6ef92a6b0b..fdff716ed3 100644
--- a/Source/Core/DolphinQt2/Updater.cpp
+++ b/Source/Core/DolphinQt2/Updater.cpp
@@ -8,6 +8,7 @@
#include <QDialog>
#include <QDialogButtonBox>
#include <QLabel>
+#include <QMessageBox>
#include <QPushButton>
#include <QTextBrowser>
#include <QVBoxLayout>
@@ -23,12 +24,21 @@ Updater::Updater(QWidget* parent) : m_parent(parent)
void Updater::run()
{
- CheckForUpdate();
+ AutoUpdateChecker::CheckForUpdate();
+}
+
+bool Updater::CheckForUpdate()
+{
+ m_update_available = false;
+ AutoUpdateChecker::CheckForUpdate();
+
+ return m_update_available;
}
void Updater::OnUpdateAvailable(const NewVersionInformation& info)
{
bool later = false;
+ m_update_available = true;
std::optional<int> choice = RunOnObject(m_parent, [&] {
QDialog* dialog = new QDialog(m_parent);
diff --git a/Source/Core/DolphinQt2/Updater.h b/Source/Core/DolphinQt2/Updater.h
index 9083dfede5..462424ea89 100644
--- a/Source/Core/DolphinQt2/Updater.h
+++ b/Source/Core/DolphinQt2/Updater.h
@@ -18,7 +18,9 @@ public:
void run() override;
void OnUpdateAvailable(const NewVersionInformation& info) override;
+ bool CheckForUpdate();
private:
QWidget* m_parent;
+ bool m_update_available = false;
};