Skip to content

Commit

Permalink
Merge pull request #12512 from JosJuice/assembler-dirty-flag
Browse files Browse the repository at this point in the history
DolphinQt: Rework dirty flag handling in AssemblerWidget::TabTextForEditor
  • Loading branch information
lioncash committed Jan 21, 2024
2 parents 29f6baa + 6276232 commit d64705d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Source/Core/DolphinQt/Debugger/AssemblerWidget.cpp
Expand Up @@ -698,21 +698,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)
{
dirtyFlag = QStringLiteral(" *");
}

if (editor->Path().isEmpty())
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())
{
if (editor->EditorNum() == 0)
{
return tr("New File%1").arg(dirtyFlag);
}
return tr("New File (%1)%2").arg(editor->EditorNum() + 1).arg(dirtyFlag);
// i18n: This asterisk is added to the title of an editor to indicate that it has unsaved
// changes
result = tr("%1 *").arg(result);
}
return tr("%1%2").arg(editor->EditorTitle()).arg(dirtyFlag);

return result;
}

AsmEditor* AssemblerWidget::GetEditor(int idx)
Expand Down

0 comments on commit d64705d

Please sign in to comment.