mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
Qt: Retranslate GameList header and Filter line
Didn't notice this until I was trying to change the default font to Comic Sans MS when language is set to English in yuzu.
This commit is contained in:
parent
ed0e9e9593
commit
854fe203e8
@ -136,10 +136,8 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
|
|||||||
layout_filter = new QHBoxLayout;
|
layout_filter = new QHBoxLayout;
|
||||||
layout_filter->setContentsMargins(8, 8, 8, 8);
|
layout_filter->setContentsMargins(8, 8, 8, 8);
|
||||||
label_filter = new QLabel;
|
label_filter = new QLabel;
|
||||||
label_filter->setText(tr("Filter:"));
|
|
||||||
edit_filter = new QLineEdit;
|
edit_filter = new QLineEdit;
|
||||||
edit_filter->clear();
|
edit_filter->clear();
|
||||||
edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
|
|
||||||
edit_filter->installEventFilter(key_release_eater);
|
edit_filter->installEventFilter(key_release_eater);
|
||||||
edit_filter->setClearButtonEnabled(true);
|
edit_filter->setClearButtonEnabled(true);
|
||||||
connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::OnTextChanged);
|
connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::OnTextChanged);
|
||||||
@ -159,6 +157,7 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
|
|||||||
layout_filter->addWidget(label_filter_result);
|
layout_filter->addWidget(label_filter_result);
|
||||||
layout_filter->addWidget(button_filter_close);
|
layout_filter->addWidget(button_filter_close);
|
||||||
setLayout(layout_filter);
|
setLayout(layout_filter);
|
||||||
|
RetranslateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -306,11 +305,7 @@ GameList::GameList(GMainWindow* parent) : QWidget{parent} {
|
|||||||
tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }"));
|
tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }"));
|
||||||
|
|
||||||
item_model->insertColumns(0, COLUMN_COUNT);
|
item_model->insertColumns(0, COLUMN_COUNT);
|
||||||
item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"));
|
RetranslateUI();
|
||||||
item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility"));
|
|
||||||
item_model->setHeaderData(COLUMN_REGION, Qt::Horizontal, tr("Region"));
|
|
||||||
item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type"));
|
|
||||||
item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size"));
|
|
||||||
item_model->setSortRole(GameListItemPath::SortRole);
|
item_model->setSortRole(GameListItemPath::SortRole);
|
||||||
|
|
||||||
connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons);
|
connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons);
|
||||||
@ -667,6 +662,35 @@ void GameList::LoadCompatibilityList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameList::changeEvent(QEvent* event) {
|
||||||
|
if (event->type() == QEvent::LanguageChange) {
|
||||||
|
RetranslateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameList::RetranslateUI() {
|
||||||
|
item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"));
|
||||||
|
item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility"));
|
||||||
|
item_model->setHeaderData(COLUMN_REGION, Qt::Horizontal, tr("Region"));
|
||||||
|
item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type"));
|
||||||
|
item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameListSearchField::changeEvent(QEvent* event) {
|
||||||
|
if (event->type() == QEvent::LanguageChange) {
|
||||||
|
RetranslateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameListSearchField::RetranslateUI() {
|
||||||
|
label_filter->setText(tr("Filter:"));
|
||||||
|
edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
|
||||||
|
}
|
||||||
|
|
||||||
QStandardItemModel* GameList::GetModel() const {
|
QStandardItemModel* GameList::GetModel() const {
|
||||||
return item_model;
|
return item_model;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,9 @@ private:
|
|||||||
|
|
||||||
QString FindGameByProgramID(QStandardItem* current_item, u64 program_id, int role);
|
QString FindGameByProgramID(QStandardItem* current_item, u64 program_id, int role);
|
||||||
|
|
||||||
|
void changeEvent(QEvent*) override;
|
||||||
|
void RetranslateUI();
|
||||||
|
|
||||||
GameListSearchField* search_field;
|
GameListSearchField* search_field;
|
||||||
GMainWindow* main_window = nullptr;
|
GMainWindow* main_window = nullptr;
|
||||||
QVBoxLayout* layout = nullptr;
|
QVBoxLayout* layout = nullptr;
|
||||||
|
@ -431,6 +431,9 @@ public:
|
|||||||
void setFocus();
|
void setFocus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void changeEvent(QEvent*) override;
|
||||||
|
void RetranslateUI();
|
||||||
|
|
||||||
class KeyReleaseEater : public QObject {
|
class KeyReleaseEater : public QObject {
|
||||||
public:
|
public:
|
||||||
explicit KeyReleaseEater(GameList* gamelist, QObject* parent = nullptr);
|
explicit KeyReleaseEater(GameList* gamelist, QObject* parent = nullptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user