tvheadend.epg = function() {
var lookup = '<span class="x-linked"> </span>';
+ var epgChannelCurrentIndex = 0;
var detailsfcn = function(grid, rec, act, row) {
new tvheadend.epgDetails(grid, row);
}
});
+ var epgPrevChannel = new Ext.Button({
+ handler: epgPrevChannelCB,
+ iconCls: 'previous',
+ tooltip: _("Go to previous channel"),
+ });
+
+ var epgNextChannel = new Ext.Button({
+ handler: epgNextChannelCB,
+ iconCls: 'next',
+ tooltip: _("Go to next channel"),
+ });
+
// Tags, uses global store
var epgFilterChannelTags = new Ext.ux.form.ComboAny({
epgView.reset();
}
- epgFilterChannels.on('select', function(c, r) {
+ epgFilterChannels.on('select', function(c, r, index) {
+ epgChannelCurrentIndex = index;
epgFilterChannelSet(r.data.key == -1 ? "" : r.data.key);
});
var tbar = [
epgMode, '-',
epgFilterTitle, { text: _('Fulltext') }, epgFilterFulltext, { text: _('New only') }, epgFilterNewOnly, '-',
- epgFilterChannels, '-',
+ epgPrevChannel, epgFilterChannels, epgNextChannel, '-',
epgFilterChannelTags, '-',
epgFilterContentGroup, '-',
epgFilterDuration, '-',
new tvheadend.epgDetails(grid, index);
}
+ function epgChannelSetCommon(delta) {
+ // Count is 1-based
+ var max = epgFilterChannels.store.getCount();
+ // Elem 0 is "clear filter" so we expect at least
+ // two items.
+ if (max < 2)
+ return;
+
+ epgChannelCurrentIndex += delta;
+ // Wrap-around seems to make sense for EPG since
+ // we have a text field showing the channel names.
+ if (epgChannelCurrentIndex < 1)
+ epgChannelCurrentIndex = max - 1;
+ else if (epgChannelCurrentIndex >= max)
+ epgChannelCurrentIndex = 1;
+
+ var text = epgFilterChannels.store.getAt(epgChannelCurrentIndex).get("val");
+ epgFilterChannels.setValue(text);
+ // We have to call our "value changed" cb ourselves, but with
+ // the associated key for it to be sent to the server for filtering.
+ var key = epgFilterChannels.store.getAt(epgChannelCurrentIndex).get("key");
+ epgFilterChannelSet(key);
+ }
+
+ function epgPrevChannelCB() {
+ epgChannelSetCommon(-1);
+ }
+
+ function epgNextChannelCB() {
+ epgChannelSetCommon(+1);
+ }
+
function createAutoRec() {
if (!tvheadend.accessUpdate.dvr)