From 0b807eba97e65bf9e25f83387826ef2579b79c90 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 26 Jun 2010 15:24:00 +0200 Subject: Actors and genre edit Implemented widgets for actor and genre editing of movies. Created new MappingTableWidget for both genres and actors and revamped ArchiveTreeView to show 2 widgets below the FilesTreeView separated by a splitter. While testing the new setup several bugs were fixed: -an SQL syntax error in FilesTreeModel -fixed SmModelSingleton to properly work with table names I also changed the signature of MappingTableModel::addMapping for the ease of use and added MappingTableModel::removeMapping. MappingTableModel got 2 new convenience functions: 1. bool contains(QString) to check if an item is already present 2. QModelIndex find() to get the index of a specific value from the model. --- mappingtablemodel.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mappingtablemodel.h') diff --git a/mappingtablemodel.h b/mappingtablemodel.h index f624bff..d600437 100644 --- a/mappingtablemodel.h +++ b/mappingtablemodel.h @@ -29,13 +29,16 @@ class MappingTableModel : public SmTreeModel{ virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual QVariant data(const QModelIndex &index, int role) const; virtual bool setData(const QModelIndex &index, const QVariant &value, int role); + bool contains(const QString &value) const; + QModelIndex find(const QVariant &value, int column = 0, const QModelIndex &parent = QModelIndex()) const; //add and remove items bool addItem(const QVariant &name); bool removeItem(const QModelIndex &idx); //mappings - bool addMapping(int seriesId, const QList &itemIds); + bool addMapping(int seriesId, int itemId); + bool removeMapping(int seriesId, int itemId); QList mappings(int seriesId); signals: @@ -56,6 +59,7 @@ class MappingTableModel : public SmTreeModel{ QSqlQuery *mInsertItemQuery; QSqlQuery *mDeleteItemQuery; QSqlQuery *mAddMappingQuery; + QSqlQuery *mRemoveMappingQuery; QSqlQuery *mMappingQuery; }; -- cgit v1.2.3-70-g09d2