summaryrefslogtreecommitdiffstats
path: root/moviemodel.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-05-30 10:29:47 +0200
committerArno <am@disconnect.de>2010-05-30 10:29:47 +0200
commit9a1ec955d9ce339e6b89714488bb866ae43bb397 (patch)
treee9df2c0c37821a1e4d9c670afcae2cfb298bdf1e /moviemodel.cpp
parent51631c5726cc770e2802bb746954819f2a892310 (diff)
downloadSheMov-9a1ec955d9ce339e6b89714488bb866ae43bb397.tar.gz
SheMov-9a1ec955d9ce339e6b89714488bb866ae43bb397.tar.bz2
SheMov-9a1ec955d9ce339e6b89714488bb866ae43bb397.zip
Implemented copying of movie data
Added function to copy actors, covers, genre, dvd and quality to other parts of the same movie if movie has multiple files.
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");
}