aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/libLumina/LVideoLabel.cpp31
-rw-r--r--src-qt5/core/libLumina/LVideoLabel.h11
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.cpp4
3 files changed, 27 insertions, 19 deletions
diff --git a/src-qt5/core/libLumina/LVideoLabel.cpp b/src-qt5/core/libLumina/LVideoLabel.cpp
index 3b2ce468..dcc0ad58 100644
--- a/src-qt5/core/libLumina/LVideoLabel.cpp
+++ b/src-qt5/core/libLumina/LVideoLabel.cpp
@@ -1,16 +1,28 @@
#include "LVideoLabel.h"
-
+#include <QTimer>
LVideoLabel::LVideoLabel(QString file, QWidget *parent) : QLabel(parent) {
this->setScaledContents(true);
- mediaPlayer = new QMediaPlayer(this, QMediaPlayer::VideoSurface);
- thumbnail = QPixmap();
- this->setPixmap(thumbnail);
+ this->setPixmap(thumbnail); //blank pixmap by default
entered = false;
+ filepath = file;
+ QTimer::singleShot(0, this, SLOT(initializeBackend()) );
+}
+
+LVideoLabel::~LVideoLabel() {
+
+}
+
+void LVideoLabel::setShrinkPixmap(bool shrink) {
+ this->shrink = shrink;
+}
+
+void LVideoLabel::initializeBackend(){
+ mediaPlayer = new QMediaPlayer(this, QMediaPlayer::VideoSurface);
surface = new LVideoSurface(this);
mediaPlayer->setVideoOutput(surface);
mediaPlayer->setPlaybackRate(3);
mediaPlayer->setMuted(true);
- mediaPlayer->setMedia(QUrl("file://" + file));
+ mediaPlayer->setMedia(QUrl::fromLocalFile(filepath));
mediaPlayer->play();
mediaPlayer->pause();
@@ -19,15 +31,6 @@ LVideoLabel::LVideoLabel(QString file, QWidget *parent) : QLabel(parent) {
this->connect(this, SIGNAL(rollOver()), surface, SLOT(switchRollOver()));
}
-LVideoLabel::~LVideoLabel() {
- mediaPlayer->deleteLater();
- delete surface;
-}
-
-void LVideoLabel::setShrinkPixmap(bool shrink) {
- this->shrink = shrink;
-}
-
void LVideoLabel::stopVideo(QPixmap pix) {
if(!entered) {
emit frameReceived(pix);
diff --git a/src-qt5/core/libLumina/LVideoLabel.h b/src-qt5/core/libLumina/LVideoLabel.h
index fa590e5a..110e3305 100644
--- a/src-qt5/core/libLumina/LVideoLabel.h
+++ b/src-qt5/core/libLumina/LVideoLabel.h
@@ -1,5 +1,5 @@
-#ifndef LVIDEOLABEL_H
-#define LVIDEOLABEL_H
+#ifndef LVIDEOLABEL_H
+#define LVIDEOLABEL_H
#include <QLabel>
#include <QMediaPlayer>
@@ -13,21 +13,26 @@ class LVideoLabel : public QLabel {
LVideoLabel(QString, QWidget* parent=NULL);
~LVideoLabel();
void setShrinkPixmap(bool);
-
+
protected:
void enterEvent(QEvent*);
void leaveEvent(QEvent*);
+
signals:
void rollOver();
void frameReceived(QPixmap);
+
private slots:
+ void initializeBackend();
void stopVideo(QPixmap);
void setDuration(QMediaPlayer::MediaStatus);
+
private:
QMediaPlayer *mediaPlayer;
LVideoSurface *surface;
QPixmap thumbnail;
bool entered;
bool shrink;
+ QString filepath;
};
#endif
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.cpp b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
index d829fff0..a68b8580 100644
--- a/src-qt5/desktop-utils/lumina-fm/Browser.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
@@ -103,13 +103,13 @@ void Browser::futureFinished(QString name, QImage icon){
//Note: this will be called once for every item that loads
//Haven't added the extra files in a directory fix, but that should be easy to do
//Try to load a file with multiple videos and lots of other stuff before any other directory. It crashes for some reason
- qDebug() << name << "here";
+ //qDebug() << name << "here";
QIcon *ico = new QIcon();
LFileInfo *info = new LFileInfo(name);
if(!icon.isNull() && showThumbs){
QPixmap pix = QPixmap::fromImage(icon);
ico->addPixmap(pix);
- }else if(videoFormats.contains(name.section(".",-1).toLower())) {
+ }else if(info->isVideo() && showThumbs) {
if(videoImages.find(name) == videoImages.end()) {
LVideoLabel *mediaLabel = new LVideoLabel(name);
while(mediaLabel->pixmap()->isNull()) { QCoreApplication::processEvents(QEventLoop::AllEvents, 50); }
bgstack15