aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core')
-rw-r--r--src-qt5/core/libLumina/LVideoLabel.cpp23
-rw-r--r--src-qt5/core/libLumina/LVideoLabel.h3
-rw-r--r--src-qt5/core/libLumina/LVideoWidget.cpp12
-rw-r--r--src-qt5/core/libLumina/LVideoWidget.h3
4 files changed, 26 insertions, 15 deletions
diff --git a/src-qt5/core/libLumina/LVideoLabel.cpp b/src-qt5/core/libLumina/LVideoLabel.cpp
index bc70a292..bddb1cba 100644
--- a/src-qt5/core/libLumina/LVideoLabel.cpp
+++ b/src-qt5/core/libLumina/LVideoLabel.cpp
@@ -2,11 +2,12 @@
#include <LuminaXDG.h>
#include <QCoreApplication>
-LVideoLabel::LVideoLabel(QString file, QWidget *parent) : QLabel(parent) {
+LVideoLabel::LVideoLabel(QString file, bool icons, QWidget *parent) : QLabel(parent) {
thumbnail = QPixmap();
entered = false;
- icons = true;
+ this->icons = icons;
filepath = file;
+ defaultThumbnail = LXDG::findIcon("unknown", "").pixmap(256,256);
QTimer::singleShot(0, this, SLOT(initializeBackend()) );
}
@@ -23,6 +24,7 @@ void LVideoLabel::initializeBackend(){
mediaPlayer->setPlaybackRate(3);
mediaPlayer->setMuted(true);
+ this->setPixmap(defaultThumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
mediaPlayer->setMedia(QUrl::fromLocalFile(filepath));
mediaPlayer->play();
@@ -38,7 +40,7 @@ void LVideoLabel::enableIcons() {
}
void LVideoLabel::disableIcons() {
- this->setPixmap(LXDG::findIcon("unknown", "").pixmap(this->size()));
+ this->setPixmap(defaultThumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
icons = false;
}
@@ -47,10 +49,12 @@ void LVideoLabel::stopVideo(QPixmap pix) {
emit frameReceived(pix);
if(thumbnail.isNull())
thumbnail = pix;
- this->setPixmap(thumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
+ if(icons)
+ this->setPixmap(thumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
mediaPlayer->pause();
}else {
- this->setPixmap(pix.scaled(this->size(),Qt::IgnoreAspectRatio));
+ if(icons)
+ this->setPixmap(pix.scaled(this->size(),Qt::IgnoreAspectRatio));
}
}
@@ -84,8 +88,13 @@ void LVideoLabel::setDuration(QMediaPlayer::MediaStatus status) {
}
void LVideoLabel::resizeEvent(QResizeEvent *event) {
- if(!thumbnail.isNull()) //Resize the current pixmap to match the new size
- this->setPixmap(thumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
+ //Resize the current pixmap to match the new size
+ if(!thumbnail.isNull()){
+ if(icons)
+ this->setPixmap(thumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
+ else
+ this->setPixmap(defaultThumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
+ }
QLabel::resizeEvent(event);
}
diff --git a/src-qt5/core/libLumina/LVideoLabel.h b/src-qt5/core/libLumina/LVideoLabel.h
index 3c6b304c..56defb6a 100644
--- a/src-qt5/core/libLumina/LVideoLabel.h
+++ b/src-qt5/core/libLumina/LVideoLabel.h
@@ -10,7 +10,7 @@
class LVideoLabel : public QLabel{
Q_OBJECT
public:
- LVideoLabel(QString, QWidget* parent=NULL);
+ LVideoLabel(QString, bool, QWidget* parent=NULL);
~LVideoLabel();
void enableIcons();
void disableIcons();
@@ -34,6 +34,7 @@ class LVideoLabel : public QLabel{
QMediaPlayer *mediaPlayer;
LVideoSurface *surface;
QPixmap thumbnail;
+ QPixmap defaultThumbnail;
bool entered;
bool icons;
QString filepath;
diff --git a/src-qt5/core/libLumina/LVideoWidget.cpp b/src-qt5/core/libLumina/LVideoWidget.cpp
index b9660b10..f1f74414 100644
--- a/src-qt5/core/libLumina/LVideoWidget.cpp
+++ b/src-qt5/core/libLumina/LVideoWidget.cpp
@@ -1,20 +1,22 @@
#include "LVideoWidget.h"
-LVideoWidget::LVideoWidget(QString file, QSize iconSize, QWidget *parent) : QWidget(parent) {
- flag = false;
- iconLabel = new LVideoLabel(file, parent);
+LVideoWidget::LVideoWidget(QString file, QSize iconSize, bool icons, QWidget *parent) : QWidget(parent) {
+ iconLabel = new LVideoLabel(file, icons, parent);
textLabel = new QLabel(parent);
layout = new QHBoxLayout(this);
layout->setAlignment(Qt::AlignLeft | Qt::AlignCenter);
- layout->addWidget(iconLabel);
- layout->addWidget(textLabel);
+ layout->setContentsMargins(5,5,5,5);
layout->setStretchFactor(textLabel, 1); //make sure this always occupies all extra space
textLabel->setText(file.section("/", -1));
+ iconLabel->setGeometry(QRect(QPoint(0,0), iconSize));
iconLabel->setFixedSize(iconSize);
iconLabel->setVisible(true);
textLabel->setVisible(true);
+
+ layout->addWidget(iconLabel);
+ layout->addWidget(textLabel);
}
LVideoWidget::~LVideoWidget() {
diff --git a/src-qt5/core/libLumina/LVideoWidget.h b/src-qt5/core/libLumina/LVideoWidget.h
index 6743acb6..610fd9e5 100644
--- a/src-qt5/core/libLumina/LVideoWidget.h
+++ b/src-qt5/core/libLumina/LVideoWidget.h
@@ -8,14 +8,13 @@
class LVideoWidget : public QWidget {
Q_OBJECT
public:
- LVideoWidget(QString, QSize, QWidget* parent=NULL);
+ LVideoWidget(QString, QSize, bool icons, QWidget* parent=NULL);
~LVideoWidget();
void setIconSize(QSize);
void disableIcons();
void enableIcons();
private:
- bool flag;
LVideoLabel *iconLabel;
QLabel *textLabel;
QHBoxLayout *layout;
bgstack15