mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-01-09 02:01:02 +01:00
Qt: Fix game list multi-selection after Refresh
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (0, 51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (1, 8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (0, 51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (1, 8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
This commit is contained in:
parent
1eb0b2260d
commit
90df8baa5f
|
|
@ -15,7 +15,7 @@ public:
|
|||
[[maybe_unused]] const std::vector<game_info>& game_data,
|
||||
[[maybe_unused]] const std::map<QString, QString>& notes_map,
|
||||
[[maybe_unused]] const std::map<QString, QString>& title_map,
|
||||
[[maybe_unused]] const std::string& selected_item_id,
|
||||
[[maybe_unused]] const std::set<std::string>& selected_item_ids,
|
||||
[[maybe_unused]] bool play_hover_movies){};
|
||||
|
||||
void set_icon_size(QSize size) { m_icon_size = std::move(size); }
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ void game_list_context_menu::show_single_selection_context_menu(const game_info&
|
|||
Q_EMIT m_game_list_frame->RequestBoot(gameinfo, cfg_mode::global);
|
||||
});
|
||||
|
||||
const auto configure_l = [this, current_game, gameinfo](bool create_cfg_from_global_cfg)
|
||||
auto configure_l = [this, current_game, gameinfo](bool create_cfg_from_global_cfg)
|
||||
{
|
||||
settings_dialog dlg(m_gui_settings, m_emu_settings, 0, m_game_list_frame, ¤t_game, create_cfg_from_global_cfg);
|
||||
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ void game_list_frame::Refresh(const bool from_drive, const std::vector<std::stri
|
|||
|
||||
// Fill Game List / Game Grid
|
||||
|
||||
const std::string selected_item = CurrentSelectionPath();
|
||||
const std::set<std::string> selected_items = CurrentSelectionPaths();
|
||||
|
||||
// Release old data
|
||||
for (const auto& game : m_game_data)
|
||||
|
|
@ -481,7 +481,7 @@ void game_list_frame::Refresh(const bool from_drive, const std::vector<std::stri
|
|||
{
|
||||
m_game_grid->clear_list();
|
||||
const int scroll_position = m_game_list->verticalScrollBar()->value();
|
||||
m_game_list->populate(matching_apps, m_notes, m_titles, selected_item, m_play_hover_movies);
|
||||
m_game_list->populate(matching_apps, m_notes, m_titles, selected_items, m_play_hover_movies);
|
||||
m_game_list->sort(m_game_data.size(), m_sort_column, m_col_sort_order);
|
||||
RepaintIcons();
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ void game_list_frame::Refresh(const bool from_drive, const std::vector<std::stri
|
|||
else
|
||||
{
|
||||
m_game_list->clear_list();
|
||||
m_game_grid->populate(matching_apps, m_notes, m_titles, selected_item, m_play_hover_movies);
|
||||
m_game_grid->populate(matching_apps, m_notes, m_titles, selected_items, m_play_hover_movies);
|
||||
RepaintIcons();
|
||||
}
|
||||
}
|
||||
|
|
@ -1257,38 +1257,37 @@ bool game_list_frame::SearchMatchesApp(const QString& name, const QString& seria
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string game_list_frame::CurrentSelectionPath()
|
||||
std::set<std::string> game_list_frame::CurrentSelectionPaths()
|
||||
{
|
||||
std::string selection;
|
||||
|
||||
game_info game{};
|
||||
std::set<std::string> selection;
|
||||
|
||||
if (m_old_layout_is_list)
|
||||
{
|
||||
if (!m_game_list->selectedItems().isEmpty())
|
||||
for (const QTableWidgetItem* selected_item : m_game_list->selectedItems())
|
||||
{
|
||||
if (QTableWidgetItem* item = m_game_list->item(m_game_list->currentRow(), 0))
|
||||
if (const QTableWidgetItem* item = m_game_list->item(selected_item->row(), 0))
|
||||
{
|
||||
if (const QVariant var = item->data(gui::game_role); var.canConvert<game_info>())
|
||||
{
|
||||
game = var.value<game_info>();
|
||||
if (const game_info game = var.value<game_info>())
|
||||
{
|
||||
selection.insert(game->info.path + game->info.icon_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_game_grid)
|
||||
{
|
||||
if (game_list_grid_item* item = static_cast<game_list_grid_item*>(m_game_grid->selected_item()))
|
||||
if (const game_list_grid_item* item = static_cast<game_list_grid_item*>(m_game_grid->selected_item()))
|
||||
{
|
||||
game = item->game();
|
||||
if (const game_info& game = item->game())
|
||||
{
|
||||
selection.insert(game->info.path + game->info.icon_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (game)
|
||||
{
|
||||
selection = game->info.path + game->info.icon_path;
|
||||
}
|
||||
|
||||
m_old_layout_is_list = m_is_list_layout;
|
||||
|
||||
return selection;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ private:
|
|||
|
||||
bool SearchMatchesApp(const QString& name, const QString& serial, bool fallback = false) const;
|
||||
|
||||
std::string CurrentSelectionPath();
|
||||
std::set<std::string> CurrentSelectionPaths();
|
||||
|
||||
game_info GetGameInfoByMode(const QTableWidgetItem* item) const;
|
||||
static game_info GetGameInfoFromItem(const QTableWidgetItem* item);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void game_list_grid::populate(
|
|||
const std::vector<game_info>& game_data,
|
||||
const std::map<QString, QString>& notes_map,
|
||||
const std::map<QString, QString>& title_map,
|
||||
const std::string& selected_item_id,
|
||||
const std::set<std::string>& selected_item_ids,
|
||||
bool play_hover_movies)
|
||||
{
|
||||
clear_list();
|
||||
|
|
@ -110,7 +110,7 @@ void game_list_grid::populate(
|
|||
item->set_video_path(game->info.movie_path);
|
||||
}
|
||||
|
||||
if (selected_item_id == game->info.path + game->info.icon_path)
|
||||
if (selected_item_ids.contains(game->info.path + game->info.icon_path))
|
||||
{
|
||||
selected_item = item;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public:
|
|||
const std::vector<game_info>& game_data,
|
||||
const std::map<QString, QString>& notes_map,
|
||||
const std::map<QString, QString>& title_map,
|
||||
const std::string& selected_item_id,
|
||||
const std::set<std::string>& selected_item_ids,
|
||||
bool play_hover_movies) override;
|
||||
|
||||
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ void game_list_table::populate(
|
|||
const std::vector<game_info>& game_data,
|
||||
const std::map<QString, QString>& notes_map,
|
||||
const std::map<QString, QString>& title_map,
|
||||
const std::string& selected_item_id,
|
||||
const std::set<std::string>& selected_item_ids,
|
||||
bool play_hover_movies)
|
||||
{
|
||||
clear_list();
|
||||
|
|
@ -219,7 +219,7 @@ void game_list_table::populate(
|
|||
|
||||
int row = 0;
|
||||
int index = -1;
|
||||
int selected_row = -1;
|
||||
std::set<int> selected_rows;
|
||||
|
||||
const auto get_title = [&title_map](const QString& serial, const std::string& name) -> QString
|
||||
{
|
||||
|
|
@ -378,15 +378,18 @@ void game_list_table::populate(
|
|||
setItem(row, static_cast<int>(gui::game_list_columns::compat), compat_item);
|
||||
setItem(row, static_cast<int>(gui::game_list_columns::dir_size), new custom_table_widget_item(game_size != umax ? gui::utils::format_byte_size(game_size) : tr("Unknown"), Qt::UserRole, QVariant::fromValue<qulonglong>(game_size)));
|
||||
|
||||
if (selected_item_id == game->info.path + game->info.icon_path)
|
||||
if (selected_item_ids.contains(game->info.path + game->info.icon_path))
|
||||
{
|
||||
selected_row = row;
|
||||
selected_rows.insert(row);
|
||||
}
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
selectRow(selected_row);
|
||||
for (int selected_row : selected_rows)
|
||||
{
|
||||
selectionModel()->select(model()->index(selected_row, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
}
|
||||
}
|
||||
|
||||
void game_list_table::repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
const std::vector<game_info>& game_data,
|
||||
const std::map<QString, QString>& notes_map,
|
||||
const std::map<QString, QString>& title_map,
|
||||
const std::string& selected_item_id,
|
||||
const std::set<std::string>& selected_item_ids,
|
||||
bool play_hover_movies) override;
|
||||
|
||||
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
||||
|
|
|
|||
Loading…
Reference in a new issue