1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Patch manager: detailed message box for long logs

This commit is contained in:
Megamouse 2022-04-09 20:54:35 +02:00
parent 4dfb47cdd9
commit 039d19dacf
3 changed files with 48 additions and 4 deletions

View File

@ -653,7 +653,7 @@ void main_window::InstallPackages(QStringList file_paths)
const QString info_string = QStringLiteral("%0\n\n%1%2%3%4%5").arg(file_info.fileName()).arg(info.title).arg(info.local_cat)
.arg(info.title_id).arg(info.version).arg(info.changelog);
if (QMessageBox::question(this, tr("PKG Decrypter / Installer"), tr("Do you want to install this package?\n\n%0").arg(info_string),
if (QMessageBox::question(this, tr("PKG Decrypter / Installer"), tr("Do you want to install this package?\n\n%0").arg(info_string),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
{
gui_log.notice("PKG: Cancelled installation from drop.\n%s", sstr(info_string));

View File

@ -835,7 +835,29 @@ void patch_manager_dialog::dropEvent(QDropEvent* event)
else
{
patch_log.error("Errors found in patch file %s", path);
QMessageBox::critical(this, tr("Validation failed"), tr("Errors were found in the patch file.\n\nLog:\n%0").arg(QString::fromStdString(log_message.str())));
QString summary = QString::fromStdString(log_message.str());
if (summary.count(QLatin1Char('\n')) < 5)
{
QMessageBox::critical(this, tr("Validation failed"), tr("Errors were found in the patch file.\n\nLog:\n%0").arg(summary));
}
else
{
QString message = tr("Errors were found in the patch file.");
QMessageBox mb(QMessageBox::Icon::Critical, tr("Validation failed"), message, QMessageBox::Ok, this);
mb.setInformativeText(tr("To see the error log, please click \"Show Details\"."));
mb.setDetailedText(tr("%0").arg(summary));
// Smartass hack to make the unresizeable message box wide enough for the changelog
const int log_width = QLabel(summary).sizeHint().width();
while (QLabel(message).sizeHint().width() < log_width)
{
message += " ";
}
mb.setText(message);
mb.exec();
}
}
}
}
@ -1025,7 +1047,29 @@ bool patch_manager_dialog::handle_json(const QByteArray& data)
else
{
patch_log.error("Errors found in downloaded patch file");
QMessageBox::critical(this, tr("Validation failed"), tr("Errors were found in the downloaded patch file.\n\nLog:\n%0").arg(QString::fromStdString(log_message.str())));
QString summary = QString::fromStdString(log_message.str());
if (summary.count(QLatin1Char('\n')) < 5)
{
QMessageBox::critical(this, tr("Validation failed"), tr("Errors were found in the downloaded patch file.\n\nLog:\n%0").arg(summary));
}
else
{
QString message = tr("Errors were found in the downloaded patch file.");
QMessageBox mb(QMessageBox::Icon::Critical, tr("Validation failed"), message, QMessageBox::Ok, this);
mb.setInformativeText(tr("To see the error log, please click \"Show Details\"."));
mb.setDetailedText(tr("%0").arg(summary));
// Smartass hack to make the unresizeable message box wide enough for the changelog
const int log_width = QLabel(message).sizeHint().width();
while (QLabel(message).sizeHint().width() < log_width)
{
message += " ";
}
mb.setText(message);
mb.exec();
}
}
return true;

View File

@ -302,7 +302,7 @@ void update_manager::update(bool auto_accept)
changelog_content.append(tr("• %0: %1").arg(entry.version, entry.title));
}
QMessageBox mb(QMessageBox::Icon::Question, tr("Update Available"), m_update_message, QMessageBox::Yes | QMessageBox::No,m_downloader->get_progress_dialog() ? m_downloader->get_progress_dialog() : m_parent);
QMessageBox mb(QMessageBox::Icon::Question, tr("Update Available"), m_update_message, QMessageBox::Yes | QMessageBox::No, m_downloader->get_progress_dialog() ? m_downloader->get_progress_dialog() : m_parent);
if (!changelog_content.isEmpty())
{