From 5cde173217fd8cb1dbc21f3ac54f18e8234e709b Mon Sep 17 00:00:00 2001 From: Arno Date: Thu, 10 Nov 2016 05:02:44 +0100 Subject: New feature: Add Origin Since SheMov now displays origin files (i.e. source files for a reencode), add an option here to add origin files for already archived movies. We guess the archived movie from the filename by cutting off the extension and look it up in the files table. If we find an archived movie with that filename, mark the source blue. Deactive "Add" if we don't find one or if we already have an origin. --- filewidget.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'filewidget.h') diff --git a/filewidget.h b/filewidget.h index b9133e2..ef18603 100644 --- a/filewidget.h +++ b/filewidget.h @@ -18,12 +18,12 @@ class QAction; class QMimeData; class VideoSorter; class FileDisplay; - +class OriginDialog; class FileWidget : public QWidget { Q_OBJECT public: - enum FileAttrs { NotPresent = 0, Present = 1, NoVideo = 2, ParentDir = 3, Directory = 4 }; + enum FileAttrs { NotPresent = 0, Present = 1, NoVideo = 2, ParentDir = 3, Directory = 4, Origin = 5 }; enum CustomRoles { AttrsRole = Qt::UserRole + 1, FullPathRole = Qt::UserRole + 2, DurationRole = Qt::UserRole + 3, MD5SumRole = Qt::UserRole + 4, SecondsRole = Qt::UserRole + 5 }; enum { ColumnCount = 5 }; enum Columns { IconColumn = 0, NameColumn = 1, MimeColumn = 2, DurationColumn = 3, Md5Column = 4 }; @@ -56,6 +56,7 @@ class FileWidget : public QWidget { void cut(); void paste(); void selectFirst(); + void addAsOrigin(); protected: virtual void keyPressEvent(QKeyEvent *e); @@ -66,6 +67,7 @@ class FileWidget : public QWidget { void createActions(); void fileData(const QString &fullPath, const QString &md5); int md5Count(const QString &md5); + bool haveOrigin(const QString filename); void readHeaderData(); void writeHeaderData(); void readSettings(); @@ -84,6 +86,7 @@ class FileWidget : public QWidget { QSqlDatabase mDb; QSqlQuery mQOrigin; QSqlQuery mQFiles; + QSqlQuery mQSimilar; QMimeData *mMimeData; QAction *mSelDirA; QAction *mRefreshA; @@ -94,8 +97,10 @@ class FileWidget : public QWidget { QAction *mCutA; QAction *mPasteA; QAction *mDeleteA; + QAction *mAddAsOriginA; FileDisplay *mFileDisplay; VideoSorter *mProxy; + OriginDialog *mOrignDlg; int mFileAction; }; -- cgit v1.2.3-70-g09d2