Qt: add option to prefer game data icons in the game list
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run

This commit is contained in:
Megamouse 2025-03-26 09:11:50 +01:00
parent 324af04426
commit 467c4ba2cf
5 changed files with 41 additions and 3 deletions

View file

@ -223,6 +223,7 @@ void game_list_frame::LoadSettings()
m_category_filters = m_gui_settings->GetGameListCategoryFilters(true);
m_grid_category_filters = m_gui_settings->GetGameListCategoryFilters(false);
m_draw_compat_status_to_grid = m_gui_settings->GetValue(gui::gl_draw_compat).toBool();
m_prefer_game_data_icons = m_gui_settings->GetValue(gui::gl_pref_gd_icon).toBool();
m_show_custom_icons = m_gui_settings->GetValue(gui::gl_custom_icon).toBool();
m_play_hover_movies = m_gui_settings->GetValue(gui::gl_hover_gifs).toBool();
@ -897,8 +898,8 @@ void game_list_frame::OnRefreshFinished()
}
}
// Let's fetch the game data icon if the path was empty for some reason
if (entry->info.icon_path.empty())
// Let's fetch the game data icon if preferred or if the path was empty for some reason
if (m_prefer_game_data_icons || entry->info.icon_path.empty())
{
if (std::string icon_path = other->info.path + "/" + localized_icon; fs::is_file(icon_path))
{
@ -909,6 +910,19 @@ void game_list_frame::OnRefreshFinished()
entry->info.icon_path = std::move(icon_path);
}
}
// Let's fetch the game data movie if preferred or if the path was empty
if (m_prefer_game_data_icons || entry->info.movie_path.empty())
{
if (std::string movie_path = other->info.path + "/" + localized_movie; fs::is_file(movie_path))
{
entry->info.movie_path = std::move(movie_path);
}
else if (std::string movie_path = other->info.path + "/ICON1.PAM"; fs::is_file(movie_path))
{
entry->info.movie_path = std::move(movie_path);
}
}
}
}
@ -3001,6 +3015,16 @@ void game_list_frame::SetShowCompatibilityInGrid(bool show)
m_gui_settings->SetValue(gui::gl_draw_compat, show);
}
void game_list_frame::SetPreferGameDataIcons(bool enabled)
{
if (m_prefer_game_data_icons != enabled)
{
m_prefer_game_data_icons = enabled;
m_gui_settings->SetValue(gui::gl_pref_gd_icon, enabled);
Refresh(true);
}
}
void game_list_frame::SetShowCustomIcons(bool show)
{
if (m_show_custom_icons != show)

View file

@ -73,6 +73,7 @@ public Q_SLOTS:
void SetListMode(const bool& is_list);
void SetSearchText(const QString& text);
void SetShowCompatibilityInGrid(bool show);
void SetPreferGameDataIcons(bool enabled);
void SetShowCustomIcons(bool show);
void SetPlayHoverGifs(bool play);
void FocusAndSelectFirstEntryIfNoneIs();
@ -212,6 +213,7 @@ private:
qreal m_margin_factor;
qreal m_text_factor;
bool m_draw_compat_status_to_grid = false;
bool m_prefer_game_data_icons = false;
bool m_show_custom_icons = true;
bool m_play_hover_movies = true;
std::optional<auto_typemap<game_list_frame>> m_refresh_funcs_manage_type{std::in_place};

View file

@ -214,6 +214,7 @@ namespace gui
const gui_save gl_show_hidden = gui_save(game_list, "show_hidden", false);
const gui_save gl_hidden_list = gui_save(game_list, "hidden_list", QStringList());
const gui_save gl_draw_compat = gui_save(game_list, "draw_compat", false);
const gui_save gl_pref_gd_icon = gui_save(game_list, "pref_gd_icon", false);
const gui_save gl_custom_icon = gui_save(game_list, "custom_icon", true);
const gui_save gl_hover_gifs = gui_save(game_list, "hover_gifs", true);

View file

@ -3380,6 +3380,7 @@ void main_window::CreateConnects()
ResizeIcons(index);
});
connect(ui->actionPreferGameDataIcons, &QAction::triggered, m_game_list_frame, &game_list_frame::SetPreferGameDataIcons);
connect(ui->showCustomIconsAct, &QAction::triggered, m_game_list_frame, &game_list_frame::SetShowCustomIcons);
connect(ui->playHoverGifsAct, &QAction::triggered, m_game_list_frame, &game_list_frame::SetPlayHoverGifs);
@ -3679,6 +3680,7 @@ void main_window::ConfigureGuiFromSettings()
m_game_list_frame->SetShowHidden(ui->showHiddenEntriesAct->isChecked()); // prevent GetValue in m_game_list_frame->LoadSettings
ui->showCompatibilityInGridAct->setChecked(m_gui_settings->GetValue(gui::gl_draw_compat).toBool());
ui->actionPreferGameDataIcons->setChecked(m_gui_settings->GetValue(gui::gl_pref_gd_icon).toBool());
ui->showCustomIconsAct->setChecked(m_gui_settings->GetValue(gui::gl_custom_icon).toBool());
ui->playHoverGifsAct->setChecked(m_gui_settings->GetValue(gui::gl_hover_gifs).toBool());

View file

@ -35,7 +35,7 @@
<bool>true</bool>
</property>
<property name="dockOptions">
<set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::GroupedDragging</set>
<set>QMainWindow::DockOption::AllowNestedDocks|QMainWindow::DockOption::AllowTabbedDocks|QMainWindow::DockOption::AnimatedDocks|QMainWindow::DockOption::GroupedDragging</set>
</property>
<widget class="QWidget" name="centralWidget">
<property name="sizePolicy">
@ -344,6 +344,7 @@
<addaction name="setIconSizeMediumAct"/>
<addaction name="setIconSizeLargeAct"/>
<addaction name="separator"/>
<addaction name="actionPreferGameDataIcons"/>
<addaction name="showCustomIconsAct"/>
<addaction name="playHoverGifsAct"/>
</widget>
@ -1415,6 +1416,14 @@
<string>Savestates</string>
</property>
</action>
<action name="actionPreferGameDataIcons">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Prefer Game Data Icons</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>