示例#1
0
int CRecordSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
	dprintf(DEBUG_DEBUG, "init record setup\n");
	int   res = menu_return::RETURN_REPAINT;

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

	if(actionKey=="recording")
	{
		CNeutrinoApp::getInstance()->setupRecordingDevice();
		return res;
	}
	else if(actionKey == "help_recording")
	{
		ShowLocalizedMessage(LOCALE_SETTINGS_HELP, LOCALE_RECORDINGMENU_HELP, CMessageBox::mbrBack, CMessageBox::mbBack);
		return res;
	}


	showRecordSetup();
	
	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;
}