digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::ScanController Class Reference
+ Inheritance diagram for Digikam::ScanController:

Classes

class  FileMetadataWrite
 When writing metadata to the file, the file content on disk changes, but the information is taken from the database; therefore, the resulting scanning process can be optimized. More...
 

Public Types

enum  Advice { Success , ContinueWithoutDatabase , AbortImmediately }
 
- Public Types inherited from Digikam::InitializationObserver
enum  UpdateResult { UpdateSuccess , UpdateError , UpdateErrorMustAbort }
 

Public Member Functions

void allowToScanDeferredFiles ()
 
QList< qlonglong > getNewIdsList () const
 Returns item ids from new detected items.
 
ItemInfo scannedInfo (const QString &filePath, CollectionScanner::FileScanMode mode=CollectionScanner::NormalScan)
 If necessary (modified or newly created, scans the file directly Returns the up-to-date ItemInfo.
 
void updateUniqueHash ()
 Carries out a complete collection scan, at the same time updating the unique hash in the database and thumbnail database.
 

Static Public Member Functions

static ScanControllerinstance ()
 

Protected Member Functions

void run () override
 

Stop Operations

class ScanControllerCreator
 
void shutDown ()
 Wait for the thread to finish.
 
void abortInitialization ()
 If the controller is currently processing a database update (typically after first run), cancel this hard and as soon as possible.
 
void cancelCompleteScan ()
 If the controller is currently doing a complete scan (typically at startup), stop this operation.
 
void cancelAllAndSuspendCollectionScan ()
 Cancels all running or scheduled operations and suspends scanning.
 
void suspendCollectionScan ()
 Temporarily suspend collection scanning.
 
void finishFileMetadataWrite (const ItemInfo &info, bool changed)
 Implementation of FileMetadataWrite, see there.
 
void collectionScanFinished ()
 
void newImages (const ItemInfoList &)
 
void partialScanDone (const QString &path)
 
void completeScanDone ()
 
void completeScanCanceled ()
 
void errorFromInitialization (const QString &)
 

Start Operations

void restart ()
 Restart thread after shutdown.
 
Advice databaseInitialization ()
 Calls CoreDbAccess::checkReadyForUse(), providing progress feedback if schema updating occurs.
 
void completeCollectionScan (bool defer=false)
 Carries out a complete collection scan, providing progress feedback.
 
void completeCollectionScanDeferFiles ()
 
void completeCollectionScanInBackground (bool defer, bool fastScan=true)
 Scan Whole collection without to display a progress dialog or to manage splashscreen, as for NewItemsFinder tool.
 
void scheduleCollectionScan (const QString &path)
 Schedules a scan of the specified part of the collection.
 
void scheduleCollectionScanRelaxed (const QString &path)
 Schedules a scan of the specified part of the collection.
 
void scheduleCollectionScanExternal (const QString &path)
 Schedules a scan of the specified part of the collection.
 
void beginFileMetadataWrite (const ItemInfo &info)
 Implementation of FileMetadataWrite, see there.
 
void resumeCollectionScan ()
 Resume a suspended collection scanning.
 
void restartCollectionScan ()
 Restart a suspended collection scanning.
 
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())
 Hint at the imminent copy, move or rename of an album, so that the collection scanner is informed about this.
 
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)
 Hint at the imminent copy, move or rename of items, so that the collection scanner is informed about this.
 
void hintAtMoveOrCopyOfItem (qlonglong id, const PAlbum *const dstAlbum, const QString &itemName)
 
void hintAtModificationOfItems (const QList< qlonglong > &ids)
 Hint at the fact that an item may have changed, although its modification date may not have changed.
 
void hintAtModificationOfItem (qlonglong id)
 
void totalFilesToScan (int)
 
void startScanningAlbum (const QString &albumRoot, const QString &album)
 
void filesScanned (int)
 
void scanningProgress (float progress)
 
void triggerShowProgressDialog ()
 
void incrementProgressDialog (int)
 
void progressFromInitialization (const QString &, int)
 

Member Function Documentation

◆ abortInitialization()

void Digikam::ScanController::abortInitialization ( )

Any progress may be lost.

◆ beginFileMetadataWrite()

void Digikam::ScanController::beginFileMetadataWrite ( const ItemInfo info)

Calling these methods is equivalent.

◆ cancelAllAndSuspendCollectionScan()

void Digikam::ScanController::cancelAllAndSuspendCollectionScan ( )

This method returns when all scanning has stopped. This includes a call to suspendCollectionScan(). Restart with resumeCollectionScan.

◆ cancelCompleteScan()

void Digikam::ScanController::cancelCompleteScan ( )

It can be resumed later.

◆ completeCollectionScan()

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

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.

◆ databaseInitialization()

ScanController::Advice Digikam::ScanController::databaseInitialization ( )

Synchronous, returns when ready.

◆ finishFileMetadataWrite()

void Digikam::ScanController::finishFileMetadataWrite ( const ItemInfo info,
bool  changed 
)

Calling these methods is equivalent.

◆ hintAtModificationOfItems()

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

Note that a scan of the containing directory will need to be triggered nonetheless for the hints to take effect.

◆ hintAtMoveOrCopyOfAlbum()

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

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.

◆ hintAtMoveOrCopyOfItems()

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

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.)

◆ restartCollectionScan()

void Digikam::ScanController::restartCollectionScan ( )

All scheduled scanning tasks are queued and will be done when restartCollectionScan() has been called.

◆ resumeCollectionScan()

void Digikam::ScanController::resumeCollectionScan ( )

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.

◆ scheduleCollectionScan()

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

Asynchronous, returns immediately.

◆ scheduleCollectionScanExternal()

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

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.

◆ scheduleCollectionScanRelaxed()

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

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.

◆ shutDown()

void Digikam::ScanController::shutDown ( )

Returns after all tasks are done.

◆ suspendCollectionScan()

void Digikam::ScanController::suspendCollectionScan ( )

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.

◆ updateUniqueHash()

void Digikam::ScanController::updateUniqueHash ( )

Synchronous, returns when ready. The database will be locked while the scan is running.