当前位置: 首页>>代码示例>>C++>>正文


C++ dt_control_add_job函数代码示例

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


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

示例1: dt_control_delete_images

void dt_control_delete_images()
{
  if(dt_conf_get_bool("ask_before_delete"))
  {
    GtkWidget *dialog;
    GtkWidget *win = dt_ui_main_window(darktable.gui->ui);

    int number = dt_collection_get_selected_count(darktable.collection);

    // Do not show the dialog if no image is selected:
    if(number == 0) return;

    dialog = gtk_message_dialog_new(GTK_WINDOW(win),
                                    GTK_DIALOG_DESTROY_WITH_PARENT,
                                    GTK_MESSAGE_QUESTION,
                                    GTK_BUTTONS_YES_NO,
                                    ngettext("do you really want to physically delete %d selected image from disk?",
                                        "do you really want to physically delete %d selected images from disk?", number), number);

    gtk_window_set_title(GTK_WINDOW(dialog), _("delete images?"));
    gint res = gtk_dialog_run(GTK_DIALOG(dialog));
    gtk_widget_destroy(dialog);
    if(res != GTK_RESPONSE_YES) return;
  }
  dt_job_t j;
  dt_control_delete_images_job_init(&j);
  dt_control_add_job(darktable.control, &j);
}
开发者ID:minusdreidb,项目名称:darktable,代码行数:28,代码来源:control_jobs.c

示例2: lua_job_cancelled

static void lua_job_cancelled(dt_progress_t *progress, gpointer user_data)
{
    dt_job_t *job = dt_control_job_create(&lua_job_canceled_job, "lua: on background cancel");
    if(!job) return;
    dt_control_job_set_params(job, progress);
    dt_control_add_job(darktable.control, DT_JOB_QUEUE_SYSTEM_BG, job);
}
开发者ID:markcottrell,项目名称:darktable,代码行数:7,代码来源:gui.c

示例3: _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

示例4: dt_control_delete_images

void dt_control_delete_images()
{
  if(dt_conf_get_bool("ask_before_delete"))
  {
    GtkWidget *dialog;
    GtkWidget *win = dt_ui_main_window(darktable.gui->ui);

    sqlite3_stmt *stmt = NULL;
    int number = 0;
    
    DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select count(imgid) from selected_images", -1, &stmt, NULL);
    if(sqlite3_step(stmt) == SQLITE_ROW)
    {
      number = sqlite3_column_int(stmt, 0);
    }

    dialog = gtk_message_dialog_new(GTK_WINDOW(win),
                                    GTK_DIALOG_DESTROY_WITH_PARENT,
                                    GTK_MESSAGE_QUESTION,
                                    GTK_BUTTONS_YES_NO,
                                    ngettext("do you really want to physically delete %d selected image from disk?",
                                             "do you really want to physically delete %d selected images from disk?", number), number);
    gtk_window_set_title(GTK_WINDOW(dialog), _("delete images?"));
    gint res = gtk_dialog_run(GTK_DIALOG(dialog));
    gtk_widget_destroy(dialog);
    if(res != GTK_RESPONSE_YES) return;
  }
  dt_job_t j;
  dt_control_delete_images_job_init(&j);
  dt_control_add_job(darktable.control, &j);
}
开发者ID:nagyistoce,项目名称:radhermit-darktable,代码行数:31,代码来源:control_jobs.c

示例5: dt_control_reset_local_copy_images

void dt_control_reset_local_copy_images()
{
  dt_job_t j;
  dt_control_local_copy_images_job_init(&j);
  j.user_data=(void *)0;
  dt_control_add_job(darktable.control, &j);
  return;
}
开发者ID:jmarca,项目名称:darktable,代码行数:8,代码来源:control_jobs.c

示例6: _camera_capture_image_downloaded

static void _camera_capture_image_downloaded(const dt_camera_t *camera, const char *filename, void *data)
{
  dt_capture_t *lib = (dt_capture_t *)data;

  /* create an import job of downloaded image */
  dt_control_add_job(darktable.control, DT_JOB_QUEUE_USER_BG,
                     dt_image_import_job_create(dt_import_session_film_id(lib->session), filename));
}
开发者ID:AdamMajer,项目名称:darktable,代码行数:8,代码来源:tethering.c

示例7: dt_lua_init

void dt_lua_init(lua_State*L,const char *lua_command)
{
  /*
     Note to reviewers
     this is the only place where lua code is run without the lua lock.
     At this point, no user script has been called,
     so we are completely thread-safe. no need to lock

     This is also the only place where lua code is run with the gdk lock
     held, but this is not a problem because it is very brief, user calls
     are delegated to a secondary job
     */
  char tmp_path[PATH_MAX];
  // init the lua environment
  lua_CFunction* cur_type = init_funcs;
  while(*cur_type)
  {
    (*cur_type)(L);
    cur_type++;
  }
  // build the table containing the configuration info

  lua_getglobal(L,"package");
  dt_lua_goto_subtable(L,"loaded");
  lua_pushstring(L,"darktable");
  dt_lua_push_darktable_lib(L);
  lua_settable(L,-3);
  lua_pop(L,1);

  lua_getglobal(L,"package");
  lua_getfield(L,-1,"path");
  lua_pushstring(L,";");
  dt_loc_get_datadir(tmp_path, sizeof(tmp_path));
  lua_pushstring(L,tmp_path);
  lua_pushstring(L,"/lua/?.lua");
  lua_pushstring(L,";");
  dt_loc_get_user_config_dir(tmp_path, sizeof(tmp_path));
  lua_pushstring(L,tmp_path);
  lua_pushstring(L,"/lua/?.lua");
  lua_concat(L,7);
  lua_setfield(L,-2,"path");
  lua_pop(L,1);



  dt_job_t *job = dt_control_job_create(&run_early_script, "lua: run initial script");
  dt_control_job_set_params(job, g_strdup(lua_command));
  if(darktable.gui)
  {
    dt_control_add_job(darktable.control, DT_JOB_QUEUE_USER_BG, job);
  }
  else
  {
    run_early_script(job);
    dt_control_job_dispose(job);
  }

}
开发者ID:grinoscar,项目名称:darktable,代码行数:58,代码来源:init.c

示例8: dt_control_add_background_job

/* Background jobs will be timestamped and added to queue
    the queue will then check ts and detect if its background job
    and place it on the job_res if its available...
*/
int32_t dt_control_add_background_job(dt_control_t *s, dt_job_t *job, time_t delay)
{
  /* setup timestamps */
  job->ts_added = time(NULL);
  job->ts_execute = job->ts_added+delay;

  /* pass the job further to scheduled jobs worker */
  return dt_control_add_job(s,job);
}
开发者ID:kriomant,项目名称:darktable,代码行数:13,代码来源:control.c

示例9: free_params_wrapper

static void  free_params_wrapper  (struct dt_imageio_module_storage_t *self, dt_imageio_module_data_t *data)
{
  dt_job_t job;
  dt_control_job_init(&job, "lua: destroy storage param");
  job.execute = &free_param_wrapper_job;
  free_param_wrapper_data *t = (free_param_wrapper_data*)job.param;
  t->data = (lua_storage_t*)data;
  dt_control_add_job(darktable.control, &job);
}
开发者ID:danielbaak,项目名称:darktable,代码行数:9,代码来源:storage.c

示例10: dt_control_move_images

void dt_control_move_images()
{
  // Open file chooser dialog
  gchar *dir = NULL;
  GtkWidget *win = dt_ui_main_window(darktable.gui->ui);
  int number = dt_collection_get_selected_count(darktable.collection);

  // Do not show the dialog if no image is selected:
  if(number == 0) return;

  GtkWidget *filechooser = gtk_file_chooser_dialog_new (_("select directory"),
                           GTK_WINDOW (win),
                           GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
                           GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                           GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
                           (char *)NULL);

  gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(filechooser), FALSE);
  if (gtk_dialog_run (GTK_DIALOG (filechooser)) == GTK_RESPONSE_ACCEPT)
  {
    dir = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser));
  }
  gtk_widget_destroy (filechooser);

  if(!dir || !g_file_test(dir, G_FILE_TEST_IS_DIR))
    goto abort;

  if(dt_conf_get_bool("ask_before_move"))
  {
    GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(win),
                        GTK_DIALOG_DESTROY_WITH_PARENT,
                        GTK_MESSAGE_QUESTION,
                        GTK_BUTTONS_YES_NO,
                        ngettext("do you really want to physically move the %d selected image to %s?\n"
                                 "(all unselected duplicates will be moved along)",
                                 "do you really want to physically move %d selected images to %s?\n"
                                 "(all unselected duplicates will be moved along)", number), number, dir);
    gtk_window_set_title(GTK_WINDOW(dialog), ngettext("move image?", "move images?", number));

    gint res = gtk_dialog_run(GTK_DIALOG(dialog));
    gtk_widget_destroy(dialog);

    if(res != GTK_RESPONSE_YES)
      goto abort;
  }

  dt_job_t j;
  dt_control_move_images_job_init(&j);
  j.user_data = dir;
  dt_control_add_job(darktable.control, &j);
  return;

abort:
  g_free(dir);
  return;
}
开发者ID:minusdreidb,项目名称:darktable,代码行数:56,代码来源:control_jobs.c

示例11: dt_control_match_similar

void dt_control_match_similar(dt_similarity_t *data)
{
  dt_job_t j;
  GList *selected = dt_collection_get_selected(darktable.collection);
  if(selected)
  {
    dt_control_match_similar_job_init(&j, (long int)selected->data, data);
    dt_control_add_job(darktable.control, &j);
  }
  else
    dt_control_log(_("select an image as target for search of similar images"));
}
开发者ID:ksyz,项目名称:darktable,代码行数:12,代码来源:control_jobs.c

示例12: free_params_wrapper

static void free_params_wrapper(struct dt_imageio_module_storage_t *self, dt_imageio_module_data_t *data)
{
  dt_job_t *job = dt_control_job_create(&free_param_wrapper_job, "lua: destroy storage param");
  if(!job) return;
  free_param_wrapper_data *t = (free_param_wrapper_data *)calloc(1, sizeof(free_param_wrapper_data));
  if(!t)
  {
    dt_control_job_dispose(job);
    return;
  }
  dt_control_job_set_params(job, t, free_param_wrapper_destroy);
  t->data = (lua_storage_t *)data;
  dt_control_add_job(darktable.control, DT_JOB_QUEUE_SYSTEM_BG, job);
}
开发者ID:kael-shipman,项目名称:darktable,代码行数:14,代码来源:luastorage.c

示例13: shortcut_callback

static gboolean shortcut_callback(GtkAccelGroup *accel_group,
    GObject *acceleratable,
    guint keyval,
    GdkModifierType modifier,
    gpointer p)
{
  dt_job_t job;
  dt_control_job_init(&job, "lua: on export image tmpfile");
  job.execute = &shortcut_callback_job;
  shortcut_callback_data *t = (shortcut_callback_data*)job.param;
  t->name = strdup(p);
  dt_control_add_job(darktable.control, &job);
  return TRUE;
}
开发者ID:danielbaak,项目名称:darktable,代码行数:14,代码来源:events.c

示例14: _camera_capture_image_downloaded

void _camera_capture_image_downloaded(const dt_camera_t *camera,const char *filename,void *data)
{
  dt_camera_capture_t *t;

  t = (dt_camera_capture_t*)data;

  /* create an import job of downloaded image */
  dt_control_add_job(darktable.control, DT_JOB_QUEUE_USER_BG, dt_image_import_job_create(dt_import_session_film_id(t->shared.session), filename));
  if (--t->total == 0)
  {
    pthread_mutex_lock(&t->mutex);
    pthread_cond_broadcast(&t->done);
    pthread_mutex_unlock(&t->mutex);
  }
}
开发者ID:PolarFox,项目名称:darktable,代码行数:15,代码来源:camera_jobs.c

示例15: dt_printers_discovery

void dt_printers_discovery(void (*cb)(dt_printer_info_t *pr, void *user_data), void *user_data)
{
  // asynchronously checks for available printers
  dt_job_t *job = dt_control_job_create(&_detect_printers_callback, "detect connected printers");
  if(job)
  {
    dt_prtctl_t *prtctl = g_malloc0(sizeof(dt_prtctl_t));

    prtctl->cb = cb;
    prtctl->user_data = user_data;

    dt_control_job_set_params(job, prtctl, g_free);
    dt_control_add_job(darktable.control, DT_JOB_QUEUE_SYSTEM_BG, job);
  }
}
开发者ID:CChiappa,项目名称:darktable,代码行数:15,代码来源:cups_print.c


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