mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-01-19 07:00:33 +01:00
Qt: fix shortcut creation for ISO
This commit is contained in:
parent
98e64d7821
commit
4dc994833d
|
|
@ -1534,7 +1534,7 @@ void game_list_actions::CreateShortcuts(const std::vector<game_info>& games, con
|
|||
#endif
|
||||
}
|
||||
|
||||
if (!gameid_token_value.empty() && gui::utils::create_shortcut(gameinfo->info.name, gameinfo->info.serial, target_cli_args, gameinfo->info.name, gameinfo->info.icon_path, target_icon_dir, location))
|
||||
if (!gameid_token_value.empty() && gui::utils::create_shortcut(gameinfo->info.name, gameinfo->icon_in_archive ? gameinfo->info.path : "", gameinfo->info.serial, target_cli_args, gameinfo->info.name, gameinfo->info.icon_path, target_icon_dir, location))
|
||||
{
|
||||
game_list_log.success("Created %s shortcut for %s", destination, QString::fromStdString(gameinfo->info.name).simplified());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "Emu/VFS.h"
|
||||
#include "Utilities/File.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Loader/ISO.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
|
|
@ -31,7 +32,7 @@ LOG_CHANNEL(sys_log, "SYS");
|
|||
|
||||
namespace gui::utils
|
||||
{
|
||||
bool create_square_shortcut_icon_file(const std::string& src_icon_path, const std::string& target_icon_dir, std::string& target_icon_path, const std::string& extension, int size)
|
||||
bool create_square_shortcut_icon_file(const std::string& path, const std::string& src_icon_path, const std::string& target_icon_dir, std::string& target_icon_path, const std::string& extension, int size)
|
||||
{
|
||||
if (src_icon_path.empty() || target_icon_dir.empty() || extension.empty())
|
||||
{
|
||||
|
|
@ -39,7 +40,15 @@ namespace gui::utils
|
|||
return false;
|
||||
}
|
||||
|
||||
QPixmap icon(QString::fromStdString(src_icon_path));
|
||||
const bool is_archive = is_file_iso(path);
|
||||
|
||||
QPixmap icon;
|
||||
if (!load_icon(icon, src_icon_path, is_archive ? path : ""))
|
||||
{
|
||||
sys_log.error("Failed to create shortcut. Failed to load %sicon: '%s'", is_archive ? "iso " : "", src_icon_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!gui::utils::create_square_pixmap(icon, size))
|
||||
{
|
||||
sys_log.error("Failed to create shortcut. Icon empty.");
|
||||
|
|
@ -67,6 +76,7 @@ namespace gui::utils
|
|||
}
|
||||
|
||||
bool create_shortcut(const std::string& name,
|
||||
const std::string& path,
|
||||
[[maybe_unused]] const std::string& serial,
|
||||
[[maybe_unused]] const std::string& target_cli_args,
|
||||
[[maybe_unused]] const std::string& description,
|
||||
|
|
@ -189,7 +199,7 @@ namespace gui::utils
|
|||
if (!src_icon_path.empty() && !target_icon_dir.empty())
|
||||
{
|
||||
std::string target_icon_path;
|
||||
if (!create_square_shortcut_icon_file(src_icon_path, target_icon_dir, target_icon_path, "ico", 512))
|
||||
if (!create_square_shortcut_icon_file(path, src_icon_path, target_icon_dir, target_icon_path, "ico", 512))
|
||||
return cleanup(false, ".ico creation failed");
|
||||
|
||||
const std::wstring w_icon_path = utf8_to_wchar(target_icon_path);
|
||||
|
|
@ -301,7 +311,7 @@ namespace gui::utils
|
|||
if (!src_icon_path.empty())
|
||||
{
|
||||
std::string target_icon_path = resources_dir;
|
||||
if (!create_square_shortcut_icon_file(src_icon_path, resources_dir, target_icon_path, "icns", 512))
|
||||
if (!create_square_shortcut_icon_file(path, src_icon_path, resources_dir, target_icon_path, "icns", 512))
|
||||
{
|
||||
// Error is logged in create_square_shortcut_icon_file
|
||||
return false;
|
||||
|
|
@ -339,7 +349,7 @@ namespace gui::utils
|
|||
if (!src_icon_path.empty() && !target_icon_dir.empty())
|
||||
{
|
||||
std::string target_icon_path;
|
||||
if (!create_square_shortcut_icon_file(src_icon_path, target_icon_dir, target_icon_path, "png", 512))
|
||||
if (!create_square_shortcut_icon_file(path, src_icon_path, target_icon_dir, target_icon_path, "png", 512))
|
||||
{
|
||||
// Error is logged in create_square_shortcut_icon_file
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace gui::utils
|
|||
};
|
||||
|
||||
bool create_shortcut(const std::string& name,
|
||||
const std::string& path,
|
||||
const std::string& serial,
|
||||
const std::string& target_cli_args,
|
||||
const std::string& description,
|
||||
|
|
|
|||
|
|
@ -83,12 +83,12 @@ welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> gui_settings, bool
|
|||
{
|
||||
if (ui->create_desktop_shortcut->isChecked())
|
||||
{
|
||||
gui::utils::create_shortcut("RPCS3", "", "", "RPCS3", ":/rpcs3.svg", fs::get_temp_dir(), gui::utils::shortcut_location::desktop);
|
||||
gui::utils::create_shortcut("RPCS3", "", "", "", "RPCS3", ":/rpcs3.svg", fs::get_temp_dir(), gui::utils::shortcut_location::desktop);
|
||||
}
|
||||
|
||||
if (ui->create_applications_menu_shortcut->isChecked())
|
||||
{
|
||||
gui::utils::create_shortcut("RPCS3", "", "", "RPCS3", ":/rpcs3.svg", fs::get_temp_dir(), gui::utils::shortcut_location::applications);
|
||||
gui::utils::create_shortcut("RPCS3", "", "", "", "RPCS3", ":/rpcs3.svg", fs::get_temp_dir(), gui::utils::shortcut_location::applications);
|
||||
}
|
||||
|
||||
if (ui->use_dark_theme->isChecked() && ui->use_dark_theme->isEnabled()) // if checked and also on initial welcome dialog
|
||||
|
|
|
|||
Loading…
Reference in a new issue