digiKam
|
Classes | |
class | Private |
Public Types | |
enum | LocationCheckResult { LocationInvalidCheck , LocationAllRight , LocationHasProblems , LocationNotAllowed } |
Signals | |
void | triggerUpdateVolumesList () |
Public Member Functions | |
void | refresh () |
void | setWatchDisabled () |
Static Public Member Functions | |
static void | cleanUp () |
static CollectionManager * | instance () |
Operations on Albums | |
class | Private |
class | CoreDbWatch |
class | CoreDbAccess |
QStringList | allAvailableAlbumRootPaths () |
QString | albumRootPath (int id) |
QString | albumRootLabel (int id) |
QUrl | albumRoot (const QUrl &fileUrl) |
QString | albumRootPath (const QUrl &fileUrl) |
QString | albumRootPath (const QString &filePath) |
bool | isAlbumRoot (const QUrl &fileUrl) |
bool | isAlbumRoot (const QString &filePath) |
QString | album (const QUrl &fileUrl) |
QString | album (const QString &filePath) |
QString | album (const CollectionLocation &location, const QUrl &fileUrl) |
QString | album (const CollectionLocation &location, const QString &filePath) |
QUrl | oneAlbumRoot () |
QString | oneAlbumRootPath () |
Operations on Collection Location | |
CollectionLocation | addLocation (const QUrl &fileUrl, const QString &label=QString()) |
CollectionLocation | addNetworkLocation (const QUrl &fileUrl, const QString &label=QString()) |
CollectionLocation | refreshLocation (const CollectionLocation &location, int newType, const QUrl &fileUrl, const QString &label=QString()) |
LocationCheckResult | checkLocation (const QUrl &fileUrl, QList< CollectionLocation > &assumeDeleted, QString *message=nullptr, QString *suggestedMessageIconName=nullptr) |
LocationCheckResult | checkNetworkLocation (const QUrl &fileUrl, QList< CollectionLocation > &assumeDeleted, QString *message=nullptr, QString *suggestedMessageIconName=nullptr) |
void | removeLocation (const CollectionLocation &location) |
void | setLabel (const CollectionLocation &location, const QString &label) |
void | changeType (const CollectionLocation &location, int type) |
QList< CollectionLocation > | checkHardWiredLocations () |
void | migrationCandidates (const CollectionLocation &disappearedLocation, QString *const technicalDescription, QStringList *const candidateIdentifiers, QStringList *const candidateDescriptions) |
void | migrateToVolume (const CollectionLocation &location, const QString &identifier) |
QList< CollectionLocation > | allLocations () |
QList< CollectionLocation > | allAvailableLocations () |
CollectionLocation | locationForAlbumRootId (int id) |
CollectionLocation | locationForAlbumRoot (const QUrl &fileUrl) |
CollectionLocation | locationForAlbumRootPath (const QString &albumRootPath) |
CollectionLocation | locationForUrl (const QUrl &fileUrl) |
CollectionLocation | locationForPath (const QString &filePath) |
void | locationStatusChanged (const CollectionLocation &location, int oldStatus) |
void | locationPropertiesChanged (const CollectionLocation &location) |
CollectionLocation Digikam::CollectionManager::addLocation | ( | const QUrl & | fileUrl, |
const QString & | label = QString() |
||
) |
Add the given file system location as new collection location. Type and availability will be detected. On failure returns null. This would be the case if the given url is already contained in another collection location. You may pass an optional user-visible label that will be stored in the database. The label has no further meaning and can be freely chosen.
CollectionLocation objects returned are simple data containers. If the corresponding location is returned, the data is still safe to access, but does not represent anything. Therefore, do not store returned objects, but prefer to retrieve them freshly.
References CoreDbAccess, Digikam::CollectionManager::Private::findVolumeForUrl(), Digikam::SolidVolumeInfo::isNull(), Digikam::SolidVolumeInfo::isRemovable, Digikam::CollectionManager::Private::listVolumes(), locationForPath(), Digikam::SolidVolumeInfo::path, Digikam::AlbumRoot::VolumeHardWired, Digikam::CollectionManager::Private::volumeIdentifier(), and Digikam::AlbumRoot::VolumeRemovable.
Referenced by Digikam::SetupCollectionModel::apply(), and Digikam::AlbumManager::setDatabase().
CollectionLocation Digikam::CollectionManager::addNetworkLocation | ( | const QUrl & | fileUrl, |
const QString & | label = QString() |
||
) |
QString Digikam::CollectionManager::album | ( | const CollectionLocation & | location, |
const QString & | filePath | ||
) |
References album(), and Digikam::RedEye::location().
QString Digikam::CollectionManager::album | ( | const CollectionLocation & | location, |
const QUrl & | fileUrl | ||
) |
References album(), and Digikam::RedEye::location().
QString Digikam::CollectionManager::album | ( | const QString & | filePath | ) |
QString Digikam::CollectionManager::album | ( | const QUrl & | fileUrl | ) |
Returns the album part of the given file path, i.e. the album root path at the beginning is removed and the second part, starting with "/", ending without a slash, is returned. Example: "/media/fotos/Paris 2007" gives "/Paris 2007" Returns a null QString if the file path is not located in an album root. Returns "/" if the file path is an album root. Note that trailing slashes are removed in the return value, regardless if there was one or not. Note that you have to feed a path/url pointing to a directory. File names cannot be recognized as such by this method, and will be treated as a directory.
Referenced by album(), Digikam::CollectionScanner::countItemsInFolder(), Digikam::AlbumManager::findPAlbum(), Digikam::CollectionScanner::finishCompleteScan(), Digikam::ItemInfo::fromLocalFile(), Digikam::ScanController::hintAtMoveOrCopyOfAlbum(), Digikam::CollectionScanner::partialScan(), Digikam::ItemScanner::resolveHistoryImageId(), and Digikam::CollectionScanner::scanFile().
QUrl Digikam::CollectionManager::albumRoot | ( | const QUrl & | fileUrl | ) |
For a given path, the part of the path that forms the album root is returned, ending without a slash. Example: "/media/fotos/Paris 2007" gives "/media/fotos". Only available (or hidden, but available) album roots are guaranteed to be found.
References albumRootPath().
QString Digikam::CollectionManager::albumRootLabel | ( | int | id | ) |
Returns the album root label with the given id. Returns a null QString if the root path does not exist or is not available.
References Digikam::RedEye::location(), Digikam::CollectionLocation::LocationAvailable, Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by Digikam::PAlbum::albumRootLabel().
QString Digikam::CollectionManager::albumRootPath | ( | const QString & | filePath | ) |
QString Digikam::CollectionManager::albumRootPath | ( | const QUrl & | fileUrl | ) |
References albumRootPath().
QString Digikam::CollectionManager::albumRootPath | ( | int | id | ) |
Returns the album root path with the given id. Returns a null QString if the root path does not exist or is not available.
References Digikam::RedEye::location(), Digikam::CollectionLocation::LocationAvailable, Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by albumRoot(), Digikam::PAlbum::albumRootPath(), albumRootPath(), Digikam::DTrash::deleteImage(), Digikam::ItemInfo::filePath(), Digikam::CoreDB::getDirtyOrMissingFaceImageUrls(), Digikam::CoreDB::getItemIDsAndURLsInAlbum(), Digikam::CoreDB::getItemsURLsWithTag(), Digikam::CoreDB::getItemURLsInAlbum(), Digikam::CoreDB::getItemURLsInTag(), Digikam::ItemScanner::ItemScanner(), locationForAlbumRootPath(), Digikam::CollectionScanner::partialScan(), Digikam::CollectionScanner::scanFile(), and Digikam::AlbumModificationHelper::slotAlbumNew().
QStringList Digikam::CollectionManager::allAvailableAlbumRootPaths | ( | ) |
Returns a list of the paths of all currently available root paths
References Digikam::RedEye::location(), Digikam::CollectionLocation::LocationAvailable, Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by Digikam::DBInfoIface::defaultUploadUrl().
QList< CollectionLocation > Digikam::CollectionManager::allAvailableLocations | ( | ) |
Returns a list of all currently available CollectionLocations
References Digikam::RedEye::location(), Digikam::CollectionLocation::LocationAvailable, Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by Digikam::CollectionScanner::completeScan().
QList< CollectionLocation > Digikam::CollectionManager::allLocations | ( | ) |
Returns a list of all CollectionLocations stored in the database
References Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by Digikam::SetupCollectionModel::loadCollections().
void Digikam::CollectionManager::changeType | ( | const CollectionLocation & | location, |
int | type | ||
) |
Changes the CollectionLocation::Type of the given location
References CoreDbAccess, Digikam::CollectionLocation::id(), Digikam::RedEye::location(), locationPropertiesChanged(), Digikam::CollectionManager::Private::locations, Digikam::CollectionManager::Private::lock, and Digikam::AlbumRootLocation::setType().
Referenced by Digikam::AlbumManager::setDatabase().
QList< CollectionLocation > Digikam::CollectionManager::checkHardWiredLocations | ( | ) |
Checks the locations of type HardWired. If one of these is not available currently, it is added to the list of disappeared locations. This case may happen if a file system is changed, a backup restored or other actions taken that change the UUID, although the data may still be available and mounted. If there are hard-wired volumes available which are candidates for a newly appeared volume (in fact those that do not contain any collections currently), they are added to the map, identifier -> i18n'ed user presentable description. The identifier can be used for changeVolume.
References Digikam::CollectionManager::Private::listVolumes(), Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, Digikam::CollectionLocation::LocationUnavailable, Digikam::CollectionManager::Private::lock, and Digikam::CollectionLocation::TypeVolumeHardWired.
Referenced by Digikam::AlbumManager::setDatabase().
CollectionManager::LocationCheckResult Digikam::CollectionManager::checkLocation | ( | const QUrl & | fileUrl, |
QList< CollectionLocation > & | assumeDeleted, | ||
QString * | message = nullptr , |
||
QString * | suggestedMessageIconName = nullptr |
||
) |
Analyzes the given file path. Creates an info message describing the result of identification or possible problems. The text is i18n'ed and can be presented to the user. The returned result enum describes the test result.
References Digikam::CollectionManager::Private::checkIfExists(), Digikam::CollectionManager::Private::findVolumeForUrl(), Digikam::AlbumRootLocation::identifier, Digikam::SolidVolumeInfo::isNull(), Digikam::SolidVolumeInfo::isOpticalDisc, Digikam::SolidVolumeInfo::isRemovable, Digikam::SolidVolumeInfo::label, Digikam::CollectionManager::Private::listVolumes(), LocationAllRight, LocationHasProblems, LocationNotAllowed, Digikam::CollectionManager::Private::locations, Digikam::SolidVolumeInfo::path, and Digikam::SolidVolumeInfo::uuid.
Referenced by Digikam::SetupCollectionModel::askForNewCollectionPath().
CollectionManager::LocationCheckResult Digikam::CollectionManager::checkNetworkLocation | ( | const QUrl & | fileUrl, |
QList< CollectionLocation > & | assumeDeleted, | ||
QString * | message = nullptr , |
||
QString * | suggestedMessageIconName = nullptr |
||
) |
References Digikam::CollectionManager::Private::checkIfExists(), LocationAllRight, and LocationNotAllowed.
Referenced by Digikam::SetupCollectionModel::askForNewCollectionPath().
|
static |
|
static |
Referenced by Digikam::PAlbum::albumRootLabel(), Digikam::PAlbum::albumRootPath(), Digikam::ToolTipFiller::albumTipContents(), Digikam::SetupCollectionModel::apply(), Digikam::SetupCollectionModel::askForNewCollectionPath(), Digikam::CoreDbAccess::checkReadyForUse(), Digikam::CollectionScanner::completeScan(), Digikam::CoreDbAccess::CoreDbAccess(), Digikam::CollectionScanner::countItemsInFolder(), Digikam::AlbumManager::createPAlbum(), Digikam::DBInfoIface::defaultUploadUrl(), Digikam::DTrash::deleteImage(), Digikam::ItemInfo::filePath(), Digikam::AlbumManager::findPAlbum(), Digikam::CollectionScanner::finishCompleteScan(), Digikam::CoreDbUrl::fromAlbumAndName(), Digikam::CoreDbUrl::fromFileUrl(), Digikam::ItemInfo::fromLocalFile(), Digikam::CoreDB::getDirtyOrMissingFaceImageUrls(), Digikam::CoreDB::getItemIDsAndURLsInAlbum(), Digikam::CoreDB::getItemsURLsWithTag(), Digikam::CoreDB::getItemURLsInAlbum(), Digikam::CoreDB::getItemURLsInTag(), Digikam::ScanController::hintAtMoveOrCopyOfAlbum(), Digikam::CoreDbWatch::initializeRemote(), Digikam::ItemInfo::isLocationAvailable(), Digikam::ItemScanner::ItemScanner(), Digikam::ItemLister::listPAlbum(), Digikam::SetupCollectionModel::loadCollections(), Digikam::CollectionScanner::partialScan(), Digikam::ItemScanner::resolvedImageHistory(), Digikam::ItemScanner::resolveHistoryImageId(), Digikam::CollectionScanner::scanFile(), Digikam::CollectionScanner::scanForStaleAlbums(), Digikam::AlbumManager::setDatabase(), Digikam::CoreDbAccess::setParameters(), Digikam::AlbumManager::setShowOnlyAvailableAlbums(), Digikam::AlbumWatch::slotAlbumAdded(), Digikam::AlbumModificationHelper::slotAlbumNew(), Digikam::ImportUI::slotDownload(), Digikam::AlbumManager::startScan(), Digikam::ItemInfo::thumbnailInfo(), and Digikam::DatabaseVersionManager::toplevelDirectory().
bool Digikam::CollectionManager::isAlbumRoot | ( | const QString & | filePath | ) |
The file path should not end with the directory slash. Using CoreDbUrl's method is fine.
References Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
bool Digikam::CollectionManager::isAlbumRoot | ( | const QUrl & | fileUrl | ) |
Returns true if the given path forms an album root. It will return false if the path is a path below an album root, or if the path does not belong to an album root. Example: "/media/fotos/Paris 2007" is an album with album root "/media/fotos". "/media/fotos" returns true, "/media/fotos/Paris 2007" and "/media" return false. Only available (or hidden, but available) album roots are guaranteed to be found.
CollectionLocation Digikam::CollectionManager::locationForAlbumRoot | ( | const QUrl & | fileUrl | ) |
Returns the CollectionLocation that contains the given album root. The path must be an album root with isAlbumRoot() == true. Returns 0 if no collection location matches. Only available (or hidden, but available) locations are guaranteed to be found.
References locationForAlbumRootPath().
Referenced by Digikam::CoreDbUrl::fromAlbumAndName(), and Digikam::CoreDbUrl::fromFileUrl().
CollectionLocation Digikam::CollectionManager::locationForAlbumRootId | ( | int | id | ) |
Returns the location for the given album root id
References Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by Digikam::ToolTipFiller::albumTipContents(), Digikam::ItemInfo::isLocationAvailable(), Digikam::ItemScanner::resolvedImageHistory(), Digikam::CollectionScanner::scanForStaleAlbums(), Digikam::AlbumWatch::slotAlbumAdded(), Digikam::ImportUI::slotDownload(), and Digikam::ItemInfo::thumbnailInfo().
CollectionLocation Digikam::CollectionManager::locationForAlbumRootPath | ( | const QString & | albumRootPath | ) |
References albumRootPath(), Digikam::DeleteDialogMode::Files, Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by Digikam::AlbumManager::createPAlbum(), locationForAlbumRoot(), Digikam::CollectionScanner::partialScan(), and Digikam::CollectionScanner::scanFile().
CollectionLocation Digikam::CollectionManager::locationForPath | ( | const QString & | filePath | ) |
References Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by addLocation(), addNetworkLocation(), Digikam::CollectionScanner::countItemsInFolder(), Digikam::CollectionScanner::finishCompleteScan(), Digikam::ItemInfo::fromLocalFile(), Digikam::ScanController::hintAtMoveOrCopyOfAlbum(), locationForUrl(), refreshLocation(), Digikam::ItemScanner::resolveHistoryImageId(), and Digikam::DatabaseVersionManager::toplevelDirectory().
CollectionLocation Digikam::CollectionManager::locationForUrl | ( | const QUrl & | fileUrl | ) |
Returns the CollectionLocation that contains the given path. Equivalent to calling locationForAlbumRoot(albumRoot(fileUrl)). Only available (or hidden, but available) locations are guaranteed to be found.
References locationForPath().
Referenced by Digikam::AlbumManager::findPAlbum().
|
signal |
Emitted when the label of a collection location is changed
Referenced by changeType(), refreshLocation(), and setLabel().
|
signal |
Emitted when the status of a collection location changed. This means that the location became available, hidden or unavailable.
An added location will change its status after addition, from Null to Available, Hidden or Unavailable.
A removed location will change its status to Deleted during the removal; in this case, you shall not use the object passed with this signal with any method of CollectionManager.
The second signal argument is of type CollectionLocation::Status and describes the status before the state change occurred
void Digikam::CollectionManager::migrateToVolume | ( | const CollectionLocation & | location, |
const QString & | identifier | ||
) |
Migrates the existing collection to a new volume, identified by an internal identifier as returned by checkHardWiredLocations(). Use this only to react to changes like those detailed for checkHardWiredLocations; the actual data pointed to shall be unchanged.
References CoreDbAccess, Digikam::CollectionLocation::id(), Digikam::AlbumRootLocation::identifier, Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, and Digikam::CollectionManager::Private::lock.
Referenced by Digikam::AlbumManager::setDatabase().
void Digikam::CollectionManager::migrationCandidates | ( | const CollectionLocation & | disappearedLocation, |
QString *const | technicalDescription, | ||
QStringList *const | candidateIdentifiers, | ||
QStringList *const | candidateDescriptions | ||
) |
For a given disappeared location (retrieved from checkHardWiredLocations()) retrieve a user-presentable technical description (excluding the CollectionLocation's label) and a list of identifiers and corresponding user presentable strings of candidates to where the given location may have been moved.
References Digikam::SolidVolumeInfo::isMounted, Digikam::CollectionManager::Private::listVolumes(), Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, Digikam::CollectionManager::Private::lock, Digikam::SolidVolumeInfo::path, Digikam::AlbumRootLocation::specificPath, Digikam::CollectionManager::Private::technicalDescription(), and Digikam::CollectionManager::Private::volumeIdentifier().
Referenced by Digikam::AlbumManager::setDatabase().
QUrl Digikam::CollectionManager::oneAlbumRoot | ( | ) |
Returns just one album root, out of the list of available location, the one that is most suitable to serve as a default, e.g. to suggest as default place when the user wants to add files.
References oneAlbumRootPath().
QString Digikam::CollectionManager::oneAlbumRootPath | ( | ) |
void Digikam::CollectionManager::refresh | ( | ) |
Clears all locations and re-reads the lists of collection locations. Enables the watch.
Referenced by Digikam::CoreDbAccess::checkReadyForUse(), and Digikam::CoreDbAccess::CoreDbAccess().
CollectionLocation Digikam::CollectionManager::refreshLocation | ( | const CollectionLocation & | location, |
int | newType, | ||
const QUrl & | fileUrl, | ||
const QString & | label = QString() |
||
) |
References Digikam::CoreDB::changeAlbumRootType(), Digikam::CoreDbAccess::db(), Digikam::CollectionManager::Private::findVolumeForUrl(), Digikam::AlbumRootLocation::identifier, Digikam::SolidVolumeInfo::isNull(), Digikam::CollectionManager::Private::listVolumes(), Digikam::RedEye::location(), locationForPath(), locationPropertiesChanged(), Digikam::CollectionManager::Private::locations, Digikam::CollectionManager::Private::lock, Digikam::CoreDB::migrateAlbumRoot(), Digikam::AlbumRoot::Network, Digikam::CollectionManager::Private::networkShareIdentifier(), Digikam::SolidVolumeInfo::path, Digikam::CoreDB::setAlbumRootLabel(), Digikam::CoreDB::setAlbumRootPath(), Digikam::AlbumRootLocation::setLabel(), Digikam::AlbumRootLocation::setType(), Digikam::AlbumRootLocation::specificPath, Digikam::CollectionLocation::TypeNetwork, Digikam::CollectionLocation::TypeVolumeRemovable, Digikam::AlbumRoot::VolumeHardWired, Digikam::CollectionManager::Private::volumeIdentifier(), and Digikam::AlbumRoot::VolumeRemovable.
Referenced by Digikam::SetupCollectionModel::apply().
void Digikam::CollectionManager::removeLocation | ( | const CollectionLocation & | location | ) |
Removes the given location. This means that all images contained on the location will be removed from the database, all tags will be lost.
References Digikam::CoreDbAccess::db(), Digikam::CoreDB::deleteAlbumRoot(), Digikam::CoreDB::getAlbumsOnAlbumRoot(), Digikam::CollectionLocation::id(), Digikam::RedEye::location(), Digikam::CollectionManager::Private::locations, Digikam::CollectionManager::Private::lock, and Digikam::CollectionScanner::safelyRemoveAlbums().
Referenced by Digikam::SetupCollectionModel::apply().
void Digikam::CollectionManager::setLabel | ( | const CollectionLocation & | location, |
const QString & | label | ||
) |
Sets the label of the given location
References CoreDbAccess, Digikam::CollectionLocation::id(), Digikam::RedEye::location(), locationPropertiesChanged(), Digikam::CollectionManager::Private::locations, Digikam::CollectionManager::Private::lock, and Digikam::AlbumRootLocation::setLabel().
Referenced by Digikam::SetupCollectionModel::apply().
void Digikam::CollectionManager::setWatchDisabled | ( | ) |
Disables the collection watch. It will be reenabled as soon as refresh() is called or any other action triggered.
References Digikam::CollectionManager::Private::watchEnabled.
Referenced by Digikam::AlbumManager::setDatabase().
|
signal |
Referenced by Digikam::CollectionManager::Private::Private().
|
friend |
Referenced by addLocation(), addNetworkLocation(), changeType(), migrateToVolume(), and setLabel().
|
friend |
|
friend |