summaryrefslogtreecommitdiffstats
path: root/archiveiteminfoedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'archiveiteminfoedit.cpp')
-rw-r--r--archiveiteminfoedit.cpp188
1 files changed, 188 insertions, 0 deletions
diff --git a/archiveiteminfoedit.cpp b/archiveiteminfoedit.cpp
new file mode 100644
index 0000000..9d25fb6
--- /dev/null
+++ b/archiveiteminfoedit.cpp
@@ -0,0 +1,188 @@
+/*
+ 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 <QLabel>
+#include <QTreeView>
+#include <QComboBox>
+#include <QSpinBox>
+#include <QLineEdit>
+#include <QSplitter>
+#include <QModelIndex>
+
+#include "archiveiteminfoedit.h"
+#include "fileinfomodel.h"
+#include "actorwidget.h"
+#include "listmodelsingleton.h"
+#include "moviemodelsingleton.h"
+#include "listeditor.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;
+ QVBoxLayout *infoWidgetLayout = new QVBoxLayout;
+
+ //Movie Information
+ QLabel *infoCaption = new QLabel(tr("Movie Information"));
+ infoWidgetLayout->addWidget(infoCaption);
+ mInfoView = new QTreeView;
+ mInfoModel = new FileInfoModel;
+ mInfoView->setModel(mInfoModel);
+ infoWidgetLayout->addWidget(mInfoView);
+
+ //Actor Information
+ mActorView = new ActorWidget;
+ infoWidgetLayout->addWidget(mActorView);
+
+ //Genre Information
+ QLabel *genreLabel = new QLabel(tr("Select genre"));
+ mGenre = new QComboBox;
+ mGenre->setModel(mGenreModel);
+ QHBoxLayout *genreLayout = new QHBoxLayout;
+ genreLayout->addWidget(genreLabel);
+ genreLayout->addWidget(mGenre);
+ infoWidgetLayout->addLayout(genreLayout);
+
+ //Quality, Series, Part + DVD Infomation
+ QHBoxLayout *miscInfoLayout = new QHBoxLayout;
+
+ //Quality
+ QLabel *qualityLabel = new QLabel(tr("Quality"));
+ mQuality = new QSpinBox;
+ mQuality->setMinimum(0);
+ mQuality->setMaximum(10);
+ miscInfoLayout->addWidget(qualityLabel);
+ miscInfoLayout->addWidget(mQuality);
+
+ //DVD
+ QLabel *dvdLabel = new QLabel(tr("DVD no."));
+ mDvd = new QSpinBox;
+ mDvd->setMinimum(-1);
+ mDvd->setMaximum(10);
+ miscInfoLayout->addWidget(dvdLabel);
+ miscInfoLayout->addWidget(mDvd);
+ miscInfoLayout->addStretch();
+
+ //Series
+ QLabel *seriesLabel = new QLabel(tr("Series no."));
+ mSeries = new QSpinBox;
+ mSeries->setMinimum(-1);
+ mSeries->setMaximum(1000);
+ miscInfoLayout->addWidget(seriesLabel);
+ miscInfoLayout->addWidget(mSeries);
+
+ //Part
+ QLabel *partLabel = new QLabel(tr("Part no."));
+ mPart = new QSpinBox;
+ mPart->setMinimum(-1);
+ mPart->setMaximum(100);
+ miscInfoLayout->addWidget(partLabel);
+ miscInfoLayout->addWidget(mPart);
+
+ //Add to infoWidget
+ infoWidgetLayout->addLayout(miscInfoLayout);
+
+ //Title
+ QHBoxLayout *titleLayout = new QHBoxLayout;
+ QLabel *titleLabel = new QLabel(tr("Movie title"));
+ mTitle = new QLineEdit;
+ titleLayout->addWidget(titleLabel);
+ titleLayout->addWidget(mTitle);
+ infoWidgetLayout->addLayout(titleLayout);
+
+ //Create widget
+ infoWidget->setLayout(infoWidgetLayout);
+
+ //ListEditorWidget
+ QWidget *editorWidget = new QWidget;
+ QVBoxLayout *editorWidgetLayout = new QVBoxLayout;
+
+ //GenreEditor
+ ListEditor *genreEditor = new ListEditor(mGenreModel);
+ editorWidgetLayout->addWidget(genreEditor);
+
+ //ActorEditor
+ ListEditor *actorEditor = new ListEditor(mActorModel);
+ editorWidgetLayout->addWidget(actorEditor);
+ connect(actorEditor, SIGNAL(itemAdded(QString)), this, SLOT(addActor(QString)));
+ editorWidgetLayout->addStretch();
+
+ //Create widget
+ editorWidget->setLayout(editorWidgetLayout);
+
+ //Splitter
+ QSplitter *splitter = new QSplitter;
+ splitter->addWidget(infoWidget);
+ splitter->addWidget(editorWidget);
+
+ //Create this widget
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(splitter);
+ setLayout(mainLayout);
+}
+
+const QString ArchiveItemInfoEdit::genre() const {
+ return mGenre->currentText();
+}
+
+const QString ArchiveItemInfoEdit::title() const {
+ return mTitle->text();
+}
+
+int ArchiveItemInfoEdit::quality() const {
+ return mQuality->value();
+}
+
+int ArchiveItemInfoEdit::dvd() const {
+ return mDvd->value();
+}
+
+int ArchiveItemInfoEdit::series() const {
+ return mSeries->value();
+}
+
+int ArchiveItemInfoEdit::part() const {
+ return mPart->value();
+}
+
+void ArchiveItemInfoEdit::setGenre(const QString &genre){
+ QModelIndex idx = mGenreModel->index(genre);
+ if(idx.isValid()){
+ mGenre->setCurrentIndex(idx.row());
+ }
+}
+
+void ArchiveItemInfoEdit::setTitle(const QString &title){
+ mTitle->setText(title);
+}
+
+void ArchiveItemInfoEdit::setQuality(int quality){
+ mQuality->setValue(quality);
+}
+
+void ArchiveItemInfoEdit::setDvd(int dvd){
+ mDvd->setValue(dvd);
+}
+
+void ArchiveItemInfoEdit::setSeries(int series){
+ mSeries->setValue(series);
+}
+
+void ArchiveItemInfoEdit::setPart(int part){
+ mPart->setValue(part);
+}
+
+void ArchiveItemInfoEdit::addActor(const QString &actor){
+ mActorView->addActor(actor);
+}