diff options
author | Ken Moore <ken@ixsystems.com> | 2016-09-30 14:40:40 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-09-30 14:40:40 -0400 |
commit | 04b5af3c9996f24764fddb4819f38e178c5dff4a (patch) | |
tree | 7acc524cd667ff99153877afa8b80f392ee3f894 /src-qt5/desktop-utils/lumina-fm/Browser.cpp | |
parent | Adjust the default settings for the new GPU accel detection routine to prefer... (diff) | |
download | lumina-04b5af3c9996f24764fddb4819f38e178c5dff4a.tar.gz lumina-04b5af3c9996f24764fddb4819f38e178c5dff4a.tar.bz2 lumina-04b5af3c9996f24764fddb4819f38e178c5dff4a.zip |
Commit a large update to lumina-fm:
The entire backend has been rewritten around multi-threading, and is much faster and more responsive now.
The entire browsing widget has been redesigned for a better workflow and cleaner UI.
The tabs/columns "group modes" have been removed. Instead, tabs are always used, but each browser supports a single/dual columns *within* each tab (via a couple simple buttons on the toolbar). Each column within a tab will share the same interface buttons (toolbar actions, ZFS snapshot slider,etc) - and they will reflect the settings on the "Active" column (with appropriate visual changes to indicate which one is active).
The icon size options have also been removed from the menu bar and are now a couple small "zoom" buttons on the browsing widgets instead.
KNOWN REGRESSION:
Keyboard shortcuts have not been tested and re-added as necessary yet.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/Browser.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/Browser.cpp | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.cpp b/src-qt5/desktop-utils/lumina-fm/Browser.cpp index 8c9b27c3..7455e5ea 100644 --- a/src-qt5/desktop-utils/lumina-fm/Browser.cpp +++ b/src-qt5/desktop-utils/lumina-fm/Browser.cpp @@ -67,25 +67,17 @@ void Browser::loadItem(QString info){ // PRIVATE SLOTS void Browser::fileChanged(QString file){ - if(file.startsWith(currentDir+"/")){ emit itemUpdated(file); } + if(file.startsWith(currentDir+"/")){ QtConcurrent::run(this, &Browser::loadItem, file ); } else if(file==currentDir){ QTimer::singleShot(0, this, SLOT(loadDirectory()) ); } } void Browser::dirChanged(QString dir){ if(dir==currentDir){ QTimer::singleShot(0, this, SLOT(loadDirectory()) ); } - else if(dir.startsWith(currentDir)){ emit itemUpdated(dir); } + else if(dir.startsWith(currentDir)){ QtConcurrent::run(this, &Browser::loadItem, dir ); } } void Browser::futureFinished(QString name, QByteArray icon){ //Note: this will be called once for every item that loads - //qDebug() << "Future Finished" << name; - //for(int i=0; i<fwatchers.length(); i++){ - //if(fwatchers[i]->isFinished()){ - //FileItem FI = fwatchers[i]->result(); - //qDebug() << "Found finished:" << FI.name << i; - //disconnect(fwatchers[i]); - //fwatchers.takeAt(i)->deleteLater(); - //fwatchers.removeAt(i); QIcon ico; LFileInfo info(name); if(!icon.isEmpty()){ @@ -94,13 +86,11 @@ void Browser::futureFinished(QString name, QByteArray icon){ }else if(info.isDir()){ ico = LXDG::findIcon("folder","inode/directory"); } - if(ico.isNull()){ ico = LXDG::findIcon( info.mimetype(), "unknown" ); } + if(ico.isNull()){ + //qDebug() << "MimeType:" << info.fileName() << info.mimetype(); + ico = LXDG::findIcon( info.iconfile(), "unknown" ); + } this->emit itemDataAvailable( ico, info ); - //qDebug() << "- done"; - //i--; - //return; - //} - //} } // PUBLIC SLOTS @@ -108,22 +98,41 @@ void Browser::loadDirectory(QString dir){ //qDebug() << "Load Directory" << dir; if(dir.isEmpty()){ dir = currentDir; } //reload current directory if(dir.isEmpty()){ return; } //nothing to do - nothing previously loaded + if(currentDir != dir){ //let the main widget know to clear all current items (completely different dir) + oldFiles.clear(); + emit clearItems(); + } + currentDir = dir; //save this for later //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 + QStringList old = oldFiles; //copy this over for the moment (both lists will change in a moment) + oldFiles.clear(); //get ready for re-creating this list // read the given directory QDir directory(dir); if(directory.exists()){ QStringList files; if(showHidden){ files = directory.entryList( QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot, QDir::NoSort); } else{ files = directory.entryList( QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot, QDir::NoSort); } + emit itemsLoading(files.length()); + QCoreApplication::processEvents(); for(int i=0; i<files.length(); i++){ watcher->addPath(directory.absoluteFilePath(files[i])); //qDebug() << "Future Starting:" << files[i]; QString path = directory.absoluteFilePath(files[i]); + if(old.contains(path)){ old.removeAll(path); } + oldFiles << path; //add to list for next time QtConcurrent::run(this, &Browser::loadItem, path ); + QCoreApplication::sendPostedEvents(); } watcher->addPath(directory.absolutePath()); + if(!old.isEmpty()){ + old.removeAll(directory.absolutePath()); + for(int i=0; i<old.length(); i++){ + emit itemRemoved(old[i]); + } + } + }else{ + emit itemsLoading(0); //nothing to load } } |