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

Public Slots

void slotFaceTagDelete ()
 
void slotFaceTagDelete (TAlbum *tag)
 
void slotMultipleFaceTagDel ()
 
void slotMultipleFaceTagDel (const QList< TAlbum * > &tags)
 
void slotMultipleTagDel ()
 
void slotMultipleTagDel (const QList< TAlbum * > &tags)
 must use bindTag and a QAction More...
 
void slotMultipleTagsToFaceTags ()
 
void slotMultipleTagsToFaceTags (const QList< TAlbum * > &tags)
 
void slotTagDelete ()
 
void slotTagDelete (TAlbum *tag)
 
void slotTagEdit ()
 
void slotTagEdit (TAlbum *tag)
 
TAlbumslotTagNew ()
 
TAlbumslotTagNew (TAlbum *parent, const QString &title=QString(), const QString &iconName=QString())
 
void slotTagToFaceTag ()
 
void slotTagToFaceTag (TAlbum *tag)
 

Signals

void aboutToDeleteTag (TAlbum *tag)
 
void tagCreated (TAlbum *tag)
 
void tagEdited (TAlbum *tag)
 

Public Member Functions

void bindMultipleTags (QAction *action, const QList< TAlbum * > &tags)
 
void bindTag (QAction *action, TAlbum *parent) const
 
QList< TAlbum * > boundMultipleTags (QObject *sender)
 
TAlbumboundTag (QObject *action) const
 
 TagModificationHelper (QObject *const parent, QWidget *const dialogParent)
 
 ~TagModificationHelper () override
 

Detailed Description

Utility class providing methods to modify tag albums (TAlbum) in a way useful to implement views.

This class can do background processing for batch tag operations. So be sure that the signals indicating the progress of these operations are used.

Author
jwienke

Constructor & Destructor Documentation

◆ TagModificationHelper()

Digikam::TagModificationHelper::TagModificationHelper ( QObject *const  parent,
QWidget *const  dialogParent 
)
explicit

Constructor.

Parameters
parentthe parent for qt parent child mechanism
dialogParentparent widget for dialogs displayed by this object

◆ ~TagModificationHelper()

Digikam::TagModificationHelper::~TagModificationHelper ( )
override

Destructor.

Member Function Documentation

◆ aboutToDeleteTag

void Digikam::TagModificationHelper::aboutToDeleteTag ( TAlbum tag)
signal

◆ bindMultipleTags()

void Digikam::TagModificationHelper::bindMultipleTags ( QAction *  action,
const QList< TAlbum * > &  tags 
)

Set QVector's pointer into action's data. Make sure that QVector is not a local object and it's not destroyed before boundMultipleTags are called

Parameters
action- action to store pointer
tags- QVector pointer to be stored

Referenced by Digikam::ContextMenuHelper::addActionDeleteFaceTags(), Digikam::ContextMenuHelper::addActionDeleteTags(), and Digikam::ContextMenuHelper::addActionTagsToFaceTags().

◆ bindTag()

void Digikam::TagModificationHelper::bindTag ( QAction *  action,
TAlbum parent 
) const

Sets the tag that the given action operates on. You must call bindTag and then connect the action's triggered to the desired slot, slotTagNew(), slotTagEdit() or slotTagDelete(). Note: Changes the Action's user data.

Referenced by Digikam::ContextMenuHelper::addActionDeleteFaceTag(), Digikam::ContextMenuHelper::addActionDeleteTag(), Digikam::ContextMenuHelper::addActionEditTag(), Digikam::ContextMenuHelper::addActionNewTag(), and Digikam::ContextMenuHelper::addActionTagToFaceTag().

◆ boundMultipleTags()

QList< TAlbum * > Digikam::TagModificationHelper::boundMultipleTags ( QObject *  sender)

Return QVector pointer bound with bindMultipleTags. Use when context menu should delete more than one item: multiple-selection.

Referenced by slotMultipleFaceTagDel(), slotMultipleTagDel(), and slotMultipleTagsToFaceTags().

◆ boundTag()

TAlbum * Digikam::TagModificationHelper::boundTag ( QObject *  action) const

Returns the tag bound with bindTag. The given QObject shall be a QAction, but for convenience the given object will be checked with qobject_cast first, so you can pass QObject::sender().

Referenced by slotFaceTagDelete(), slotTagDelete(), slotTagEdit(), slotTagNew(), and slotTagToFaceTag().

◆ slotFaceTagDelete [1/2]

void Digikam::TagModificationHelper::slotFaceTagDelete ( )
slot

must use bindTag and a QAction

References boundTag().

◆ slotFaceTagDelete [2/2]

void Digikam::TagModificationHelper::slotFaceTagDelete ( TAlbum tag)
slot

Deletes the given face tag and after prompting the user for this. The tag itself is not deleted. Only its property as face tag.

Parameters
tagthe face tag to delete

References slotMultipleFaceTagDel().

◆ slotMultipleFaceTagDel [1/2]

void Digikam::TagModificationHelper::slotMultipleFaceTagDel ( )
slot

must use bindMultipleTags and a QAction

References boundMultipleTags().

Referenced by slotFaceTagDelete().

◆ slotMultipleFaceTagDel [2/2]

◆ slotMultipleTagDel [1/2]

void Digikam::TagModificationHelper::slotMultipleTagDel ( )
slot

must use bindMultipleTags and a QAction

References boundMultipleTags().

◆ slotMultipleTagDel [2/2]

void Digikam::TagModificationHelper::slotMultipleTagDel ( const QList< TAlbum * > &  tags)
slot

must use bindTag and a QAction

Delete multiple tags and prompt user only once for all

Parameters
tagsthe tags to be deleted, without root tag

Tags must be deleted from children to parents, if we don't want to step on invalid index. Use QMultiMap to order them by distance to root tag

QMultimap doesn't provide reverse iterator, -1 is required because end() points after the last element

References aboutToDeleteTag(), Digikam::AlbumIterator::current(), Digikam::CoreDbAccess::db(), Digikam::CoreDB::getItemIDsInTag(), Digikam::AlbumManager::instance(), Digikam::Album::isRoot(), and Digikam::Album::parent().

◆ slotMultipleTagsToFaceTags [1/2]

void Digikam::TagModificationHelper::slotMultipleTagsToFaceTags ( )
slot

must use bindMultipleTags and a QAction

References boundMultipleTags().

◆ slotMultipleTagsToFaceTags [2/2]

void Digikam::TagModificationHelper::slotMultipleTagsToFaceTags ( const QList< TAlbum * > &  tags)
slot

Marks the tags as face tags if they are not already.

Parameters
tagsthe tags to mark.

References slotTagToFaceTag().

◆ slotTagDelete [1/2]

void Digikam::TagModificationHelper::slotTagDelete ( )
slot

must use bindTag and a QAction

References boundTag().

◆ slotTagDelete [2/2]

void Digikam::TagModificationHelper::slotTagDelete ( TAlbum tag)
slot

Deletes the given tag and after prompting the user for this.

Parameters
tagthe tag to delete, must not be the root tag album

References aboutToDeleteTag(), Digikam::AlbumIterator::current(), Digikam::CoreDbAccess::db(), Digikam::CoreDB::getItemIDsInTag(), Digikam::AlbumManager::instance(), and Digikam::Album::isRoot().

Referenced by Digikam::ItemIconView::slotDeleteTag().

◆ slotTagEdit [1/2]

void Digikam::TagModificationHelper::slotTagEdit ( )
slot

must use bindTag and a QAction

References boundTag().

◆ slotTagEdit [2/2]

◆ slotTagNew [1/2]

TAlbum * Digikam::TagModificationHelper::slotTagNew ( )
slot

Same as above, but this slot can be triggered from a QAction if a parent tag is bound to this action, see below. Without this mechanism, will add a toplevel tag.

Returns
new tag created or 0 if no tag was created

References boundTag().

◆ slotTagNew [2/2]

TAlbum * Digikam::TagModificationHelper::slotTagNew ( TAlbum parent,
const QString &  title = QString(),
const QString &  iconName = QString() 
)
slot

Creates one ore more new tags under the given parent. If only the parent is given, then a dialog is shown to create new tags. Else, if also a title and optionally an icon are given, then these values will be used directly to create the tag.

Parameters
parentthe parent tag album under which to create the new tags. May be 0 to use the root album
titleif this isn't an empty string, then this tag name is suggested
iconNamean optional name for the icon to suggest for the new tag
Returns
new tag album or 0 if not created

References Digikam::TagEditDlg::createTAlbum(), Digikam::AlbumManager::findTAlbum(), Digikam::AlbumManager::instance(), Digikam::TagEditDlg::showtagsListCreationError(), Digikam::TagEditDlg::tagCreate(), and tagCreated().

Referenced by Digikam::ItemIconView::slotNewTag().

◆ slotTagToFaceTag [1/2]

void Digikam::TagModificationHelper::slotTagToFaceTag ( )
slot

must use bindTag and a QAction

References boundTag().

Referenced by slotMultipleTagsToFaceTags().

◆ slotTagToFaceTag [2/2]

void Digikam::TagModificationHelper::slotTagToFaceTag ( TAlbum tag)
slot

◆ tagCreated

void Digikam::TagModificationHelper::tagCreated ( TAlbum tag)
signal

Referenced by slotTagNew().

◆ tagEdited

void Digikam::TagModificationHelper::tagEdited ( TAlbum tag)
signal

Referenced by slotTagEdit().


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