Skip to content

Commit

Permalink
Qt: Use detailed text for install message
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Jul 8, 2023
1 parent c30c9b2 commit 050b8fa
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions rpcs3/rpcs3qt/main_window.cpp
Expand Up @@ -780,16 +780,33 @@ bool main_window::InstallPackages(QStringList file_paths, bool from_boot)

if (!info.changelog.isEmpty())
{
info.changelog = tr("\n\nChangelog:\n%0", "Block for Changelog").arg(info.changelog);
info.changelog = tr("Changelog:\n%0", "Block for Changelog").arg(info.changelog);
}

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);
const QString info_string = QStringLiteral("%0\n\n%1%2%3%4").arg(file_info.fileName()).arg(info.title).arg(info.local_cat).arg(info.title_id).arg(info.version);
QString message = 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)
QMessageBox mb(QMessageBox::Icon::Question, tr("PKG Decrypter / Installer"), message, QMessageBox::Yes | QMessageBox::No, this);
mb.setDefaultButton(QMessageBox::No);

if (!info.changelog.isEmpty())
{
mb.setInformativeText(tr("To see the changelog, please click \"Show Details\"."));
mb.setDetailedText(tr("%0").arg(info.changelog));

// Smartass hack to make the unresizeable message box wide enough for the changelog
const int log_width = QLabel(info.changelog).sizeHint().width();
while (QLabel(message).sizeHint().width() < log_width)
{
message += " ";
}

mb.setText(message);
}

if (mb.exec() != QMessageBox::Yes)
{
gui_log.notice("PKG: Cancelled installation from drop.\n%s", info_string);
gui_log.notice("PKG: Cancelled installation from drop.\n%s\n%s", info_string, info.changelog);
return true;
}
}
Expand Down

0 comments on commit 050b8fa

Please sign in to comment.