Compare commits

...

1 commit

View file

@ -1178,13 +1178,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
} }
} }
// Executes after PrecompileCachesFromInstalledPackages ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths));
m_notify_batch_game_action_cb = [this, paths]() mutable
{
ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths));
};
PrecompileCachesFromInstalledPackages(paths);
}); });
} }
@ -2384,6 +2378,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
QVBoxLayout* vlayout = new QVBoxLayout(dlg); QVBoxLayout* vlayout = new QVBoxLayout(dlg);
QCheckBox* precompile_check = new QCheckBox(tr("Precompile caches"));
QCheckBox* desk_check = new QCheckBox(tr("Add desktop shortcut(s)")); QCheckBox* desk_check = new QCheckBox(tr("Add desktop shortcut(s)"));
#ifdef _WIN32 #ifdef _WIN32
QCheckBox* quick_check = new QCheckBox(tr("Add Start menu shortcut(s)")); QCheckBox* quick_check = new QCheckBox(tr("Add Start menu shortcut(s)"));
@ -2392,10 +2387,12 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
#else #else
QCheckBox* quick_check = new QCheckBox(tr("Add launcher shortcut(s)")); QCheckBox* quick_check = new QCheckBox(tr("Add launcher shortcut(s)"));
#endif #endif
QLabel* label = new QLabel(tr("%1\nWould you like to install shortcuts to the installed software? (%2 new software detected)\n\n").arg(message).arg(bootable_paths.size()), dlg); QLabel* label = new QLabel(tr("%1\nWould you like to precompile caches and install shortcuts to the installed software? (%2 new software detected)\n\n").arg(message).arg(bootable_paths.size()), dlg);
vlayout->addWidget(label); vlayout->addWidget(label);
vlayout->addStretch(10); vlayout->addStretch(10);
vlayout->addWidget(precompile_check);
vlayout->addStretch(3);
vlayout->addWidget(desk_check); vlayout->addWidget(desk_check);
vlayout->addStretch(3); vlayout->addStretch(3);
vlayout->addWidget(quick_check); vlayout->addWidget(quick_check);
@ -2408,6 +2405,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
connect(btn_box, &QDialogButtonBox::accepted, this, [=, this, paths = std::move(bootable_paths)]() connect(btn_box, &QDialogButtonBox::accepted, this, [=, this, paths = std::move(bootable_paths)]()
{ {
const bool precompile_caches = precompile_check->isChecked();
const bool create_desktop_shortcuts = desk_check->isChecked(); const bool create_desktop_shortcuts = desk_check->isChecked();
const bool create_app_shortcut = quick_check->isChecked(); const bool create_app_shortcut = quick_check->isChecked();
@ -2429,35 +2427,38 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
locations.insert(gui::utils::shortcut_location::applications); locations.insert(gui::utils::shortcut_location::applications);
} }
if (locations.empty()) if (!locations.empty())
{ {
return; std::vector<game_info> game_data_shortcuts;
}
std::vector<game_info> game_data_shortcuts; for (const auto& [boot_path, title_id] : paths)
for (const auto& [boot_path, title_id] : paths)
{
for (const game_info& gameinfo : m_game_list_frame->GetGameInfo())
{ {
if (gameinfo && gameinfo->info.serial == title_id.toStdString()) for (const game_info& gameinfo : m_game_list_frame->GetGameInfo())
{ {
if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path)) if (gameinfo && gameinfo->info.serial == title_id.toStdString())
{ {
if (!locations.empty()) if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path))
{ {
game_data_shortcuts.push_back(gameinfo); if (!locations.empty())
{
game_data_shortcuts.push_back(gameinfo);
}
} }
}
break; break;
}
} }
} }
if (!game_data_shortcuts.empty() && !locations.empty())
{
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations);
}
} }
if (!game_data_shortcuts.empty() && !locations.empty()) if (precompile_caches)
{ {
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations); PrecompileCachesFromInstalledPackages(paths);
} }
}); });