aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm/widgets/DirWidget.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-09-23 14:59:12 -0400
committerKen Moore <moorekou@gmail.com>2015-09-23 14:59:12 -0400
commitc7600102e79cb87d51588dbc9e47c245ab6e70af (patch)
tree78af4e7a8b84e4527f6bd6b85c64461e44ac33ac /lumina-fm/widgets/DirWidget.cpp
parentClean up the file transfer systems a bit in lumina-fm: (diff)
downloadlumina-c7600102e79cb87d51588dbc9e47c245ab6e70af.tar.gz
lumina-c7600102e79cb87d51588dbc9e47c245ab6e70af.tar.bz2
lumina-c7600102e79cb87d51588dbc9e47c245ab6e70af.zip
Make sure that a directory does not refresh more than once a second from a file within the directory getting changed.
Diffstat (limited to 'lumina-fm/widgets/DirWidget.cpp')
-rw-r--r--lumina-fm/widgets/DirWidget.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp
index 6b8fe976..f62d4b94 100644
--- a/lumina-fm/widgets/DirWidget.cpp
+++ b/lumina-fm/widgets/DirWidget.cpp
@@ -63,7 +63,7 @@ DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new U
//Create the filesystem watcher
watcher = new QFileSystemWatcher(this);
synctimer = new QTimer(this);
- synctimer->setInterval(100); // 1/10 second pause (combine simultaneous signals from the watcher)
+ synctimer->setInterval(1000); // 1 second pause (combine simultaneous signals from the watcher)
synctimer->setSingleShot(true);
//Now update the rest of the UI
canmodify = false; //initial value
@@ -902,9 +902,13 @@ void DirWidget::SelectionChanged(){
void DirWidget::startSync(const QString &file){
//Update date_format based on user settings
if(file == sessionsettings_config_file){ setDateFormat(); }
- if(file == snapbasedir){ emit findSnaps(ID, normalbasedir); } //snapshot list changed
- if(synctimer->isActive()){ synctimer->stop(); }
- synctimer->start();
+ else if(file == snapbasedir){ emit findSnaps(ID, normalbasedir); } //snapshot list changed
+ else if(file == normalbasedir){ emit LoadDirectory(ID, normalbasedir); } //Directory changed (new/removed files)
+ else{
+ //Some file in the directory got changed - start the time for a dir reload
+ // -- This prevents a directory from refreshing constantly if a file within the directory is changing all the time (such as a log file)
+ if(!synctimer->isActive()){ synctimer->start(); }
+ }
}
//====================
bgstack15