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-2020 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include <glib.h>
22#include <glib/gi18n.h>
23#include <inttypes.h>
24#include "common/metadata.h"
25
26#define NUM_LAST_COLLECTIONS 10
27
29{
30 COLLECTION_QUERY_SIMPLE = 0, // a query with only select and where statement
31 COLLECTION_QUERY_USE_SORT = 1 << 0, // if query should include order by statement
32 COLLECTION_QUERY_USE_LIMIT = 1 << 1, // if query should include "limit ?1,?2" part
33 COLLECTION_QUERY_USE_WHERE_EXT = 1 << 2, // if query should include extended where part
34 COLLECTION_QUERY_USE_ONLY_WHERE_EXT = 1 << 3 // if query should only use extended where part
36#define COLLECTION_QUERY_FULL (COLLECTION_QUERY_USE_SORT | COLLECTION_QUERY_USE_LIMIT)
37
57
74
75#define DT_COLLECTION_ORDER_FLAG 0x8000
76
77/* NOTE: any reordeing in this module require a legacy_preset entry in src/libs/collect.c */
115
117{
119 DT_COLLECTION_CHANGE_NEW_QUERY = 1, // a completly different query
120 DT_COLLECTION_CHANGE_FILTER = 2, // base query has been finetuned (filter, ...)
121 DT_COLLECTION_CHANGE_RELOAD = 3 // we have just reload the collection after images changes (query is identical)
123
140
150
151/* returns the name for the given collection property */
153
157void dt_collection_free(const dt_collection_t *collection);
161void dt_collection_get_makermodels(const gchar *filter, GList **sanitized, GList **exif);
163gchar *dt_collection_get_makermodel(const char *exif_maker, const char *exif_model);
165const gchar *dt_collection_get_query(const dt_collection_t *collection);
167int dt_collection_update(const dt_collection_t *collection);
169void dt_collection_reset(const dt_collection_t *collection);
171gchar *dt_collection_get_extended_where(const dt_collection_t *collection, int exclude);
173void dt_collection_set_extended_where(const dt_collection_t *collection, gchar **extended_where);
174
179
184
186char *dt_collection_get_text_filter(const dt_collection_t *collection);
188void dt_collection_set_text_filter(const dt_collection_t *collection, char *text_filter);
189
191void dt_collection_set_tag_id(dt_collection_t *collection, const uint32_t tagid);
192
194void dt_collection_load_filmroll(dt_collection_t *collection, const int32_t imgid, gboolean open_single_image);
195
197void dt_collection_set_sort(const dt_collection_t *collection, dt_collection_sort_t sort, gint reverse);
201gboolean dt_collection_get_sort_descending(const dt_collection_t *collection);
203gchar *dt_collection_get_sort_query(const dt_collection_t *collection);
204
206uint32_t dt_collection_get_count(const dt_collection_t *collection);
208int dt_collection_get_nth(const dt_collection_t *collection, int nth);
211GList *dt_collection_get_all(const dt_collection_t *collection, int limit);
212
214void dt_collection_update_query(const dt_collection_t *collection, dt_collection_change_t query_change,
215 dt_collection_properties_t changed_property, GList *list);
216
218void dt_collection_hint_message(const dt_collection_t *collection);
219
220/* serialize and deserialize into a string. */
221void dt_collection_deserialize(const char *buf);
222int dt_collection_serialize(char *buf, int bufsize);
223
224/* splits an input string into a number part and an optional operator part */
225void dt_collection_split_operator_number(const gchar *input, char **number1, char **number2, char **op);
226void dt_collection_split_operator_datetime(const gchar *input, char **number1, char **number2, char **op);
227void dt_collection_split_operator_exposure(const gchar *input, char **number1, char **number2, char **op);
228
229/* initialize memory table */
231
236
237// clang-format off
238// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
239// vim: shiftwidth=2 expandtab tabstop=2 cindent
240// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
241// clang-format on
const char * dt_collection_name(dt_collection_properties_t prop)
Definition collection.c:571
void dt_collection_load_filmroll(dt_collection_t *collection, const int32_t imgid, gboolean open_single_image)
Definition collection.c:2013
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:1746
void dt_culling_mode_to_selection()
Definition collection.c:1905
void dt_collection_reset(const dt_collection_t *collection)
Definition collection.c:445
void dt_collection_set_query_flags(const dt_collection_t *collection, dt_collection_query_flags_t flags)
Definition collection.c:502
void dt_collection_split_operator_exposure(const gchar *input, char **number1, char **number2, char **op)
Definition collection.c:945
void dt_collection_split_operator_datetime(const gchar *input, char **number1, char **number2, char **op)
Definition collection.c:884
void dt_collection_deserialize(const char *buf)
Definition collection.c:1631
const dt_collection_params_t * dt_collection_params(const dt_collection_t *collection)
Definition collection.c:71
void dt_collection_set_text_filter(const dt_collection_t *collection, char *text_filter)
Definition collection.c:490
char * dt_collection_get_text_filter(const dt_collection_t *collection)
Definition collection.c:485
gboolean dt_collection_get_sort_descending(const dt_collection_t *collection)
Definition collection.c:566
dt_collection_properties_t
Definition collection.h:79
@ DT_COLLECTION_PROP_EXPOSURE
Definition collection.h:87
@ DT_COLLECTION_PROP_MODULE
Definition collection.h:106
@ DT_COLLECTION_PROP_RATING
Definition collection.h:108
@ DT_COLLECTION_PROP_TIME
Definition collection.h:92
@ DT_COLLECTION_PROP_METADATA
Definition collection.h:101
@ DT_COLLECTION_PROP_GROUPING
Definition collection.h:102
@ DT_COLLECTION_PROP_TAG
Definition collection.h:99
@ DT_COLLECTION_PROP_FILMROLL
Definition collection.h:80
@ DT_COLLECTION_PROP_LENS
Definition collection.h:85
@ DT_COLLECTION_PROP_SORT
Definition collection.h:113
@ DT_COLLECTION_PROP_CAMERA
Definition collection.h:84
@ DT_COLLECTION_PROP_LAST
Definition collection.h:110
@ DT_COLLECTION_PROP_LOCAL_COPY
Definition collection.h:103
@ DT_COLLECTION_PROP_GEOTAGGING
Definition collection.h:98
@ DT_COLLECTION_PROP_FILENAME
Definition collection.h:82
@ DT_COLLECTION_PROP_ISO
Definition collection.h:89
@ DT_COLLECTION_PROP_COLORLABEL
Definition collection.h:100
@ DT_COLLECTION_PROP_UNDEF
Definition collection.h:112
@ DT_COLLECTION_PROP_DAY
Definition collection.h:91
@ DT_COLLECTION_PROP_ORDER
Definition collection.h:107
@ DT_COLLECTION_PROP_FOLDERS
Definition collection.h:81
@ DT_COLLECTION_PROP_APERTURE
Definition collection.h:86
@ DT_COLLECTION_PROP_IMPORT_TIMESTAMP
Definition collection.h:93
@ DT_COLLECTION_PROP_FOCAL_LENGTH
Definition collection.h:88
@ DT_COLLECTION_PROP_EXPORT_TIMESTAMP
Definition collection.h:95
@ DT_COLLECTION_PROP_CHANGE_TIMESTAMP
Definition collection.h:94
@ DT_COLLECTION_PROP_HISTORY
Definition collection.h:105
@ DT_COLLECTION_PROP_PRINT_TIMESTAMP
Definition collection.h:96
gchar * dt_collection_get_extended_where(const dt_collection_t *collection, int exclude)
Definition collection.c:508
void dt_selection_to_culling_mode()
Definition collection.c:1888
void dt_collection_set_filter_flags(const dt_collection_t *collection, dt_collection_filter_flag_t flags)
Definition collection.c:479
void dt_collection_memory_update()
Definition collection.c:115
dt_collection_filter_flag_t dt_collection_get_filter_flags(const dt_collection_t *collection)
Definition collection.c:474
dt_collection_query_flags_t
Definition collection.h:29
@ COLLECTION_QUERY_USE_ONLY_WHERE_EXT
Definition collection.h:34
@ COLLECTION_QUERY_USE_WHERE_EXT
Definition collection.h:33
@ COLLECTION_QUERY_USE_SORT
Definition collection.h:31
@ COLLECTION_QUERY_SIMPLE
Definition collection.h:30
@ COLLECTION_QUERY_USE_LIMIT
Definition collection.h:32
void dt_collection_get_makermodels(const gchar *filter, GList **sanitized, GList **exif)
Definition collection.c:1008
dt_collection_filter_flag_t
Definition collection.h:39
@ COLLECTION_FILTER_ALTERED
Definition collection.h:41
@ COLLECTION_FILTER_UNALTERED
Definition collection.h:42
@ COLLECTION_FILTER_GREEN
Definition collection.h:52
@ COLLECTION_FILTER_NONE
Definition collection.h:40
@ COLLECTION_FILTER_2_STAR
Definition collection.h:46
@ COLLECTION_FILTER_MAGENTA
Definition collection.h:54
@ COLLECTION_FILTER_0_STAR
Definition collection.h:44
@ COLLECTION_FILTER_1_STAR
Definition collection.h:45
@ COLLECTION_FILTER_BLUE
Definition collection.h:53
@ COLLECTION_FILTER_5_STAR
Definition collection.h:49
@ COLLECTION_FILTER_YELLOW
Definition collection.h:51
@ COLLECTION_FILTER_REJECTED
Definition collection.h:43
@ COLLECTION_FILTER_4_STAR
Definition collection.h:48
@ COLLECTION_FILTER_3_STAR
Definition collection.h:47
@ COLLECTION_FILTER_RED
Definition collection.h:50
@ COLLECTION_FILTER_WHITE
Definition collection.h:55
const gchar * dt_collection_get_query(const dt_collection_t *collection)
Definition collection.c:466
void dt_collection_split_operator_number(const gchar *input, char **number1, char **number2, char **op)
Definition collection.c:815
dt_collection_query_flags_t dt_collection_get_query_flags(const dt_collection_t *collection)
Definition collection.c:497
dt_collection_sort_t dt_collection_get_sort_field(const dt_collection_t *collection)
Definition collection.c:561
void dt_collection_set_tag_id(dt_collection_t *collection, const uint32_t tagid)
Definition collection.c:546
int dt_collection_get_nth(const dt_collection_t *collection, int nth)
Definition collection.c:785
dt_collection_change_t
Definition collection.h:117
@ DT_COLLECTION_CHANGE_RELOAD
Definition collection.h:121
@ DT_COLLECTION_CHANGE_NEW_QUERY
Definition collection.h:119
@ DT_COLLECTION_CHANGE_FILTER
Definition collection.h:120
@ DT_COLLECTION_CHANGE_NONE
Definition collection.h:118
gchar * dt_collection_get_makermodel(const char *exif_maker, const char *exif_model)
Definition collection.c:1068
void dt_collection_hint_message(const dt_collection_t *collection)
Definition collection.c:1920
int dt_collection_serialize(char *buf, int bufsize)
Definition collection.c:1599
uint32_t dt_collection_get_count(const dt_collection_t *collection)
Definition collection.c:743
int dt_collection_update(const dt_collection_t *collection)
Definition collection.c:182
dt_collection_sort_t
Definition collection.h:59
@ DT_COLLECTION_SORT_EXPORT_TIMESTAMP
Definition collection.h:65
@ DT_COLLECTION_SORT_IMPORT_TIMESTAMP
Definition collection.h:63
@ DT_COLLECTION_SORT_DATETIME
Definition collection.h:62
@ DT_COLLECTION_SORT_GROUP
Definition collection.h:70
@ DT_COLLECTION_SORT_FILENAME
Definition collection.h:61
@ DT_COLLECTION_SORT_RATING
Definition collection.h:67
@ DT_COLLECTION_SORT_PATH
Definition collection.h:71
@ DT_COLLECTION_SORT_TITLE
Definition collection.h:72
@ DT_COLLECTION_SORT_CHANGE_TIMESTAMP
Definition collection.h:64
@ DT_COLLECTION_SORT_NONE
Definition collection.h:60
@ DT_COLLECTION_SORT_PRINT_TIMESTAMP
Definition collection.h:66
@ DT_COLLECTION_SORT_ID
Definition collection.h:68
@ DT_COLLECTION_SORT_COLOR
Definition collection.h:69
dt_collection_t * dt_collection_new()
Definition collection.c:57
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:537
GList * dt_collection_get_all(const dt_collection_t *collection, int limit)
Definition collection.c:780
gchar * dt_collection_get_sort_query(const dt_collection_t *collection)
Definition collection.c:622
void dt_collection_free(const dt_collection_t *collection)
Definition collection.c:64
@ DT_METADATA_NUMBER
Definition metadata.h:41
dt_mipmap_buffer_dsc_flags flags
Definition mipmap_cache.c:4
Definition collection.h:125
dt_collection_query_flags_t query_flags
Definition collection.h:127
dt_collection_sort_t sort
Definition collection.h:136
gint descending
Definition collection.h:137
dt_collection_filter_flag_t filter_flags
Definition collection.h:130
char * text_filter
Definition collection.h:133
Definition collection.h:142
dt_collection_params_t store
Definition collection.h:148
unsigned int count
Definition collection.h:145
dt_collection_params_t params
Definition collection.h:147
unsigned int tagid
Definition collection.h:146
gchar * query
Definition collection.h:143
gchar ** where_ext
Definition collection.h:144