summaryrefslogtreecommitdiffstats
path: root/moviemodel.cpp
diff options
context:
space:
mode:
authoram <am@f440f766-f032-0410-8965-dc7d17de2ca0>2009-07-21 13:48:56 +0000
committeram <am@f440f766-f032-0410-8965-dc7d17de2ca0>2009-07-21 13:48:56 +0000
commit84ed109c159dcbd0c9395717d54599e902060b26 (patch)
tree01bb4a4d6148ec46952a1cdd5e923bb7b642305e /moviemodel.cpp
parentec3418479b28ca8e162f84d76c2eed78c27a114c (diff)
downloadSheMov-84ed109c159dcbd0c9395717d54599e902060b26.tar.gz
SheMov-84ed109c159dcbd0c9395717d54599e902060b26.tar.bz2
SheMov-84ed109c159dcbd0c9395717d54599e902060b26.zip
-Made CoverItem behave consistent
-get QModelIndex from MovieModel by movieId -ArchiveView: added delegates for dvd and size, MovieItem now returns size as int -Finished EditArchiveItemDialog -Reverted covereditor, it became too convoluted git-svn-id: file:///var/svn/repos2/shemov/trunk@393 f440f766-f032-0410-8965-dc7d17de2ca0
Diffstat (limited to 'moviemodel.cpp')
-rw-r--r--moviemodel.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/moviemodel.cpp b/moviemodel.cpp
index d34113a..8bfa846 100644
--- a/moviemodel.cpp
+++ b/moviemodel.cpp
@@ -69,6 +69,18 @@ QModelIndex MovieModel::index(int row, int column, const QModelIndex &parent) co
return createIndex(row, column, internal);
}
+QModelIndex MovieModel::index(int movieId, int column) const{
+ QModelIndex retval = QModelIndex();
+ for(int i = 0; i < rowCount(QModelIndex()); ++i){
+ MovieItem *item = mItems.at(i);
+ if(item->id() == movieId){
+ retval = createIndex(i, column, item);
+ break;
+ }
+ }
+ return retval;
+}
+
QVariant MovieModel::data(const QModelIndex &index, int role) const{
if(!index.isValid()){
return QVariant();
@@ -76,11 +88,6 @@ QVariant MovieModel::data(const QModelIndex &index, int role) const{
MovieItem *item = static_cast<MovieItem*>(index.internalPointer());
Q_ASSERT(item != 0);
if(role == Qt::DisplayRole){
- switch (index.column()){
- case MovieItem::Dvd:
- return QVariant(QString(tr("DVD %1")).arg(QString::number(item->dataAt(MovieItem::Dvd).toInt())));
- break;
- }
return item->dataAt(index.column());
}
if(role == ActorsRole){