Qt: Fix some strings not being translatable

This commit is contained in:
Connor McLaughlin 2021-01-05 19:34:20 +10:00
parent b83a9cfe9a
commit 98a4e59f52
2 changed files with 38 additions and 22 deletions

View File

@ -212,8 +212,8 @@ u32 PlayStationMouse::StaticGetVibrationMotorCount()
Controller::SettingList PlayStationMouse::StaticGetSettings() Controller::SettingList PlayStationMouse::StaticGetSettings()
{ {
static constexpr std::array<SettingInfo, 1> settings = {{ static constexpr std::array<SettingInfo, 1> settings = {{
{SettingInfo::Type::Boolean, "RelativeMouseMode", TRANSLATABLE("PlaystationMouse", "Relative Mouse Mode"), {SettingInfo::Type::Boolean, "RelativeMouseMode", TRANSLATABLE("PlayStationMouse", "Relative Mouse Mode"),
TRANSLATABLE("PlaystationMouse", "Locks the mouse cursor to the window, use for FPS games.")}, TRANSLATABLE("PlayStationMouse", "Locks the mouse cursor to the window, use for FPS games.")},
}}; }};
return SettingList(settings.begin(), settings.end()); return SettingList(settings.begin(), settings.end());

View File

@ -77,7 +77,7 @@ QVariant DebuggerCodeModel::data(const QModelIndex& index, int role /*= Qt::Disp
// Bytes // Bytes
u32 instruction_bits; u32 instruction_bits;
if (!CPU::SafeReadInstruction(address, &instruction_bits)) if (!CPU::SafeReadInstruction(address, &instruction_bits))
return QStringLiteral("<invalid>"); return tr("<invalid>");
return QString::asprintf("%08X", instruction_bits); return QString::asprintf("%08X", instruction_bits);
} }
@ -87,9 +87,8 @@ QVariant DebuggerCodeModel::data(const QModelIndex& index, int role /*= Qt::Disp
// Instruction // Instruction
u32 instruction_bits; u32 instruction_bits;
if (!CPU::SafeReadInstruction(address, &instruction_bits)) if (!CPU::SafeReadInstruction(address, &instruction_bits))
return QStringLiteral("<invalid>"); return tr("<invalid>");
Log_DevPrintf("Disassemble %08X", address);
SmallString str; SmallString str;
CPU::DisassembleInstruction(&str, address, instruction_bits); CPU::DisassembleInstruction(&str, address, instruction_bits);
return QString::fromUtf8(str.GetCharArray(), static_cast<int>(str.GetLength())); return QString::fromUtf8(str.GetCharArray(), static_cast<int>(str.GetLength()));
@ -103,7 +102,7 @@ QVariant DebuggerCodeModel::data(const QModelIndex& index, int role /*= Qt::Disp
u32 instruction_bits; u32 instruction_bits;
if (!CPU::SafeReadInstruction(address, &instruction_bits)) if (!CPU::SafeReadInstruction(address, &instruction_bits))
return QStringLiteral("<invalid>"); return tr("<invalid>");
TinyString str; TinyString str;
CPU::DisassembleInstructionComment(&str, address, instruction_bits, &CPU::g_state.regs); CPU::DisassembleInstructionComment(&str, address, instruction_bits, &CPU::g_state.regs);
@ -168,11 +167,20 @@ QVariant DebuggerCodeModel::headerData(int section, Qt::Orientation orientation,
if (role != Qt::DisplayRole) if (role != Qt::DisplayRole)
return QVariant(); return QVariant();
static const char* header_names[] = {"", "Address", "Bytes", "Instruction", "Comment"}; switch (section)
if (section < 0 || section >= countof(header_names)) {
return QVariant(); case 1:
return tr("Address");
return header_names[section]; case 2:
return tr("Bytes");
case 3:
return tr("Instruction");
case 4:
return tr("Comment");
case 0:
default:
return QVariant();
}
} }
bool DebuggerCodeModel::updateRegion(VirtualMemoryAddress address) bool DebuggerCodeModel::updateRegion(VirtualMemoryAddress address)
@ -340,11 +348,15 @@ QVariant DebuggerRegistersModel::headerData(int section, Qt::Orientation orienta
if (role != Qt::DisplayRole) if (role != Qt::DisplayRole)
return QVariant(); return QVariant();
static const char* header_names[] = {"Register", "Value"}; switch (section)
if (section < 0 || section >= countof(header_names)) {
return QVariant(); case 0:
return tr("Register");
return header_names[section]; case 1:
return tr("Value");
default:
return QVariant();
}
} }
void DebuggerRegistersModel::invalidateView() void DebuggerRegistersModel::invalidateView()
@ -390,7 +402,7 @@ QVariant DebuggerStackModel::data(const QModelIndex& index, int role /*= Qt::Dis
u32 value; u32 value;
if (!CPU::SafeReadMemoryWord(address, &value)) if (!CPU::SafeReadMemoryWord(address, &value))
return QStringLiteral("<invalid>"); return tr("<invalid>");
return QString::asprintf("0x%08X", ZeroExtend32(value)); return QString::asprintf("0x%08X", ZeroExtend32(value));
} }
@ -403,11 +415,15 @@ QVariant DebuggerStackModel::headerData(int section, Qt::Orientation orientation
if (role != Qt::DisplayRole) if (role != Qt::DisplayRole)
return QVariant(); return QVariant();
static const char* header_names[] = {"Address", "Value"}; switch (section)
if (section < 0 || section >= countof(header_names)) {
return QVariant(); case 0:
return tr("Address");
return header_names[section]; case 1:
return tr("Value");
default:
return QVariant();
}
} }
void DebuggerStackModel::invalidateView() void DebuggerStackModel::invalidateView()