digiKam Developer Documentation: Digikam::CollectionScanner Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Digikam::CollectionScanner Class Reference
Inheritance diagram for Digikam::CollectionScanner:

## Public Types
enum | FileScanMode { NormalScan , ModifiedScan , Rescan , CleanScan }

## Public Member Functions
QStringList | deferredAlbumPaths () const
QList< qlonglong > | getNewIdsList () const
| Returns item ids from new detected items.
void | setDeferredFileScanning (bool defer)
void | setHintContainer (CollectionScannerHintContainer *const container)
void | setNeedFileCount (bool on)
| Call this to enable emitting the total files to scan (for progress info) before a complete collection scan.
void | setObserver (CollectionScannerObserver *const observer)
| Set an observer to be able to cancel a running scan.
void | setPerformFastScan (bool on)
| Call this to disable fast scan with album date check.
void | setSignalsEnabled (bool on)
| Call this to enable the progress info signals.
void | setUpdateHashHint (bool hint=true)

## Static Public Member Functions
static CollectionScannerHintContainer * | createHintContainer ()
| Hints give the scanner additional info about things that happened in the past carried out by higher level which the collection scanner cannot know.

## Scan utilities
void | safelyRemoveAlbums (const QList< int > &albumIds)
| Prepare the given albums to be removed, typically by setting the albums as orphan and removing all entries from the albums.
static void | copyFileProperties (const ItemInfo &source, const ItemInfo &dest)
| When a file is derived from another file, typically through editing, copy all relevant attributes from source file to the new file.
void | markDatabaseAsScanned ()
void | mainEntryPoint (bool complete)
void | readDirectoryInCache (int &items, const QString &path)
int | createAlbumDateCache (const CollectionLocation &location, const QString &album)
int | checkAlbum (const CollectionLocation &location, const QString &album)
void | itemsWereRemoved (const QList< qlonglong > &removedIds)
void | updateRemovedItemsTime ()
void | incrementDeleteRemovedCompleteScanCount ()
void | resetDeleteRemovedSettings ()
bool | checkDeleteRemoved ()
void | loadNameFilters ()
DatabaseItem::Category | category (const QFileInfo &info)
void | totalFilesToScan (int count)
| Emitted once in scanAlbums(), the scan() methods, and updateItemsWithoutDate().
void | startScanningAlbumRoot (const QString &albumRoot)
| Notifies the begin of the scanning of the specified album root, album, of stale files, or of the whole collection (after stale files)
void | startScanningAlbum (const QString &albumRoot, const QString &album)
void | startScanningForStaleAlbums ()
void | startScanningAlbumRoots ()
void | startCompleteScan ()
void | signalScannedNewImage (const QFileInfo &info)
void | finishedScanningAlbumRoot (const QString &albumRoot)
| Emitted when the scanning has finished.
void | finishedScanningAlbum (const QString &albumRoot, const QString &album, int filesScanned)
void | finishedScanningForStaleAlbums ()
void | finishedCompleteScan ()
void | scannedFiles (int filesScanned)
| Emitted between startScanningAlbum and finishedScanningAlbum.
void | cancelled ()
| Emitted when the observer told to cancel the scan.

## Scan operations
void | completeScan ()
| Carries out a full scan on all available parts of the collection.
void | finishCompleteScan (const QStringList &albumPaths)
| If you enable deferred file scanning for a completeScan(), new files will not be scanned.
void | partialScan (const QString &filePath)
| Carries out a partial scan on the specified path of the collection.
void | partialScan (const QString &albumRoot, const QString &album)
| Same procedure as above, but albumRoot and album is provided.
qlonglong | scanFile (const QString &filePath, FileScanMode mode=ModifiedScan)
| The given file will be scanned according to the given mode.
qlonglong | scanFile (const QString &albumRoot, const QString &album, const QString &fileName, FileScanMode mode=ModifiedScan)
| Same procedure as above, but albumRoot and album is provided.
void | scanFile (const ItemInfo &info, FileScanMode mode=ModifiedScan)
| The given file represented by the ItemInfo will be scanned according to mode.
static bool | databaseInitialScanDone ()
| Returns if the initial scan of the database has been done.
void | scanForStaleAlbums (const CollectionLocation &location, const QString &album)
void | scanAlbumRoot (const CollectionLocation &location)
void | scanAlbum (const CollectionLocation &location, const QString &album, bool checkDate=false)
void | scanExistingFile (const QFileInfo &fi, qlonglong id)
void | scanFileNormal (const QFileInfo &info, const ItemScanInfo &scanInfo, bool checkSidecar=true, const QFileInfo *const sidecarInfo=nullptr)
void | scanModifiedFile (const QFileInfo &info, const ItemScanInfo &scanInfo)
void | scanFileUpdateHashReuseThumbnail (const QFileInfo &fi, const ItemScanInfo &scanInfo, bool fileWasEdited)
void | cleanScanFile (const QFileInfo &info, const ItemScanInfo &scanInfo)
void | rescanFile (const QFileInfo &info, const ItemScanInfo &scanInfo)
void | completeScanCleanupPart ()
void | completeHistoryScanning ()
void | finishHistoryScanning ()
void | historyScanningStage2 (const QList< qlonglong > &ids)
void | historyScanningStage3 (const QList< qlonglong > &ids)
qlonglong | scanFile (const QFileInfo &fi, int albumId, qlonglong id, FileScanMode mode)
qlonglong | scanNewFile (const QFileInfo &info, int albumId)
qlonglong | scanNewFileFullScan (const QFileInfo &info, int albumId)

## Member Enumeration Documentation

## ◆ FileScanMode

enum Digikam::CollectionScanner::FileScanMode

Enumerator
NormalScan | The file will be scanned like it is done for any usual scan. If it was not modified, no further action is taken. If the file is not known yet, it will be fully scanned, or, if an identical file is found, this data will be copied.
ModifiedScan | The file will scanned like a modified file. Only a selected portion of the metadata will be updated into the database. If the file is not known yet, it will be fully scanned, or, if an identical file is found, this data will be copied.
Rescan | The file will be scanned like a completely new file. The complete metadata is re-read into the database. No search for identical files will be done.
CleanScan | This is the same as Rescan but the database metadata will be cleaned up if the corresponding metadata write option is enabled.

## Member Function Documentation

## ◆ completeScan()

void Digikam::CollectionScanner::completeScan | ( |  | ) |

Only a full scan can finally remove deleted files from the database, only a full scan will mark the database as scanned. The database will be locked while running (Note: this is not done for partialScans).

## ◆ createHintContainer()

CollectionScannerHintContainer * Digikam::CollectionScanner::createHintContainer | ( |  | ) |
| static

They allow to carry out optimizations. Record hints in a container, and provide the container to the collection scanner. The Container set in setHintContainer must be one created by createContainer.

## ◆ databaseInitialScanDone()

bool Digikam::CollectionScanner::databaseInitialScanDone | ( |  | ) |
| static

This is the first complete scan after creation of a new database file (or update requiring a rescan)

## ◆ finishCompleteScan()

void Digikam::CollectionScanner::finishCompleteScan | ( | const QStringList & | albumPaths | ) |

The relevant albums are available from deferredAlbumPaths() when completeScan() has finished. You need to call finishCompleteScan() afterwards with the list to get the same complete scan than undeferred completeScan().

## ◆ finishedScanningAlbumRoot

void Digikam::CollectionScanner::finishedScanningAlbumRoot | ( | const QString & | albumRoot | ) |
| signal

Note that start/finishScanningAlbum may be emitted recursively.

## ◆ partialScan()

void Digikam::CollectionScanner::partialScan | ( | const QString & | filePath | ) |

The includes scanning for new files + albums and updating modified file data. Files no longer found in the specified path however are not completely removed, but only marked as removed. They will be removed only after a complete scan.

## ◆ scanFile() [1/2]

qlonglong Digikam::CollectionScanner::scanFile | ( | const QString & | albumRoot,
|  | const QString & | album,
|  | const QString & | fileName,
|  | FileScanMode | mode = `ModifiedScan`
| ) |  |

If you already have this info it need not be retrieved. Returns the image id of the file, or -1 on failure.

## ◆ scanFile() [2/2]

qlonglong Digikam::CollectionScanner::scanFile | ( | const QString & | filePath,
|  | FileScanMode | mode = `ModifiedScan`
| ) |  |

Returns the image id of the file.

## ◆ scannedFiles

void Digikam::CollectionScanner::scannedFiles | ( | int | filesScanned | ) |
| signal

In between these two signals, the sum of filesScanned of all sent signals equals the one reported by finishedScanningAlbum()

## ◆ setNeedFileCount()

void Digikam::CollectionScanner::setNeedFileCount | ( | bool | on | ) |

Default is off. If on, setSignalEnabled() must be on to take effect.

## ◆ setPerformFastScan()

void Digikam::CollectionScanner::setPerformFastScan | ( | bool | on | ) |

Default is on.

## ◆ setSignalsEnabled()

void Digikam::CollectionScanner::setSignalsEnabled | ( | bool | on | ) |

Default is off.

## ◆ totalFilesToScan

void Digikam::CollectionScanner::totalFilesToScan | ( | int | count | ) |
| signal

Gives the number of the files that need to be scanned.