mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-01 16:05:07 +01:00
Port yuzu-emu/yuzu#2457: "yuzu/{about_dialog, main}: Specify string conversions explicitly for SCM-related info" (#4774)
* yuzu/about_dialog: Specify string conversions explicitly Specifies the conversions explicitly to avoid implicit conversions from const char* to QString. This makes it easier to disable implicit QString conversions in the future. In this case, the implicit conversion was technically wrong as well. The implicit conversion treats the input strings as ASCII characters. This would result in an incorrect conversion being performed in the rare case a branch name was created with a non-ASCII Unicode character, likely resulting in junk being displayed. * yuzu/main: Move window title updating logic to its own function For similar reasons to the previous change, we move this to a single function, so we don't need to duplicate the conversion logic in several places within main.cpp.
This commit is contained in:
parent
0269cb6e67
commit
d80edd99d7
@ -11,10 +11,10 @@ AboutDialog::AboutDialog(QWidget* parent)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
|
||||
ui(new Ui::AboutDialog) {
|
||||
ui->setupUi(this);
|
||||
ui->labelLogo->setPixmap(QIcon::fromTheme("citra").pixmap(200));
|
||||
ui->labelBuildInfo->setText(
|
||||
ui->labelBuildInfo->text().arg(Common::g_build_fullname, Common::g_scm_branch,
|
||||
Common::g_scm_desc, QString(Common::g_build_date).left(10)));
|
||||
ui->labelLogo->setPixmap(QIcon::fromTheme(QStringLiteral("citra")).pixmap(200));
|
||||
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
|
||||
QString::fromUtf8(Common::g_build_fullname), QString::fromUtf8(Common::g_scm_branch),
|
||||
QString::fromUtf8(Common::g_scm_desc), QString::fromUtf8(Common::g_build_date).left(10)));
|
||||
}
|
||||
|
||||
AboutDialog::~AboutDialog() = default;
|
||||
|
@ -158,9 +158,9 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
||||
ConnectMenuEvents();
|
||||
ConnectWidgetEvents();
|
||||
|
||||
SetupUIStrings();
|
||||
LOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch,
|
||||
Common::g_scm_desc);
|
||||
UpdateWindowTitle();
|
||||
|
||||
show();
|
||||
|
||||
@ -797,7 +797,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
||||
std::string title;
|
||||
system.GetAppLoader().ReadTitle(title);
|
||||
game_title = QString::fromStdString(title);
|
||||
SetupUIStrings();
|
||||
UpdateWindowTitle();
|
||||
|
||||
game_path = filename;
|
||||
|
||||
@ -927,7 +927,7 @@ void GMainWindow::ShutdownGame() {
|
||||
}
|
||||
|
||||
game_title.clear();
|
||||
SetupUIStrings();
|
||||
UpdateWindowTitle();
|
||||
|
||||
game_path.clear();
|
||||
}
|
||||
@ -1813,7 +1813,7 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
|
||||
LoadTranslation();
|
||||
ui.retranslateUi(this);
|
||||
RetranslateStatusBar();
|
||||
SetupUIStrings();
|
||||
UpdateWindowTitle();
|
||||
|
||||
if (emulation_running)
|
||||
ui.action_Start->setText(tr("Continue"));
|
||||
@ -1826,11 +1826,13 @@ void GMainWindow::OnMoviePlaybackCompleted() {
|
||||
ui.action_Stop_Recording_Playback->setEnabled(false);
|
||||
}
|
||||
|
||||
void GMainWindow::SetupUIStrings() {
|
||||
void GMainWindow::UpdateWindowTitle() {
|
||||
const QString full_name = QString::fromUtf8(Common::g_build_fullname);
|
||||
|
||||
if (game_title.isEmpty()) {
|
||||
setWindowTitle(tr("Citra %1").arg(Common::g_build_fullname));
|
||||
setWindowTitle(tr("Citra %1").arg(full_name));
|
||||
} else {
|
||||
setWindowTitle(tr("Citra %1| %2").arg(Common::g_build_fullname, game_title));
|
||||
setWindowTitle(tr("Citra %1| %2").arg(full_name, game_title));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ private:
|
||||
Q_INVOKABLE void OnMoviePlaybackCompleted();
|
||||
void UpdateStatusBar();
|
||||
void LoadTranslation();
|
||||
void SetupUIStrings();
|
||||
void UpdateWindowTitle();
|
||||
void RetranslateStatusBar();
|
||||
void InstallCIA(QStringList filepaths);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user