diff options
| -rw-r--r-- | src/selfupdater.cpp | 8 | ||||
| -rw-r--r-- | src/updatedialog.cpp | 12 | ||||
| -rw-r--r-- | src/updatedialog.h | 3 | ||||
| -rw-r--r-- | 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::UpdateDialog> 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 @@ </size> </property> <property name="windowTitle"> - <string notr="true">New update available (xxxx)</string> + <string notr="true">Update available</string> </property> <property name="sizeGripEnabled"> <bool>true</bool> @@ -27,7 +27,7 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0"> + <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1"> <property name="spacing"> <number>0</number> </property> @@ -80,40 +80,14 @@ </item> <item> <widget class="QLabel" name="updateLabel"> - <property name="minimumSize"> - <size> - <width>400</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>400</width> - <height>16777215</height> - </size> - </property> <property name="text"> - <string>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.</string> + <string notr="true">Update text placeholder</string> </property> <property name="wordWrap"> <bool>true</bool> </property> </widget> </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> </layout> </item> <item> @@ -121,7 +95,7 @@ Select Show Details option to see the full change-log.</string> <item> <widget class="QToolButton" name="detailsButton"> <property name="text"> - <string>Show Details...</string> + <string>Changelog</string> </property> </widget> </item> |
