diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/citra_qt/game_list.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index d6e26ed47..f56c247c7 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp | |||
| @@ -45,7 +45,7 @@ bool GameList::SearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* e | |||
| 45 | break; | 45 | break; |
| 46 | } | 46 | } |
| 47 | // Return and Enter | 47 | // Return and Enter |
| 48 | // If the enter key gets pressed first checks how many and which entry is visable | 48 | // If the enter key gets pressed first checks how many and which entry is visible |
| 49 | // If there is only one result launch this game | 49 | // If there is only one result launch this game |
| 50 | case Qt::Key_Return: | 50 | case Qt::Key_Return: |
| 51 | case Qt::Key_Enter: { | 51 | case Qt::Key_Enter: { |
| @@ -80,7 +80,7 @@ bool GameList::SearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* e | |||
| 80 | return QObject::eventFilter(obj, event); | 80 | return QObject::eventFilter(obj, event); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | void GameList::SearchField::setFilterResult(int visable, int total) { | 83 | void GameList::SearchField::setFilterResult(int visible, int total) { |
| 84 | QString result_of_text = tr("of"); | 84 | QString result_of_text = tr("of"); |
| 85 | QString result_text; | 85 | QString result_text; |
| 86 | if (total == 1) { | 86 | if (total == 1) { |
| @@ -89,7 +89,7 @@ void GameList::SearchField::setFilterResult(int visable, int total) { | |||
| 89 | result_text = tr("results"); | 89 | result_text = tr("results"); |
| 90 | } | 90 | } |
| 91 | label_filter_result->setText( | 91 | label_filter_result->setText( |
| 92 | QString("%1 %2 %3 %4").arg(visable).arg(result_of_text).arg(total).arg(result_text)); | 92 | QString("%1 %2 %3 %4").arg(visible).arg(result_of_text).arg(total).arg(result_text)); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void GameList::SearchField::clear() { | 95 | void GameList::SearchField::clear() { |
| @@ -133,13 +133,13 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} { | |||
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | /** | 135 | /** |
| 136 | * Checks if all words separated by spaces are contained in another string | 136 | * Checks if all words separated by spaces are contained in another string |
| 137 | * This offers a word order insensitive search function | 137 | * This offers a word order insensitive search function |
| 138 | * | 138 | * |
| 139 | * @param String that gets checked if it contains all words of the userinput string | 139 | * @param String that gets checked if it contains all words of the userinput string |
| 140 | * @param String containing all words getting checked | 140 | * @param String containing all words getting checked |
| 141 | * @return true if the haystack contains all words of userinput | 141 | * @return true if the haystack contains all words of userinput |
| 142 | */ | 142 | */ |
| 143 | bool GameList::containsAllWords(QString haystack, QString userinput) { | 143 | bool GameList::containsAllWords(QString haystack, QString userinput) { |
| 144 | QStringList userinput_split = userinput.split(" ", QString::SplitBehavior::SkipEmptyParts); | 144 | QStringList userinput_split = userinput.split(" ", QString::SplitBehavior::SkipEmptyParts); |
| 145 | return std::all_of(userinput_split.begin(), userinput_split.end(), | 145 | return std::all_of(userinput_split.begin(), userinput_split.end(), |
| @@ -295,6 +295,8 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { | |||
| 295 | if (!FileUtil::Exists(dir_path.toStdString()) || | 295 | if (!FileUtil::Exists(dir_path.toStdString()) || |
| 296 | !FileUtil::IsDirectory(dir_path.toStdString())) { | 296 | !FileUtil::IsDirectory(dir_path.toStdString())) { |
| 297 | LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data()); | 297 | LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data()); |
| 298 | search_field->setFilterResult(0, 0); | ||
| 299 | search_field->setFocus(); | ||
| 298 | return; | 300 | return; |
| 299 | } | 301 | } |
| 300 | 302 | ||
| @@ -355,20 +357,20 @@ void GameList::RefreshGameDirectory() { | |||
| 355 | } | 357 | } |
| 356 | 358 | ||
| 357 | /** | 359 | /** |
| 358 | * Adds the game list folder to the QFileSystemWatcher to check for updates. | 360 | * Adds the game list folder to the QFileSystemWatcher to check for updates. |
| 359 | * | 361 | * |
| 360 | * The file watcher will fire off an update to the game list when a change is detected in the game | 362 | * The file watcher will fire off an update to the game list when a change is detected in the game |
| 361 | * list folder. | 363 | * list folder. |
| 362 | * | 364 | * |
| 363 | * Notice: This method is run on the UI thread because QFileSystemWatcher is not thread safe and | 365 | * Notice: This method is run on the UI thread because QFileSystemWatcher is not thread safe and |
| 364 | * this function is fast enough to not stall the UI thread. If performance is an issue, it should | 366 | * this function is fast enough to not stall the UI thread. If performance is an issue, it should |
| 365 | * be moved to another thread and properly locked to prevent concurrency issues. | 367 | * be moved to another thread and properly locked to prevent concurrency issues. |
| 366 | * | 368 | * |
| 367 | * @param dir folder to check for changes in | 369 | * @param dir folder to check for changes in |
| 368 | * @param recursion 0 if recursion is disabled. Any positive number passed to this will add each | 370 | * @param recursion 0 if recursion is disabled. Any positive number passed to this will add each |
| 369 | * directory recursively to the watcher and will update the file list if any of the folders | 371 | * directory recursively to the watcher and will update the file list if any of the folders |
| 370 | * change. The number determines how deep the recursion should traverse. | 372 | * change. The number determines how deep the recursion should traverse. |
| 371 | */ | 373 | */ |
| 372 | void GameList::UpdateWatcherList(const std::string& dir, unsigned int recursion) { | 374 | void GameList::UpdateWatcherList(const std::string& dir, unsigned int recursion) { |
| 373 | const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory, | 375 | const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory, |
| 374 | const std::string& virtual_name) -> bool { | 376 | const std::string& virtual_name) -> bool { |