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

Classes

class  Private
 

Public Types

enum  FileScanMode { NormalScan , ModifiedScan , Rescan }
 

Public Member Functions

 CollectionScanner ()
 
QStringList deferredAlbumPaths () const
 
QList< qlonglong > getNewIdsList () const
 
void setDeferredFileScanning (bool defer)
 
void setHintContainer (CollectionScannerHintContainer *const container)
 
void setNeedFileCount (bool on)
 
void setObserver (CollectionScannerObserver *const observer)
 
void setPerformFastScan (bool on)
 
void setSignalsEnabled (bool on)
 
void setUpdateHashHint (bool hint=true)
 
 ~CollectionScanner () override
 

Static Public Member Functions

static CollectionScannerHintContainercreateHintContainer ()
 

Scan utilities

void safelyRemoveAlbums (const QList< int > &albumIds)
 
static void copyFileProperties (const ItemInfo &source, const ItemInfo &dest)
 
void markDatabaseAsScanned ()
 
void mainEntryPoint (bool complete)
 
int checkAlbum (const CollectionLocation &location, const QString &album)
 
void itemsWereRemoved (const QList< qlonglong > &removedIds)
 
void updateRemovedItemsTime ()
 
void incrementDeleteRemovedCompleteScanCount ()
 
void resetDeleteRemovedSettings ()
 
bool checkDeleteRemoved ()
 
void loadNameFilters ()
 
int countItemsInFolder (const QString &path)
 
DatabaseItem::Category category (const QFileInfo &info)
 
void totalFilesToScan (int count)
 
void startScanningAlbumRoot (const QString &albumRoot)
 
void startScanningAlbum (const QString &albumRoot, const QString &album)
 
void startScanningForStaleAlbums ()
 
void startScanningAlbumRoots ()
 
void startCompleteScan ()
 
void signalScannedNewImage (const QFileInfo &info)
 
void finishedScanningAlbumRoot (const QString &albumRoot)
 
void finishedScanningAlbum (const QString &albumRoot, const QString &album, int filesScanned)
 
void finishedScanningForStaleAlbums ()
 
void finishedCompleteScan ()
 
void scannedFiles (int filesScanned)
 
void cancelled ()
 

Scan operations

void completeScan ()
 
void finishCompleteScan (const QStringList &albumPaths)
 
void partialScan (const QString &filePath)
 
void partialScan (const QString &albumRoot, const QString &album)
 
qlonglong scanFile (const QString &filePath, FileScanMode mode=ModifiedScan)
 
qlonglong scanFile (const QString &albumRoot, const QString &album, const QString &fileName, FileScanMode mode=ModifiedScan)
 
void scanFile (const ItemInfo &info, FileScanMode mode=ModifiedScan)
 
static bool databaseInitialScanDone ()
 
void scanForStaleAlbums (const QList< CollectionLocation > &locations)
 
void scanForStaleAlbums (const QList< int > &locationIdsToScan)
 
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)
 
void scanModifiedFile (const QFileInfo &info, const ItemScanInfo &scanInfo)
 
void scanFileUpdateHashReuseThumbnail (const QFileInfo &fi, const ItemScanInfo &scanInfo, bool fileWasEdited)
 
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

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.

Constructor & Destructor Documentation

◆ CollectionScanner()

Digikam::CollectionScanner::CollectionScanner ( )
explicit

◆ ~CollectionScanner()

Digikam::CollectionScanner::~CollectionScanner ( )
override

Member Function Documentation

◆ cancelled

void Digikam::CollectionScanner::cancelled ( )
signal

Emitted when the observer told to cancel the scan

Referenced by completeScan(), finishCompleteScan(), and partialScan().

◆ category()

◆ checkAlbum()

◆ checkDeleteRemoved()

bool Digikam::CollectionScanner::checkDeleteRemoved ( )
protected

◆ completeHistoryScanning()

◆ completeScan()

◆ completeScanCleanupPart()

◆ copyFileProperties()

◆ countItemsInFolder()

◆ createHintContainer()

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

Hints give the scanner additional info about things that happened in the past carried out by higher level which the collection scanner cannot know. 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

Returns if the initial scan of the database has been done. This is the first complete scan after creation of a new database file (or update requiring a rescan)

References Digikam::CoreDbAccess::db(), and Digikam::CoreDB::getSetting().

Referenced by Digikam::ScanController::completeCollectionScan(), Digikam::DigikamApp::DigikamApp(), and Digikam::DigikamApp::show().

◆ deferredAlbumPaths()

QStringList Digikam::CollectionScanner::deferredAlbumPaths ( ) const

◆ finishCompleteScan()

◆ finishedCompleteScan

void Digikam::CollectionScanner::finishedCompleteScan ( )
signal

◆ finishedScanningAlbum

void Digikam::CollectionScanner::finishedScanningAlbum ( const QString &  albumRoot,
const QString &  album,
int  filesScanned 
)
signal

Referenced by scanAlbum().

◆ finishedScanningAlbumRoot

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

Emitted when the scanning has finished. Note that start/finishScanningAlbum may be emitted recursively.

Referenced by scanAlbumRoot().

◆ finishedScanningForStaleAlbums

void Digikam::CollectionScanner::finishedScanningForStaleAlbums ( )
signal

Referenced by scanForStaleAlbums().

◆ finishHistoryScanning()

◆ getNewIdsList()

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

Returns item ids from new detected items

References Digikam::CollectionScanner::Private::newIdsList.

Referenced by Digikam::ScanController::run().

◆ historyScanningStage2()

◆ historyScanningStage3()

void Digikam::CollectionScanner::historyScanningStage3 ( const QList< qlonglong > &  ids)
protected

◆ incrementDeleteRemovedCompleteScanCount()

void Digikam::CollectionScanner::incrementDeleteRemovedCompleteScanCount ( )
protected

◆ itemsWereRemoved()

◆ loadNameFilters()

◆ mainEntryPoint()

void Digikam::CollectionScanner::mainEntryPoint ( bool  complete)
protected

◆ markDatabaseAsScanned()

void Digikam::CollectionScanner::markDatabaseAsScanned ( )
protected

◆ partialScan() [1/2]

◆ partialScan() [2/2]

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

Carries out a partial scan on the specified path of the collection. 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.

References Digikam::CollectionManager::album(), Digikam::CollectionManager::albumRootPath(), and Digikam::CollectionManager::instance().

Referenced by Digikam::ScanController::run().

◆ rescanFile()

void Digikam::CollectionScanner::rescanFile ( const QFileInfo &  info,
const ItemScanInfo scanInfo 
)
protected

◆ resetDeleteRemovedSettings()

void Digikam::CollectionScanner::resetDeleteRemovedSettings ( )
protected

◆ safelyRemoveAlbums()

void Digikam::CollectionScanner::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

References Digikam::CoreDbAccess::db(), Digikam::CoreDB::getItemIDsInAlbum(), itemsWereRemoved(), Digikam::CoreDB::makeStaleAlbum(), and Digikam::CoreDB::removeItemsFromAlbum().

Referenced by Digikam::CollectionManager::removeLocation(), and scanForStaleAlbums().

◆ scanAlbum()

◆ scanAlbumRoot()

◆ scanExistingFile()

void Digikam::CollectionScanner::scanExistingFile ( const QFileInfo &  fi,
qlonglong  id 
)
protected

◆ scanFile() [1/4]

void Digikam::CollectionScanner::scanFile ( const ItemInfo info,
FileScanMode  mode = ModifiedScan 
)

◆ scanFile() [2/4]

qlonglong Digikam::CollectionScanner::scanFile ( const QFileInfo &  fi,
int  albumId,
qlonglong  id,
FileScanMode  mode 
)
protected

◆ scanFile() [3/4]

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

Same procedure as above, but albumRoot and album is provided. If you already have this info it need not be retrieved. Returns the image id of the file, or -1 on failure.

References checkAlbum(), Digikam::CoreDbAccess::db(), Digikam::CoreDB::getImageId(), Digikam::CollectionManager::instance(), Digikam::RedEye::location(), Digikam::CollectionManager::locationForAlbumRootPath(), and scanFile().

◆ scanFile() [4/4]

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

◆ scanFileNormal()

◆ scanFileUpdateHashReuseThumbnail()

◆ scanForStaleAlbums() [1/2]

void Digikam::CollectionScanner::scanForStaleAlbums ( const QList< CollectionLocation > &  locations)
protected

References Digikam::RedEye::location().

Referenced by completeScan(), and partialScan().

◆ scanForStaleAlbums() [2/2]

◆ scanModifiedFile()

void Digikam::CollectionScanner::scanModifiedFile ( const QFileInfo &  info,
const ItemScanInfo scanInfo 
)
protected

◆ scannedFiles

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

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

Referenced by scanAlbum(), scanAlbumRoot(), and scanForStaleAlbums().

◆ scanNewFile()

◆ scanNewFileFullScan()

qlonglong Digikam::CollectionScanner::scanNewFileFullScan ( const QFileInfo &  info,
int  albumId 
)
protected

◆ setDeferredFileScanning()

void Digikam::CollectionScanner::setDeferredFileScanning ( bool  defer)

◆ setHintContainer()

void Digikam::CollectionScanner::setHintContainer ( CollectionScannerHintContainer *const  container)

◆ setNeedFileCount()

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

Call this to enable emitting the total files to scan (for progress info) before a complete collection scan. Default is off. If on, setSignalEnabled() must be on to take effect.

References Digikam::CollectionScanner::Private::needTotalFiles.

Referenced by Digikam::ScanController::run(), and Digikam::CoreDbSchemaUpdater::updateUniqueHash().

◆ setObserver()

void Digikam::CollectionScanner::setObserver ( CollectionScannerObserver *const  observer)

Set an observer to be able to cancel a running scan

References Digikam::CollectionScanner::Private::observer.

Referenced by Digikam::ScanController::run(), and Digikam::CoreDbSchemaUpdater::updateUniqueHash().

◆ setPerformFastScan()

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

Call this to disable fast scan with album date check. Default is on.

References Digikam::CollectionScanner::Private::performFastScan.

Referenced by Digikam::ScanController::run().

◆ setSignalsEnabled()

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

Call this to enable the progress info signals. Default is off.

References Digikam::CollectionScanner::Private::wantSignals.

◆ setUpdateHashHint()

void Digikam::CollectionScanner::setUpdateHashHint ( bool  hint = true)

◆ signalScannedNewImage

void Digikam::CollectionScanner::signalScannedNewImage ( const QFileInfo &  info)
signal

◆ startCompleteScan

void Digikam::CollectionScanner::startCompleteScan ( )
signal

Referenced by completeScan(), and finishCompleteScan().

◆ startScanningAlbum

void Digikam::CollectionScanner::startScanningAlbum ( const QString &  albumRoot,
const QString &  album 
)
signal

Referenced by scanAlbum().

◆ startScanningAlbumRoot

void Digikam::CollectionScanner::startScanningAlbumRoot ( const QString &  albumRoot)
signal

Notifies the begin of the scanning of the specified album root, album, of stale files, or of the whole collection (after stale files)

Referenced by scanAlbumRoot().

◆ startScanningAlbumRoots

void Digikam::CollectionScanner::startScanningAlbumRoots ( )
signal

Referenced by completeScan(), and finishCompleteScan().

◆ startScanningForStaleAlbums

void Digikam::CollectionScanner::startScanningForStaleAlbums ( )
signal

Referenced by scanForStaleAlbums().

◆ totalFilesToScan

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

Emitted once in scanAlbums(), the scan() methods, and updateItemsWithoutDate(). Gives the number of the files that need to be scanned.

Referenced by completeScan(), finishCompleteScan(), and scanForStaleAlbums().

◆ updateRemovedItemsTime()

void Digikam::CollectionScanner::updateRemovedItemsTime ( )
protected

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