+#include "qui/SequenceLocationModel.hpp"
+
+SequenceLocationModel::SequenceLocationModel(QObject *parent)
+ : QAbstractTableModel(parent)
+{
+ Sequence s("AGCT");
+ sequence_locations.push_back(SequenceLocation(s, 0, 1));
+ sequence_locations.push_back(SequenceLocation(s, 2, 2));
+}
+
+int
+SequenceLocationModel::rowCount( const QModelIndex& parent) const
+{
+ return sequence_locations.size();
+}
+
+int
+SequenceLocationModel::columnCount(const QModelIndex& parent) const
+{
+ return 3;
+}
+
+QVariant
+SequenceLocationModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ if (index.row() >= sequence_locations.size())
+ return QVariant();
+
+ if (index.column() >= 3)
+ return QVariant();
+
+ if (role == Qt::DisplayRole) {
+ if (index.column() == 0 ) {
+ const Sequence& seq = sequence_locations[index.row()].getSequence();
+ std::string header(seq.get_header());
+ if (header.size() == 0) {
+ return QVariant(QString(tr("Sequence ")) +
+ QString().setNum(index.row())
+ );
+ } else {
+ return QVariant(QString(header.c_str()));
+ }
+ } else if (index.column() == 1) {
+ return QVariant(sequence_locations[index.row()].getLeft());
+ } else if (index.column() == 2) {
+ return QVariant(sequence_locations[index.row()].getRight());
+ }
+ }
+ return QVariant();
+}
+
+QVariant
+SequenceLocationModel::headerData(
+ int section,
+ Qt::Orientation orentation,
+ int role
+)
+{
+ switch(section) {
+ case 0:
+ return QString("Sequence");
+ break;
+ case 1:
+ return QString("Left");
+ break;
+ case 2:
+ return QString("Right");
+ break;
+ default:
+ return QVariant();
+ break;
+ }
+}
+
+