summaryrefslogtreecommitdiffstats
path: root/archiveitemeditdialog.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-05-29 14:54:55 +0200
committerArno <am@disconnect.de>2010-05-29 15:12:41 +0200
commitca84789d9f288e39936a288c17eff247cb0f4a3f (patch)
treee4c70bd2eccd65378edc09fea0b8cdce13d2de3d /archiveitemeditdialog.cpp
parentd95e3f02d6615854547bded419de81395b28c2c5 (diff)
downloadSheMov-ca84789d9f288e39936a288c17eff247cb0f4a3f.tar.gz
SheMov-ca84789d9f288e39936a288c17eff247cb0f4a3f.tar.bz2
SheMov-ca84789d9f288e39936a288c17eff247cb0f4a3f.zip
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!
Diffstat (limited to 'archiveitemeditdialog.cpp')
-rw-r--r--archiveitemeditdialog.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/archiveitemeditdialog.cpp b/archiveitemeditdialog.cpp
new file mode 100644
index 0000000..0cd11eb
--- /dev/null
+++ b/archiveitemeditdialog.cpp
@@ -0,0 +1,65 @@
+/*
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version
+ 2 of the License, or (at your option) any later version.
+*/
+
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QTabWidget>
+
+#include "archiveitemeditdialog.h"
+#include "archiveiteminfoedit.h"
+#include "archiveitemcoveredit.h"
+#include "moviemodelsingleton.h"
+#include "moviemodel.h"
+#include "movieitem.h"
+#include "fileinfomodel.h"
+
+ArchiveItemEditDialog::ArchiveItemEditDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){
+ //Init dialog
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+
+ //Tab widget
+ mTab = new QTabWidget;
+ mInfoEdit = new ArchiveItemInfoEdit;
+ mTab->addTab(mInfoEdit, tr("General"));
+ mCoverEdit = new ArchiveItemCoverEdit;
+ mTab->addTab(mCoverEdit, tr("Covers"));
+ mainLayout->addWidget(mTab);
+
+ //Button layout
+ QHBoxLayout *buttonLayout = new QHBoxLayout;
+ mCancel = new QPushButton(tr("Cancel"));
+ connect(mCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ mUpdate = new QPushButton(tr("Update"));
+ connect(mUpdate, SIGNAL(clicked()), this, SLOT(accept()));
+ buttonLayout->addStretch();
+ buttonLayout->addWidget(mCancel);
+ buttonLayout->addWidget(mUpdate);
+ mainLayout->addLayout(buttonLayout);
+
+ setLayout(mainLayout);
+}
+
+void ArchiveItemEditDialog::setMovie(const QModelIndex &idx){
+ if(!idx.isValid()){
+ return;
+ }
+
+ //Numbers and title setup
+ mInfoEdit->setTitle(idx.data(MovieModel::TitleBaseRole).toString());
+ mInfoEdit->setDvd(idx.data(MovieModel::DvdRole).toInt());
+ mInfoEdit->setSeries(idx.data(MovieModel::SeriesNoRole).toInt());
+ mInfoEdit->setPart(idx.data(MovieModel::PartNoRole).toInt());
+ mInfoEdit->setGenre(idx.data(MovieModel::GenreRole).toString());
+ mInfoEdit->setQuality(idx.data(MovieModel::QualityRole).toInt());
+
+ //File and actor info
+ mInfoEdit->setup(idx);
+
+ //Set covers
+ mCoverEdit->setCovers(idx.data(MovieModel::CoverRole).toList());
+}