mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-18 13:10:05 +00:00
Merge pull request #2682 from nicoboss/filter
citra-qt: game list search function fixed minor mistakes
This commit is contained in:
commit
e33558c6ce
@ -45,7 +45,7 @@ bool GameList::SearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* e
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Return and Enter
|
// Return and Enter
|
||||||
// If the enter key gets pressed first checks how many and which entry is visable
|
// If the enter key gets pressed first checks how many and which entry is visible
|
||||||
// If there is only one result launch this game
|
// If there is only one result launch this game
|
||||||
case Qt::Key_Return:
|
case Qt::Key_Return:
|
||||||
case Qt::Key_Enter: {
|
case Qt::Key_Enter: {
|
||||||
@ -80,7 +80,7 @@ bool GameList::SearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* e
|
|||||||
return QObject::eventFilter(obj, event);
|
return QObject::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameList::SearchField::setFilterResult(int visable, int total) {
|
void GameList::SearchField::setFilterResult(int visible, int total) {
|
||||||
QString result_of_text = tr("of");
|
QString result_of_text = tr("of");
|
||||||
QString result_text;
|
QString result_text;
|
||||||
if (total == 1) {
|
if (total == 1) {
|
||||||
@ -89,7 +89,7 @@ void GameList::SearchField::setFilterResult(int visable, int total) {
|
|||||||
result_text = tr("results");
|
result_text = tr("results");
|
||||||
}
|
}
|
||||||
label_filter_result->setText(
|
label_filter_result->setText(
|
||||||
QString("%1 %2 %3 %4").arg(visable).arg(result_of_text).arg(total).arg(result_text));
|
QString("%1 %2 %3 %4").arg(visible).arg(result_of_text).arg(total).arg(result_text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameList::SearchField::clear() {
|
void GameList::SearchField::clear() {
|
||||||
@ -236,11 +236,13 @@ GameList::~GameList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameList::setFilterFocus() {
|
void GameList::setFilterFocus() {
|
||||||
|
if (tree_view->model()->rowCount() > 0) {
|
||||||
search_field->setFocus();
|
search_field->setFocus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GameList::setFilterVisible(bool visablility) {
|
void GameList::setFilterVisible(bool visibility) {
|
||||||
search_field->setVisible(visablility);
|
search_field->setVisible(visibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameList::clearFilter() {
|
void GameList::clearFilter() {
|
||||||
@ -271,8 +273,10 @@ void GameList::DonePopulating() {
|
|||||||
tree_view->setEnabled(true);
|
tree_view->setEnabled(true);
|
||||||
int rowCount = tree_view->model()->rowCount();
|
int rowCount = tree_view->model()->rowCount();
|
||||||
search_field->setFilterResult(rowCount, rowCount);
|
search_field->setFilterResult(rowCount, rowCount);
|
||||||
|
if (rowCount > 0) {
|
||||||
search_field->setFocus();
|
search_field->setFocus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GameList::PopupContextMenu(const QPoint& menu_location) {
|
void GameList::PopupContextMenu(const QPoint& menu_location) {
|
||||||
QModelIndex item = tree_view->indexAt(menu_location);
|
QModelIndex item = tree_view->indexAt(menu_location);
|
||||||
@ -295,6 +299,7 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
|
|||||||
if (!FileUtil::Exists(dir_path.toStdString()) ||
|
if (!FileUtil::Exists(dir_path.toStdString()) ||
|
||||||
!FileUtil::IsDirectory(dir_path.toStdString())) {
|
!FileUtil::IsDirectory(dir_path.toStdString())) {
|
||||||
LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data());
|
LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data());
|
||||||
|
search_field->setFilterResult(0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
class SearchField : public QWidget {
|
class SearchField : public QWidget {
|
||||||
public:
|
public:
|
||||||
void setFilterResult(int visable, int total);
|
void setFilterResult(int visible, int total);
|
||||||
void clear();
|
void clear();
|
||||||
void setFocus();
|
void setFocus();
|
||||||
explicit SearchField(GameList* parent = nullptr);
|
explicit SearchField(GameList* parent = nullptr);
|
||||||
@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
void clearFilter();
|
void clearFilter();
|
||||||
void setFilterFocus();
|
void setFilterFocus();
|
||||||
void setFilterVisible(bool visablility);
|
void setFilterVisible(bool visibility);
|
||||||
|
|
||||||
void PopulateAsync(const QString& dir_path, bool deep_scan);
|
void PopulateAsync(const QString& dir_path, bool deep_scan);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user