From 98903de8351e1f78a057febe0bb996223a238d56 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 28 May 2010 21:32:54 +0200 Subject: Redesign of editing archive items Added new widget to edit movies already in archive. ArchiveItemInfoEdit is designed to be part of a QTabWidget. --- archiveiteminfoedit.cpp | 188 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 archiveiteminfoedit.cpp (limited to 'archiveiteminfoedit.cpp') 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#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); +} -- cgit v1.2.3-70-g09d2