aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina
diff options
context:
space:
mode:
authorZackaryWelch <welch.zackary@gmail.com>2017-10-25 17:09:02 -0400
committerZackaryWelch <welch.zackary@gmail.com>2017-10-25 17:09:41 -0400
commit76eb44f51faee92476ed509b700be9bc30be08a7 (patch)
treee7a2229d6cf87a21ca800f04c944e3504075a3ce /src-qt5/core/libLumina
parentSpeed up some of the desktop init procedures again. (diff)
downloadlumina-76eb44f51faee92476ed509b700be9bc30be08a7.tar.gz
lumina-76eb44f51faee92476ed509b700be9bc30be08a7.tar.bz2
lumina-76eb44f51faee92476ed509b700be9bc30be08a7.zip
Fixed image previews with video thumbnails
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r--src-qt5/core/libLumina/LVideoLabel.cpp34
-rw-r--r--src-qt5/core/libLumina/LVideoLabel.h5
-rw-r--r--src-qt5/core/libLumina/LVideoWidget.cpp8
-rw-r--r--src-qt5/core/libLumina/LVideoWidget.h2
4 files changed, 35 insertions, 14 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);
}
diff --git a/src-qt5/core/libLumina/LVideoLabel.h b/src-qt5/core/libLumina/LVideoLabel.h
index f368c1a8..3c6b304c 100644
--- a/src-qt5/core/libLumina/LVideoLabel.h
+++ b/src-qt5/core/libLumina/LVideoLabel.h
@@ -12,7 +12,8 @@ class LVideoLabel : public QLabel{
public:
LVideoLabel(QString, QWidget* parent=NULL);
~LVideoLabel();
- void setShrinkPixmap(bool);
+ void enableIcons();
+ void disableIcons();
protected:
void enterEvent(QEvent*);
@@ -34,7 +35,7 @@ class LVideoLabel : public QLabel{
LVideoSurface *surface;
QPixmap thumbnail;
bool entered;
- bool shrink;
+ bool icons;
QString filepath;
};
#endif
diff --git a/src-qt5/core/libLumina/LVideoWidget.cpp b/src-qt5/core/libLumina/LVideoWidget.cpp
index 14490484..b9660b10 100644
--- a/src-qt5/core/libLumina/LVideoWidget.cpp
+++ b/src-qt5/core/libLumina/LVideoWidget.cpp
@@ -26,3 +26,11 @@ LVideoWidget::~LVideoWidget() {
void LVideoWidget::setIconSize(QSize iconSize) {
iconLabel->setFixedSize(iconSize);
}
+
+void LVideoWidget::enableIcons() {
+ iconLabel->enableIcons();
+}
+
+void LVideoWidget::disableIcons() {
+ iconLabel->disableIcons();
+}
diff --git a/src-qt5/core/libLumina/LVideoWidget.h b/src-qt5/core/libLumina/LVideoWidget.h
index c239a697..6743acb6 100644
--- a/src-qt5/core/libLumina/LVideoWidget.h
+++ b/src-qt5/core/libLumina/LVideoWidget.h
@@ -11,6 +11,8 @@ class LVideoWidget : public QWidget {
LVideoWidget(QString, QSize, QWidget* parent=NULL);
~LVideoWidget();
void setIconSize(QSize);
+ void disableIcons();
+ void enableIcons();
private:
bool flag;
bgstack15