From fbd3511acfaa2c03d386cb42f7c4d9dcbf27a08f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Sun, 28 Sep 2008 08:20:30 +0000 Subject: [PATCH] Add support for assign icon to tags (and forward this over HTSP) --- channels.c | 8 ++++++++ channels.h | 2 ++ htsp.c | 2 ++ webui/static/app/cteditor.js | 21 +++++++++++++++++++-- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/channels.c b/channels.c index 05f64d44..7f04fe8a 100644 --- a/channels.c +++ b/channels.c @@ -643,6 +643,7 @@ channel_tag_find(const char *id, int create) ct->ct_identifier = strdup(id); ct->ct_name = strdup("New tag"); ct->ct_comment = strdup(""); + ct->ct_icon = strdup(""); TAILQ_INSERT_TAIL(&channel_tags, ct, ct_link); return ct; } @@ -683,6 +684,7 @@ channel_tag_destroy(channel_tag_t *ct) free(ct->ct_identifier); free(ct->ct_name); free(ct->ct_comment); + free(ct->ct_icon); TAILQ_REMOVE(&channel_tags, ct, ct_link); free(ct); } @@ -697,9 +699,11 @@ channel_tag_record_build(channel_tag_t *ct) htsmsg_t *e = htsmsg_create(); htsmsg_add_u32(e, "enabled", !!ct->ct_enabled); htsmsg_add_u32(e, "internal", !!ct->ct_internal); + htsmsg_add_u32(e, "titledIcon", !!ct->ct_titled_icon); htsmsg_add_str(e, "name", ct->ct_name); htsmsg_add_str(e, "comment", ct->ct_comment); + htsmsg_add_str(e, "icon", ct->ct_icon); htsmsg_add_str(e, "id", ct->ct_identifier); return e; } @@ -761,6 +765,10 @@ channel_tag_record_update(void *opaque, const char *id, htsmsg_t *values, tvh_str_update(&ct->ct_name, htsmsg_get_str(values, "name")); tvh_str_update(&ct->ct_comment, htsmsg_get_str(values, "comment")); + tvh_str_update(&ct->ct_icon, htsmsg_get_str(values, "icon")); + + if(!htsmsg_get_u32(values, "titledIcon", &u32)) + ct->ct_titled_icon = u32; was_exposed = ct->ct_enabled && !ct->ct_internal; diff --git a/channels.h b/channels.h index 6f37dfb5..9aa22ebb 100644 --- a/channels.h +++ b/channels.h @@ -78,8 +78,10 @@ typedef struct channel_tag { TAILQ_ENTRY(channel_tag) ct_link; int ct_enabled; int ct_internal; + int ct_titled_icon; char *ct_name; char *ct_comment; + char *ct_icon; char *ct_identifier; struct channel_tag_mapping_list ct_ctms; diff --git a/htsp.c b/htsp.c index 386ec44c..f37dc533 100644 --- a/htsp.c +++ b/htsp.c @@ -252,6 +252,8 @@ htsp_build_tag(channel_tag_t *ct, const char *method) htsmsg_add_str(out, "tagId", ct->ct_identifier); htsmsg_add_str(out, "tagName", ct->ct_name); + htsmsg_add_str(out, "tagIcon", ct->ct_icon); + htsmsg_add_u32(out, "tagTitledIcon", ct->ct_titled_icon); LIST_FOREACH(ctm, &ct->ct_ctms, ctm_tag_link) htsmsg_add_u32(members, NULL, ctm->ctm_channel->ch_id); diff --git a/webui/static/app/cteditor.js b/webui/static/app/cteditor.js index 1ff1908b..8f914adc 100644 --- a/webui/static/app/cteditor.js +++ b/webui/static/app/cteditor.js @@ -14,6 +14,15 @@ tvheadend.cteditor = function() { width: 100 }); + var titledIconColumn = new Ext.grid.CheckColumn({ + header: "Icon has title", + dataIndex: 'titledIcon', + width: 100, + tooltip: 'Set this if the supplied icon has a title embedded. ' + + 'This will tell displaying application not to superimpose title '+ + 'on top of logo.' + }); + var cm = new Ext.grid.ColumnModel([ enabledColumn, @@ -23,6 +32,13 @@ tvheadend.cteditor = function() { editor: new fm.TextField({allowBlank: false}) }, internalColumn, + { + header: "Icon (full URL)", + dataIndex: 'icon', + width: 400, + editor: new fm.TextField({}) + }, + titledIconColumn, { header: "Comment", dataIndex: 'comment', @@ -32,10 +48,11 @@ tvheadend.cteditor = function() { ]); var ChannelTagRecord = Ext.data.Record.create([ - 'enabled','name','internal','comment' + 'enabled','name','internal','icon','comment','titledIcon' ]); return new tvheadend.tableEditor('Channel Tags', 'channeltags', cm, ChannelTagRecord, - [enabledColumn, internalColumn]); + [enabledColumn, internalColumn, + titledIconColumn]); }