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);
|
||||
|
||||
// m_ui.description->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
// m_ui.description->setOpenExternalLinks(true);
|
||||
|
||||
connect(m_ui.downloadAndInstall, &QPushButton::clicked, this, &AutoUpdaterDialog::downloadUpdateClicked);
|
||||
connect(m_ui.skipThisUpdate, &QPushButton::clicked, this, &AutoUpdaterDialog::skipThisUpdateClicked);
|
||||
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();
|
||||
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.newVersion->setText(
|
||||
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)
|
||||
message.remove(first_line_terminator, message.size() - first_line_terminator);
|
||||
if (!message.isEmpty())
|
||||
{
|
||||
changes_html +=
|
||||
QStringLiteral("<li>%1 <i>(%2)</i></li>").arg(message.toHtmlEscaped()).arg(author.toHtmlEscaped());
|
||||
}
|
||||
|
||||
if (message.contains(QStringLiteral("[SAVEVERSION+]")))
|
||||
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>"));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -53,6 +53,7 @@ private:
|
|||
QNetworkAccessManager* m_network_access_mgr = nullptr;
|
||||
QString m_latest_sha;
|
||||
QString m_download_url;
|
||||
int m_download_size = 0;
|
||||
|
||||
bool m_display_messages = false;
|
||||
bool m_update_will_break_save_states = false;
|
||||
|
|
|
@ -21,18 +21,38 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<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>
|
||||
<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="text">
|
||||
<string/>
|
||||
</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>
|
||||
<widget class="QLabel" name="currentVersion">
|
||||
|
@ -49,18 +69,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Update Notes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="updateNotes">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextBrowser" name="updateNotes"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
|
@ -79,12 +88,12 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="downloadAndInstall">
|
||||
<property name="text">
|
||||
<string>Download and Install...</string>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Download and Install...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -108,6 +117,8 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
Loading…
Reference in a new issue