Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
tags.h File Reference
#include <glib.h>
#include <sqlite3.h>
#include <stdint.h>
+ Include dependency graph for tags.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_tag_t
 

Macros

#define DT_TF_ALL   (DT_TF_CATEGORY | DT_TF_PRIVATE | DT_TF_ORDER_SET)
 

Typedefs

typedef struct dt_tag_t dt_tag_t
 
typedef enum dt_tag_flags_t dt_tag_flags_t
 
typedef enum dt_tag_selection_t dt_tag_selection_t
 

Enumerations

enum  dt_tag_flags_t {
  DT_TF_NONE = 0 ,
  DT_TF_CATEGORY = 1 << 0 ,
  DT_TF_PRIVATE = 1 << 1 ,
  DT_TF_ORDER_SET = 1 << 2 ,
  DT_TF_DESCENDING = 1U << 31
}
 
enum  dt_tag_selection_t {
  DT_TS_NO_IMAGE = 0 ,
  DT_TS_SOME_IMAGES ,
  DT_TS_ALL_IMAGES
}
 

Functions

gboolean dt_tag_new (const char *name, guint *tagid)
 
gboolean dt_tag_new_from_gui (const char *name, guint *tagid)
 
uint32_t dt_tag_import (const char *filename)
 
uint32_t dt_tag_export (const char *filename)
 
gchar * dt_tag_get_name (const guint tagid)
 
guint dt_tag_remove (const guint tagid, gboolean final)
 
guint dt_tag_remove_list (GList *tag_list)
 
void dt_tag_rename (const guint tagid, const gchar *new_tagname)
 
gboolean dt_tag_exists (const char *name, guint *tagid)
 
gboolean dt_tag_attach_images (const guint tagid, const GList *img, const gboolean undo_on)
 
gboolean dt_tag_attach (const guint tagid, const int32_t imgid, const gboolean undo_on, const gboolean group_on)
 
gboolean dt_is_tag_attached (const guint tagid, const int32_t imgid)
 
gboolean dt_tag_set_tags (const GList *tags, const GList *img, const gboolean ignore_dt_tags, const gboolean clear_on, const gboolean undo_on)
 
gboolean dt_tag_attach_string_list (const gchar *tags, const GList *img, const gboolean undo_on)
 
gboolean dt_tag_detach_images (const guint tagid, const GList *img, const gboolean undo_on)
 
gboolean dt_tag_detach (const guint tagid, const int32_t imgid, const gboolean undo_on, const gboolean group_on)
 
gboolean dt_tag_detach_by_string (const char *name, const int32_t imgid, const gboolean undo_on, const gboolean group_on)
 
uint32_t dt_tag_get_attached (const int32_t imgid, GList **result, const gboolean ignore_dt_tags)
 
GList * dt_sort_tag (GList *tags, gboolean byname)
 
GList * dt_tag_get_list (int32_t imgid)
 
GList * dt_tag_get_list_export (int32_t imgid, int32_t flags)
 
GList * dt_tag_get_hierarchical (int32_t imgid)
 
GList * dt_tag_get_hierarchical_export (int32_t imgid, int32_t flags)
 
GList * dt_tag_get_tags (const int32_t imgid, const gboolean ignore_dt_tags)
 
GList * dt_tag_get_images (const gint tagid)
 
GList * dt_tag_get_images_from_list (const GList *img, const gint tagid)
 
uint32_t dt_tag_get_suggestions (GList **result)
 
void dt_tag_count_tags_images (const gchar *keyword, int *tag_count, int *img_count)
 
void dt_tag_get_tags_images (const gchar *keyword, GList **tag_list, GList **img_list)
 
uint32_t dt_tag_get_with_usage (GList **result)
 
uint32_t dt_tag_get_collection_tags (GList **result)
 
gchar * dt_tag_get_synonyms (gint tagid)
 
void dt_tag_set_synonyms (gint tagid, gchar *synonyms)
 
gint dt_tag_get_flags (gint tagid)
 
void dt_tag_set_flags (gint tagid, gint flags)
 
uint32_t dt_tag_get_recent_used (GList **result)
 
void dt_tag_free_result (GList **result)
 
uint32_t dt_tag_images_count (gint tagid)
 
char * dt_tag_get_subtags (const int32_t imgid, const char *category, const int level)
 
gboolean dt_tag_get_tag_order_by_id (const uint32_t tagid, uint32_t *sort, gboolean *descending)
 
void dt_tag_set_tag_order_by_id (const uint32_t tagid, const uint32_t sort, const gboolean descending)
 
uint32_t dt_tag_get_tag_id_by_name (const char *const name)
 
void dt_set_darktable_tags ()
 
void dt_tags_cleanup (void)
 

Macro Definition Documentation

◆ DT_TF_ALL

#define DT_TF_ALL   (DT_TF_CATEGORY | DT_TF_PRIVATE | DT_TF_ORDER_SET)

Definition at line 70 of file tags.h.

Typedef Documentation

◆ dt_tag_flags_t

◆ dt_tag_selection_t

◆ dt_tag_t

typedef struct dt_tag_t dt_tag_t

Enumeration Type Documentation

◆ dt_tag_flags_t

Enumerator
DT_TF_NONE 
DT_TF_CATEGORY 
DT_TF_PRIVATE 
DT_TF_ORDER_SET 
DT_TF_DESCENDING 

Definition at line 61 of file tags.h.

◆ dt_tag_selection_t

Enumerator
DT_TS_NO_IMAGE 
DT_TS_SOME_IMAGES 
DT_TS_ALL_IMAGES 

Definition at line 72 of file tags.h.

Function Documentation

◆ dt_is_tag_attached()

gboolean dt_is_tag_attached ( const guint  tagid,
const int32_t  imgid 
)

check if a tag is attached to the given image

Definition at line 1073 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by dt_tag_attach().

◆ dt_set_darktable_tags()

void dt_set_darktable_tags ( )

init the darktable tags table

Definition at line 624 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by dt_init(), and dt_tag_delete_tag_batch().

◆ dt_sort_tag()

GList * dt_sort_tag ( GList *  tags,
gboolean  byname 
)

sort tags per name (including '|') or per count (desc)

◆ dt_tag_attach()

gboolean dt_tag_attach ( const guint  tagid,
const int32_t  imgid,
const gboolean  undo_on,
const gboolean  group_on 
)

◆ dt_tag_attach_images()

gboolean dt_tag_attach_images ( const guint  tagid,
const GList *  img,
const gboolean  undo_on 
)

attach a tag on images list. tagid id of tag to attach. img the list of image id to attach tag to

Definition at line 469 of file tags.c.

References _pop_undo(), _tag_execute(), _tags_undo_data_free(), DT_TA_ATTACH, dt_undo_end_group(), dt_undo_get_global(), dt_undo_record(), dt_undo_start_group(), DT_UNDO_TAGS, FALSE, and IS_NULL_PTR.

Referenced by _drop_attach_tag(), _event_dnd_received(), and dt_tag_attach().

◆ dt_tag_attach_string_list()

gboolean dt_tag_attach_string_list ( const gchar *  tags,
const GList *  img,
const gboolean  undo_on 
)

attach a list of tags on list of images.

Parameters
[in]tagsa comma separated string of tags.
[in]imgthe list of images to attach tag to.
Note
If tag does not exist, it's created.

Definition at line 532 of file tags.c.

References _pop_undo(), _tag_execute(), _tags_undo_data_free(), DT_TA_ATTACH, dt_tag_new(), dt_undo_end_group(), dt_undo_get_global(), dt_undo_record(), dt_undo_start_group(), DT_UNDO_TAGS, and FALSE.

Referenced by _create_tag_from_entry(), _lib_tagging_tag_key_press(), and _lib_tagging_tag_redo_accel().

◆ dt_tag_count_tags_images()

void dt_tag_count_tags_images ( const gchar *  keyword,
int *  tag_count,
int *  img_count 
)

retrieves count of tagged images.

Parameters
[in]keywordthe keyword to search
Returns
the count
Note
the limit of result is decided by conf value "xxx"

Definition at line 1260 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, and IS_NULL_PTR.

Referenced by _pop_menu_dictionary_change_path(), _pop_menu_dictionary_delete_node(), and _pop_menu_dictionary_edit_tag().

◆ dt_tag_detach()

gboolean dt_tag_detach ( const guint  tagid,
const int32_t  imgid,
const gboolean  undo_on,
const gboolean  group_on 
)

detach tag from images.

Parameters
[in]tagidof tag to detach.
[in]imgidthe image id to detach tag from, if < 0 images to act on are used.

Definition at line 599 of file tags.c.

References dt_act_on_get_images(), dt_grouping_add_grouped_images(), dt_tag_detach_images(), and UNKNOWN_IMAGE.

Referenced by dt_control_export_job_run(), dt_control_local_copy_images_job_run(), dt_map_location_update_images(), dt_map_location_update_locations(), and dt_tag_detach_by_string().

◆ dt_tag_detach_by_string()

gboolean dt_tag_detach_by_string ( const char *  name,
const int32_t  imgid,
const gboolean  undo_on,
const gboolean  group_on 
)

detach tags from images that matches name, it is valid to use % to match tag

Definition at line 614 of file tags.c.

References dt_tag_detach(), dt_tag_exists(), FALSE, IS_NULL_PTR, and name.

Referenced by _image_duplicate_with_version(), and dt_history_delete_on_image_ext().

◆ dt_tag_detach_images()

gboolean dt_tag_detach_images ( const guint  tagid,
const GList *  img,
const gboolean  undo_on 
)

detach tag from images.

Parameters
[in]tagidof tag to detach.
[in]imgthe list of image id to detach tag from

Definition at line 576 of file tags.c.

References _pop_undo(), _tag_execute(), _tags_undo_data_free(), DT_TA_DETACH, dt_undo_end_group(), dt_undo_get_global(), dt_undo_record(), dt_undo_start_group(), DT_UNDO_TAGS, and FALSE.

Referenced by _detach_tagids(), and dt_tag_detach().

◆ dt_tag_exists()

gboolean dt_tag_exists ( const char *  name,
guint *  tagid 
)

checks if tag exists.

Parameters
[in]nameof tag to check.
Returns
the id of found tag or -1 i not found.

Definition at line 362 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, FALSE, IS_NULL_PTR, name, and TRUE.

Referenced by _apply_rename_path(), _lrop(), _pop_menu_dictionary_create_tag(), _pop_menu_dictionary_edit_tag(), dt_map_location_name_exists(), dt_tag_detach_by_string(), and dt_tag_rename().

◆ dt_tag_export()

uint32_t dt_tag_export ( const char *  filename)

◆ dt_tag_free_result()

◆ dt_tag_get_attached()

◆ dt_tag_get_collection_tags()

uint32_t dt_tag_get_collection_tags ( GList **  result)

retrieves the list of tags attached to the images of the current collection (memory.collected_images).

Parameters
[out]resulta pointer to list populated with result (dt_tag_t items, only name and id are meaningful).
Returns
the count.
Note
free with dt_tag_free_result().

Definition at line 1442 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, and t.

Referenced by _refresh_collection_tags().

◆ dt_tag_get_flags()

gint dt_tag_get_flags ( gint  tagid)

retrieves flags of the tag

Definition at line 1537 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, and flags.

Referenced by _pop_menu_dictionary_edit_tag().

◆ dt_tag_get_hierarchical()

GList * dt_tag_get_hierarchical ( int32_t  imgid)

get a flat list of only hierarchical tags, the difference to dt_tag_get_attached() is that this one filters out the "darktable|" tags.

Definition at line 900 of file tags.c.

References dt_tag_free_result(), dt_tag_get_attached(), t, and TRUE.

Referenced by _exif_xmp_read_data().

◆ dt_tag_get_hierarchical_export()

GList * dt_tag_get_hierarchical_export ( int32_t  imgid,
int32_t  flags 
)

get a flat list of only hierarchical tags, the difference to dt_tag_get_hierarchical() is that this one checks option for exportation

Definition at line 1049 of file tags.c.

References DT_META_PRIVATE_TAG, dt_tag_free_result(), dt_tag_get_attached(), DT_TF_PRIVATE, flags, t, and TRUE.

Referenced by _exif_xmp_read_data_export().

◆ dt_tag_get_images()

GList * dt_tag_get_images ( const gint  tagid)

get the subset of images that have a given tag attached

Definition at line 1090 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by _delete_tagids(), and dt_map_location_update_images().

◆ dt_tag_get_images_from_list()

GList * dt_tag_get_images_from_list ( const GList *  img,
const gint  tagid 
)

get the subset of images from the given list that have a given tag attached

Definition at line 1113 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, and dt_util_dstrcat().

Referenced by _detach_tagids().

◆ dt_tag_get_list()

GList * dt_tag_get_list ( int32_t  imgid)

get a list of tags, the difference to dt_tag_get_attached() is that this one splits at '|' and filters out the "darktable|" tags.

Definition at line 856 of file tags.c.

References dt_conf_get_bool(), dt_tag_free_result(), dt_tag_get_attached(), dt_util_glist_uniq(), IS_NULL_PTR, t, TRUE, and value.

Referenced by _exif_xmp_read_data().

◆ dt_tag_get_list_export()

GList * dt_tag_get_list_export ( int32_t  imgid,
int32_t  flags 
)

◆ dt_tag_get_name()

gchar * dt_tag_get_name ( const guint  tagid)

◆ dt_tag_get_recent_used()

uint32_t dt_tag_get_recent_used ( GList **  result)

retrieves a list of recent tags used.

Parameters
[out]resulta pointer to list populated with result.
Returns
the count
Note
the limit of result is decided by conf value "xxx"

Definition at line 1607 of file tags.c.

◆ dt_tag_get_subtags()

char * dt_tag_get_subtags ( const int32_t  imgid,
const char *  category,
const int  level 
)

retrieves the subtags of requested level for the requested category

Definition at line 1827 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_util_dstrcat(), dt_util_string_count_char(), FALSE, IS_NULL_PTR, and TRUE.

Referenced by _get_base_value().

◆ dt_tag_get_suggestions()

uint32_t dt_tag_get_suggestions ( GList **  result)

retrieves a list of suggested tags matching keyword.

Parameters
[in]keywordthe keyword to search
[out]resulta pointer to list populated with result.
Returns
the count
Note
the limit of result is decided by conf value "xxx"

Definition at line 1147 of file tags.c.

References dt_conf_get_int(), dt_conf_get_string_const(), dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_selection_get_global(), dt_selection_get_length(), DT_TS_ALL_IMAGES, DT_TS_NO_IMAGE, DT_TS_SOME_IMAGES, and t.

Referenced by _init_treeview().

◆ dt_tag_get_synonyms()

gchar * dt_tag_get_synonyms ( gint  tagid)

retrieves synonyms of the tag

Definition at line 1503 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by dt_tag_add_synonym().

◆ dt_tag_get_tag_id_by_name()

uint32_t dt_tag_get_tag_id_by_name ( const char *const  name)

return the tagid of that tag - follow tag sensitivity - return 0 if not found

Definition at line 1897 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, IS_NULL_PTR, and name.

Referenced by _act_tag_rename(), _act_tags_remove(), _adopt_tag_order(), and _drop_attach_tag().

◆ dt_tag_get_tag_order_by_id()

gboolean dt_tag_get_tag_order_by_id ( const uint32_t  tagid,
uint32_t *  sort,
gboolean *  descending 
)

return the images order associated to that tag

Definition at line 1869 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, DT_TF_DESCENDING, DT_TF_ORDER_SET, FALSE, flags, IS_NULL_PTR, and TRUE.

Referenced by _adopt_tag_order().

◆ dt_tag_get_tags()

GList * dt_tag_get_tags ( const int32_t  imgid,
const gboolean  ignore_dt_tags 
)

get a flat list of tags id attached to image id

Definition at line 956 of file tags.c.

References _tag_get_tags(), DT_TAG_TYPE_ALL, and DT_TAG_TYPE_USER.

◆ dt_tag_get_tags_images()

void dt_tag_get_tags_images ( const gchar *  keyword,
GList **  tag_list,
GList **  img_list 
)

retrieves list of tags and tagged images.

Parameters
[in]keywordthe keyword to search.
[out]resultpointers to list populated with result.
Note
the limit of result is decided by conf value "xxx"

Definition at line 1308 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, IS_NULL_PTR, and t.

Referenced by _apply_rename_path(), _pop_menu_dictionary_delete_node(), and _pop_menu_dictionary_edit_tag().

◆ dt_tag_get_with_usage()

uint32_t dt_tag_get_with_usage ( GList **  result)

retrieves the list of tags matching keyword.

Parameters
[in]keywordthe keyword to search
[out]resulta pointer to list populated with result.
Returns
the count
Note
the limit of result is decided by conf value "xxx"

Definition at line 1383 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_selection_get_global(), dt_selection_get_length(), DT_TS_ALL_IMAGES, DT_TS_NO_IMAGE, DT_TS_SOME_IMAGES, and t.

Referenced by _init_treeview(), _refresh_completion_store(), and dt_tag_export().

◆ dt_tag_images_count()

uint32_t dt_tag_images_count ( gint  tagid)

get number of images affected with that tag

Definition at line 1365 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.

Referenced by _pop_menu_attached_attach_to_all(), and _update_attached_count().

◆ dt_tag_import()

◆ dt_tag_new()

gboolean dt_tag_new ( const char *  name,
guint *  tagid 
)

creates a new tag, returns tagid

Parameters
[in]namethe tag name.
[in]tagida pointer to tagid of new tag, this can be NULL
Returns
false if failed to create a tag and indicates that tagid is invalid to use.
Note
If tag already exists the existing tag id is returned.

Definition at line 185 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, FALSE, IS_NULL_PTR, name, and TRUE.

Referenced by _exif_decode_exif_data(), _exif_decode_iptc_data(), _image_import_internal(), _lrop(), _pop_menu_dictionary_create_tag(), _pop_menu_dictionary_set_as_tag(), _print_job_run(), dt_control_export_job_run(), dt_control_local_copy_images_job_run(), dt_dev_append_changed_tag(), dt_map_location_new(), dt_tag_attach_string_list(), dt_tag_import(), and dt_tag_new_from_gui().

◆ dt_tag_new_from_gui()

gboolean dt_tag_new_from_gui ( const char *  name,
guint *  tagid 
)

creates a new tag, returns tagid

Parameters
[in]namethe tag name.
[in]tagida pointer to tagid of new tag, this can be NULL
Returns
false if failed to create a tag and indicates that tagid is invalid to use.
Note
If tag already exists the existing tag id is returned. This function will also raise a DT_SIGNAL_TAG_CHANGED signal if necessary, so keywords GUI can refresh.

Definition at line 234 of file tags.c.

References dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_SIGNAL_TAG_CHANGED, dt_tag_new(), and name.

◆ dt_tag_remove()

guint dt_tag_remove ( const guint  tagid,
gboolean  final 
)

removes a tag from db and from assigned images.

Parameters
finalTRUE actually performs the remove
Returns
the amount of images affected.

Definition at line 242 of file tags.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, and TRUE.

Referenced by _act_tags_remove(), _delete_tagids(), and dt_map_location_delete().

◆ dt_tag_remove_list()

guint dt_tag_remove_list ( GList *  tag_list)

removes a list of tags from db and from assigned images.

Returns
the number of tags deleted

Definition at line 300 of file tags.c.

References dt_free, dt_tag_delete_tag_batch(), and dt_util_dstrcat().

Referenced by _pop_menu_dictionary_delete_node().

◆ dt_tag_rename()

void dt_tag_rename ( const guint  tagid,
const gchar *  new_tagname 
)

◆ dt_tag_set_flags()

void dt_tag_set_flags ( gint  tagid,
gint  flags 
)

◆ dt_tag_set_synonyms()

void dt_tag_set_synonyms ( gint  tagid,
gchar *  synonyms 
)

◆ dt_tag_set_tag_order_by_id()

void dt_tag_set_tag_order_by_id ( const uint32_t  tagid,
const uint32_t  sort,
const gboolean  descending 
)

◆ dt_tag_set_tags()

gboolean dt_tag_set_tags ( const GList *  tags,
const GList *  img,
const gboolean  ignore_dt_tags,
const gboolean  clear_on,
const gboolean  undo_on 
)

attach a list of tags on selected images.

Parameters
[in]tagsa list of ids of tags.
[in]imgidthe image id to attach tag to, if < 0 selected images are used.
Note
If tag not exists it's created if clear_on TRUE the image tags are cleared before attaching the new ones

Definition at line 512 of file tags.c.

References _pop_undo(), _tag_execute(), _tags_undo_data_free(), DT_TA_ATTACH, DT_TA_SET, DT_TA_SET_ALL, dt_undo_end_group(), dt_undo_get_global(), dt_undo_record(), dt_undo_start_group(), DT_UNDO_TAGS, and FALSE.

Referenced by _exif_decode_xmp_data(), and set_params().

◆ dt_tags_cleanup()

void dt_tags_cleanup ( void  )