diff options
author | Arno <am@disconnect.de> | 2013-04-06 07:19:55 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-04-06 07:19:55 +0200 |
commit | 3956fb84ccc26d5ba3be1814192b0c377adfbad0 (patch) | |
tree | b120bc942235f542797d4c4de8a69cfaf8df4eba /smdirmodel.cpp | |
parent | 511d1f9cd61586336014c55e32f67872e5e4ee10 (diff) | |
download | SheMov-3956fb84ccc26d5ba3be1814192b0c377adfbad0.tar.gz SheMov-3956fb84ccc26d5ba3be1814192b0c377adfbad0.tar.bz2 SheMov-3956fb84ccc26d5ba3be1814192b0c377adfbad0.zip |
SmDirModel: check if file already is in database
Indicate if we already have a file by coloring the filename darkGreen
when browsing the filesystem.
Diffstat (limited to 'smdirmodel.cpp')
-rw-r--r-- | smdirmodel.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/smdirmodel.cpp b/smdirmodel.cpp index 8a6c961..6053890 100644 --- a/smdirmodel.cpp +++ b/smdirmodel.cpp @@ -57,6 +57,8 @@ QVariant SmDirModel::data(const QModelIndex &index, int role) const{ return i->data(Bitrate); case FullPathRole: return i->data(FullPath); + case PresentRole: + return i->data(Present); case Qt::DecorationRole: { if(index.column() == 0){ QStringList mime = i->data(Type).toString().split('/'); @@ -67,8 +69,15 @@ QVariant SmDirModel::data(const QModelIndex &index, int role) const{ return mIcons.value("other"); } return mIcons.value(mime.at(0).toLower()); + }else{ + return QVariant(); } } + case Qt::ForegroundRole: + if(index.column() == 0 && i->data(Present).toInt() > 0){ + return QVariant(QColor(Qt::darkGreen)); + } + return SmTreeModel::data(index, role); case Qt::DisplayRole: { if(index.column() == DurSize){ QVariant d = i->data(DurSize); @@ -85,6 +94,7 @@ QVariant SmDirModel::data(const QModelIndex &index, int role) const{ } } + default: return SmTreeModel::data(index, role); } @@ -187,6 +197,10 @@ void SmDirModel::refresh(){ setDir(mCurrentDir); } +void SmDirModel::setCheckForPresent(bool check){ + mCollector->setCheckForPresent(check); +} + void SmDirModel::populate(SmTreeItem *root){ setRoot(root); emit needResize(); |