aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-08-28 13:00:19 -0400
committerKen Moore <moorekou@gmail.com>2015-08-28 13:00:19 -0400
commitb85aad91e22a02f9ea14cd2009c718f8c64a7ef9 (patch)
tree7b642706c3c77d53daea462f09d5730eca9b900e
parentMake the processEvents() call only happen every 10 items loaded - this makes ... (diff)
downloadlumina-b85aad91e22a02f9ea14cd2009c718f8c64a7ef9.tar.gz
lumina-b85aad91e22a02f9ea14cd2009c718f8c64a7ef9.tar.bz2
lumina-b85aad91e22a02f9ea14cd2009c718f8c64a7ef9.zip
Another minor increase in speed from the dir loader: only processEvents every 20 items, but be sure to processEvents after clearing the widget before the item loop is started (to ensure it is blanked out right away).
-rw-r--r--lumina-fm/DirData.h2
-rw-r--r--lumina-fm/widgets/DirWidget.cpp8
2 files changed, 7 insertions, 3 deletions
diff --git a/lumina-fm/DirData.h b/lumina-fm/DirData.h
index c82ee155..26cfb3ad 100644
--- a/lumina-fm/DirData.h
+++ b/lumina-fm/DirData.h
@@ -20,7 +20,7 @@
#define ZSNAPDIR QString("/.zfs/snapshot/")
-#define DEBUG 1
+#define DEBUG 0
//Class used for keeping track of directory information in the HASH
class LDirInfoList{
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp
index 8d41d4c0..b4a6ca78 100644
--- a/lumina-fm/widgets/DirWidget.cpp
+++ b/lumina-fm/widgets/DirWidget.cpp
@@ -21,7 +21,9 @@
#include "../ScrollDialog.h"
+#ifndef DEBUG
#define DEBUG 0
+#endif
DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new Ui::DirWidget){
ui->setupUi(this); //load the designer file
@@ -236,6 +238,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
if(lastbasedir != normalbasedir){
if(showDetails){ treeWidget->clear(); }
else{ listWidget->clear(); }
+ QApplication::processEvents(); //make sure it is cleared right away
}else{
//Need to be smarter about which items need to be removed
// - compare the old/new lists and remove any items not in the new listing (new items taken care of below)
@@ -248,7 +251,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
i--;
}
}
- QApplication::processEvents();
+ QApplication::processEvents(); //make sure the scrollbar is up to date after removals
scrollpercent = treeWidget->verticalScrollBar()->value()/( (double) treeWidget->verticalScrollBar()->maximum());
}else{
for(int i=0; i<listWidget->count(); i++){
@@ -257,6 +260,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
i--;
}
}
+ QApplication::processEvents(); //make sure the scrollbar is up to date after removals
scrollpercent = listWidget->horizontalScrollBar()->value()/( (double) listWidget->horizontalScrollBar()->maximum());
}
} //end check for CDIR reload
@@ -350,7 +354,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
listWidget->scrollToItem(it);
}
}
- if(i%10==0){ QApplication::processEvents(); }//keep the UI snappy while loading a directory
+ if(i%20==0){ QApplication::processEvents(); }//keep the UI snappy while loading a directory
if(DEBUG){ qDebug() << " - item finished:" << i << time.elapsed(); }
}
if(DEBUG){ qDebug() << "Done with item loop:" << time.elapsed() << list.length(); }
bgstack15