Qt: Allow user to precompile caches on demand when installing packages or adding disc games
This commit is contained in:
@@ -1180,7 +1180,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
|
|||||||
{
|
{
|
||||||
m_game_list_frame->AddRefreshedSlot([this, paths = std::move(bootable_paths_installed)](std::set<std::string>& claimed_paths) mutable
|
m_game_list_frame->AddRefreshedSlot([this, paths = std::move(bootable_paths_installed)](std::set<std::string>& claimed_paths) mutable
|
||||||
{
|
{
|
||||||
// Try to claim operaions on ID
|
// Try to claim operations on ID
|
||||||
for (auto it = paths.begin(); it != paths.end();)
|
for (auto it = paths.begin(); it != paths.end();)
|
||||||
{
|
{
|
||||||
std::string resolved_path = Emu.GetCallbacks().resolve_path(it->first);
|
std::string resolved_path = Emu.GetCallbacks().resolve_path(it->first);
|
||||||
@@ -1196,13 +1196,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Executes after PrecompileCachesFromInstalledPackages
|
|
||||||
m_notify_batch_game_action_cb = [this, paths]() mutable
|
|
||||||
{
|
|
||||||
ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths));
|
ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths));
|
||||||
};
|
|
||||||
|
|
||||||
PrecompileCachesFromInstalledPackages(paths);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2402,6 +2396,8 @@ 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"));
|
||||||
|
precompile_check->setChecked(true);
|
||||||
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)"));
|
||||||
@@ -2410,10 +2406,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);
|
||||||
@@ -2426,6 +2424,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();
|
||||||
|
|
||||||
@@ -2447,11 +2446,8 @@ 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)
|
||||||
@@ -2477,13 +2473,18 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
|
|||||||
{
|
{
|
||||||
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations);
|
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (precompile_caches)
|
||||||
|
{
|
||||||
|
PrecompileCachesFromInstalledPackages(paths);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dlg->open();
|
dlg->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void main_window::PrecompileCachesFromInstalledPackages(const std::map<std::string, QString>& bootable_paths)
|
void main_window::PrecompileCachesFromInstalledPackages(const std::map<std::string, QString>& bootable_paths)
|
||||||
{
|
{
|
||||||
std::vector<game_info> game_data;
|
std::vector<game_info> game_data;
|
||||||
|
|||||||
Reference in New Issue
Block a user