summaryrefslogtreecommitdiffstats
path: root/archiveiteminfoedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'archiveiteminfoedit.cpp')
-rw-r--r--archiveiteminfoedit.cpp209
1 files changed, 0 insertions, 209 deletions
diff --git a/archiveiteminfoedit.cpp b/archiveiteminfoedit.cpp
deleted file mode 100644
index 70e5afe..0000000
--- a/archiveiteminfoedit.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- 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 "listeditor.h"
-#include "moviemodel.h"
-
-
-ArchiveItemInfoEdit::ArchiveItemInfoEdit(QWidget *parent) : QWidget(parent){
- //Models
- mGenreModel = ListModelSingleton::instance()->model("genre");
- mActorModel = ListModelSingleton::instance()->model("actor");
-
- //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(1000);
- 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);
-}
-
-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
- mActorView->clear();
- QStringList actors = idx.data(MovieModel::ActorsRole).toStringList();
- qSort(actors);
- foreach(QString a, actors){
- mActorView->addActor(a);
- }
-}
-
-const QString ArchiveItemInfoEdit::genre() const {
- return mGenre->currentText();
-}
-
-const QString ArchiveItemInfoEdit::title() const {
- return mTitle->text().trimmed().toLower();
-}
-
-const QStringList ArchiveItemInfoEdit::actors() const {
- return mActorView->actors();
-}
-
-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);
-}