]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
WEBUI: cosmetic changes for the stream edit tabs
authorJaroslav Kysela <perex@perex.cz>
Thu, 9 Oct 2014 19:48:51 +0000 (21:48 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 9 Oct 2014 19:48:51 +0000 (21:48 +0200)
src/api/api_idnode.c
src/prop.c
src/webui/static/app/esfilter.js
src/webui/static/app/ext.css
src/webui/static/app/idnode.js
src/webui/static/app/tvheadend.js
src/webui/static/icons/film.png [new symlink]
src/webui/static/icons/film_key.png [new symlink]

index a6994c2a61c32a3202e92c7bb85c76e74b8e57a0..b767d1d6e3a733b5de5457e535b00e0bfdb0a2e9 100644 (file)
@@ -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);
     }
index dbfff50dd59d5ec0c962d4e4ffae2a99cd3550f9..723ae41090ec7966fb0f818cbed153384a37cedb 100644 (file)
@@ -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);
       }
     }
   }
index 07523e1824b85061b92810ac44d9d54591bcef24..2972c48e5026a0d3d5d6341caef1445de4005406 100644 (file)
@@ -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: {}
         },
index debe2ffcfd13259cb17afcd361b2d91c72290c52..2c41c9dcb89572b986f9e96d646f3cce0160b7a9 100644 (file)
     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;
 }
index 909074ee878b7798b0f6bef7b219fdebb071651c..55ff62438fc5e8bde02a511b9381406f49d537fb 100644 (file)
@@ -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, {
index 6b5008b2435a345d40e82078dfc031b054ec70e4..aef8f475f1fb313e3c104d85101dbd4c81b952e6 100644 (file)
@@ -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 (symlink)
index 0000000..9fba879
--- /dev/null
@@ -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 (symlink)
index 0000000..216d594
--- /dev/null
@@ -0,0 +1 @@
+../../../../vendor/famfamsilk/film_key.png
\ No newline at end of file