aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-10-25 18:27:52 -0400
committerKen Moore <ken@ixsystems.com>2017-10-25 18:27:52 -0400
commitc52596a4d90e681b394e4c212592f26275d74bae (patch)
tree6264e2caf978da7e09d749c923821e3d8132bd10 /src-qt5/desktop-utils/lumina-fm
parentRe-enable the "Root Mode" warning at the top of lumina-fm, and setup the root... (diff)
parentFixed issues with previews and LVideoWidget sizing (diff)
downloadlumina-c52596a4d90e681b394e4c212592f26275d74bae.tar.gz
lumina-c52596a4d90e681b394e4c212592f26275d74bae.tar.bz2
lumina-c52596a4d90e681b394e4c212592f26275d74bae.zip
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp44
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserWidget.h4
2 files changed, 26 insertions, 22 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
index dc00e92f..0983a7b4 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
@@ -111,6 +110,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->enableIcons();
+ treeWidget->setItemWidget(it, 0, widget);
+ }else{
+ widget->disableIcons();
+ treeWidget->setItemWidget(it, 0, widget);
+ }
+ }
BROWSER->showThumbnails(show);
}
@@ -128,8 +139,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 +345,19 @@ 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);
+ 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()) {
+ it = videoMap[info->absoluteFilePath()].first;
+ LVideoWidget *widget = videoMap[info->absoluteFilePath()].second;
+ widget->setIconSize(treeWidget->iconSize());
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{
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)
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
index 585aaa82..f041280c 100644
--- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
+++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
@@ -12,6 +12,8 @@
#include <QWidget>
#include <QThread>
+#include <LVideoWidget.h>
+
#include "Browser.h"
#include "widgets/DDListWidgets.h"
@@ -23,7 +25,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;
+ QMap<QString,QPair<QTreeWidgetItem*, LVideoWidget*>> videoMap;
bool freshload;
//The drag and drop brower widgets
bgstack15