Merge branch 'master' into CompatibiltyReporting
This commit is contained in:
commit
c3afd73592
75 changed files with 1527 additions and 745 deletions
|
@ -90,12 +90,46 @@ file(GLOB_RECURSE THEMES ${CMAKE_SOURCE_DIR}/dist/qt_themes/*)
|
|||
|
||||
qt5_wrap_ui(UI_HDRS ${UIS})
|
||||
|
||||
if (ENABLE_QT_TRANSLATION)
|
||||
set(CITRA_QT_LANGUAGES "${CMAKE_SOURCE_DIR}/dist/languages" CACHE PATH "Path to the translation bundle for the Qt frontend")
|
||||
option(GENERATE_QT_TRANSLATION "Generate en.ts as the translation source file" OFF)
|
||||
|
||||
# Update source TS file if enabled
|
||||
if (GENERATE_QT_TRANSLATION)
|
||||
get_target_property(SRCS citra-qt SOURCES)
|
||||
qt5_create_translation(QM_FILES ${SRCS} ${UIS} ${CITRA_QT_LANGUAGES}/en.ts)
|
||||
add_custom_target(translation ALL DEPENDS ${CITRA_QT_LANGUAGES}/en.ts)
|
||||
endif()
|
||||
|
||||
# Find all TS files except en.ts
|
||||
file(GLOB_RECURSE LANGUAGES_TS ${CITRA_QT_LANGUAGES}/*.ts)
|
||||
list(REMOVE_ITEM LANGUAGES_TS ${CITRA_QT_LANGUAGES}/en.ts)
|
||||
|
||||
# Compile TS files to QM files
|
||||
qt5_add_translation(LANGUAGES_QM ${LANGUAGES_TS})
|
||||
|
||||
# Build a QRC file from the QM file list
|
||||
set(LANGUAGES_QRC ${CMAKE_CURRENT_BINARY_DIR}/languages.qrc)
|
||||
file(WRITE ${LANGUAGES_QRC} "<RCC><qresource prefix=\"languages\">\n")
|
||||
foreach (QM ${LANGUAGES_QM})
|
||||
get_filename_component(QM_FILE ${QM} NAME)
|
||||
file(APPEND ${LANGUAGES_QRC} "<file>${QM_FILE}</file>\n")
|
||||
endforeach (QM)
|
||||
file(APPEND ${LANGUAGES_QRC} "</qresource></RCC>")
|
||||
|
||||
# Add the QRC file to package in all QM files
|
||||
qt5_add_resources(LANGUAGES ${LANGUAGES_QRC})
|
||||
else()
|
||||
set(LANGUAGES)
|
||||
endif()
|
||||
|
||||
target_sources(citra-qt
|
||||
PRIVATE
|
||||
${ICONS}
|
||||
${THEMES}
|
||||
${UI_HDRS}
|
||||
${UIS}
|
||||
${LANGUAGES}
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
|
|
|
@ -36,6 +36,7 @@ void EmuThread::run() {
|
|||
|
||||
Core::System::ResultStatus result = Core::System::GetInstance().RunLoop();
|
||||
if (result != Core::System::ResultStatus::Success) {
|
||||
this->SetRunning(false);
|
||||
emit ErrorThrown(result, Core::System::GetInstance().GetStatusDetails());
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,9 @@ void Config::ReadValues() {
|
|||
}
|
||||
|
||||
Settings::values.motion_device =
|
||||
qt_config->value("motion_device", "engine:motion_emu,update_period:100,sensitivity:0.01")
|
||||
qt_config
|
||||
->value("motion_device",
|
||||
"engine:motion_emu,update_period:100,sensitivity:0.01,tilt_clamp:90.0")
|
||||
.toString()
|
||||
.toStdString();
|
||||
Settings::values.touch_device =
|
||||
|
@ -182,6 +184,7 @@ void Config::ReadValues() {
|
|||
UISettings::values.gamedir = qt_config->value("gameListRootDir", ".").toString();
|
||||
UISettings::values.gamedir_deepscan = qt_config->value("gameListDeepScan", false).toBool();
|
||||
UISettings::values.recent_files = qt_config->value("recentFiles").toStringList();
|
||||
UISettings::values.language = qt_config->value("language", "").toString();
|
||||
qt_config->endGroup();
|
||||
|
||||
qt_config->beginGroup("Shortcuts");
|
||||
|
@ -333,6 +336,7 @@ void Config::SaveValues() {
|
|||
qt_config->setValue("gameListRootDir", UISettings::values.gamedir);
|
||||
qt_config->setValue("gameListDeepScan", UISettings::values.gamedir_deepscan);
|
||||
qt_config->setValue("recentFiles", UISettings::values.recent_files);
|
||||
qt_config->setValue("language", UISettings::values.language);
|
||||
qt_config->endGroup();
|
||||
|
||||
qt_config->beginGroup("Shortcuts");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>740</width>
|
||||
<width>461</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -34,15 +34,15 @@
|
|||
<string>Input</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="ConfigureGraphics" name="graphicsTab">
|
||||
<attribute name="title">
|
||||
<string>Graphics</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="ConfigureGraphics" name="graphicsTab">
|
||||
<attribute name="title">
|
||||
<string>Graphics</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="ConfigureAudio" name="audioTab">
|
||||
<attribute name="title">
|
||||
<string>Audio</string>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Audio</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="ConfigureDebug" name="debugTab">
|
||||
<attribute name="title">
|
||||
|
|
|
@ -76,3 +76,7 @@ void ConfigureAudio::updateAudioDevices(int sink_index) {
|
|||
ui->audio_device_combo_box->addItem(device.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureAudio::retranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public:
|
|||
~ConfigureAudio();
|
||||
|
||||
void applyConfiguration();
|
||||
void retranslateUi();
|
||||
|
||||
public slots:
|
||||
void updateAudioDevices(int sink_index);
|
||||
|
|
|
@ -24,3 +24,7 @@ void ConfigureDebug::applyConfiguration() {
|
|||
Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
|
||||
Settings::Apply();
|
||||
}
|
||||
|
||||
void ConfigureDebug::retranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public:
|
|||
~ConfigureDebug();
|
||||
|
||||
void applyConfiguration();
|
||||
void retranslateUi();
|
||||
|
||||
private:
|
||||
void setConfiguration();
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ConfigureDialog) {
|
||||
ui->setupUi(this);
|
||||
this->setConfiguration();
|
||||
connect(ui->generalTab, &ConfigureGeneral::languageChanged, this,
|
||||
&ConfigureDialog::onLanguageChanged);
|
||||
}
|
||||
|
||||
ConfigureDialog::~ConfigureDialog() {}
|
||||
|
@ -26,3 +28,15 @@ void ConfigureDialog::applyConfiguration() {
|
|||
ui->webTab->applyConfiguration();
|
||||
Settings::Apply();
|
||||
}
|
||||
|
||||
void ConfigureDialog::onLanguageChanged(const QString& locale) {
|
||||
emit languageChanged(locale);
|
||||
ui->retranslateUi(this);
|
||||
ui->generalTab->retranslateUi();
|
||||
ui->systemTab->retranslateUi();
|
||||
ui->inputTab->retranslateUi();
|
||||
ui->graphicsTab->retranslateUi();
|
||||
ui->audioTab->retranslateUi();
|
||||
ui->debugTab->retranslateUi();
|
||||
ui->webTab->retranslateUi();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,12 @@ public:
|
|||
|
||||
void applyConfiguration();
|
||||
|
||||
private slots:
|
||||
void onLanguageChanged(const QString& locale);
|
||||
|
||||
signals:
|
||||
void languageChanged(const QString& locale);
|
||||
|
||||
private:
|
||||
void setConfiguration();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QDirIterator>
|
||||
#include "citra_qt/configuration/configure_general.h"
|
||||
#include "citra_qt/ui_settings.h"
|
||||
#include "core/core.h"
|
||||
|
@ -12,6 +13,23 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
|
|||
: QWidget(parent), ui(new Ui::ConfigureGeneral) {
|
||||
|
||||
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,
|
||||
&ConfigureGeneral::onLanguageChanged);
|
||||
|
||||
for (auto theme : UISettings::themes) {
|
||||
ui->theme_combobox->addItem(theme.first, theme.second);
|
||||
|
@ -37,6 +55,8 @@ void ConfigureGeneral::setConfiguration() {
|
|||
ui->region_combobox->setCurrentIndex(Settings::values.region_value + 1);
|
||||
|
||||
ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
|
||||
ui->language_combobox->setCurrentIndex(
|
||||
ui->language_combobox->findData(UISettings::values.language));
|
||||
}
|
||||
|
||||
void ConfigureGeneral::applyConfiguration() {
|
||||
|
@ -52,3 +72,14 @@ void ConfigureGeneral::applyConfiguration() {
|
|||
Settings::values.use_cpu_jit = ui->toggle_cpu_jit->isChecked();
|
||||
Settings::Apply();
|
||||
}
|
||||
|
||||
void ConfigureGeneral::onLanguageChanged(int index) {
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
emit languageChanged(ui->language_combobox->itemData(index).toString());
|
||||
}
|
||||
|
||||
void ConfigureGeneral::retranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,13 @@ public:
|
|||
~ConfigureGeneral();
|
||||
|
||||
void applyConfiguration();
|
||||
void retranslateUi();
|
||||
|
||||
private slots:
|
||||
void onLanguageChanged(int index);
|
||||
|
||||
signals:
|
||||
void languageChanged(const QString& locale);
|
||||
|
||||
private:
|
||||
void setConfiguration();
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>377</height>
|
||||
<width>345</width>
|
||||
<height>493</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -38,6 +38,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="language_label">
|
||||
<property name="text">
|
||||
<string>Interface language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="language_combobox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -113,3 +113,7 @@ void ConfigureGraphics::applyConfiguration() {
|
|||
Settings::values.swap_screen = ui->swap_screen->isChecked();
|
||||
Settings::Apply();
|
||||
}
|
||||
|
||||
void ConfigureGraphics::retranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public:
|
|||
~ConfigureGraphics();
|
||||
|
||||
void applyConfiguration();
|
||||
void retranslateUi();
|
||||
|
||||
private:
|
||||
void setConfiguration();
|
||||
|
|
|
@ -277,3 +277,7 @@ void ConfigureInput::keyPressEvent(QKeyEvent* event) {
|
|||
}
|
||||
setPollingResult({}, true);
|
||||
}
|
||||
|
||||
void ConfigureInput::retranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
|
||||
/// Save all button configurations to settings file
|
||||
void applyConfiguration();
|
||||
void retranslateUi();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::ConfigureInput> ui;
|
||||
|
|
|
@ -167,3 +167,7 @@ void ConfigureSystem::refreshConsoleID() {
|
|||
Service::CFG::UpdateConfigNANDSavegame();
|
||||
ui->label_console_id->setText("Console ID: 0x" + QString::number(console_id, 16).toUpper());
|
||||
}
|
||||
|
||||
void ConfigureSystem::retranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
|
||||
void applyConfiguration();
|
||||
void setConfiguration();
|
||||
void retranslateUi();
|
||||
|
||||
public slots:
|
||||
void updateBirthdayComboBox(int birthmonth_index);
|
||||
|
|
|
@ -100,3 +100,7 @@ void ConfigureWeb::OnLoginVerified() {
|
|||
"correctly, and that your internet connection is working."));
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureWeb::retranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
~ConfigureWeb();
|
||||
|
||||
void applyConfiguration();
|
||||
void retranslateUi();
|
||||
|
||||
public slots:
|
||||
void RefreshTelemetryID();
|
||||
|
|
|
@ -98,6 +98,8 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
|||
// register size_t to use in slots and signals
|
||||
qRegisterMetaType<size_t>("size_t");
|
||||
|
||||
LoadTranslation();
|
||||
|
||||
Pica::g_debug_context = Pica::DebugContext::Construct();
|
||||
setAcceptDrops(true);
|
||||
ui.setupUi(this);
|
||||
|
@ -115,8 +117,8 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
|||
ConnectMenuEvents();
|
||||
ConnectWidgetEvents();
|
||||
|
||||
setWindowTitle(QString("Citra %1| %2-%3")
|
||||
.arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
||||
SetupUIStrings();
|
||||
|
||||
show();
|
||||
|
||||
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
||||
|
@ -892,6 +894,8 @@ void GMainWindow::ToggleWindowMode() {
|
|||
|
||||
void GMainWindow::OnConfigure() {
|
||||
ConfigureDialog configureDialog(this);
|
||||
connect(&configureDialog, &ConfigureDialog::languageChanged, this,
|
||||
&GMainWindow::OnLanguageChanged);
|
||||
auto result = configureDialog.exec();
|
||||
if (result == QDialog::Accepted) {
|
||||
configureDialog.applyConfiguration();
|
||||
|
@ -995,6 +999,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
|||
} else {
|
||||
// Only show the message if the game is still running.
|
||||
if (emu_thread) {
|
||||
emu_thread->SetRunning(true);
|
||||
message_label->setText(status_message);
|
||||
message_label->setVisible(true);
|
||||
}
|
||||
|
@ -1105,6 +1110,45 @@ void GMainWindow::UpdateUITheme() {
|
|||
}
|
||||
}
|
||||
|
||||
void GMainWindow::LoadTranslation() {
|
||||
// If the selected language is English, no need to install any translation
|
||||
if (UISettings::values.language == "en") {
|
||||
return;
|
||||
}
|
||||
|
||||
bool loaded;
|
||||
|
||||
if (UISettings::values.language.isEmpty()) {
|
||||
// If the selected language is empty, use system locale
|
||||
loaded = translator.load(QLocale(), "", "", ":/languages/");
|
||||
} else {
|
||||
// Otherwise load from the specified file
|
||||
loaded = translator.load(UISettings::values.language, ":/languages/");
|
||||
}
|
||||
|
||||
if (loaded) {
|
||||
qApp->installTranslator(&translator);
|
||||
} else {
|
||||
UISettings::values.language = "en";
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::OnLanguageChanged(const QString& locale) {
|
||||
if (UISettings::values.language != "en") {
|
||||
qApp->removeTranslator(&translator);
|
||||
}
|
||||
|
||||
UISettings::values.language = locale;
|
||||
LoadTranslation();
|
||||
ui.retranslateUi(this);
|
||||
SetupUIStrings();
|
||||
}
|
||||
|
||||
void GMainWindow::SetupUIStrings() {
|
||||
setWindowTitle(
|
||||
tr("Citra %1| %2-%3").arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
||||
}
|
||||
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <memory>
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
#include "core/core.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "ui_main.h"
|
||||
|
@ -152,9 +153,12 @@ private slots:
|
|||
void OnUpdateFound(bool found, bool error);
|
||||
void OnCheckForUpdates();
|
||||
void OnOpenUpdater();
|
||||
void OnLanguageChanged(const QString& locale);
|
||||
|
||||
private:
|
||||
void UpdateStatusBar();
|
||||
void LoadTranslation();
|
||||
void SetupUIStrings();
|
||||
|
||||
Ui::MainWindow ui;
|
||||
|
||||
|
@ -193,6 +197,8 @@ private:
|
|||
|
||||
QAction* actions_recent_files[max_recent_files_item];
|
||||
|
||||
QTranslator translator;
|
||||
|
||||
protected:
|
||||
void dropEvent(QDropEvent* event) override;
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
|
|
|
@ -48,6 +48,7 @@ struct Values {
|
|||
QString gamedir;
|
||||
bool gamedir_deepscan;
|
||||
QStringList recent_files;
|
||||
QString language;
|
||||
|
||||
QString theme;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue