summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-08-28 11:10:58 +0200
committerArno <am@disconnect.de>2013-08-28 11:10:58 +0200
commit2cc92200386c55818cbe9bcb7d2e488170317d70 (patch)
treeabead086c71b8821bf4f8d5a7f076875d7ba24fb
parent00084a82f08ea72bafc6c002422c8f49bdeb1742 (diff)
downloadSheMov-2cc92200386c55818cbe9bcb7d2e488170317d70.tar.gz
SheMov-2cc92200386c55818cbe9bcb7d2e488170317d70.tar.bz2
SheMov-2cc92200386c55818cbe9bcb7d2e488170317d70.zip
Don't show progress dialog when we're polling
-rw-r--r--smdirmodel.cpp8
-rw-r--r--smdirmodel.h1
-rw-r--r--smdirwatcher.cpp10
-rw-r--r--smdirwatcher.h2
4 files changed, 17 insertions, 4 deletions
diff --git a/smdirmodel.cpp b/smdirmodel.cpp
index 6a7ac39..fc227dd 100644
--- a/smdirmodel.cpp
+++ b/smdirmodel.cpp
@@ -167,7 +167,7 @@ void SmDirModel::readSettings(){
interval *= 1000;
mRefreshTimer->setInterval(interval);
mRefreshTimer->start();
- connect(mRefreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
+ connect(mRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshFromTimer()));
}
}
@@ -175,6 +175,12 @@ void SmDirModel::refresh(){
setDir(mCurrentDir);
}
+void SmDirModel::refreshFromTimer(){
+ mCollector->setShowProgress(false);
+ setDir(mCurrentDir);
+ mCollector->setShowProgress(true);
+}
+
void SmDirModel::setCheckForPresent(bool check){
mCollector->setCheckForPresent(check);
}
diff --git a/smdirmodel.h b/smdirmodel.h
index 02ad608..9a5e55e 100644
--- a/smdirmodel.h
+++ b/smdirmodel.h
@@ -46,6 +46,7 @@ class SmDirModel : public SmTreeModel {
private slots:
void populate(SmTreeItem *root);
void addFile(const QList<QVariant> &data);
+ void refreshFromTimer();
signals:
void needResize();
diff --git a/smdirwatcher.cpp b/smdirwatcher.cpp
index 2b03179..9c4fb81 100644
--- a/smdirwatcher.cpp
+++ b/smdirwatcher.cpp
@@ -103,7 +103,7 @@ void SmDirWatcher::stop(){
quit();
}
-SmDataColletor::SmDataColletor(const int numFields, QObject *parent) : QThread(parent), mSemFree(0), mSemUsed(0), mDataQueue(0), mNumFields(numFields), mCheckForPresent(true), mCancel(false) {
+SmDataColletor::SmDataColletor(const int numFields, QObject *parent) : QThread(parent), mSemFree(0), mSemUsed(0), mDataQueue(0), mNumFields(numFields), mCheckForPresent(true), mCancel(false), mShowProgress(false) {
QSqlDatabase db = QSqlDatabase::cloneDatabase(QSqlDatabase::database("treedb"), "collectordb");
db.open();
mPicPresentQ = new QSqlQuery(db);
@@ -154,9 +154,13 @@ void SmDataColletor::run(){
SmTreeItem * SmDataColletor::populate(const QString &dir){
SmTreeItem *retval = new SmTreeItem(mNumFields);
QDir d = QDir(dir);
- emit totalFiles(d.entryInfoList().size());
+ if(mShowProgress){
+ emit totalFiles(d.entryInfoList().size());
+ }
foreach(QFileInfo fi, d.entryInfoList()){
- emit progress();
+ if(mShowProgress){
+ emit progress();
+ }
if(fi.fileName() == "."){
continue;
}
diff --git a/smdirwatcher.h b/smdirwatcher.h
index fccc1ed..9afd62b 100644
--- a/smdirwatcher.h
+++ b/smdirwatcher.h
@@ -60,6 +60,7 @@ class SmDataColletor : public QThread {
void setCheckForPresent(bool present);
void run();
void stop() { mCancel = true; }
+ void setShowProgress(bool progress) { mShowProgress = progress; }
signals:
void newData(const QList<QVariant>,int);
@@ -80,6 +81,7 @@ class SmDataColletor : public QThread {
const int mNumFields;
bool mCheckForPresent;
bool mCancel;
+ bool mShowProgress;
QMutex mCheckForPresentMx;
QSqlQuery *mPicPresentQ;
QSqlQuery *mMovPresentQ;