diff options
author | Arno <am@disconnect.de> | 2010-11-27 12:28:34 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-11-27 12:28:34 +0100 |
commit | da30a02976792a07c72e8be01aebde019a6a09d5 (patch) | |
tree | 7643cddb956a258eea9aeda2990313fd6fa92d32 /archivetreeview.h | |
parent | 0f3f7598e4a3ee58c330cc7424cf89ea3e692da0 (diff) | |
download | SheMov-da30a02976792a07c72e8be01aebde019a6a09d5.tar.gz SheMov-da30a02976792a07c72e8be01aebde019a6a09d5.tar.bz2 SheMov-da30a02976792a07c72e8be01aebde019a6a09d5.zip |
Implemented dialog for showing movies without covers
Implemented a new dialog to show movies without covers. The view is a
QTreeView with another model. While working on the model several
shortcomings of SmTreeModel were resolved. findValue() now takes another
argument to indicate the column the returned QModelIndex() should
represent. Also, itemAt() was promoted from private to protected. It's
quite useful for derived classes.
Diffstat (limited to 'archivetreeview.h')
-rw-r--r-- | archivetreeview.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/archivetreeview.h b/archivetreeview.h index ddfad7e..2789298 100644 --- a/archivetreeview.h +++ b/archivetreeview.h @@ -11,6 +11,11 @@ #include <QWidget> #include <QModelIndexList> #include <QList> +#include <QSqlDatabase> +#include <QTreeView> +#include <QDialog> + +#include "smtreemodel.h" class SeriesTreeWidget; class FilesTreeWidget; @@ -18,7 +23,12 @@ class FilesTreeModel; class SeriesTreeModel; class MappingTableWidget; class MappingTableModel; +class NoCoverMovieDialog; class QItemSelection; +class QSqlQuery; +class QPushButton; +class QContextMenuEvent; +class QLabel; class ArchiveTreeView : public QWidget { @@ -35,6 +45,8 @@ class ArchiveTreeView : public QWidget public slots: void setFileViewMode(int mode); void cleanDatabase(const QString &table); + void showNoCoverDialog(); + void selectMovie(const QModelIndex &idx); private slots: void currentChanged(const QItemSelection &selected, const QItemSelection &deselected); @@ -59,6 +71,62 @@ class ArchiveTreeView : public QWidget //misc QString mWindowTitle; + NoCoverMovieDialog *mNoCoverDialog; +}; + +class NoCoverMovieModel : public SmTreeModel { + Q_OBJECT + public: + enum CustomRoles { SeriesNameRole = Qt::UserRole + 1, SeriesPartRole = Qt::UserRole + 2, SeriesIdRole = Qt::UserRole + 3 }; + enum Fields { Display = 0, SeriesName = 1, SeriesPart = 2, SeriesId = 3 }; + explicit NoCoverMovieModel(const QStringList &headers, QObject *parent = 0); + virtual ~NoCoverMovieModel() {} + virtual QVariant data(const QModelIndex &index, int role) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + + public slots: + void refresh(); + + signals: + void refreshed(); + + private: + QSqlDatabase mDb; + QSqlQuery *mDataQuery; +}; + +class NoCoverMovieView : public QTreeView { + Q_OBJECT + public: + explicit NoCoverMovieView(QWidget *parent = 0); + virtual ~NoCoverMovieView() {} + + protected: + void contextMenuEvent(QContextMenuEvent *e); +}; + +class NoCoverMovieDialog : public QDialog { + Q_OBJECT + public: + explicit NoCoverMovieDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); + virtual ~NoCoverMovieDialog() {} + NoCoverMovieView *view() { return mView; } + + private slots: + void openInBrowser(); + void copyToClipboard(); + void updateLabel(); + + private: + const QString selectedText() const; + const QString labelText() const; + QPushButton *mClose; + QPushButton *mRefresh; + NoCoverMovieView *mView; + NoCoverMovieModel *mModel; + QLabel *mMovieLabel; + QAction *mCopyA; + QAction *mBrowserA; }; #endif |