aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
authorWeblate <noreply@weblate.org>2016-09-25 19:49:35 +0000
committerWeblate <noreply@weblate.org>2016-09-25 19:49:35 +0000
commit644c70c0e5604ce8faf54b60bd09acb5b3913cf2 (patch)
tree8ee3fd21ef0df94bc493c7e99796402fdfc5bbc9 /src-qt5/desktop-utils
parentTranslated using Weblate (lumina_DESKTOP@es (generated)) (diff)
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-644c70c0e5604ce8faf54b60bd09acb5b3913cf2.tar.gz
lumina-644c70c0e5604ce8faf54b60bd09acb5b3913cf2.tar.bz2
lumina-644c70c0e5604ce8faf54b60bd09acb5b3913cf2.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.cpp77
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.h47
-rw-r--r--src-qt5/desktop-utils/lumina-fm/MainUI.cpp12
-rw-r--r--src-qt5/desktop-utils/lumina-fm/MainUI.h4
4 files changed, 132 insertions, 8 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.cpp b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
new file mode 100644
index 00000000..0aeb5648
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
@@ -0,0 +1,77 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "Browser.h"
+
+Browser::Browser(QObject *parent) : QObject(parent){
+ watcher = new QFileSystemWatcher(this);
+ connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(QString)) );
+ connect(watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(dirChanged(QString)) );
+ showHidden = false;
+}
+
+Browser::~Browser(){
+ watcher->deleteLater();
+}
+
+void Browser::showHiddenFiles(bool show){
+ if(show !=showHidden){
+ showHidden = show;
+ QTimer::singleShot(0, this, SLOT(loadDirectory()) );
+ }
+}
+bool Browser::showingHiddenFiles(){
+
+}
+
+// PRIVATE
+void Browser::loadItem(QFileInfo info){
+ LFileInfo linfo(info);
+ QIcon ico;
+ if(linfo.isImage()){
+ QPixmap pix;
+ if(pix.load(info.absoluteFilePath()) ){
+ if(pix.height()>128){ pix = pix.scaled(128, 128, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); }
+ ico.addPixmap(pix);
+ }
+ }else if(linfo.isDirectory()){
+ ico = LXDG::findIcon("folder","inode/directory");
+ }
+ if(ico.isNull()){ ico = LXDG::findIcon(linfo.mimetype(), "unknown"); }
+ emit ItemDataAvailable(ico, linfo);
+}
+
+// PRIVATE SLOTS
+void Browser::fileChanged(QString){
+
+}
+
+void Browser::dirChanged(QString){
+
+}
+
+// PUBLIC SLOTS
+QString Browser::loadDirectory(QString dir){
+ if(dir.isEmpty()){ dir = currentDir; } //reload current directory
+ if(dir.isEmpty()){ return; } //nothing to do - nothing previously loaded
+ //clean up the watcher first
+ QStringList watched; watched << watcher->files() << watcher->directories();
+ if(!watched.isEmpty()){ watcher->removePaths(watched); }
+ emit clearItems(); //let the main widget know to clear all current items
+ //QApplication::processEvents();
+ // read the given directory
+ QDir directory(dir);
+ if(directory.exists()){
+ QFileInfoList files;
+ if(showHidden){ files = directory.entryInfoList( QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotOrDotDot, QDir::NoSort); }
+ else{ files = directory.entryInfoList( QDir::Dirs | QDir::Files | QDir::NoDotOrDotDot, QDir::NoSort); }
+ for(int i=0; i<files.length(); i++){
+ watcher->addPath(files[i].absoluteFilePath());
+ QtConcurrent::run(this, &Browser::loadDirectory, files[i]);
+ }
+ watcher->addPath(directory.absolutePath());
+ }
+}
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.h b/src-qt5/desktop-utils/lumina-fm/Browser.h
new file mode 100644
index 00000000..21dd7789
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/Browser.h
@@ -0,0 +1,47 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is the main browsing backend for the file manager
+//===========================================
+#ifndef _LUMINA_FM_BROWSE_BACKEND_H
+#define _LUMINA_FM_BROWSE_BACKEND_H
+
+class Browser : public QObject{
+ Q_OBJECT
+public:
+ Browser(QObject *parent = 0);
+ ~Browser();
+
+ void showHiddenFiles(bool);
+ bool showingHiddenFiles();
+
+private:
+ QString currentDir;
+ QFileSystemWatcher *watcher;
+ bool showHidden;
+
+ void loadItem(QFileInfo info); //this is the main loader class - multiple instances each run in a separate thread
+
+private slots:
+ void fileChanged(QString); //tied into the watcher - for file change notifications
+ void dirChanged(QString); // tied into the watcher - for new/removed files in the current dir
+
+public slots:
+ QString loadDirectory(QString dir = "");
+
+signals:
+ //Main Signals
+ void itemUpdated(QString item); //emitted if a file changes after the initial scan
+ void clearItems(); //emitted when dirs change for example
+ void itemDataAvailable(QIcon, LFileInfo);
+
+ //Start/Stop signals for loading of data
+ void itemsLoading(int); //number of items which are getting loaded
+ void itemsDoneLoading(); //emitted when all items are done loading
+
+};
+
+#endif
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
index abe14c0d..59b671b5 100644
--- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
@@ -59,11 +59,11 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize();
connect(worker, SIGNAL(DirDataAvailable(QString, QString, LFileInfoList)), this, SLOT(DirDataAvailable(QString, QString, LFileInfoList)) );
connect(worker, SIGNAL(SnapshotDataAvailable(QString, QString, QStringList)), this, SLOT(SnapshotDataAvailable(QString, QString, QStringList)) );
worker->moveToThread(workThread);
- if(DEBUG){ qDebug() << " - File System Model"; }
- fsmod = new QFileSystemModel(this);
- fsmod->setRootPath(QDir::homePath());
- dirCompleter = new QCompleter(fsmod, this);
- dirCompleter->setModelSorting( QCompleter::CaseInsensitivelySortedModel );
+ //if(DEBUG){ qDebug() << " - File System Model"; }
+ //fsmod = new QFileSystemModel(this);
+ //fsmod->setRootPath(QDir::homePath());
+ //dirCompleter = new QCompleter(fsmod, this);
+ //dirCompleter->setModelSorting( QCompleter::CaseInsensitivelySortedModel );
if(DEBUG){ qDebug() << " - Context Menu"; }
contextMenu = new QMenu(this);
radio_view_details = new QRadioButton(tr("Detailed List"), this);
@@ -187,7 +187,7 @@ void MainUI::OpenDirs(QStringList dirs){
DW->setDetails(details); //Which details to show and in which order (L->R)
DW->setShowThumbnails(ui->actionShow_Thumbnails->isChecked());
DW->setThumbnailSize(settings->value("iconsize", 32).toInt());
- DW->setDirCompleter(dirCompleter);
+ //DW->setDirCompleter(dirCompleter);
DW->setShowCloseButton(!radio_view_tabs->isChecked());
//Now load the directory
DW->ChangeDir(dirs[i]); //kick off loading the directory info
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.h b/src-qt5/desktop-utils/lumina-fm/MainUI.h
index 6df10a89..19b40406 100644
--- a/src-qt5/desktop-utils/lumina-fm/MainUI.h
+++ b/src-qt5/desktop-utils/lumina-fm/MainUI.h
@@ -77,7 +77,7 @@ private:
DirData *worker;
//Internal non-ui widgets
QTabBar *tabBar;
- QFileSystemModel *fsmod;
+ //QFileSystemModel *fsmod;
QMenu *contextMenu;
QRadioButton *radio_view_details, *radio_view_list, *radio_view_tabs, *radio_view_cols;
QWidgetAction *detWA, *listWA, *tabsWA, *colsWA;
@@ -89,7 +89,7 @@ private:
QSettings *settings;
QShortcut *nextTabLShort, *nextTabRShort, *togglehiddenfilesShort, *focusDirWidgetShort;
- QCompleter *dirCompleter;
+ //QCompleter *dirCompleter;
//Simplification Functions
void setupConnections(); //used during initialization
bgstack15