diff options
author | Arno <am@disconnect.de> | 2014-12-10 23:19:09 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2014-12-10 23:19:09 +0100 |
commit | d0a7a182617e8353d78274832f515c6fad5d04e4 (patch) | |
tree | 0b6f4ca017bbcf2c20b44874d904515523b94f03 | |
parent | 2c022561f692a813b44da39d6ffdcb373aa4c7ba (diff) | |
download | SheMov-d0a7a182617e8353d78274832f515c6fad5d04e4.tar.gz SheMov-d0a7a182617e8353d78274832f515c6fad5d04e4.tar.bz2 SheMov-d0a7a182617e8353d78274832f515c6fad5d04e4.zip |
Don't show progressdialog when autorefreshing
They don't play nice together. Crap... AutoRefresh should be a thread,
but that opens another shebang of problems, I guess. So don't show the
dialog for now.
-rw-r--r-- | smdirmodel.cpp | 11 | ||||
-rw-r--r-- | smdirmodel.h | 2 | ||||
-rw-r--r-- | smdirwatcher.cpp | 16 | ||||
-rw-r--r-- | smdirwatcher.h | 2 |
4 files changed, 23 insertions, 8 deletions
diff --git a/smdirmodel.cpp b/smdirmodel.cpp index 1552044..73ae0c5 100644 --- a/smdirmodel.cpp +++ b/smdirmodel.cpp @@ -135,6 +135,11 @@ void SmDirModel::setDir(const QString &dir){ mWatch->setDir(mCurrentDir); } +void SmDirModel::setDirNoProgress(const QString &dir){ + mCurrentDir = dir; + mWatch->setDir(mCurrentDir, false); +} + void SmDirModel::dirEvent(const QList<QVariant> &data, int e){ if(e == SmDirWatcher::Added){ /* for some reason SmTreeModel::addRow() doesn't work, @@ -172,7 +177,7 @@ void SmDirModel::readSettings(){ interval *= 1000; mRefreshTimer->setInterval(interval); mRefreshTimer->start(); - connect(mRefreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); + connect(mRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshNoProgress())); } bool expensive = s.value("ui/expensiveops", true).toBool(); mWatch->setExpensiveOps(expensive); @@ -182,6 +187,10 @@ void SmDirModel::refresh(){ setDir(mCurrentDir); } +void SmDirModel::refreshNoProgress(){ + setDirNoProgress(mCurrentDir); +} + void SmDirModel::populate(SmTreeItem *root){ setRoot(root); //mWatch->startAsyncJobs(); diff --git a/smdirmodel.h b/smdirmodel.h index a775553..4e7112a 100644 --- a/smdirmodel.h +++ b/smdirmodel.h @@ -39,9 +39,11 @@ class SmDirModel : public SmTreeModel { public slots: void setDir(const QString &dir); + void setDirNoProgress(const QString &dir); void dirEvent(const QList<QVariant> &data, int e); void readSettings(); void refresh(); + void refreshNoProgress(); private slots: void populate(SmTreeItem *root); diff --git a/smdirwatcher.cpp b/smdirwatcher.cpp index 8c0570e..c5914ad 100644 --- a/smdirwatcher.cpp +++ b/smdirwatcher.cpp @@ -29,7 +29,7 @@ SmDirWatcher::SmDirWatcher(int numFields, QObject *parent) : QThread(parent), mF mDb.open(); } -void SmDirWatcher::setDir(const QString &dir){ +void SmDirWatcher::setDir(const QString &dir, bool progress){ if(mDescr){ inotify_rm_watch(mFd, mDescr); //generates IN_IGNORE ??? } @@ -37,14 +37,18 @@ void SmDirWatcher::setDir(const QString &dir){ QDir d(mCurrent); QWidget *fsWidget = SmGlobals::instance()->registeredWidgets().value("FSWidget"); QProgressDialog *pDlg = new QProgressDialog(tr("Gathering data..."), QString(), 0, d.count(), fsWidget); - pDlg->setWindowModality(Qt::WindowModal); - Helper::centerWidget(pDlg); - pDlg->show(); + if(progress){ + pDlg->setWindowModality(Qt::WindowModal); + Helper::centerWidget(pDlg); + pDlg->show(); + } SmTreeItem *rootItem = new SmTreeItem(mNumFields); for(uint i = 0; i < d.count(); ++i){ QFileInfo fi = d.entryInfoList().at(i); - pDlg->setValue(i); - qApp->processEvents(); + if(progress){ + pDlg->setValue(i); + qApp->processEvents(); + } if(fi.fileName() == "." || fi.fileName() == ".."){ continue; } diff --git a/smdirwatcher.h b/smdirwatcher.h index bf89050..bb045ef 100644 --- a/smdirwatcher.h +++ b/smdirwatcher.h @@ -33,7 +33,7 @@ class SmDirWatcher : public QThread { public slots: void run(); void stop(); - void setDir(const QString &dir); + void setDir(const QString &dir, bool progress = true); void setExpensiveOps(bool expensiveOps); private: |