From 49b943474c4ac39ee5f0f2e900fddd1253a84366 Mon Sep 17 00:00:00 2001 From: Arno Date: Wed, 5 Aug 2015 04:04:49 +0200 Subject: Remove progress dialog and use Qt::WaitCursor instead Get rid of the progress Dialog in the filesystem widget and replace it with Qt::WaitCursor. While at it, show the waitcursor in the picture widget, too. Also remove the annoying warnings from ImageMagick by defining the missing constants. --- helper.h | 9 +++++++++ pictureswidget.cpp | 3 +++ smdirmodel.cpp | 12 +----------- smdirmodel.h | 2 -- smdirwatcher.cpp | 14 +++----------- smdirwatcher.h | 2 +- 6 files changed, 17 insertions(+), 25 deletions(-) diff --git a/helper.h b/helper.h index e78b827..cdfcd88 100644 --- a/helper.h +++ b/helper.h @@ -17,6 +17,15 @@ #include #include + +#ifndef MAGICKCORE_QUANTUM_DEPTH +#define MAGICKCORE_QUANTUM_DEPTH 16 +#endif + +#ifndef MAGICKCORE_HDRI_ENABLE +#define MAGICKCORE_HDRI_ENABLE 1 +#endif + #include class QString; diff --git a/pictureswidget.cpp b/pictureswidget.cpp index d27d801..59007ca 100644 --- a/pictureswidget.cpp +++ b/pictureswidget.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include "pictureswidget.h" #include "picfilesmodel.h" @@ -170,10 +171,12 @@ PictureView::PictureView(QWidget *parent) : SmTreeView("ui/picheaderpos", parent void PictureView::mappingChanged(int pMapId){ mModel->setMapping(pMapId); + qApp->setOverrideCursor(Qt::WaitCursor); mModel->populate(); for(int i = 0; i < PicFilesModel::NumFields; ++i){ resizeColumnToContents(i); } + qApp->restoreOverrideCursor(); } void PictureView::deletePics(){ diff --git a/smdirmodel.cpp b/smdirmodel.cpp index 73ae0c5..32bc241 100644 --- a/smdirmodel.cpp +++ b/smdirmodel.cpp @@ -135,11 +135,6 @@ 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 &data, int e){ if(e == SmDirWatcher::Added){ /* for some reason SmTreeModel::addRow() doesn't work, @@ -177,7 +172,7 @@ void SmDirModel::readSettings(){ interval *= 1000; mRefreshTimer->setInterval(interval); mRefreshTimer->start(); - connect(mRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshNoProgress())); + connect(mRefreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); } bool expensive = s.value("ui/expensiveops", true).toBool(); mWatch->setExpensiveOps(expensive); @@ -187,13 +182,8 @@ void SmDirModel::refresh(){ setDir(mCurrentDir); } -void SmDirModel::refreshNoProgress(){ - setDirNoProgress(mCurrentDir); -} - void SmDirModel::populate(SmTreeItem *root){ setRoot(root); - //mWatch->startAsyncJobs(); emit needResize(); } diff --git a/smdirmodel.h b/smdirmodel.h index 4e7112a..a775553 100644 --- a/smdirmodel.h +++ b/smdirmodel.h @@ -39,11 +39,9 @@ class SmDirModel : public SmTreeModel { public slots: void setDir(const QString &dir); - void setDirNoProgress(const QString &dir); void dirEvent(const QList &data, int e); void readSettings(); void refresh(); - void refreshNoProgress(); private slots: void populate(SmTreeItem *root); diff --git a/smdirwatcher.cpp b/smdirwatcher.cpp index 8c0f04a..79bce7c 100644 --- a/smdirwatcher.cpp +++ b/smdirwatcher.cpp @@ -29,24 +29,16 @@ SmDirWatcher::SmDirWatcher(int numFields, QObject *parent) : QThread(parent), mF mDb.open(); } -void SmDirWatcher::setDir(const QString &dir, bool progress){ +void SmDirWatcher::setDir(const QString &dir){ if(mDescr){ inotify_rm_watch(mFd, mDescr); //generates IN_IGNORE ??? } mCurrent = dir; QDir d(mCurrent); - QWidget *fsWidget = SmGlobals::instance()->registeredWidgets().value("FSWidget"); - QProgressDialog *pDlg = new QProgressDialog(tr("Gathering data..."), QString(), 0, d.count(), fsWidget); - if(progress){ - pDlg->show(); - } + qApp->setOverrideCursor(Qt::WaitCursor); SmTreeItem *rootItem = new SmTreeItem(mNumFields); for(uint i = 0; i < d.count(); ++i){ QFileInfo fi = d.entryInfoList().at(i); - if(progress){ - pDlg->setValue(i); - qApp->processEvents(); - } if(fi.fileName() == "." || fi.fileName() == ".."){ continue; } @@ -54,7 +46,6 @@ void SmDirWatcher::setDir(const QString &dir, bool progress){ SmTreeItem *newItem = new SmTreeItem(data, rootItem); rootItem->appendChild(newItem); } - pDlg->deleteLater(); emit population(rootItem); /* mask rationale: * IN_DELETE_SELF cannot happen since we're only @@ -62,6 +53,7 @@ void SmDirWatcher::setDir(const QString &dir, bool progress){ * We don't care about the other events */ mDescr = inotify_add_watch(mFd, qPrintable(dir), IN_CLOSE_WRITE | IN_CREATE | IN_DELETE | IN_MODIFY | IN_MOVED_FROM | IN_MOVED_TO); + qApp->restoreOverrideCursor(); } void SmDirWatcher::setExpensiveOps(bool expensiveOps){ diff --git a/smdirwatcher.h b/smdirwatcher.h index bb045ef..bf89050 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, bool progress = true); + void setDir(const QString &dir); void setExpensiveOps(bool expensiveOps); private: -- cgit v1.2.3-70-g09d2