digiKam Developer Documentation: Digikam::ScanController Class Reference

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

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
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 ScanController * | instance ()

## Protected Member Functions
void | run () override

## Stop Operations
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 | 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.

## ◆ 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.