Linux-DVB-DVBT-Apps-QuartzPVR

 view release on metacpan or  search on metacpan

js/tvguide/Pages/ChanSel.js  view on Meta::CPAN

	// add a ref to the global settings
	this.settings = ChanSel.settings ;
}



// Map from array index to entry field
ChanSel.MAP = {
		0	: "chanid", 
		1	: "name", 
		2	: "show", 
		3	: "iplay",
		4	: "type",
		5	: "display",
} ;

ChanSel.INT_FIELDS = ['chanid', 'show', 'iplay', 'display'] ;

function ChanSelEntry(args)
{
	// fields
	for (var i in ChanSel.MAP)
	{
		var field = ChanSel.MAP[i] ;
		this[field] = null ;
		if (args[i])
		{
			this[field] = args[i] ;
		}
	}
	
	// Ensure integer fields are integers
	for (var i in ChanSel.INT_FIELDS)
	{
		var field = ChanSel.INT_FIELDS[i] ;
		this[field] = parseInt(this[field], 10) ;
	}
	
}



/*------------------------------------------------------------------------------------------------------*/
// Set the display windows
// start date & hour, display period in hours
//
//
//	DISPLAY_DATE: "2009-08-07", 
//	DISPLAY_HOUR: 12, 
//	DISPLAY_PERIOD: 3
//
//
ChanSel.setup = function(settings)
{
	// Copy settings
	for (var setting in settings)
	{
		ChanSel.settings[setting] = settings[setting] ;
	}
	
	// make our popup bigger
	ChanSel.settings.POPUP_WIDTH_PX = 600 ;
}



/*------------------------------------------------------------------------------------------------------*/
// Add/Create channels
//
ChanSel.prototype.update = function(chansel_data)
{
	Profile.start('ChanSel.update') ;

	// Remove existing
	this.list = [] ;
	
	// Create list of objects
	for (var i=0; i < chansel_data.length; ++i)	{

		// create a new chansel entry based on the data received
		var chansel = new ChanSelEntry(chansel_data[i]) ;
		
		// Add it to the list
		this.list.push(chansel) ;
	}

	Profile.stop('ChanSel.update') ;
}



/*------------------------------------------------------------------------------------------------------*/
//Display heading
ChanSel.prototype.display_head = function()
{
	TitleBar.display_head("Channel Display Selection", "", null, 'ChanSel') ;

	// Add some extra tools
	TitleBar.addTool("sync", "Update channels", ChanSel.settings.app.updateChanSel) ;
}


/*------------------------------------------------------------------------------------------------------*/
//Display contents
ChanSel.prototype.display = function()
{
	// set body width
	$("#quartz-net-com")
		.css({
			fontSize:	ChanSel.settings.FONT_SIZE,
			fontFamily:	"arial,helvetica,clean,sans-serif"
		}) ;
	
	var body_pad = 100 ;
	$("#quartz-body")
		.width(ChanSel.settings.TOTAL_PX+body_pad) ;
	$("#quartz-content")
		.width(ChanSel.settings.TOTAL_PX+body_pad) ;
	
	// Change heading
	this.display_head() ;



( run in 0.783 second using v1.01-cache-2.11-cpan-364913b4093 )