diff options
Diffstat (limited to 'seriestreemodel.cpp')
-rw-r--r-- | seriestreemodel.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/seriestreemodel.cpp b/seriestreemodel.cpp index ca8e10d..a0dfebf 100644 --- a/seriestreemodel.cpp +++ b/seriestreemodel.cpp @@ -17,7 +17,7 @@ #include "smtreeitem.h" #include "helper.h" -SeriesTreeModel::SeriesTreeModel(QStringList &headers, QObject *parent) : SmTreeModel(headers, parent){ +SeriesTreeModel::SeriesTreeModel(QStringList &headers, QObject *parent) : SmTreeModel(headers, parent), mRowFilter(All) { mDb = QSqlDatabase::database("treedb"); mSeriesPartsQuery = new QSqlQuery(mDb); mSeriesPartsQuery->prepare("SELECT iseriesparts_id, iseriespart, bfavorite, tsubtitle FROM seriesparts WHERE iseries_id = :id ORDER BY iseriespart"); @@ -152,6 +152,9 @@ QVariant SeriesTreeModel::data(const QModelIndex &index, int role) const{ if(role == SubtitleRole){ return item->data(Subtitle); } + if(role == IsLocalRole){ + return item->data(IsLocal); + } return QVariant(); } @@ -409,7 +412,7 @@ void SeriesTreeModel::setMappingFilter(const QString &filter, const QString &tab QSqlQuery seriesIdQuery(seriesIdTemplate, mDb); while(seriesIdQuery.next()){ QList<QVariant> seriesData; - seriesData << seriesIdQuery.value(1) << seriesIdQuery.value(0) << QVariant() << QVariant() << Series << false << QVariant(); + seriesData << seriesIdQuery.value(1) << seriesIdQuery.value(0) << QVariant() << QVariant() << Series << false << QVariant() << QVariant(); SmTreeItem *seriesItem = new SmTreeItem(seriesData, rootItem); rootItem->appendChild(seriesItem); QString partsQueryString = seriesPartsTemplate.arg(table).arg(ids.join(",")); @@ -553,7 +556,7 @@ void SeriesTreeModel::populate(){ while(mSeriesPartsQuery->next()){ QList<QVariant> partData; partData << seriesData.at(Name) << seriesData.at(SeriesId) << mSeriesPartsQuery->value(0) << mSeriesPartsQuery->value(1) << Part << mSeriesPartsQuery->value(2) << mSeriesPartsQuery->value(3); - partData << hasLocals(seriesData.at(1).toInt()); + partData << hasLocals(mSeriesPartsQuery->value(0).toInt()); SmTreeItem *partItem = new SmTreeItem(partData, seriesItem); seriesItem->appendChild(partItem); mSeriesPartSeriesMap.insert(mSeriesPartsQuery->value(0).toInt(), seriesData.at(1).toInt()); |