/* 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 NEWMOVIEWIZARD_H #define NEWMOVIEWIZARD_H #include #include #include #include "smtreemodel.h" #include "mappingtablewidget.h" class QTreeView; class QLineEdit; class QSpinBox; class QPushButton; class QComboBox; class QCheckBox; class QStringListModel; class WizardTreeModel; class SmTreeItem; class MovieInfoPage; class MovieMappingPage; class NewMovieWizard : public QWizard { Q_OBJECT public: explicit NewMovieWizard(QWidget *parent = 0); void accept(); MovieInfoPage *infoPage() { return mInfoPage; } MovieMappingPage *actorPage() { return mActorPage; } MovieMappingPage *genrePage() { return mGenrePage; } signals: void seriesAdded(const QString series, int seriesPart); private: MovieInfoPage *mInfoPage; MovieMappingPage *mActorPage; MovieMappingPage *mGenrePage; }; class MovieInfoPage : public QWizardPage { Q_OBJECT public: explicit MovieInfoPage(QWidget *parent = 0); WizardTreeModel *model() { return mFileModel; } virtual void initializePage(); void addFile(const QString &file); private slots: void addFiles(); void removeFile(); void onDvd(int); void typeChanged(QString); void seriesPartChanged(int); void setNextDvdNo(); void initModel(); void fileSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous); private: void setupGui(); QTreeView *mFileView; QLineEdit *mTitle; QSpinBox *mSeriesNo; QSpinBox *mPartno; QSpinBox *mQuality; QSpinBox *mDvdNo; QPushButton *mAddFile; QPushButton *mRemoveFile; QComboBox *mFileType; QCheckBox *mOnDvd; QPushButton *mNextDvdNo; WizardTreeModel *mFileModel; SmTreeItem *mMoviesItem; SmTreeItem *mCoversItem; }; class MovieMappingPage : public QWizardPage { Q_OBJECT public: explicit MovieMappingPage(const QString &table, QWidget *parent = 0); MappingTableItemModel *model() { return mWidget->model(); } virtual void initializePage(); private: MappingTableWidget *mWidget; }; class WizardTreeModel : public SmTreeModel { Q_OBJECT public: enum CustomRoles { FileNameRole = Qt::UserRole + 1, FileSizeRole = Qt::UserRole + 2, FileTypeRole = Qt::UserRole + 3, FilePartRole = Qt::UserRole + 4, FullPathRole = Qt::UserRole + 5 }; enum Fields { FileName = 0, FileSize = 1, FileType = 2, FilePart = 3, FullPath = 4 }; enum Types { Movie = 1, FrontCover = 2, BackCover = 3, GeneralCover = 4 }; explicit WizardTreeModel(QStringList &headers, QObject *parent = 0); virtual ~WizardTreeModel() {} //data + flags virtual QVariant data(const QModelIndex &index, int role) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; QHash files(); int filesPart(const QString &fullPath) const; //file types QStringList types() const; int typeId(const QString &value) const; QString typeName(int typeId) const; private: QHash mFileTypeMap; QHash mFilePartMap; }; #endif