3535#include " camera_settings_dialog.h"
3636#include " ps_move_tracker_dialog.h"
3737#include " ipc_settings_dialog.h"
38- #include " shortcut_utils.h"
3938#include " config_checker.h"
4039#include " shortcut_dialog.h"
40+ #include " steam_utils.h"
4141#include " system_cmd_dialog.h"
4242#include " emulated_pad_settings_dialog.h"
4343#include " emulated_logitech_g27_settings_dialog.h"
@@ -935,9 +935,8 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
935935 }
936936
937937 std::vector<compat::package_info> packages;
938+ std::set<gui::utils::shortcut_location> shortcut_locations;
938939 bool precompile_caches = false ;
939- bool create_desktop_shortcuts = false ;
940- bool create_app_shortcut = false ;
941940 bool canceled = false ;
942941
943942 game_compatibility* compat = m_game_list_frame ? m_game_list_frame->GetGameCompatibility () : nullptr ;
@@ -954,8 +953,15 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
954953
955954 packages = dlg.get_paths_to_install ();
956955 precompile_caches = dlg.precompile_caches ();
957- create_desktop_shortcuts = dlg.create_desktop_shortcuts ();
958- create_app_shortcut = dlg.create_app_shortcut ();
956+
957+ if (dlg.create_desktop_shortcuts ())
958+ shortcut_locations.insert (gui::utils::shortcut_location::desktop);
959+
960+ if (dlg.create_app_shortcut ())
961+ shortcut_locations.insert (gui::utils::shortcut_location::applications);
962+
963+ if (dlg.create_steam_shortcut ())
964+ shortcut_locations.insert (gui::utils::shortcut_location::steam);
959965 });
960966 dlg.exec ();
961967
@@ -1136,7 +1142,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
11361142
11371143 if (!bootable_paths_installed.empty ())
11381144 {
1139- m_game_list_frame->AddRefreshedSlot ([this , create_desktop_shortcuts , precompile_caches, create_app_shortcut , paths = std::move (bootable_paths_installed)](std::set<std::string>& claimed_paths) mutable
1145+ m_game_list_frame->AddRefreshedSlot ([this , shortcut_locations , precompile_caches, paths = std::move (bootable_paths_installed)](std::set<std::string>& claimed_paths) mutable
11401146 {
11411147 // Try to claim operations on ID
11421148 for (auto it = paths.begin (); it != paths.end ();)
@@ -1154,7 +1160,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
11541160 }
11551161 }
11561162
1157- CreateShortCuts (paths, create_desktop_shortcuts, create_app_shortcut );
1163+ CreateShortCuts (paths, shortcut_locations );
11581164
11591165 if (precompile_caches)
11601166 {
@@ -2370,6 +2376,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
23702376#else
23712377 QCheckBox* quick_check = new QCheckBox (tr (" Add launcher shortcut(s)" ));
23722378#endif
2379+ QCheckBox* steam_check = nullptr ;
23732380 QLabel* label = new QLabel (tr (" %1\n Would 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);
23742381
23752382 vlayout->addWidget (label);
@@ -2381,6 +2388,13 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
23812388 vlayout->addWidget (quick_check);
23822389 vlayout->addStretch (3 );
23832390
2391+ if constexpr (gui::utils::steam_supported ())
2392+ {
2393+ steam_check = new QCheckBox (tr (" Add Steam shortcut(s)" ));
2394+ vlayout->addWidget (steam_check);
2395+ vlayout->addStretch (3 );
2396+ }
2397+
23842398 QDialogButtonBox* btn_box = new QDialogButtonBox (QDialogButtonBox::Ok);
23852399
23862400 vlayout->addWidget (btn_box);
@@ -2389,13 +2403,22 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
23892403 connect (btn_box, &QDialogButtonBox::accepted, this , [=, this , paths = std::move (bootable_paths)]()
23902404 {
23912405 const bool precompile_caches = precompile_check->isChecked ();
2392- const bool create_desktop_shortcuts = desk_check->isChecked ();
2393- const bool create_app_shortcut = quick_check->isChecked ();
2406+
2407+ std::set<gui::utils::shortcut_location> shortcut_locations;
2408+
2409+ if (desk_check->isChecked ())
2410+ shortcut_locations.insert (gui::utils::shortcut_location::desktop);
2411+
2412+ if (quick_check->isChecked ())
2413+ shortcut_locations.insert (gui::utils::shortcut_location::applications);
2414+
2415+ if (steam_check && steam_check->isChecked ())
2416+ shortcut_locations.insert (gui::utils::shortcut_location::steam);
23942417
23952418 dlg->hide ();
23962419 dlg->accept ();
23972420
2398- CreateShortCuts (paths, create_desktop_shortcuts, create_app_shortcut );
2421+ CreateShortCuts (paths, shortcut_locations );
23992422
24002423 if (precompile_caches)
24012424 {
@@ -2407,52 +2430,40 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
24072430 dlg->open ();
24082431}
24092432
2410- void main_window::CreateShortCuts (const std::map<std::string, QString>& paths, bool create_desktop_shortcuts, bool create_app_shortcut )
2433+ void main_window::CreateShortCuts (const std::map<std::string, QString>& paths, std::set<gui::utils::shortcut_location> locations )
24112434{
24122435 if (paths.empty ()) return ;
24132436
2414- std::set<gui::utils::shortcut_location> locations;
2415-
24162437#ifdef _WIN32
24172438 locations.insert (gui::utils::shortcut_location::rpcs3_shortcuts);
2418- #endif
2419- if (create_desktop_shortcuts )
2439+ #else
2440+ if (locations. empty () )
24202441 {
2421- locations. insert (gui::utils::shortcut_location::desktop) ;
2442+ return ;
24222443 }
2444+ #endif
24232445
2424- if (create_app_shortcut)
2425- {
2426- locations.insert (gui::utils::shortcut_location::applications);
2427- }
2446+ std::vector<game_info> game_data_shortcuts;
24282447
2429- if (!locations. empty () )
2448+ for ( const auto & [boot_path, title_id] : paths )
24302449 {
2431- std::vector<game_info> game_data_shortcuts;
2432-
2433- for (const auto & [boot_path, title_id] : paths)
2450+ for (const game_info& gameinfo : m_game_list_frame->GetGameInfo ())
24342451 {
2435- for ( const game_info& gameinfo : m_game_list_frame-> GetGameInfo ())
2452+ if (gameinfo && gameinfo-> info . serial == title_id. toStdString ())
24362453 {
2437- if (gameinfo && gameinfo->info .serial == title_id. toStdString ( ))
2454+ if (Emu. IsPathInsideDir (boot_path, gameinfo->info .path ))
24382455 {
2439- if (Emu.IsPathInsideDir (boot_path, gameinfo->info .path ))
2440- {
2441- if (!locations.empty ())
2442- {
2443- game_data_shortcuts.push_back (gameinfo);
2444- }
2445- }
2446-
2447- break ;
2456+ game_data_shortcuts.push_back (gameinfo);
24482457 }
2458+
2459+ break ;
24492460 }
24502461 }
2462+ }
24512463
2452- if (!game_data_shortcuts.empty () && !locations.empty ())
2453- {
2454- m_game_list_frame->actions ()->CreateShortcuts (game_data_shortcuts, locations);
2455- }
2464+ if (!game_data_shortcuts.empty ())
2465+ {
2466+ m_game_list_frame->actions ()->CreateShortcuts (game_data_shortcuts, locations);
24562467 }
24572468}
24582469
0 commit comments