From 6276232574c2ef281c953e2f5499da9e1c53ca60 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 20 Jan 2024 14:53:45 +0100 Subject: [PATCH] DolphinQt: Rework dirty flag handling in AssemblerWidget::TabTextForEditor Putting the handling of the dirty flag in only one string makes it clearer for translators what's going on. --- .../DolphinQt/Debugger/AssemblerWidget.cpp | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Source/Core/DolphinQt/Debugger/AssemblerWidget.cpp b/Source/Core/DolphinQt/Debugger/AssemblerWidget.cpp index a769df82e6..25b1308f1d 100644 --- a/Source/Core/DolphinQt/Debugger/AssemblerWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/AssemblerWidget.cpp @@ -701,21 +701,23 @@ void AssemblerWidget::OnTabChange(int index) QString AssemblerWidget::TabTextForEditor(AsmEditor* editor, bool with_dirty) { ASSERT(editor != nullptr); - QString dirtyFlag = QStringLiteral(); - if (editor->IsDirty() && with_dirty) + + QString result; + if (!editor->Path().isEmpty()) + result = editor->EditorTitle(); + else if (editor->EditorNum() == 0) + result = tr("New File"); + else + result = tr("New File (%1)").arg(editor->EditorNum() + 1); + + if (with_dirty && editor->IsDirty()) { - dirtyFlag = QStringLiteral(" *"); + // i18n: This asterisk is added to the title of an editor to indicate that it has unsaved + // changes + result = tr("%1 *").arg(result); } - if (editor->Path().isEmpty()) - { - if (editor->EditorNum() == 0) - { - return tr("New File%1").arg(dirtyFlag); - } - return tr("New File (%1)%2").arg(editor->EditorNum() + 1).arg(dirtyFlag); - } - return tr("%1%2").arg(editor->EditorTitle()).arg(dirtyFlag); + return result; } AsmEditor* AssemblerWidget::GetEditor(int idx)