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
84
101
102#define DT_COLLECTION_ORDER_FLAG 0x8000
103
104/* NOTE: any reordeing in this module require a legacy_preset entry in src/libs/collect.c */
142
144{
146 DT_COLLECTION_CHANGE_NEW_QUERY = 1, // a completly different query
147 DT_COLLECTION_CHANGE_FILTER = 2, // base query has been finetuned (filter, ...)
148 DT_COLLECTION_CHANGE_RELOAD = 3 // we have just reload the collection after images changes (query is identical)
150
167
177
178/* returns the name for the given collection property */
180
184void dt_collection_free(const dt_collection_t *collection);
188void dt_collection_get_makermodels(const gchar *filter, GList **sanitized, GList **exif);
190gchar *dt_collection_get_makermodel(const char *exif_maker, const char *exif_model);
192const gchar *dt_collection_get_query(const dt_collection_t *collection);
194int dt_collection_update(const dt_collection_t *collection);
196void dt_collection_reset(const dt_collection_t *collection);
198gchar *dt_collection_get_extended_where(const dt_collection_t *collection, int exclude);
200void dt_collection_set_extended_where(const dt_collection_t *collection, gchar **extended_where);
201
206
211
213char *dt_collection_get_text_filter(const dt_collection_t *collection);
215void dt_collection_set_text_filter(const dt_collection_t *collection, char *text_filter);
216
218void dt_collection_set_tag_id(dt_collection_t *collection, const uint32_t tagid);
219
221void dt_collection_load_filmroll(dt_collection_t *collection, const int32_t imgid, gboolean open_single_image);
222
224void dt_collection_set_sort(const dt_collection_t *collection, dt_collection_sort_t sort, gint reverse);
228gboolean dt_collection_get_sort_descending(const dt_collection_t *collection);
230gchar *dt_collection_get_sort_query(const dt_collection_t *collection);
231
233uint32_t dt_collection_get_count(const dt_collection_t *collection);
235int dt_collection_get_nth(const dt_collection_t *collection, int nth);
238GList *dt_collection_get_all(const dt_collection_t *collection, int limit);
239
241void dt_collection_update_query(const dt_collection_t *collection, dt_collection_change_t query_change,
242 dt_collection_properties_t changed_property, GList *list);
243
245void dt_collection_hint_message(const dt_collection_t *collection);
246
247/* serialize and deserialize into a string. */
248void dt_collection_deserialize(const char *buf);
249int dt_collection_serialize(char *buf, int bufsize);
250
251/* splits an input string into a number part and an optional operator part */
252void dt_collection_split_operator_number(const gchar *input, char **number1, char **number2, char **op);
253void dt_collection_split_operator_datetime(const gchar *input, char **number1, char **number2, char **op);
254void dt_collection_split_operator_exposure(const gchar *input, char **number1, char **number2, char **op);
255
256/* initialize memory table */
258
263
264// clang-format off
265// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
266// vim: shiftwidth=2 expandtab tabstop=2 cindent
267// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
268// clang-format on
const char * dt_collection_name(dt_collection_properties_t prop)
Definition collection.c:656
void dt_collection_load_filmroll(dt_collection_t *collection, const int32_t imgid, gboolean open_single_image)
Definition collection.c:2122
void dt_collection_update_query(const dt_collection_t *collection, dt_collection_change_t query_change, dt_collection_properties_t changed_property, GList *list)
Definition collection.c:1852
void dt_culling_mode_to_selection()
Definition collection.c:2011
void dt_collection_reset(const dt_collection_t *collection)
Definition collection.c:530
void dt_collection_set_query_flags(const dt_collection_t *collection, dt_collection_query_flags_t flags)
Definition collection.c:587
void dt_collection_split_operator_exposure(const gchar *input, char **number1, char **number2, char **op)
Definition collection.c:1051
void dt_collection_split_operator_datetime(const gchar *input, char **number1, char **number2, char **op)
Definition collection.c:990
void dt_collection_deserialize(const char *buf)
Definition collection.c:1737
const dt_collection_params_t * dt_collection_params(const dt_collection_t *collection)
Definition collection.c:156
void dt_collection_set_text_filter(const dt_collection_t *collection, char *text_filter)
Definition collection.c:575
char * dt_collection_get_text_filter(const dt_collection_t *collection)
Definition collection.c:570
gboolean dt_collection_get_sort_descending(const dt_collection_t *collection)
Definition collection.c:651
dt_collection_properties_t
Definition collection.h:106
@ DT_COLLECTION_PROP_EXPOSURE
Definition collection.h:114
@ DT_COLLECTION_PROP_MODULE
Definition collection.h:133
@ DT_COLLECTION_PROP_RATING
Definition collection.h:135
@ DT_COLLECTION_PROP_TIME
Definition collection.h:119
@ DT_COLLECTION_PROP_METADATA
Definition collection.h:128
@ DT_COLLECTION_PROP_GROUPING
Definition collection.h:129
@ DT_COLLECTION_PROP_TAG
Definition collection.h:126
@ DT_COLLECTION_PROP_FILMROLL
Definition collection.h:107
@ DT_COLLECTION_PROP_LENS
Definition collection.h:112
@ DT_COLLECTION_PROP_SORT
Definition collection.h:140
@ DT_COLLECTION_PROP_CAMERA
Definition collection.h:111
@ DT_COLLECTION_PROP_LAST
Definition collection.h:137
@ DT_COLLECTION_PROP_LOCAL_COPY
Definition collection.h:130
@ DT_COLLECTION_PROP_GEOTAGGING
Definition collection.h:125
@ DT_COLLECTION_PROP_FILENAME
Definition collection.h:109
@ DT_COLLECTION_PROP_ISO
Definition collection.h:116
@ DT_COLLECTION_PROP_COLORLABEL
Definition collection.h:127
@ DT_COLLECTION_PROP_UNDEF
Definition collection.h:139
@ DT_COLLECTION_PROP_DAY
Definition collection.h:118
@ DT_COLLECTION_PROP_ORDER
Definition collection.h:134
@ DT_COLLECTION_PROP_FOLDERS
Definition collection.h:108
@ DT_COLLECTION_PROP_APERTURE
Definition collection.h:113
@ DT_COLLECTION_PROP_IMPORT_TIMESTAMP
Definition collection.h:120
@ DT_COLLECTION_PROP_FOCAL_LENGTH
Definition collection.h:115
@ DT_COLLECTION_PROP_EXPORT_TIMESTAMP
Definition collection.h:122
@ DT_COLLECTION_PROP_CHANGE_TIMESTAMP
Definition collection.h:121
@ DT_COLLECTION_PROP_HISTORY
Definition collection.h:132
@ DT_COLLECTION_PROP_PRINT_TIMESTAMP
Definition collection.h:123
gchar * dt_collection_get_extended_where(const dt_collection_t *collection, int exclude)
Definition collection.c:593
void dt_selection_to_culling_mode()
Definition collection.c:1994
void dt_collection_set_filter_flags(const dt_collection_t *collection, dt_collection_filter_flag_t flags)
Definition collection.c:564
void dt_collection_memory_update()
Definition collection.c:200
dt_collection_filter_flag_t dt_collection_get_filter_flags(const dt_collection_t *collection)
Definition collection.c:559
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)
Definition collection.c:1113
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_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:551
void dt_collection_split_operator_number(const gchar *input, char **number1, char **number2, char **op)
Definition collection.c:922
dt_collection_query_flags_t dt_collection_get_query_flags(const dt_collection_t *collection)
Definition collection.c:582
dt_collection_sort_t dt_collection_get_sort_field(const dt_collection_t *collection)
Definition collection.c:646
void dt_collection_set_tag_id(dt_collection_t *collection, const uint32_t tagid)
Definition collection.c:631
int dt_collection_get_nth(const dt_collection_t *collection, int nth)
Definition collection.c:892
dt_collection_change_t
Definition collection.h:144
@ DT_COLLECTION_CHANGE_RELOAD
Definition collection.h:148
@ DT_COLLECTION_CHANGE_NEW_QUERY
Definition collection.h:146
@ DT_COLLECTION_CHANGE_FILTER
Definition collection.h:147
@ DT_COLLECTION_CHANGE_NONE
Definition collection.h:145
gchar * dt_collection_get_makermodel(const char *exif_maker, const char *exif_model)
Definition collection.c:1177
void dt_collection_hint_message(const dt_collection_t *collection)
Definition collection.c:2026
int dt_collection_serialize(char *buf, int bufsize)
Definition collection.c:1705
uint32_t dt_collection_get_count(const dt_collection_t *collection)
Definition collection.c:834
int dt_collection_update(const dt_collection_t *collection)
Definition collection.c:267
dt_collection_sort_t
Definition collection.h:86
@ DT_COLLECTION_SORT_EXPORT_TIMESTAMP
Definition collection.h:92
@ DT_COLLECTION_SORT_IMPORT_TIMESTAMP
Definition collection.h:90
@ DT_COLLECTION_SORT_DATETIME
Definition collection.h:89
@ DT_COLLECTION_SORT_GROUP
Definition collection.h:97
@ DT_COLLECTION_SORT_FILENAME
Definition collection.h:88
@ DT_COLLECTION_SORT_RATING
Definition collection.h:94
@ DT_COLLECTION_SORT_PATH
Definition collection.h:98
@ DT_COLLECTION_SORT_TITLE
Definition collection.h:99
@ DT_COLLECTION_SORT_CHANGE_TIMESTAMP
Definition collection.h:91
@ DT_COLLECTION_SORT_NONE
Definition collection.h:87
@ DT_COLLECTION_SORT_PRINT_TIMESTAMP
Definition collection.h:93
@ DT_COLLECTION_SORT_ID
Definition collection.h:95
@ DT_COLLECTION_SORT_COLOR
Definition collection.h:96
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:622
GList * dt_collection_get_all(const dt_collection_t *collection, int limit)
Definition collection.c:887
gchar * dt_collection_get_sort_query(const dt_collection_t *collection)
Definition collection.c:707
void dt_collection_free(const dt_collection_t *collection)
Definition collection.c:124
@ DT_METADATA_NUMBER
Definition metadata.h:52
dt_mipmap_buffer_dsc_flags flags
Definition mipmap_cache.c:4
Definition collection.h:152
dt_collection_query_flags_t query_flags
Definition collection.h:154
dt_collection_sort_t sort
Definition collection.h:163
gint descending
Definition collection.h:164
dt_collection_filter_flag_t filter_flags
Definition collection.h:157
char * text_filter
Definition collection.h:160
Definition collection.h:169
dt_collection_params_t store
Definition collection.h:175
unsigned int count
Definition collection.h:172
dt_collection_params_t params
Definition collection.h:174
unsigned int tagid
Definition collection.h:173
gchar * query
Definition collection.h:170
gchar ** where_ext
Definition collection.h:171