diff options
author | Arno <am@disconnect.de> | 2010-06-26 15:24:00 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-06-26 15:24:00 +0200 |
commit | 0b807eba97e65bf9e25f83387826ef2579b79c90 (patch) | |
tree | 9a86166a4ebd77d95e9a26b723c49ebab417e337 /mappingtablewidget.h | |
parent | 6567a92bec5ca8b2bc6b7156bddc5ba8508f31b3 (diff) | |
download | SheMov-0b807eba97e65bf9e25f83387826ef2579b79c90.tar.gz SheMov-0b807eba97e65bf9e25f83387826ef2579b79c90.tar.bz2 SheMov-0b807eba97e65bf9e25f83387826ef2579b79c90.zip |
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.
Diffstat (limited to 'mappingtablewidget.h')
-rw-r--r-- | mappingtablewidget.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/mappingtablewidget.h b/mappingtablewidget.h new file mode 100644 index 0000000..d6df991 --- /dev/null +++ b/mappingtablewidget.h @@ -0,0 +1,59 @@ +/* + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version + 2 of the License, or (at your option) any later version. +*/ + +#ifndef MAPPINGTABLEWIDGET_H +#define MAPPINGTABLEWIDGET_H + +#include <QWidget> +#include <QStringListModel> + +class QTreeView; +class QLineEdit; +class QPushButton; +class MappingTableItemModel; +class MappingTableModel; + +class MappingTableWidget : public QWidget{ + Q_OBJECT + public: + explicit MappingTableWidget(const QString &table, QWidget *parent = 0); + + public slots: + void setStringList(const QStringList &list); + void setEditEnabled(bool enabled); + void setCurrentId(int id) { mCurrentId = id; } + + private slots: + void addItem(); + void removeItem(); + + private: + QTreeView *mView; + QPushButton *mAddItem; + QPushButton *mRemoveItem; + QLineEdit *mItemEdit; + MappingTableItemModel *mModel; + MappingTableModel *mMappingModel; + const QString mTable; + int mCurrentId; +}; + +class MappingTableItemModel : public QStringListModel { + Q_OBJECT + public: + explicit MappingTableItemModel(QObject *parent = 0); + + //data + flags + virtual QVariant data(const QModelIndex &index, int role) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + + //find + int lowerBound(const QString &value) const; + QModelIndex find(const QString &value) const; +}; + +#endif // MAPPINGTABLEWIDGET_H |