From: Mikko Keinänen Date: Sun, 28 Nov 2010 00:29:05 +0000 (+0200) Subject: Removed signaling database updates from FileUtil to X-Git-Url: http://vcs.maemo.org/git/?p=emufront;a=commitdiff_plain;h=15aa38b467822c7c107b1f153984975846f223d9 Removed signaling database updates from FileUtil to MediaImagePathMainDIalog. --- diff --git a/src/dialogs/mediaimagepathmaindialog.cpp b/src/dialogs/mediaimagepathmaindialog.cpp index be1c07d..b6bd0d6 100644 --- a/src/dialogs/mediaimagepathmaindialog.cpp +++ b/src/dialogs/mediaimagepathmaindialog.cpp @@ -43,8 +43,8 @@ MediaImagePathMainDialog::MediaImagePathMainDialog(QWidget *parent) hideColumns(); fileUtil = new FileUtil(this); - initProgressDialog(); + // do not move to parent class: connectSignals(); } @@ -61,27 +61,8 @@ void MediaImagePathMainDialog::connectSignals() { DbObjectDialog::connectSignals(); connect(scanButton, SIGNAL(clicked()), this, SLOT(beginScanFilePath())); - connect(fileUtil, SIGNAL(dbUpdateFinished()), this, SLOT(hideDbUpdating())); - connect(fileUtil, SIGNAL(dbUpdateInProgress()), this, SLOT(showDbUpdating())); -} - -void MediaImagePathMainDialog::showDbUpdating() -{ - qDebug() << "DB updating"; - // TODO: the following is not currently working - progressDialog->setWindowTitle(tr("Updating DB... please wait!")); - progressDialog->setEnabled(false); } -void MediaImagePathMainDialog::hideDbUpdating() -{ - qDebug() << "DB update finished"; - // TODO: the following is not currently working - progressDialog->setEnabled(true); - progressDialog->setWindowTitle(tr("Scanning files")); -} - - void MediaImagePathMainDialog::initEditDialog() { nameDialog = new MediaImagePathDialog(this, dynamic_cast(dbObject)); @@ -113,7 +94,6 @@ void MediaImagePathMainDialog::beginScanFilePath() dbMediaImageContainer->removeFromFilePath(fpo->getId()); progressDialog->show(); - progressDialog->setEnabled(true); setUIEnabled(false); int count = fileUtil->scanFilePath(fpo, l, dbMediaImageContainer, progressDialog); diff --git a/src/dialogs/mediaimagepathmaindialog.h b/src/dialogs/mediaimagepathmaindialog.h index 25cad5d..4f76c22 100644 --- a/src/dialogs/mediaimagepathmaindialog.h +++ b/src/dialogs/mediaimagepathmaindialog.h @@ -43,8 +43,6 @@ protected: private slots: void beginScanFilePath(); - void showDbUpdating(); - void hideDbUpdating(); private: QPushButton *scanButton; diff --git a/src/utils/fileutil.cpp b/src/utils/fileutil.cpp index 80874bc..49ee35b 100644 --- a/src/utils/fileutil.cpp +++ b/src/utils/fileutil.cpp @@ -109,9 +109,9 @@ int FileUtil::scanFilePath(FilePathObject *fp, if (containers.count() >= MIC_BUFFER_SIZE) { //qDebug() << "We have " << containers.count() << " containers .. storing to db."; - emit dbUpdateInProgress(); + showDbUpdating(progressDialog); dbMic->storeContainers(containers, fp); - emit dbUpdateFinished(); + hideDbUpdating(progressDialog); qDeleteAll(containers); containers.clear(); //qDebug() << "containers now: " << containers.count(); @@ -125,15 +125,14 @@ int FileUtil::scanFilePath(FilePathObject *fp, progressDialog->setValue(list.size()); if (containers.count() > 0) { //qDebug() << "Storing the rest " << containers.count() << " containers."; - emit dbUpdateInProgress(); + //emit dbUpdateInProgress(); + showDbUpdating(progressDialog); dbMic->storeContainers(containers, fp); - emit dbUpdateFinished(); + hideDbUpdating(progressDialog); + //emit dbUpdateFinished(); qDeleteAll(containers); containers.clear(); - - } - } catch (EmuFrontException &e) { - qDebug() << "Got exception " << e.what() << ", aborting & deleting created data objects."; + } } catch (EmuFrontException &e) { qDebug() << "Got exception " << e.what() << ", aborting & deleting created data objects."; qDeleteAll(containers); throw e; } @@ -168,3 +167,20 @@ bool FileUtil::isSupportedFile(const QString filename, const QStringList support QString ext = filename.section('.', -1); return supportedFileExtensions.contains(ext, Qt::CaseInsensitive); } + +void FileUtil::showDbUpdating(QProgressDialog *progressDialog) +{ + qDebug() << "DB updating"; + // TODO: the following is not currently working + progressDialog->setWindowTitle(tr("Updating DB... please wait!")); + progressDialog->setEnabled(false); +} + +void FileUtil::hideDbUpdating(QProgressDialog *progressDialog) +{ + qDebug() << "DB update finished"; + // TODO: the following is not currently working + progressDialog->setEnabled(true); + progressDialog->setWindowTitle(tr("Scanning files")); +} + diff --git a/src/utils/fileutil.h b/src/utils/fileutil.h index c4693fe..f5c50ee 100644 --- a/src/utils/fileutil.h +++ b/src/utils/fileutil.h @@ -50,6 +50,9 @@ private: bool isSupportedFile(const QString filename, const QStringList supportedFileExtensions); static const int MIC_BUFFER_SIZE = 50; UnzipHelper *unzipHelper; + void showDbUpdating(QProgressDialog*); + void hideDbUpdating(QProgressDialog*); + }; #endif // FILEUTIL_H