mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
Qt: Minor improvements to auto-updater (icon, show download size)
This commit is contained in:
parent
e88d36513e
commit
7255530d87
|
@ -53,9 +53,6 @@ AutoUpdaterDialog::AutoUpdaterDialog(QtHostInterface* host_interface, QWidget* p
|
||||||
|
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
// m_ui.description->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
||||||
// m_ui.description->setOpenExternalLinks(true);
|
|
||||||
|
|
||||||
connect(m_ui.downloadAndInstall, &QPushButton::clicked, this, &AutoUpdaterDialog::downloadUpdateClicked);
|
connect(m_ui.downloadAndInstall, &QPushButton::clicked, this, &AutoUpdaterDialog::downloadUpdateClicked);
|
||||||
connect(m_ui.skipThisUpdate, &QPushButton::clicked, this, &AutoUpdaterDialog::skipThisUpdateClicked);
|
connect(m_ui.skipThisUpdate, &QPushButton::clicked, this, &AutoUpdaterDialog::skipThisUpdateClicked);
|
||||||
connect(m_ui.remindMeLater, &QPushButton::clicked, this, &AutoUpdaterDialog::remindMeLaterClicked);
|
connect(m_ui.remindMeLater, &QPushButton::clicked, this, &AutoUpdaterDialog::remindMeLaterClicked);
|
||||||
|
@ -197,6 +194,7 @@ void AutoUpdaterDialog::getLatestReleaseComplete(QNetworkReply* reply)
|
||||||
m_download_url = asset_obj["browser_download_url"].toString();
|
m_download_url = asset_obj["browser_download_url"].toString();
|
||||||
if (!m_download_url.isEmpty())
|
if (!m_download_url.isEmpty())
|
||||||
{
|
{
|
||||||
|
m_download_size = asset_obj["size"].toInt();
|
||||||
m_ui.currentVersion->setText(tr("Current Version: %1 (%2)").arg(g_scm_hash_str).arg(g_scm_date_str));
|
m_ui.currentVersion->setText(tr("Current Version: %1 (%2)").arg(g_scm_hash_str).arg(g_scm_date_str));
|
||||||
m_ui.newVersion->setText(
|
m_ui.newVersion->setText(
|
||||||
tr("New Version: %1 (%2)").arg(m_latest_sha).arg(doc_object["published_at"].toString()));
|
tr("New Version: %1 (%2)").arg(m_latest_sha).arg(doc_object["published_at"].toString()));
|
||||||
|
@ -269,8 +267,10 @@ void AutoUpdaterDialog::getChangesComplete(QNetworkReply* reply)
|
||||||
if (first_line_terminator >= 0)
|
if (first_line_terminator >= 0)
|
||||||
message.remove(first_line_terminator, message.size() - first_line_terminator);
|
message.remove(first_line_terminator, message.size() - first_line_terminator);
|
||||||
if (!message.isEmpty())
|
if (!message.isEmpty())
|
||||||
|
{
|
||||||
changes_html +=
|
changes_html +=
|
||||||
QStringLiteral("<li>%1 <i>(%2)</i></li>").arg(message.toHtmlEscaped()).arg(author.toHtmlEscaped());
|
QStringLiteral("<li>%1 <i>(%2)</i></li>").arg(message.toHtmlEscaped()).arg(author.toHtmlEscaped());
|
||||||
|
}
|
||||||
|
|
||||||
if (message.contains(QStringLiteral("[SAVEVERSION+]")))
|
if (message.contains(QStringLiteral("[SAVEVERSION+]")))
|
||||||
update_will_break_save_states = true;
|
update_will_break_save_states = true;
|
||||||
|
@ -285,6 +285,9 @@ void AutoUpdaterDialog::getChangesComplete(QNetworkReply* reply)
|
||||||
"before installing this update or you will lose progress.</p>"));
|
"before installing this update or you will lose progress.</p>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changes_html += tr("<h4>Installing this update will download %1 MB through your internet connection.</h4>")
|
||||||
|
.arg(static_cast<double>(m_download_size) / 1000000.0, 0, 'f', 2);
|
||||||
|
|
||||||
m_ui.updateNotes->setText(changes_html);
|
m_ui.updateNotes->setText(changes_html);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -53,6 +53,7 @@ private:
|
||||||
QNetworkAccessManager* m_network_access_mgr = nullptr;
|
QNetworkAccessManager* m_network_access_mgr = nullptr;
|
||||||
QString m_latest_sha;
|
QString m_latest_sha;
|
||||||
QString m_download_url;
|
QString m_download_url;
|
||||||
|
int m_download_size = 0;
|
||||||
|
|
||||||
bool m_display_messages = false;
|
bool m_display_messages = false;
|
||||||
bool m_update_will_break_save_states = false;
|
bool m_update_will_break_save_states = false;
|
||||||
|
|
|
@ -21,18 +21,38 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||||
<property name="font">
|
<item>
|
||||||
<font>
|
<widget class="QLabel" name="label_2">
|
||||||
<pointsize>16</pointsize>
|
<property name="sizePolicy">
|
||||||
<weight>75</weight>
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
<bold>true</bold>
|
<horstretch>0</horstretch>
|
||||||
</font>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Update Available</string>
|
<property name="text">
|
||||||
</property>
|
<string/>
|
||||||
</widget>
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="resources/resources.qrc">:/icons/software-update-available.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Update Available</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="currentVersion">
|
<widget class="QLabel" name="currentVersion">
|
||||||
|
@ -49,18 +69,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QTextBrowser" name="updateNotes"/>
|
||||||
<property name="text">
|
|
||||||
<string>Update Notes:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="updateNotes">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
@ -79,12 +88,12 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="downloadAndInstall">
|
<widget class="QPushButton" name="downloadAndInstall">
|
||||||
<property name="text">
|
|
||||||
<string>Download and Install...</string>
|
|
||||||
</property>
|
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Download and Install...</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -108,6 +117,8 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="resources/resources.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Reference in a new issue