diff options
| author | Chris Bessent <lost.dragonist@gmail.com> | 2021-02-08 08:24:51 -0700 |
|---|---|---|
| committer | Chris Bessent <lost.dragonist@gmail.com> | 2021-02-11 17:58:10 -0700 |
| commit | 3dd05ff869e5113fc9a5f474786c226dd556fc1b (patch) | |
| tree | c028228dcf5b1f4be43bcc68624a4f97d7cc2de1 /src/selfupdater.cpp | |
| parent | f058125e6679560e5ade95a76c05acd6eb5274d4 (diff) | |
Create a new dialog for the update window
The idea here is to be able to resize the window and better handle
markdown formatting. Everything was stolen from the LOOT dialog.
Diffstat (limited to 'src/selfupdater.cpp')
| -rw-r--r-- | src/selfupdater.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index 70ab9090..68aecc46 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -32,6 +32,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <versioninfo.h>
#include <report.h>
#include "shared/util.h"
+#include "updatedialog.h"
#include <QApplication>
#include <QCoreApplication>
@@ -164,10 +165,9 @@ void SelfUpdater::startUpdate() auto latestRelease = m_UpdateCandidates.begin()->second;
- QMessageBox query(QMessageBox::Question,
- tr("New update available (%1)")
- .arg(latestRelease["tag_name"].toString()), tr("Do you want to install update? All your mods and setup will be left untouched.\nSelect Show Details option to see the full change-log."),
- QMessageBox::Yes | QMessageBox::Cancel, m_Parent);
+ UpdateDialog dialog(m_Parent, tr("New update available (%1 -> %2)")
+ .arg(MOShared::createVersionInfo().displayString(3))
+ .arg(latestRelease["tag_name"].toString()));
// We concatenate release details. We only include pre-release if those are
// the latest release:
@@ -186,24 +186,16 @@ void SelfUpdater::startUpdate() includePreRelease = false;
}
- details += "\n# " + release["tag_name"].toString() + "\n---\n";
+ details += "\n## " + release["tag_name"].toString() + "\n---\n";
details += release["body"].toString();
}
// Need to call setDetailedText to create the QTextEdit and then be able to retrieve it:
- query.setDetailedText(details);
- QTextEdit* textEdit = query.findChild<QTextEdit*>();
+ dialog.setChangeLogs(details);
- // If we have the text edit, we can call setMarkdown to get proper formatting.
- if (textEdit) {
- textEdit->setMarkdown(details);
- }
-
- query.button(QMessageBox::Yes)->setText(tr("Install"));
-
- int res = query.exec();
+ int res = dialog.exec();
- if (query.result() == QMessageBox::Yes) {
+ if (dialog.result() == QDialog::Accepted) {
bool found = false;
for (const QJsonValue &assetVal : latestRelease["assets"].toArray()) {
QJsonObject asset = assetVal.toObject();
|
