diff options
author | ZackaryWelch <welch.zackary@gmail.com> | 2017-10-25 17:09:02 -0400 |
---|---|---|
committer | ZackaryWelch <welch.zackary@gmail.com> | 2017-10-25 17:09:41 -0400 |
commit | 76eb44f51faee92476ed509b700be9bc30be08a7 (patch) | |
tree | e7a2229d6cf87a21ca800f04c944e3504075a3ce /src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp | |
parent | Speed up some of the desktop init procedures again. (diff) | |
download | lumina-76eb44f51faee92476ed509b700be9bc30be08a7.tar.gz lumina-76eb44f51faee92476ed509b700be9bc30be08a7.tar.bz2 lumina-76eb44f51faee92476ed509b700be9bc30be08a7.zip |
Fixed image previews with video thumbnails
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp index dc00e92f..0384d892 100644 --- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp +++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp @@ -12,7 +12,6 @@ #include <LUtils.h> #include <LuminaOS.h> -#include <LVideoWidget.h> BrowserWidget::BrowserWidget(QString objID, QWidget *parent) : QWidget(parent){ //Setup the Widget/UI @@ -39,6 +38,7 @@ BrowserWidget::~BrowserWidget(){ } void BrowserWidget::changeDirectory(QString dir){ + qDebug() << "changing"; videoMap.clear(); if(BROWSER->currentDirectory()==dir){ return; } //already on this directory //qDebug() << "Change Directory:" << dir << historyList; @@ -111,6 +111,18 @@ bool BrowserWidget::hasHiddenFiles(){ } void BrowserWidget::showThumbnails(bool show){ + qDebug() << show << videoMap.size(); + for(QString file : videoMap.uniqueKeys()) { + QTreeWidgetItem *it = videoMap[file].first; + LVideoWidget *widget = videoMap[file].second; + if(show) { + widget->disableIcons(); + treeWidget->setItemWidget(it, 0, widget); + }else{ + widget->enableIcons(); + treeWidget->setItemWidget(it, 0, widget); + } + } BROWSER->showThumbnails(show); } @@ -128,8 +140,8 @@ void BrowserWidget::setThumbnailSize(int px){ treeWidget->setIconSize(QSize(px,px)); } for(QString file : videoMap.uniqueKeys()) { - QTreeWidgetItem *it = videoMap[file]; - LVideoWidget *widget = (LVideoWidget*)treeWidget->itemWidget(it, 0); + QTreeWidgetItem *it = videoMap[file].first; + LVideoWidget *widget = videoMap[file].second; widget->setIconSize(treeWidget->iconSize()); treeWidget->setItemWidget(it, 0, widget); } @@ -334,28 +346,18 @@ void BrowserWidget::itemDataAvailable(QIcon ico, LFileInfo *info){ treeWidget->addTopLevelItem(it); } }else{ - if(!BROWSER->showingThumbnails() && videoMap.size() !=0) { - for(QString file : videoMap.keys()) { - QTreeWidgetItem *it = videoMap[file]; - treeWidget->removeItemWidget(it, 0); - } - videoMap.clear(); - } 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() && BROWSER->showingThumbnails()){ + }else if(info->isVideo() && videoMap.find(info->absoluteFilePath()) == videoMap.end()) { it = new CQTreeWidgetItem(treeWidget); treeWidget->addTopLevelItem(it); LVideoWidget *widget = new LVideoWidget(info->absoluteFilePath(), treeWidget->iconSize(), treeWidget); - videoMap.insert(info->absoluteFilePath(), it); + videoMap.insert(info->absoluteFilePath(), QPair<QTreeWidgetItem*,LVideoWidget*>(it, widget)); treeWidget->setItemWidget(it, 0, widget); - }else if(info->isVideo() && BROWSER->showingThumbnails()){ - 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 if(info->isVideo()) { + it = videoMap[info->absoluteFilePath()].first; + LVideoWidget *widget = videoMap[info->absoluteFilePath()].second; + widget->setIconSize(treeWidget->iconSize()); }else{ it = new CQTreeWidgetItem(treeWidget); treeWidget->addTopLevelItem(it); @@ -363,7 +365,7 @@ void BrowserWidget::itemDataAvailable(QIcon ico, LFileInfo *info){ } } //Now set/update all the data - if(!info->isVideo() || (info->isVideo() && !BROWSER->showingThumbnails())) + 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) |