fixups for language

This commit is contained in:
georgemoralis 2025-06-19 20:14:05 +03:00
parent 955dd2ad65
commit dd5a138da9
8 changed files with 15 additions and 10 deletions

View File

@ -34,7 +34,8 @@ GameGridFrame::GameGridFrame(std::shared_ptr<gui_settings> gui_settings,
connect(this->horizontalScrollBar(), &QScrollBar::valueChanged, this,
&GameGridFrame::RefreshGridBackgroundImage);
connect(this, &QTableWidget::customContextMenuRequested, this, [=, this](const QPoint& pos) {
m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info, this, false);
m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info,
m_gui_settings, this, false);
});
}

View File

@ -75,7 +75,8 @@ GameListFrame::GameListFrame(std::shared_ptr<gui_settings> gui_settings,
});
connect(this, &QTableWidget::customContextMenuRequested, this, [=, this](const QPoint& pos) {
m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info, this, true);
m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info,
m_gui_settings, this, true);
});
connect(this, &QTableWidget::cellClicked, this, [=, this](int row, int column) {

View File

@ -32,8 +32,10 @@ class GuiContextMenus : public QObject {
public:
void RequestGameMenu(const QPoint& pos, QVector<GameInfo>& m_games,
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
QTableWidget* widget, bool isList) {
std::shared_ptr<gui_settings> settings, QTableWidget* widget,
bool isList) {
QPoint global_pos = widget->viewport()->mapToGlobal(pos);
std::shared_ptr<gui_settings> m_gui_settings = std::move(settings);
int itemID = 0;
if (isList) {
itemID = widget->currentRow();
@ -357,7 +359,7 @@ public:
QString gameName = QString::fromStdString(m_games[itemID].name);
TrophyViewer* trophyViewer =
new TrophyViewer(trophyPath, gameTrpPath, gameName, allTrophyGames);
new TrophyViewer(m_gui_settings, trophyPath, gameTrpPath, gameName, allTrophyGames);
trophyViewer->show();
connect(widget->parent(), &QWidget::destroyed, trophyViewer,
[trophyViewer]() { trophyViewer->deleteLater(); });

View File

@ -1189,7 +1189,7 @@ void MainWindow::LoadTranslation() {
}
}
void MainWindow::OnLanguageChanged(const std::string& locale) {
void MainWindow::OnLanguageChanged(const QString& locale) {
m_gui_settings->SetValue(gui::gen_guiLanguage, locale);
LoadTranslation();

View File

@ -47,7 +47,7 @@ private Q_SLOTS:
void ShowGameList();
void RefreshGameTable();
void HandleResize(QResizeEvent* event);
void OnLanguageChanged(const std::string& locale);
void OnLanguageChanged(const QString& locale);
void toggleLabelsUnderIcons();
private:

View File

@ -594,7 +594,7 @@ void SettingsDialog::OnLanguageChanged(int index) {
ui->retranslateUi(this);
emit LanguageChanged(ui->emulatorLanguageComboBox->itemData(index).toString().toStdString());
emit LanguageChanged(ui->emulatorLanguageComboBox->itemData(index).toString());
}
void SettingsDialog::OnCursorStateChanged(s16 index) {

View File

@ -32,7 +32,7 @@ public:
int exec() override;
signals:
void LanguageChanged(const std::string& locale);
void LanguageChanged(const QString& locale);
void CompatibilityChanged();
void BackgroundOpacityChanged(int opacity);

View File

@ -104,9 +104,10 @@ void TrophyViewer::updateTableFilters() {
}
}
TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath, QString gameName,
TrophyViewer::TrophyViewer(std::shared_ptr<gui_settings> gui_settings, QString trophyPath,
QString gameTrpPath, QString gameName,
const QVector<TrophyGameInfo>& allTrophyGames)
: QMainWindow(), allTrophyGames_(allTrophyGames), currentGameName_(gameName) {
: QMainWindow(), allTrophyGames_(allTrophyGames), currentGameName_(gameName), m_gui_settings(std::move(gui_settings)) {
this->setWindowTitle(tr("Trophy Viewer") + " - " + currentGameName_);
this->setAttribute(Qt::WA_DeleteOnClose);
tabWidget = new QTabWidget(this);