From f4a2553aa56939721bcd82d8ad9bffbaecd0647a Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 9 Jan 2011 12:52:09 +0100 Subject: 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. --- newmoviewizard.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'newmoviewizard.cpp') diff --git a/newmoviewizard.cpp b/newmoviewizard.cpp index f5fe333..99c2f8d 100644 --- a/newmoviewizard.cpp +++ b/newmoviewizard.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #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(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 ¤t, 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); -- cgit v1.2.3-70-g09d2