summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archiveitemcoveredit.cpp40
-rw-r--r--archiveitemeditdialog.cpp65
-rw-r--r--archiveitemeditdialog.h33
-rw-r--r--archiveiteminfoedit.cpp24
-rw-r--r--archiveiteminfoedit.h5
-rw-r--r--archiveviewwidget.cpp1
-rw-r--r--archiveviewwidget.h5
-rw-r--r--shemov.cpp3
-rw-r--r--shemov.h3
-rw-r--r--shemov.pro6
10 files changed, 159 insertions, 26 deletions
diff --git a/archiveitemcoveredit.cpp b/archiveitemcoveredit.cpp
index 41672d7..5f0deb6 100644
--- a/archiveitemcoveredit.cpp
+++ b/archiveitemcoveredit.cpp
@@ -16,6 +16,7 @@
#include <QSettings>
#include <QSettings>
#include <QFileInfo>
+#include <QPalette>
#include <algorithm>
@@ -35,24 +36,30 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
//Warning
QLabel *descriptionLabel = new QLabel(tr("Edit covers of movie - if the movie already has covers you have to unlock the specific cover for changing it. Then click browse to select a new cover. WARNING: The old cover will be deleted from archive if you submit the changes!"));
- descriptionLabel->setBackgroundRole(QPalette::Light);
+ descriptionLabel->setWordWrap(true);
+ descriptionLabel->setAutoFillBackground(true);
descriptionLabel->setFrameStyle(QFrame::Box);
+ descriptionLabel->setMargin(5);
+ QPalette palette = descriptionLabel->palette();
+ palette.setColor(QPalette::Window, Qt::white);
+ descriptionLabel->setPalette(palette);
mainLayout->addWidget(descriptionLabel);
+ mainLayout->addSpacing(15);
//Front cover
QLabel *frontCoverLabel = new QLabel(tr("Front cover"));
coverLayout->addWidget(frontCoverLabel, 0, 0);
mFrontCover = new QLineEdit;
mInitialValue.insert(mFrontCover, QString());
- coverLayout->addWidget(mFrontCover);
+ coverLayout->addWidget(mFrontCover, 0, 1);
mBrowseFront = new QPushButton(tr("Browse..."));
connect(mBrowseFront, SIGNAL(clicked()), browseMapper, SLOT(map()));
browseMapper->setMapping(mBrowseFront, mFrontCover);
- coverLayout->addWidget(mBrowseFront, 0, 1);
+ coverLayout->addWidget(mBrowseFront, 0, 2);
mViewFront = new QPushButton(tr("View"));
connect(mViewFront, SIGNAL(clicked()), viewMapper, SLOT(map()));
viewMapper->setMapping(mViewFront, mFrontCover);
- coverLayout->addWidget(mViewFront, 0, 2);
+ coverLayout->addWidget(mViewFront, 0, 3);
mUnlockFront = new QCheckBox;
mCheckboxTexts.insert(mUnlockFront, qMakePair(tr("Unlock front cover"), tr("Reset and lock front cover")));
mUnlockFront->setText(mCheckboxTexts.value(mUnlockFront).first);
@@ -60,22 +67,22 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
mBrowseMap.insert(mUnlockFront, mBrowseFront);
connect(mUnlockFront, SIGNAL(stateChanged(int)), unlockMapper, SLOT(map()));
unlockMapper->setMapping(mUnlockFront, mFrontCover);
- coverLayout->addWidget(mUnlockFront, 1, 1, 0, 2, Qt::AlignRight);
+ coverLayout->addWidget(mUnlockFront, 1, 2, 1, 2, Qt::AlignLeft);
//Back cover
QLabel *backCoverLabel = new QLabel(tr("Back cover"));
coverLayout->addWidget(backCoverLabel, 2, 0);
mBackCover = new QLineEdit;
mInitialValue.insert(mBackCover, QString());
- coverLayout->addWidget(mBackCover);
+ coverLayout->addWidget(mBackCover, 2, 1);
mBrowseBack = new QPushButton(tr("Browse..."));
connect(mBrowseBack, SIGNAL(clicked()), browseMapper, SLOT(map()));
browseMapper->setMapping(mBrowseBack, mBackCover);
- coverLayout->addWidget(mBrowseBack, 2, 1);
+ coverLayout->addWidget(mBrowseBack, 2, 2);
mViewBack = new QPushButton(tr("View"));
connect(mViewBack, SIGNAL(clicked()), viewMapper, SLOT(map()));
viewMapper->setMapping(mViewBack, mBackCover);
- coverLayout->addWidget(mViewBack, 2, 2);
+ coverLayout->addWidget(mViewBack, 2, 3);
mUnlockBack = new QCheckBox;
mCheckboxTexts.insert(mUnlockBack, qMakePair(tr("Unlock back cover"), tr("Reset and lock back cover")));
mUnlockBack->setText(mCheckboxTexts.value(mUnlockBack).first);
@@ -83,22 +90,22 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
mBrowseMap.insert(mUnlockBack, mBrowseBack);
connect(mUnlockBack, SIGNAL(stateChanged(int)), unlockMapper, SLOT(map()));
unlockMapper->setMapping(mUnlockBack, mBackCover);
- coverLayout->addWidget(mUnlockBack, 3, 1, 0, 2, Qt::AlignRight);
+ coverLayout->addWidget(mUnlockBack, 3, 2, 1, 2, Qt::AlignLeft);
//General cover
QLabel *generalCoverLabel = new QLabel(tr("General cover"));
coverLayout->addWidget(generalCoverLabel, 4, 0);
mGeneralCover = new QLineEdit;
mInitialValue.insert(mGeneralCover, QString());
- coverLayout->addWidget(mGeneralCover);
+ coverLayout->addWidget(mGeneralCover, 4, 1);
mBrowseGeneral = new QPushButton(tr("Browse..."));
connect(mBrowseGeneral, SIGNAL(clicked()), browseMapper, SLOT(map()));
browseMapper->setMapping(mBrowseGeneral, mGeneralCover);
- coverLayout->addWidget(mBrowseGeneral, 4, 1);
+ coverLayout->addWidget(mBrowseGeneral, 4, 2);
mViewGeneral = new QPushButton(tr("View"));
connect(mViewGeneral, SIGNAL(clicked()), viewMapper, SLOT(map()));
viewMapper->setMapping(mViewGeneral, mGeneralCover);
- coverLayout->addWidget(mViewGeneral, 4, 2);
+ coverLayout->addWidget(mViewGeneral, 4, 3);
mUnlockGeneral = new QCheckBox;
mCheckboxTexts.insert(mUnlockGeneral, qMakePair(tr("Unlock general cover"), tr("Reset and lock general cover")));
mUnlockGeneral->setText(mCheckboxTexts.value(mUnlockGeneral).first);
@@ -106,7 +113,7 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
mBrowseMap.insert(mUnlockGeneral, mBrowseGeneral);
connect(mUnlockGeneral, SIGNAL(stateChanged(int)), unlockMapper, SLOT(map()));
unlockMapper->setMapping(mUnlockGeneral, mGeneralCover);
- coverLayout->addWidget(mUnlockGeneral, 5, 1, 0, 2, Qt::AlignRight);
+ coverLayout->addWidget(mUnlockGeneral, 5, 2, 1, 2, Qt::AlignLeft);
//Connect QSignalMappers
connect(unlockMapper, SIGNAL(mapped(QWidget*)), this, SLOT(unlock(QWidget*)));
@@ -115,6 +122,7 @@ ArchiveItemCoverEdit::ArchiveItemCoverEdit(QWidget *parent) : QWidget(parent) {
//Setup Widget
mainLayout->addLayout(coverLayout);
+ mainLayout->addStretch();
setLayout(mainLayout);
}
@@ -125,7 +133,7 @@ void ArchiveItemCoverEdit::setCovers(const QList<QVariant> &covers){
it = std::find_if(covers.constBegin(), covers.constEnd(), std::bind2nd(CoverItem::findType(), "front"));
QString initialValue;
if(it != covers.constEnd()){
- initialValue = it->value<CoverItem>().fileName();
+ initialValue = it->value<CoverItem>().fullPath();
}
mFrontCover->setText(initialValue);
mInitialValue[mFrontCover] = initialValue;
@@ -135,7 +143,7 @@ void ArchiveItemCoverEdit::setCovers(const QList<QVariant> &covers){
//Set back cover
it = std::find_if(covers.constBegin(), covers.constEnd(), std::bind2nd(CoverItem::findType(), "back"));
if(it != covers.constEnd()){
- initialValue = it->value<CoverItem>().fileName();
+ initialValue = it->value<CoverItem>().fullPath();
}
mBackCover->setText(initialValue);
mInitialValue[mBackCover] = initialValue;
@@ -145,7 +153,7 @@ void ArchiveItemCoverEdit::setCovers(const QList<QVariant> &covers){
//Set general cover
it = std::find_if(covers.constBegin(), covers.constEnd(), std::bind2nd(CoverItem::findType(), "general"));
if(it != covers.constEnd()){
- initialValue = it->value<CoverItem>().fileName();
+ initialValue = it->value<CoverItem>().fullPath();
}
mGeneralCover->setText(initialValue);
mInitialValue[mGeneralCover] = initialValue;
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());
+}
diff --git a/archiveitemeditdialog.h b/archiveitemeditdialog.h
new file mode 100644
index 0000000..edb4af3
--- /dev/null
+++ b/archiveitemeditdialog.h
@@ -0,0 +1,33 @@
+/*
+ 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.
+*/
+
+#ifndef ARCHIVEITEMEDITDIALOG_H
+#define ARCHIVEITEMEDITDIALOG_H
+
+#include <QDialog>
+
+class QPushButton;
+class QTabWidget;
+class ArchiveItemInfoEdit;
+class ArchiveItemCoverEdit;
+class QModelIndex;
+
+class ArchiveItemEditDialog : public QDialog {
+ Q_OBJECT
+ public:
+ explicit ArchiveItemEditDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
+ void setMovie(const QModelIndex &idx);
+
+ private:
+ QPushButton *mUpdate;
+ QPushButton *mCancel;
+ QTabWidget *mTab;
+ ArchiveItemInfoEdit *mInfoEdit;
+ ArchiveItemCoverEdit *mCoverEdit;
+};
+
+#endif
diff --git a/archiveiteminfoedit.cpp b/archiveiteminfoedit.cpp
index 9d25fb6..4ec7d18 100644
--- a/archiveiteminfoedit.cpp
+++ b/archiveiteminfoedit.cpp
@@ -19,15 +19,14 @@
#include "fileinfomodel.h"
#include "actorwidget.h"
#include "listmodelsingleton.h"
-#include "moviemodelsingleton.h"
#include "listeditor.h"
+#include "moviemodel.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;
@@ -132,6 +131,23 @@ ArchiveItemInfoEdit::ArchiveItemInfoEdit(QWidget *parent) : QWidget(parent){
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
+ QStringList actors = idx.data(MovieModel::ActorsRole).toStringList();
+ qSort(actors);
+ foreach(QString a, actors){
+ mActorView->addActor(a);
+ }
+}
+
const QString ArchiveItemInfoEdit::genre() const {
return mGenre->currentText();
}
@@ -140,6 +156,10 @@ const QString ArchiveItemInfoEdit::title() const {
return mTitle->text();
}
+const QStringList ArchiveItemInfoEdit::actors() const {
+ return mActorView->actors();
+}
+
int ArchiveItemInfoEdit::quality() const {
return mQuality->value();
}
diff --git a/archiveiteminfoedit.h b/archiveiteminfoedit.h
index d06fa0a..98a1736 100644
--- a/archiveiteminfoedit.h
+++ b/archiveiteminfoedit.h
@@ -17,14 +17,16 @@ class QLineEdit;
class FileInfoModel;
class ActorWidget;
class ListModel;
-class MovieModel;
+class QModelIndex;
class ArchiveItemInfoEdit : public QWidget {
Q_OBJECT
public:
explicit ArchiveItemInfoEdit(QWidget *parent = 0);
+ void setup(const QModelIndex &idx);
const QString genre() const;
const QString title() const;
+ const QStringList actors() const;
int quality() const;
int dvd() const;
int series() const;
@@ -53,7 +55,6 @@ class ArchiveItemInfoEdit : public QWidget {
FileInfoModel *mInfoModel;
ListModel *mGenreModel;
ListModel *mActorModel;
- MovieModel *mMovieModel;
};
#endif
diff --git a/archiveviewwidget.cpp b/archiveviewwidget.cpp
index 1aad409..eab5a5a 100644
--- a/archiveviewwidget.cpp
+++ b/archiveviewwidget.cpp
@@ -33,6 +33,7 @@
#include "helper.h"
#include "moviepropertiesdialog.h"
#include "addmoviewizard.h"
+#include "archiveitemeditdialog.h"
ArchiveViewWidget::ArchiveViewWidget(MovieModel *model, ListModel *genre, ListModel *actors, QWidget *parent) : QWidget(parent), mMovieModel(model), mGenreModel(genre), mActorsModel(actors), mSize(0){
//filter bar
diff --git a/archiveviewwidget.h b/archiveviewwidget.h
index 4f56af5..00356c4 100644
--- a/archiveviewwidget.h
+++ b/archiveviewwidget.h
@@ -23,6 +23,7 @@ class ArchiveFileView;
class ArchiveProxy;
class EditArchiveItemDialog;
class CoverArchiveEditor;
+class ArchiveItemEditDialog;
class ArchiveViewWidget : public QWidget {
Q_OBJECT
@@ -30,7 +31,7 @@ class ArchiveViewWidget : public QWidget {
ArchiveViewWidget(MovieModel *model, ListModel *genre, ListModel *actors, QWidget *parent = 0);
~ArchiveViewWidget() {};
ArchiveFileView* fileView() { return mFileView; };
- void setEditDialog(EditArchiveItemDialog *dlg) { mEditDialog = dlg; };
+ void setEditDialog(ArchiveItemEditDialog *dlg) { mEditDialog = dlg; };
void setCoverEditDialog(CoverArchiveEditor *dlg) { mCoverEditDialog = dlg; };
const QString &windowTitle() const { return mWindowTitle; };
qint64 currentSize() const { return mSize; };
@@ -72,7 +73,7 @@ class ArchiveViewWidget : public QWidget {
ListModel *mActorsModel;
ArchiveFileView *mFileView;
ArchiveProxy *mProxy;
- EditArchiveItemDialog *mEditDialog;
+ ArchiveItemEditDialog *mEditDialog;
CoverArchiveEditor *mCoverEditDialog;
QString mWindowTitle;
qint64 mSize;
diff --git a/shemov.cpp b/shemov.cpp
index fa87d35..d429b62 100644
--- a/shemov.cpp
+++ b/shemov.cpp
@@ -39,6 +39,7 @@
#include "listmodel.h"
#include "archiveviewwidget.h"
#include "editarchiveitemdialog.h"
+#include "archiveitemeditdialog.h"
#include "coverarchiveeditor.h"
#include "statisticsdialog.h"
#include "filesystemfileproxy.h"
@@ -79,7 +80,7 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla
mAEdit = new ArchiveEditDialog(this);
mFSWidget->setArchiveDialog(mAEdit);
- mAItemEdit = new EditArchiveItemDialog(mGenreModel, mActorModel, mMovieModel, this);
+ mAItemEdit = new ArchiveItemEditDialog(this);
mAVWidget->setEditDialog(mAItemEdit);
mCEdit = new CoverArchiveEditor(mMovieModel, this);
mAVWidget->setCoverEditDialog(mCEdit);
diff --git a/shemov.h b/shemov.h
index 0b64093..b33fd6e 100644
--- a/shemov.h
+++ b/shemov.h
@@ -26,6 +26,7 @@ class ListModel;
class ArchiveViewWidget;
class EditArchiveItemDialog;
class CoverArchiveEditor;
+class ArchiveItemEditDialog;
class SheMov : public QMainWindow {
Q_OBJECT
@@ -115,7 +116,7 @@ class SheMov : public QMainWindow {
FilesystemWidget *mFSWidget;
ArchiveViewWidget *mAVWidget;
ArchiveEditDialog *mAEdit;
- EditArchiveItemDialog *mAItemEdit;
+ ArchiveItemEditDialog *mAItemEdit;
CoverArchiveEditor *mCEdit;
MovieModel *mMovieModel;
ListModel *mGenreModel;
diff --git a/shemov.pro b/shemov.pro
index a6090c3..da5ebb7 100644
--- a/shemov.pro
+++ b/shemov.pro
@@ -46,7 +46,8 @@ SOURCES = main.cpp \
pictureviewer.cpp \
pictureviewerinfoitem.cpp \
archiveiteminfoedit.cpp \
- archiveitemcoveredit.cpp
+ archiveitemcoveredit.cpp \
+ archiveitemeditdialog.cpp
HEADERS = listitem.h \
listmodel.h \
movieitem.h \
@@ -88,6 +89,7 @@ HEADERS = listitem.h \
pictureviewer.h \
pictureviewerinfoitem.h \
archiveiteminfoedit.h \
- archiveitemcoveredit.h
+ archiveitemcoveredit.h \
+ archiveitemeditdialog.h
LIBS += -lmagic
RESOURCES = shemov.qrc