Skip to content

Commit

Permalink
GUI: Display PKG information & installation confirmation from main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Aug 14, 2021
1 parent b928cb0 commit 8e3a028
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions rpcs3/rpcs3qt/main_window.cpp
Expand Up @@ -567,9 +567,9 @@ void main_window::InstallPackages(QStringList file_paths)
const QFileInfo file_info(file_paths[0]);
m_gui_settings->SetValue(gui::fd_install_pkg, file_info.path());
}
else if (file_paths.count() == 1)

if (file_paths.count() == 1 && [&](){ u32 magic{}; fs::file file(sstr(file_paths.front())); return file && file.read(magic) && magic == "\x7FPKG"_u32; }())
{
// This can currently only happen by drag and drop and cli arg.
const QString file_path = file_paths.front();
const QFileInfo file_info(file_path);

Expand Down Expand Up @@ -612,11 +612,13 @@ void main_window::InstallPackages(QStringList file_paths)
info.changelog = tr("\n\nChangelog:\n%0", "Block for Changelog").arg(info.changelog);
}

if (QMessageBox::question(this, tr("PKG Decrypter / Installer"), tr("Do you want to install this package?\n\n%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%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),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
{
gui_log.notice("PKG: Cancelled installation from drop. File: %s", sstr(file_paths.front()));
gui_log.notice("PKG: Cancelled installation from drop.\n%s", sstr(info_string));
return;
}
}
Expand Down

0 comments on commit 8e3a028

Please sign in to comment.