diff options
author | bd <bdunahu@operationnull.com> | 2025-04-27 17:34:16 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-27 17:34:16 -0400 |
commit | 4f77c3161128ff965b26f9575853c5347c0d662d (patch) | |
tree | 7120db1a5d945d7309564bb3918a21a16928733b /gui/registerview.cc | |
parent | 3233a150e2024e9be51623f606bf15527a76cf1e (diff) |
Basic register display
Diffstat (limited to 'gui/registerview.cc')
-rw-r--r-- | gui/registerview.cc | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/gui/registerview.cc b/gui/registerview.cc index 5320afa..b1a1333 100644 --- a/gui/registerview.cc +++ b/gui/registerview.cc @@ -15,8 +15,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. +#include "pipe_spec.h" #include "registerview.h" -#include "definitions.h" #include "util.h" #include <QAbstractTableModel> #include <QVector> @@ -29,12 +29,22 @@ QVariant RegisterView::data(const QModelIndex &i, int role) const a = Qt::AlignRight | Qt::AlignVCenter; return QVariant(static_cast<int>(a)); } + if (!i.isValid() || role != Qt::DisplayRole) return QVariant(); - return this->d[i.row()][i.column()]; + + if (i.row() < 16) { + if (i.column() < 1) + return this->gprs[i.row()]; + else + return QVariant(); + } + + return this->vrs[i.row() - GPR_NUM][i.column() - GPR_NUM]; } -QVariant RegisterView::headerData(int section, Qt::Orientation o, int role) const +QVariant +RegisterView::headerData(int section, Qt::Orientation o, int role) const { Qt::Alignment a; @@ -47,7 +57,13 @@ QVariant RegisterView::headerData(int section, Qt::Orientation o, int role) cons return QVariant(); if (o == Qt::Vertical) { - return format_toggled_value(section * 4, this->is_hex); + return format_toggled_value(section, this->is_hex); } return QVariant(); } + +void RegisterView::set_data(const QVector<int> &gprs, const QVector<QVector<int>> &vrs) +{ + this->gprs = gprs; + this->vrs = vrs; +} |