diff options
author | Arno <arno@disconnect.de> | 2017-08-12 19:28:23 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-08-12 19:28:23 +0200 |
commit | 33990a7379d5ea93fb1b3fa72b47c51e4f7f5ef8 (patch) | |
tree | 038d5c9cd843d426723d9b6059b87187196a09cb /consistencycheck.cpp | |
parent | 4ebd741d2bd6061dd4812adf0a89bd0cdb81023d (diff) | |
download | SheMov-33990a7379d5ea93fb1b3fa72b47c51e4f7f5ef8.tar.gz SheMov-33990a7379d5ea93fb1b3fa72b47c51e4f7f5ef8.tar.bz2 SheMov-33990a7379d5ea93fb1b3fa72b47c51e4f7f5ef8.zip |
Fix consistency check
Actually, removing stray pictures never worked, because the call to that
function was commented out.
Also, remove the clear functions stray files and stray ids and lock the
mutex in place. They were only called once, so we can do it inside the
function. And don't forget to clear the picture Ids.
Finally, fix the logic for activating the cleanup button.
Diffstat (limited to 'consistencycheck.cpp')
-rw-r--r-- | consistencycheck.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/consistencycheck.cpp b/consistencycheck.cpp index 1583093..d5d1aa8 100644 --- a/consistencycheck.cpp +++ b/consistencycheck.cpp @@ -176,7 +176,7 @@ void ConsistencyCheck::checkerFinished(){ mCancelExit->disconnect(); connect(mCancelExit, SIGNAL(clicked()), this, SLOT(accept())); mChecker->setCancel(false); - if(!mChecker->strayFiles().isEmpty() || !mChecker->strayFileIds().isEmpty()){ + if(!mChecker->strayPicIds().isEmpty() || !mChecker->strayFileIds().isEmpty() || mChecker->strayFiles().isEmpty()){ mCleanup->setEnabled(true); } } @@ -202,7 +202,7 @@ void ConsistencyCheck::cleanup(){ QString msg = QString(tr("Really delete %1 pictures from database?")).arg(QString::number(picIds.count())); int retval = QMessageBox::critical(this, tr("Delete from database"), msg, QMessageBox::Yes | QMessageBox::No); if(retval == QMessageBox::Yes){ - //mChecker->deleteIds(fileIds); + mChecker->deletePicIds(picIds); } } } @@ -258,11 +258,6 @@ const QStringList ConsistencyChecker::strayFiles(){ return mStrayFiles; } -void ConsistencyChecker::clearStrayFiles(){ - QMutexLocker locker(&mStrayFilesMutex); - mStrayFiles.clear(); -} - const QList<int> ConsistencyChecker::strayFileIds(){ QMutexLocker locker(&mStrayFileIdMutex); return mStrayFileIds; @@ -273,11 +268,6 @@ const QList<int> ConsistencyChecker::strayPicIds(){ return mStrayPicIds; } -void ConsistencyChecker::clearStrayIds(){ - QMutexLocker locker(&mStrayFileIdMutex); - mStrayFileIds.clear(); -} - void ConsistencyChecker::setCancel(bool cancel){ QMutexLocker locker(&mCancelMutex); mCanceled = cancel; @@ -302,8 +292,6 @@ void ConsistencyChecker::deletePicIds(const QList<int> &ids){ } void ConsistencyChecker::run(){ - clearStrayFiles(); - clearStrayIds(); if(mMode == ConsistencyCheck::FsCheck){ fsCheck(); } @@ -387,6 +375,12 @@ void ConsistencyChecker::doDbCheckPics(){ } void ConsistencyChecker::dbCheck(){ + mStrayFileIdMutex.lock(); + mStrayFileIds.clear(); + mStrayFileIdMutex.unlock(); + mStrayPicsIdMutex.lock(); + mStrayPicIds.clear(); + mStrayPicsIdMutex.unlock(); QSqlQuery numFilesQ("SELECT COUNT(*) FROM files", mDb); int numFiles; while(numFilesQ.next()){ |