digiKam
Digikam::ScanController Class Reference
+ Inheritance diagram for Digikam::ScanController:

Classes

class  FileMetadataWrite
 
class  Private
 

Public Types

enum  Advice { Success , ContinueWithoutDatabase , AbortImmediately }
 
enum  UpdateResult { UpdateSuccess , UpdateError , UpdateErrorMustAbort }
 

Public Member Functions

void allowToScanDeferredFiles ()
 
QList< qlonglong > getNewIdsList () const
 
ItemInfo scannedInfo (const QString &filePath)
 
void updateUniqueHash ()
 

Static Public Member Functions

static ScanControllerinstance ()
 

Protected Member Functions

void run () override
 

Stop Operations

class ScanControllerCreator
 
void shutDown ()
 
void abortInitialization ()
 
void cancelCompleteScan ()
 
void cancelAllAndSuspendCollectionScan ()
 
void suspendCollectionScan ()
 
void finishFileMetadataWrite (const ItemInfo &info, bool changed)
 
void collectionScanFinished ()
 
void newImages (const ItemInfoList &)
 
void partialScanDone (const QString &path)
 
void completeScanDone ()
 
void completeScanCanceled ()
 
void errorFromInitialization (const QString &)
 

Start Operations

Advice databaseInitialization ()
 
void completeCollectionScan (bool defer=false)
 
void completeCollectionScanDeferFiles ()
 
void completeCollectionScanInBackground (bool defer, bool fastScan=true)
 
void scheduleCollectionScan (const QString &path)
 
void scheduleCollectionScanRelaxed (const QString &path)
 
void scheduleCollectionScanExternal (const QString &path)
 
void beginFileMetadataWrite (const ItemInfo &info)
 
void resumeCollectionScan ()
 
void databaseInitialized (bool success)
 
void collectionScanStarted (const QString &message)
 

Progress Operations

void hintAtMoveOrCopyOfAlbum (const PAlbum *const album, const PAlbum *const dstAlbum, const QString &newAlbumName=QString())
 
void hintAtMoveOrCopyOfAlbum (const PAlbum *const album, const QString &dstPath, const QString &newAlbumName=QString())
 
void hintAtMoveOrCopyOfItems (const QList< qlonglong > &ids, const PAlbum *const dstAlbum, const QStringList &itemNames)
 
void hintAtMoveOrCopyOfItem (qlonglong id, const PAlbum *const dstAlbum, const QString &itemName)
 
void hintAtModificationOfItems (const QList< qlonglong > &ids)
 
void hintAtModificationOfItem (qlonglong id)
 
void totalFilesToScan (int)
 
void filesScanned (int)
 
void scanningProgress (float progress)
 
void triggerShowProgressDialog ()
 
void incrementProgressDialog (int)
 
void progressFromInitialization (const QString &, int)
 

Member Enumeration Documentation

◆ Advice

Enumerator
Success 
ContinueWithoutDatabase 
AbortImmediately 

◆ UpdateResult

Enumerator
UpdateSuccess 
UpdateError 
UpdateErrorMustAbort 

Member Function Documentation

◆ abortInitialization()

void Digikam::ScanController::abortInitialization ( )

If the controller is currently processing a database update (typically after first run), cancel this hard and as soon as possible. Any progress may be lost.

References Digikam::ScanController::Private::continueInitialization, Digikam::ScanController::Private::mutex, and Digikam::ScanController::Private::needsInitialization.

◆ allowToScanDeferredFiles()

◆ beginFileMetadataWrite()

◆ cancelAllAndSuspendCollectionScan()

◆ cancelCompleteScan()

void Digikam::ScanController::cancelCompleteScan ( )

If the controller is currently doing a complete scan (typically at startup), stop this operation. It can be resumed later.

References completeScanCanceled(), Digikam::ScanController::Private::continueScan, Digikam::ScanController::Private::mutex, and Digikam::ScanController::Private::needsCompleteScan.

◆ collectionScanFinished

void Digikam::ScanController::collectionScanFinished ( )
signal

Referenced by run().

◆ collectionScanStarted

void Digikam::ScanController::collectionScanStarted ( const QString &  message)
signal

Referenced by run().

◆ completeCollectionScan()

void Digikam::ScanController::completeCollectionScan ( bool  defer = false)

Carries out a complete collection scan, providing progress feedback. Synchronous, returns when ready. The database will be locked while the scan is running. With the DeferFiles variant, deep files scanning (new files), the part which can take long, will be done during the time after the method returns, shortening the synchronous wait. After completeCollectionScanDeferFiles, you need to call allowToScanDeferredFiles() once to enable scanning the deferred files.

References Digikam::CollectionScanner::databaseInitialScanDone(), and Digikam::ScanController::Private::progressDialog.

Referenced by Digikam::AlbumManager::changeDatabase(), and completeCollectionScanDeferFiles().

◆ completeCollectionScanDeferFiles()

void Digikam::ScanController::completeCollectionScanDeferFiles ( )

◆ completeCollectionScanInBackground()

void Digikam::ScanController::completeCollectionScanInBackground ( bool  defer,
bool  fastScan = true 
)

Scan Whole collection without to display a progress dialog or to manage splashscreen, as for NewItemsFinder tool.

Referenced by Digikam::SetupMime::applySettings(), and Digikam::SetupCollections::applySettings().

◆ completeScanCanceled

void Digikam::ScanController::completeScanCanceled ( )
signal

Referenced by cancelCompleteScan().

◆ completeScanDone

void Digikam::ScanController::completeScanDone ( )
signal

Referenced by run().

◆ databaseInitialization()

◆ databaseInitialized

void Digikam::ScanController::databaseInitialized ( bool  success)
signal

Referenced by run().

◆ errorFromInitialization

void Digikam::ScanController::errorFromInitialization ( const QString &  )
signal

◆ filesScanned

void Digikam::ScanController::filesScanned ( int  )
signal

◆ finishFileMetadataWrite()

◆ getNewIdsList()

QList< qlonglong > Digikam::ScanController::getNewIdsList ( ) const

Returns item ids from new detected items

References Digikam::ScanController::Private::newIdsList.

◆ hintAtModificationOfItem()

◆ hintAtModificationOfItems()

void Digikam::ScanController::hintAtModificationOfItems ( const QList< qlonglong > &  ids)

Hint at the fact that an item may have changed, although its modification date may not have changed. Note that a scan of the containing directory will need to be triggered nonetheless for the hints to take effect.

References Digikam::ScanController::Private::garbageCollectHints(), Digikam::ScanController::Private::hints, Digikam::ItemChangeHint::ItemModified, and Digikam::CollectionScannerHintContainer::recordHints().

◆ hintAtMoveOrCopyOfAlbum() [1/2]

void Digikam::ScanController::hintAtMoveOrCopyOfAlbum ( const PAlbum *const  album,
const PAlbum *const  dstAlbum,
const QString &  newAlbumName = QString() 
)

Hint at the imminent copy, move or rename of an album, so that the collection scanner is informed about this. If the album is renamed, give the new name in newAlbumName. DstAlbum is the new parent album / dstPath is the new parent directory of the album, so do not include the album name to dstPath.

References Digikam::PAlbum::albumPath(), Digikam::PAlbum::albumRootId(), Digikam::ScanController::Private::hints, Digikam::CollectionScannerHintContainer::recordHints(), and Digikam::Album::title().

◆ hintAtMoveOrCopyOfAlbum() [2/2]

void Digikam::ScanController::hintAtMoveOrCopyOfAlbum ( const PAlbum *const  album,
const QString &  dstPath,
const QString &  newAlbumName = QString() 
)

◆ hintAtMoveOrCopyOfItem()

void Digikam::ScanController::hintAtMoveOrCopyOfItem ( qlonglong  id,
const PAlbum *const  dstAlbum,
const QString &  itemName 
)

◆ hintAtMoveOrCopyOfItems()

void Digikam::ScanController::hintAtMoveOrCopyOfItems ( const QList< qlonglong > &  ids,
const PAlbum *const  dstAlbum,
const QStringList &  itemNames 
)

Hint at the imminent copy, move or rename of items, so that the collection scanner is informed about this. Give the list of existing items, specify the destination with dstAlbum, and give the names at destination in itemNames (Unless for rename, names wont usually change. Give them nevertheless.)

References Digikam::PAlbum::albumRootId(), Digikam::ScanController::Private::garbageCollectHints(), Digikam::ScanController::Private::hints, Digikam::Album::id(), and Digikam::CollectionScannerHintContainer::recordHints().

◆ incrementProgressDialog

void Digikam::ScanController::incrementProgressDialog ( int  )
signal

◆ instance()

◆ newImages

void Digikam::ScanController::newImages ( const ItemInfoList )
signal

◆ partialScanDone

void Digikam::ScanController::partialScanDone ( const QString &  path)
signal

Referenced by run().

◆ progressFromInitialization

void Digikam::ScanController::progressFromInitialization ( const QString &  ,
int   
)
signal

◆ resumeCollectionScan()

void Digikam::ScanController::resumeCollectionScan ( )

Resume a suspended collection scanning. All scheduled scanning tasks are queued and will be done when resumeCollectionScan() has been called. Calling these methods is recursive, you must resume as often as you called suspend.

References Digikam::ScanController::Private::condVar, Digikam::ScanController::Private::mutex, and Digikam::ScanController::Private::scanSuspended.

Referenced by Digikam::AlbumManager::renamePAlbum(), Digikam::AlbumManager::setDatabase(), Digikam::FileActionMngrFileWorker::transform(), Digikam::FileActionMngrFileWorker::writeMetadata(), and Digikam::FileActionMngrFileWorker::writeMetadataToFiles().

◆ run()

void Digikam::ScanController::run ( )
overrideprotected

References Digikam::ScanController::Private::advice, Digikam::CoreDbAccess::backend(), Digikam::CoreDbAccess::checkReadyForUse(), collectionScanFinished(), collectionScanStarted(), Digikam::CollectionScanner::completeScan(), Digikam::ScanController::Private::completeScanDeferredAlbums, completeScanDone(), Digikam::ScanController::Private::condVar, Digikam::ScanController::Private::continueInitialization, Digikam::ScanController::Private::continuePartialScan, Digikam::ScanController::Private::continueScan, ContinueWithoutDatabase, databaseInitialized(), Digikam::CoreDbAccess::db(), Digikam::ScanController::Private::deferFileScanning, Digikam::CollectionScanner::deferredAlbumPaths(), Digikam::CollectionScanner::finishCompleteScan(), Digikam::ScanController::Private::finishScanAllowed, Digikam::CollectionScanner::getNewIdsList(), Digikam::ScanController::Private::hints, Digikam::ScanController::Private::idle, Digikam::ScanController::Private::mutex, Digikam::ScanController::Private::needsCompleteScan, Digikam::ScanController::Private::needsInitialization, Digikam::ScanController::Private::needsUpdateUniqueHash, Digikam::ScanController::Private::needTotalFiles, Digikam::ScanController::Private::newIdsList, Digikam::CoreDbAccess::parameters(), Digikam::CollectionScanner::partialScan(), partialScanDone(), Digikam::ScanController::Private::performFastScan, Digikam::ScanController::Private::running, Digikam::ScanController::Private::scanSuspended, Digikam::ScanController::Private::scanTasks, Digikam::CoreDbSchemaUpdater::setCoreDbAccess(), Digikam::CollectionScanner::setDeferredFileScanning(), Digikam::CollectionScanner::setHintContainer(), Digikam::CollectionScanner::setNeedFileCount(), Digikam::CollectionScanner::setObserver(), Digikam::CoreDbSchemaUpdater::setObserver(), Digikam::CollectionScanner::setPerformFastScan(), Success, and Digikam::CoreDbSchemaUpdater::updateUniqueHash().

◆ scannedInfo()

ItemInfo Digikam::ScanController::scannedInfo ( const QString &  filePath)

◆ scanningProgress

void Digikam::ScanController::scanningProgress ( float  progress)
signal

◆ scheduleCollectionScan()

void Digikam::ScanController::scheduleCollectionScan ( const QString &  path)

Schedules a scan of the specified part of the collection. Asynchronous, returns immediately.

References Digikam::ScanController::Private::condVar, Digikam::ScanController::Private::mutex, and Digikam::ScanController::Private::scanTasks.

◆ scheduleCollectionScanExternal()

void Digikam::ScanController::scheduleCollectionScanExternal ( const QString &  path)

Schedules a scan of the specified part of the collection. Asynchronous, returns immediately. A very long delay with timer restart may be introduced before the actual scanning starts, so that you can call this often without checking for duplicates. This method is only for the QFileSystemWatcher.

References Digikam::ScanController::Private::externalTimer, Digikam::ScanController::Private::mutex, and Digikam::ScanController::Private::scanTasks.

◆ scheduleCollectionScanRelaxed()

void Digikam::ScanController::scheduleCollectionScanRelaxed ( const QString &  path)

Schedules a scan of the specified part of the collection. Asynchronous, returns immediately. A small delay may be introduced before the actual scanning starts, so that you can call this often without checking for duplicates. This method must only be used from the main thread.

References Digikam::ScanController::Private::mutex, Digikam::ScanController::Private::relaxedTimer, and Digikam::ScanController::Private::scanTasks.

◆ shutDown()

◆ suspendCollectionScan()

void Digikam::ScanController::suspendCollectionScan ( )

Temporarily suspend collection scanning. All scheduled scanning tasks are queued and will be done when resumeCollectionScan() has been called. Calling these methods is recursive, you must resume as often as you called suspend.

References Digikam::ScanController::Private::mutex, and Digikam::ScanController::Private::scanSuspended.

Referenced by Digikam::AlbumManager::renamePAlbum(), Digikam::FileActionMngrFileWorker::transform(), Digikam::FileActionMngrFileWorker::writeMetadata(), and Digikam::FileActionMngrFileWorker::writeMetadataToFiles().

◆ totalFilesToScan

void Digikam::ScanController::totalFilesToScan ( int  )
signal

◆ triggerShowProgressDialog

void Digikam::ScanController::triggerShowProgressDialog ( )
signal

◆ updateUniqueHash()

void Digikam::ScanController::updateUniqueHash ( )

Carries out a complete collection scan, at the same time updating the unique hash in the database and thumbnail database. Synchronous, returns when ready. The database will be locked while the scan is running.

References Digikam::ScanController::Private::condVar, Digikam::ScanController::Private::eventLoop, Digikam::ScanController::Private::mutex, Digikam::ScanController::Private::needsUpdateUniqueHash, Digikam::ScanController::Private::needTotalFiles, and Digikam::ScanController::Private::progressDialog.

Friends And Related Function Documentation

◆ ScanControllerCreator

friend class ScanControllerCreator
friend

The documentation for this class was generated from the following files: