fix: final fixes
- use `done(code)` for offer dialog Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
c123558314
commit
400a2f7201
@ -47,17 +47,17 @@ UpdateAvailableDialog::UpdateAvailableDialog(const QString& currentVersion,
|
|||||||
ui->releaseNotes->setOpenExternalLinks(true);
|
ui->releaseNotes->setOpenExternalLinks(true);
|
||||||
|
|
||||||
connect(ui->skipButton, &QPushButton::clicked, this, [this](){
|
connect(ui->skipButton, &QPushButton::clicked, this, [this](){
|
||||||
this->setResult(DialogCode::Skip);
|
setResult(ResultCode::Skip);
|
||||||
this->close();
|
done(ResultCode::Skip);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->delayButton, &QPushButton::clicked, this, [this](){
|
connect(ui->delayButton, &QPushButton::clicked, this, [this](){
|
||||||
this->setResult(DialogCode::DontInstall);
|
setResult(ResultCode::DontInstall);
|
||||||
this->close();
|
done(ResultCode::DontInstall);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->installButton, &QPushButton::clicked, this, [this](){
|
connect(ui->installButton, &QPushButton::clicked, this, [this](){
|
||||||
this->setResult(DialogCode::Install);
|
setResult(ResultCode::Install);
|
||||||
this->close();
|
done(ResultCode::Install);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@ class UpdateAvailableDialog : public QDialog {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum DialogCode {
|
enum ResultCode {
|
||||||
Install,
|
Install = 10,
|
||||||
DontInstall,
|
DontInstall = 11,
|
||||||
Skip,
|
Skip = 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit UpdateAvailableDialog(const QString& currentVersion,
|
explicit UpdateAvailableDialog(const QString& currentVersion,
|
||||||
|
@ -134,7 +134,8 @@ void PrismExternalUpdater::checkForUpdates()
|
|||||||
// there was an error
|
// there was an error
|
||||||
{
|
{
|
||||||
qDebug() << "Updater subprocess error" << qPrintable(std_error);
|
qDebug() << "Updater subprocess error" << qPrintable(std_error);
|
||||||
auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update Check Error"), tr("There was an error running the update check."));
|
auto msgBox =
|
||||||
|
QMessageBox(QMessageBox::Warning, tr("Update Check Error"), tr("There was an error running the update check."));
|
||||||
msgBox.setDetailedText(std_error);
|
msgBox.setDetailedText(std_error);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
@ -244,15 +245,20 @@ void PrismExternalUpdater::offerUpdate(const QString& version_name, const QStrin
|
|||||||
auto should_skip = priv->settings->value(version_tag, false).toBool();
|
auto should_skip = priv->settings->value(version_tag, false).toBool();
|
||||||
priv->settings->endGroup();
|
priv->settings->endGroup();
|
||||||
|
|
||||||
if (should_skip)
|
if (should_skip) {
|
||||||
|
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("There are no new updates available."));
|
||||||
|
msgBox.exec();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateAvailableDialog dlg(BuildConfig.printableVersionString(), version_name, release_notes);
|
UpdateAvailableDialog dlg(BuildConfig.printableVersionString(), version_name, release_notes);
|
||||||
|
|
||||||
auto result = dlg.exec();
|
auto result = dlg.exec();
|
||||||
|
qDebug() << "offer dlg result" << result;
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case UpdateAvailableDialog::Install: {
|
case UpdateAvailableDialog::Install: {
|
||||||
performUpdate(version_tag);
|
performUpdate(version_tag);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
case UpdateAvailableDialog::Skip: {
|
case UpdateAvailableDialog::Skip: {
|
||||||
priv->settings->beginGroup("skip");
|
priv->settings->beginGroup("skip");
|
||||||
|
@ -327,6 +327,11 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar
|
|||||||
// on command line
|
// on command line
|
||||||
adjustedBy = "Command line";
|
adjustedBy = "Command line";
|
||||||
m_dataPath = dirParam;
|
m_dataPath = dirParam;
|
||||||
|
#ifndef Q_OS_MACOS
|
||||||
|
if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
|
||||||
|
m_isPortable = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), ".."));
|
QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), ".."));
|
||||||
m_dataPath = foo.absolutePath();
|
m_dataPath = foo.absolutePath();
|
||||||
@ -958,8 +963,6 @@ void PrismUpdaterApp::performInstall(QFileInfo file)
|
|||||||
return showFatalErrorMessage(tr("Update Aborted"), tr("The update attempt was aborted"));
|
return showFatalErrorMessage(tr("Update Aborted"), tr("The update attempt was aborted"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write_lock_file(update_lock_path, QDateTime::currentDateTime(), m_prismVersion, m_install_release.tag_name, applicationDirPath(),
|
|
||||||
m_dataPath);
|
|
||||||
clearUpdateLog();
|
clearUpdateLog();
|
||||||
|
|
||||||
auto changelog_path = FS::PathCombine(m_dataPath, ".prism_launcher_update.changelog");
|
auto changelog_path = FS::PathCombine(m_dataPath, ".prism_launcher_update.changelog");
|
||||||
@ -967,6 +970,8 @@ void PrismUpdaterApp::performInstall(QFileInfo file)
|
|||||||
|
|
||||||
logUpdate(tr("Updating from %1 to %2").arg(m_prismVersion).arg(m_install_release.tag_name));
|
logUpdate(tr("Updating from %1 to %2").arg(m_prismVersion).arg(m_install_release.tag_name));
|
||||||
if (m_isPortable || file.suffix().toLower() == "zip") {
|
if (m_isPortable || file.suffix().toLower() == "zip") {
|
||||||
|
write_lock_file(update_lock_path, QDateTime::currentDateTime(), m_prismVersion, m_install_release.tag_name, applicationDirPath(),
|
||||||
|
m_dataPath);
|
||||||
logUpdate(tr("Updating portable install at %1").arg(applicationDirPath()));
|
logUpdate(tr("Updating portable install at %1").arg(applicationDirPath()));
|
||||||
unpackAndInstall(file);
|
unpackAndInstall(file);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user