• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dt_conf_get_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dt_conf_get_string函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_conf_get_string函数的具体用法?C++ dt_conf_get_string怎么用?C++ dt_conf_get_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dt_conf_get_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: export_button_clicked

static void
export_button_clicked (GtkWidget *widget, gpointer user_data)
{
  char style[128];

  // Let's get the max dimension restriction if any...
  // TODO: pass the relevant values directly, not using the conf ...
  int max_width  = dt_conf_get_int ("plugins/lighttable/export/width");
  int max_height = dt_conf_get_int ("plugins/lighttable/export/height");
  char *format_name = dt_conf_get_string("plugins/lighttable/export/format_name");
  char *storage_name = dt_conf_get_string("plugins/lighttable/export/storage_name");
  int format_index = dt_imageio_get_index_of_format(dt_imageio_get_format_by_name(format_name));
  int storage_index = dt_imageio_get_index_of_storage(dt_imageio_get_storage_by_name(storage_name));
  g_free(format_name);
  g_free(storage_name);
  gboolean high_quality = dt_conf_get_bool("plugins/lighttable/export/high_quality_processing");
  char* tmp = dt_conf_get_string("plugins/lighttable/export/style");
  if (tmp)
  {
    g_strlcpy(style, tmp, sizeof(style));
    g_free(tmp);
  }

  int imgid = dt_view_get_image_to_act_on();
  GList *list = NULL;

  if (imgid != -1)
    list = g_list_append (list, GINT_TO_POINTER(imgid));
  else
    list = dt_collection_get_selected(darktable.collection, -1);

  dt_control_export(list, max_width, max_height, format_index, storage_index, high_quality,style);
}
开发者ID:bartokk,项目名称:darktable,代码行数:33,代码来源:export.c


示例2: init

void init(dt_view_t *self)
{
  self->data = malloc(sizeof(dt_capture_t));
  memset(self->data,0,sizeof(dt_capture_t));
  dt_capture_t *lib = (dt_capture_t *)self->data;

  // initialize capture data struct
  const int i = dt_conf_get_int("plugins/capture/mode");
  lib->mode = i;

  // Setup variable expanding, shares configuration as camera import uses...
  dt_variables_params_init(&lib->vp);
  lib->basedirectory = dt_conf_get_string("plugins/capture/storage/basedirectory");
  lib->subdirectory = dt_conf_get_string("plugins/capture/storage/subpath");
  lib->filenamepattern = dt_conf_get_string("plugins/capture/storage/namepattern");

  // prefetch next few from first selected image on.
  dt_view_filmstrip_prefetch();


  /* setup the tethering view proxy */
  darktable.view_manager->proxy.tethering.view = self;
  darktable.view_manager->proxy.tethering.get_film_id = _capture_view_get_film_id;
  darktable.view_manager->proxy.tethering.get_session_filename = _capture_view_get_session_filename;
  darktable.view_manager->proxy.tethering.get_session_path = _capture_view_get_session_path;
  darktable.view_manager->proxy.tethering.get_job_code = _capture_view_get_jobcode;
  darktable.view_manager->proxy.tethering.set_job_code = _capture_view_set_jobcode;
  darktable.view_manager->proxy.tethering.get_selected_imgid = _capture_view_get_selected_imgid;

}
开发者ID:AntonSh,项目名称:darktable,代码行数:30,代码来源:capture.c


示例3: gui_init

void gui_init(dt_imageio_module_storage_t *self)
{
  latex_t *d = (latex_t *)malloc(sizeof(latex_t));
  self->gui_data = (void *)d;
  self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_PIXEL_APPLY_DPI(5));
  GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(8));
  gtk_box_pack_start(GTK_BOX(self->widget), hbox, TRUE, TRUE, 0);
  GtkWidget *widget;

  widget = gtk_entry_new();
  gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0);
  gchar *dir = dt_conf_get_string("plugins/imageio/storage/latex/file_directory");
  if(dir)
  {
    gtk_entry_set_text(GTK_ENTRY(widget), dir);
    g_free(dir);
  }
  d->entry = GTK_ENTRY(widget);
  dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(d->entry));

  dt_gtkentry_setup_completion(GTK_ENTRY(widget), dt_gtkentry_get_default_path_compl_list());

  char *tooltip_text = dt_gtkentry_build_completion_tooltip_text(
      _("enter the path where to put exported images\nrecognized variables:"),
      dt_gtkentry_get_default_path_compl_list());
  gtk_widget_set_tooltip_text(widget, tooltip_text);
  g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(entry_changed_callback), self);
  g_free(tooltip_text);

  widget = dtgtk_button_new(dtgtk_cairo_paint_directory, CPF_DO_NOT_USE_BORDER);
  gtk_widget_set_tooltip_text(widget, _("select directory"));
  gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
  g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(button_clicked), self);

  hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10));
  gtk_box_pack_start(GTK_BOX(self->widget), hbox, TRUE, TRUE, 0);

  widget = gtk_label_new(_("title"));
  gtk_widget_set_halign(widget, GTK_ALIGN_START);
  g_object_set(G_OBJECT(widget), "xalign", 0.0, NULL);
  gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);

  d->title_entry = GTK_ENTRY(gtk_entry_new());
  gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(d->title_entry), TRUE, TRUE, 0);
  dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(d->title_entry));
  // TODO: support title, author, subject, keywords (collect tags?)
  gtk_widget_set_tooltip_text(GTK_WIDGET(d->title_entry), _("enter the title of the book"));
  dir = dt_conf_get_string("plugins/imageio/storage/latex/title");
  if(dir)
  {
    gtk_entry_set_text(GTK_ENTRY(d->title_entry), dir);
    g_free(dir);
  }
  g_signal_connect(G_OBJECT(d->title_entry), "changed", G_CALLBACK(title_changed_callback), self);
}
开发者ID:kael-shipman,项目名称:darktable,代码行数:55,代码来源:latex.c


示例4: gui_reset

void
gui_reset (dt_lib_module_t *self)
{
  // make sure we don't do anything useless:
  if(!dt_control_running()) return;
  dt_lib_export_t *d = (dt_lib_export_t *)self->data;
  gtk_spin_button_set_value(d->width,   dt_conf_get_int("plugins/lighttable/export/width"));
  gtk_spin_button_set_value(d->height,  dt_conf_get_int("plugins/lighttable/export/height"));

  // Set storage
  gchar *storage_name = dt_conf_get_string("plugins/lighttable/export/storage_name");
  int storage_index = dt_imageio_get_index_of_storage(dt_imageio_get_storage_by_name(storage_name));
  g_free(storage_name);
  gtk_combo_box_set_active(d->storage, storage_index);

  gtk_combo_box_set_active(d->intent, (int)dt_conf_get_int("plugins/lighttable/export/iccintent") + 1);
  // iccprofile
  int iccfound = 0;
  gchar *iccprofile = dt_conf_get_string("plugins/lighttable/export/iccprofile");
  if(iccprofile)
  {
    GList *prof = d->profiles;
    while(prof)
    {
      dt_lib_export_profile_t *pp = (dt_lib_export_profile_t *)prof->data;
      if(!strcmp(pp->filename, iccprofile))
      {
        gtk_combo_box_set_active(d->profile, pp->pos);
        iccfound = 1;
      }
      if(iccfound) break;
      prof = g_list_next(prof);
    }
    g_free(iccprofile);
  }
  // style
  // set it to none if the var is not set or the style doesn't exist anymore
  gboolean rc = FALSE;
  gchar *style = dt_conf_get_string("plugins/lighttable/export/style");
  if (style != NULL)
  {
    rc = _combo_box_set_active_text(d->style, style);
    if (rc == FALSE)
      gtk_combo_box_set_active(d->style, 0);
    g_free(style);
  }
  else
    gtk_combo_box_set_active(d->style, 0);

  if(!iccfound) gtk_combo_box_set_active(d->profile, 0);
  dt_imageio_module_format_t *mformat = dt_imageio_get_format();
  if(mformat) mformat->gui_reset(mformat);
  dt_imageio_module_storage_t *mstorage = dt_imageio_get_storage();
  if(mstorage) mstorage->gui_reset(mstorage);
}
开发者ID:bartokk,项目名称:darktable,代码行数:55,代码来源:export.c


示例5: curl_easy_init

static dt_gphoto_context_t *gphoto_api_init()
{
  dt_gphoto_context_t *ctx = (dt_gphoto_context_t *)g_malloc0(sizeof(dt_gphoto_context_t));
  ctx->curl_ctx = curl_easy_init();
  ctx->errmsg = g_string_new("");
  ctx->response = g_string_new("");
  ctx->json_parser = json_parser_new();
  ctx->google_client_id = dt_conf_get_string("plugins/imageio/storage/gphoto/id");
  ctx->google_client_secret = dt_conf_get_string("plugins/imageio/storage/gphoto/secret");
  return ctx;
}
开发者ID:TurboGit,项目名称:darktable,代码行数:11,代码来源:googlephoto.c


示例6: memset

/** Creates a gconf widget. */
_camera_gconf_widget_t *_camera_import_gconf_widget(_camera_import_dialog_t *dlg,gchar *label,gchar *confstring)
{
  _camera_gconf_widget_t *gcw=malloc(sizeof(_camera_gconf_widget_t));
  memset(gcw,0,sizeof(_camera_gconf_widget_t));
  GtkWidget *vbox,*hbox;
  gcw->widget=vbox=GTK_WIDGET(gtk_vbox_new(FALSE,0));
  hbox=GTK_WIDGET(gtk_hbox_new(FALSE,0));
  g_object_set_data(G_OBJECT(vbox),"gconf:string",confstring);
  gcw->dialog=dlg;

  gcw->entry=gtk_entry_new();
  char* value = NULL;
  if((value = dt_conf_get_string (confstring)))
  {
    gtk_entry_set_text( GTK_ENTRY( gcw->entry ),dt_conf_get_string (confstring));
    gcw->value=g_strdup(value);
    g_free(value);
  }

  gtk_box_pack_start(GTK_BOX(hbox),GTK_WIDGET(gcw->entry),TRUE,TRUE,0);

  GtkWidget *button=dtgtk_button_new(dtgtk_cairo_paint_store,CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
  g_object_set(button,"tooltip-text",_("store value as default"),(char *)NULL);
  gtk_widget_set_size_request(button,13,13);
  gtk_box_pack_start(GTK_BOX(hbox),button,FALSE,FALSE,0);
  g_signal_connect (G_OBJECT (button), "clicked",
                    G_CALLBACK (_gcw_store_callback), gcw);

  button=dtgtk_button_new(dtgtk_cairo_paint_reset,CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
  g_object_set(button,"tooltip-text",_("reset value to default"),(char *)NULL);
  gtk_widget_set_size_request(button,13,13);
  gtk_box_pack_start(GTK_BOX(hbox),button,FALSE,FALSE,0);
  g_signal_connect (G_OBJECT (button), "clicked",
                    G_CALLBACK (_gcw_reset_callback), gcw);

  GtkWidget *l=gtk_label_new(label);
  gtk_misc_set_alignment(GTK_MISC(l), 0.0, 0.0);
  gtk_box_pack_start(GTK_BOX(vbox),l,FALSE,FALSE,0);

  gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(hbox),FALSE,FALSE,0);

  g_signal_connect (G_OBJECT(gtk_entry_get_buffer(GTK_ENTRY(gcw->entry))), "inserted-text",
                    G_CALLBACK (entry_it_callback), gcw);
  g_signal_connect (G_OBJECT(gtk_entry_get_buffer(GTK_ENTRY(gcw->entry))), "deleted-text",
                    G_CALLBACK (entry_dt_callback), gcw);

  return gcw;
}
开发者ID:EvilBit,项目名称:darktable,代码行数:49,代码来源:camera_import_dialog.c


示例7: _lib_collect_update_params

/* Update the params struct with active ruleset */
static void _lib_collect_update_params(dt_lib_collect_t *d) {
    /* reset params */
    dt_lib_collect_params_t *p = d->params;
    memset(p,0,sizeof(dt_lib_collect_params_t));

    /* for each active rule set update params */
    const int active = CLAMP(dt_conf_get_int("plugins/lighttable/collect/num_rules") - 1, 0, (MAX_RULES-1));
    char confname[200];
    for (int i=0; i<=active; i++) {
        /* get item */
        snprintf(confname, 200, "plugins/lighttable/collect/item%1d", i);
        p->rule[i].item = dt_conf_get_int(confname);

        /* get mode */
        snprintf(confname, 200, "plugins/lighttable/collect/mode%1d", i);
        p->rule[i].mode = dt_conf_get_int(confname);

        /* get string */
        snprintf(confname, 200, "plugins/lighttable/collect/string%1d", i);
        gchar* string = dt_conf_get_string(confname);
        if (string != NULL) {
            snprintf(p->rule[i].string,PARAM_STRING_SIZE,"%s", string);
            g_free(string);
        }

        fprintf(stderr,"[%i] %d,%d,%s\n",i, p->rule[i].item, p->rule[i].mode,  p->rule[i].string);
    }

    p->rules = active+1;

}
开发者ID:nagyistoce,项目名称:radhermit-darktable,代码行数:32,代码来源:collect.c


示例8: enter

void enter(dt_view_t *self)
{
  dt_capture_t *lib = (dt_capture_t *)self->data;

  lib->mode = dt_conf_get_int("plugins/capture/mode");

  /* connect signal for mipmap update for a redraw */
  dt_control_signal_connect(darktable.signals, DT_SIGNAL_DEVELOP_MIPMAP_UPDATED,
                            G_CALLBACK(_capture_mipamps_updated_signal_callback),
                            (gpointer)self);


  /* connect signal for fimlstrip image activate */
  dt_control_signal_connect(darktable.signals,
                            DT_SIGNAL_VIEWMANAGER_FILMSTRIP_ACTIVATE,
                            G_CALLBACK(_view_capture_filmstrip_activate_callback),
                            self);

  dt_view_filmstrip_scroll_to_image(darktable.view_manager, lib->image_id, TRUE);


  // initialize a default session...
  char* tmp = dt_conf_get_string("plugins/capture/jobcode");
  _capture_view_set_jobcode(self, tmp);
  g_free(tmp);
}
开发者ID:AntonSh,项目名称:darktable,代码行数:26,代码来源:capture.c


示例9: import_button_clicked

static void import_button_clicked(GtkButton *button, gpointer user_data)
{
  char *last_dirname = dt_conf_get_string("plugins/lighttable/tagging/last_import_export_location");
  if(!last_dirname || !*last_dirname)
  {
    g_free(last_dirname);
    last_dirname = g_strdup(g_get_home_dir());
  }

  GtkWidget *win = dt_ui_main_window(darktable.gui->ui);
  GtkWidget *filechooser = gtk_file_chooser_dialog_new(_("Select a keyword file"), GTK_WINDOW(win),
                                                       GTK_FILE_CHOOSER_ACTION_OPEN,
                                                       _("_cancel"), GTK_RESPONSE_CANCEL,
                                                       _("_import"), GTK_RESPONSE_ACCEPT, (char *)NULL);
  gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(filechooser), last_dirname);
  gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(filechooser), FALSE);

  if(gtk_dialog_run(GTK_DIALOG(filechooser)) == GTK_RESPONSE_ACCEPT)
  {
    char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser));
    char *dirname = g_path_get_dirname(filename);
    dt_conf_set_string("plugins/lighttable/tagging/last_import_export_location", dirname);
    ssize_t count = dt_tag_import(filename);
    if(count < 0)
      dt_control_log(_("error importing tags"));
    else
      dt_control_log(_("%zd tags imported"), count);
    g_free(filename);
    g_free(dirname);
  }

  g_free(last_dirname);
  gtk_widget_destroy(filechooser);
}
开发者ID:fhrtms,项目名称:darktable,代码行数:34,代码来源:tagging.c


示例10: dt_dev_init

void dt_dev_init(dt_develop_t *dev, int32_t gui_attached)
{
  memset(dev,0,sizeof(dt_develop_t));
  dev->preview_downsampling = 1.0f;
  dev->gui_module = NULL;
  dev->timestamp = 0;
  dev->average_delay = DT_DEV_AVERAGE_DELAY_START;
  dev->preview_average_delay = DT_DEV_PREVIEW_AVERAGE_DELAY_START;
  dev->gui_leaving = 0;
  dev->gui_synch = 0;
  dt_pthread_mutex_init(&dev->history_mutex, NULL);
  dev->history_end = 0;
  dev->history = NULL; // empty list

  dev->gui_attached = gui_attached;
  dev->width = -1;
  dev->height = -1;

  dt_image_init(&dev->image_storage);
  dev->image_dirty = dev->preview_dirty = 1;
  dev->image_loading = dev->preview_loading = 0;
  dev->image_force_reload = 0;
  dev->preview_input_changed = 0;

  dev->pipe = dev->preview_pipe = NULL;
  dev->histogram = NULL;
  dev->histogram_pre_tonecurve = NULL;
  dev->histogram_pre_levels = NULL;
  if(g_strcmp0(dt_conf_get_string("plugins/darkroom/histogram/mode"), "linear") == 0)
    dev->histogram_linear = TRUE;
  else
    dev->histogram_linear = FALSE;

  if(dev->gui_attached)
  {
    dev->pipe = (dt_dev_pixelpipe_t *)malloc(sizeof(dt_dev_pixelpipe_t));
    dev->preview_pipe = (dt_dev_pixelpipe_t *)malloc(sizeof(dt_dev_pixelpipe_t));
    dt_dev_pixelpipe_init(dev->pipe);
    dt_dev_pixelpipe_init_preview(dev->preview_pipe);

    dev->histogram = (float *)malloc(sizeof(float)*4*256);
    dev->histogram_pre_tonecurve = (float *)malloc(sizeof(float)*4*256);
    dev->histogram_pre_levels = (float*)malloc(sizeof(float) * 4 * 256);
    memset(dev->histogram, 0, sizeof(float)*256*4);
    memset(dev->histogram_pre_tonecurve, 0, sizeof(float)*256*4);
    memset(dev->histogram_pre_levels, 0, sizeof(float)*256*4);
    dev->histogram_max = -1;
    dev->histogram_pre_tonecurve_max = -1;
    dev->histogram_pre_levels_max = -1;
  }

  dev->iop_instance = 0;
  dev->iop = NULL;

  dev->overexposed.enabled = FALSE;
  dev->overexposed.colorscheme = dt_conf_get_int("darkroom/ui/overexposed/colorscheme");
  dev->overexposed.lower = dt_conf_get_int("darkroom/ui/overexposed/lower");
  dev->overexposed.upper = dt_conf_get_int("darkroom/ui/overexposed/upper");

}
开发者ID:julianjm,项目名称:darktable,代码行数:60,代码来源:develop.c


示例11: enter

void enter(dt_view_t *self)
{
  dt_capture_t *lib = (dt_capture_t *)self->data;

  /* connect signal for mipmap update for a redraw */
  dt_control_signal_connect(darktable.signals, DT_SIGNAL_DEVELOP_MIPMAP_UPDATED,
                            G_CALLBACK(_capture_mipmaps_updated_signal_callback), (gpointer)self);


  /* connect signal for fimlstrip image activate */
  dt_control_signal_connect(darktable.signals, DT_SIGNAL_VIEWMANAGER_FILMSTRIP_ACTIVATE,
                            G_CALLBACK(_view_capture_filmstrip_activate_callback), self);

  dt_view_filmstrip_scroll_to_image(darktable.view_manager, lib->image_id, TRUE);


  /* initialize a session */
  lib->session = dt_import_session_new();

  char *tmp = dt_conf_get_string("plugins/capture/jobcode");
  if(tmp != NULL)
  {
    _capture_view_set_jobcode(self, tmp);
    g_free(tmp);
  }

  // register listener
  lib->listener = g_malloc0(sizeof(dt_camctl_listener_t));
  lib->listener->data = lib;
  lib->listener->image_downloaded = _camera_capture_image_downloaded;
  lib->listener->request_image_path = _camera_request_image_path;
  lib->listener->request_image_filename = _camera_request_image_filename;
  dt_camctl_register_listener(darktable.camctl, lib->listener);
}
开发者ID:AdamMajer,项目名称:darktable,代码行数:34,代码来源:tethering.c


示例12: _camera_image_downloaded

/** Listener interface for import job */
void _camera_image_downloaded(const dt_camera_t *camera,const char *filename,void *data)
{
  // Import downloaded image to import filmroll
  dt_camera_import_t *t = (dt_camera_import_t *)data;
  dt_film_image_import(t->film,filename, FALSE);
  dt_control_log(_("%d/%d imported to %s"), t->import_count+1,g_list_length(t->images), g_path_get_basename(filename));

  t->fraction+=1.0/g_list_length(t->images);

  dt_control_backgroundjobs_progress(darktable.control, t->bgj, t->fraction );

  if( dt_conf_get_bool("plugins/capture/camera/import/backup/enable") == TRUE )
  {
    // Backup is enable, let's initialize a backup job of imported image...
    char *base=dt_conf_get_string("plugins/capture/storage/basedirectory");
    char *fixed_base=dt_util_fix_path(base);
    dt_variables_expand( t->vp, fixed_base, FALSE );
    g_free(base);
    const char *sdpart=dt_variables_get_result(t->vp);
    if( sdpart )
    {
      // Initialize a image backup job of file
      dt_job_t j;
      dt_camera_import_backup_job_init(&j, filename,filename+strlen(sdpart));
      dt_control_add_job(darktable.control, &j);
    }
  }
  t->import_count++;
}
开发者ID:AntonSh,项目名称:darktable,代码行数:30,代码来源:camera_jobs.c


示例13: dt_collection_serialize

int
dt_collection_serialize(char *buf, int bufsize)
{
  char confname[200];
  int c;
  const int num_rules = dt_conf_get_int("plugins/lighttable/collect/num_rules");
  c = snprintf(buf, bufsize, "%d:", num_rules);
  buf += c;
  bufsize -= c;
  for(int k=0; k<num_rules; k++)
  {
    snprintf(confname, sizeof(confname), "plugins/lighttable/collect/mode%1d", k);
    const int mode = dt_conf_get_int(confname);
    c = snprintf(buf, bufsize, "%d:", mode);
    buf += c;
    bufsize -= c;
    snprintf(confname, sizeof(confname), "plugins/lighttable/collect/item%1d", k);
    const int item = dt_conf_get_int(confname);
    c = snprintf(buf, bufsize, "%d:", item);
    buf += c;
    bufsize -= c;
    snprintf(confname, sizeof(confname), "plugins/lighttable/collect/string%1d", k);
    gchar *str = dt_conf_get_string(confname);
    if(str && (str[0] != '\0'))
      c = snprintf(buf, bufsize, "%s$", str);
    else
      c = snprintf(buf, bufsize, "%%$");
    buf += c;
    bufsize -= c;
    g_free(str);
  }
  return 0;
}
开发者ID:joergbeyer,项目名称:darktable,代码行数:33,代码来源:collection.c


示例14: read_pref

static int read_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:
      lua_pushstring(L,dt_conf_get_string(pref_name));
      break;
    case pref_bool:
      lua_pushboolean(L,dt_conf_get_bool(pref_name));
      break;
    case pref_int:
      lua_pushnumber(L,dt_conf_get_int(pref_name));
      break;
  }
  return 1;
}
开发者ID:EvilBit,项目名称:darktable,代码行数:29,代码来源:preferences.c


示例15: gui_init

void
gui_init (dt_imageio_module_storage_t *self)
{
  disk_t *d = (disk_t *)malloc(sizeof(disk_t));
  self->gui_data = (void *)d;
  self->widget = gtk_hbox_new(FALSE, 5);
  GtkWidget *widget;

  widget = gtk_entry_new();
  gtk_box_pack_start(GTK_BOX(self->widget), widget, TRUE, TRUE, 0);
  gchar *dir = dt_conf_get_string("plugins/imageio/storage/disk/file_directory");
  if(dir)
  {
    gtk_entry_set_text(GTK_ENTRY(widget), dir);
    g_free(dir);
  }

  dt_gtkentry_setup_completion(GTK_ENTRY(widget), dt_gtkentry_get_default_path_compl_list());

  char *tooltip_text = dt_gtkentry_build_completion_tooltip_text (
                         _("enter the path where to put exported images\nrecognized variables:"),
                         dt_gtkentry_get_default_path_compl_list());

  d->entry = GTK_ENTRY(widget);
  dt_gui_key_accel_block_on_focus (GTK_WIDGET (d->entry));
  g_object_set(G_OBJECT(widget), "tooltip-text", tooltip_text, (char *)NULL);
  widget = dtgtk_button_new(dtgtk_cairo_paint_directory, 0);
  gtk_widget_set_size_request(widget, 18, 18);
  g_object_set(G_OBJECT(widget), "tooltip-text", _("select directory"), (char *)NULL);
  gtk_box_pack_start(GTK_BOX(self->widget), widget, FALSE, FALSE, 0);
  g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(button_clicked), self);

  g_free(tooltip_text);
}
开发者ID:itarozzi,项目名称:darktable,代码行数:34,代码来源:disk.c


示例16: _database_migrate_to_xdg_structure

static void _database_migrate_to_xdg_structure()
{
  gchar dbfilename[DT_MAX_PATH_LEN]= {0};
  gchar *conf_db = dt_conf_get_string("database");

  gchar datadir[DT_MAX_PATH_LEN] = {0};
  dt_loc_get_datadir(datadir, DT_MAX_PATH_LEN);

  if (conf_db && conf_db[0] != '/')
  {
    char *homedir = getenv ("HOME");
    snprintf (dbfilename,DT_MAX_PATH_LEN,"%s/%s", homedir, conf_db);
    if (g_file_test (dbfilename, G_FILE_TEST_EXISTS))
    {
      fprintf(stderr, "[init] moving database into new XDG directory structure\n");
      char destdbname[DT_MAX_PATH_LEN]= {0};
      snprintf(destdbname,DT_MAX_PATH_LEN,"%s/%s",datadir,"library.db");
      if(!g_file_test (destdbname,G_FILE_TEST_EXISTS))
      {
        rename(dbfilename,destdbname);
        dt_conf_set_string("database","library.db");
      }
    }
  }

  g_free(conf_db);
}
开发者ID:rharrison10,项目名称:darktable,代码行数:27,代码来源:database.c


示例17: button_pressed

static void
button_pressed (GtkButton *button, gpointer user_data)
{
  dt_lib_module_t *self = (dt_lib_module_t *)user_data;
  dt_lib_recentcollect_t *d = (dt_lib_recentcollect_t *) self->data;

  // deserialize this button's preset
  int n = -1;
  for(int k=0; k<NUM_LINES; k++)
  {
    if(button == GTK_BUTTON(d->item[k].button))
    {
      n = k;
      break;
    }
  }
  if(n < 0) return;
  char confname[200];
  snprintf(confname, 200, "plugins/lighttable/recentcollect/line%1d", n);
  gchar *line = dt_conf_get_string(confname);
  if(line)
  {
    dt_collection_deserialize(line);
    g_free(line);
    // position will be updated when the list of recent collections is.
    // that way it'll also catch cases when this is triggered by a signal,
    // not only our button press here.
  }
}
开发者ID:EvilBit,项目名称:darktable,代码行数:29,代码来源:recentcollect.c


示例18: dt_colorspaces_create_output_profile

cmsHPROFILE
dt_colorspaces_create_output_profile(const int imgid)
{
  char profile[1024];
  profile[0] = '\0';
  // db lookup colorout params, and dt_conf_() for override
  gchar *overprofile = dt_conf_get_string("plugins/lighttable/export/iccprofile");
  if(!overprofile || !strcmp(overprofile, "image"))
  {
    const dt_iop_colorout_params_t *params;
    // sqlite:
    sqlite3_stmt *stmt;
    DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select op_params from history where imgid=?1 and operation='colorout'", -1, &stmt, NULL);
    DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
    if(sqlite3_step(stmt) == SQLITE_ROW)
    {
      params = sqlite3_column_blob(stmt, 0);
      g_strlcpy(profile, params->iccprofile, 1024);
    }
    sqlite3_finalize(stmt);
  }
  if(!overprofile && profile[0] == '\0')
  {
    g_strlcpy(profile, "sRGB", 1024);
  }
  else if(profile[0] == '\0')
  {
    g_strlcpy(profile, overprofile, 1024);
  }

  if(overprofile)
  {
    g_free(overprofile);
  }

  cmsHPROFILE output = NULL;

  if(!strcmp(profile, "sRGB"))
    output = dt_colorspaces_create_srgb_profile();
  else if(!strcmp(profile, "linear_rgb"))
    output = dt_colorspaces_create_linear_rgb_profile();
  else if(!strcmp(profile, "XYZ"))
    output = dt_colorspaces_create_xyz_profile();
  else if(!strcmp(profile, "adobergb"))
    output = dt_colorspaces_create_adobergb_profile();
  else if(!strcmp(profile, "X profile") && darktable.control->xprofile_data)
    output = cmsOpenProfileFromMem(darktable.control->xprofile_data, darktable.control->xprofile_size);
  else
  {
    // else: load file name
    char filename[1024];
    dt_colorspaces_find_profile(filename, 1024, profile, "out");
    output = cmsOpenProfileFromFile(filename, "r");
  }
  if(!output) output = dt_colorspaces_create_srgb_profile();
  return output;
}
开发者ID:bgK,项目名称:darktable,代码行数:57,代码来源:colorspaces.c


示例19: set_storage_by_name

static void
set_storage_by_name (dt_lib_export_t *d, const char *name)
{
  int k=-1;
  GList *it = g_list_first(darktable.imageio->plugins_storage);
  dt_imageio_module_storage_t *module = NULL;
  if( it != NULL )
    do
    {
      k++;
      if( strcmp(  ((dt_imageio_module_storage_t *)it->data)->name(((dt_imageio_module_storage_t *)it->data)),name) == 0 ||
          strcmp(  ((dt_imageio_module_storage_t *)it->data)->plugin_name,name) == 0)
      {
        module = (dt_imageio_module_storage_t*)it->data;
        break;
      }
    }
    while( ( it = g_list_next(it) ) );

  if(!module) return;

  if(!darktable.gui->reset) gtk_combo_box_set_active(d->storage, k);
  dt_conf_set_string("plugins/lighttable/export/storage_name", module->plugin_name);
  GtkWidget *old = gtk_bin_get_child(GTK_BIN(d->storage_box));
  if(old != module->widget)
  {
    if(old) gtk_container_remove(d->storage_box, old);
    if(module->widget) gtk_container_add(d->storage_box, module->widget);
  }

  // Check if plugin recommends a max dimension and set
  // if not implemented the stored conf values are used..
  uint32_t w=0,h=0;
  w = dt_conf_get_int("plugins/lighttable/export/width");
  h = dt_conf_get_int("plugins/lighttable/export/height");
  module->recommended_dimension( module, &w, &h );
  // Set the recommended dimension, prevent signal changed...
  g_signal_handlers_block_by_func( d->width, width_changed, NULL );
  g_signal_handlers_block_by_func( d->height, height_changed, NULL );
  gtk_spin_button_set_value( d->width, w );
  gtk_spin_button_set_value( d->height, h );
  g_signal_handlers_unblock_by_func( d->width, width_changed, NULL );
  g_signal_handlers_unblock_by_func( d->height, height_changed, NULL );

  // Let's update formats combobox with supported formats of selected storage module...
  _update_formats_combobox( d );

  // Lets try to set selected format if fail select first in list..
  gchar *format_name = dt_conf_get_string("plugins/lighttable/export/format_name");
  dt_imageio_module_format_t *format = dt_imageio_get_format_by_name(format_name);
  g_free(format_name);
  if( format==NULL || _combo_box_set_active_text( d->format, format->name() ) == FALSE )
    gtk_combo_box_set_active( d->format, 0);

  gtk_widget_show_all(GTK_WIDGET(d->storage_box));
}
开发者ID:bartokk,项目名称:darktable,代码行数:56,代码来源:export.c


示例20: _lib_collect_gui_update

static void
_lib_collect_gui_update (dt_lib_module_t *self)
{
    dt_lib_collect_t *d = (dt_lib_collect_t *)self->data;

    const int old = darktable.gui->reset;
    darktable.gui->reset = 1;
    const int active = CLAMP(dt_conf_get_int("plugins/lighttable/collect/num_rules") - 1, 0, (MAX_RULES-1));
    char confname[200];
    for(int i=0; i<MAX_RULES; i++)
    {
        gtk_widget_set_no_show_all(d->rule[i].hbox, TRUE);
        gtk_widget_set_visible(d->rule[i].hbox, FALSE);
    }
    for(int i=0; i<=active; i++)
    {
        gtk_widget_set_no_show_all(d->rule[i].hbox, FALSE);
        gtk_widget_set_visible(d->rule[i].hbox, TRUE);
        gtk_widget_show_all(d->rule[i].hbox);
        snprintf(confname, 200, "plugins/lighttable/collect/item%1d", i);
        gtk_combo_box_set_active(GTK_COMBO_BOX(d->rule[i].combo), dt_conf_get_int(confname));
        snprintf(confname, 200, "plugins/lighttable/collect/string%1d", i);
        gchar *text = dt_conf_get_string(confname);
        if(text)
        {
            gtk_entry_set_text(GTK_ENTRY(d->rule[i].text), text);
            g_free(text);
        }

        GtkDarktableButton *button = DTGTK_BUTTON(d->rule[i].button);
        if(i == MAX_RULES - 1)
        {
            // only clear
            button->icon = dtgtk_cairo_paint_cancel;
            g_object_set(G_OBJECT(button), "tooltip-text", _("clear this rule"), (char *)NULL);
        }
        else if(i == active)
        {
            button->icon = dtgtk_cairo_paint_dropdown;
            g_object_set(G_OBJECT(button), "tooltip-text", _("clear this rule or add new rules"), (char *)NULL);
        }
        else
        {
            snprintf(confname, 200, "plugins/lighttable/collect/mode%1d", i+1);
            const int mode = dt_conf_get_int(confname);
            if(mode == DT_LIB_COLLECT_MODE_AND)     button->icon = dtgtk_cairo_paint_and;
            if(mode == DT_LIB_COLLECT_MODE_OR)      button->icon = dtgtk_cairo_paint_or;
            if(mode == DT_LIB_COLLECT_MODE_AND_NOT) button->icon = dtgtk_cairo_paint_andnot;
            g_object_set(G_OBJECT(button), "tooltip-text", _("clear this rule"), (char *)NULL);
        }
    }
    // update list of proposals
    changed_callback(NULL, d->rule + d->active_rule);
    darktable.gui->reset = old;
}
开发者ID:nagyistoce,项目名称:radhermit-darktable,代码行数:55,代码来源:collect.c



注:本文中的dt_conf_get_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dt_conf_set_int函数代码示例发布时间:2022-05-30
下一篇:
C++ dt_conf_get_int函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap