mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
QT: Fix search in Grid mode
This commit is contained in:
parent
3ed1c31678
commit
a6e6067143
@ -49,6 +49,9 @@ void GameInfoClass::GetGameInfo(QWidget* parent) {
|
|||||||
return readGameInfo(Common::FS::PathFromQString(path));
|
return readGameInfo(Common::FS::PathFromQString(path));
|
||||||
}).results();
|
}).results();
|
||||||
|
|
||||||
|
// used to retrieve values after performing a search
|
||||||
|
m_games_backup = m_games;
|
||||||
|
|
||||||
// Progress bar, please be patient :)
|
// Progress bar, please be patient :)
|
||||||
QProgressDialog dialog(tr("Loading game list, please wait :3"), tr("Cancel"), 0, 0, parent);
|
QProgressDialog dialog(tr("Loading game list, please wait :3"), tr("Cancel"), 0, 0, parent);
|
||||||
dialog.setWindowTitle(tr("Loading..."));
|
dialog.setWindowTitle(tr("Loading..."));
|
||||||
|
@ -17,6 +17,7 @@ public:
|
|||||||
~GameInfoClass();
|
~GameInfoClass();
|
||||||
void GetGameInfo(QWidget* parent = nullptr);
|
void GetGameInfo(QWidget* parent = nullptr);
|
||||||
QVector<GameInfo> m_games;
|
QVector<GameInfo> m_games;
|
||||||
|
QVector<GameInfo> m_games_backup;
|
||||||
|
|
||||||
static bool CompareStrings(GameInfo& a, GameInfo& b) {
|
static bool CompareStrings(GameInfo& a, GameInfo& b) {
|
||||||
std::string name_a = a.name, name_b = b.name;
|
std::string name_a = a.name, name_b = b.name;
|
||||||
|
@ -659,6 +659,10 @@ void MainWindow::StartGame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SearchGameTable(const QString& text) {
|
void MainWindow::SearchGameTable(const QString& text) {
|
||||||
|
m_game_info->m_games = m_game_info->m_games_backup;
|
||||||
|
m_game_grid_frame->PopulateGameGrid(m_game_info->m_games, false);
|
||||||
|
m_game_list_frame->PopulateGameList();
|
||||||
|
|
||||||
if (isTableList) {
|
if (isTableList) {
|
||||||
for (int row = 0; row < m_game_list_frame->rowCount(); row++) {
|
for (int row = 0; row < m_game_list_frame->rowCount(); row++) {
|
||||||
QString game_name = QString::fromStdString(m_game_info->m_games[row].name);
|
QString game_name = QString::fromStdString(m_game_info->m_games[row].name);
|
||||||
@ -674,6 +678,7 @@ void MainWindow::SearchGameTable(const QString& text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::sort(filteredGames.begin(), filteredGames.end(), m_game_info->CompareStrings);
|
std::sort(filteredGames.begin(), filteredGames.end(), m_game_info->CompareStrings);
|
||||||
|
m_game_info->m_games = filteredGames;
|
||||||
m_game_grid_frame->PopulateGameGrid(filteredGames, true);
|
m_game_grid_frame->PopulateGameGrid(filteredGames, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user