yuzu: address some review comments and fix compilation in CI

This commit is contained in:
fearlessTobi
2019-01-04 23:03:29 +01:00
parent 85498975f2
commit 0d567ac1cc
5 changed files with 28 additions and 24 deletions

View File

@@ -256,7 +256,7 @@ if (ENABLE_QT)
if (YUZU_USE_QT_WEB_ENGINE)
find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets ${QT_PREFIX_HINT})
endif ()
if (ENABLE_QT_TRANSLATION)
find_package(Qt5 REQUIRED COMPONENTS LinguistTools ${QT_PREFIX_HINT})
endif()

View File

@@ -9,7 +9,7 @@
#include "common/common_types.h"
#include "core/settings.h"
#include "ui_configure_gamelist.h"
#include "ui_configure_ui.h"
#include "yuzu/configuration/configure_ui.h"
#include "yuzu/ui_settings.h"
@@ -33,23 +33,7 @@ constexpr std::array row_text_names{
ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) {
ui->setupUi(this);
ui->language_combobox->addItem(tr("<System>"), QString(""));
ui->language_combobox->addItem(tr("English"), QString("en"));
QDirIterator it(":/languages", QDirIterator::NoIteratorFlags);
while (it.hasNext()) {
QString locale = it.next();
locale.truncate(locale.lastIndexOf('.'));
locale.remove(0, locale.lastIndexOf('/') + 1);
QString lang = QLocale::languageToString(QLocale(locale).language());
ui->language_combobox->addItem(lang, locale);
}
// Unlike other configuration changes, interface language changes need to be reflected on the
// interface immediately. This is done by passing a signal to the main window, and then
// retranslating when passing back.
connect(ui->language_combobox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ConfigureUi::onLanguageChanged);
InitializeLanguageComboBox();
for (const auto& theme : UISettings::themes) {
ui->theme_combobox->addItem(theme.first, theme.second);
@@ -125,6 +109,25 @@ void ConfigureUi::RetranslateUI() {
}
}
void ConfigureUi::InitializeLanguageComboBox() {
ui->language_combobox->addItem(tr("<System>"), QString());
ui->language_combobox->addItem(tr("English"), QStringLiteral("en"));
QDirIterator it(":/languages", QDirIterator::NoIteratorFlags);
while (it.hasNext()) {
QString locale = it.next();
locale.truncate(locale.lastIndexOf('.'));
locale.remove(0, locale.lastIndexOf('/') + 1);
const QString lang = QLocale::languageToString(QLocale(locale).language());
ui->language_combobox->addItem(lang, locale);
}
// Unlike other configuration changes, interface language changes need to be reflected on the
// interface immediately. This is done by passing a signal to the main window, and then
// retranslating when passing back.
connect(ui->language_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&ConfigureUi::onLanguageChanged);
}
void ConfigureUi::InitializeIconSizeComboBox() {
for (const auto& size : default_icon_sizes) {
ui->icon_size_combobox->addItem(QString::fromUtf8(size.second), size.first);

View File

@@ -34,6 +34,7 @@ private:
void changeEvent(QEvent*) override;
void RetranslateUI();
void InitializeLanguageComboBox();
void InitializeIconSizeComboBox();
void InitializeRowComboBoxes();

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigureGameList</class>
<widget class="QWidget" name="ConfigureGameList">
<class>ConfigureUi</class>
<widget class="QWidget" name="ConfigureUi">
<property name="geometry">
<rect>
<x>0</x>

View File

@@ -1800,10 +1800,10 @@ void GMainWindow::UpdateWindowTitle() {
const QString description = QString::fromUtf8(Common::g_scm_desc);
if (game_title.isEmpty()) {
setWindowTitle(QStringLiteral("yuzu %1| %2-%3").arg(full_name, branch_name, description));
setWindowTitle(tr("yuzu %1| %2-%3").arg(full_name, branch_name, description));
} else {
setWindowTitle(QStringLiteral("yuzu %1| %4 | %2-%3")
.arg(full_name, branch_name, description, title_name));
setWindowTitle(
tr("yuzu %1| %4 | %2-%3").arg(full_name, branch_name, description, game_title));
}
}