![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Include dependency graph for collection_query.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | dt_iop_name_row_t |
| One module's identity, for the rule that searches by module name. More... | |
| struct | dt_collection_values_request_t |
Typedefs | |
| typedef int(* | dt_collection_query_order_resolver_t) (const char *text) |
| typedef struct dt_iop_name_row_t | dt_iop_name_row_t |
| One module's identity, for the rule that searches by module name. | |
| typedef struct dt_collection_values_request_t | dt_collection_values_request_t |
The collection query: which images the lighttable is currently showing, and in what order.
This is the one place in the tree that COMPOSES SQL rather than merely running it, and that is why it lives here. Rules arrive as rules – a dt_collection_params_t and an array of dt_collection_rule_t – never as SQL. Turning each rule into a WHERE, joining them with their conjunctions and assembling the query is this module's job, and none of that text leaves the file. Callers ask for ids, counts and offsets.
Reading the user's rules out of conf stays in common/collection.c: this module reads no configuration, which is what lets it be reused against a different database. For the same reason anything presentational – translating a module-order name, deciding whether a metadata field is hidden – is resolved by the caller and handed in.
There is no handle. dt_collection_new() has a single call site, so the collection is a singleton in practice and an argument no caller chooses is not a parameter. Resolve a user-visible module-order name to the version id stored in main.module_order, or -1 when it names none.
Matching a LOCALISED string is presentation, and this module has no business doing it – but the "module order" collection rule is expressed that way. The caller installs a resolver.
Definition at line 57 of file collection_query.h.
What to list, and every preference the answer depends on, resolved by the caller.
Each of these was a conf read inside the query builder. They are display decisions – which rule excludes itself, whether a metadata field is hidden, how film rolls are ordered – and this module reads no configuration.
One module's identity, for the rule that searches by module name.
Finalise the cached statements and release the stored rules. Must run before the connection closes.
Definition at line 1595 of file collection_query.c.
References _params, _query, _where_ext, dt_free, L, and dt_collection_params_t::text_filter.
Referenced by dt_collection_free(), and testdb_teardown().
| uint32_t dt_collection_query_count | ( | void | ) |
How many images the collection currently holds.
Definition at line 1132 of file collection_query.c.
References _count.
Referenced by dt_collection_get_count(), and dt_collection_query_get_nth().
| int32_t dt_collection_query_find_neighbour | ( | GList * | imgids | ) |
The first collected image that is not in imgids, looked for after the list and then before it; -1 if there is none.
Definition at line 1529 of file collection_query.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_util_dstrcat(), i, IS_NULL_PTR, and L.
Referenced by dt_collection_update_query().
A number that advances on every recomposition.
Callers that need to notice "the collection changed" compare this. It replaces hashing the query string, which required the text to leave the module.
Definition at line 1161 of file collection_query.c.
References _generation.
Referenced by _dt_collection_get_hash().
| GList * dt_collection_query_get_group_members | ( | const int32_t | group_id, |
| const int32_t | exclude_imgid | ||
| ) |
Members of image group group_id that are IN the current collection, exclude_imgid left out. Lives here rather than in image_repository because it is scoped by the collection query, and that text does not leave this file.
Definition at line 1168 of file collection_query.c.
References _ensure_query(), dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, IS_NULL_PTR, and L.
Referenced by dt_grouping_add_grouped_images().
The first limit image ids of the collection, in collection order (-1 for all of them).
Definition at line 1648 of file collection_query.c.
References _ensure_query(), _params, COLLECTION_QUERY_USE_LIMIT, dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, IS_NULL_PTR, L, and dt_collection_params_t::query_flags.
Referenced by dt_collection_get().
| GList * dt_collection_query_get_images_for_rule | ( | const dt_collection_properties_t | property, |
| const char * | text, | ||
| gboolean | recursive | ||
| ) |
Image ids matching ONE rule, independent of the active collection – what batch operations enumerate over.
Definition at line 1503 of file collection_query.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, get_query_string(), IS_NULL_PTR, and L.
Referenced by dt_collection_get_images_for_rule().
| void dt_collection_query_get_makermodels | ( | const gchar * | filter, |
| GList ** | sanitized, | ||
| GList ** | exif | ||
| ) |
Camera maker/model pairs present in the library, sanitised and as EXIF recorded them.
Definition at line 1442 of file collection_query.c.
References dt_collection_get_makermodel(), dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, FALSE, IS_NULL_PTR, key, L, and TRUE.
Referenced by dt_collection_get_makermodels().
| int32_t dt_collection_query_get_nth | ( | const int | nth | ) |
The id at position nth, or -1.
Definition at line 1673 of file collection_query.c.
References _ensure_query(), dt_collection_query_count(), dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, and L.
Referenced by _slideshow_get_imgid_from_rank(), and dt_collection_get_nth().
| GList * dt_collection_query_get_property_values | ( | const dt_collection_values_request_t * | req | ) |
The distinct values of the requested property across the collection, with counts.
Definition at line 1193 of file collection_query.c.
References _extended_where_excluding(), _name_value_new(), _order_names, _order_names_count, dt_collection_get_makermodel(), DT_COLLECTION_PROP_APERTURE, DT_COLLECTION_PROP_CAMERA, DT_COLLECTION_PROP_CHANGE_TIMESTAMP, DT_COLLECTION_PROP_COLORLABEL, DT_COLLECTION_PROP_DAY, DT_COLLECTION_PROP_EXPORT_TIMESTAMP, DT_COLLECTION_PROP_EXPOSURE, DT_COLLECTION_PROP_FILENAME, DT_COLLECTION_PROP_FILMROLL, DT_COLLECTION_PROP_FOCAL_LENGTH, DT_COLLECTION_PROP_FOLDERS, DT_COLLECTION_PROP_GEOTAGGING, DT_COLLECTION_PROP_GROUPING, DT_COLLECTION_PROP_HISTORY, DT_COLLECTION_PROP_IMPORT_TIMESTAMP, DT_COLLECTION_PROP_ISO, DT_COLLECTION_PROP_LENS, DT_COLLECTION_PROP_LOCAL_COPY, DT_COLLECTION_PROP_METADATA, DT_COLLECTION_PROP_MODULE, DT_COLLECTION_PROP_ORDER, DT_COLLECTION_PROP_PRINT_TIMESTAMP, DT_COLLECTION_PROP_RATING, DT_COLLECTION_PROP_TAG, DT_COLLECTION_PROP_TIME, dt_database_get_sqlite3_global(), DT_DATETIME_EXIF_LENGTH, dt_datetime_gtimespan_to_exif(), DT_DEBUG_SQLITE3_PREPARE_V2, DT_IMAGE_LOCAL_COPY, dt_map_location_data_tag_root(), dt_metadata_get_keyid_by_display_order(), DT_METADATA_NUMBER, dt_util_dstrcat(), i, IS_NULL_PTR, L, maker, model, name, orders, and out.
Referenced by dt_collection_get_property_values().
| int dt_collection_query_image_offset | ( | const int32_t | imgid | ) |
The position of imgid within the collection, or 0 if it is not in it – the original's convention, which callers use to land at the start rather than error out.
Definition at line 1694 of file collection_query.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, FALSE, IS_NULL_PTR, L, TRUE, and UNKNOWN_IMAGE.
Referenced by dt_collection_image_offset_with_collection().
Definition at line 1723 of file collection_query.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, and L.
Referenced by dt_pop_collection().
Save / restore memory.collected_images, for code that needs to collect something else for a moment and put the user's collection back afterwards.
Definition at line 1732 of file collection_query.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, and L.
Referenced by dt_push_collection().
| int dt_collection_query_recompose | ( | void | ) |
Recompose from the rules already held – what a caller does after changing something the query text depends on without changing the rules themselves.
Definition at line 1127 of file collection_query.c.
References _recompose().
Rebuild memory.collected_images from the current query.
Definition at line 1607 of file collection_query.c.
References _compute_count(), _ensure_query(), dt_collection_get_global(), dt_database_get_sqlite3_global(), dt_database_is_open(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_EXEC, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, IS_NULL_PTR, and L.
Referenced by dt_collection_memory_update().
Drop from memory.collected_images everything that is not in main.selected_images.
Definition at line 1741 of file collection_query.c.
References _compute_count(), dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, and L.
Referenced by dt_selection_to_culling_mode().
| void dt_collection_query_set_iop_names | ( | const dt_iop_name_row_t * | rows, |
| const size_t | count | ||
| ) |
Fill memory.darktable_iop_names, the table the module-name rules join against.
Must run before any collection query naming a module. The table lives here because these queries are its only readers; the localised names come from the module objects, which the caller owns.
Definition at line 1137 of file collection_query.c.
References dt_database_get_sqlite3_global(), dt_database_release_transaction, dt_database_start_transaction, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, i, IS_NULL_PTR, L, and name.
Referenced by dt_iop_set_darktable_iop_table().
Supply the user-visible module-order names, index-aligned with the versions stored in main.module_order. The value list for that property interpolates them into its query, so the module needs the strings themselves – but not the ability to translate. Borrowed.
Definition at line 96 of file collection_query.c.
References _order_names, _order_names_count, and L.
Referenced by dt_collection_new().
| void dt_collection_query_set_order_resolver | ( | dt_collection_query_order_resolver_t | fn | ) |
Definition at line 91 of file collection_query.c.
References _order_resolver, and L.
Referenced by dt_collection_new().
| int dt_collection_query_set_rules | ( | const dt_collection_params_t * | params, |
| const dt_collection_rule_t * | rules, | ||
| const int | n_rules, | ||
| const uint32_t | tagid | ||
| ) |
Replace the rules and recompose.
The rules arrive as rules – property, mode, text – not as SQL. Turning them into WHERE fragments and assembling the query is this module's whole job. Everything is copied, so the caller keeps ownership of what it passed.
Definition at line 1109 of file collection_query.c.
References _compose_where_ext(), _params, _recompose(), _tagid, _where_ext, dt_free, IS_NULL_PTR, L, and dt_collection_params_t::text_filter.
Referenced by dt_collection_update().