Merge pull request #4376 from FearlessTobi/port-1571

Port yuzu-emu/yuzu#1571: "graphic_breakpoints: Correct translation of strings in BreakpointModel's data() function"
This commit is contained in:
Weiyi Wang 2018-10-26 22:40:55 -04:00 committed by GitHub
commit fa46dbdf0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 16 deletions

View File

@ -30,23 +30,8 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const {
switch (role) {
case Qt::DisplayRole: {
if (index.column() == 0) {
static const std::map<Pica::DebugContext::Event, QString> map = {
{Pica::DebugContext::Event::PicaCommandLoaded, tr("Pica command loaded")},
{Pica::DebugContext::Event::PicaCommandProcessed, tr("Pica command processed")},
{Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")},
{Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")},
{Pica::DebugContext::Event::VertexShaderInvocation, tr("Vertex shader invocation")},
{Pica::DebugContext::Event::IncomingDisplayTransfer,
tr("Incoming display transfer")},
{Pica::DebugContext::Event::GSPCommandProcessed, tr("GSP command processed")},
{Pica::DebugContext::Event::BufferSwapped, tr("Buffers swapped")},
};
DEBUG_ASSERT(map.size() ==
static_cast<std::size_t>(Pica::DebugContext::Event::NumEvents));
return (map.find(event) != map.end()) ? map.at(event) : QString();
return DebugContextEventToString(event);
}
break;
}
@ -128,6 +113,30 @@ void BreakPointModel::OnResumed() {
active_breakpoint = context->active_breakpoint;
}
QString BreakPointModel::DebugContextEventToString(Pica::DebugContext::Event event) {
switch (event) {
case Pica::DebugContext::Event::PicaCommandLoaded:
return tr("Pica command loaded");
case Pica::DebugContext::Event::PicaCommandProcessed:
return tr("Pica command processed");
case Pica::DebugContext::Event::IncomingPrimitiveBatch:
return tr("Incoming primitive batch");
case Pica::DebugContext::Event::FinishedPrimitiveBatch:
return tr("Finished primitive batch");
case Pica::DebugContext::Event::VertexShaderInvocation:
return tr("Vertex shader invocation");
case Pica::DebugContext::Event::IncomingDisplayTransfer:
return tr("Incoming display transfer");
case Pica::DebugContext::Event::GSPCommandProcessed:
return tr("GSP command processed");
case Pica::DebugContext::Event::BufferSwapped:
return tr("Buffers swapped");
case Pica::DebugContext::Event::NumEvents:
break;
}
return tr("Unknown debug context event");
}
GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent)
: QDockWidget(tr("Pica Breakpoints"), parent), Pica::DebugContext::BreakPointObserver(

View File

@ -29,6 +29,8 @@ public:
void OnResumed();
private:
static QString DebugContextEventToString(Pica::DebugContext::Event event);
std::weak_ptr<Pica::DebugContext> context_weak;
bool at_breakpoint;
Pica::DebugContext::Event active_breakpoint;