Merge branch 'master' into CompatibiltyReporting
This commit is contained in:
commit
c3afd73592
75 changed files with 1527 additions and 745 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue