From ca84789d9f288e39936a288c17eff247cb0f4a3f Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 29 May 2010 14:54:55 +0200 Subject: Implement new ArchiveItemEditDialog Use ArchiveItemEditDialog instead of EditArchiveItemDialog. The latter will soon be obsolete and removed. Terrible naming, though. This commit is not as atomic as I want it to be, but it can't be helped. I had to fix several bugs in ArchveItemInfoEdit and ArchiveItemCoverEdit on the way: -Fix layout of ArchiveItemCoverEdit -Make white background of warning label in ArchiveItemCoverEdit work -Add function to ArchiveItemInfoEdit to init the ActorModel and FileInfoModel -Add function to ArchiveItemInfoEdit to return selected actors Beware: The update button still does nothing! --- archiveiteminfoedit.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'archiveiteminfoedit.cpp') diff --git a/archiveiteminfoedit.cpp b/archiveiteminfoedit.cpp index 9d25fb6..4ec7d18 100644 --- a/archiveiteminfoedit.cpp +++ b/archiveiteminfoedit.cpp @@ -19,15 +19,14 @@ #include "fileinfomodel.h" #include "actorwidget.h" #include "listmodelsingleton.h" -#include "moviemodelsingleton.h" #include "listeditor.h" +#include "moviemodel.h" ArchiveItemInfoEdit::ArchiveItemInfoEdit(QWidget *parent) : QWidget(parent){ //Models mGenreModel = ListModelSingleton::instance()->model("genre"); mActorModel = ListModelSingleton::instance()->model("actor"); - mMovieModel = MovieModelSingleton::instance(); //InfoWidget QWidget *infoWidget = new QWidget; @@ -132,6 +131,23 @@ ArchiveItemInfoEdit::ArchiveItemInfoEdit(QWidget *parent) : QWidget(parent){ setLayout(mainLayout); } +void ArchiveItemInfoEdit::setup(const QModelIndex &idx) { + //Movie Info + QString title = QString(idx.data().toString()); + mInfoModel->clear(); + mInfoModel->addIndex(title, idx); + mInfoView->resizeColumnToContents(0); + mInfoView->setHeaderHidden(true); + mInfoView->expandAll(); + + //Actors + QStringList actors = idx.data(MovieModel::ActorsRole).toStringList(); + qSort(actors); + foreach(QString a, actors){ + mActorView->addActor(a); + } +} + const QString ArchiveItemInfoEdit::genre() const { return mGenre->currentText(); } @@ -140,6 +156,10 @@ const QString ArchiveItemInfoEdit::title() const { return mTitle->text(); } +const QStringList ArchiveItemInfoEdit::actors() const { + return mActorView->actors(); +} + int ArchiveItemInfoEdit::quality() const { return mQuality->value(); } -- cgit v1.2.3-70-g09d2