int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey)
{
	dprintf(DEBUG_DEBUG, "init extended settings menue\n");

	if(parent != NULL)
		parent->hide();

	if(actionKey == "epgdir")
	{
		CFileBrowser b;
		b.Dir_Mode=true;
		if (b.exec(g_settings.epg_dir.c_str()))
		{
			if((b.getSelectedFile()->Name) == "/")
			{
				// if selected dir is root -> clear epg_dir
				g_settings.epg_dir = "";
			} else {
				g_settings.epg_dir = b.getSelectedFile()->Name + "/";
			}
			CNeutrinoApp::getInstance()->SendSectionsdConfig(); // update notifier
		}
		return menu_return::RETURN_REPAINT;
	}

	int res = showMenue();
	
	return res;
}
int CWebTVSetup::exec(CMenuTarget* parent, const std::string & actionKey)
{
	int res = menu_return::RETURN_REPAINT;

	if(actionKey == "d" /* delete */) {
		selected = m->getSelected();
		if (selected >= item_offset) {
			m->removeItem(selected);
		    m->hide();
			selected = m->getSelected();
			changed = true;
		}
		return res;
	}
	if(actionKey == "c" /* change */) {
		CFileBrowser fileBrowser;
		CFileFilter fileFilter;
		fileFilter.addFilter("xml");
		fileBrowser.Filter = &fileFilter;
		selected = m->getSelected();
		CMenuItem* item = m->getItem(selected);
		CMenuForwarder *f = static_cast<CMenuForwarder*>(item);
		std::string dirname(f->getName());
		if (fileBrowser.exec(dirname.substr(0, dirname.rfind('/')).c_str())) {
			f->setName(fileBrowser.getSelectedFile()->Name);
			changed = true;
		}
		return res;
	}
	if(actionKey == "a" /* add */) {
		CFileBrowser fileBrowser;
		CFileFilter fileFilter;
		fileFilter.addFilter("xml");
		fileBrowser.Filter = &fileFilter;
		if (fileBrowser.exec("/") == true) {
			std::string s = fileBrowser.getSelectedFile()->Name;
			m->addItem(new CMenuForwarder(s, true, NULL, this, "c"));
			changed = true;
		}
		return res;
	}

    if(parent)
		parent->hide();

	Show();

	return res;
}
Esempio n. 3
0
int GLCD_Menu::exec(CMenuTarget* parent, const std::string & actionKey)
{
	int res = menu_return::RETURN_REPAINT;
	nGLCD *nglcd = nGLCD::getInstance();
	if(actionKey == "rescan") {
		nglcd->Rescan();
		return res;
	}
	if(actionKey == "select_font") {
		if(parent)
			parent->hide();
		CFileBrowser fileBrowser;
		CFileFilter fileFilter;
		fileFilter.addFilter("ttf");
		fileBrowser.Filter = &fileFilter;
		if (fileBrowser.exec(FONTDIR) == true) {
			g_settings.glcd_font = fileBrowser.getSelectedFile()->Name;
			nglcd->Rescan();
		}
		return res;
	}

	if (parent)
		parent->hide();

	GLCD_Menu_Settings();

	return res;
}
Esempio n. 4
0
void CTestMenu::testShowPictureURL()
{
	neutrino_msg_t msg;
	neutrino_msg_data_t data;

	CFileBrowser * fileBrowser;
	
	fileBrowser = new CFileBrowser();
	
	CFileFilter fileFilter;
	
	fileFilter.addFilter("png");
	fileFilter.addFilter("bmp");
	fileFilter.addFilter("jpg");
	fileFilter.addFilter("jpeg");
	
	fileBrowser->Multi_Select    = false;
	fileBrowser->Dirs_Selectable = false;
	fileBrowser->Filter = &fileFilter;
	
	std::string Path_local = g_settings.network_nfs_audioplayerdir;

BROWSER:
	if (fileBrowser->exec(Path_local.c_str()))
	{
		Path_local = fileBrowser->getCurrentDir();
		
		CFile * file;
		
		if ((file = fileBrowser->getSelectedFile()) != NULL) 
		{
			CPictureViewerGui tmpPictureViewerGui;
			CPicture pic;
			struct stat statbuf;
			
			pic.Filename = file->Name;
			std::string tmp = file->Name.substr(file->Name.rfind('/') + 1);
			pic.Name = tmp.substr(0, tmp.rfind('.'));
			pic.Type = tmp.substr(tmp.rfind('.') + 1);
			
			if(stat(pic.Filename.c_str(), &statbuf) != 0)
				printf("stat error");
			pic.Date = statbuf.st_mtime;
							
			tmpPictureViewerGui.addToPlaylist(pic);
			tmpPictureViewerGui.exec(NULL, "urlplayback");
		}

		g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
		
		if (msg != CRCInput::RC_home) 
		{
			goto BROWSER;
		}
	}
	
	delete fileBrowser;
}
Esempio n. 5
0
void CTestMenu::testPlayAudioURL()
{
	neutrino_msg_t msg;
	neutrino_msg_data_t data;
		
	CFileBrowser * fileBrowser;
	
	fileBrowser = new CFileBrowser();
	
	CFileFilter fileFilter;
	
	fileFilter.addFilter("cdr");
	fileFilter.addFilter("mp3");
	fileFilter.addFilter("mpa");
	fileFilter.addFilter("mp2");
	fileFilter.addFilter("ogg");
	fileFilter.addFilter("wav");
	fileFilter.addFilter("flac");
	fileFilter.addFilter("aac");
	fileFilter.addFilter("dts");
	fileFilter.addFilter("m4a");
	
	fileBrowser->Multi_Select = false;
	fileBrowser->Dirs_Selectable = false;
	fileBrowser->Filter = &fileFilter;
	
	std::string Path_local = g_settings.network_nfs_audioplayerdir;

BROWSER:
	if (fileBrowser->exec(Path_local.c_str()))
	{
		Path_local = fileBrowser->getCurrentDir();
		
		CFile * file;
		
		if ((file = fileBrowser->getSelectedFile()) != NULL) 
		{
			CAudioPlayerGui tmpAudioPlayerGui;
			
			if (file->getType() == CFile::FILE_AUDIO)
			{
				CAudiofileExt audiofile(file->Name, file->getExtension());
				tmpAudioPlayerGui.addToPlaylist(audiofile);
				tmpAudioPlayerGui.exec(NULL, "urlplayback");
			}
		}

		g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
		
		if (msg != CRCInput::RC_home) 
		{
			goto BROWSER;
		}
	}
	
	delete fileBrowser;
}
Esempio n. 6
0
int CEPGSettings::exec(CMenuTarget* parent, const std::string& actionKey)
{
	dprintf(DEBUG_NORMAL, "CEPGSettings::exec: actionKey: %s\n", actionKey.c_str());
	
	int ret = menu_return::RETURN_REPAINT;
	
	if(parent)
		parent->hide();
	
	if(actionKey == "savesettings")
	{
		CNeutrinoApp::getInstance()->exec(NULL, "savesettings");
		
		return ret;
	}
	else if(actionKey == "epgdir") 
	{
		if(parent)
			parent->hide();
		
		CFileBrowser b;
		b.Dir_Mode = true;
		
		if ( b.exec(g_settings.epg_dir.c_str())) 
		{
			const char * newdir = b.getSelectedFile()->Name.c_str();
			if(check_dir(newdir))
				printf("CNeutrinoApp::exec: Wrong/unsupported epg dir %s\n", newdir);
			else
			{
				g_settings.epg_dir = b.getSelectedFile()->Name;
				CNeutrinoApp::getInstance()->SendSectionsdConfig();
			}
		}

		return ret;
	}
	
	showMenu();
	
	return ret;
}
int CKeybindSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
	dprintf(DEBUG_DEBUG, "init keybindings setup\n");
	int   res = menu_return::RETURN_REPAINT;

	if (parent)
	{
		parent->hide();
	}

	if(actionKey == "loadkeys") {
		CFileBrowser fileBrowser;
		CFileFilter fileFilter;
		fileFilter.addFilter("conf");
		fileBrowser.Filter = &fileFilter;
		if (fileBrowser.exec(CONFIGDIR) == true) {
			CNeutrinoApp::getInstance()->loadKeys(fileBrowser.getSelectedFile()->Name.c_str());
			printf("[neutrino keybind_setup] new keys: %s\n", fileBrowser.getSelectedFile()->Name.c_str());
		}
		return menu_return::RETURN_REPAINT;
	}
	else if(actionKey == "savekeys") {
		CFileBrowser fileBrowser;
		fileBrowser.Dir_Mode = true;
		if (fileBrowser.exec("/var/tuxbox") == true) {
			std::string fname = "keys.conf";
			CStringInputSMS * sms = new CStringInputSMS(LOCALE_EXTRA_SAVEKEYS, &fname, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789. ");
			sms->exec(NULL, "");
			std::string sname = fileBrowser.getSelectedFile()->Name + "/" + fname;
			printf("[neutrino keybind_setup] save keys: %s\n", sname.c_str());
			CNeutrinoApp::getInstance()->saveKeys(sname.c_str());
			delete sms;
		}
		return menu_return::RETURN_REPAINT;
	}

	res = showKeySetup();

	return res;
}
Esempio n. 8
0
int CGeneralSettings::exec(CMenuTarget* parent, const std::string& actionKey)
{
	dprintf(DEBUG_NORMAL, "CGeneralSettings::exec: actionKey: %s\n", actionKey.c_str());
	
	int ret = menu_return::RETURN_REPAINT;
	
	if(parent)
		parent->hide();
	
	if(actionKey == "savesettings")
	{
		CNeutrinoApp::getInstance()->exec(NULL, "savesettings");
		
		return ret;
	}
	else if(actionKey == "logos_dir") 
	{
		if(parent)
			parent->hide();
		
		CFileBrowser b;
		b.Dir_Mode = true;
		
		if (b.exec(g_settings.logos_dir.c_str())) 
		{
			g_settings.logos_dir = b.getSelectedFile()->Name;

			dprintf(DEBUG_NORMAL, "CMiscSettings::exec: new logos dir %s\n", b.getSelectedFile()->Name.c_str());
		}

		return ret;
	}
	
	showMenu();
	
	return ret;
}
Esempio n. 9
0
int CDirChooser::exec(CMenuTarget* parent, const std::string &)
/* start dir chooser */
/**********************************************************************/
{
	int result = menu_return::RETURN_REPAINT;
	new_path_selected = false;
	
	if(parent != NULL)
	{
		parent->hide();
	}
    	
	CFileBrowser browser;
	browser.Dir_Mode = true;
    
	bool allowed = false;
	bool test_allowed = false;
	if (browser.exec(dirPath->c_str()))
	{
		*dirPath = browser.getSelectedFile()->Name;
	        
		for(int i = 0;i < MAX_ALLOWED_PATHS; i++)
		{
			if(allowedPath[i] != NULL)
			{
				test_allowed = true; // there is at least one allowed path, so check it
				if(dirPath->compare(0,strlen(allowedPath[i]),allowedPath[i]) == 0)
				{
					allowed = true;
					break;
				}
			}
		}
		if( (test_allowed == true && allowed == false) ||
		     *dirPath == "/")
		{
			*dirPath = "";   // We clear the  string if the selected folder is not at allowed
		}
		new_path_selected = true;
	}
	return result;
}
Esempio n. 10
0
int CPictureViewerSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
	dprintf(DEBUG_DEBUG, "init pctureviwer setup\n");
	int   res = menu_return::RETURN_REPAINT;

	if (parent)
		parent->hide();


	if(actionKey == "picturedir")
	{
		CFileBrowser b;
		b.Dir_Mode=true;
		if (b.exec(g_settings.network_nfs_picturedir.c_str()))
			g_settings.network_nfs_picturedir = b.getSelectedFile()->Name;
		return res;
	}

	res = showPictureViewerSetup();

	return res;
}
Esempio n. 11
0
void CWebTV::addUserBouquet(void)
{
	CFileBrowser filebrowser;
	CFileFilter fileFilter;
	
	fileFilter.addFilter("xml");
	fileFilter.addFilter("tv");
	fileFilter.addFilter("m3u");

	filebrowser.Filter = &fileFilter;

	if (filebrowser.exec(CONFIGDIR "/webtv"))
	{
		g_settings.userBouquet.clear();
		
		g_settings.userBouquet = filebrowser.getSelectedFile()->Name.c_str();
		
		printf("[webtv] webtv settings file %s\n", g_settings.userBouquet.c_str());
		
		// load channels
		loadChannels();
		selected = 0;
	}
}
Esempio n. 12
0
void CTestMenu::testPlayMovieURL()
{
	neutrino_msg_t msg;
	neutrino_msg_data_t data;
		
	CFileBrowser * fileBrowser;
	
	fileBrowser = new CFileBrowser();
	
	CFileFilter fileFilter;
	
	fileFilter.addFilter("ts");
	fileFilter.addFilter("mpg");
	fileFilter.addFilter("mpeg");
	fileFilter.addFilter("divx");
	fileFilter.addFilter("avi");
	fileFilter.addFilter("mkv");
	fileFilter.addFilter("asf");
	fileFilter.addFilter("aiff");
	fileFilter.addFilter("m2p");
	fileFilter.addFilter("mpv");
	fileFilter.addFilter("m2ts");
	fileFilter.addFilter("vob");
	fileFilter.addFilter("mp4");
	fileFilter.addFilter("mov");	
	fileFilter.addFilter("flv");	
	fileFilter.addFilter("dat");
	fileFilter.addFilter("trp");
	fileFilter.addFilter("vdr");
	fileFilter.addFilter("mts");
	fileFilter.addFilter("wmv");
	fileFilter.addFilter("wav");
	fileFilter.addFilter("flac");
	fileFilter.addFilter("mp3");
	fileFilter.addFilter("wma");
	fileFilter.addFilter("ogg");

	fileBrowser->Multi_Select    = false;
	fileBrowser->Dirs_Selectable = false;
	fileBrowser->Filter = &fileFilter;
	
	std::string Path_local = g_settings.network_nfs_moviedir;

BROWSER:
	if (fileBrowser->exec(Path_local.c_str()))
	{
		Path_local = fileBrowser->getCurrentDir();
		
		CFile * file;
		
		if ((file = fileBrowser->getSelectedFile()) != NULL) 
		{
		
			moviePlayerGui->filename = file->Name.c_str();
				
			// movieinfos
			moviePlayerGui->Title = file->Title;
			moviePlayerGui->Info1 = file->Info1;
			moviePlayerGui->Info2 = file->Info2;
			moviePlayerGui->thumbnail = file->thumbnail;
				
			// play
			moviePlayerGui->exec(NULL, "urlplayback");
		}

		g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
		
		if (msg != CRCInput::RC_home) 
		{
			goto BROWSER;
		}
	}
	
	delete fileBrowser;
}
Esempio n. 13
0
int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
{
	printf("[neutrino] CSettingsManager %s: init...\n",__FUNCTION__);
	int   res = menu_return::RETURN_REPAINT;

	if (parent)
		parent->hide();

	CFileBrowser fileBrowser;
	CFileFilter fileFilter;

	if(actionKey == "loadconfig")
	{
		fileFilter.addFilter("conf");
		fileBrowser.Filter = &fileFilter;
		if (fileBrowser.exec(CONFIGDIR) == true)
		{
			CNeutrinoApp::getInstance()->loadSetup(fileBrowser.getSelectedFile()->Name.c_str());
			CColorSetupNotifier *colorSetupNotifier = new CColorSetupNotifier;
			colorSetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);
			CVFD::getInstance()->setlcdparameter();
			printf("[neutrino] new settings: %s\n", fileBrowser.getSelectedFile()->Name.c_str());
			delete colorSetupNotifier;
		}
		return res;
	}
	else if(actionKey == "saveconfig")
	{
		fileBrowser.Dir_Mode = true;
		if (fileBrowser.exec("/var/tuxbox") == true)
		{
			std::string fname = "neutrino.conf";
			CStringInputSMS * sms = new CStringInputSMS(LOCALE_EXTRA_SAVECONFIG, &fname, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789. ");
			sms->exec(NULL, "");

			std::string sname = fileBrowser.getSelectedFile()->Name + "/" + fname;
			printf("[neutrino] save settings: %s\n", sname.c_str());
			CNeutrinoApp::getInstance()->saveSetup(sname.c_str());
			delete sms;
		}
		return res;
	}
	else if(actionKey == "backup")
	{
		fileBrowser.Dir_Mode = true;
		if (fileBrowser.exec("/media") == true)
		{
			struct statfs s;
			int ret = ::statfs(fileBrowser.getSelectedFile()->Name.c_str(), &s);
			if(ret == 0 && s.f_type != 0x72b6L) /*jffs2*/
			{
				const char backup_sh[] = "/bin/backup.sh";
				printf("backup: executing [%s %s]\n",backup_sh, fileBrowser.getSelectedFile()->Name.c_str());
				my_system(2, backup_sh, fileBrowser.getSelectedFile()->Name.c_str());
			}
			else
				ShowMsg(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_SETTINGS_BACKUP_FAILED),CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_ERROR);
		}
		return res;
	}
	else if(actionKey == "restore")
	{
		fileFilter.addFilter("tar");
		fileBrowser.Filter = &fileFilter;
		if (fileBrowser.exec("/media") == true)
		{
			int result = ShowMsg(LOCALE_SETTINGS_RESTORE, g_Locale->getText(LOCALE_SETTINGS_RESTORE_WARN), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo);
			if(result == CMessageBox::mbrYes)
			{
				const char restore_sh[] = "/bin/restore.sh";
				printf("restore: executing [%s %s]\n", restore_sh, fileBrowser.getSelectedFile()->Name.c_str());
				my_system(2, restore_sh, fileBrowser.getSelectedFile()->Name.c_str());
			}
		}
		return res;
	}

	res = showMenu();

	return res;
}
int CRecordSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
	dprintf(DEBUG_DEBUG, "init record setup\n");
	int   res = menu_return::RETURN_REPAINT;
	std::string timeshiftDir;

	if (parent)
	{
		parent->hide();
	}

	if(actionKey=="recording")
	{
		CNeutrinoApp::getInstance()->setupRecordingDevice();
		return res;
	}
	else if(actionKey == "help_recording")
	{
		ShowMsg(LOCALE_SETTINGS_HELP, LOCALE_RECORDINGMENU_HELP, CMessageBox::mbrBack, CMessageBox::mbBack);
		return res;
	}
	else if(actionKey == "recordingdir")
	{
		//parent->hide();
		const char *action_str = "recordingdir";
		if(chooserDir(g_settings.network_nfs_recordingdir, true, action_str)){
			printf("New recordingdir: %s (timeshift %s)\n", g_settings.network_nfs_recordingdir.c_str(), g_settings.timeshiftdir.c_str());
			if(g_settings.timeshiftdir.empty())
			{
				timeshiftDir = g_settings.network_nfs_recordingdir + "/.timeshift";
				safe_mkdir(timeshiftDir.c_str());
				printf("New timeshift dir: %s\n", timeshiftDir.c_str());
				CRecordManager::getInstance()->SetTimeshiftDirectory(timeshiftDir);
			}
			cHddStat::getInstance()->setDir(g_settings.network_nfs_recordingdir);
		}
		return res;
	}
	else if(actionKey == "timeshiftdir")
	{
		//parent->hide();
		CFileBrowser b;
		b.Dir_Mode=true;
		if (b.exec(g_settings.timeshiftdir.c_str()))
		{
			const char * newdir = b.getSelectedFile()->Name.c_str();
			printf("New timeshift: selected %s\n", newdir);
			if(check_dir(newdir))
				printf("Wrong/unsupported recording dir %s\n", newdir);
			else
			{
				printf("New timeshift dir: old %s (record %s)\n", g_settings.timeshiftdir.c_str(), g_settings.network_nfs_recordingdir.c_str());
				if(newdir != g_settings.network_nfs_recordingdir)
				{
					printf("New timeshift != rec dir\n");
					g_settings.timeshiftdir = b.getSelectedFile()->Name;
					timeshiftDir = g_settings.timeshiftdir;
				}
				else
				{
					timeshiftDir = g_settings.network_nfs_recordingdir + "/.timeshift";
					g_settings.timeshiftdir = newdir;
					safe_mkdir(timeshiftDir.c_str());
					printf("New timeshift == rec dir\n");
				}
				printf("New timeshift dir: %s\n", timeshiftDir.c_str());
				CRecordManager::getInstance()->SetTimeshiftDirectory(timeshiftDir);
			}
		}
		return res;
	}
#if 0
	if (CNeutrinoApp::getInstance()->recordingstatus)
		DisplayInfoMessage(g_Locale->getText(LOCALE_RECORDINGMENU_RECORD_IS_RUNNING));
	else
#endif
		res = showRecordSetup();

	return res;
}
Esempio n. 15
0
void plugin_exec(void)
{
	neutrino_msg_t msg;
	neutrino_msg_data_t data;
		
	CFileBrowser filebrowser;
	
	std::string Path_local = "/media/hdd";
	
	
BROWSER:	
	if (filebrowser.exec(Path_local.c_str())) 
	{
		Path_local = filebrowser.getCurrentDir(); // remark path
		
		// get the current file name
		CFile * file;

		if ((file = filebrowser.getSelectedFile()) != NULL) 
		{
			// parse file extension
			if(file->getType() == CFile::FILE_PICTURE)
			{
				CPictureViewerGui tmpPictureViewerGui;
				CPicture pic;
				struct stat statbuf;
				
				pic.Filename = file->Name;
				std::string tmp = file->Name.substr(file->Name.rfind('/') + 1);
				pic.Name = tmp.substr(0, tmp.rfind('.'));
				pic.Type = tmp.substr(tmp.rfind('.') + 1);
				
				if(stat(pic.Filename.c_str(), &statbuf) != 0)
					printf("stat error");
				pic.Date = statbuf.st_mtime;
								
				tmpPictureViewerGui.addToPlaylist(pic);
				tmpPictureViewerGui.exec(NULL, "urlplayback");
			}
			else if(file->getType() == CFile::FILE_TEXT || file->getType() == CFile::FILE_XML)
			{
				std::string buffer;
				buffer.clear();
				
				char buf[256];
				FILE* pFile;
				pFile = fopen(file->Name.c_str(), "r");
				if(pFile != NULL)
				{
					fgets(buf, sizeof(buf), pFile);
				}
				fclose(pFile);

				buffer = buf;
				int mode =  CInfoBox::SCROLL | CInfoBox::TITLE | CInfoBox::FOOT | CInfoBox::BORDER;// | //CInfoBox::NO_AUTO_LINEBREAK | //CInfoBox::CENTER | //CInfoBox::AUTO_WIDTH | //CInfoBox::AUTO_HIGH;
				CBox position(g_settings.screen_StartX + 50, g_settings.screen_StartY + 50, g_settings.screen_EndX - g_settings.screen_StartX - 100, g_settings.screen_EndY - g_settings.screen_StartY - 100); 
					
				CInfoBox * infoBox = new CInfoBox(file->getFileName().c_str(), g_Font[SNeutrinoSettings::FONT_TYPE_MENU], mode, &position, file->getFileName().c_str(), g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], NULL);
				infoBox->setText(&buffer);
				infoBox->exec();
				delete infoBox;
			}
			else if(file->getType() == CFile::FILE_VIDEO)
			{
				moviePlayerGui->filename = file->Name.c_str();
				
				moviePlayerGui->Title = file->Title;
				moviePlayerGui->Info1 = file->Info1;
				moviePlayerGui->Info2 = file->Info2;
				
				// play
				moviePlayerGui->exec(NULL, "urlplayback");
			}
			else if(file->getType() == CFile::FILE_AUDIO)
			{
				CAudioPlayerGui tmpAudioPlayerGui;
			
				CAudiofileExt audiofile(file->Name, file->getExtension());
				tmpAudioPlayerGui.addToPlaylist(audiofile);
				tmpAudioPlayerGui.exec(NULL, "urlplayback");
			}
		}

		g_RCInput->getMsg_ms(&msg, &data, 10);
		
		if (msg != CRCInput::RC_home) 
		{
			goto BROWSER;
		}
	}
}
int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
{
	int res = menu_return::RETURN_REPAINT;

	if (actionKey.empty()) {
		if (parent)
			parent->hide();
		int ret = showMenu();
		saveConfig();
		CFileHelpers::removeDir(OPKG_TMP_DIR);
		return ret;
	}
	int selected = menu->getSelected() - menu_offset;

	if (expert_mode && actionKey == "rc_blue") {
		if (selected < 0 || selected >= (int) pkg_vec.size() || !pkg_vec[selected]->installed)
			return menu_return::RETURN_NONE;

		char loc[200];
		snprintf(loc, sizeof(loc), g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_REMOVE), pkg_vec[selected]->name.c_str());
		if (ShowMsg(LOCALE_OPKG_TITLE, loc, CMessageBox::mbrCancel, CMessageBox::mbYes | CMessageBox::mbCancel) != CMessageBox::mbrCancel) {
			if (parent)
				parent->hide();
			execCmd(pkg_types[OM_REMOVE] + pkg_vec[selected]->name, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE_EVENT);
			refreshMenu();
		}
		return res;
	}
	if (actionKey == "rc_info") {
		if (selected < 0 || selected >= (int) pkg_vec.size()){
			DisplayInfoMessage("No information available! Please first select a package!");
			return menu_return::RETURN_NONE;
		}
		//show package info...
		bool is_installed = pkg_vec[selected]->installed;
		string infostr = getPkgInfo(pkg_vec[selected]->name, "", is_installed /*status or info*/);

		//if available, generate a readable string for installation time
		if (is_installed){
			string tstr = getPkgInfo(pkg_vec[selected]->name, "Installed-Time", is_installed);
			stringstream sstr(tstr);
			time_t tval; sstr >> tval;
			string newstr = asctime(localtime(&tval));
			infostr = str_replace(tstr, newstr, infostr);
		}

		DisplayInfoMessage(infostr.c_str());
		return res;
	}
	if (actionKey == "rc_yellow") {
		expert_mode = !expert_mode;
		updateMenu();
		return res;
	}
	if (actionKey == "local_package") {
		if (parent)
			parent->hide();

		CFileFilter fileFilter;
		string filters[] = {"opk", "ipk"};
		for(size_t i=0; i<sizeof(filters)/sizeof(filters[0]) ;i++)
			fileFilter.addFilter(filters[i]);

		CFileBrowser fileBrowser;
		fileBrowser.Filter = &fileFilter;

		if (fileBrowser.exec((*local_dir).c_str()))
		{
			string pkg_name = fileBrowser.getSelectedFile()->Name;
			if (!installPackage(pkg_name))
				showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name);

			*local_dir = fileBrowser.getCurrentDir();
		refreshMenu();
		}
		return res;
	}
	if(actionKey == pkg_types[OM_UPGRADE]) {
		if (parent)
			parent->hide();
		int r = execCmd(actionKey, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE_EVENT);
		if (r) {
			showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE), strerror(errno), actionKey);
		} else
			installed = true;
		refreshMenu();
		/* I don't think ending up at the last package in the list is a good idea...
		g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_up, 0);
		 */
		return res;
	}

	map<string, struct pkg>::iterator it = pkg_map.find(actionKey);
	if (it != pkg_map.end()) {
		if (parent)
			parent->hide();
		string force = "";
		if (it->second.installed && !it->second.upgradable) {
			char l[200];
			snprintf(l, sizeof(l), g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_REINSTALL), actionKey.c_str());
			l[sizeof(l) - 1] = 0;
			if (ShowMsg(LOCALE_OPKG_TITLE, l, CMessageBox::mbrCancel, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel)
				return res;
			force = "--force-reinstall ";
		}

		//install package with size check ...cancel installation if check failed
		installPackage(actionKey, force);

		refreshMenu();
	}
	return res;
}
Esempio n. 17
0
int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
	dprintf(DEBUG_DEBUG, "init osd setup\n");

	if(parent != NULL)
		parent->hide();

	if (actionKey=="show_menue_color_setup")
	{
		int res = showOsdMenueColorSetup();
		return res;
	}
	else if (actionKey=="show_infobar_color_setup")
	{
		int res = showOsdInfobarColorSetup();
		return res;
	}
	else if (actionKey=="show_timeout_setup")
	{
		int res = showOsdTimeoutSetup();
		return res;
	}
	else if (actionKey=="show_infobar_setup")
	{
		int res = showOsdInfobarSetup();
		return res;
	}
	else if (actionKey=="show_channellist_setup")
	{
		int res = showOsdChannelListSetup();
		return res;
	}
	else if (actionKey=="show_fontsize_setup")
	{
		int res = showOsdFontSizeSetup();
		return res;
	}
	else if(strncmp(actionKey.c_str(), "fontsize.d", 10) == 0)
	{
		for (int i = 0; i < 6; i++)
		{
			if (actionKey == font_sizes_groups[i].actionkey)
				for (unsigned int j = 0; j < font_sizes_groups[i].count; j++)
				{
					SNeutrinoSettings::FONT_TYPES k = font_sizes_groups[i].content[j];
					CNeutrinoApp::getInstance()->getConfigFile()->setInt32(locale_real_names[neutrino_font[k].name], neutrino_font[k].defaultsize);
				}
		}

		fontsizenotifier->changeNotify(NONEXISTANT_LOCALE, NULL);

		return menu_return::RETURN_REPAINT;
	}
	else if(actionKey == "channel_logodir")
	{
		CFileBrowser b;
		b.Dir_Mode=true;
		if (b.exec(g_settings.infobar_channel_logodir))
			strncpy(g_settings.infobar_channel_logodir, b.getSelectedFile()->Name.c_str(), sizeof(g_settings.infobar_channel_logodir)-1);
		return menu_return::RETURN_REPAINT;
	}
	else if(actionKey=="osd.def")
	{
		for (int i = 0; i < TIMING_SETTING_COUNT; i++)
			g_settings.timing[i] = timing_setting[i].default_timing;

		CNeutrinoApp::getInstance()->SetupTiming();
		return menu_return::RETURN_REPAINT;
	}

	int res = showOsdSetup();
	
	return res;
}
Esempio n. 18
0
int CDataResetNotifier::exec(CMenuTarget */*parent*/, const std::string& actionKey)
{
	CFileBrowser fileBrowser;
	CFileFilter fileFilter;

	if( actionKey == "factory") 
	{
		int result = MessageBox(LOCALE_RESET_SETTINGS, g_Locale->getText(LOCALE_RESET_CONFIRM), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo);
		if(result != CMessageBox::mbrYes) 
			return true;
		
		// neutrino settings
		unlink(NEUTRINO_SETTINGS_FILE);
		
		// moviebrowser settings
		unlink(MOVIEBROWSER_SETTINGS_FILE);
		
		// timerd settings
		unlink(TIMERD_CONFIGFILE);
		
		// nhttpd settings
		unlink(HTTPD_CONFIGFILE );
		unlink(YWEB_CONFIGFILE);
		
		// load default settings
		CNeutrinoApp::getInstance()->loadSetup(NEUTRINO_SETTINGS_FILE);
		
		// create default settings to stop wizard
		CNeutrinoApp::getInstance()->saveSetup(NEUTRINO_SETTINGS_FILE);
		
		CFrameBuffer::getInstance()->paintBackground();
#ifdef FB_BLIT
		CFrameBuffer::getInstance()->blit();
#endif		
		// video mode
		if(videoDecoder)
		{
			videoDecoder->SetVideoSystem(g_settings.video_Mode);

			//aspect-ratio
			videoDecoder->setAspectRatio(g_settings.video_Ratio, g_settings.video_Format);
#if defined (PLATFORM_COOLSTREAM)
			videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode);
#else			
			videoDecoder->SetAnalogMode( g_settings.analog_mode); 
#endif

#if !defined (PLATFORM_COOLSTREAM)	
			videoDecoder->SetSpaceColour(g_settings.hdmi_color_space);
#endif
		}

		// audio mode
		g_Zapit->setAudioMode(g_settings.audio_AnalogMode);

		if(audioDecoder)
			audioDecoder->SetHdmiDD(g_settings.hdmi_dd );

		CNeutrinoApp::getInstance()->SetupTiming();
	}
	else if(actionKey == "backup") 
	{
		fileBrowser.Dir_Mode = true;
		if (fileBrowser.exec("/media") == true) 
		{
			char  fname[256];
			struct statfs s;
			int ret = ::statfs(fileBrowser.getSelectedFile()->Name.c_str(), &s);

			if(ret == 0 && s.f_type != 0x72b6L/*jffs2*/ && s.f_type != 0x5941ff53L /*yaffs2*/)
			{ 
				const char backup_sh[] = "backup.sh";

				sprintf(fname, "%s %s", backup_sh, fileBrowser.getSelectedFile()->Name.c_str());
				
				dprintf(DEBUG_NORMAL, "CDataResetNotifier::exec: executing %s\n", fname);
				
				system(fname);
			} 
			else
				MessageBox(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_SETTINGS_BACKUP_FAILED),CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_ERROR);
		}
	}
	else if(actionKey == "restore") 
	{
		fileFilter.addFilter("tar");
		fileBrowser.Filter = &fileFilter;
		if (fileBrowser.exec("/media") == true) 
		{
			int result = MessageBox(LOCALE_SETTINGS_RESTORE, g_Locale->getText(LOCALE_SETTINGS_RESTORE_WARN), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo);
			if(result == CMessageBox::mbrYes) 
			{
				char  fname[256];
				
				const char restore_sh[] = "restore.sh";
				
				sprintf(fname, "%s %s", restore_sh, fileBrowser.getSelectedFile()->Name.c_str());
				
				dprintf(DEBUG_NORMAL, "CDataResetNotifier::exec: executing %s\n", fname);
				
				system(fname);
			}
			
			
		}
	}

	return true;
}
Esempio n. 19
0
int CMiscSettings::exec(CMenuTarget* parent, const std::string& actionKey)
{
	dprintf(DEBUG_NORMAL, "CMiscSettings::exec: actionKey: %s\n", actionKey.c_str());
	
	int ret = menu_return::RETURN_REPAINT;
	
	if(parent)
		parent->hide();
	
	if(actionKey == "savesettings")
	{
		CNeutrinoApp::getInstance()->exec(NULL, "savesettings");
		
		return ret;
	}
	else if(actionKey == "logos_dir") 
	{
		if(parent)
			parent->hide();
		
		CFileBrowser b;
		b.Dir_Mode = true;
		
		if (b.exec(g_settings.logos_dir.c_str())) 
		{
			g_settings.logos_dir = b.getSelectedFile()->Name;

			dprintf(DEBUG_NORMAL, "CMiscSettings::exec: new logos dir %s\n", b.getSelectedFile()->Name.c_str());
		}

		return ret;
	}
	else if(actionKey == "epgdir") 
	{
		if(parent)
			parent->hide();
		
		CFileBrowser b;
		b.Dir_Mode = true;
		
		if ( b.exec(g_settings.epg_dir.c_str())) 
		{
			const char * newdir = b.getSelectedFile()->Name.c_str();
			if(check_dir(newdir))
				printf("CNeutrinoApp::exec: Wrong/unsupported epg dir %s\n", newdir);
			else
			{
				g_settings.epg_dir = b.getSelectedFile()->Name;
				CNeutrinoApp::getInstance()->SendSectionsdConfig();
			}
		}

		return ret;
	}
	
	if(g_settings.menu_design == SNeutrinoSettings::MENU_DESIGN_STANDARD)
		showMenu();
	else if(g_settings.menu_design == SNeutrinoSettings::MENU_DESIGN_CLASSIC)
		showMenuClassic();
	else if(g_settings.menu_design == SNeutrinoSettings::MENU_DESIGN_SMART)
		showMenuSmart();
	
	return ret;
}
Esempio n. 20
0
int CNFSMountGui::exec( CMenuTarget *parent, const std::string &actionKey )
{
	dprintf(DEBUG_NORMAL, "CNFSMountGui::exec: actionKey:%s\n", actionKey.c_str());
	
	int returnval = menu_return::RETURN_REPAINT;
	
	if (m_nfs_sup == CFSMounter::FS_UNPROBED)
		m_nfs_sup = CFSMounter::fsSupported(CFSMounter::NFS);

	if (m_cifs_sup == CFSMounter::FS_UNPROBED)
		m_cifs_sup = CFSMounter::fsSupported(CFSMounter::CIFS);

	if (m_lufs_sup == CFSMounter::FS_UNPROBED)
		m_lufs_sup = CFSMounter::fsSupported(CFSMounter::LUFS);
	
	if (m_smbfs_sup == CFSMounter::FS_UNPROBED)
		m_smbfs_sup = CFSMounter::fsSupported(CFSMounter::SMBFS);

	dprintf(DEBUG_NORMAL, "SUPPORT: NFS: %d, CIFS: %d, LUFS: %d, SMBFS: %d\n", m_nfs_sup, m_cifs_sup, m_lufs_sup, m_smbfs_sup);

	if (actionKey.empty())
	{
		if(parent)
			parent->hide();
		
		for(int i = 0 ; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
		{
			sprintf(m_entry[i],
				nfs_entry_printf_string[(g_settings.network_nfs_type[i] == (int) CFSMounter::NFS) ? 0 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::CIFS) ? 1 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::SMBFS) ? 3 : 2))],
				g_settings.network_nfs_ip[i].c_str(),
				FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_dir[i]),
				FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_local_dir[i]),
				g_Locale->getText(g_settings.network_nfs_automount[i] ? LOCALE_MESSAGEBOX_YES : LOCALE_MESSAGEBOX_NO));
		}
		returnval = menu();
	}
	else if(actionKey.substr(0,10) == "mountentry")
	{
		if(parent)
			parent->hide();
		
		returnval = menuEntry(actionKey[10]-'0');
		
		for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
		{
			sprintf(m_entry[i],
				nfs_entry_printf_string[(g_settings.network_nfs_type[i] == (int) CFSMounter::NFS) ? 0 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::CIFS) ? 1 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::SMBFS) ? 3 : 2))],
				g_settings.network_nfs_ip[i].c_str(),
				FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_dir[i]),
				FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_local_dir[i]),
				g_Locale->getText(g_settings.network_nfs_automount[i] ? LOCALE_MESSAGEBOX_YES : LOCALE_MESSAGEBOX_NO));
			sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str());
		}
	}
	else if(actionKey.substr(0,7) == "domount")
	{
		int nr = atoi(actionKey.substr(7,1).c_str());
		CFSMounter::mount(g_settings.network_nfs_ip[nr].c_str(), g_settings.network_nfs_dir[nr], 
				  g_settings.network_nfs_local_dir[nr], (CFSMounter::FSType) g_settings.network_nfs_type[nr],
				  g_settings.network_nfs_username[nr], g_settings.network_nfs_password[nr],
				  g_settings.network_nfs_mount_options1[nr], g_settings.network_nfs_mount_options2[nr]);
		// TODO show msg in case of error
		returnval = menu_return::RETURN_EXIT;
	}
	else if(actionKey.substr(0,3) == "dir")
	{
		if(parent)
			parent->hide();
		
		int nr = atoi(actionKey.substr(3,1).c_str());
		CFileBrowser b;
		b.Dir_Mode = true;

		if (b.exec(g_settings.network_nfs_local_dir[nr]))
			strcpy(g_settings.network_nfs_local_dir[nr], b.getSelectedFile()->Name.c_str());

		returnval = menu_return::RETURN_REPAINT;
	}
	
	return returnval;
}