fix: add thread sleep to wait for resources - add detail text from logs

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-06-28 09:18:07 -07:00
parent 4123343130
commit 46e840fdf1
No known key found for this signature in database
GPG Key ID: E10E321EB160949B
3 changed files with 19 additions and 8 deletions

View File

@ -999,6 +999,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update In Progress"), infoMsg, QMessageBox::Ignore | QMessageBox::Abort);
msgBox.setDefaultButton(QMessageBox::Abort);
msgBox.setModal(true);
msgBox.setDetailedText(FS::read(update_log_path));
auto res = msgBox.exec();
switch (res) {
case QMessageBox::Ignore: {
@ -1028,6 +1029,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update Failed"), infoMsg, QMessageBox::Ignore | QMessageBox::Abort);
msgBox.setDefaultButton(QMessageBox::Abort);
msgBox.setModal(true);
msgBox.setDetailedText(FS::read(update_log_path));
auto res = msgBox.exec();
switch (res) {
case QMessageBox::Ignore: {
@ -1056,7 +1058,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
.arg(update_log_path);
auto msgBox = QMessageBox(QMessageBox::Information, tr("Update Succeeded"), infoMsg, QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.open();
msgBox.setDetailedText(FS::read(update_log_path));
msgBox.exec();
FS::deletePath(update_success_marker.absoluteFilePath());
}
}

View File

@ -23,13 +23,14 @@
#include "PrismExternalUpdater.h"
#include <QCoreApplication>
#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QMessageBox>
#include <QProcess>
#include <QProgressDialog>
#include <QSettings>
#include <QTimer>
#include <memory>
#include <QDebug>
#include "StringUtils.h"
@ -117,9 +118,6 @@ void PrismExternalUpdater::checkForUpdates()
auto std_output = proc.readAllStandardOutput();
auto std_error = proc.readAllStandardError();
qDebug() << "captured output:" << std_output;
qDebug() << "captured error:" << std_error;
progress.hide();
QCoreApplication::processEvents();
@ -128,12 +126,17 @@ void PrismExternalUpdater::checkForUpdates()
// no update available
{
qDebug() << "No update available";
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("You are running the latest version."));
msgBox.exec();
}
break;
case 1:
// there was an error
{
qDebug() << "Updater subprocess error" << 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."));
msgBox.setDetailedText(std_error);
msgBox.exec();
}
break;
case 100:
@ -264,14 +267,15 @@ void PrismExternalUpdater::offerUpdate(const QString& version_name, const QStrin
}
}
void PrismExternalUpdater::performUpdate(const QString& version_tag) {
void PrismExternalUpdater::performUpdate(const QString& version_tag)
{
QProcess proc;
auto exe_name = QStringLiteral("%1_updater").arg(BuildConfig.LAUNCHER_APP_BINARY_NAME);
#if defined Q_OS_WIN32
exe_name.append(".exe");
#endif
QStringList args = { "--dir", priv->dataDir.absolutePath(), "--install-version", version_tag };
QStringList args = { "--dir", priv->dataDir.absolutePath(), "--install-version", version_tag };
if (priv->allowBeta)
args.append("--pre-release");

View File

@ -617,6 +617,10 @@ void PrismUpdaterApp::run()
void PrismUpdaterApp::moveAndFinishUpdate(QDir target)
{
logUpdate("Finishing update process");
logUpdate("Waiting 2 seconds for resources to free");
this->thread()->sleep(2);
auto manifest_path = FS::PathCombine(applicationDirPath(), "manifest.txt");
QFileInfo manifest(manifest_path);