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()
{
static constexpr std::array<SettingInfo, 1> settings = {{
{SettingInfo::Type::Boolean, "RelativeMouseMode", TRANSLATABLE("PlaystationMouse", "Relative Mouse Mode"),
TRANSLATABLE("PlaystationMouse", "Locks the mouse cursor to the window, use for FPS games.")},
{SettingInfo::Type::Boolean, "RelativeMouseMode", TRANSLATABLE("PlayStationMouse", "Relative Mouse Mode"),
TRANSLATABLE("PlayStationMouse", "Locks the mouse cursor to the window, use for FPS games.")},
}};
return SettingList(settings.begin(), settings.end());

View File

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