1
0
Fork 0
forked from suyu/suyu
suyu/src/yuzu/debugger/graphics/graphics_breakpoints_p.h
Lioncash 030847d5fa graphic_breakpoints: Correct translation of strings in BreakpointModel's data() function
tr() will not function properly on static/global data like this, as the
object is only ever constructed once, so the strings won't translate if
the language is changed without restarting the program, which is
undesirable. Instead we can just turn the map into a plain old function
that maps the values to their equivalent strings. This is also lessens
the memory allocated, since it's only allocating memory for the strings
themselves, and not an encompassing map as well.
2018-10-24 11:01:23 -04:00

37 lines
1.1 KiB
C++

// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <QAbstractListModel>
#include "video_core/debug_utils/debug_utils.h"
class BreakPointModel : public QAbstractListModel {
Q_OBJECT
public:
enum {
Role_IsEnabled = Qt::UserRole,
};
BreakPointModel(std::shared_ptr<Tegra::DebugContext> context, QObject* parent);
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
void OnBreakPointHit(Tegra::DebugContext::Event event);
void OnResumed();
private:
static QString DebugContextEventToString(Tegra::DebugContext::Event event);
std::weak_ptr<Tegra::DebugContext> context_weak;
bool at_breakpoint;
Tegra::DebugContext::Event active_breakpoint;
};