Debugger: Fix some untranslatable strings

This commit is contained in:
chaoticgd 2025-08-23 12:46:48 +01:00 committed by Ty
parent a8ea4e55ef
commit a92297ceec
6 changed files with 42 additions and 20 deletions

View File

@ -393,7 +393,10 @@ void DockManager::createWindowsMenu(QMenu* menu)
const auto description_iterator = DockTables::DEBUGGER_VIEWS.find(type);
pxAssert(description_iterator != DockTables::DEBUGGER_VIEWS.end());
QAction* action = add_another_menu->addAction(description_iterator->second.display_name);
QString display_name = QCoreApplication::translate(
"DebuggerView", description_iterator->second.display_name);
QAction* action = add_another_menu->addAction(display_name);
connect(action, &QAction::triggered, this, [this, type]() {
if (m_current_layout == DockLayout::INVALID_INDEX)
return;

View File

@ -158,7 +158,7 @@ Qt::ItemFlags SavedAddressesModel::flags(const QModelIndex& index) const
void SavedAddressesModel::addRow()
{
const SavedAddress defaultNewAddress = {0, "Name", "Description"};
const SavedAddress defaultNewAddress = {0, tr("Name"), tr("Description")};
addRow(defaultNewAddress);
}

View File

@ -245,11 +245,21 @@ void DebugAnalysisSettingsWidget::setupSymbolSourceGrid()
int i = 0;
for (auto& [name, temp] : m_symbol_sources)
{
temp.check_box = new QCheckBox(QString::fromStdString(name));
QString display_name = SymbolGuardian::TranslateSymbolSourceName(name.c_str());
temp.check_box = new QCheckBox(display_name);
temp.check_box->setChecked(temp.previous_value);
layout->addWidget(temp.check_box, i / 2, i % 2);
connect(temp.check_box, &QCheckBox::checkStateChanged, this, &DebugAnalysisSettingsWidget::symbolSourceCheckStateChanged);
connect(temp.check_box, &QCheckBox::checkStateChanged, this, [this, name]() {
auto temp = m_symbol_sources.find(name);
if (temp == m_symbol_sources.end())
return;
temp->second.modified_by_user = true;
saveSymbolSources();
});
i++;
}
@ -264,21 +274,6 @@ void DebugAnalysisSettingsWidget::setupSymbolSourceGrid()
m_ui.symbolSourceErrorMessage->hide();
}
void DebugAnalysisSettingsWidget::symbolSourceCheckStateChanged()
{
QCheckBox* check_box = qobject_cast<QCheckBox*>(sender());
if (!check_box)
return;
auto temp = m_symbol_sources.find(check_box->text().toStdString());
if (temp == m_symbol_sources.end())
return;
temp->second.modified_by_user = true;
saveSymbolSources();
}
void DebugAnalysisSettingsWidget::saveSymbolSources()
{
if (!m_dialog)

View File

@ -30,7 +30,6 @@ public:
protected:
void setupSymbolSourceGrid();
void symbolSourceCheckStateChanged();
void saveSymbolSources();
void setupSymbolFileList();

View File

@ -4,6 +4,7 @@
#include "SymbolGuardian.h"
#include "DebugInterface.h"
#include "Host.h"
SymbolGuardian R5900SymbolGuardian;
SymbolGuardian R3000SymbolGuardian;
@ -216,3 +217,23 @@ void SymbolGuardian::ClearIrxModules()
m_database.destroy_symbols_from_module(module, false);
});
}
const char* SymbolGuardian::TranslateSymbolSourceName(const char* name)
{
static constexpr std::array<const char*, 8> names = {
TRANSLATE_NOOP("SymbolGuardian", "DWARF Symbol Table"),
TRANSLATE_NOOP("SymbolGuardian", "ELF Section Headers"),
TRANSLATE_NOOP("SymbolGuardian", "ELF Symbol Table"),
TRANSLATE_NOOP("SymbolGuardian", "Function Scanner"),
TRANSLATE_NOOP("SymbolGuardian", "Nocash Symbols"),
TRANSLATE_NOOP("SymbolGuardian", "SNDLL Symbol Table"),
TRANSLATE_NOOP("SymbolGuardian", "Symbol Table Importer"),
TRANSLATE_NOOP("SymbolGuardian", "User-Defined"),
};
for (const char* test_name : names)
if (strcmp(test_name, name) == 0)
return TRANSLATE("SymbolGuardian", name);
return name;
}

View File

@ -88,6 +88,10 @@ public:
// Delete all symbols from modules that have the "is_irx" flag set.
void ClearIrxModules();
// Translate the name of a ccc::SymbolSource object, or return it as is if
// no translation is available.
static const char* TranslateSymbolSourceName(const char* name);
protected:
ccc::SymbolDatabase m_database;
mutable std::shared_mutex m_big_symbol_lock;