summaryrefslogtreecommitdiffstats
path: root/newmoviewizard.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2011-01-09 12:52:09 +0100
committerArno <am@disconnect.de>2011-01-09 12:52:09 +0100
commitf4a2553aa56939721bcd82d8ad9bffbaecd0647a (patch)
treefa8c2374d125c5b139a3977bbb3d450568076b21 /newmoviewizard.cpp
parent9603ec4b1e8cb85770f2d6b69dbe31a0fcff44f7 (diff)
downloadSheMov-f4a2553aa56939721bcd82d8ad9bffbaecd0647a.tar.gz
SheMov-f4a2553aa56939721bcd82d8ad9bffbaecd0647a.tar.bz2
SheMov-f4a2553aa56939721bcd82d8ad9bffbaecd0647a.zip
Use pictureViewer in NewMovieWizard
Optionally show a frame or the picture in PictureViewer when clicking an item in the file list. Added a new function to SmGlobals::FrameCache: make it possible to retrieve the path of the frame, also.
Diffstat (limited to 'newmoviewizard.cpp')
-rw-r--r--newmoviewizard.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/newmoviewizard.cpp b/newmoviewizard.cpp
index f5fe333..99c2f8d 100644
--- a/newmoviewizard.cpp
+++ b/newmoviewizard.cpp
@@ -21,6 +21,7 @@
#include <QCheckBox>
#include <QMessageBox>
#include <QFile>
+#include <QSettings>
#include "newmoviewizard.h"
#include "smtreeitem.h"
@@ -31,6 +32,7 @@
#include "mappingtablemodel.h"
#include "filestreemodel.h"
#include "helper.h"
+#include "pictureviewer.h"
NewMovieWizard::NewMovieWizard(QWidget *parent) : QWizard(parent){
mInfoPage = new MovieInfoPage;
@@ -115,6 +117,10 @@ void NewMovieWizard::accept(){
MappingTableModel *genreModel = static_cast<MappingTableModel*>(SmGlobals::instance()->model("genres"));
genreModel->setMappings(genres, seriesPartId);
+ //make picviewer setting persistent
+ QSettings s;
+ s.setValue("ui/archiveusepicviewer", field("usePicViewer"));
+
//done
emit seriesAdded(series, seriesno);
QDialog::accept();
@@ -122,6 +128,8 @@ void NewMovieWizard::accept(){
MovieInfoPage::MovieInfoPage(QWidget *parent) : QWizardPage(parent){
setupGui();
+ mPicViewer = SmGlobals::instance()->pictureViewer();
+ connect(mFileView, SIGNAL(clicked(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
}
void MovieInfoPage::setupGui(){
@@ -214,12 +222,22 @@ void MovieInfoPage::setupGui(){
mDvdNo->setEnabled(false);
mNextDvdNo->setEnabled(false);
+ //picviewer
+ QHBoxLayout *picViewerLayout = new QHBoxLayout;
+ picViewerLayout->setAlignment(Qt::AlignRight | Qt::AlignHCenter);
+ mUsePicViewer = new QCheckBox(tr("Use picture viewer when selecting item"));
+ picViewerLayout->addWidget(mUsePicViewer);
+ QSettings s;
+ bool usePicViewer = s.value("ui/archiveusepicviewer", false).toBool();
+ mUsePicViewer->setChecked(usePicViewer);
+
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(mFileView);
mainLayout->addLayout(fileButtonLayout);
mainLayout->addLayout(movieTitleLayout);
mainLayout->addLayout(numberLayout);
mainLayout->addLayout(dvdLayout);
+ mainLayout->addLayout(picViewerLayout);
setLayout(mainLayout);
//expose data
@@ -229,6 +247,7 @@ void MovieInfoPage::setupGui(){
registerField("quality", mQuality);
registerField("dvdNo", mDvdNo);
registerField("onDvd", mOnDvd);
+ registerField("usePicViewer", mUsePicViewer);
}
void MovieInfoPage::initializePage(){
@@ -376,6 +395,30 @@ void MovieInfoPage::fileSelectionChanged(const QModelIndex &current, const QMode
}
}
+void MovieInfoPage::itemClicked(const QModelIndex &index){
+ if(!field("usePicViewer").toBool()){
+ return;
+ }
+ int type = index.data(WizardTreeModel::FileTypeRole).toInt();
+ switch(type){
+ case WizardTreeModel::Movie:{
+ QString framePath = SmGlobals::instance()->frameCache()->entryPath(index.data(WizardTreeModel::FullPathRole).toString(), QString());
+ mPicViewer->showPic(framePath, false);
+ break;
+ }
+ case WizardTreeModel::FrontCover:
+ case WizardTreeModel::BackCover:
+ case WizardTreeModel::GeneralCover:
+ mPicViewer->showPic(index.data(WizardTreeModel::FullPathRole).toString(), false);
+ break;
+ default:
+ mPicViewer->setVisible(false);
+ return;
+ }
+ mPicViewer->setVisible(true);
+ mPicViewer->raise();
+}
+
MovieMappingPage::MovieMappingPage(const QString &table, QWidget *parent) : QWizardPage(parent){
QString title = QString(tr("Edit %1")).arg(table);
QString subTitle = QString(tr("Edit %1 by adding them from the text field below")).arg(table);