Exemplo n.º 1
0
void
audio_test_init(prop_t *asettings)
{
  settings_create_separator(asettings, _p("Audio test"));

  setting_create(SETTING_BOOL, asettings, SETTINGS_INITIAL_UPDATE,
		 SETTING_TITLE(_p("Play test signal")),
                 SETTING_CALLBACK(enable_set_signal, NULL),
		 NULL);

  setting_create(SETTING_MULTIOPT, asettings, SETTINGS_INITIAL_UPDATE,
		 SETTING_TITLE(_p("Test signal type")),
		 SETTING_WRITE_INT(&signal_type),
		 SETTING_OPTION("0", _p("Speaker position")),
		 SETTING_OPTION("1", _p("Pink noise")),
		 SETTING_OPTION("2", _p("440Hz sinewave -12dB")),
		 NULL);

  add_ch_bool(_p("Front Left"),  0, 1, asettings);
  add_ch_bool(_p("Center"),      2, 0, asettings);
  add_ch_bool(_p("Front Right"), 1, 1, asettings);
  add_ch_bool(_p("LFE"),         3, 0, asettings);
  add_ch_bool(_p("Surround Left"),   4, 0, asettings);
  add_ch_bool(_p("Surround Right"),  5, 0, asettings);
  add_ch_bool(_p("Rear Left"),   6, 0, asettings);
  add_ch_bool(_p("Rear Right"),  7, 0, asettings);

}
Exemplo n.º 2
0
void create_settings()
{
	setting_create("master-volume");
	setting_create("master-waveform");

	synth_model.setting_master_volume = setting_find("master-volume");
	synth_model.setting_master_waveform = setting_find("master-waveform");
	setting_init_as_int(synth_model.setting_master_volume, 0);
	setting_init_as_enum(synth_model.setting_master_waveform, (int)WAVETABLE_SINE, &master_waveform_type);
}
Exemplo n.º 3
0
void
runcontrol_init(void)
{
  prop_t *rc;

  rc = prop_create(prop_get_global(), "runcontrol");

  prop_set(rc, "canStandby",   PROP_SET_INT,  !!gconf.can_standby);
  prop_set(rc, "canPowerOff",  PROP_SET_INT,  !!gconf.can_poweroff);
  prop_set(rc, "canLogout",    PROP_SET_INT,  !!gconf.can_logout);
  prop_set(rc, "canOpenShell", PROP_SET_INT,  !!gconf.can_open_shell);
  prop_set(rc, "canRestart",   PROP_SET_INT,  !!gconf.can_restart);
  prop_set(rc, "canExit",      PROP_SET_INT,   !gconf.can_not_exit);

  if(!(gconf.can_standby ||
       gconf.can_poweroff ||
       gconf.can_logout ||
       gconf.can_open_shell ||
       gconf.can_restart ||
       !gconf.can_not_exit))
    return;

  settings_create_separator(gconf.settings_general,
			  _p("Starting and stopping"));

  if(gconf.can_standby) {
    init_autostandby();
    init_sleeptimer(rc);
    settings_create_action(gconf.settings_general, _p("Standby"),
			   do_standby, NULL, 0, NULL);
  }

  if(gconf.can_poweroff)
    settings_create_action(gconf.settings_general, _p("Power off system"),
			   do_power_off, NULL, 0, NULL);

  if(gconf.can_logout)
    settings_create_action(gconf.settings_general, _p("Logout"),
			   do_logout, NULL, 0, NULL);

  if(gconf.can_open_shell)
    settings_create_action(gconf.settings_general, _p("Open shell"),
			   do_open_shell, NULL, 0, NULL);

  if(!gconf.can_not_exit)
    settings_create_action(gconf.settings_general, _p("Quit"),
			   do_exit, NULL, 0, NULL);

  if(gconf.shell_fd > 0) {

    settings_create_separator(gconf.settings_network, _p("SSH server"));

    setting_create(SETTING_BOOL, gconf.settings_network,SETTINGS_INITIAL_UPDATE,
		   SETTING_TITLE(_p("Enable SSH server")),
		   SETTING_VALUE(0),
		   SETTING_CALLBACK(set_ssh_server, NULL),
		   SETTING_STORE("runcontrol", "sshserver"),
		   NULL);
  }
}
Exemplo n.º 4
0
static void *
connman_thread(void *aux)
{
  GError *err;
  GDBusProxy *mgr;
  GMainContext *ctx = g_main_context_new();
  GMainLoop *mainloop = g_main_loop_new(ctx, FALSE);
  connman_courier = glib_courier_create(ctx);

  g_main_context_push_thread_default(ctx);

 again:

  err = NULL;

  mgr = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
				      G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START ,
				      NULL,
				      "net.connman",
				      "/",
				      "net.connman.Manager",
				      NULL,
				      &err);
  if(mgr == NULL) {
    TRACE(TRACE_ERROR, "CONNMAN", "Unable to connect to connman -- %s",
	  err->message);
    g_error_free(err);
    sleep(5);
    goto again;
  }

  g_signal_connect(G_OBJECT(mgr), "g-signal",
		   G_CALLBACK(connman_mgr_signal), NULL);


  g_bus_own_name(G_BUS_TYPE_SYSTEM,
		 "com.showtimemediacenter.showtime.network.agent",
		 G_BUS_NAME_OWNER_FLAGS_NONE,
		 on_bus_acquired,
		 on_name_acquired,
		 on_name_lost,
		 mgr,
		 NULL);

  connman_getpropreties(mgr);
  connman_getservices(mgr);
  connman_gettechnologies(mgr);

  if(have_wifi) {
    setting_create(SETTING_BOOL, connman_settings, SETTINGS_INITIAL_UPDATE,
		   SETTING_TITLE(_p("Enable Wi-Fi")),
		   SETTING_CALLBACK(set_wifi_enable, NULL),
		   SETTING_STORE("connman", "enable_wifi"),
		   NULL);
  }

  g_main_loop_run(mainloop);
  return NULL;
}
Exemplo n.º 5
0
void
audio_init(void)
{
  htsmsg_t *store = htsmsg_store_load("audio2");
  if(store == NULL)
    store = htsmsg_create_map();

  prop_t *asettings =
    settings_add_dir(NULL, _p("Audio settings"), NULL, NULL,
                     _p("Setup audio output"),
                     "settings:audio");

  audio_mastervol_init();
  audio_class = audio_driver_init(asettings, store);

  settings_create_separator(asettings,
			    _p("Audio settings during video playback"));

  gconf.setting_av_volume =
    setting_create(SETTING_INT, asettings,
                   SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Audio gain adjustment during video playback")),
                   SETTING_RANGE(-12, 12),
                   SETTING_UNIT_CSTR("dB"),
                   SETTING_HTSMSG("videovolume", store, "audio2"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  gconf.setting_av_sync =
    setting_create(SETTING_INT, asettings,
                   SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Audio delay")),
                   SETTING_RANGE(-5000, 5000),
                   SETTING_STEP(50),
                   SETTING_UNIT_CSTR("ms"),
                   SETTING_HTSMSG("avdelta", store, "audio2"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);


#if CONFIG_AUDIOTEST
  audio_test_init(asettings);
#endif
}
Exemplo n.º 6
0
static void
add_ch_bool(prop_t *title, int id, int def, prop_t *asettings)
{
  setting_create(SETTING_BOOL, asettings, SETTINGS_INITIAL_UPDATE,
		 SETTING_TITLE(title),
		 SETTING_WRITE_BOOL(&test_channels[id]),
		 SETTING_VALUE(def),
		 NULL);

}
Exemplo n.º 7
0
static int
locatedb_init(void)
{
  prop_t *s = search_get_settings();

  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Search using Unix locatedb")),
                 SETTING_VALUE(1),
                 SETTING_WRITE_BOOL(&locatedb_enabled),
                 SETTING_STORE("locatedb", "enable"),
                 NULL);

  return 0;
}
Exemplo n.º 8
0
static void
rpi_tv_init(void)
{
  prop_t *set = setting_get_dir("settings:tv");
  setting_create(SETTING_BOOL, set,
		 SETTINGS_INITIAL_UPDATE,
		 SETTING_TITLE(_p("Match display and content framerate")),
                 SETTING_VALUE(0),
		 SETTING_CALLBACK(set_framerate, NULL),
		 SETTING_STORE("rpitv", "setframerate"),
		 NULL);


}
Exemplo n.º 9
0
static JSBool 
js_createInt(JSContext *cx, JSObject *obj, uintN argc, 
		jsval *argv, jsval *rval)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *id;
  const char *title;
  int def;
  int min;
  int max;
  int step;
  const char* unit;
  JSObject *func;
  JSBool persistent = JS_FALSE;

  if(!JS_ConvertArguments(cx, argc, argv, "ssiiiiso/b",
			  &id, &title, &def, &min, &max, &step, &unit, &func,
			  &persistent)){
    return JS_FALSE;
  }


  js_setting_t *jss = jss_create(cx, obj, id, rval, func, jsg, persistent);
  if(jss == NULL)
    return JS_FALSE;

  if(persistent && jsg->jsg_kv_url)
    def = kv_url_opt_get_int(jsg->jsg_kv_url, KVSTORE_DOMAIN_PLUGIN, 
			     id, def);
  jss->jss_s =
    setting_create(SETTING_INT, jsg->jsg_root,
                   SETTINGS_INITIAL_UPDATE | jsg->jsg_settings_flags,

                   SETTING_TITLE_CSTR(title),
                   SETTING_VALUE(def),
                   SETTING_RANGE(min, max),
                   SETTING_STEP(step),
                   SETTING_UNIT_CSTR(unit),
                   SETTING_COURIER(js_global_pc),
                   SETTING_CALLBACK(js_store_update_int, jss),
                   SETTING_HTSMSG_CUSTOM_SAVER(id, jsg->jsg_store,
                                               js_setting_group_save, jsg),
                   NULL);
  jss->jss_cx = NULL;

  return JS_TRUE;
}
Exemplo n.º 10
0
int
glw_ps3_start(void)
{
  glw_ps3_t *gp = calloc(1, sizeof(glw_ps3_t));
  glwps3 = gp;
  prop_t *root = gp->gr.gr_prop_ui = prop_create(prop_get_global(), "ui");
  gp->gr.gr_prop_nav = nav_spawn();

  prop_set_int(prop_create(root, "fullscreen"), 1);

  if(glw_ps3_init(gp))
     return 1;

  gp->gr.gr_prop_maxtime = 10000;

  glw_root_t *gr = &gp->gr;

  if(glw_init2(gr,
               GLW_INIT_KEYBOARD_MODE |
               GLW_INIT_OVERSCAN |
               GLW_INIT_IN_FULLSCREEN))
    return 1;

  settings_create_separator(glw_settings.gs_settings, _p("Dual-Shock Remote"));

  setting_create(SETTING_MULTIOPT, glw_settings.gs_settings,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Seek using L2 and R2 button")),
                 SETTING_OPTION("0", _p("Yes")),
                 SETTING_OPTION("1", _p("Yes with Select button")),
                 SETTING_OPTION("2", _p("No")),
                 SETTING_COURIER(gr->gr_courier),
                 SETTING_CALLBACK(set_seekmode, gp),
                 SETTING_STORE("glw", "analogseekmode"),
                 NULL);

  gr->gr_open_osk = osk_open;

  TRACE(TRACE_DEBUG, "GLW", "loading universe");

  glw_load_universe(gr);
  glw_ps3_mainloop(gp);
  glw_unload_universe(gr);
  glw_reap(gr);
  glw_reap(gr);
  return 0;
}
Exemplo n.º 11
0
static setting_t *
make_dir_setting(int type, const char *id, struct setting_list *group,
                 const char *dir_url, setting_t *parent,
                 media_pipe_t *mp)
{
  if(dir_url == NULL)
    return parent;

  return setting_create(type, NULL, SETTINGS_INITIAL_UPDATE,
                        SETTING_MUTEX(mp),
                        SETTING_LOCKMGR(mp_lockmgr),
                        SETTING_KVSTORE(dir_url, id),
                        SETTING_GROUP(group),
                        SETTING_INHERIT(parent),
                        SETTING_VALUE_ORIGIN("directory"),
                        NULL);
}
Exemplo n.º 12
0
static JSBool 
js_createString(JSContext *cx, JSObject *obj, uintN argc, 
		jsval *argv, jsval *rval)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *id;
  const char *title;
  const char *def;
  JSObject *func;
  JSBool persistent = JS_FALSE;

  if(!JS_ConvertArguments(cx, argc, argv, "ssso/b",
			  &id, &title, &def, &func, &persistent))
    return JS_FALSE;

  js_setting_t *jss = jss_create(cx, obj, id, rval, func, jsg, persistent);
  if(jss == NULL)
    return JS_FALSE;

  rstr_t *r = NULL;
  if(persistent && jsg->jsg_kv_url) {
    r = kv_url_opt_get_rstr(jsg->jsg_kv_url, KVSTORE_DOMAIN_PLUGIN, id);
    if(r != NULL)
      def = rstr_get(r);
  }

  jss->jss_s =
    setting_create(SETTING_STRING, jsg->jsg_root,
                   SETTINGS_INITIAL_UPDATE | jsg->jsg_settings_flags,
                   SETTING_TITLE_CSTR(title),
                   SETTING_COURIER(js_global_pc),
                   SETTING_VALUE(def),
                   SETTING_CALLBACK(js_store_update_string, jss),
                   SETTING_HTSMSG_CUSTOM_SAVER(id, jsg->jsg_store,
                                               js_setting_group_save, jsg),
                   NULL);

  jss->jss_cx = NULL;
  rstr_release(r);
  return JS_TRUE;
}
Exemplo n.º 13
0
static void
init_autostandby(void)
{
  setting_create(SETTING_INT, gconf.settings_general, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Automatic standby")),
                 SETTING_STORE("runcontrol", "autostandby"),
                 SETTING_WRITE_INT(&standby_delay),
                 SETTING_RANGE(0, 60),
                 SETTING_STEP(5),
                 SETTING_UNIT_CSTR("min"),
                 SETTING_ZERO_TEXT(_p("Off")),
                 NULL);

  last_activity = arch_get_ts();

  prop_subscribe(0,
		 PROP_TAG_NAME("global", "media", "current", "playstatus"),
		 PROP_TAG_CALLBACK_STRING, current_media_playstatus, NULL,
		 NULL);

  callout_arm(&autostandby_timer, check_autostandby, NULL, 1);
}
Exemplo n.º 14
0
void
notifications_init(void)
{
  hts_mutex_init(&news_mutex);
  prop_t *root = prop_create(prop_get_global(), "notifications");

  if((dismissed_news_in = htsmsg_store_load("dismissed_news")) == NULL)
    dismissed_news_in = htsmsg_create_map();
  dismissed_news_out = htsmsg_create_map();

  notify_prop_entries = prop_create(root, "nodes");

#if ENABLE_WEBPOPUP

  prop_t *dir = setting_get_dir("general:misc");

  setting_create(SETTING_BOOL, dir, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Show news on home screen")),
                 SETTING_VALUE(1),
                 SETTING_WRITE_BOOL(&shownews),
                 SETTING_STORE("notifications", "shownews"),
                 NULL);
#endif
}
Exemplo n.º 15
0
static void *
libcec_init_thread(void *aux)
{
  prop_t *set = setting_get_dir("settings:tv");

  libcec_clear_configuration(&cec_config);
  cec_config.callbacks = &g_callbacks;
  snprintf(cec_config.strDeviceName, sizeof(cec_config.strDeviceName),
           "%s", APPNAMEUSER);


  cec_config.deviceTypes.types[0] = CEC_DEVICE_TYPE_RECORDING_DEVICE;

  conn = libcec_initialise(&cec_config);
  if(conn == NULL) {
    TRACE(TRACE_ERROR, "CEC", "Unable to init libcec");
    return NULL;
  }

  libcec_init_video_standalone(conn);

  cec_adapter ca;
  int num_adapters = libcec_find_adapters(conn, &ca, 1, NULL);
  if(num_adapters < 1) {
    libcec_destroy(conn);
    conn = NULL;
    TRACE(TRACE_ERROR, "CEC", "No adapters found");
    return NULL;
  }
  TRACE(TRACE_DEBUG, "CEC", "Using adapter %s on %s",
        ca.comm, ca.path);


  setting_create(SETTING_BOOL, set,
		 SETTINGS_INITIAL_UPDATE,
		 SETTING_TITLE(_p("Switch TV input source")),
                 SETTING_VALUE(1),
		 SETTING_CALLBACK(set_activate_source, NULL),
		 SETTING_STORE("cec", "controlinput"),
		 NULL);

  setting_create(SETTING_BOOL, set,
		 SETTINGS_INITIAL_UPDATE,
		 SETTING_TITLE(_p("Use STOP key for combo input")),
                 SETTING_VALUE(1),
		 SETTING_CALLBACK(set_stop_combo_mode, NULL),
		 SETTING_STORE("cec", "stopcombo"),
		 NULL);

  setting_create(SETTING_BOOL, set,
		 SETTINGS_INITIAL_UPDATE,
		 SETTING_TITLE(_p("Longpress SELECT for item menu")),
                 SETTING_VALUE(1),
		 SETTING_CALLBACK(set_longpress_select, NULL),
		 SETTING_STORE("cec", "longpress_select"),
		 NULL);


#if 0
  setting_create(SETTING_BOOL, set,
		 SETTINGS_INITIAL_UPDATE,
		 SETTING_TITLE_CSTR("Shutdown UI when TV is off"),
		 SETTING_WRITE_BOOL(&auto_ui_shutdown),
		 SETTING_STORE("cec", "auto_shutdown"),
		 NULL);
#endif

  if(!libcec_open(conn, ca.comm, 5000)) {
    TRACE(TRACE_ERROR, "CEC", "Unable to open connection to %s",
          ca.comm);
    libcec_destroy(conn);
    conn = NULL;
    return NULL;
  }
  return NULL;
}
Exemplo n.º 16
0
void
i18n_init(void)
{
  prop_t *s = settings_add_dir(NULL, _p("Languages"), "i18n", NULL,
			       _p("Preferred languages"),
			       "settings:i18n");
  int i;

  nls_init(s);

#ifdef STOS
  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Timezone")),
                 SETTING_CALLBACK(set_timezone, NULL),
                 SETTING_STORE("i18n", "timezone"),
                 NULL);

#endif

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Time format")),
                 SETTING_STORE("i18n", "timeformat"),
                 SETTING_WRITE_INT(&gconf.time_format),
                 SETTING_OPTION(gconf.time_format_system ? "0" : NULL,
                                _p("System default")),
                 SETTING_OPTION("1", _p("24 Hour")),
                 SETTING_OPTION("2", _p("12 Hour")),
                 NULL);


  settings_create_info(s,
		       NULL,
		       _p("Language codes should be configured as three character ISO codes, example (eng, swe, fra)"));

  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Primary audio language code")),
                 SETTING_CALLBACK(set_lang, &lang_audio[0]),
                 SETTING_STORE("i18n", "audio1"),
                 NULL);

  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Secondary audio language code")),
                 SETTING_CALLBACK(set_lang, &lang_audio[1]),
                 SETTING_STORE("i18n", "audio2"),
                 NULL);

  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Tertiary audio language code")),
                 SETTING_CALLBACK(set_lang, &lang_audio[2]),
                 SETTING_STORE("i18n", "audio3"),
                 NULL);


  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Primary subtitle language code")),
                 SETTING_CALLBACK(&set_lang, &lang_subtitle[0]),
                 SETTING_STORE("i18n", "subtitle1"),
                 NULL);

  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Secondary subtitle language code")),
                 SETTING_CALLBACK(&set_lang, &lang_subtitle[1]),
                 SETTING_STORE("i18n", "subtitle2"),
                 NULL);

  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Tertiary subtitle language code")),
                 SETTING_CALLBACK(&set_lang, &lang_subtitle[2]),
                 SETTING_STORE("i18n", "subtitle3"),
                 NULL);

  const char **optlist = NULL;
  const charset_t *cs;
  for(i = 0; (cs = charset_get_idx(i)) != NULL; i++) {}

  optlist = alloca((i * 2 + 3) * sizeof(const char *));

  optlist[0] = "auto";
  optlist[1] = "Auto";

  for(i = 0; (cs = charset_get_idx(i)) != NULL; i++) {
    optlist[i * 2 + 2] = cs->id;
    optlist[i * 2 + 3] = cs->title;
  }
  optlist[i * 2 + 2] = NULL;

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Default character set")),
                 SETTING_STORE("i18n", "default_charset"),
                 SETTING_CALLBACK(set_default_charset, NULL),
                 SETTING_OPTION_LIST(optlist),
                 NULL);

  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Ignore 'The' at beginning of words when sorting")),
                 SETTING_STORE("i18n", "skipthe"),
                 SETTING_WRITE_BOOL(&gconf.ignore_the_prefix),
                 NULL);
}
Exemplo n.º 17
0
void
video_settings_init(void)
{
  prop_t *s;

  s = settings_add_dir(NULL, _p("Video playback"), "video", NULL,
		       _p("Video acceleration and display behaviour"),
		       "settings:video");

#if ENABLE_VDPAU
  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Enable VDPAU")),
                 SETTING_VALUE(1),
                 SETTING_WRITE_BOOL(&video_settings.vdpau),
                 SETTING_STORE("videoplayback", "vdpau"),
                 NULL);

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Preferred VDPAU deinterlacer method")),
                 SETTING_STORE("videoplayback", "vdpau_deinterlace"),
                 SETTING_WRITE_INT(&video_settings.vdpau_deinterlace),
                 SETTING_OPTION("2", _p("Temporal/Spatial")),
                 SETTING_OPTION("1", _p("Temporal")),
                 SETTING_OPTION("0", _p("Off")),
                 NULL);

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Maximum resolution for deinterlacer")),
                 SETTING_STORE("videoplayback",
                                "vdpau_deinterlace_resolution_limit"),
                 SETTING_WRITE_INT(&video_settings.
                                   vdpau_deinterlace_resolution_limit),
                 SETTING_OPTION     ("0", _p("No limit")),
                 SETTING_OPTION_CSTR("576",  "576"),
                 SETTING_OPTION_CSTR("720",  "720"),
                 SETTING_OPTION_CSTR("1080", "1080"),
                 NULL);
#endif

#if defined(__APPLE__) || defined(__ANDROID__)
  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Hardware accelerated decoding")),
                 SETTING_STORE("videoplayback", "videoaccel"),
#if defined(__APPLE__)
                 SETTING_VALUE(1),
#else
                 SETTING_VALUE(0),
#endif
                 SETTING_WRITE_BOOL(&video_settings.video_accel),
                 NULL);
#endif

  video_settings.vzoom_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Video zoom")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(50, 200),
                   SETTING_VALUE(100),
                   SETTING_STORE("videoplayback", "vzoom"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.pan_horizontal_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Horizontal pan")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(-100, 100),
                   SETTING_VALUE(0),
                   SETTING_STORE("videoplayback", "horizontalpan"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.pan_vertical_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Vertical pan")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(-100, 100),
                   SETTING_VALUE(0),
                   SETTING_STORE("videoplayback", "verticalpan"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.scale_horizontal_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Horizontal scale")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(10, 300),
                   SETTING_VALUE(100),
                   SETTING_STORE("videoplayback", "horizontalscale"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.scale_vertical_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Vertical scale")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(10, 300),
                   SETTING_VALUE(100),
                   SETTING_STORE("videoplayback", "verticalscale"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.stretch_horizontal_setting =
    setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Stretch video to widescreen")),
                   SETTING_STORE("videoplayback", "stretch_horizontal"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.stretch_fullscreen_setting =
    setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Stretch video to fullscreen")),
                   SETTING_STORE("videoplayback", "stretch_fullscreen"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.vinterpolate_setting =
    setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Video frame interpolation")),
                   SETTING_STORE("videoplayback", "vinterpolate"),
                   SETTING_VALUE_ORIGIN("global"),
                   SETTING_VALUE(1),
                   NULL);

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Resume video playback")),
                 SETTING_WRITE_INT(&video_settings.resume_mode),
                 SETTING_STORE("videoplayback", "resumemode"),
                 SETTING_OPTION("2", _p("Ask")),
                 SETTING_OPTION("1", _p("Always")),
                 SETTING_OPTION("0", _p("Never")),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Count video as played when reaching")),
                 SETTING_VALUE(90),
                 SETTING_RANGE(1, 100),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_WRITE_INT(&video_settings.played_threshold),
                 SETTING_STORE("videoplayback", "played_threshold"),
                 NULL);

  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Automatically play next video in list")),
                 SETTING_STORE("videoplayback", "continuous_playback"),
                 SETTING_WRITE_BOOL(&video_settings.continuous_playback),
                 NULL);

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Up / Down during video playback controls")),
                 SETTING_WRITE_INT(&video_settings.dpad_up_down_mode),
                 SETTING_STORE("videoplayback", "dpad_up_down_mode"),
                 SETTING_OPTION("0", _p("Master volume")),
                 SETTING_OPTION("1", _p("Per-file volume")),
                 NULL);



  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Show clock during playback")),
                 SETTING_STORE("videoplayback", "show_clock"),
                 SETTING_WRITE_PROP(prop_create(prop_create(prop_get_global(),
                                                            "clock"),
                                                "showDuringVideo")),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Step when seeking backward")),
                 SETTING_VALUE(15),
                 SETTING_RANGE(3, 60),
                 SETTING_UNIT_CSTR("s"),
                 SETTING_WRITE_INT(&video_settings.seek_back_step),
                 SETTING_STORE("videoplayback", "seekbackstep"),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Step when seeking forward")),
                 SETTING_VALUE(30),
                 SETTING_RANGE(3, 60),
                 SETTING_UNIT_CSTR("s"),
                 SETTING_WRITE_INT(&video_settings.seek_fwd_step),
                 SETTING_STORE("videoplayback", "seekfwdstep"),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Video buffer size")),
                 SETTING_VALUE(48),
                 SETTING_RANGE(16, gconf.max_video_buffer_size ?: 128),
                 SETTING_UNIT_CSTR("MB"),
                 SETTING_STORE("videoplayback", "videobuffersize"),
                 SETTING_WRITE_INT(&video_settings.video_buffer_size),
                 NULL);
}
Exemplo n.º 18
0
void
torrent_settings_init(void)
{
  prop_t *dir = setting_get_dir("general:filebrowse");
  prop_t *s = settings_add_dir(dir, _p("BitTorrent"),
                               NULL, NULL, NULL, "settings:bittorrent");

  char defpath[1024];
  int freespace = 10;

#ifdef STOS
  freespace = 75;
#endif

  snprintf(defpath, sizeof(defpath), "%s/bittorrentcache", gconf.cache_path);

  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Enable bittorrent")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_WRITE_BOOL(&btg.btg_enabled),
                 SETTING_VALUE(1),
                 SETTING_STORE("bittorrent", "enable"),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Max upload speed")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_CALLBACK(set_torrent_upload_speed, NULL),
                 SETTING_VALUE(5),
                 SETTING_RANGE(0, 100),
                 SETTING_UNIT_CSTR("Mbit/s"),
                 SETTING_STORE("bittorrent", "uploadspeed"),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Max usage of free space for caching torrents")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_CALLBACK(set_torrent_free_percentage, NULL),
                 SETTING_VALUE(freespace),
                 SETTING_RANGE(1, 90),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_STORE("bittorrent", "freepercentage"),
                 NULL);

  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE | SETTINGS_DIR,
                 SETTING_TITLE(_p("Torrent cache path")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_CALLBACK(set_torrent_cache_path, NULL),
                 SETTING_VALUE(defpath),
                 SETTING_STORE("bittorrent", "path"),
                 NULL);

  setting_create(SETTING_ACTION, s, 0,
                 SETTING_TITLE(_p("Clear cache")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_CALLBACK(torrent_diskio_cache_clear, NULL),
                 NULL);


  settings_create_separator(s, _p("Status"));

  btg.btg_torrent_status = prop_create_root(NULL);
  settings_create_info(s, NULL, btg.btg_torrent_status);

  btg.btg_disk_status = prop_create_root(NULL);
  settings_create_info(s, NULL, btg.btg_disk_status);

  allow_update = 1;
  torrent_diskio_scan(0);
}
Exemplo n.º 19
0
void
mp_settings_init(media_pipe_t *mp, const char *url, const char *dir_url,
                 const char *parent_title)
{
  setting_t *p;
  prop_t *c = mp->mp_prop_ctrl;
  char set_directory_title[256];
  char clr_directory_title[256];

  mp_settings_clear(mp);

  if(url == NULL || !(mp->mp_flags & MP_VIDEO))
    return;

  TRACE(TRACE_DEBUG, "media",
        "Settings initialized for URL %s in folder: %s [%s]",
        url, parent_title ?: "<unset>", dir_url ?: "<unset>");

  if(dir_url != NULL) {
    rstr_t *fmt;

    fmt = _("Save as defaults for folder '%s'");
    snprintf(set_directory_title, sizeof(set_directory_title), rstr_get(fmt),
             parent_title);
    rstr_release(fmt);

    fmt = _("Reset defaults for folder '%s'");
    snprintf(clr_directory_title, sizeof(clr_directory_title), rstr_get(fmt),
             parent_title);
    rstr_release(fmt);
  }

  // --- Video -------------------------------------------------

  p = make_dir_setting(SETTING_INT, "vzoom", &mp->mp_settings_video_dir,
                       dir_url, video_settings.vzoom_setting, mp);

  setting_create(SETTING_INT, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Video zoom")),
                 SETTING_RANGE(50, 200),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_WRITE_PROP(prop_create(c, "vzoom")),
                 SETTING_KVSTORE(url, "vzoom"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "panhorizontal", &mp->mp_settings_video_dir,
                       dir_url, video_settings.pan_horizontal_setting, mp);

  setting_create(SETTING_INT, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Horizontal pan")),
                 SETTING_RANGE(-100, 100),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_WRITE_PROP(prop_create(c, "panhorizontal")),
                 SETTING_KVSTORE(url, "panhorizontal"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "panvertical", &mp->mp_settings_video_dir,
                       dir_url, video_settings.pan_vertical_setting, mp);

  setting_create(SETTING_INT, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Vertical pan")),
                 SETTING_RANGE(-100, 100),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_WRITE_PROP(prop_create(c, "panvertical")),
                 SETTING_KVSTORE(url, "panvertical"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_BOOL, "hstretch", &mp->mp_settings_video_dir,
                       dir_url, video_settings.stretch_horizontal_setting, mp);

  setting_create(SETTING_BOOL, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Stretch video to widescreen")),
                 SETTING_WRITE_PROP(prop_create(c, "hstretch")),
                 SETTING_KVSTORE(url, "hstretch"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_BOOL, "fstretch", &mp->mp_settings_video_dir,
                       dir_url, video_settings.stretch_fullscreen_setting, mp);

  setting_create(SETTING_BOOL, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Stretch video to fullscreen")),
                 SETTING_WRITE_PROP(prop_create(c, "fstretch")),
                 SETTING_KVSTORE(url, "fstretch"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  if(video_settings.vinterpolate_setting != NULL) {
    p = make_dir_setting(SETTING_BOOL, "vinterpolate",
                         &mp->mp_settings_video_dir,
                         dir_url, video_settings.vinterpolate_setting, mp);

    setting_create(SETTING_BOOL, mp->mp_setting_video_root,
                   SETTINGS_INITIAL_UPDATE,
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_TITLE(_p("Video frame interpolation")),
                   SETTING_WRITE_PROP(prop_create(c, "vinterpolate")),
                   SETTING_KVSTORE(url, "vinterpolate"),
                   SETTING_GROUP(&mp->mp_settings_video),
                   SETTING_INHERIT(p),
                   NULL);
  }

  setting_create(SETTING_SEPARATOR, mp->mp_setting_video_root, 0,
                 SETTING_GROUP(&mp->mp_settings_video),
                 NULL);

  setting_create(SETTING_ACTION, mp->mp_setting_video_root, 0,
                 SETTING_TITLE(_p("Save as global default")),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_CALLBACK(set_video_global_defaults, mp),
                 SETTING_GROUP(&mp->mp_settings_video),
                 NULL);

  if(dir_url != NULL) {
    setting_create(SETTING_ACTION, mp->mp_setting_video_root, 0,
                   SETTING_TITLE_CSTR(set_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(set_video_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_video),
                   NULL);

    setting_create(SETTING_ACTION, mp->mp_setting_video_root, 0,
                   SETTING_TITLE_CSTR(clr_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(clr_video_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_video),
                   NULL);
  }

  // --- Audio ---------------------------------------------


  p = make_dir_setting(SETTING_INT, "audiovolume", &mp->mp_settings_audio_dir,
                       dir_url, gconf.setting_av_volume, mp);

  mp->mp_vol_setting =
  setting_create(SETTING_INT, mp->mp_setting_audio_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Audio volume")),
                 SETTING_RANGE(-12, MAX_USER_AUDIO_GAIN),
                 SETTING_UNIT_CSTR("dB"),
                 SETTING_CALLBACK(update_audio_volume_user, mp),
                 SETTING_WRITE_PROP(prop_create(c, "audiovolume")),
                 SETTING_KVSTORE(url, "audiovolume"),
                 SETTING_PROP_ENABLER(prop_create(c, "canAdjustVolume")),
                 SETTING_GROUP(&mp->mp_settings_audio),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "avdelta", &mp->mp_settings_audio_dir,
                       dir_url, gconf.setting_av_sync, mp);

  setting_create(SETTING_INT, mp->mp_setting_audio_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Audio delay")),
                 SETTING_RANGE(-5000, 5000),
                 SETTING_STEP(50),
                 SETTING_UNIT_CSTR("ms"),
                 SETTING_CALLBACK(update_av_delta, mp),
                 SETTING_WRITE_PROP(prop_create(c, "avdelta")),
                 SETTING_KVSTORE(url, "avdelta"),
                 SETTING_GROUP(&mp->mp_settings_audio),
                 SETTING_INHERIT(p),
                 NULL);

  setting_create(SETTING_SEPARATOR, mp->mp_setting_audio_root, 0,
                 SETTING_GROUP(&mp->mp_settings_audio),
                 NULL);

  setting_create(SETTING_ACTION, mp->mp_setting_audio_root, 0,
                 SETTING_TITLE(_p("Save as global default")),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_CALLBACK(set_audio_global_defaults, mp),
                 SETTING_GROUP(&mp->mp_settings_audio),
                 NULL);

  if(dir_url != NULL) {
    setting_create(SETTING_ACTION, mp->mp_setting_audio_root, 0,
                   SETTING_TITLE_CSTR(set_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(set_audio_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_audio),
                   NULL);

    setting_create(SETTING_ACTION, mp->mp_setting_audio_root, 0,
                   SETTING_TITLE_CSTR(clr_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(clr_audio_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_audio),
                   NULL);
  }


  // --- Subtitle ------------------------------------------

  setting_create(SETTING_INT, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Subtitle delay")),
                 SETTING_RANGE(-600000, 600000),
                 SETTING_STEP(500),
                 SETTING_UNIT_CSTR("ms"),
                 SETTING_CALLBACK(update_sv_delta, mp),
                 SETTING_WRITE_PROP(prop_create(c, "svdelta")),
                 SETTING_KVSTORE(url, "svdelta"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 NULL);

  p = make_dir_setting(SETTING_INT, "subscale", &mp->mp_settings_subtitle_dir,
                       dir_url, subtitle_settings.scaling_setting, mp);

  setting_create(SETTING_INT, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Subtitle scaling")),
                 SETTING_RANGE(30, 500),
                 SETTING_STEP(5),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_WRITE_PROP(prop_create(c, "subscale")),
                 SETTING_KVSTORE(url, "subscale"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_BOOL, "subalign", &mp->mp_settings_subtitle_dir,
                       dir_url, subtitle_settings.align_on_video_setting, mp);

  setting_create(SETTING_BOOL, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Align subtitles on video frame")),
                 SETTING_WRITE_PROP(prop_create(c, "subalign")),
                 SETTING_KVSTORE(url, "subalign"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "subvdisplace",
                       &mp->mp_settings_subtitle_dir,
                       dir_url, subtitle_settings.vertical_displacement_setting,
                       mp);

  setting_create(SETTING_INT, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_RANGE(-300, 300),
                 SETTING_STEP(5),
                 SETTING_UNIT_CSTR("px"),
                 SETTING_TITLE(_p("Subtitle vertical displacement")),
                 SETTING_WRITE_PROP(prop_create(c, "subvdisplace")),
                 SETTING_KVSTORE(url, "subvdisplace"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "subhdisplace", 
                       &mp->mp_settings_subtitle_dir,
                       dir_url,
                       subtitle_settings.horizontal_displacement_setting,
                       mp);

  setting_create(SETTING_INT, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_RANGE(-300, 300),
                 SETTING_STEP(5),
                 SETTING_UNIT_CSTR("px"),
                 SETTING_TITLE(_p("Subtitle horizontal displacement")),
                 SETTING_WRITE_PROP(prop_create(c, "subhdisplace")),
                 SETTING_KVSTORE(url, "subhdisplace"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 SETTING_INHERIT(p),
                 NULL);

  setting_create(SETTING_SEPARATOR, mp->mp_setting_subtitle_root, 0,
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 NULL);

  setting_create(SETTING_ACTION, mp->mp_setting_subtitle_root, 0,
                 SETTING_TITLE(_p("Save as global default")),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_CALLBACK(set_subtitle_global_defaults, mp),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 NULL);

  if(dir_url != NULL) {
    setting_create(SETTING_ACTION, mp->mp_setting_subtitle_root, 0,
                   SETTING_TITLE_CSTR(set_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(set_subtitle_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_subtitle),
                   NULL);

    setting_create(SETTING_ACTION, mp->mp_setting_subtitle_root, 0,
                   SETTING_TITLE_CSTR(clr_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(clr_subtitle_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_subtitle),
                   NULL);
  }

  // ----------------------------------------------------------------


  if(gconf.can_standby) {
      setting_create(SETTING_BOOL, mp->mp_setting_root,
                     SETTINGS_INITIAL_UPDATE,
                     SETTING_MUTEX(mp),
                     SETTING_LOCKMGR(mp_lockmgr),
                     SETTING_WRITE_INT(&mp->mp_auto_standby),
                     SETTING_TITLE(_p("Go to standby after video ends")),
                     SETTING_GROUP(&mp->mp_settings_other),
                     NULL);
  }
}
Exemplo n.º 20
0
void
glw_settings_init(void)
{
  glw_settings.gs_settings_store = htsmsg_store_load("glw");

  if(glw_settings.gs_settings_store == NULL)
    glw_settings.gs_settings_store = htsmsg_create_map();


  glw_settings.gs_settings = prop_create_root(NULL);
  prop_concat_add_source(gconf.settings_look_and_feel,
			 prop_create(glw_settings.gs_settings, "nodes"),
			 NULL);

  prop_t *s = glw_settings.gs_settings;
  htsmsg_t *store = glw_settings.gs_settings_store;

  glw_settings.gs_setting_size =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Font and icon size")),
                   SETTING_RANGE(-10, 30),
                   SETTING_UNIT_CSTR("px"),
                   SETTING_WRITE_INT(&glw_settings.gs_size),
                   SETTING_HTSMSG("size", store, "glw"),
                   NULL);

  glw_settings.gs_setting_underscan_h =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Horizontal underscan")),
                   SETTING_RANGE(-100, 100),
                   SETTING_UNIT_CSTR("px"),
                   SETTING_WRITE_INT(&glw_settings.gs_underscan_h),
                   SETTING_HTSMSG("underscan_h", store, "glw"),
                   NULL);

  glw_settings.gs_setting_underscan_v =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Vertical underscan")),
                   SETTING_RANGE(-100, 100),
                   SETTING_UNIT_CSTR("px"),
                   SETTING_WRITE_INT(&glw_settings.gs_underscan_v),
                   SETTING_HTSMSG("underscan_v", store, "glw"),
                   NULL);

  glw_settings.gs_setting_screensaver =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Screensaver delay")),
                   SETTING_VALUE(10),
                   SETTING_RANGE(0, 60),
		   SETTING_ZERO_TEXT(_p("Off")),
                   SETTING_UNIT_CSTR("min"),
                   SETTING_WRITE_INT(&glw_settings.gs_screensaver_delay),
                   SETTING_HTSMSG("screensaver", store, "glw"),
                   NULL);

  glw_settings.gs_setting_wrap =
    setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Wrap when reaching beginning/end of lists")),
                   SETTING_VALUE(1),
                   SETTING_WRITE_BOOL(&glw_settings.gs_wrap),
                   SETTING_HTSMSG("wrap", store, "glw"),
                   NULL);

  prop_t *p = prop_create(prop_get_global(), "glw");
  p = prop_create(p, "osk");
  kv_prop_bind_create(p, "showtime:glw:osk");
}
Exemplo n.º 21
0
static JSBool 
js_createMultiOpt(JSContext *cx, JSObject *obj, uintN argc, 
		  jsval *argv, jsval *rval)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *id;
  const char *title;
  JSObject *func;
  JSObject *optlist;
  JSBool persistent = JS_FALSE;

  if(!JS_ConvertArguments(cx, argc, argv, "ssoo/b",
			  &id, &title, &optlist, &func, &persistent))
    return JS_FALSE;

  js_setting_t *jss = jss_create(cx, obj, id, rval, func, jsg, persistent);
  if(jss == NULL)
    return JS_FALSE;

  char **options = NULL;
  JSIdArray *opts, *opt;
  int i;

  char *defvalue = NULL;

  if((opts = JS_Enumerate(cx, optlist)) != NULL) {

    for(i = 0; i < opts->length; i++) {
      jsval name, value, id, title, def;
      if(!JS_IdToValue(cx, opts->vector[i], &name) ||
         !JSVAL_IS_INT(name) ||
         !JS_GetElement(cx, optlist, JSVAL_TO_INT(name), &value) ||
         !JSVAL_IS_OBJECT(value) ||
         (opt = JS_Enumerate(cx, JSVAL_TO_OBJECT(value))) == NULL)
        continue;

      if(opt->length >= 2 &&
         JS_GetElement(cx, JSVAL_TO_OBJECT(value), 0, &id) &&
         JS_GetElement(cx, JSVAL_TO_OBJECT(value), 1, &title)) {

        if(opt->length < 3 ||
           !JS_GetElement(cx, JSVAL_TO_OBJECT(value), 2, &def))
          def = JSVAL_FALSE;

        const char *k = JS_GetStringBytes(JS_ValueToString(cx, id));

        if(def == JSVAL_TRUE)
          mystrset(&defvalue, k);

        strvec_addp(&options, k);
        strvec_addp(&options, JS_GetStringBytes(JS_ValueToString(cx, title)));
      }
      JS_DestroyIdArray(cx, opt);
    }
    JS_DestroyIdArray(cx, opts);
  }

  rstr_t *r = NULL;
  if(persistent && jsg->jsg_kv_url)
    r = kv_url_opt_get_rstr(jsg->jsg_kv_url, KVSTORE_DOMAIN_PLUGIN, id);


  jss->jss_s =
    setting_create(SETTING_MULTIOPT, jsg->jsg_root,
                   SETTINGS_INITIAL_UPDATE | jsg->jsg_settings_flags,
                   SETTING_TITLE_CSTR(title),
                   SETTING_COURIER(js_global_pc),
                   SETTING_CALLBACK(js_store_update_string, jss),
                   SETTING_VALUE(r ? rstr_get(r) : defvalue),
                   SETTING_OPTION_LIST(options),
                   SETTING_HTSMSG_CUSTOM_SAVER(id, jsg->jsg_store,
                                               js_setting_group_save, jsg),
                   NULL);

  strvec_free(options);
  rstr_release(r);
  jss->jss_cx = NULL;
  return JS_TRUE;
}