diff --git a/rpcs3/rpcs3qt/game_list_base.h b/rpcs3/rpcs3qt/game_list_base.h index 6d25aad3b3..2af79b0b01 100644 --- a/rpcs3/rpcs3qt/game_list_base.h +++ b/rpcs3/rpcs3qt/game_list_base.h @@ -15,7 +15,7 @@ public: [[maybe_unused]] const std::vector& game_data, [[maybe_unused]] const std::map& notes_map, [[maybe_unused]] const std::map& title_map, - [[maybe_unused]] const std::string& selected_item_id, + [[maybe_unused]] const std::set& selected_item_ids, [[maybe_unused]] bool play_hover_movies){}; void set_icon_size(QSize size) { m_icon_size = std::move(size); } diff --git a/rpcs3/rpcs3qt/game_list_context_menu.cpp b/rpcs3/rpcs3qt/game_list_context_menu.cpp index a04f5b0128..bb15bc80ec 100644 --- a/rpcs3/rpcs3qt/game_list_context_menu.cpp +++ b/rpcs3/rpcs3qt/game_list_context_menu.cpp @@ -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); diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 6910012fc3..f8b48e8508 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -446,7 +446,7 @@ void game_list_frame::Refresh(const bool from_drive, const std::vector 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::vectorclear_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::vectorclear_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 game_list_frame::CurrentSelectionPaths() { - std::string selection; - - game_info game{}; + std::set 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 = var.value(); + if (const game_info game = var.value()) + { + selection.insert(game->info.path + game->info.icon_path); + } } } } } else if (m_game_grid) { - if (game_list_grid_item* item = static_cast(m_game_grid->selected_item())) + if (const game_list_grid_item* item = static_cast(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; diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index 332383dae5..b8148630f9 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -130,7 +130,7 @@ private: bool SearchMatchesApp(const QString& name, const QString& serial, bool fallback = false) const; - std::string CurrentSelectionPath(); + std::set CurrentSelectionPaths(); game_info GetGameInfoByMode(const QTableWidgetItem* item) const; static game_info GetGameInfoFromItem(const QTableWidgetItem* item); diff --git a/rpcs3/rpcs3qt/game_list_grid.cpp b/rpcs3/rpcs3qt/game_list_grid.cpp index 0fc48c412e..e60a832569 100644 --- a/rpcs3/rpcs3qt/game_list_grid.cpp +++ b/rpcs3/rpcs3qt/game_list_grid.cpp @@ -40,7 +40,7 @@ void game_list_grid::populate( const std::vector& game_data, const std::map& notes_map, const std::map& title_map, - const std::string& selected_item_id, + const std::set& 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; } diff --git a/rpcs3/rpcs3qt/game_list_grid.h b/rpcs3/rpcs3qt/game_list_grid.h index 6116ff1d8c..e9e5890e81 100644 --- a/rpcs3/rpcs3qt/game_list_grid.h +++ b/rpcs3/rpcs3qt/game_list_grid.h @@ -18,7 +18,7 @@ public: const std::vector& game_data, const std::map& notes_map, const std::map& title_map, - const std::string& selected_item_id, + const std::set& selected_item_ids, bool play_hover_movies) override; void repaint_icons(std::vector& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override; diff --git a/rpcs3/rpcs3qt/game_list_table.cpp b/rpcs3/rpcs3qt/game_list_table.cpp index 3d010c7689..c3069ef67e 100644 --- a/rpcs3/rpcs3qt/game_list_table.cpp +++ b/rpcs3/rpcs3qt/game_list_table.cpp @@ -204,7 +204,7 @@ void game_list_table::populate( const std::vector& game_data, const std::map& notes_map, const std::map& title_map, - const std::string& selected_item_id, + const std::set& 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 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(gui::game_list_columns::compat), compat_item); setItem(row, static_cast(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(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_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) diff --git a/rpcs3/rpcs3qt/game_list_table.h b/rpcs3/rpcs3qt/game_list_table.h index 4c185fcc61..ac9bff64e5 100644 --- a/rpcs3/rpcs3qt/game_list_table.h +++ b/rpcs3/rpcs3qt/game_list_table.h @@ -28,7 +28,7 @@ public: const std::vector& game_data, const std::map& notes_map, const std::map& title_map, - const std::string& selected_item_id, + const std::set& selected_item_ids, bool play_hover_movies) override; void repaint_icons(std::vector& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;