mirror of
https://github.com/decaf-emu/decaf-emu.git
synced 2025-04-02 10:42:13 -04:00
Basic skeleton app now, let's see if we can iterate on this until we have something useful?
30 lines
775 B
C++
30 lines
775 B
C++
#include "replaycommandsmodel.h"
|
|
|
|
ReplayCommandModel::ReplayCommandModel(std::shared_ptr<ReplayFile> replay, QObject *parent) :
|
|
QAbstractTableModel(parent),
|
|
mReplay(replay)
|
|
{
|
|
}
|
|
|
|
int ReplayCommandModel::rowCount(const QModelIndex &parent) const
|
|
{
|
|
return static_cast<int>(mReplay->index.commands.size());
|
|
}
|
|
|
|
int ReplayCommandModel::columnCount(const QModelIndex &parent) const
|
|
{
|
|
return 2;
|
|
}
|
|
|
|
QVariant ReplayCommandModel::data(const QModelIndex &index, int role) const
|
|
{
|
|
if (role == Qt::DisplayRole) {
|
|
if (index.column() == 0) {
|
|
return QString { "%1" }.arg(index.row() + 1);
|
|
} else if (index.column() == 1) {
|
|
return QString::fromStdString(getCommandName(mReplay->index.commands[index.row()]));
|
|
}
|
|
}
|
|
|
|
return QVariant {};
|
|
}
|