diff options
Diffstat (limited to 'seriestreewidget.h')
-rw-r--r-- | seriestreewidget.h | 185 |
1 files changed, 0 insertions, 185 deletions
diff --git a/seriestreewidget.h b/seriestreewidget.h deleted file mode 100644 index 9740c02..0000000 --- a/seriestreewidget.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - 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 SERIESTREEWIDGET_H -#define SERIESTREEWIDGET_H - -#include <QtWidgets/QWidget> -#include <QSortFilterProxyModel> -#include <QSqlDatabase> - -#include "smdialog.h" -#include "smtreeview.h" - -class QComboBox; -class QCompleter; -class QStringListModel; -class QCheckBox; -class QSpinBox; -class SeriesTreeModel; -class SeriesTreeView; -class SeriesTreeSortModel; -class FilesTreeModel; -class AddCoverDialog; -class HoverWindow; -class CompleterProducer; - -class SeriesTreeWidget : public QWidget { - Q_OBJECT - public: - enum FilterMode { FilterSeries = 1, FilterActor = 2, FilterGenre = 3, FilterSize = 4, FilterQuality = 5, FilterFileName = 6, FilterDvdNo = 7 }; - explicit SeriesTreeWidget(QWidget *parent = 0); - virtual ~SeriesTreeWidget(); - SeriesTreeView *seriesTree() { return mView; } - SeriesTreeSortModel *seriesProxy() { return mProxy; } - - public slots: - void seriesAdded(const QString seriesName, int seriesPart, bool resort = true); - void toggleFavorite(); - void deleteFromSeries(); - void readSettings(); - void writeSettings(); - void expandCurrent(); - void addCover(); - void setFilterMode(int mode); - void filter(); - void filterFavorites(bool checked); - void expandItems(const QStringList &items = QStringList()); - - private slots: - void clearFilter(); - void resort(); - void itemExpanded(const QModelIndex &); - void itemCollaped(const QModelIndex &); - void editItem(); - void producerFinished(QStringListModel *model); - - signals: - void filesReload(); - - private: - QLineEdit *mFilterEdit; - QPushButton *mFilter; - QPushButton *mClear; - SeriesTreeView *mView; - SeriesTreeSortModel *mProxy; - SeriesTreeModel *mModel; - AddCoverDialog *mCoverDialog; - QStringList mExpandedItems; - int mFilterMode; - QCompleter *mFilterCompleter; - QThread *mCompleterProducerThread; - CompleterProducer *mCompleterProducer; - QString mOldFilterText; -}; - -class SeriesTreeView : public SmTreeView { - Q_OBJECT - public: - explicit SeriesTreeView(QWidget *parent = 0); - - public slots: - void readSettings(); - - protected: - virtual void contextMenuEvent(QContextMenuEvent *e); - virtual bool event(QEvent *event); - - private: - bool exitHover(bool exitVal = true); - QStringList children(const QModelIndex &idx) const; - QModelIndex mCurHover; - HoverWindow *mHoverWin; - bool mHover; - qint16 mCursorOffset; -}; - - -class SeriesTreeSortModel : public QSortFilterProxyModel { - Q_OBJECT - public: - SeriesTreeSortModel(QObject *parent = 0); - ~SeriesTreeSortModel() {} - bool acceptedByFilter(int source_row, const QModelIndex &parent) const { return filterAcceptsRow(source_row, parent); } - - protected: - virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; - virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; -}; - -class AddCoverDialog : public SmDialog { - Q_OBJECT - public: - explicit AddCoverDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); - const QString file() const; - int fileType() const { return mCurrentType; } - - private slots: - void selectFile(); - void typeChanged(const QString &type); - - private: - QLineEdit *mFile; - QComboBox *mFileType; - QPushButton *mSelectFile; - QPushButton *mOk; - QPushButton *mCancel; - QString mLastOpenedDir; - int mCurrentType; - FilesTreeModel *mFilesModel; -}; - -class EditSeriesDialog : public QDialog { - Q_OBJECT - public: - explicit EditSeriesDialog(const QModelIndex &idx, QWidget *parent = 0); - - public slots: - void accept(); - - private slots: - void hasPartNoStateChanged(int state); - - private: - QLineEdit *mTitle; - QLineEdit *mSubtitle; - QCheckBox *mFavorite; - QCheckBox *mHasPartNo; - QSpinBox *mPartNo; - QPushButton *mOk; - QPushButton *mCancel; - const QPersistentModelIndex mIdx; -}; - -class CompleterProducer : public QObject { - Q_OBJECT - public: - CompleterProducer(int Mode = SeriesTreeWidget::FilterSeries, QObject *parent = 0); - ~CompleterProducer(); - - public slots: - void produce(); - void setMode(int mode) { mMode = mode; } - - signals: - void done(QStringListModel *model); - - private: - QStringListModel *mModel; - int mMode; - QSqlDatabase mDb; - QSqlQuery *mSeriesQuery; - QSqlQuery *mActorsQuery; - QSqlQuery *mGenresQuery; - QSqlQuery *mSizeQuery; - QSqlQuery *mQualityQuery; - QSqlQuery *mFileNameQuery; - QSqlQuery *mDvdNoQuery; - QHash<int, QSqlQuery*> mQueryHash; -}; - -#endif |