From 621e72e606f88739a67ce6efc4832e0abdc34ffa Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 17 Dec 2011 08:19:34 +0100 Subject: Implemented delete stray actors Added a tab to DbAnalyzerDialog for actors that aren't associated with a movie and make it possible to delete them. --- shemov.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'shemov.cpp') diff --git a/shemov.cpp b/shemov.cpp index 1837dac..5b8b789 100644 --- a/shemov.cpp +++ b/shemov.cpp @@ -51,6 +51,7 @@ #include "filestreemodel.h" #include "consistencycheck.h" #include "mappingtableeditor.h" +#include "mappingtablemodel.h" #include "dbanalyzer.h" SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), mOpenWithGroupFS(0), mOpenWithGroupAV(0) { @@ -986,9 +987,31 @@ void SheMov::checkConsistency(){ void SheMov::analyzeDb(){ DbAnalyzerDialog d(this); connect(&d, SIGNAL(partClicked(int, int)), mATree, SLOT(selectMoviePart(int, int))); + connect(&d, SIGNAL(delItems(int,QList&)), this, SLOT(analyzeDelete(int,QList&))); d.exec(); } +void SheMov::analyzeDelete(int mode, QList &ids){ + QString message = QString(tr("Really delete %1 items?")).arg(QString::number(ids.count())); + int res = QMessageBox::question(this, tr("Delete items"), message, QMessageBox::Yes | QMessageBox::No); + if(res != QMessageBox::Yes){ + return; + } + MappingTableModel *model = 0; + switch(mode){ + case DbAnalyzerDialog::Actors: + model = qobject_cast(SmGlobals::instance()->model("actors")); + break; + case DbAnalyzerDialog::Genres: + model = qobject_cast(SmGlobals::instance()->model("genres")); + break; + default: + ; + } + Q_ASSERT(model); + model->deleteItems(ids); +} + void SheMov::toggleHover(QObject *object){ QAction *action = qobject_cast(object); if(action){ -- cgit v1.2.3-70-g09d2