forked from PCSX2/pcsx2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a289723
commit 41f1ec4
Showing
11 changed files
with
846 additions
and
9 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* PCSX2 - PS2 Emulator for PCs | ||
* Copyright (C) 2002-2022 PCSX2 Dev Team | ||
* | ||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU Lesser General Public License as published by the Free Software Found- | ||
* ation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
* PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with PCSX2. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
#include "ui_AutoUpdaterDialog.h" | ||
#include <string> | ||
#include <QtCore/QDateTime> | ||
#include <QtCore/QStringList> | ||
#include <QtWidgets/QDialog> | ||
|
||
class QNetworkAccessManager; | ||
class QNetworkReply; | ||
|
||
class AutoUpdaterDialog final : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit AutoUpdaterDialog(QWidget* parent = nullptr); | ||
~AutoUpdaterDialog(); | ||
|
||
static bool isSupported(); | ||
static QStringList getTagList(); | ||
static std::string getDefaultTag(); | ||
static QString getCurrentVersion(); | ||
static QString getCurrentVersionDate(); | ||
|
||
Q_SIGNALS: | ||
void updateCheckCompleted(); | ||
|
||
public Q_SLOTS: | ||
void queueUpdateCheck(bool display_message); | ||
|
||
private Q_SLOTS: | ||
void getLatestReleaseComplete(QNetworkReply* reply); | ||
|
||
void queueGetChanges(); | ||
void getChangesComplete(QNetworkReply* reply); | ||
|
||
void downloadUpdateClicked(); | ||
void skipThisUpdateClicked(); | ||
void remindMeLaterClicked(); | ||
|
||
private: | ||
void reportError(const char* msg, ...); | ||
void checkIfUpdateNeeded(); | ||
QString getCurrentUpdateTag() const; | ||
|
||
#ifdef _WIN32 | ||
bool processUpdate(const QByteArray& update_data); | ||
bool doUpdate(const QString& zip_path, const QString& updater_path, const QString& destination_path); | ||
#else | ||
bool processUpdate(const QByteArray& update_data); | ||
#endif | ||
|
||
Ui::AutoUpdaterDialog m_ui; | ||
|
||
QNetworkAccessManager* m_network_access_mgr = nullptr; | ||
QString m_latest_version; | ||
QDateTime m_latest_version_timestamp; | ||
QString m_download_url; | ||
int m_download_size = 0; | ||
|
||
bool m_display_messages = false; | ||
bool m_update_will_break_save_states = false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>AutoUpdaterDialog</class> | ||
<widget class="QDialog" name="AutoUpdaterDialog"> | ||
<property name="windowModality"> | ||
<enum>Qt::ApplicationModal</enum> | ||
</property> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>651</width> | ||
<height>474</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Automatic Updater</string> | ||
</property> | ||
<property name="modal"> | ||
<bool>true</bool> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1"> | ||
<item> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="maximumSize"> | ||
<size> | ||
<width>24</width> | ||
<height>24</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string/> | ||
</property> | ||
<property name="pixmap"> | ||
<pixmap resource="resources/resources.qrc">:/icons/update.png</pixmap> | ||
</property> | ||
<property name="scaledContents"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label"> | ||
<property name="font"> | ||
<font> | ||
<pointsize>16</pointsize> | ||
<bold>true</bold> | ||
</font> | ||
</property> | ||
<property name="text"> | ||
<string>Update Available</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="currentVersion"> | ||
<property name="text"> | ||
<string>Current Version: </string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="newVersion"> | ||
<property name="text"> | ||
<string>New Version: </string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QTextBrowser" name="updateNotes"/> | ||
</item> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="downloadAndInstall"> | ||
<property name="enabled"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="text"> | ||
<string>Download and Install...</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="skipThisUpdate"> | ||
<property name="text"> | ||
<string>Skip This Update</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="remindMeLater"> | ||
<property name="text"> | ||
<string>Remind Me Later</string> | ||
</property> | ||
<property name="default"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources> | ||
<include location="resources/resources.qrc"/> | ||
</resources> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.