aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.cpp7
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp31
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserWidget.h1
3 files changed, 31 insertions, 8 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.cpp b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
index a68b8580..10c2567b 100644
--- a/src-qt5/desktop-utils/lumina-fm/Browser.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
@@ -20,7 +20,6 @@ Browser::Browser(QObject *parent) : QObject(parent){
showHidden = false;
showThumbs = false;
imageFormats = LUtils::imageExtensions(false); //lowercase suffixes
- videoFormats = LUtils::videoExtensions(); //lowercase suffixes
//connect(surface, SIGNAL(frameReceived(QImage)), this, SLOT(captureFrame(QImage)));
//connect(player, &QMediaPlayer::mediaStatusChanged, this, [&]{ stopVideo(player, player->mediaStatus()); });
connect(this, SIGNAL(threadDone(QString, QImage)), this, SLOT(futureFinished(QString, QImage))); //will always be between different threads
@@ -109,7 +108,7 @@ void Browser::futureFinished(QString name, QImage icon){
if(!icon.isNull() && showThumbs){
QPixmap pix = QPixmap::fromImage(icon);
ico->addPixmap(pix);
- }else if(info->isVideo() && showThumbs) {
+ /*}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); }
@@ -118,7 +117,7 @@ void Browser::futureFinished(QString name, QImage icon){
delete mediaLabel;
}else{
ico->addPixmap(videoImages[name]);
- }
+ }*/
}else{
ico = loadIcon(info->iconfile());
}
@@ -134,7 +133,7 @@ void Browser::loadDirectory(QString dir, bool force){
//qDebug() << "Load Directory" << dir;
bool dirupdate = true;
if(currentDir != dir){ //let the main widget know to clear all current items (completely different dir)
- videoImages.clear();
+ //videoImages.clear();
oldFiles.clear();
lastcheck = QDateTime(); //null time
emit clearItems();
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
index d2c07648..a7b07b47 100644
--- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
@@ -12,6 +12,7 @@
#include <LUtils.h>
#include <LuminaOS.h>
+#include <LVideoWidget.h>
BrowserWidget::BrowserWidget(QString objID, QWidget *parent) : QWidget(parent){
//Setup the Widget/UI
@@ -38,6 +39,7 @@ BrowserWidget::~BrowserWidget(){
}
void BrowserWidget::changeDirectory(QString dir){
+ videoMap.clear();
if(BROWSER->currentDirectory()==dir){ return; } //already on this directory
//qDebug() << "Change Directory:" << dir << historyList;
@@ -125,6 +127,12 @@ void BrowserWidget::setThumbnailSize(int px){
larger = treeWidget->iconSize().height() < px;
treeWidget->setIconSize(QSize(px,px));
}
+ for(QString file : videoMap.uniqueKeys()) {
+ QTreeWidgetItem *it = videoMap[file];
+ LVideoWidget *widget = (LVideoWidget*)treeWidget->itemWidget(it, 0);
+ widget->setIconSize(treeWidget->iconSize());
+ treeWidget->setItemWidget(it, 0, widget);
+ }
//qDebug() << "Changing Icon Size:" << px << larger;
if(BROWSER->currentDirectory().isEmpty() || !larger ){ return; } //don't need to reload icons unless the new size is larger
emit dirChange("", larger);
@@ -326,15 +334,30 @@ void BrowserWidget::itemDataAvailable(QIcon ico, LFileInfo *info){
treeWidget->addTopLevelItem(it);
}
}else{
- if( ! treeWidget->findItems(info->fileName(), Qt::MatchExactly, 0).isEmpty() ){ it = treeWidget->findItems(info->fileName(), Qt::MatchExactly, 0).first(); }
- 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()){
it = new CQTreeWidgetItem(treeWidget);
- it->setText(0, info->fileName() ); //name (0)
treeWidget->addTopLevelItem(it);
+ LVideoWidget *widget = new LVideoWidget(info->absoluteFilePath(), treeWidget->iconSize(), treeWidget);
+ videoMap.insert(info->absoluteFilePath(), it);
+ treeWidget->setItemWidget(it, 0, widget);
+ }else if(info->isVideo()){
+ it = videoMap[info->absoluteFilePath()];
+ if(treeWidget->itemWidget(it, 0) != 0) {
+ LVideoWidget *widget = (LVideoWidget*)treeWidget->itemWidget(it, 0);
+ widget->setIconSize(treeWidget->iconSize());
+ treeWidget->setItemWidget(it, 0, widget);
+ }
+ }else{
+ it = new CQTreeWidgetItem(treeWidget);
+ treeWidget->addTopLevelItem(it);
+ it->setText(0, info->fileName() ); //name (0)
}
}
//Now set/update all the data
- it->setIcon(0, ico);
+ if(!info->isVideo())
+ 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/BrowserWidget.h b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
index 02fd910d..585aaa82 100644
--- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
+++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
@@ -23,6 +23,7 @@ private:
int numItems; //used for checking if all the items have loaded yet
QString ID, statustip;
QStringList date_format, historyList;
+ QMap<QString,QTreeWidgetItem*> videoMap;
bool freshload;
//The drag and drop brower widgets
bgstack15