Translation: Add translation notation for all translatable strings

This commit is contained in:
Chromaryu 2022-12-24 20:17:52 +09:00 committed by lightningterror
parent 00d06db90e
commit 30504660fa
6 changed files with 91 additions and 91 deletions

View File

@ -115,7 +115,7 @@ void BreakpointDialog::accept()
u64 address; u64 address;
if (!m_cpu->initExpression(m_ui.txtAddress->text().toLocal8Bit(), expression) || !m_cpu->parseExpression(expression, address)) if (!m_cpu->initExpression(m_ui.txtAddress->text().toLocal8Bit(), expression) || !m_cpu->parseExpression(expression, address))
{ {
QMessageBox::warning(this, "Error", "Invalid address \"" + m_ui.txtAddress->text() + "\""); QMessageBox::warning(this, tr("Error"), tr("Invalid address \"%1\"").arg(m_ui.txtAddress->text()));
return; return;
} }
@ -124,7 +124,7 @@ void BreakpointDialog::accept()
{ {
if (!m_cpu->initExpression(m_ui.txtSize->text().toLocal8Bit(), expression) || !m_cpu->parseExpression(expression, size) || !size) if (!m_cpu->initExpression(m_ui.txtSize->text().toLocal8Bit(), expression) || !m_cpu->parseExpression(expression, size) || !size)
{ {
QMessageBox::warning(this, "Error", "Invalid size \"" + m_ui.txtSize->text() + "\""); QMessageBox::warning(this, tr("Error"), tr("Invalid size \"%1\"").arg(m_ui.txtSize->text()));
return; return;
} }
@ -184,7 +184,7 @@ void BreakpointDialog::accept()
expression.clear(); expression.clear();
if (!m_cpu->initExpression(strData.constData(), expression)) if (!m_cpu->initExpression(strData.constData(), expression))
{ {
QMessageBox::warning(this, "Error", "Invalid condition \"" + strData + "\""); QMessageBox::warning(this, tr("Error"), tr("Invalid condition \"%1\"").arg(strData));
return; return;
} }

View File

@ -253,7 +253,7 @@ void CpuWidget::updateBreakpoints()
// Type (R/O) // Type (R/O)
QTableWidgetItem* typeItem = new QTableWidgetItem(); QTableWidgetItem* typeItem = new QTableWidgetItem();
typeItem->setText("Execute"); typeItem->setText(tr("Execute"));
typeItem->setFlags(Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsSelectable); typeItem->setFlags(Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsSelectable);
m_ui.breakpointList->setItem(iter, 0, typeItem); m_ui.breakpointList->setItem(iter, 0, typeItem);
@ -309,9 +309,9 @@ void CpuWidget::updateBreakpoints()
// Type (R/O) // Type (R/O)
QTableWidgetItem* typeItem = new QTableWidgetItem(); QTableWidgetItem* typeItem = new QTableWidgetItem();
QString type(""); QString type("");
type += memcheck.cond & MEMCHECK_READ ? "Read" : ""; type += memcheck.cond & MEMCHECK_READ ? tr("Read") : "";
type += ((memcheck.cond & MEMCHECK_BOTH) == MEMCHECK_BOTH) ? ", " : " "; type += ((memcheck.cond & MEMCHECK_BOTH) == MEMCHECK_BOTH) ? ", " : " ";
type += memcheck.cond & MEMCHECK_WRITE ? memcheck.cond & MEMCHECK_WRITE_ONCHANGE ? "Write(C)" : "Write" : ""; type += memcheck.cond & MEMCHECK_WRITE ? memcheck.cond & MEMCHECK_WRITE_ONCHANGE ? tr("Write(C)") : tr("Write") : "";
typeItem->setText(type); typeItem->setText(type);
typeItem->setFlags(Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsSelectable); typeItem->setFlags(Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsSelectable);
m_ui.breakpointList->setItem(iter, 0, typeItem); m_ui.breakpointList->setItem(iter, 0, typeItem);
@ -378,7 +378,7 @@ void CpuWidget::onBPListContextMenu(QPoint pos)
m_bplistContextMenu = new QMenu(m_ui.breakpointList); m_bplistContextMenu = new QMenu(m_ui.breakpointList);
QAction* newAction = new QAction("New", m_ui.breakpointList); QAction* newAction = new QAction(tr("New"), m_ui.breakpointList);
connect(newAction, &QAction::triggered, this, &CpuWidget::contextBPListNew); connect(newAction, &QAction::triggered, this, &CpuWidget::contextBPListNew);
m_bplistContextMenu->addAction(newAction); m_bplistContextMenu->addAction(newAction);
@ -386,7 +386,7 @@ void CpuWidget::onBPListContextMenu(QPoint pos)
if (selModel->hasSelection()) if (selModel->hasSelection())
{ {
QAction* editAction = new QAction("Edit", m_ui.breakpointList); QAction* editAction = new QAction(tr("Edit"), m_ui.breakpointList);
connect(editAction, &QAction::triggered, this, &CpuWidget::contextBPListEdit); connect(editAction, &QAction::triggered, this, &CpuWidget::contextBPListEdit);
m_bplistContextMenu->addAction(editAction); m_bplistContextMenu->addAction(editAction);
@ -394,12 +394,12 @@ void CpuWidget::onBPListContextMenu(QPoint pos)
// Shouldn't be trivial to support cross column copy // Shouldn't be trivial to support cross column copy
if (selModel->selectedIndexes().count() == 1) if (selModel->selectedIndexes().count() == 1)
{ {
QAction* copyAction = new QAction("Copy", m_ui.breakpointList); QAction* copyAction = new QAction(tr("Copy"), m_ui.breakpointList);
connect(copyAction, &QAction::triggered, this, &CpuWidget::contextBPListCopy); connect(copyAction, &QAction::triggered, this, &CpuWidget::contextBPListCopy);
m_bplistContextMenu->addAction(copyAction); m_bplistContextMenu->addAction(copyAction);
} }
QAction* deleteAction = new QAction("Delete", m_ui.breakpointList); QAction* deleteAction = new QAction(tr("Delete"), m_ui.breakpointList);
connect(deleteAction, &QAction::triggered, this, &CpuWidget::contextBPListDelete); connect(deleteAction, &QAction::triggered, this, &CpuWidget::contextBPListDelete);
m_bplistContextMenu->addAction(deleteAction); m_bplistContextMenu->addAction(deleteAction);
} }
@ -417,7 +417,7 @@ void CpuWidget::onBPListItemChange(QTableWidgetItem* item)
u32 val = item->text().toUInt(&ok, 16); u32 val = item->text().toUInt(&ok, 16);
if (!ok) if (!ok)
{ {
QMessageBox::warning(this, "Error", "Invalid size \"" + item->text() + "\""); QMessageBox::warning(this, tr("Error"), tr("Invalid size \"%1\"").arg(item->text()));
item->setText(QString::number((mc->end - mc->start), 16)); item->setText(QString::number((mc->end - mc->start), 16));
return; return;
} }
@ -451,7 +451,7 @@ void CpuWidget::onBPListItemChange(QTableWidgetItem* item)
if (!m_cpu.initExpression(item->text().toLocal8Bit().constData(), expression)) if (!m_cpu.initExpression(item->text().toLocal8Bit().constData(), expression))
{ {
QMessageBox::warning(this, "Error", "Invalid condition \"" + item->text() + "\""); QMessageBox::warning(this, tr("Error"), tr("Invalid condition \"%1\"").arg(item->text()));
item->setText(QString::fromLocal8Bit(&bp->cond.expressionString[0])); item->setText(QString::fromLocal8Bit(&bp->cond.expressionString[0]));
return; return;
} }
@ -620,25 +620,25 @@ void CpuWidget::updateThreads()
switch (thread.data.status) switch (thread.data.status)
{ {
case THS_BAD: case THS_BAD:
statusString = "Bad"; statusString = tr("Bad");
break; break;
case THS_RUN: case THS_RUN:
statusString = "Running"; statusString = tr("Running");
break; break;
case THS_READY: case THS_READY:
statusString = "Ready"; statusString = tr("Ready");
break; break;
case THS_WAIT: case THS_WAIT:
statusString = "Waiting"; statusString = tr("Waiting");
break; break;
case THS_SUSPEND: case THS_SUSPEND:
statusString = "Suspended"; statusString = tr("Suspended");
break; break;
case THS_WAIT_SUSPEND: case THS_WAIT_SUSPEND:
statusString = "Waiting/Suspended"; statusString = tr("Waiting/Suspended");
break; break;
case THS_DORMANT: case THS_DORMANT:
statusString = "Dormant"; statusString = tr("Dormant");
break; break;
} }
@ -651,13 +651,13 @@ void CpuWidget::updateThreads()
switch (thread.data.waitType) switch (thread.data.waitType)
{ {
case WAIT_NONE: case WAIT_NONE:
waitTypeString = "None"; waitTypeString = tr("None");
break; break;
case WAIT_WAKEUP_REQ: case WAIT_WAKEUP_REQ:
waitTypeString = "Wakeup request"; waitTypeString = tr("Wakeup request");
break; break;
case WAIT_SEMA: case WAIT_SEMA:
waitTypeString = "Semaphore"; waitTypeString = tr("Semaphore");
break; break;
} }
@ -674,7 +674,7 @@ void CpuWidget::onThreadListContextMenu(QPoint pos)
{ {
m_threadlistContextMenu = new QMenu(m_ui.threadList); m_threadlistContextMenu = new QMenu(m_ui.threadList);
QAction* copyAction = new QAction("Copy", m_ui.threadList); QAction* copyAction = new QAction(tr("Copy"), m_ui.threadList);
connect(copyAction, &QAction::triggered, [this] { connect(copyAction, &QAction::triggered, [this] {
const auto& items = m_ui.threadList->selectedItems(); const auto& items = m_ui.threadList->selectedItems();
if (!items.size()) if (!items.size())
@ -710,7 +710,7 @@ void CpuWidget::onFuncListContextMenu(QPoint pos)
else else
m_funclistContextMenu->clear(); m_funclistContextMenu->clear();
QAction* demangleAction = new QAction("Demangle Symbols", m_ui.listFunctions); QAction* demangleAction = new QAction(tr("Demangle Symbols"), m_ui.listFunctions);
demangleAction->setCheckable(true); demangleAction->setCheckable(true);
demangleAction->setChecked(m_demangleFunctions); demangleAction->setChecked(m_demangleFunctions);
@ -721,7 +721,7 @@ void CpuWidget::onFuncListContextMenu(QPoint pos)
m_funclistContextMenu->addAction(demangleAction); m_funclistContextMenu->addAction(demangleAction);
QAction* copyName = new QAction("Copy Function Name", m_ui.listFunctions); QAction* copyName = new QAction(tr("Copy Function Name"), m_ui.listFunctions);
connect(copyName, &QAction::triggered, [this] { connect(copyName, &QAction::triggered, [this] {
// We only store the address in the widget item // We only store the address in the widget item
// Resolve the function name by fetching the symbolmap and filtering the address // Resolve the function name by fetching the symbolmap and filtering the address
@ -732,7 +732,7 @@ void CpuWidget::onFuncListContextMenu(QPoint pos)
}); });
m_funclistContextMenu->addAction(copyName); m_funclistContextMenu->addAction(copyName);
QAction* copyAddress = new QAction("Copy Function Address", m_ui.listFunctions); QAction* copyAddress = new QAction(tr("Copy Function Address"), m_ui.listFunctions);
connect(copyAddress, &QAction::triggered, [this] { connect(copyAddress, &QAction::triggered, [this] {
const QString addressString = FilledQStringFromValue(m_ui.listFunctions->selectedItems().first()->data(256).toUInt(), 16); const QString addressString = FilledQStringFromValue(m_ui.listFunctions->selectedItems().first()->data(256).toUInt(), 16);
QApplication::clipboard()->setText(addressString); QApplication::clipboard()->setText(addressString);
@ -742,14 +742,14 @@ void CpuWidget::onFuncListContextMenu(QPoint pos)
m_funclistContextMenu->addSeparator(); m_funclistContextMenu->addSeparator();
QAction* gotoDisasm = new QAction("Go to in Disassembly", m_ui.listFunctions); QAction* gotoDisasm = new QAction(tr("Go to in Disassembly"), m_ui.listFunctions);
connect(gotoDisasm, &QAction::triggered, [this] { connect(gotoDisasm, &QAction::triggered, [this] {
m_ui.disassemblyWidget->gotoAddress(m_ui.listFunctions->selectedItems().first()->data(256).toUInt()); m_ui.disassemblyWidget->gotoAddress(m_ui.listFunctions->selectedItems().first()->data(256).toUInt());
}); });
m_funclistContextMenu->addAction(gotoDisasm); m_funclistContextMenu->addAction(gotoDisasm);
QAction* gotoMemory = new QAction("Go to in Memory View", m_ui.listFunctions); QAction* gotoMemory = new QAction(tr("Go to in Memory View"), m_ui.listFunctions);
connect(gotoMemory, &QAction::triggered, [this] { connect(gotoMemory, &QAction::triggered, [this] {
m_ui.memoryviewWidget->gotoAddress(m_ui.listFunctions->selectedItems().first()->data(256).toUInt()); m_ui.memoryviewWidget->gotoAddress(m_ui.listFunctions->selectedItems().first()->data(256).toUInt());
}); });
@ -816,7 +816,7 @@ void CpuWidget::onStackListContextMenu(QPoint pos)
{ {
m_stacklistContextMenu = new QMenu(m_ui.stackframeList); m_stacklistContextMenu = new QMenu(m_ui.stackframeList);
QAction* copyAction = new QAction("Copy", m_ui.stackframeList); QAction* copyAction = new QAction(tr("Copy"), m_ui.stackframeList);
connect(copyAction, &QAction::triggered, [this] { connect(copyAction, &QAction::triggered, [this] {
const auto& items = m_ui.stackframeList->selectedItems(); const auto& items = m_ui.stackframeList->selectedItems();
if (!items.size()) if (!items.size())
@ -959,7 +959,7 @@ void CpuWidget::onSearchButtonClicked()
if (!ok) if (!ok)
{ {
QMessageBox::critical(this, "Debugger", "Invalid start address"); QMessageBox::critical(this, tr("Debugger"), tr("Invalid start address"));
return; return;
} }
@ -967,13 +967,13 @@ void CpuWidget::onSearchButtonClicked()
if (!ok) if (!ok)
{ {
QMessageBox::critical(this, "Debugger", "Invalid end address"); QMessageBox::critical(this, tr("Debugger"), tr("Invalid end address"));
return; return;
} }
if (searchStart >= searchEnd) if (searchStart >= searchEnd)
{ {
QMessageBox::critical(this, "Debugger", "Start address can't be equal to or greater than the end address"); QMessageBox::critical(this, tr("Debugger"), tr("Start address can't be equal to or greater than the end address"));
return; return;
} }
@ -990,7 +990,7 @@ void CpuWidget::onSearchButtonClicked()
if (!ok) if (!ok)
{ {
QMessageBox::critical(this, "Debugger", "Invalid search value"); QMessageBox::critical(this, tr("Debugger"), tr("Invalid search value"));
return; return;
} }

View File

@ -36,10 +36,10 @@ DebuggerWindow::DebuggerWindow(QWidget* parent)
this->setStyleSheet("font: 8pt 'Monospace'"); this->setStyleSheet("font: 8pt 'Monospace'");
#endif #endif
m_actionRunPause = new QAction("Run", this); m_actionRunPause = new QAction(tr("Run"), this);
m_actionStepInto = new QAction("Step Into", this); m_actionStepInto = new QAction(tr("Step Into"), this);
m_actionStepOver = new QAction("Step Over", this); m_actionStepOver = new QAction(tr("Step Over"), this);
m_actionStepOut = new QAction("Step Out", this); m_actionStepOut = new QAction(tr("Step Out"), this);
m_ui.menubar->addAction(m_actionRunPause); m_ui.menubar->addAction(m_actionRunPause);
m_ui.menubar->addAction(m_actionStepInto); m_ui.menubar->addAction(m_actionStepInto);
@ -73,7 +73,7 @@ void DebuggerWindow::onVMStateChanged()
if (!QtHost::IsVMPaused()) if (!QtHost::IsVMPaused())
{ {
nextStatePaused = true; nextStatePaused = true;
m_actionRunPause->setText("Pause"); m_actionRunPause->setText(tr("Pause"));
m_actionStepInto->setEnabled(false); m_actionStepInto->setEnabled(false);
m_actionStepOver->setEnabled(false); m_actionStepOver->setEnabled(false);
m_actionStepOut->setEnabled(false); m_actionStepOut->setEnabled(false);
@ -81,7 +81,7 @@ void DebuggerWindow::onVMStateChanged()
else else
{ {
nextStatePaused = false; nextStatePaused = false;
m_actionRunPause->setText("Run"); m_actionRunPause->setText(tr("Run"));
m_actionStepInto->setEnabled(true); m_actionStepInto->setEnabled(true);
m_actionStepOver->setEnabled(true); m_actionStepOver->setEnabled(true);
m_actionStepOut->setEnabled(true); m_actionStepOut->setEnabled(true);

View File

@ -50,36 +50,36 @@ void DisassemblyWidget::CreateCustomContextMenu()
m_contextMenu = new QMenu(this); m_contextMenu = new QMenu(this);
QAction* action = 0; QAction* action = 0;
m_contextMenu->addAction(action = new QAction("Copy Address", this)); m_contextMenu->addAction(action = new QAction(tr("Copy Address"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextCopyAddress); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextCopyAddress);
m_contextMenu->addAction(action = new QAction("Copy Instruction Hex", this)); m_contextMenu->addAction(action = new QAction(tr("Copy Instruction Hex"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextCopyInstructionHex); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextCopyInstructionHex);
m_contextMenu->addAction(action = new QAction("Copy Instruction Text", this)); m_contextMenu->addAction(action = new QAction(tr("Copy Instruction Text"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextCopyInstructionText); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextCopyInstructionText);
// TODO: Disassemble to file. Do people use that? // TODO: Disassemble to file. Do people use that?
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_contextMenu->addAction(action = new QAction("Assemble new Instruction(s)", this)); m_contextMenu->addAction(action = new QAction(tr("Assemble new Instruction(s)"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextAssembleInstruction); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextAssembleInstruction);
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_contextMenu->addAction(action = new QAction("Run to Cursor", this)); m_contextMenu->addAction(action = new QAction(tr("Run to Cursor"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRunToCursor); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRunToCursor);
m_contextMenu->addAction(action = new QAction("Jump to Cursor", this)); m_contextMenu->addAction(action = new QAction(tr("Jump to Cursor"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextJumpToCursor); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextJumpToCursor);
m_contextMenu->addAction(action = new QAction("Toggle Breakpoint", this)); m_contextMenu->addAction(action = new QAction(tr("Toggle Breakpoint"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextToggleBreakpoint); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextToggleBreakpoint);
m_contextMenu->addAction(action = new QAction("Follow Branch", this)); m_contextMenu->addAction(action = new QAction(tr("Follow Branch"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextFollowBranch); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextFollowBranch);
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_contextMenu->addAction(action = new QAction("Go to Address", this)); m_contextMenu->addAction(action = new QAction(tr("Go to Address"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextGoToAddress); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextGoToAddress);
m_contextMenu->addAction(action = new QAction("Go to in Memory View", this)); m_contextMenu->addAction(action = new QAction(tr("Go to in Memory View"), this));
connect(action, &QAction::triggered, this, [this]() { gotoInMemory(m_selectedAddressStart); }); connect(action, &QAction::triggered, this, [this]() { gotoInMemory(m_selectedAddressStart); });
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_contextMenu->addAction(action = new QAction("Add Function", this)); m_contextMenu->addAction(action = new QAction(tr("Add Function"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextAddFunction); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextAddFunction);
m_contextMenu->addAction(action = new QAction("Rename Function", this)); m_contextMenu->addAction(action = new QAction(tr("Rename Function"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRenameFunction); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRenameFunction);
m_contextMenu->addAction(action = new QAction("Remove Function", this)); m_contextMenu->addAction(action = new QAction(tr("Remove Function"), this));
connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRemoveFunction); connect(action, &QAction::triggered, this, &DisassemblyWidget::contextRemoveFunction);
} }
@ -102,14 +102,14 @@ void DisassemblyWidget::contextAssembleInstruction()
{ {
if (!m_cpu->isCpuPaused()) if (!m_cpu->isCpuPaused())
{ {
QMessageBox::warning(this, "Assemble Error", "Unable to change assembly while core is running"); QMessageBox::warning(this, tr("Assemble Error"), tr("Unable to change assembly while core is running"));
return; return;
} }
DisassemblyLineInfo line; DisassemblyLineInfo line;
bool ok; bool ok;
m_disassemblyManager.getLine(m_selectedAddressStart, false, line); m_disassemblyManager.getLine(m_selectedAddressStart, false, line);
QString instruction = QInputDialog::getText(this, "Assemble Instruction", "", QString instruction = QInputDialog::getText(this, tr("Assemble Instruction"), "",
QLineEdit::Normal, QString("%1 %2").arg(line.name.c_str()).arg(line.params.c_str()), &ok); QLineEdit::Normal, QString("%1 %2").arg(line.name.c_str()).arg(line.params.c_str()), &ok);
if (!ok) if (!ok)
@ -121,7 +121,7 @@ void DisassemblyWidget::contextAssembleInstruction()
if (!valid) if (!valid)
{ {
QMessageBox::warning(this, "Assemble Error", QString::fromStdString(errorText)); QMessageBox::warning(this, tr("Assemble Error"), QString::fromStdString(errorText));
return; return;
} }
else else
@ -182,7 +182,7 @@ void DisassemblyWidget::contextFollowBranch()
void DisassemblyWidget::contextGoToAddress() void DisassemblyWidget::contextGoToAddress()
{ {
bool ok; bool ok;
const QString targetString = QInputDialog::getText(this, "Go to address", "", const QString targetString = QInputDialog::getText(this, tr("Go to address"), "",
QLineEdit::Normal, "", &ok); QLineEdit::Normal, "", &ok);
if (!ok) if (!ok)
@ -192,7 +192,7 @@ void DisassemblyWidget::contextGoToAddress()
if (!ok) if (!ok)
{ {
QMessageBox::warning(this, "Go to address error", "Invalid address"); QMessageBox::warning(this, tr("Go to address error"), tr("Invalid address"));
return; return;
} }
@ -210,7 +210,7 @@ void DisassemblyWidget::contextAddFunction()
{ {
if (curFuncAddr == curAddress) // There is already a function here if (curFuncAddr == curAddress) // There is already a function here
{ {
QMessageBox::warning(this, "Add Function Error", "A function entry point already exists here. Consider renaming instead."); QMessageBox::warning(this, tr("Add Function Error"), tr("A function entry point already exists here. Consider renaming instead."));
} }
else else
{ {
@ -218,8 +218,8 @@ void DisassemblyWidget::contextAddFunction()
u32 newSize = curAddress - curFuncAddr; u32 newSize = curAddress - curFuncAddr;
bool ok; bool ok;
QString funcName = QInputDialog::getText(this, "Add Function", QString funcName = QInputDialog::getText(this, tr("Add Function"),
QString("Function will be (0x%1) instructions long.\nEnter function name").arg(prevSize - newSize, 0, 16), QLineEdit::Normal, "", &ok); tr("Function will be (0x%1) instructions long.\nEnter function name").arg(prevSize - newSize, 0, 16), QLineEdit::Normal, "", &ok);
if (!ok) if (!ok)
return; return;
@ -234,7 +234,7 @@ void DisassemblyWidget::contextAddFunction()
{ {
bool ok; bool ok;
QString funcName = QInputDialog::getText(this, "Add Function", QString funcName = QInputDialog::getText(this, "Add Function",
QString("Function will be (0x%1) instructions long.\nEnter function name").arg(m_selectedAddressEnd + 4 - m_selectedAddressStart, 0, 16), QLineEdit::Normal, "", &ok); tr("Function will be (0x%1) instructions long.\nEnter function name").arg(m_selectedAddressEnd + 4 - m_selectedAddressStart, 0, 16), QLineEdit::Normal, "", &ok);
if (!ok) if (!ok)
return; return;
@ -270,13 +270,13 @@ void DisassemblyWidget::contextRenameFunction()
if (curFuncAddress != SymbolMap::INVALID_ADDRESS) if (curFuncAddress != SymbolMap::INVALID_ADDRESS)
{ {
bool ok; bool ok;
QString funcName = QInputDialog::getText(this, "Rename Function", "Function name", QLineEdit::Normal, m_cpu->GetSymbolMap().GetLabelString(curFuncAddress).c_str(), &ok); QString funcName = QInputDialog::getText(this, tr("Rename Function"), tr("Function name"), QLineEdit::Normal, m_cpu->GetSymbolMap().GetLabelString(curFuncAddress).c_str(), &ok);
if (!ok) if (!ok)
return; return;
if (funcName.isEmpty()) if (funcName.isEmpty())
{ {
QMessageBox::warning(this, "Rename Function Error", "Function name cannot be nothing."); QMessageBox::warning(this, tr("Rename Function Error"), tr("Function name cannot be nothing."));
} }
else else
{ {
@ -288,7 +288,7 @@ void DisassemblyWidget::contextRenameFunction()
} }
else else
{ {
QMessageBox::warning(this, "Rename Function Error", "No function / symbol is currently selected."); QMessageBox::warning(this, tr("Rename Function Error"), tr("No function / symbol is currently selected."));
} }
} }
@ -592,7 +592,7 @@ inline QString DisassemblyWidget::DisassemblyStringFromAddress(u32 address, QFon
DisassemblyLineInfo line; DisassemblyLineInfo line;
if (!m_cpu->isValidAddress(address)) if (!m_cpu->isValidAddress(address))
return QString("%1 NOT VALID ADDRESS").arg(address, 8, 16, QChar('0')).toUpper(); return tr("%1 NOT VALID ADDRESS").arg(address, 8, 16, QChar('0')).toUpper();
// Todo? support non symbol view? // Todo? support non symbol view?
m_disassemblyManager.getLine(address, true, line); m_disassemblyManager.getLine(address, true, line);

View File

@ -354,48 +354,48 @@ void MemoryViewWidget::customMenuRequested(QPoint pos)
{ {
m_contextMenu = new QMenu(this); m_contextMenu = new QMenu(this);
QAction* action = new QAction("Go to in disassembly"); QAction* action = new QAction(tr("Go to in disassembly"));
m_contextMenu->addAction(action); m_contextMenu->addAction(action);
connect(action, &QAction::triggered, this, [this]() { emit gotoInDisasm(m_table.selectedAddress); }); connect(action, &QAction::triggered, this, [this]() { emit gotoInDisasm(m_table.selectedAddress); });
action = new QAction("Go to address"); action = new QAction(tr("Go to address"));
m_contextMenu->addAction(action); m_contextMenu->addAction(action);
connect(action, &QAction::triggered, this, [this]() { contextGoToAddress(); }); connect(action, &QAction::triggered, this, [this]() { contextGoToAddress(); });
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
// View Types // View Types
m_actionBYTE = new QAction("Show as 1 byte"); m_actionBYTE = new QAction(tr("Show as 1 byte"));
m_actionBYTE->setCheckable(true); m_actionBYTE->setCheckable(true);
m_contextMenu->addAction(m_actionBYTE); m_contextMenu->addAction(m_actionBYTE);
connect(m_actionBYTE, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::BYTE); }); connect(m_actionBYTE, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::BYTE); });
m_actionBYTEHW = new QAction("Show as 2 bytes"); m_actionBYTEHW = new QAction(tr("Show as 2 bytes"));
m_actionBYTEHW->setCheckable(true); m_actionBYTEHW->setCheckable(true);
m_contextMenu->addAction(m_actionBYTEHW); m_contextMenu->addAction(m_actionBYTEHW);
connect(m_actionBYTEHW, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::BYTEHW); }); connect(m_actionBYTEHW, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::BYTEHW); });
m_actionWORD = new QAction("Show as 4 bytes"); m_actionWORD = new QAction(tr("Show as 4 bytes"));
m_actionWORD->setCheckable(true); m_actionWORD->setCheckable(true);
m_contextMenu->addAction(m_actionWORD); m_contextMenu->addAction(m_actionWORD);
connect(m_actionWORD, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::WORD); }); connect(m_actionWORD, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::WORD); });
m_actionDWORD = new QAction("Show as 8 bytes"); m_actionDWORD = new QAction(tr("Show as 8 bytes"));
m_actionDWORD->setCheckable(true); m_actionDWORD->setCheckable(true);
m_contextMenu->addAction(m_actionDWORD); m_contextMenu->addAction(m_actionDWORD);
connect(m_actionDWORD, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::DWORD); }); connect(m_actionDWORD, &QAction::triggered, this, [this]() { m_table.SetViewType(MemoryViewType::DWORD); });
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
action = new QAction("Copy Byte"); action = new QAction(tr("Copy Byte"));
m_contextMenu->addAction(action); m_contextMenu->addAction(action);
connect(action, &QAction::triggered, this, [this]() { contextCopyByte(); }); connect(action, &QAction::triggered, this, [this]() { contextCopyByte(); });
action = new QAction("Copy Segment"); action = new QAction(tr("Copy Segment"));
m_contextMenu->addAction(action); m_contextMenu->addAction(action);
connect(action, &QAction::triggered, this, [this]() { contextCopySegment(); }); connect(action, &QAction::triggered, this, [this]() { contextCopySegment(); });
action = new QAction("Copy Character"); action = new QAction(tr("Copy Character"));
m_contextMenu->addAction(action); m_contextMenu->addAction(action);
connect(action, &QAction::triggered, this, [this]() { contextCopyCharacter(); }); connect(action, &QAction::triggered, this, [this]() { contextCopyCharacter(); });
} }
@ -429,7 +429,7 @@ void MemoryViewWidget::contextCopyCharacter()
void MemoryViewWidget::contextGoToAddress() void MemoryViewWidget::contextGoToAddress()
{ {
bool ok; bool ok;
QString targetString = QInputDialog::getText(this, "Go to address", "", QString targetString = QInputDialog::getText(this, tr("Go to address"), "",
QLineEdit::Normal, "", &ok); QLineEdit::Normal, "", &ok);
if (!ok) if (!ok)

View File

@ -235,30 +235,30 @@ void RegisterWidget::customMenuRequested(QPoint pos)
if (categoryIndex == EECAT_FPR) if (categoryIndex == EECAT_FPR)
{ {
m_contextMenu->addAction(action = new QAction(m_showFPRFloat ? "View as hex" : "View as float")); m_contextMenu->addAction(action = new QAction(m_showFPRFloat ? tr("View as hex") : tr("View as float")));
connect(action, &QAction::triggered, this, [this]() { m_showFPRFloat = !m_showFPRFloat; }); connect(action, &QAction::triggered, this, [this]() { m_showFPRFloat = !m_showFPRFloat; });
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
} }
if (categoryIndex == EECAT_VU0F) if (categoryIndex == EECAT_VU0F)
{ {
m_contextMenu->addAction(action = new QAction(m_showVU0FFloat ? "View as hex" : "View as float")); m_contextMenu->addAction(action = new QAction(m_showVU0FFloat ? tr("View as hex") : tr("View as float")));
connect(action, &QAction::triggered, this, [this]() { m_showVU0FFloat = !m_showVU0FFloat; }); connect(action, &QAction::triggered, this, [this]() { m_showVU0FFloat = !m_showVU0FFloat; });
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
} }
if (m_cpu->getRegisterSize(categoryIndex) == 128) if (m_cpu->getRegisterSize(categoryIndex) == 128)
{ {
m_contextMenu->addAction(action = new QAction("Copy Top Half", this)); m_contextMenu->addAction(action = new QAction(tr("Copy Top Half"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextCopyTop); connect(action, &QAction::triggered, this, &RegisterWidget::contextCopyTop);
m_contextMenu->addAction(action = new QAction("Copy Bottom Half", this)); m_contextMenu->addAction(action = new QAction(tr("Copy Bottom Half"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextCopyBottom); connect(action, &QAction::triggered, this, &RegisterWidget::contextCopyBottom);
m_contextMenu->addAction(action = new QAction("Copy Segment", this)); m_contextMenu->addAction(action = new QAction(tr("Copy Segment"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextCopySegment); connect(action, &QAction::triggered, this, &RegisterWidget::contextCopySegment);
} }
else else
{ {
m_contextMenu->addAction(action = new QAction("Copy Value", this)); m_contextMenu->addAction(action = new QAction(tr("Copy Value"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextCopyValue); connect(action, &QAction::triggered, this, &RegisterWidget::contextCopyValue);
} }
@ -266,25 +266,25 @@ void RegisterWidget::customMenuRequested(QPoint pos)
if (m_cpu->getRegisterSize(categoryIndex) == 128) if (m_cpu->getRegisterSize(categoryIndex) == 128)
{ {
m_contextMenu->addAction(action = new QAction("Change Top Half", this)); m_contextMenu->addAction(action = new QAction(tr("Change Top Half"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextChangeTop); connect(action, &QAction::triggered, this, &RegisterWidget::contextChangeTop);
m_contextMenu->addAction(action = new QAction("Change Bottom Half", this)); m_contextMenu->addAction(action = new QAction(tr("Change Bottom Half"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextChangeBottom); connect(action, &QAction::triggered, this, &RegisterWidget::contextChangeBottom);
m_contextMenu->addAction(action = new QAction("Change Segment", this)); m_contextMenu->addAction(action = new QAction(tr("Change Segment"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextChangeSegment); connect(action, &QAction::triggered, this, &RegisterWidget::contextChangeSegment);
} }
else else
{ {
m_contextMenu->addAction(action = new QAction("Change Value", this)); m_contextMenu->addAction(action = new QAction(tr("Change Value"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextChangeValue); connect(action, &QAction::triggered, this, &RegisterWidget::contextChangeValue);
} }
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_contextMenu->addAction(action = new QAction("Go to in Disassembly", this)); m_contextMenu->addAction(action = new QAction(tr("Go to in Disassembly"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextGotoDisasm); connect(action, &QAction::triggered, this, &RegisterWidget::contextGotoDisasm);
m_contextMenu->addAction(action = new QAction("Go to in Memory", this)); m_contextMenu->addAction(action = new QAction(tr("Go to in Memory"), this));
connect(action, &QAction::triggered, this, &RegisterWidget::contextGotoMemory); connect(action, &QAction::triggered, this, &RegisterWidget::contextGotoMemory);
m_contextMenu->popup(this->mapToGlobal(pos)); m_contextMenu->popup(this->mapToGlobal(pos));
@ -339,7 +339,7 @@ bool RegisterWidget::contextFetchNewValue(u64& out, u64 currentValue, bool segme
else else
existingValue = existingValue.arg(bit_cast<float>((u32)currentValue)); existingValue = existingValue.arg(bit_cast<float>((u32)currentValue));
QString input = QInputDialog::getText(this, QString("Change %1").arg(m_cpu->getRegisterName(categoryIndex, m_selectedRow)), "", QString input = QInputDialog::getText(this, tr("Change %1").arg(m_cpu->getRegisterName(categoryIndex, m_selectedRow)), "",
QLineEdit::Normal, existingValue, &ok); QLineEdit::Normal, existingValue, &ok);
if (!ok) if (!ok)
@ -350,7 +350,7 @@ bool RegisterWidget::contextFetchNewValue(u64& out, u64 currentValue, bool segme
out = input.toULongLong(&ok, 16); out = input.toULongLong(&ok, 16);
if (!ok) if (!ok)
{ {
QMessageBox::warning(this, "Invalid register value", "Invalid hexadecimal register value."); QMessageBox::warning(this, tr("Invalid register value"), tr("Invalid hexadecimal register value."));
return false; return false;
} }
} }
@ -359,7 +359,7 @@ bool RegisterWidget::contextFetchNewValue(u64& out, u64 currentValue, bool segme
out = bit_cast<u32>(input.toFloat(&ok)); out = bit_cast<u32>(input.toFloat(&ok));
if (!ok) if (!ok)
{ {
QMessageBox::warning(this, "Invalid register value", "Invalid floating-point register value."); QMessageBox::warning(this, tr("Invalid register value"), tr("Invalid floating-point register value."));
return false; return false;
} }
} }
@ -428,7 +428,7 @@ void RegisterWidget::contextGotoDisasm()
if (m_cpu->isValidAddress(addr)) if (m_cpu->isValidAddress(addr))
gotoInDisasm(addr); gotoInDisasm(addr);
else else
QMessageBox::warning(this, "Invalid target address", "This register holds an invalid address."); QMessageBox::warning(this, tr("Invalid target address"), ("This register holds an invalid address."));
} }
void RegisterWidget::contextGotoMemory() void RegisterWidget::contextGotoMemory()