fix(updater): set minimum dialog / msgbox sizes

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-06-29 15:56:44 -07:00
parent 109ae5bae0
commit 603e3e7e2e
No known key found for this signature in database
GPG Key ID: E10E321EB160949B
3 changed files with 21 additions and 11 deletions

View File

@ -1004,6 +1004,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
msgBox.setDefaultButton(QMessageBox::Abort);
msgBox.setModal(true);
msgBox.setDetailedText(FS::read(update_log_path));
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
auto res = msgBox.exec();
switch (res) {
@ -1015,7 +1016,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
[[fallthrough]];
default: {
qDebug() << "Exiting because update lockfile is present";
QMetaObject::invokeMethod(this, [](){ exit(1); }, Qt::QueuedConnection);
QMetaObject::invokeMethod(
this, []() { exit(1); }, Qt::QueuedConnection);
return;
}
}
@ -1035,6 +1037,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
msgBox.setDefaultButton(QMessageBox::Abort);
msgBox.setModal(true);
msgBox.setDetailedText(FS::read(update_log_path));
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
auto res = msgBox.exec();
switch (res) {
@ -1046,7 +1049,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
[[fallthrough]];
default: {
qDebug() << "Exiting because update lockfile is present";
QMetaObject::invokeMethod(this, [](){ exit(1); }, Qt::QueuedConnection);
QMetaObject::invokeMethod(
this, []() { exit(1); }, Qt::QueuedConnection);
return;
}
}
@ -1066,6 +1070,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
msgBox->setDefaultButton(QMessageBox::Ok);
msgBox->setDetailedText(FS::read(update_log_path));
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setMinimumWidth(460);
msgBox->adjustSize();
msgBox->open();
FS::deletePath(update_success_marker.absoluteFilePath());
@ -1127,7 +1132,8 @@ bool Application::createSetupWizard()
return false;
}
bool Application::updaterEnabled() {
bool Application::updaterEnabled()
{
#if defined(Q_OS_MAC)
return BuildConfig.UPDATER_ENABLED;
#else
@ -1135,7 +1141,8 @@ bool Application::updaterEnabled() {
#endif
}
QString Application::updaterBinaryName() {
QString Application::updaterBinaryName()
{
auto exe_name = QStringLiteral("%1_updater").arg(BuildConfig.LAUNCHER_APP_BINARY_NAME);
#if defined Q_OS_WIN32
exe_name.append(".exe");
@ -1174,8 +1181,6 @@ void Application::performMainStartupAction()
{
m_status = Application::Initialized;
if (!m_instanceIdToLaunch.isEmpty()) {
auto inst = instances()->getInstanceById(m_instanceIdToLaunch);
if (inst) {

View File

@ -111,7 +111,7 @@ void PrismExternalUpdater::checkForUpdates()
auto msgBox =
QMessageBox(QMessageBox::Information, tr("Update Check Failed"),
tr("Failed to start after 5 seconds\nReason: %1.").arg(proc.errorString()), QMessageBox::Ok, priv->parent);
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
msgBox.exec();
priv->lastCheck = QDateTime::currentDateTime();
@ -133,6 +133,7 @@ void PrismExternalUpdater::checkForUpdates()
QMessageBox(QMessageBox::Information, tr("Update Check Failed"),
tr("Updater failed to close 60 seconds\nReason: %1.").arg(proc.errorString()), QMessageBox::Ok, priv->parent);
msgBox.setDetailedText(output);
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
msgBox.exec();
priv->lastCheck = QDateTime::currentDateTime();
@ -157,7 +158,7 @@ void PrismExternalUpdater::checkForUpdates()
qDebug() << "No update available";
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("You are running the latest version."),
QMessageBox::Ok, priv->parent);
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
msgBox.exec();
}
@ -169,7 +170,7 @@ void PrismExternalUpdater::checkForUpdates()
auto msgBox = QMessageBox(QMessageBox::Warning, tr("Update Check Error"),
tr("There was an error running the update check."), QMessageBox::Ok, priv->parent);
msgBox.setDetailedText(std_error);
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
msgBox.exec();
}
@ -199,7 +200,7 @@ void PrismExternalUpdater::checkForUpdates()
QMessageBox::Ok, priv->parent);
auto detail_txt = tr("StdOut: %1\nStdErr: %2").arg(std_output).arg(std_error);
msgBox.setDetailedText(detail_txt);
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
msgBox.exec();
}
@ -293,7 +294,7 @@ void PrismExternalUpdater::offerUpdate(const QString& version_name, const QStrin
if (should_skip) {
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("There are no new updates available."),
QMessageBox::Ok, priv->parent);
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
msgBox.exec();
return;

View File

@ -522,6 +522,7 @@ void PrismUpdaterApp::showFatalErrorMessage(const QString& title, const QString&
msgBox->setDefaultButton(QMessageBox::Ok);
msgBox->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
msgBox->setIcon(QMessageBox::Critical);
msgBox->setMinimumWidth(460);
msgBox->adjustSize();
msgBox->exec();
exit(1);
@ -660,6 +661,7 @@ void PrismUpdaterApp::moveAndFinishUpdate(QDir target)
QProgressDialog progress(tr("Backing up install at %1").arg(applicationDirPath()), "", 0, file_list.length());
progress.setCancelButton(nullptr);
progress.setMinimumWidth(400);
progress.adjustSize();
progress.show();
QCoreApplication::processEvents();
@ -963,6 +965,7 @@ void PrismUpdaterApp::performInstall(QFileInfo file)
msgBox.setInformativeText(infoMsg);
msgBox.setStandardButtons(QMessageBox::Ignore | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
msgBox.setMinimumWidth(460);
msgBox.adjustSize();
switch (msgBox.exec()) {
case QMessageBox::AcceptRole:
@ -1075,6 +1078,7 @@ void PrismUpdaterApp::backupAppDir()
QProgressDialog progress(tr("Backing up install at %1").arg(applicationDirPath()), "", 0, file_list.length());
progress.setCancelButton(nullptr);
progress.setMinimumWidth(400);
progress.adjustSize();
progress.show();
QCoreApplication::processEvents();