summaryrefslogtreecommitdiffstats
path: root/moviemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'moviemodel.cpp')
-rw-r--r--moviemodel.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/moviemodel.cpp b/moviemodel.cpp
index d92692d..d9b0c22 100644
--- a/moviemodel.cpp
+++ b/moviemodel.cpp
@@ -27,6 +27,8 @@ MovieModel::MovieModel(QObject *parent) : QAbstractItemModel(parent) {
mDeleteCovers->prepare("DELETE FROM covers WHERE imovid = :id");
mInsertCovers = new QSqlQuery;
mInsertCovers->prepare("INSERT INTO covers VALUES(:filename, :movid, :covertype, :md5sum)");
+ mOtherPartsQuery = new QSqlQuery;
+ mOtherPartsQuery->prepare("SELECT imovid FROM movies WHERE ttitle = :title AND iseriesno = :seriesno AND imovid != :id");
QSqlQuery *c1 = new QSqlQuery;
c1->prepare("UPDATE movies SET ttitle = :value WHERE imovid = :id");
mColumnQueries << c1;
@@ -66,6 +68,7 @@ MovieModel::~MovieModel(){
delete mInsertActorsForMovie;
delete mDeleteCovers;
delete mInsertCovers;
+ delete mOtherPartsQuery;
}
QModelIndex MovieModel::index(int row, int column, const QModelIndex &parent) const{
@@ -188,6 +191,17 @@ QVariant MovieModel::data(const QModelIndex &index, int role) const{
}
return retval;
}
+ if(role == OtherPartsRole){
+ QList<QVariant> retval;
+ mOtherPartsQuery->bindValue(":title", item->dataAt(MovieItem::Title));
+ mOtherPartsQuery->bindValue(":seriesno", item->dataAt(MovieItem::SeriesNo));
+ mOtherPartsQuery->bindValue(":id", item->id());
+ mOtherPartsQuery->exec();
+ while(mOtherPartsQuery->next()){
+ retval << mOtherPartsQuery->value(0);
+ }
+ return retval;
+ }
if((role == Qt::DecorationRole) && (index.column() == 0)){
return QIcon(":/dildo.png");
}