Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
collection.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2010-2012 Henrik Andersson.
4 Copyright (C) 2010-2011, 2013 johannes hanika.
5 Copyright (C) 2012 José Carlos García Sogo.
6 Copyright (C) 2012, 2018, 2020 Pascal Obry.
7 Copyright (C) 2012 Richard Wonka.
8 Copyright (C) 2012 Simon Spannagel.
9 Copyright (C) 2013 Gaspard Jankowiak.
10 Copyright (C) 2013-2016, 2019 Tobias Ellinghaus.
11 Copyright (C) 2013 Ulrich Pegelow.
12 Copyright (C) 2014, 2016 Roman Lebedev.
13 Copyright (C) 2015-2016 Jérémy Rosen.
14 Copyright (C) 2015 Pedro Côrte-Real.
15 Copyright (C) 2016, 2020-2022 Aldric Renaudin.
16 Copyright (C) 2016 itinerarium.
17 Copyright (C) 2017 luzpaz.
18 Copyright (C) 2018 Mario Lueder.
19 Copyright (C) 2018 Rick Yorgason.
20 Copyright (C) 2018 Rikard Öxler.
21 Copyright (C) 2018 Sam Smith.
22 Copyright (C) 2018 Simon Legner.
23 Copyright (C) 2019 rrd1.
24 Copyright (C) 2020 Hanno Schwalm.
25 Copyright (C) 2020 JP Verrue.
26 Copyright (C) 2020-2021 Philippe Weyland.
27 Copyright (C) 2021 Arnaud TANGUY.
28 Copyright (C) 2021 Ralf Brown.
29 Copyright (C) 2022-2023, 2025 Aurélien PIERRE.
30 Copyright (C) 2022 Martin Bařinka.
31
32 darktable is free software: you can redistribute it and/or modify
33 it under the terms of the GNU General Public License as published by
34 the Free Software Foundation, either version 3 of the License, or
35 (at your option) any later version.
36
37 darktable is distributed in the hope that it will be useful,
38 but WITHOUT ANY WARRANTY; without even the implied warranty of
39 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 GNU General Public License for more details.
41
42 You should have received a copy of the GNU General Public License
43 along with darktable. If not, see <http://www.gnu.org/licenses/>.
44*/
45
46#pragma once
47
48#include <glib.h>
49#include <glib/gi18n.h>
50#include <inttypes.h>
51#include "common/metadata.h"
52
53#define NUM_LAST_COLLECTIONS 10
54
56{
57 COLLECTION_QUERY_SIMPLE = 0, // a query with only select and where statement
58 COLLECTION_QUERY_USE_SORT = 1 << 0, // if query should include order by statement
59 COLLECTION_QUERY_USE_LIMIT = 1 << 1, // if query should include "limit ?1,?2" part
60 COLLECTION_QUERY_USE_WHERE_EXT = 1 << 2, // if query should include extended where part
61 COLLECTION_QUERY_USE_ONLY_WHERE_EXT = 1 << 3 // if query should only use extended where part
63#define COLLECTION_QUERY_FULL (COLLECTION_QUERY_USE_SORT | COLLECTION_QUERY_USE_LIMIT)
64
85
102
103#define DT_COLLECTION_ORDER_FLAG 0x8000
104
105/* NOTE: any reordeing in this module require a legacy_preset entry in src/libs/collect.c */
145
147{
149 DT_COLLECTION_CHANGE_NEW_QUERY = 1, // a completly different query
150 DT_COLLECTION_CHANGE_FILTER = 2, // base query has been finetuned (filter, ...)
151 DT_COLLECTION_CHANGE_RELOAD = 3 // we have just reload the collection after images changes (query is identical)
153
170
180
181/* returns the name for the given collection property */
183
187void dt_collection_free(const dt_collection_t *collection);
191void dt_collection_get_makermodels(const gchar *filter, GList **sanitized, GList **exif);
193gchar *dt_collection_get_makermodel(const char *exif_maker, const char *exif_model);
195const gchar *dt_collection_get_query(const dt_collection_t *collection);
197int dt_collection_update(const dt_collection_t *collection);
199void dt_collection_reset(const dt_collection_t *collection);
201gchar *dt_collection_get_extended_where(const dt_collection_t *collection, int exclude);
203void dt_collection_set_extended_where(const dt_collection_t *collection, gchar **extended_where);
204
209
214
216char *dt_collection_get_text_filter(const dt_collection_t *collection);
218void dt_collection_set_text_filter(const dt_collection_t *collection, char *text_filter);
219
221void dt_collection_set_tag_id(dt_collection_t *collection, const uint32_t tagid);
222
224void dt_collection_load_filmroll(dt_collection_t *collection, const int32_t imgid, gboolean open_single_image);
225
227void dt_collection_set_sort(const dt_collection_t *collection, dt_collection_sort_t sort, gint reverse);
231gboolean dt_collection_get_sort_descending(const dt_collection_t *collection);
233gchar *dt_collection_get_sort_query(const dt_collection_t *collection);
234
236uint32_t dt_collection_get_count(const dt_collection_t *collection);
238int dt_collection_get_nth(const dt_collection_t *collection, int nth);
241GList *dt_collection_get_all(const dt_collection_t *collection, int limit);
242
246GList *dt_collection_get_images_for_rule(const dt_collection_properties_t property, const char *text);
247
250{
251 char *name; // raw/display value: folder path, tag name, formatted number/date, ...
252 int id; // film_roll id / tag id / running index, or 0
253 int count; // number of matching images
254 int status; // folder reachability (1 = reachable) for folders/film-rolls, else -1
256
261GList *dt_collection_get_property_values(const dt_collection_properties_t property, const int rule);
263
265void dt_collection_update_query(const dt_collection_t *collection, dt_collection_change_t query_change,
266 dt_collection_properties_t changed_property, GList *list);
267
269void dt_collection_hint_message(const dt_collection_t *collection);
270
271/* serialize and deserialize into a string. */
272void dt_collection_deserialize(const char *buf);
273int dt_collection_serialize(char *buf, int bufsize);
274
275/* splits an input string into a number part and an optional operator part */
276void dt_collection_split_operator_number(const gchar *input, char **number1, char **number2, char **op);
277void dt_collection_split_operator_datetime(const gchar *input, char **number1, char **number2, char **op);
278void dt_collection_split_operator_exposure(const gchar *input, char **number1, char **number2, char **op);
279
280/* initialize memory table */
282
287
288// clang-format off
289// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
290// vim: shiftwidth=2 expandtab tabstop=2 cindent
291// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
292// clang-format on
const char * dt_collection_name(dt_collection_properties_t prop)
Definition collection.c:657
void dt_collection_load_filmroll(dt_collection_t *collection, const int32_t imgid, gboolean open_single_image)
void dt_collection_update_query(const dt_collection_t *collection, dt_collection_change_t query_change, dt_collection_properties_t changed_property, GList *list)
void dt_culling_mode_to_selection()
void dt_collection_reset(const dt_collection_t *collection)
Definition collection.c:531
void dt_collection_set_query_flags(const dt_collection_t *collection, dt_collection_query_flags_t flags)
Definition collection.c:588
void dt_collection_split_operator_exposure(const gchar *input, char **number1, char **number2, char **op)
void dt_collection_split_operator_datetime(const gchar *input, char **number1, char **number2, char **op)
Definition collection.c:992
void dt_collection_deserialize(const char *buf)
const dt_collection_params_t * dt_collection_params(const dt_collection_t *collection)
Definition collection.c:157
void dt_collection_set_text_filter(const dt_collection_t *collection, char *text_filter)
Definition collection.c:576
char * dt_collection_get_text_filter(const dt_collection_t *collection)
Definition collection.c:571
gboolean dt_collection_get_sort_descending(const dt_collection_t *collection)
Definition collection.c:652
dt_collection_properties_t
Definition collection.h:107
@ DT_COLLECTION_PROP_EXPOSURE
Definition collection.h:115
@ DT_COLLECTION_PROP_MODULE
Definition collection.h:134
@ DT_COLLECTION_PROP_RATING
Definition collection.h:136
@ DT_COLLECTION_PROP_QUERY
Definition collection.h:138
@ DT_COLLECTION_PROP_TIME
Definition collection.h:120
@ DT_COLLECTION_PROP_METADATA
Definition collection.h:129
@ DT_COLLECTION_PROP_GROUPING
Definition collection.h:130
@ DT_COLLECTION_PROP_TAG
Definition collection.h:127
@ DT_COLLECTION_PROP_FILMROLL
Definition collection.h:108
@ DT_COLLECTION_PROP_LENS
Definition collection.h:113
@ DT_COLLECTION_PROP_SORT
Definition collection.h:143
@ DT_COLLECTION_PROP_CAMERA
Definition collection.h:112
@ DT_COLLECTION_PROP_LAST
Definition collection.h:140
@ DT_COLLECTION_PROP_LOCAL_COPY
Definition collection.h:131
@ DT_COLLECTION_PROP_GEOTAGGING
Definition collection.h:126
@ DT_COLLECTION_PROP_FILENAME
Definition collection.h:110
@ DT_COLLECTION_PROP_ISO
Definition collection.h:117
@ DT_COLLECTION_PROP_COLORLABEL
Definition collection.h:128
@ DT_COLLECTION_PROP_UNDEF
Definition collection.h:142
@ DT_COLLECTION_PROP_DAY
Definition collection.h:119
@ DT_COLLECTION_PROP_ORDER
Definition collection.h:135
@ DT_COLLECTION_PROP_FOLDERS
Definition collection.h:109
@ DT_COLLECTION_PROP_APERTURE
Definition collection.h:114
@ DT_COLLECTION_PROP_IMPORT_TIMESTAMP
Definition collection.h:121
@ DT_COLLECTION_PROP_FOCAL_LENGTH
Definition collection.h:116
@ DT_COLLECTION_PROP_EXPORT_TIMESTAMP
Definition collection.h:123
@ DT_COLLECTION_PROP_CHANGE_TIMESTAMP
Definition collection.h:122
@ DT_COLLECTION_PROP_HISTORY
Definition collection.h:133
@ DT_COLLECTION_PROP_PRINT_TIMESTAMP
Definition collection.h:124
gchar * dt_collection_get_extended_where(const dt_collection_t *collection, int exclude)
Definition collection.c:594
void dt_selection_to_culling_mode()
void dt_collection_set_filter_flags(const dt_collection_t *collection, dt_collection_filter_flag_t flags)
Definition collection.c:565
void dt_collection_memory_update()
Definition collection.c:201
dt_collection_filter_flag_t dt_collection_get_filter_flags(const dt_collection_t *collection)
Definition collection.c:560
dt_collection_query_flags_t
Definition collection.h:56
@ COLLECTION_QUERY_USE_ONLY_WHERE_EXT
Definition collection.h:61
@ COLLECTION_QUERY_USE_WHERE_EXT
Definition collection.h:60
@ COLLECTION_QUERY_USE_SORT
Definition collection.h:58
@ COLLECTION_QUERY_SIMPLE
Definition collection.h:57
@ COLLECTION_QUERY_USE_LIMIT
Definition collection.h:59
void dt_collection_get_makermodels(const gchar *filter, GList **sanitized, GList **exif)
GList * dt_collection_get_images_for_rule(const dt_collection_properties_t property, const char *text)
dt_collection_filter_flag_t
Definition collection.h:66
@ COLLECTION_FILTER_ALTERED
Definition collection.h:68
@ COLLECTION_FILTER_UNALTERED
Definition collection.h:69
@ COLLECTION_FILTER_GREEN
Definition collection.h:79
@ COLLECTION_FILTER_NONE
Definition collection.h:67
@ COLLECTION_FILTER_2_STAR
Definition collection.h:73
@ COLLECTION_FILTER_MAGENTA
Definition collection.h:81
@ COLLECTION_FILTER_0_STAR
Definition collection.h:71
@ COLLECTION_FILTER_1_STAR
Definition collection.h:72
@ COLLECTION_FILTER_BLUE
Definition collection.h:80
@ COLLECTION_FILTER_5_STAR
Definition collection.h:76
@ COLLECTION_FILTER_YELLOW
Definition collection.h:78
@ COLLECTION_FILTER_ALL
Definition collection.h:83
@ COLLECTION_FILTER_REJECTED
Definition collection.h:70
@ COLLECTION_FILTER_4_STAR
Definition collection.h:75
@ COLLECTION_FILTER_3_STAR
Definition collection.h:74
@ COLLECTION_FILTER_RED
Definition collection.h:77
@ COLLECTION_FILTER_WHITE
Definition collection.h:82
const gchar * dt_collection_get_query(const dt_collection_t *collection)
Definition collection.c:552
void dt_collection_split_operator_number(const gchar *input, char **number1, char **number2, char **op)
Definition collection.c:924
dt_collection_query_flags_t dt_collection_get_query_flags(const dt_collection_t *collection)
Definition collection.c:583
dt_collection_sort_t dt_collection_get_sort_field(const dt_collection_t *collection)
Definition collection.c:647
void dt_collection_set_tag_id(dt_collection_t *collection, const uint32_t tagid)
Definition collection.c:632
void dt_collection_name_value_free(gpointer value)
int dt_collection_get_nth(const dt_collection_t *collection, int nth)
Definition collection.c:894
dt_collection_change_t
Definition collection.h:147
@ DT_COLLECTION_CHANGE_RELOAD
Definition collection.h:151
@ DT_COLLECTION_CHANGE_NEW_QUERY
Definition collection.h:149
@ DT_COLLECTION_CHANGE_FILTER
Definition collection.h:150
@ DT_COLLECTION_CHANGE_NONE
Definition collection.h:148
gchar * dt_collection_get_makermodel(const char *exif_maker, const char *exif_model)
void dt_collection_hint_message(const dt_collection_t *collection)
int dt_collection_serialize(char *buf, int bufsize)
uint32_t dt_collection_get_count(const dt_collection_t *collection)
Definition collection.c:836
int dt_collection_update(const dt_collection_t *collection)
Definition collection.c:268
dt_collection_sort_t
Definition collection.h:87
@ DT_COLLECTION_SORT_EXPORT_TIMESTAMP
Definition collection.h:93
@ DT_COLLECTION_SORT_IMPORT_TIMESTAMP
Definition collection.h:91
@ DT_COLLECTION_SORT_DATETIME
Definition collection.h:90
@ DT_COLLECTION_SORT_GROUP
Definition collection.h:98
@ DT_COLLECTION_SORT_FILENAME
Definition collection.h:89
@ DT_COLLECTION_SORT_RATING
Definition collection.h:95
@ DT_COLLECTION_SORT_PATH
Definition collection.h:99
@ DT_COLLECTION_SORT_TITLE
Definition collection.h:100
@ DT_COLLECTION_SORT_CHANGE_TIMESTAMP
Definition collection.h:92
@ DT_COLLECTION_SORT_NONE
Definition collection.h:88
@ DT_COLLECTION_SORT_PRINT_TIMESTAMP
Definition collection.h:94
@ DT_COLLECTION_SORT_ID
Definition collection.h:96
@ DT_COLLECTION_SORT_COLOR
Definition collection.h:97
dt_collection_t * dt_collection_new()
Definition collection.c:117
void dt_collection_set_sort(const dt_collection_t *collection, dt_collection_sort_t sort, gint reverse)
void dt_collection_set_extended_where(const dt_collection_t *collection, gchar **extended_where)
Definition collection.c:623
GList * dt_collection_get_property_values(const dt_collection_properties_t property, const int rule)
GList * dt_collection_get_all(const dt_collection_t *collection, int limit)
Definition collection.c:889
gchar * dt_collection_get_sort_query(const dt_collection_t *collection)
Definition collection.c:709
void dt_collection_free(const dt_collection_t *collection)
Definition collection.c:124
static const dt_aligned_pixel_simd_t value
Definition darktable.h:577
@ DT_METADATA_NUMBER
Definition metadata.h:52
dt_mipmap_buffer_dsc_flags flags
Definition mipmap_cache.c:4
dt_collection_query_flags_t query_flags
Definition collection.h:157
dt_collection_sort_t sort
Definition collection.h:166
dt_collection_filter_flag_t filter_flags
Definition collection.h:160
dt_collection_params_t store
Definition collection.h:178
unsigned int count
Definition collection.h:175
dt_collection_params_t params
Definition collection.h:177
unsigned int tagid
Definition collection.h:176
gchar ** where_ext
Definition collection.h:174