From f486e6fa4e5893c4f437147e5a031e64b48035e7 Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Thu, 11 Feb 2021 18:39:06 -0700 Subject: Updates to text, title and buttons --- src/selfupdater.cpp | 8 +++++--- src/updatedialog.cpp | 12 ++++++++++-- src/updatedialog.h | 3 ++- src/updatedialog.ui | 34 ++++------------------------------ 4 files changed, 21 insertions(+), 36 deletions(-) diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index 68aecc46..4b2894fd 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -165,9 +165,11 @@ void SelfUpdater::startUpdate() auto latestRelease = m_UpdateCandidates.begin()->second; - UpdateDialog dialog(m_Parent, tr("New update available (%1 -> %2)") - .arg(MOShared::createVersionInfo().displayString(3)) - .arg(latestRelease["tag_name"].toString())); + UpdateDialog dialog(m_Parent); + dialog.setVersions( + MOShared::createVersionInfo().displayString(3), + latestRelease["tag_name"].toString() + ); // We concatenate release details. We only include pre-release if those are // the latest release: diff --git a/src/updatedialog.cpp b/src/updatedialog.cpp index 1be58576..d3336e93 100644 --- a/src/updatedialog.cpp +++ b/src/updatedialog.cpp @@ -6,12 +6,11 @@ using namespace MOBase; -UpdateDialog::UpdateDialog(QWidget* parent, const QString& title) : +UpdateDialog::UpdateDialog(QWidget* parent) : QDialog(parent, Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint), ui(new Ui::UpdateDialog) { // Basic UI stuff ui->setupUi(this); - setWindowTitle(title); connect(ui->installButton, &QPushButton::pressed, this, [&]{ done(QDialog::Accepted); }); connect(ui->cancelButton, &QPushButton::pressed, this, [&]{ done(QDialog::Rejected); }); @@ -57,3 +56,12 @@ void UpdateDialog::setChangeLogs(const QString& text) { m_changeLogs.setText(text); } + +void UpdateDialog::setVersions(const QString& oldVersion, const QString& newVersion) +{ + ui->updateLabel->setText( + tr("Mod Organizer %1 is available. The current version is %2. Updating will not affect your mods or profiles.") + .arg(newVersion) + .arg(oldVersion) + ); +} diff --git a/src/updatedialog.h b/src/updatedialog.h index dbcf28a7..1dd5e0b1 100644 --- a/src/updatedialog.h +++ b/src/updatedialog.h @@ -13,10 +13,11 @@ class UpdateDialog : public QDialog Q_OBJECT; public: - UpdateDialog(QWidget* parent, const QString& title); + UpdateDialog(QWidget* parent); ~UpdateDialog(); void setChangeLogs(const QString& text); + void setVersions(const QString& oldVersion, const QString& newVersion); private: std::unique_ptr ui; diff --git a/src/updatedialog.ui b/src/updatedialog.ui index 43a17346..874cbb80 100644 --- a/src/updatedialog.ui +++ b/src/updatedialog.ui @@ -17,7 +17,7 @@ - New update available (xxxx) + Update available true @@ -27,7 +27,7 @@ - + 0 @@ -80,40 +80,14 @@ - - - 400 - 0 - - - - - 400 - 16777215 - - - Do you want to install the update? All your mods and setup will be left untouched. -Select Show Details option to see the full change-log. + Update text placeholder true - - - - Qt::Horizontal - - - - 20 - 20 - - - - @@ -121,7 +95,7 @@ Select Show Details option to see the full change-log. - Show Details... + Changelog -- cgit v1.3.1