aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-11-14 15:53:30 -0500
committerKen Moore <ken@ixsystems.com>2017-11-14 15:53:30 -0500
commitb2eb3023b7f9a922011a1120060cadf0fd19127f (patch)
tree86e8d8e0bb91044250f799946ed5797ac01c5687
parentFix up the insertion of files from multiple directories within the tar backend. (diff)
downloadlumina-b2eb3023b7f9a922011a1120060cadf0fd19127f.tar.gz
lumina-b2eb3023b7f9a922011a1120060cadf0fd19127f.tar.bz2
lumina-b2eb3023b7f9a922011a1120060cadf0fd19127f.zip
A few tweaks for teh LVideoLabel - trying to get it loading a bit more reliably.
Also disable the LVideoLabel from being used at the moment in lumina-fm - needs a bit more work before we turn this on for everybody.
-rw-r--r--src-qt5/core/libLumina/LVideoLabel.cpp14
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp14
-rw-r--r--src-qt5/desktop-utils/lumina-fm/main.cpp2
3 files changed, 19 insertions, 11 deletions
diff --git a/src-qt5/core/libLumina/LVideoLabel.cpp b/src-qt5/core/libLumina/LVideoLabel.cpp
index bddb1cba..93e95afd 100644
--- a/src-qt5/core/libLumina/LVideoLabel.cpp
+++ b/src-qt5/core/libLumina/LVideoLabel.cpp
@@ -1,15 +1,15 @@
#include "LVideoLabel.h"
#include <LuminaXDG.h>
#include <QCoreApplication>
+#include <QTimer>
LVideoLabel::LVideoLabel(QString file, bool icons, QWidget *parent) : QLabel(parent) {
thumbnail = QPixmap();
entered = false;
this->icons = icons;
filepath = file;
- defaultThumbnail = LXDG::findIcon("unknown", "").pixmap(256,256);
-
- QTimer::singleShot(0, this, SLOT(initializeBackend()) );
+ defaultThumbnail = LXDG::findIcon("media-playback-start", "").pixmap(256,256);
+ QTimer::singleShot(qrand()%10, this, SLOT(initializeBackend()) );
}
LVideoLabel::~LVideoLabel() {
@@ -23,15 +23,17 @@ void LVideoLabel::initializeBackend(){
mediaPlayer->setVideoOutput(surface);
mediaPlayer->setPlaybackRate(3);
mediaPlayer->setMuted(true);
-
+
this->setPixmap(defaultThumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
mediaPlayer->setMedia(QUrl::fromLocalFile(filepath));
- mediaPlayer->play();
this->connect(surface, SIGNAL(frameReceived(QPixmap)), this, SLOT(stopVideo(QPixmap)));
this->connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(stateChanged(QMediaPlayer::State)));
this->connect(mediaPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(setDuration(QMediaPlayer::MediaStatus)));
this->connect(this, SIGNAL(rollOver()), surface, SLOT(switchRollOver()));
+
+ //QTimer::singleShot( qrand()%100,mediaPlayer, SLOT(play()) );
+ //mediaPlayer->play();
}
void LVideoLabel::enableIcons() {
@@ -72,7 +74,7 @@ void LVideoLabel::setDuration(QMediaPlayer::MediaStatus status) {
mediaPlayer->play();
}else if(status == QMediaPlayer::InvalidMedia){
mediaPlayer->stop();
- mediaPlayer->play();
+ QTimer::singleShot(qrand()%100, mediaPlayer, SLOT(play())); //mediaPlayer->play();
}/*else if(status == QMediaPlayer::LoadingMedia) {
mediaPlayer->pause();
QTimer timer;
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
index 87a3a6d7..4d8ae44c 100644
--- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
@@ -13,6 +13,8 @@
#include <LUtils.h>
#include <LuminaOS.h>
+#define USE_VIDEO_LABEL 0
+
BrowserWidget::BrowserWidget(QString objID, QWidget *parent) : QWidget(parent){
//Setup the Widget/UI
this->setLayout( new QVBoxLayout(this) );
@@ -38,7 +40,9 @@ BrowserWidget::~BrowserWidget(){
}
void BrowserWidget::changeDirectory(QString dir){
- videoMap.clear();
+ QStringList vids = videoMap.keys();
+ for(int i=0; i<vids.length(); i++){ videoMap.take(vids[i]).second->deleteLater(); }
+ //videoMap.clear();
if(BROWSER->currentDirectory()==dir){ return; } //already on this directory
//qDebug() << "Change Directory:" << dir << historyList;
@@ -277,6 +281,7 @@ void BrowserWidget::clearItems(){
if(listWidget!=0){ listWidget->clear(); }
else if(treeWidget!=0){ treeWidget->clear(); }
freshload = true;
+ videoMap.clear();
}
void BrowserWidget::itemRemoved(QString item){
@@ -352,13 +357,13 @@ void BrowserWidget::itemDataAvailable(QIcon ico, LFileInfo *info){
}else{
if( ! treeWidget->findItems(info->fileName(), Qt::MatchExactly, 0).isEmpty() ) {
it = treeWidget->findItems(info->fileName(), Qt::MatchExactly, 0).first();
- }else if(info->isVideo() && videoMap.find(info->absoluteFilePath()) == videoMap.end()) {
+ }else if(USE_VIDEO_LABEL && hasThumbnails() && info->isVideo() && !videoMap.contains(info->absoluteFilePath()) ) {
it = new CQTreeWidgetItem(treeWidget);
treeWidget->addTopLevelItem(it);
LVideoWidget *widget = new LVideoWidget(info->absoluteFilePath(), treeWidget->iconSize(), hasThumbnails(), treeWidget);
videoMap.insert(info->absoluteFilePath(), QPair<QTreeWidgetItem*,LVideoWidget*>(it, widget));
treeWidget->setItemWidget(it, 0, widget);
- }else if(info->isVideo()) {
+ }else if(USE_VIDEO_LABEL && hasThumbnails() && info->isVideo() && videoMap.contains(info->absoluteFilePath()) ) {
it = videoMap[info->absoluteFilePath()].first;
LVideoWidget *widget = videoMap[info->absoluteFilePath()].second;
widget->setIconSize(treeWidget->iconSize());
@@ -370,8 +375,7 @@ void BrowserWidget::itemDataAvailable(QIcon ico, LFileInfo *info){
}
}
//Now set/update all the data
- if(!info->isVideo())
- it->setIcon(0, ico);
+ if(!info->isVideo() || !hasThumbnails() || !USE_VIDEO_LABEL){ it->setIcon(0, ico); }
it->setText(1, info->isDir() ? "" : LUtils::BytesToDisplaySize(info->size()) ); //size (1)
it->setText(2, info->mimetype() ); //type (2)
it->setText(3, DTtoString(info->lastModified() )); //modification date (3)
diff --git a/src-qt5/desktop-utils/lumina-fm/main.cpp b/src-qt5/desktop-utils/lumina-fm/main.cpp
index 61d2dc95..3b8fdcd0 100644
--- a/src-qt5/desktop-utils/lumina-fm/main.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/main.cpp
@@ -2,6 +2,7 @@
#include <QDebug>
#include <QFile>
#include <QStringList>
+#include <QDateTime>
#include "MainUI.h"
#include <LuminaOS.h>
@@ -14,6 +15,7 @@
int main(int argc, char ** argv)
{
LTHEME::LoadCustomEnvSettings();
+ qsrand(QDateTime::currentMSecsSinceEpoch());
LSingleApplication a(argc, argv, "lumina-fm"); //loads translations inside constructor
if( !a.isPrimaryProcess()){ return 0; }
qDebug() << "Loaded QApplication";
bgstack15