Esempio n. 1
0
void create_image_obj(EFL_Core *core, EFL_Image *img, const char* path_image, int img_width, int img_height){
	img->obj = evas_object_image_add(get_main_object(core));
	evas_object_image_file_set(img->obj, path_image, NULL);
	evas_object_image_preload(img->obj, EINA_TRUE);
	img->width  = img_width;
	img->height = img_height;
}
Esempio n. 2
0
int main(int argc, char *argv[]){
	/*
	 * Here i need to get the TV resolution
	 */
	ecore_psl1ght_optimal_screen_resolution_get(&REAL_WIDTH, &REAL_HEIGHT);
	
	if(REAL_HEIGHT > 720){
		REAL_WIDTH  = 1280;
		REAL_HEIGHT = 720;
	}
	
	init_core(&core, REAL_WIDTH, REAL_HEIGHT, "Playstation Channel");
	edje_start();
	init_core_file();
	
	Cursor_Y[0] = 0.25972*REAL_HEIGHT;
	Cursor_Y[1] = 0.5445 *REAL_HEIGHT;
	
	Cursor_X[0] = 0.1*REAL_WIDTH;		// APPS      (APP 1) || MEDIA     (APP 4)
	Cursor_X[1] = 0.37421875*REAL_WIDTH;	// BMANAGERS (APP 2) || RETRO     (APP 5)
	Cursor_X[2] = 0.65*REAL_WIDTH;		// GAMES     (APP 3) || OPTIONS   (APP 6)


	
	load_edj_from_file(&core, &info, PSC_INFO_SCREEN_PATH, "information", REAL_WIDTH, REAL_HEIGHT);
	load_edj_from_file(&core, &menu[0], PSC_OPTION_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT); //OPTIONS
	load_edj_from_file(&core, &menu[1], PSC_SUB_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT);    //SUB MENU

	main_layer = evas_object_rectangle_add(get_main_object(&core));
	evas_object_resize(main_layer, REAL_WIDTH, REAL_HEIGHT);
	evas_object_color_set(main_layer, 0, 0, 0, 0);
	evas_object_show(main_layer);

	ecore_evas_object_associate(core.ee_core, main_layer, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
	override_text(&info, "information_download", " ");
	draw_edj(&info, 0, 0);

//-----------------------------------------------------------------------------------------------------

	dir_make(CACHE_PATH);
	if(file_exist(CACHE_PATH"/files.zip"))
		file_delete(CACHE_PATH"/files.zip");

	{
		char url[20];
		sprintf(url,"%s",MAINURL);
//		if(!ecore_file_download(url,CACHE_PATH"/files.zip", download_main_is_finished, download_main_func, NULL, NULL))
		download_file(url,CACHE_PATH"/files.zip", download_main_func_curl, download_main_is_finished);
		if(get_download_status()==DOWNLOAD_FAILED)
			goto end;
	}
	LoadStrings(PSC_MAIN_MENU_LANG_PATH, Categories_Names, 6);
	{
		string XML_files[5];
		LoadMainStringsFromXML(CACHE_PATH"/files.xml",XML_files);
		for(int i=0;i<5;i++){
			char tmp_char[250];
			sprintf(tmp_char,"%s/%s",CACHE_PATH,XML_files[i].c_str());
			LoadStringsFromXML(tmp_char,&Apps[i]);
			Applications[i].Image = new EFL_Image [Apps[i].n_elem];
			Applications[i].x = new int [Apps[i].n_elem];
			Applications[i].y = new int [Apps[i].n_elem];
			for(int j=0, k=0, h=0;j<Apps[i].n_elem;j++,(k>1) ? h=!h : h=h,(k>1) ? k=0 : k++ ){
				sprintf(tmp_char,"%s/%s",CACHE_PATH,Apps[i].img_file[j].c_str());
				create_image_obj(&core, &Applications[i].Image[j], tmp_char, REAL_WIDTH*0.25, REAL_HEIGHT*0.246);
				Applications[i].x[j] = Cursor_X[k];
				Applications[i].y[j] = Cursor_Y[h];
				draw_image(&Applications[i].Image[j], Applications[i].x[j], Applications[i].y[j]);
				hide_obj(Applications[i].Image[j].obj);
			}
		}
	}
//-----------------------------------------------------------------------------------------------------
	load_edj_from_file(&core, &menu[2], PSC_MAIN_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT);                                 //MAIN MENU
	load_edj_from_file(&core, &bar, PSC_MAIN_MENU_BAR_PATH, "main_menu_bar", REAL_WIDTH*0.25, REAL_HEIGHT*0.246);             //(Main/Sub) Menu bar
	load_edj_from_file(&core, &download, PSC_DOWNLOAD_MASK_PATH, "download_mask", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);     //DOWNLOAD MENU

	override_text(&menu[2], "error_text", "");

	down = evas_object_rectangle_add(get_main_object(&core));
	evas_object_move(down, (REAL_WIDTH-(REAL_WIDTH*0.3125))/2 +REAL_WIDTH*0.03125,REAL_HEIGHT*0.08861 +(REAL_HEIGHT-(REAL_HEIGHT*0.3055))/2);
	Bar_X_Val = REAL_WIDTH*0.25;
	Bar_Y_Val = REAL_HEIGHT*0.058;
	evas_object_resize(down, 1, Bar_Y_Val);
	evas_object_color_set(down, 0, 0, 255, 255); //blue
	hide_obj(down);
	load_edj_from_file(&core, &download_perc, PSC_DOWNLOADPERC_MASK_PATH, "download_perc", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);    //DOWNLOAD MENU
	load_edj_from_file(&core, &download_ask, PSC_DOWNLOAD_MASK_PATH, "download_mask_ask", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);     //DOWNLOAD MENU ASK XMB

	ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, on_exit_handler, NULL);
	information_timer = ecore_timer_add(PSC_INFO_SCREEN_TIMER, delete_info, NULL);
	enable_callback(&core, main_layer, EVAS_CALLBACK_KEY_DOWN , user_menu_handler);
	
	override_text(&menu[0], "ps3_version_edit", get_ps3_version());
	char space [100];

	if(get_ps3_free_space()>1000000000)
		sprintf(space,"%ld/%ld Gigabytes",get_ps3_free_space()/1000000000,get_ps3_total_space()/1000000000);
	else if(get_ps3_free_space()>1000000)
		sprintf(space,"%ld/%ld Megabytes",get_ps3_free_space()/1000000,get_ps3_total_space()/1000000);
	else if(get_ps3_free_space()>1000)
		sprintf(space,"%ld/%ld Kilobytes",get_ps3_free_space()/1000,get_ps3_total_space()/1000);
	else
		sprintf(space,"%ld/%ld Bytes",get_ps3_free_space(),get_ps3_total_space());

	override_text(&menu[0], "ps3_hdd_free_space_edit", space);
#ifdef PSCHANNEL_VERSION
	sprintf(space,"%f",PSCHANNEL_VERSION);
	override_text(&menu[0], "software_version", space);
#else
	override_text(&menu[0], "software_version", " ");
#endif
	if(sysModuleIsLoaded(SYSMODULE_NET))
		override_text(&menu[2], "error_text", "SYSMODULE_NET NOT LOADED!!");



	start_core_loop();
	disable_callback(main_layer,EVAS_CALLBACK_KEY_DOWN, user_menu_handler);
	
end:
	dir_recursive_delete(CACHE_PATH);

	for(int i=0;i<3;i++)
		delete_edj(&menu[i]);
	for(int i=0;i<5;i++)
		for(int j=0;j<Apps[i].n_elem;j++)
			delete_obj(Applications[i].Image[j].obj);
	delete_edj(&bar);
	delete_edj(&download);
	delete_edj(&download_perc);
	delete_obj(down);


	edje_stop();
	stop_core_file();
	ecore_psl1ght_shutdown();
//	stop_core(&core);  not needed on ps3.

	if(pkg_is_installed)
		reboot_sys();
	

	return 0;
}