Qt: Simplify hover movie code

This commit is contained in:
Megamouse 2025-03-17 13:06:21 +01:00
parent eddbf24053
commit 9c3f3e9751
3 changed files with 15 additions and 24 deletions

View file

@ -666,18 +666,20 @@ void game_list_frame::OnParsingFinished()
}
}
game.has_hover_gif = fs::is_file(game_icon_path + game.info.serial + "/hover.gif");
if (!game.has_hover_gif && game.info.movie_path.empty())
if (std::string movie_path = game_icon_path + game.info.serial + "/hover.gif"; fs::is_file(movie_path))
{
if (std::string movie_path = sfo_dir + "/" + localized_movie; fs::is_file(movie_path))
{
game.info.movie_path = std::move(movie_path);
}
else if (std::string movie_path = sfo_dir + "/ICON1.PAM"; fs::is_file(movie_path))
{
game.info.movie_path = std::move(movie_path);
}
game.info.movie_path = std::move(movie_path);
game.has_hover_gif = true;
}
else if (std::string movie_path = sfo_dir + "/" + localized_movie; fs::is_file(movie_path))
{
game.info.movie_path = std::move(movie_path);
game.has_hover_pam = true;
}
else if (std::string movie_path = sfo_dir + "/ICON1.PAM"; fs::is_file(movie_path))
{
game.info.movie_path = std::move(movie_path);
game.has_hover_pam = true;
}
const QString serial = QString::fromStdString(game.info.serial);
@ -735,7 +737,6 @@ void game_list_frame::OnParsingFinished()
game.compat = m_game_compat->GetCompatibility(game.info.serial);
game.has_custom_config = fs::is_file(rpcs3::utils::get_custom_config_path(game.info.serial));
game.has_custom_pad_config = fs::is_file(rpcs3::utils::get_custom_input_config_path(game.info.serial));
game.has_hover_pam = !game.info.movie_path.empty();
m_games.push(std::make_shared<gui_game_info>(std::move(game)));
};

View file

@ -48,7 +48,6 @@ void game_list_grid::populate(
{
clear_list();
const QString game_icon_path = play_hover_movies ? QString::fromStdString(fs::get_config_dir() + "/Icons/game_icons/") : "";
game_list_grid_item* selected_item = nullptr;
blockSignals(true);
@ -109,11 +108,7 @@ void game_list_grid::populate(
}
});
if (play_hover_movies && game->has_hover_gif)
{
item->set_movie_path(game_icon_path % serial % "/hover.gif");
}
else if (play_hover_movies && game->has_hover_pam)
if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam))
{
item->set_movie_path(QString::fromStdString(game->info.movie_path));
}

View file

@ -216,7 +216,6 @@ void game_list_table::populate(
const QLocale locale{};
const Localized localized;
const QString game_icon_path = play_hover_movies ? QString::fromStdString(fs::get_config_dir() + "/Icons/game_icons/") : "";
const std::string dev_flash = g_cfg_vfs.get_dev_flash();
int row = 0;
@ -292,11 +291,7 @@ void game_list_table::populate(
}
});
if (play_hover_movies && game->has_hover_gif)
{
icon_item->set_movie_path(game_icon_path % serial % "/hover.gif");
}
else if (play_hover_movies && game->has_hover_pam)
if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam))
{
icon_item->set_movie_path(QString::fromStdString(game->info.movie_path));
}