diff options
| author | Arno <am@disconnect.de> | 2010-06-24 21:26:44 +0200 | 
|---|---|---|
| committer | Arno <am@disconnect.de> | 2010-06-24 21:26:44 +0200 | 
| commit | 7ad391f932c9ec33cccf49eff8996ccaf2d303d5 (patch) | |
| tree | 0d6afdf4c4d69505a122c842424f9f9def7a7a8c /seriestreemodel.cpp | |
| parent | 32243b83a02e479e772d7d6fd94ddc35fd7d6880 (diff) | |
| download | SheMov-7ad391f932c9ec33cccf49eff8996ccaf2d303d5.tar.gz SheMov-7ad391f932c9ec33cccf49eff8996ccaf2d303d5.tar.bz2 SheMov-7ad391f932c9ec33cccf49eff8996ccaf2d303d5.zip | |
Made FilesTreeWidget work
It wasn't as easy as I thought. Quite big changes:
1. I changed the query for setIds in FilesTreeModel. Initially it
executed a database query for every id. Changed it to WHERE
seriespart_id IN (ids). I didn't have a chance to test the first
version, but this one is blazing fast.
2. Fixed a recursio ad infinitum in FilesTreeModel. This happens if you
call data() from data(). Either use the *item or use a role different
from what you've been called.
3. Introduce a new function in SeriesTreeModel: QList<QVariant>
childrenColumnList. It returns a QList from the children values of the
given column.
4. Lot's of UI changes. Hide unneded columns, align the remaining ones
properly.
What doesn't work:
we can't let the database do the sorting of files. We need a proxy for
this.
Diffstat (limited to 'seriestreemodel.cpp')
| -rw-r--r-- | seriestreemodel.cpp | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/seriestreemodel.cpp b/seriestreemodel.cpp index 122c163..2cda1d0 100644 --- a/seriestreemodel.cpp +++ b/seriestreemodel.cpp @@ -141,6 +141,19 @@ bool SeriesTreeModel::setData(const QModelIndex &index, const QVariant &value, i  	return false;  } +QList<QVariant> SeriesTreeModel::childrenColumnList(const QModelIndex &parent, int column) const{ +	if(!parent.isValid()){ +		return QList<QVariant>(); +	} +	SmTreeItem *item = static_cast<SmTreeItem*>(parent.internalPointer()); +	QList<QVariant> retval; +	for(int i = 0; i < item->childCount(); ++i){ +		SmTreeItem *child = item->child(i); +		retval << child->data(column); +	} +	return retval; +} +  QModelIndex SeriesTreeModel::findValue(const QVariant &value, const QModelIndex &parent, int column) const{  	SmTreeItem *parentItem = root();  	if(parent != QModelIndex()){ @@ -199,6 +212,7 @@ QFileInfoList SeriesTreeModel::findMovies(const QModelIndexList &from) const{  	return retval;  } +  bool SeriesTreeModel::deleteFromSeries(const QModelIndex &what){  	int nodeType = what.data(TypeRole).toInt();  	QSqlQuery *query = 0; | 
