summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-04-04 19:12:12 +0200
committerArno <arno@disconnect.de>2018-04-04 19:12:12 +0200
commit98c75be2b35096dd3f8a6f9f9d710a1eed0a9938 (patch)
tree84a7c85068688ea530a3308581be91054b9ac2ff
parentf48e27a63c59840979dd848893ffba3faefdfdde (diff)
downloadSheMov-98c75be2b35096dd3f8a6f9f9d710a1eed0a9938.tar.gz
SheMov-98c75be2b35096dd3f8a6f9f9d710a1eed0a9938.tar.bz2
SheMov-98c75be2b35096dd3f8a6f9f9d710a1eed0a9938.zip
MoviePropertiesDialog: implement remove genre and actor
Only removes items from the view, does nothing to the database yet.
-rw-r--r--moviepropertiesdialog.cpp9
-rw-r--r--moviepropertiesdialog.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/moviepropertiesdialog.cpp b/moviepropertiesdialog.cpp
index 92b8a0c..02bd098 100644
--- a/moviepropertiesdialog.cpp
+++ b/moviepropertiesdialog.cpp
@@ -72,6 +72,7 @@ void MoviePropertiesDialog::setupDialog(){
QAction *addActorA = new QAction(QIcon(":/spreadingpants.png"), tr("Add actor..."), this);
connect(addActorA, &QAction::triggered, [=] { addItem(mActorDlg, mActorM, QIcon(":/diaper.png")); });
QAction *removeActorA = new QAction(QIcon(":/delete.png"), tr("Remove actor"), this);
+ connect(removeActorA, &QAction::triggered, [=] { removeItem(mActorV); });
mActorV->addActions(QList<QAction*>() << addActorA << removeActorA);
QGroupBox *actorsGB = new QGroupBox(tr("Actors"));
QHBoxLayout *actorsGBL = new QHBoxLayout;
@@ -85,6 +86,7 @@ void MoviePropertiesDialog::setupDialog(){
QAction *addGenreA = new QAction(QIcon(":/spreadingpants.png"), tr("Add genre..."), this);
connect(addGenreA, &QAction::triggered, [=] { addItem(mGenreDlg, mGenreM, QIcon(":/dick_in_cage.png")); });
QAction *removeGenreA = new QAction(QIcon(":/delete.png"), tr("Remove genre"), this);
+ connect(removeGenreA, &QAction::triggered, [=] { removeItem(mGenreV); });
mGenreV->addActions(QList<QAction*>() << addGenreA << removeGenreA);
QGroupBox *genresGB = new QGroupBox(tr("Genres"));
QHBoxLayout *genresGBL = new QHBoxLayout;
@@ -205,3 +207,10 @@ void MoviePropertiesDialog::addItem(SmInputDialog *dlg, QStandardItemModel *mode
model->insertRow(idx, newItem);
}
}
+
+void MoviePropertiesDialog::removeItem(SmView *view){
+ QModelIndexList selected = view->selectionModel()->selectedRows();
+ if(!selected.isEmpty()){
+ view->model()->removeRow(selected.first().row());
+ }
+}
diff --git a/moviepropertiesdialog.h b/moviepropertiesdialog.h
index 75aff95..944b4c3 100644
--- a/moviepropertiesdialog.h
+++ b/moviepropertiesdialog.h
@@ -20,6 +20,7 @@ class MoviePropertiesDialog : public QDialog {
private:
void setupDialog();
void addItem(SmInputDialog *dlg, QStandardItemModel *model, QIcon icon);
+ void removeItem(SmView *view);
QLineEdit *mSeriesNameLE;
QLineEdit *mSubtitleLE;
QLineEdit *mCommentLE;