#include "splashmodel.h"

SplashModel::SplashModel(QList<tbSplash> msplashes, QObject *parent) :
    QAbstractListModel(parent)
{
    splashes = msplashes;
}


void SplashModel::refresh(QList<tbSplash> msplashes)
{
    splashes = msplashes;
}


int SplashModel::rowCount(const QModelIndex &) const
{
        return splashes.count();
}


QVariant SplashModel::data(const QModelIndex &index, int role) const
{
        if (!index.isValid())
                return QVariant();

        if (index.row() >= splashes.size())
                return QVariant();

        if (role == Qt::DisplayRole)
        {
                return splashes.at(index.row()).name;
        }
        return QVariant();
}
