mirror of
https://github.com/RyzenDew/Lime-3DS-Emulator.git
synced 2024-06-02 15:38:50 +02:00
Merge b10d6b4928
into 6e7cc65ec4
This commit is contained in:
commit
642b583605
|
@ -14,6 +14,7 @@
|
|||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
#include <QtNetwork/QtNetwork>
|
||||
#include <fmt/format.h>
|
||||
#ifdef __APPLE__
|
||||
#include <unistd.h> // for chdir
|
||||
|
@ -197,6 +198,7 @@ GMainWindow::GMainWindow(Core::System& system_)
|
|||
InitializeRecentFileMenuActions();
|
||||
InitializeSaveStateMenuActions();
|
||||
InitializeHotkeys();
|
||||
ShowUpdatePopup();
|
||||
#if ENABLE_QT_UPDATER
|
||||
ShowUpdaterWidgets();
|
||||
#else
|
||||
|
@ -272,7 +274,6 @@ GMainWindow::GMainWindow(Core::System& system_)
|
|||
CheckForUpdates();
|
||||
}
|
||||
#endif
|
||||
|
||||
QStringList args = QApplication::arguments();
|
||||
if (args.size() < 2) {
|
||||
return;
|
||||
|
@ -1070,6 +1071,35 @@ void GMainWindow::ShowUpdaterWidgets() {
|
|||
}
|
||||
#endif
|
||||
|
||||
void GMainWindow::ShowUpdatePopup() {
|
||||
QNetworkAccessManager* manager = new QNetworkAccessManager();
|
||||
QObject::connect(manager, &QNetworkAccessManager::finished, this, [&](QNetworkReply *reply) {
|
||||
if (reply->error()) {
|
||||
QByteArray ba = reply->errorString().toLocal8Bit();
|
||||
QMessageBox::information(
|
||||
this, tr("New Lime3DS Version"),
|
||||
tr( ba.data()
|
||||
));
|
||||
manager->clearAccessCache();
|
||||
return;
|
||||
} else {
|
||||
QJsonObject jsonObject = QJsonDocument::fromJson(reply->readAll()).object();
|
||||
QString jsonTag = jsonObject[QStringLiteral("tag_name")].toString();
|
||||
if (jsonTag != QString::fromUtf8(Common::g_build_fullname)) {
|
||||
QMessageBox::information(
|
||||
this, tr("New Lime3DS Version"),
|
||||
tr( " "
|
||||
"A New Version of Lime3DS is Available!"
|
||||
"Download <a href='https://github.com/Lime3DS/Lime3DS/releases'>here</a>"
|
||||
));
|
||||
}
|
||||
}
|
||||
});
|
||||
QUrl url(QStringLiteral("https://api.github.com/repos/Lime3DS/Lime3DS/releases/latest"));
|
||||
QNetworkRequest networkRequest(url);
|
||||
manager->get(networkRequest);
|
||||
}
|
||||
|
||||
#if defined(HAVE_SDL2) && defined(__unix__) && !defined(__APPLE__)
|
||||
static std::optional<QDBusObjectPath> HoldWakeLockLinux(u32 window_id = 0) {
|
||||
if (!QDBusConnection::sessionBus().isConnected()) {
|
||||
|
|
|
@ -161,6 +161,7 @@ private:
|
|||
void ShowNoUpdatePrompt();
|
||||
void CheckForUpdates();
|
||||
#endif
|
||||
void ShowUpdatePopup();
|
||||
|
||||
/**
|
||||
* Stores the filename in the recently loaded files list.
|
||||
|
|
Loading…
Reference in New Issue
Block a user