diff options
author | ZackaryWelch <welch.zackary@gmail.com> | 2017-10-25 17:09:02 -0400 |
---|---|---|
committer | ZackaryWelch <welch.zackary@gmail.com> | 2017-10-25 17:09:41 -0400 |
commit | 76eb44f51faee92476ed509b700be9bc30be08a7 (patch) | |
tree | e7a2229d6cf87a21ca800f04c944e3504075a3ce /src-qt5/core/libLumina/LVideoLabel.cpp | |
parent | Speed up some of the desktop init procedures again. (diff) | |
download | lumina-76eb44f51faee92476ed509b700be9bc30be08a7.tar.gz lumina-76eb44f51faee92476ed509b700be9bc30be08a7.tar.bz2 lumina-76eb44f51faee92476ed509b700be9bc30be08a7.zip |
Fixed image previews with video thumbnails
Diffstat (limited to 'src-qt5/core/libLumina/LVideoLabel.cpp')
-rw-r--r-- | src-qt5/core/libLumina/LVideoLabel.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src-qt5/core/libLumina/LVideoLabel.cpp b/src-qt5/core/libLumina/LVideoLabel.cpp index af23330c..bc70a292 100644 --- a/src-qt5/core/libLumina/LVideoLabel.cpp +++ b/src-qt5/core/libLumina/LVideoLabel.cpp @@ -1,10 +1,11 @@ #include "LVideoLabel.h" +#include <LuminaXDG.h> #include <QCoreApplication> LVideoLabel::LVideoLabel(QString file, QWidget *parent) : QLabel(parent) { thumbnail = QPixmap(); entered = false; - shrink = true; + icons = true; filepath = file; QTimer::singleShot(0, this, SLOT(initializeBackend()) ); @@ -15,10 +16,6 @@ LVideoLabel::~LVideoLabel() { surface->deleteLater(); } -void LVideoLabel::setShrinkPixmap(bool shrink) { - this->shrink = shrink; -} - void LVideoLabel::initializeBackend(){ mediaPlayer = new QMediaPlayer(this, QMediaPlayer::VideoSurface); surface = new LVideoSurface(this); @@ -35,6 +32,15 @@ void LVideoLabel::initializeBackend(){ this->connect(this, SIGNAL(rollOver()), surface, SLOT(switchRollOver())); } +void LVideoLabel::enableIcons() { + this->setPixmap(thumbnail.scaled(this->size(),Qt::IgnoreAspectRatio)); + icons = true; +} + +void LVideoLabel::disableIcons() { + this->setPixmap(LXDG::findIcon("unknown", "").pixmap(this->size())); + icons = false; +} void LVideoLabel::stopVideo(QPixmap pix) { if(!entered) { @@ -85,17 +91,21 @@ void LVideoLabel::resizeEvent(QResizeEvent *event) { //Start playing the video from the beginning when the mouse enters the label void LVideoLabel::enterEvent(QEvent *event) { - entered=true; - emit rollOver(); - mediaPlayer->setPosition(0); - mediaPlayer->play(); + if(icons) { + entered=true; + emit rollOver(); + mediaPlayer->setPosition(0); + mediaPlayer->play(); + } QWidget::enterEvent(event); } //Stop the video and set the thumbnail back to the middle of the video when the mouse leaves the label void LVideoLabel::leaveEvent(QEvent *event) { - entered=false; - mediaPlayer->setPosition(mediaPlayer->duration() / 2); - emit rollOver(); + if(icons) { + entered=false; + mediaPlayer->setPosition(mediaPlayer->duration() / 2); + emit rollOver(); + } QWidget::leaveEvent(event); } |