本文整理汇总了C++中dt_conf_set_int函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_conf_set_int函数的具体用法?C++ dt_conf_set_int怎么用?C++ dt_conf_set_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_conf_set_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_params
int set_params(dt_lib_module_t *self, const void *params, int size)
{
/* update conf settings from params */
dt_lib_collect_params_t *p = (dt_lib_collect_params_t *)params;
char confname[200];
for (int i=0; i<p->rules; i++) {
/* set item */
snprintf(confname, 200, "plugins/lighttable/collect/item%1d", i);
dt_conf_set_int(confname, p->rule[i].item);
/* set mode */
snprintf(confname, 200, "plugins/lighttable/collect/mode%1d", i);
dt_conf_set_int(confname, p->rule[i].mode);
/* set string */
snprintf(confname, 200, "plugins/lighttable/collect/string%1d", i);
dt_conf_set_string(confname, p->rule[i].string);
}
/* set number of rules */
snprintf(confname, 200, "plugins/lighttable/collect/num_rules");
dt_conf_set_int(confname, p->rules);
/* update ui */
_lib_collect_gui_update(self);
/* update view */
dt_collection_update_query(darktable.collection);
return 0;
}
示例2: _lib_keywords_add_collection_rule
static void _lib_keywords_add_collection_rule(GtkTreeView *view, GtkTreePath *tp,
GtkTreeViewColumn *tvc, gpointer user_data)
{
char kw[1024]= {0};
_lib_keywords_string_from_path(kw, 1024, gtk_tree_view_get_model(view), tp);
/*
* add a collection rule
* TODO: move this into a dt_collection_xxx API to be used
* from other places
*/
int rule = dt_conf_get_int("plugins/lighttable/collect/num_rules");
char confname[200] = {0};
/* set mode to AND */
snprintf(confname, 200, "plugins/lighttable/collect/mode%1d", rule);
dt_conf_set_int(confname, 0);
/* set tag string */
snprintf(confname, 200, "plugins/lighttable/collect/string%1d", rule);
dt_conf_set_string(confname, kw);
/* set tag rule type */
snprintf(confname, 200, "plugins/lighttable/collect/item%1d", rule);
dt_conf_set_int(confname, 3);
dt_conf_set_int("plugins/lighttable/collect/num_rules", rule+1);
dt_view_collection_update(darktable.view_manager);
dt_collection_update_query(darktable.collection);
}
示例3: dt_collection_deserialize
void
dt_collection_deserialize(char *buf)
{
int num_rules = 0;
char str[400], confname[200];
sprintf(str, "%%");
int mode = 0, item = 0;
sscanf(buf, "%d", &num_rules);
if(num_rules == 0) num_rules = 1;
dt_conf_set_int("plugins/lighttable/collect/num_rules", num_rules);
while(buf[0] != ':') buf++;
buf++;
for(int k=0; k<num_rules; k++)
{
sscanf(buf, "%d:%d:%[^$]", &mode, &item, str);
snprintf(confname, 200, "plugins/lighttable/collect/mode%1d", k);
dt_conf_set_int(confname, mode);
snprintf(confname, 200, "plugins/lighttable/collect/item%1d", k);
dt_conf_set_int(confname, item);
snprintf(confname, 200, "plugins/lighttable/collect/string%1d", k);
dt_conf_set_string(confname, str);
while(buf[0] != '$' && buf[0] != '\0') buf++;
buf++;
}
dt_collection_update_query(darktable.collection);
}
示例4: dt_configure_defaults
void dt_configure_defaults()
{
const int atom_cores = dt_get_num_atom_cores();
const int threads = dt_get_num_threads();
const size_t mem = dt_get_total_memory();
const int bits = (sizeof(void*) == 4) ? 32 : 64;
fprintf(stderr, "[defaults] found a %d-bit system with %zu kb ram and %d cores (%d atom based)\n", bits, mem, threads, atom_cores);
if(mem > (2u<<20) && threads > 4)
{
fprintf(stderr, "[defaults] setting high quality defaults\n");
dt_conf_set_int("worker_threads", 8);
dt_conf_set_int("cache_memory", 1u<<30);
dt_conf_set_int("plugins/lighttable/thumbnail_width", 1300);
dt_conf_set_int("plugins/lighttable/thumbnail_height", 1000);
dt_conf_set_bool("plugins/lighttable/low_quality_thumbnails", FALSE);
}
if(mem < (1u<<20) || threads <= 2 || bits < 64 || atom_cores > 0)
{
fprintf(stderr, "[defaults] setting very conservative defaults\n");
dt_conf_set_int("worker_threads", 1);
dt_conf_set_int("cache_memory", 200u<<20);
dt_conf_set_int("host_memory_limit", 500);
dt_conf_set_int("singlebuffer_limit", 8);
dt_conf_set_int("plugins/lighttable/thumbnail_width", 800);
dt_conf_set_int("plugins/lighttable/thumbnail_height", 500);
dt_conf_set_string("plugins/darkroom/demosaic/quality", "always bilinear (fast)");
dt_conf_set_bool("plugins/lighttable/low_quality_thumbnails", TRUE);
}
}
示例5: _lib_import_tethered_callback
/* enter tethering mode for camera */
static void _lib_import_tethered_callback(GtkToggleButton *button,gpointer data)
{
/* select camera to work with before switching mode */
dt_camctl_select_camera(darktable.camctl, (dt_camera_t *)data);
dt_conf_set_int( "plugins/capture/mode", DT_CAPTURE_MODE_TETHERED);
dt_conf_set_int("plugins/capture/current_filmroll",-1);
dt_ctl_switch_mode_to(DT_CAPTURE);
}
示例6: gui_reset
void
gui_reset (dt_lib_module_t *self)
{
dt_conf_set_int("plugins/lighttable/collect/num_rules", 1);
dt_conf_set_int("plugins/lighttable/collect/item0", 0);
dt_conf_set_string("plugins/lighttable/collect/string0", "%");
dt_collection_update_query(darktable.collection);
}
示例7: bpp_combobox_changed
static void bpp_combobox_changed(GtkWidget *widget, gpointer user_data)
{
const int bpp = dt_bauhaus_combobox_get(widget);
if(bpp == 1)
dt_conf_set_int("plugins/imageio/format/tiff/bpp", 16);
else if(bpp == 2)
dt_conf_set_int("plugins/imageio/format/tiff/bpp", 32);
else // (bpp == 0)
dt_conf_set_int("plugins/imageio/format/tiff/bpp", 8);
}
示例8: bpp_combobox_changed
static void
bpp_combobox_changed(GtkComboBox *widget, gpointer user_data)
{
int bpp = gtk_combo_box_get_active(widget);
if (bpp == 1)
dt_conf_set_int("plugins/imageio/format/tiff/bpp", 16);
else if (bpp == 2)
dt_conf_set_int("plugins/imageio/format/tiff/bpp", 32);
else // (bpp == 0)
dt_conf_set_int("plugins/imageio/format/tiff/bpp", 8);
}
示例9: gui_reset
void gui_reset(dt_lib_module_t *self)
{
dt_conf_set_int("plugins/lighttable/recentcollect/num_items", 0);
char confname[200];
for(int k = 0; k < NUM_LINES; k++)
{
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/line%1d", k);
dt_conf_set_string(confname, "");
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/pos%1d", k);
dt_conf_set_int(confname, 0);
}
_lib_recentcollection_updated(NULL, self);
}
示例10: dt_film_set_query
void dt_film_set_query(const int32_t id)
{
/* enable film id filter and set film id */
dt_conf_set_int("plugins/lighttable/collect/num_rules", 1);
dt_conf_set_int("plugins/lighttable/collect/item0", 0);
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"SELECT id, folder FROM main.film_rolls WHERE id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, id);
if(sqlite3_step(stmt) == SQLITE_ROW)
{
dt_conf_set_string("plugins/lighttable/collect/string0", (gchar *)sqlite3_column_text(stmt, 1));
}
sqlite3_finalize(stmt);
dt_collection_update_query(darktable.collection);
}
示例11: dt_opencl_image_fits_device
/** check if image size fit into limits given by OpenCL runtime */
int dt_opencl_image_fits_device(const int devid, const size_t width, const size_t height, const unsigned bpp, const float factor, const size_t overhead)
{
static float headroom = -1.0f;
if(!darktable.opencl->inited || devid < 0) return FALSE;
/* first time run */
if(headroom < 0.0f)
{
headroom = (float)dt_conf_get_int("opencl_memory_headroom")*1024*1024;
/* don't let the user play games with us */
headroom = fmin((float)darktable.opencl->dev[devid].max_global_mem, fmax(headroom, 0.0f));
dt_conf_set_int("opencl_memory_headroom", headroom/1024/1024);
}
float singlebuffer = (float)width * height * bpp;
float total = factor * singlebuffer + overhead;
if(darktable.opencl->dev[devid].max_image_width < width || darktable.opencl->dev[devid].max_image_height < height) return FALSE;
if(darktable.opencl->dev[devid].max_mem_alloc < singlebuffer) return FALSE;
if(darktable.opencl->dev[devid].max_global_mem < total + headroom) return FALSE;
return TRUE;
}
示例12: menuitem_and_not
static void
menuitem_and_not (GtkMenuItem *menuitem, dt_lib_collect_rule_t *d)
{
// add next row with and not operator
const int active = CLAMP(dt_conf_get_int("plugins/lighttable/collect/num_rules"), 1, MAX_RULES);
if(active < 10)
{
char confname[200];
snprintf(confname, 200, "plugins/lighttable/collect/mode%1d", active);
dt_conf_set_int(confname, DT_LIB_COLLECT_MODE_AND_NOT);
snprintf(confname, 200, "plugins/lighttable/collect/string%1d", active);
dt_conf_set_string(confname, "");
dt_conf_set_int("plugins/lighttable/collect/num_rules", active+1);
}
dt_collection_update_query(darktable.collection);
}
示例13: radiobutton_changed
static void
radiobutton_changed (GtkRadioButton *radiobutton, gpointer user_data)
{
long int bpp = (long int)user_data;
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton)))
dt_conf_set_int("plugins/imageio/format/tiff/bpp", bpp);
}
示例14: set_format_by_name
static void
set_format_by_name (dt_lib_export_t *d, const char *name)
{
// Find index of selected format plugin among all existing plugins
int k=-1;
GList *it = g_list_first(darktable.imageio->plugins_format);
if( it != NULL )
do
{
k++;
if( strcmp( ((dt_imageio_module_format_t *)it->data)->name(),name) == 0 ||
strcmp( ((dt_imageio_module_format_t *)it->data)->plugin_name,name) == 0) break;
}
while( ( it = g_list_next(it) ) );
// Store the new format
dt_conf_set_int ("plugins/lighttable/export/format", k);
it = g_list_nth(darktable.imageio->plugins_format, k);
if(it)
{
dt_imageio_module_format_t *module = (dt_imageio_module_format_t *)it->data;
GtkWidget *old = gtk_bin_get_child(GTK_BIN(d->format_box));
if(old != module->widget)
{
if(old) gtk_container_remove(d->format_box, old);
if(module->widget) gtk_container_add(d->format_box, module->widget);
}
gtk_widget_show_all(GTK_WIDGET(d->format_box));
if(!darktable.gui->reset && _combo_box_set_active_text( d->format, module->name() ) == FALSE )
gtk_combo_box_set_active( d->format, 0);
}
// Let's also update combination of storage/format dimension restrictions
_update_dimensions( d );
}
示例15: write_pref
static int write_pref(lua_State*L)
{
const char *script = luaL_checkstring(L,1);
const char *name = luaL_checkstring(L,2);
const char* type_name = luaL_checkstring(L,3);
int i;
for (i=0; pref_type_name[i]; i++)
if (strcmp(pref_type_name[i], type_name) == 0)
{
break;
}
if(!pref_type_name[i]) luaL_argerror(L,3,NULL);
char pref_name[1024];
get_pref_name(pref_name,1024,script,name);
switch(i)
{
case pref_string:
dt_conf_set_string(pref_name,luaL_checkstring(L,4));
break;
case pref_bool:
luaL_checktype(L,4,LUA_TBOOLEAN);
dt_conf_set_bool(pref_name,lua_toboolean(L,4));
break;
case pref_int:
dt_conf_set_int(pref_name,luaL_checkinteger(L,4));
break;
}
return 0;
}