Add support for assign icon to tags (and forward this over HTSP)

This commit is contained in:
Andreas Öman 2008-09-28 08:20:30 +00:00
parent c4ea9dc028
commit fbd3511acf
4 changed files with 31 additions and 2 deletions

View file

@ -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;

View file

@ -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;

2
htsp.c
View file

@ -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);

View file

@ -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]);
}