summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-08-22 17:16:55 +0200
committerArno <am@disconnect.de>2013-08-22 17:16:55 +0200
commit0bc6f9d81ceb45be47d09880c9ec139e2cf371e2 (patch)
treeeb163c9a6d82a38a291346ab7a08ea9bb78b56cf
parenta74ed29b3cdac32e4ca1a5480e806798a7ddb0eb (diff)
downloadSheMov-0bc6f9d81ceb45be47d09880c9ec139e2cf371e2.tar.gz
SheMov-0bc6f9d81ceb45be47d09880c9ec139e2cf371e2.tar.bz2
SheMov-0bc6f9d81ceb45be47d09880c9ec139e2cf371e2.zip
Enhance preview
* Show time when snapshot was taken. * Align the snapshots properly. * Show BusyCursor when generating preview.
-rw-r--r--archivecontroller.cpp2
-rw-r--r--helper.cpp24
2 files changed, 21 insertions, 5 deletions
diff --git a/archivecontroller.cpp b/archivecontroller.cpp
index c0ecb0c..234eab4 100644
--- a/archivecontroller.cpp
+++ b/archivecontroller.cpp
@@ -187,7 +187,9 @@ void ArchiveController::showPreview(){
if(!fi.exists()){
pv->setFile();
}else if(sel.first().data(ArchiveFilesModel::FileTypeRole).toInt() == ArchiveFilesModel::Movie){
+ mArchiveFiles->setCursor(Qt::BusyCursor);
QPixmap preview = Helper::preview(first);
+ mArchiveFiles->setCursor(Qt::ArrowCursor);
if(!preview.isNull()){
pv->setPixmap(preview);
pv->show();
diff --git a/helper.cpp b/helper.cpp
index 7349b09..cff490c 100644
--- a/helper.cpp
+++ b/helper.cpp
@@ -260,13 +260,15 @@ namespace Helper {
retval.fill(Qt::transparent);
QPainter p(&retval);
QImage img1 = snapshot(path, 20);
- p.drawImage(0, 0, img1);
+ int yOff = (480 - img1.height()) / 2;
+ yOff = yOff < 0 ? 0 : yOff;
+ p.drawImage(0, yOff, img1);
QImage img2 = snapshot(path, interval * 2);
- p.drawImage(680, 0, img2);
+ p.drawImage(680, yOff, img2);
QImage img3 = snapshot(path, interval * 3);
- p.drawImage(0, 520, img3);
+ p.drawImage(0, 520 + yOff, img3);
QImage img4 = snapshot(path, secs - 60);
- p.drawImage(680, 520, img4);
+ p.drawImage(680, 520 + yOff, img4);
QPixmap pmretval = QPixmap::fromImage(retval);
return pmretval;
}
@@ -287,7 +289,19 @@ namespace Helper {
ffproc.waitForFinished();
}
QImage retval(tf.fileName());
- return retval.scaledToWidth(640);
+ retval = retval.scaledToWidth(640);
+ Duration dur(where);
+ QFont font("courier", 10);
+ QFontMetrics fm(font);
+ int width = fm.width(dur.toString());
+ int height = fm.height();
+ QPainter p(&retval);
+ p.setBrush(QBrush(QColor(255, 255, 255, 70)));
+ QRect durRect(640 / 2 - width / 2 - 4, retval.height() - height - 8, width + 4, height + 4);
+ p.drawRect(durRect);
+ p.setPen(Qt::black);
+ p.drawText(durRect, Qt::AlignCenter, dur.toString());
+ return retval;
}
QVariant picSize(const QString &path){