Beispiel #1
0
void CTestMenu::testCStringInput()
{
	std::string value;
	CStringInput * stringInput = new CStringInput("CStringInput", (char *)value.c_str());
	
	stringInput->exec(NULL, "");
	stringInput->hide();
	delete stringInput;
	stringInput = NULL;
	value.clear();
}
Beispiel #2
0
int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &)
{
	int    res = menu_return::RETURN_REPAINT;
	int    shutdown_min = 0;
	char   value[16];
	CStringInput  * inbox;

	if (parent)
		parent->hide();
   
	shutdown_min = g_Timerd->getSleepTimerRemaining();  // remaining shutdown time?
	sprintf(value,"%03d", shutdown_min);
	CSectionsdClient::CurrentNextInfo info_CurrentNext;
	g_InfoViewer->getEPG(g_RemoteControl->current_channel_id, info_CurrentNext);
	
  	if ( info_CurrentNext.flags & CSectionsdClient::epgflags::has_current) 
	{
  		time_t jetzt=time(NULL);
  		int current_epg_zeit_dauer_rest = (info_CurrentNext.current_zeit.dauer + 150 - (jetzt - info_CurrentNext.current_zeit.startzeit ))/60 ;
  		if(shutdown_min == 0 && current_epg_zeit_dauer_rest > 0 && current_epg_zeit_dauer_rest < 1000)
  		{
  			sprintf(value,"%03d", current_epg_zeit_dauer_rest);
  		}
  	}

	inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE, value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT2, "0123456789 ");
	inbox->exec (NULL, "");
	inbox->hide ();

	delete inbox;

	int new_val = atoi(value);
		
	if(shutdown_min != new_val) 
	{
		shutdown_min = new_val;
		
		dprintf(DEBUG_NORMAL, "CSleepTimerWidget::exec: sleeptimer min: %d\n", shutdown_min);
		
		if (shutdown_min == 0)	// if set to zero remove existing sleeptimer 
		{
			if(g_Timerd->getSleeptimerID() > 0) 
			{
				g_Timerd->removeTimerEvent(g_Timerd->getSleeptimerID());
			}
		}
		else	// set the sleeptimer to actual time + shutdown mins and announce 1 min before
			g_Timerd->setSleeptimer(time(NULL) + ((shutdown_min - 1) * 60), time(NULL) + shutdown_min * 60, 0);
	}
	
	return res;
}