summaryrefslogtreecommitdiffstats
path: root/viewer.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2016-11-27 20:25:49 +0100
committerArno <arno@disconnect.de>2016-11-27 20:25:49 +0100
commitc7e3315b663566f71f83dcc9d2259aac262081c1 (patch)
treed228aa2a385f6097efe319160a01f1d890d78b5b /viewer.cpp
parentf5b9109987cd19bbc69e7a20f7a73ac3d86be96a (diff)
downloadShemovCleaner-c7e3315b663566f71f83dcc9d2259aac262081c1.tar.gz
ShemovCleaner-c7e3315b663566f71f83dcc9d2259aac262081c1.tar.bz2
ShemovCleaner-c7e3315b663566f71f83dcc9d2259aac262081c1.zip
Add preview for videos
Grab 4 frames from a video and display them in the Viewer. First frame is @00:01:00, last at length - 1 minute, and the other two are in between: length / 4 * 2 and 3 (hardcoded).
Diffstat (limited to 'viewer.cpp')
-rw-r--r--viewer.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/viewer.cpp b/viewer.cpp
index 5b35b96..cd17b6a 100644
--- a/viewer.cpp
+++ b/viewer.cpp
@@ -7,6 +7,7 @@
#include <QDir>
#include <QWheelEvent>
+#include "helper.h"
#include "viewer.h"
Viewer::Viewer(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), mCurIndex(-1) {
@@ -43,7 +44,21 @@ void Viewer::setFile(const QString &file, bool allFiles){
}
}
+void Viewer::preview(const QString &file){
+ mFiles.clear();
+ mCurIndex = -1;
+ QPixmap pm = Helper::preview(file);
+ mLabel->setPixmap(pm);
+ QString winTitle = QString(tr("%1 Viewer: [Preview %2]")).arg(qApp->applicationName()).arg(file);
+ setWindowTitle(winTitle);
+ adjustSize();
+}
+
+
void Viewer::wheelEvent(QWheelEvent *event){
+ if(mCurIndex == -1){
+ return;
+ }
QPoint numDeg = event->angleDelta() / 8;
if(numDeg.y() < 0){ //this is scrolling down -> next!
if(mCurIndex + 1 >= mFiles.count()){