diff options
| -rw-r--r-- | src/yuzu/game_list.cpp | 38 | ||||
| -rw-r--r-- | src/yuzu/game_list.h | 3 | ||||
| -rw-r--r-- | src/yuzu/game_list_p.h | 3 |
3 files changed, 37 insertions, 7 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index c4b1f65bd..b127badc2 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -126,10 +126,8 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} { | |||
| 126 | layout_filter = new QHBoxLayout; | 126 | layout_filter = new QHBoxLayout; |
| 127 | layout_filter->setContentsMargins(8, 8, 8, 8); | 127 | layout_filter->setContentsMargins(8, 8, 8, 8); |
| 128 | label_filter = new QLabel; | 128 | label_filter = new QLabel; |
| 129 | label_filter->setText(tr("Filter:")); | ||
| 130 | edit_filter = new QLineEdit; | 129 | edit_filter = new QLineEdit; |
| 131 | edit_filter->clear(); | 130 | edit_filter->clear(); |
| 132 | edit_filter->setPlaceholderText(tr("Enter pattern to filter")); | ||
| 133 | edit_filter->installEventFilter(key_release_eater); | 131 | edit_filter->installEventFilter(key_release_eater); |
| 134 | edit_filter->setClearButtonEnabled(true); | 132 | edit_filter->setClearButtonEnabled(true); |
| 135 | connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::OnTextChanged); | 133 | connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::OnTextChanged); |
| @@ -149,6 +147,7 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} { | |||
| 149 | layout_filter->addWidget(label_filter_result); | 147 | layout_filter->addWidget(label_filter_result); |
| 150 | layout_filter->addWidget(button_filter_close); | 148 | layout_filter->addWidget(button_filter_close); |
| 151 | setLayout(layout_filter); | 149 | setLayout(layout_filter); |
| 150 | RetranslateUI(); | ||
| 152 | } | 151 | } |
| 153 | 152 | ||
| 154 | /** | 153 | /** |
| @@ -333,13 +332,9 @@ GameList::GameList(FileSys::VirtualFilesystem vfs_, FileSys::ManualContentProvid | |||
| 333 | tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }")); | 332 | tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }")); |
| 334 | 333 | ||
| 335 | item_model->insertColumns(0, COLUMN_COUNT); | 334 | item_model->insertColumns(0, COLUMN_COUNT); |
| 336 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | 335 | RetranslateUI(); |
| 337 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | ||
| 338 | 336 | ||
| 339 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | ||
| 340 | tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); | 337 | tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); |
| 341 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | ||
| 342 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | ||
| 343 | item_model->setSortRole(GameListItemPath::SortRole); | 338 | item_model->setSortRole(GameListItemPath::SortRole); |
| 344 | 339 | ||
| 345 | connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons); | 340 | connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons); |
| @@ -753,6 +748,35 @@ void GameList::LoadCompatibilityList() { | |||
| 753 | } | 748 | } |
| 754 | } | 749 | } |
| 755 | 750 | ||
| 751 | void GameList::changeEvent(QEvent* event) { | ||
| 752 | if (event->type() == QEvent::LanguageChange) { | ||
| 753 | RetranslateUI(); | ||
| 754 | } | ||
| 755 | |||
| 756 | QWidget::changeEvent(event); | ||
| 757 | } | ||
| 758 | |||
| 759 | void GameList::RetranslateUI() { | ||
| 760 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | ||
| 761 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | ||
| 762 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | ||
| 763 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | ||
| 764 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | ||
| 765 | } | ||
| 766 | |||
| 767 | void GameListSearchField::changeEvent(QEvent* event) { | ||
| 768 | if (event->type() == QEvent::LanguageChange) { | ||
| 769 | RetranslateUI(); | ||
| 770 | } | ||
| 771 | |||
| 772 | QWidget::changeEvent(event); | ||
| 773 | } | ||
| 774 | |||
| 775 | void GameListSearchField::RetranslateUI() { | ||
| 776 | label_filter->setText(tr("Filter:")); | ||
| 777 | edit_filter->setPlaceholderText(tr("Enter pattern to filter")); | ||
| 778 | } | ||
| 779 | |||
| 756 | QStandardItemModel* GameList::GetModel() const { | 780 | QStandardItemModel* GameList::GetModel() const { |
| 757 | return item_model; | 781 | return item_model; |
| 758 | } | 782 | } |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index f783283c9..cdf085019 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -140,6 +140,9 @@ private: | |||
| 140 | void AddPermDirPopup(QMenu& context_menu, QModelIndex selected); | 140 | void AddPermDirPopup(QMenu& context_menu, QModelIndex selected); |
| 141 | void AddFavoritesPopup(QMenu& context_menu); | 141 | void AddFavoritesPopup(QMenu& context_menu); |
| 142 | 142 | ||
| 143 | void changeEvent(QEvent*) override; | ||
| 144 | void RetranslateUI(); | ||
| 145 | |||
| 143 | std::shared_ptr<FileSys::VfsFilesystem> vfs; | 146 | std::shared_ptr<FileSys::VfsFilesystem> vfs; |
| 144 | FileSys::ManualContentProvider* provider; | 147 | FileSys::ManualContentProvider* provider; |
| 145 | GameListSearchField* search_field; | 148 | GameListSearchField* search_field; |
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 0e19be22d..6198d1e4e 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h | |||
| @@ -353,6 +353,9 @@ public: | |||
| 353 | void setFocus(); | 353 | void setFocus(); |
| 354 | 354 | ||
| 355 | private: | 355 | private: |
| 356 | void changeEvent(QEvent*) override; | ||
| 357 | void RetranslateUI(); | ||
| 358 | |||
| 356 | class KeyReleaseEater : public QObject { | 359 | class KeyReleaseEater : public QObject { |
| 357 | public: | 360 | public: |
| 358 | explicit KeyReleaseEater(GameList* gamelist_, QObject* parent = nullptr); | 361 | explicit KeyReleaseEater(GameList* gamelist_, QObject* parent = nullptr); |