summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archiveviewwidget.cpp13
-rw-r--r--archiveviewwidget.h9
-rw-r--r--filesystemwidget.cpp2
-rw-r--r--moviepropertiesdialog.cpp152
-rw-r--r--moviepropertiesdialog.h5
-rw-r--r--shemov.cpp4
-rw-r--r--shemov.h1
7 files changed, 178 insertions, 8 deletions
diff --git a/archiveviewwidget.cpp b/archiveviewwidget.cpp
index 1bc7902..9be3a10 100644
--- a/archiveviewwidget.cpp
+++ b/archiveviewwidget.cpp
@@ -28,6 +28,7 @@
#include "coverarchiveeditor.h"
#include "textenterdialog.h"
#include "helper.h"
+#include "moviepropertiesdialog.h"
ArchiveViewWidget::ArchiveViewWidget(MovieModel *model, ListModel *genre, ListModel *actors, QWidget *parent) : QWidget(parent), mMovieModel(model), mGenreModel(genre), mActorsModel(actors){
//filter bar
@@ -151,6 +152,18 @@ void ArchiveViewWidget::showMovie(const QModelIndex &movie){
QProcess::startDetached(playerPath, args);
}
+void ArchiveViewWidget::properties(){
+ QModelIndexList selected = fileView()->selectionModel()->selectedRows();
+ if(selected.isEmpty()){
+ return;
+ }
+ QModelIndex idx = selected.at(0);
+ QModelIndex real = mProxy->mapToSource(idx);
+ int movid = real.data(MovieModel::IdRole).toInt();
+ MoviePropertiesDialog dlg(movid, this);
+ dlg.exec();
+}
+
void ArchiveViewWidget::setFilter(){
QString filter = mName->text().toLower();
if(filter.isEmpty()){
diff --git a/archiveviewwidget.h b/archiveviewwidget.h
index bbd1ea2..1e7e06a 100644
--- a/archiveviewwidget.h
+++ b/archiveviewwidget.h
@@ -37,16 +37,15 @@ class ArchiveViewWidget : public QWidget {
void editCovers();
void addMovie();
void showMovie(const QModelIndex &movie);
+ void properties();
+ void setFilter();
+ void setGenreFilter(const QString &filter);
+ void setActorFilter(const QString &filter);
signals:
void statusbarMessage(const QString &message);
void windowTitle(const QString &title);
- public slots:
- void setFilter();
- void setGenreFilter(const QString &filter);
- void setActorFilter(const QString &filter);
-
private slots:
void rowChanged(const QModelIndex &current, const QModelIndex &prev);
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp
index 182ab77..38d6a99 100644
--- a/filesystemwidget.cpp
+++ b/filesystemwidget.cpp
@@ -170,7 +170,7 @@ void FilesystemWidget::fileViewActivated(const QModelIndex &idx){
programArgs = s.value("paths/pictureviewerargs").toStringList();
}
programArgs << path;
- QProcess::execute(program, programArgs);
+ QProcess::startDetached(program, programArgs);
}
void FilesystemWidget::parentDir(){
diff --git a/moviepropertiesdialog.cpp b/moviepropertiesdialog.cpp
index 26bec8f..724e9ba 100644
--- a/moviepropertiesdialog.cpp
+++ b/moviepropertiesdialog.cpp
@@ -14,6 +14,13 @@
#include <QLabel>
#include <QSqlQuery>
#include <QFileInfo>
+#include <QFont>
+#include <QApplication>
+#include <QGridLayout>
+#include <QLocale>
+#include <QGraphicsTextItem>
+#include <QGraphicsPixmapItem>
+#include <QPixmap>
#include "moviepropertiesdialog.h"
#include "helper.h"
@@ -43,11 +50,145 @@ MoviePropertiesDialog::MoviePropertiesDialog(int movid, QWidget *parent, Qt::Win
QSqlQuery q2;
q2.prepare("SELECT tactorname FROM actor, movieactormap WHERE movieactormap.iactorid = actor.iactorid AND movieactormap.imovid = :id");
q2.bindValue(":id", mId);
+ q2.exec();
while(q2.next()){
actors << q2.value(0).toString();
}
//layout
-
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mView = new QGraphicsView;
+ mScene = new QGraphicsScene(this);
+ mView->setScene(mScene);
+ mainLayout->addWidget(mView);
+
+ //cover buttons
+ QHBoxLayout *buttonPicLayout = new QHBoxLayout;
+ mPrev = new QPushButton(tr("Previous"));
+ connect(mPrev, SIGNAL(clicked()), this, SLOT(previousCover()));
+ mNext = new QPushButton(tr("Next"));
+ connect(mNext, SIGNAL(clicked()), this, SLOT(nextCover()));
+ buttonPicLayout->addWidget(mPrev);
+ buttonPicLayout->addStretch();
+ buttonPicLayout->addWidget(mNext);
+ mainLayout->addLayout(buttonPicLayout);
+
+ //actors
+ mActors = new QTextEdit;
+ mActors->setReadOnly(true);
+ mActors->setFont(QFont("Courier new"));
+ mActors->setHtml(actorHtml(actors));
+
+ //properties
+ QGridLayout *propertiesGrid = new QGridLayout;
+ QFont font = qApp->font();
+ font.setWeight(QFont::Bold);
+ QLabel *l1 = new QLabel("Genre");
+ l1->setFont(font);
+ QLabel *l2 = new QLabel(genre);
+ propertiesGrid->addWidget(l1, 0, 0);
+ propertiesGrid->addWidget(l2, 0, 1);
+ QLabel *l3 = new QLabel(tr("Title"));
+ l3->setFont(font);
+ QLabel *l4 = new QLabel(title);
+ propertiesGrid->addWidget(l3, 1, 0);
+ propertiesGrid->addWidget(l4, 1, 1);
+ QLabel *l5 = new QLabel(tr("Filename"));
+ l5->setFont(font);
+ QLabel *l6 = new QLabel(filename);
+ propertiesGrid->addWidget(l5, 2, 0);
+ propertiesGrid->addWidget(l6, 2, 1);
+ QLabel *l7 = new QLabel(tr("MD5"));
+ l7->setFont(font);
+ QLabel *l8 = new QLabel(md5);
+ propertiesGrid->addWidget(l7, 3, 0);
+ propertiesGrid->addWidget(l8, 3, 1);
+ QLabel *l9 = new QLabel(tr("Size"));
+ l9->setFont(font);
+ QLocale l;
+ QLabel *l10 = new QLabel(l.toString(size));
+ propertiesGrid->addWidget(l9, 4, 0);
+ propertiesGrid->addWidget(l10, 4, 1);
+ QLabel *l11 = new QLabel(tr("Quality"));
+ l11->setFont(font);
+ QLabel *l12 = new QLabel(QString::number(quality));
+ propertiesGrid->addWidget(l11, 5, 0);
+ propertiesGrid->addWidget(l12, 5, 1);
+ QLabel *l13 = new QLabel(tr("Archived"));
+ l13->setFont(font);
+ QLabel *l14 = new QLabel;
+ if(dvd < 0){
+ l14->setText(tr("No - local"));
+ }else{
+ QString s = QString(tr("On DVD #%1")).arg(QString::number(dvd));
+ l14->setText(s);
+ }
+ propertiesGrid->addWidget(l13, 6, 0);
+ propertiesGrid->addWidget(l14, 6, 1);
+ QHBoxLayout *actorsPropertiesLayout = new QHBoxLayout;
+ actorsPropertiesLayout->addWidget(mActors);
+ actorsPropertiesLayout->addLayout(propertiesGrid);
+ mainLayout->addLayout(actorsPropertiesLayout);
+
+ //close button
+ mClose = new QPushButton(tr("Close"));
+ connect(mClose, SIGNAL(clicked()), this, SLOT(reject()));
+ QHBoxLayout *closeButtonLayout = new QHBoxLayout;
+ closeButtonLayout->addStretch();
+ closeButtonLayout->addWidget(mClose);
+ closeButtonLayout->addStretch();
+ mainLayout->addLayout(closeButtonLayout);
+
+ setLayout(mainLayout);
+ QString winTitle = QString("%1 - Properties of %2").arg(qApp->applicationName()).arg(title);
+ setWindowTitle(winTitle);
+
+ if(!mCovers.isEmpty()){
+ mIndex = 0;
+ }
+ setCover(mIndex);
+
+}
+
+void MoviePropertiesDialog::setCover(int index){
+ mScene->clear();
+ if((index < 0) || (index >= mCovers.size())){
+ QGraphicsTextItem *item = new QGraphicsTextItem(tr("No covers"));
+ QFont font = QFont("Courier new", 30 , QFont::Bold);
+ item->setFont(font);
+ item->setDefaultTextColor(Qt::red);
+ item->rotate(45);
+ mScene->addItem(item);
+ item->setPos(0, 0);
+ mNext->setEnabled(false);
+ mPrev->setEnabled(false);
+ }else{
+ QPixmap pm(mCovers.at(index));
+ QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pm);
+ mScene->addItem(item);
+ item->setPos(0, 0);
+ }
+}
+
+void MoviePropertiesDialog::nextCover(){
+ if(mIndex < 0){
+ return;
+ }
+ ++mIndex;
+ if(mIndex >= mCovers.size()){
+ mIndex = 0;
+ }
+ setCover(mIndex);
+}
+
+void MoviePropertiesDialog::previousCover(){
+ if(mIndex < 0){
+ return;
+ }
+ --mIndex;
+ if(mIndex < 0){
+ mIndex = mCovers.size() - 1;
+ }
+ setCover(mIndex);
}
void MoviePropertiesDialog::covers(){
@@ -63,3 +204,12 @@ void MoviePropertiesDialog::covers(){
}
}
}
+
+const QString MoviePropertiesDialog::actorHtml(const QStringList &actors) const{
+ QString retval("<html><body><ul>");
+ foreach(QString a, actors){
+ retval.append(QString("<li>%1</li>").arg(a));
+ }
+ retval.append("</ul></body></html>");
+ return retval;
+}
diff --git a/moviepropertiesdialog.h b/moviepropertiesdialog.h
index 457c5e1..c634816 100644
--- a/moviepropertiesdialog.h
+++ b/moviepropertiesdialog.h
@@ -22,10 +22,13 @@ class MoviePropertiesDialog : public QDialog {
~MoviePropertiesDialog() {};
private slots:
- void setPic(int index);
+ void setCover(int index);
+ void nextCover();
+ void previousCover();
private:
void covers();
+ const QString actorHtml(const QStringList &actors) const;
QGraphicsView *mView;
QGraphicsScene *mScene;
QPushButton *mNext;
diff --git a/shemov.cpp b/shemov.cpp
index f631f3e..4dc03b7 100644
--- a/shemov.cpp
+++ b/shemov.cpp
@@ -230,6 +230,9 @@ void SheMov::createActions(){
mAddMovieManuallyA = new QAction(tr("Add movie manually..."), this);
mAVWidget->fileView()->addAction(mAddMovieManuallyA);
connect(mAddMovieManuallyA, SIGNAL(triggered()), mAVWidget, SLOT(addMovie()));
+ mPropertiesA = new QAction(tr("Properties..."), this);
+ mAVWidget->fileView()->addAction(mPropertiesA);
+ connect(mPropertiesA, SIGNAL(triggered()), mAVWidget, SLOT(properties()));
}
void SheMov::createMenus(){
@@ -264,6 +267,7 @@ void SheMov::createMenus(){
mEditArchiveMenu = new QMenu(tr("&Edit archive"), this);
mEditArchiveMenu->addAction(mEditArchiveFileA);
mEditArchiveMenu->addAction(mEditArchiveCoverA);
+ mEditArchiveMenu->addAction(mPropertiesA);
menuBar()->addMenu(fileMenu);
mEditFSMenuA = menuBar()->addMenu(mEditFSMenu);
diff --git a/shemov.h b/shemov.h
index 0adb191..67d8da6 100644
--- a/shemov.h
+++ b/shemov.h
@@ -70,6 +70,7 @@ class SheMov : public QMainWindow {
QAction *mEditArchiveFileA;
QAction *mEditArchiveCoverA;
QAction *mAddMovieManuallyA;
+ QAction *mPropertiesA;
QList<QAction*> mExtractToA;
//EndActions