From: Jaroslav Kysela Date: Thu, 9 Oct 2014 19:48:51 +0000 (+0200) Subject: WEBUI: cosmetic changes for the stream edit tabs X-Git-Tag: v4.1~1098 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a6f6af33cf2b50884e092f5be6ccce7b6d62e8f;p=thirdparty%2Ftvheadend.git WEBUI: cosmetic changes for the stream edit tabs --- diff --git a/src/api/api_idnode.c b/src/api/api_idnode.c index a6994c2a6..b767d1d6e 100644 --- a/src/api/api_idnode.c +++ b/src/api/api_idnode.c @@ -29,6 +29,11 @@ api_idnode_flist_conf( htsmsg_t *args, const char *name ) htsmsg_t *m = NULL; const char *s = htsmsg_get_str(args, name); char *r, *saveptr = NULL; + int use = 1; + if (s && s[0] == '-') { + use = 0; + s++; + } if (s && s[0] != '\0') { s = r = strdup(s); r = strtok_r(r, ",;:", &saveptr); @@ -38,7 +43,7 @@ api_idnode_flist_conf( htsmsg_t *args, const char *name ) if (*r != '\0') { if (m == NULL) m = htsmsg_create_map(); - htsmsg_add_bool(m, r, 1); + htsmsg_add_bool(m, r, use); } r = strtok_r(NULL, ",;:", &saveptr); } diff --git a/src/prop.c b/src/prop.c index dbfff50dd..723ae4109 100644 --- a/src/prop.c +++ b/src/prop.c @@ -344,12 +344,26 @@ prop_read_values } else { const property_t *p; htsmsg_field_t *f; - int b; + int b, total = 0, count = 0; + HTSMSG_FOREACH(f, list) { - if (!htsmsg_field_get_bool(f, &b) && b > 0) { - p = prop_find(pl, f->hmf_name); - if (p) - prop_read_value(obj, p, m, p->id, optmask); + total++; + if (!htsmsg_field_get_bool(f, &b)) { + if (b > 0) { + p = prop_find(pl, f->hmf_name); + if (p) + prop_read_value(obj, p, m, p->id, optmask); + count++; + } + } + } + if (total && !count) { + for (; pl->id; pl++) { + HTSMSG_FOREACH(f, list) + if (!strcmp(pl->id, f->hmf_name)) + break; + if (f == NULL) + prop_read_value(obj, pl, m, pl->id, optmask); } } } @@ -490,12 +504,23 @@ prop_serialize } else { const property_t *p; htsmsg_field_t *f; - int b; + int b, total = 0, count = 0; HTSMSG_FOREACH(f, list) { + total++; if (!htsmsg_field_get_bool(f, &b) && b > 0) { p = prop_find(pl, f->hmf_name); if (p) prop_serialize_value(obj, p, msg, optmask); + count++; + } + } + if (total && !count) { + for (; pl->id; pl++) { + HTSMSG_FOREACH(f, list) + if (!strcmp(pl->id, f->hmf_name)) + break; + if (f == NULL) + prop_serialize_value(obj, pl, msg, optmask); } } } diff --git a/src/webui/static/app/esfilter.js b/src/webui/static/app/esfilter.js index 07523e182..2972c48e5 100644 --- a/src/webui/static/app/esfilter.js +++ b/src/webui/static/app/esfilter.js @@ -12,6 +12,8 @@ tvheadend.caclient_builders = new Ext.data.JsonStore({ tvheadend.esfilter_tab = function(panel) { + var list = '-class'; + tvheadend.idnode_form_grid(panel, { url: 'api/profile', clazz: 'profile', @@ -19,7 +21,8 @@ tvheadend.esfilter_tab = function(panel) titleS: 'Stream Profile', titleP: 'Stream Profiles', titleC: 'Stream Profile Name', - iconCls: 'stream_profile', + iconCls: 'film', + edit: { params: { list: list } }, add: { url: 'api/profile', titleS: 'Stream Profile', @@ -28,7 +31,8 @@ tvheadend.esfilter_tab = function(panel) store: tvheadend.caclient_builders, displayField: 'caption', valueField: 'class', - propField: 'props' + propField: 'props', + list: list, }, create: { }, }, @@ -38,14 +42,19 @@ tvheadend.esfilter_tab = function(panel) } }); + var eslist = '-class,index'; + tvheadend.idnode_grid(panel, { url: 'api/esfilter/video', titleS: 'Video Stream Filter', titleP: 'Video Stream Filters', + iconCls: 'film_edit', tabIndex: 1, + edit: { params: { list: eslist } }, add: { + params: { list: eslist }, url: 'api/esfilter/video', - create: {} + create: { } }, del: true, move: true, @@ -58,8 +67,11 @@ tvheadend.esfilter_tab = function(panel) url: 'api/esfilter/audio', titleS: 'Audio Stream Filter', titleP: 'Audio Stream Filters', + iconCls: 'control_volume', tabIndex: 2, + edit: { params: { list: eslist } }, add: { + params: { list: eslist }, url: 'api/esfilter/audio', create: {} }, @@ -75,7 +87,9 @@ tvheadend.esfilter_tab = function(panel) titleS: 'Teletext Stream Filter', titleP: 'Teletext Stream Filters', tabIndex: 3, + edit: { params: { list: eslist } }, add: { + params: { list: eslist }, url: 'api/esfilter/teletext', create: {} }, @@ -91,7 +105,9 @@ tvheadend.esfilter_tab = function(panel) titleS: 'Subtitle Stream Filter', titleP: 'Subtitle Stream Filters', tabIndex: 4, + edit: { params: { list: eslist } }, add: { + params: { list: eslist }, url: 'api/esfilter/subtit', create: {} }, @@ -106,8 +122,10 @@ tvheadend.esfilter_tab = function(panel) url: 'api/esfilter/ca', titleS: 'CA Stream Filter', titleP: 'CA Stream Filters', + iconCls: 'film_key', tabIndex: 5, add: { + params: { list: eslist }, url: 'api/esfilter/ca', create: {} }, @@ -123,7 +141,9 @@ tvheadend.esfilter_tab = function(panel) titleS: 'Other Stream Filter', titleP: 'Other Stream Filters', tabIndex: 6, + edit: { params: { list: eslist } }, add: { + params: { list: eslist }, url: 'api/esfilter/other', create: {} }, diff --git a/src/webui/static/app/ext.css b/src/webui/static/app/ext.css index debe2ffcf..2c41c9dcb 100644 --- a/src/webui/static/app/ext.css +++ b/src/webui/static/app/ext.css @@ -318,10 +318,18 @@ background-image: url(../icons/arrow_switch.png) !important; } -.stream_config { +.film { + background-image: url(../icons/film.png) !important; +} + +.film_edit { background-image: url(../icons/film_edit.png) !important; } +.film_key { + background-image: url(../icons/film_key.png) !important; +} + .caclientNone { background-image: url(../icons/stop.png) !important; } diff --git a/src/webui/static/app/idnode.js b/src/webui/static/app/idnode.js index 909074ee8..55ff62438 100644 --- a/src/webui/static/app/idnode.js +++ b/src/webui/static/app/idnode.js @@ -116,17 +116,27 @@ tvheadend.idnode_enum_store = function(f) tvheadend.idnode_filter_fields = function(d, list) { - if (!list) - return d; - var o = list.split(','); - var r = []; - for (var i = 0; i < o.length; i++) - for (var j = 0; j < d.length; j++) - if (d[j].id === o[i]) { - r.push(d[j]); - break; - } - return r; + if (!list) + return d; + var r = []; + if (list.charAt(0) === '-') { + var o = list.substring(1).split(','); + r = d.slice(); + for (var i = 0; i < o.length; i++) + for (var j = 0; j < r.length; j++) + if (r[j].id === o[i]) { + r.splice(i, 1); + break; + } + } else { + for (var i = 0; i < o.length; i++) + for (var j = 0; j < d.length; j++) + if (d[j].id === o[i]) { + r.push(d[j]); + break; + } + } + return r; } Ext.ux.grid.filter.IntsplitFilter = Ext.extend(Ext.ux.grid.filter.NumericFilter, { diff --git a/src/webui/static/app/tvheadend.js b/src/webui/static/app/tvheadend.js index 6b5008b24..aef8f475f 100644 --- a/src/webui/static/app/tvheadend.js +++ b/src/webui/static/app/tvheadend.js @@ -383,7 +383,7 @@ function accessUpdate(o) { activeTab: 0, autoScroll: true, title: 'Stream', - iconCls: 'stream_config', + iconCls: 'film_edit', items: [] }); tvheadend.esfilter_tab(stream); diff --git a/src/webui/static/icons/film.png b/src/webui/static/icons/film.png new file mode 120000 index 000000000..9fba87909 --- /dev/null +++ b/src/webui/static/icons/film.png @@ -0,0 +1 @@ +../../../../vendor/famfamsilk/film.png \ No newline at end of file diff --git a/src/webui/static/icons/film_key.png b/src/webui/static/icons/film_key.png new file mode 120000 index 000000000..216d5943f --- /dev/null +++ b/src/webui/static/icons/film_key.png @@ -0,0 +1 @@ +../../../../vendor/famfamsilk/film_key.png \ No newline at end of file