Qt: add setting for disabling hover music
This commit is contained in:
@@ -16,7 +16,8 @@ public:
|
|||||||
[[maybe_unused]] const std::map<QString, QString>& notes_map,
|
[[maybe_unused]] const std::map<QString, QString>& notes_map,
|
||||||
[[maybe_unused]] const std::map<QString, QString>& title_map,
|
[[maybe_unused]] const std::map<QString, QString>& title_map,
|
||||||
[[maybe_unused]] const std::set<std::string>& selected_item_ids,
|
[[maybe_unused]] const std::set<std::string>& selected_item_ids,
|
||||||
[[maybe_unused]] bool play_hover_movies){};
|
[[maybe_unused]] bool play_hover_movies,
|
||||||
|
[[maybe_unused]] bool play_hover_music){};
|
||||||
|
|
||||||
void set_icon_size(QSize size) { m_icon_size = std::move(size); }
|
void set_icon_size(QSize size) { m_icon_size = std::move(size); }
|
||||||
void set_icon_color(QColor color) { m_icon_color = std::move(color); }
|
void set_icon_color(QColor color) { m_icon_color = std::move(color); }
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ void game_list_frame::LoadSettings()
|
|||||||
m_prefer_game_data_icons = m_gui_settings->GetValue(gui::gl_pref_gd_icon).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_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();
|
m_play_hover_movies = m_gui_settings->GetValue(gui::gl_hover_gifs).toBool();
|
||||||
|
m_play_hover_music = m_gui_settings->GetValue(gui::gl_hover_music).toBool();
|
||||||
|
|
||||||
m_game_list->sync_header_actions(m_column_acts, [this](int col) { return m_gui_settings->GetGamelistColVisibility(static_cast<gui::game_list_columns>(col)); });
|
m_game_list->sync_header_actions(m_column_acts, [this](int col) { return m_gui_settings->GetGamelistColVisibility(static_cast<gui::game_list_columns>(col)); });
|
||||||
}
|
}
|
||||||
@@ -482,7 +483,7 @@ void game_list_frame::Refresh(const bool from_drive, const std::vector<std::stri
|
|||||||
{
|
{
|
||||||
m_game_grid->clear_list();
|
m_game_grid->clear_list();
|
||||||
const int scroll_position = m_game_list->verticalScrollBar()->value();
|
const int scroll_position = m_game_list->verticalScrollBar()->value();
|
||||||
m_game_list->populate(matching_apps, m_notes, m_titles, selected_items, m_play_hover_movies);
|
m_game_list->populate(matching_apps, m_notes, m_titles, selected_items, m_play_hover_movies, m_play_hover_music);
|
||||||
m_game_list->sort(m_game_data.size(), m_sort_column, m_col_sort_order);
|
m_game_list->sort(m_game_data.size(), m_sort_column, m_col_sort_order);
|
||||||
RepaintIcons();
|
RepaintIcons();
|
||||||
|
|
||||||
@@ -498,7 +499,7 @@ void game_list_frame::Refresh(const bool from_drive, const std::vector<std::stri
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_game_list->clear_list();
|
m_game_list->clear_list();
|
||||||
m_game_grid->populate(matching_apps, m_notes, m_titles, selected_items, m_play_hover_movies);
|
m_game_grid->populate(matching_apps, m_notes, m_titles, selected_items, m_play_hover_movies, m_play_hover_music);
|
||||||
RepaintIcons();
|
RepaintIcons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -521,7 +522,10 @@ void game_list_frame::OnParsingFinished()
|
|||||||
const std::string localized_icon = fmt::format("ICON0_%02d.PNG", language_index);
|
const std::string localized_icon = fmt::format("ICON0_%02d.PNG", language_index);
|
||||||
const std::string localized_movie = fmt::format("ICON1_%02d.PAM", language_index);
|
const std::string localized_movie = fmt::format("ICON1_%02d.PAM", language_index);
|
||||||
|
|
||||||
const auto add_game = [this, localized_title, localized_icon, localized_movie, dev_flash, cat_unknown_localized = localized.category.unknown.toStdString(), cat_unknown = cat::cat_unknown.toStdString(), game_icon_path, _hdd, play_hover_movies = m_play_hover_movies, show_custom_icons = m_show_custom_icons](const std::string& dir_or_elf)
|
const auto add_game = [this, localized_title, localized_icon, localized_movie, dev_flash, game_icon_path, _hdd,
|
||||||
|
cat_unknown_localized = localized.category.unknown.toStdString(), cat_unknown = cat::cat_unknown.toStdString(),
|
||||||
|
play_hover_movies = m_play_hover_movies, play_hover_music = m_play_hover_music, show_custom_icons = m_show_custom_icons]
|
||||||
|
(const std::string& dir_or_elf)
|
||||||
{
|
{
|
||||||
std::unique_ptr<iso_archive> archive;
|
std::unique_ptr<iso_archive> archive;
|
||||||
if (is_file_iso(dir_or_elf))
|
if (is_file_iso(dir_or_elf))
|
||||||
@@ -640,10 +644,13 @@ void game_list_frame::OnParsingFinished()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::string audio_path = sfo_dir + "/SND0.AT3"; file_exists(audio_path))
|
if (play_hover_music)
|
||||||
{
|
{
|
||||||
game.info.audio_path = std::move(audio_path);
|
if (std::string audio_path = sfo_dir + "/SND0.AT3"; file_exists(audio_path))
|
||||||
game.has_audio_file = true;
|
{
|
||||||
|
game.info.audio_path = std::move(audio_path);
|
||||||
|
game.has_audio_file = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString serial = QString::fromStdString(game.info.serial);
|
const QString serial = QString::fromStdString(game.info.serial);
|
||||||
@@ -1394,6 +1401,16 @@ void game_list_frame::SetPlayHoverGifs(bool play)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void game_list_frame::SetPlayHoverMusic(bool play)
|
||||||
|
{
|
||||||
|
if (m_play_hover_music != play)
|
||||||
|
{
|
||||||
|
m_play_hover_music = play;
|
||||||
|
m_gui_settings->SetValue(gui::gl_hover_music, play);
|
||||||
|
Refresh(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void game_list_frame::WaitAndAbortRepaintThreads()
|
void game_list_frame::WaitAndAbortRepaintThreads()
|
||||||
{
|
{
|
||||||
for (const game_info& game : m_game_data)
|
for (const game_info& game : m_game_data)
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public Q_SLOTS:
|
|||||||
void SetPreferGameDataIcons(bool enabled);
|
void SetPreferGameDataIcons(bool enabled);
|
||||||
void SetShowCustomIcons(bool show);
|
void SetShowCustomIcons(bool show);
|
||||||
void SetPlayHoverGifs(bool play);
|
void SetPlayHoverGifs(bool play);
|
||||||
|
void SetPlayHoverMusic(bool play);
|
||||||
void FocusAndSelectFirstEntryIfNoneIs();
|
void FocusAndSelectFirstEntryIfNoneIs();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
@@ -204,5 +205,6 @@ private:
|
|||||||
bool m_prefer_game_data_icons = false;
|
bool m_prefer_game_data_icons = false;
|
||||||
bool m_show_custom_icons = true;
|
bool m_show_custom_icons = true;
|
||||||
bool m_play_hover_movies = true;
|
bool m_play_hover_movies = true;
|
||||||
|
bool m_play_hover_music = true;
|
||||||
std::optional<auto_typemap<game_list_frame>> m_refresh_funcs_manage_type{std::in_place};
|
std::optional<auto_typemap<game_list_frame>> m_refresh_funcs_manage_type{std::in_place};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ void game_list_grid::populate(
|
|||||||
const std::map<QString, QString>& notes_map,
|
const std::map<QString, QString>& notes_map,
|
||||||
const std::map<QString, QString>& title_map,
|
const std::map<QString, QString>& title_map,
|
||||||
const std::set<std::string>& selected_item_ids,
|
const std::set<std::string>& selected_item_ids,
|
||||||
bool play_hover_movies)
|
bool play_hover_movies,
|
||||||
|
bool play_hover_music)
|
||||||
{
|
{
|
||||||
clear_list();
|
clear_list();
|
||||||
|
|
||||||
@@ -109,26 +110,23 @@ void game_list_grid::populate(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam || game->has_audio_file))
|
bool check_iso = false;
|
||||||
|
|
||||||
|
if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam))
|
||||||
{
|
{
|
||||||
bool check_iso = false;
|
item->set_video_path(game->info.movie_path);
|
||||||
|
check_iso |= !fs::exists(game->info.movie_path);
|
||||||
|
}
|
||||||
|
|
||||||
if (game->has_hover_gif || game->has_hover_pam)
|
if (play_hover_music && game->has_audio_file)
|
||||||
{
|
{
|
||||||
item->set_video_path(game->info.movie_path);
|
item->set_audio_path(game->info.audio_path);
|
||||||
check_iso |= !fs::exists(game->info.movie_path);
|
check_iso |= !fs::exists(game->info.audio_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game->has_audio_file)
|
if (check_iso && is_file_iso(game->info.path))
|
||||||
{
|
{
|
||||||
item->set_audio_path(game->info.audio_path);
|
item->set_iso_path(game->info.path);
|
||||||
check_iso |= !fs::exists(game->info.audio_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_iso && is_file_iso(game->info.path))
|
|
||||||
{
|
|
||||||
item->set_iso_path(game->info.path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected_item_ids.contains(game->info.path + game->info.icon_path))
|
if (selected_item_ids.contains(game->info.path + game->info.icon_path))
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ public:
|
|||||||
const std::map<QString, QString>& notes_map,
|
const std::map<QString, QString>& notes_map,
|
||||||
const std::map<QString, QString>& title_map,
|
const std::map<QString, QString>& title_map,
|
||||||
const std::set<std::string>& selected_item_ids,
|
const std::set<std::string>& selected_item_ids,
|
||||||
bool play_hover_movies) override;
|
bool play_hover_movies,
|
||||||
|
bool play_hover_music) override;
|
||||||
|
|
||||||
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,8 @@ void game_list_table::populate(
|
|||||||
const std::map<QString, QString>& notes_map,
|
const std::map<QString, QString>& notes_map,
|
||||||
const std::map<QString, QString>& title_map,
|
const std::map<QString, QString>& title_map,
|
||||||
const std::set<std::string>& selected_item_ids,
|
const std::set<std::string>& selected_item_ids,
|
||||||
bool play_hover_movies)
|
bool play_hover_movies,
|
||||||
|
bool play_hover_music)
|
||||||
{
|
{
|
||||||
clear_list();
|
clear_list();
|
||||||
|
|
||||||
@@ -299,26 +300,23 @@ void game_list_table::populate(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam || game->has_audio_file))
|
bool check_iso = false;
|
||||||
|
|
||||||
|
if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam))
|
||||||
{
|
{
|
||||||
bool check_iso = false;
|
icon_item->set_video_path(game->info.movie_path);
|
||||||
|
check_iso |= !fs::exists(game->info.movie_path);
|
||||||
|
}
|
||||||
|
|
||||||
if (game->has_hover_gif || game->has_hover_pam)
|
if (play_hover_music && game->has_audio_file)
|
||||||
{
|
{
|
||||||
icon_item->set_video_path(game->info.movie_path);
|
icon_item->set_audio_path(game->info.audio_path);
|
||||||
check_iso |= !fs::exists(game->info.movie_path);
|
check_iso |= !fs::exists(game->info.audio_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game->has_audio_file)
|
if (check_iso && is_file_iso(game->info.path))
|
||||||
{
|
{
|
||||||
icon_item->set_audio_path(game->info.audio_path);
|
icon_item->set_iso_path(game->info.path);
|
||||||
check_iso |= !fs::exists(game->info.audio_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_iso && is_file_iso(game->info.path))
|
|
||||||
{
|
|
||||||
icon_item->set_iso_path(game->info.path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
icon_item->setData(Qt::UserRole, index, true);
|
icon_item->setData(Qt::UserRole, index, true);
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ public:
|
|||||||
const std::map<QString, QString>& notes_map,
|
const std::map<QString, QString>& notes_map,
|
||||||
const std::map<QString, QString>& title_map,
|
const std::map<QString, QString>& title_map,
|
||||||
const std::set<std::string>& selected_item_ids,
|
const std::set<std::string>& selected_item_ids,
|
||||||
bool play_hover_movies) override;
|
bool play_hover_movies,
|
||||||
|
bool play_hover_music) override;
|
||||||
|
|
||||||
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
||||||
|
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ namespace gui
|
|||||||
const gui_save gl_pref_gd_icon = gui_save(game_list, "pref_gd_icon", 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_custom_icon = gui_save(game_list, "custom_icon", true);
|
||||||
const gui_save gl_hover_gifs = gui_save(game_list, "hover_gifs", true);
|
const gui_save gl_hover_gifs = gui_save(game_list, "hover_gifs", true);
|
||||||
|
const gui_save gl_hover_music = gui_save(game_list, "hover_music", true);
|
||||||
|
|
||||||
const gui_save fs_emulator_dir_list = gui_save(fs, "emulator_dir_list", QStringList());
|
const gui_save fs_emulator_dir_list = gui_save(fs, "emulator_dir_list", QStringList());
|
||||||
const gui_save fs_dev_hdd0_list = gui_save(fs, "dev_hdd0_list", QStringList());
|
const gui_save fs_dev_hdd0_list = gui_save(fs, "dev_hdd0_list", QStringList());
|
||||||
|
|||||||
@@ -3412,6 +3412,7 @@ void main_window::CreateConnects()
|
|||||||
connect(ui->actionPreferGameDataIcons, &QAction::triggered, m_game_list_frame, &game_list_frame::SetPreferGameDataIcons);
|
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->showCustomIconsAct, &QAction::triggered, m_game_list_frame, &game_list_frame::SetShowCustomIcons);
|
||||||
connect(ui->playHoverGifsAct, &QAction::triggered, m_game_list_frame, &game_list_frame::SetPlayHoverGifs);
|
connect(ui->playHoverGifsAct, &QAction::triggered, m_game_list_frame, &game_list_frame::SetPlayHoverGifs);
|
||||||
|
connect(ui->playHoverMusicAct, &QAction::triggered, m_game_list_frame, &game_list_frame::SetPlayHoverMusic);
|
||||||
|
|
||||||
connect(m_game_list_frame, &game_list_frame::RequestIconSizeChange, this, [this](int val)
|
connect(m_game_list_frame, &game_list_frame::RequestIconSizeChange, this, [this](int val)
|
||||||
{
|
{
|
||||||
@@ -3718,6 +3719,7 @@ void main_window::ConfigureGuiFromSettings()
|
|||||||
ui->actionPreferGameDataIcons->setChecked(m_gui_settings->GetValue(gui::gl_pref_gd_icon).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->showCustomIconsAct->setChecked(m_gui_settings->GetValue(gui::gl_custom_icon).toBool());
|
||||||
ui->playHoverGifsAct->setChecked(m_gui_settings->GetValue(gui::gl_hover_gifs).toBool());
|
ui->playHoverGifsAct->setChecked(m_gui_settings->GetValue(gui::gl_hover_gifs).toBool());
|
||||||
|
ui->playHoverMusicAct->setChecked(m_gui_settings->GetValue(gui::gl_hover_music).toBool());
|
||||||
|
|
||||||
m_is_list_mode = m_gui_settings->GetValue(gui::gl_listMode).toBool();
|
m_is_list_mode = m_gui_settings->GetValue(gui::gl_listMode).toBool();
|
||||||
|
|
||||||
|
|||||||
@@ -372,6 +372,7 @@
|
|||||||
<addaction name="actionPreferGameDataIcons"/>
|
<addaction name="actionPreferGameDataIcons"/>
|
||||||
<addaction name="showCustomIconsAct"/>
|
<addaction name="showCustomIconsAct"/>
|
||||||
<addaction name="playHoverGifsAct"/>
|
<addaction name="playHoverGifsAct"/>
|
||||||
|
<addaction name="playHoverMusicAct"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuGame_List_View">
|
<widget class="QMenu" name="menuGame_List_View">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@@ -1524,6 +1525,17 @@
|
|||||||
<string>Boot ISO</string>
|
<string>Boot ISO</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="playHoverMusicAct">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Play Hover Music</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources>
|
<resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user