Example #1
0
//open a message dialog with three buttons,
//yes:		applies networksettings and exit network setup
//no:		saves networksettings and exit network setup
//back: 	exit message dialog, goes back to network setup 
int CNetworkSetup::saveChangesDialog()
{
	if (!checkForIP())
		return 1;	

	// Save the settings after changes, if user wants to!
	int result = ShowLocalizedMessage(LOCALE_MAINSETTINGS_NETWORK,
					  LOCALE_NETWORKMENU_APPLY_SETTINGS_NOW,
					  CMessageBox::mbrYes,
					  CMessageBox::mbYes | CMessageBox::mbNo | CMessageBox::mbBack,
					  NEUTRINO_ICON_QUESTION,
					  width);
	
	switch(result)
	{
		case CMessageBox::mbrYes:
			applyNetworkSettings();
			return 0;
			break;
	
		case CMessageBox::mbrNo:
			saveNetworkSettings(true);
			return 0;
			break;
	
		default:
			restoreNetworkSettings(true);
			return 1;
			break;
	}
}
Example #2
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;
}
Example #3
0
int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey)
{
	if (parent)
		parent->hide();

	bool no_input = (actionKey == NO_USER_INPUT);
	if (ShowLocalizedMessage(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_LOCKMSG,
				 CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel,
				 NEUTRINO_ICON_INFO,450,no_input ? 5 : -1,no_input) == CMessageBox::mbrCancel)
		return menu_return::RETURN_EXIT_ALL;

	// -- Lockup Box
	lockBox();

	ShowLocalizedMessage(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO,450, no_input ? 5 : -1);
	return  menu_return::RETURN_EXIT_ALL;
}
Example #4
0
int CFavorites::exec(CMenuTarget* parent, const std::string & actionKey)
{
	int         status;
	std::string str;
	int         res = menu_return::RETURN_EXIT_ALL;
	bool	    show_list;
	//printf("[favorites] key %s\n", actionKey.c_str()); 
	show_list = (actionKey == "showlist");
	if (parent)
		parent->hide();

	if (!bouquetList) {
		ShowLocalizedMessage(LOCALE_FAVORITES_BOUQUETNAME, LOCALE_FAVORITES_NOBOUQUETS, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
		return res;
	}


	CHintBox* hintBox = new CHintBox(LOCALE_FAVORITES_BOUQUETNAME, g_Locale->getText(LOCALE_FAVORITES_ADDCHANNEL), 380); // UTF-8
	if(!show_list)
		hintBox->paint();

	status = addChannelToFavorites(show_list);

	hintBox->hide();
	delete hintBox;

	// -- Display result

	//printf("[favorites] status %d\n", status);
	if(status < 0)
		return menu_return::RETURN_REPAINT;

	str = "";
	if(show_list)
	{
		if (status & 2)  str += g_Locale->getText(LOCALE_EXTRA_CHADDED);
		else	str += g_Locale->getText(LOCALE_EXTRA_CHALREADYINBQ);
		ShowMsgUTF(LOCALE_EXTRA_ADD_TO_BOUQUET, str, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); // UTF-8
	}
	else
	{
		if (status & 1)  str += g_Locale->getText(LOCALE_FAVORITES_BQCREATED);
		if (status & 2)  str += g_Locale->getText(LOCALE_FAVORITES_CHADDED);
		else             str += g_Locale->getText(LOCALE_FAVORITES_CHALREADYINBQ);
		if (status) str +=  g_Locale->getText(LOCALE_FAVORITES_FINALHINT);
		ShowMsgUTF(LOCALE_FAVORITES_BOUQUETNAME, str, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); // UTF-8
	}



	//	if (status) {
	//		g_RCInput->postMsg( NeutrinoMessages::EVT_BOUQUETSCHANGED, 0 );
	//	}

	return res;
}
Example #5
0
int CThemes::Show()
{
	std::string file_name = "";

	CMenuWidget themes(menue_title, menue_icon, width);
	themes.setPreselected(selected);

	//intros
	themes.addIntroItems(menue_title != LOCALE_COLORTHEMEMENU_HEAD2 ? LOCALE_COLORTHEMEMENU_HEAD2 : NONEXISTANT_LOCALE);
	
	//set default theme
	themes.addItem(new CMenuForwarder(LOCALE_COLORTHEMEMENU_NEUTRINO_THEME, true, NULL, this, "theme_neutrino", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));

	readThemes(themes);

	CStringInputSMS nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789- ");
	CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput);

	// Don't show SAVE if UserDir does'nt exist
	if ( access(USERDIR, F_OK) != 0 ) { // check for existance
	// mkdir must be called for each subdir which does not exist 
	//	mkdir (USERDIR, S_IRUSR | S_IREAD | S_IWUSR | S_IWRITE | S_IXUSR | S_IEXEC) == 0) {
		if (system (((std::string)"mkdir -p " + USERDIR).c_str()) != 0) {
			printf("[neutrino theme] error creating %s\n", USERDIR);
		}
	}
	if (access(USERDIR, F_OK) == 0 ) {
		themes.addItem(GenericMenuSeparatorLine);
		themes.addItem(m1);
	} else {
		delete m1;
		printf("[neutrino theme] error accessing %s\n", USERDIR);
	}

	int res = themes.exec(NULL, "");
	selected = themes.getSelected();

	if (file_name.length() > 1) {
		saveFile((char*)((std::string)USERDIR + file_name + FILE_PREFIX).c_str());
	}

	if (hasThemeChanged) {
		if (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, menue_icon.c_str()) != CMessageBox::mbrYes)
			rememberOldTheme( false );
		else
			hasThemeChanged = false;
	}

	return res;
}
Example #6
0
//check for ip-address, if dhcp disabled, returns false if no address definied and show message
bool CNetworkSetup::checkForIP()
{
	bool ret = true;

	if (!network_dhcp && network_address.empty()) //no ip definied
	{
        ShowLocalizedMessage(LOCALE_MAINSETTINGS_NETWORK,
                             LOCALE_NETWORKMENU_ERROR_NO_ADDRESS,
                             CMessageBox::mbrBack,
                             CMessageBox::mbBack,
                             NEUTRINO_ICON_ERROR,
                             width);
		ret = false;
	}

	return ret;
}
Example #7
0
void CThemes::Show()
{
	std::string file_name = "";

	CMenuWidget themes (LOCALE_COLORTHEMEMENU_HEAD2, NEUTRINO_ICON_SETTINGS, width);
	themes.addItem(GenericMenuSeparator);
	themes.addItem(GenericMenuBack);

	readThemes(themes);

	CStringInputSMS *nameInput = new CStringInputSMS(LOCALE_COLORTHEMEMENU_NAME, &file_name, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789- ");
	CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, nameInput);

	// Don't show SAVE if UserDir does'nt exist
	if ( access(USERDIR, F_OK) != 0 ) { // check for existance
	// mkdir must be called for each subdir which does not exist 
	//	mkdir (USERDIR, S_IRUSR | S_IREAD | S_IWUSR | S_IWRITE | S_IXUSR | S_IEXEC) == 0) {
		if (system (((std::string)"mkdir -p " + USERDIR).c_str()) != 0) {
			printf("[neutrino theme] error creating %s\n", USERDIR);
		}
	}
	if (access(USERDIR, F_OK) == 0 ) {
		themes.addItem(GenericMenuSeparatorLine);
		themes.addItem(m1);
	} else {
		delete m1;
		printf("[neutrino theme] error accessing %s\n", USERDIR);
	}

	themes.exec(NULL, "");
	themes.hide();

	if (file_name.length() > 1) {
		saveFile((char*)((std::string)USERDIR + file_name + FILE_PREFIX).c_str());
	}

	if (hasThemeChanged) {
		if (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_SETTINGS) != CMessageBox::mbrYes)
			rememberOldTheme( false );
		else
			hasThemeChanged = false;
	}
}
Example #8
0
//restores settings without any changes if user wants to
void CNetworkSetup::restoreNetworkSettings(bool show_message)
{
	int result = CMessageBox::mbrNo;

	if (show_message)
	{
		result = ShowLocalizedMessage(LOCALE_MAINSETTINGS_NETWORK,
					      LOCALE_NETWORKMENU_RESET_SETTINGS_NOW,
					      CMessageBox::mbrNo,
					      CMessageBox::mbYes | CMessageBox::mbNo,
					      NEUTRINO_ICON_QUESTION,
					      width);
	}

	if (result == CMessageBox::mbrYes)
	{
		network_automatic_start	= old_network_automatic_start;
		network_dhcp		= old_network_dhcp;
		network_address		= old_network_address;
		network_netmask		= old_network_netmask;
		network_broadcast	= old_network_broadcast;
		network_nameserver	= old_network_nameserver;
		network_gateway		= old_network_gateway;

		networkConfig->automatic_start 	= network_automatic_start;
		networkConfig->inet_static 	= (network_dhcp ? false : true);
		networkConfig->address 		= network_address;
		networkConfig->netmask 		= network_netmask;
		networkConfig->broadcast 	= network_broadcast;
		networkConfig->gateway 		= network_gateway;
		networkConfig->nameserver 	= network_nameserver;

		networkConfig->commitConfig();
	}

}
Example #9
0
void CUpnpBrowserGui::selectDevice()
{
	bool loop = true;
	bool changed = true;
	neutrino_msg_t      msg;
	neutrino_msg_data_t data;

	CHintBox *scanBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_UPNPBROWSER_SCANNING)); // UTF-8
	scanBox->paint();
#if 0
	try {
		m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1");
	}
	catch (std::runtime_error error)
	{
		delete scanBox;
		ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, error.what(), CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw");
		return;
	}
#endif
	m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1");
	scanBox->hide();

	if (!m_devices.size())
	{
		ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_UPNPBROWSER_NOSERVERS, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_UPDATE);
		delete scanBox;
		return;
	}

	// control loop
	while (loop)
	{
		if (changed)
		{
			paintDevice();
			changed=false;
		}

		g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
		neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat;

		if( msg == CRCInput::RC_timeout)
		{
			// nothing
		}

		else if( msg == CRCInput::RC_home)
		{
			loop = false;
		}

		else if (msg_repeatok == CRCInput::RC_up && m_selecteddevice > 0)
		{
			m_selecteddevice--;
			if (m_selecteddevice < m_indexdevice)
				m_indexdevice-=m_listmaxshow;
			changed = true;
		}
		else if (msg_repeatok == CRCInput::RC_down && m_selecteddevice + 1 < m_devices.size())
		{
			m_selecteddevice++;
			if (m_selecteddevice + 1 > m_indexdevice + m_listmaxshow)
				m_indexdevice+=m_listmaxshow;
			changed=true;
		}
		else if( msg == CRCInput::RC_right || msg == CRCInput::RC_ok)
		{
			m_folderplay = false;
			selectItem("0");
			changed=true;
		}
		else if( msg == CRCInput::RC_blue)
		{
			scanBox->paint();
#if 0
			try {
				m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1");
			}
			catch (std::runtime_error error)
			{
				delete scanBox;
				ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, error.what(), CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw");
				return;
			}
#endif
			m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1");
			scanBox->hide();
			if (!m_devices.size())
			{
				ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_UPNPBROWSER_NOSERVERS, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_UPDATE);
				delete scanBox;
				return;
			}
			changed=true;
		}
		else if(msg == NeutrinoMessages::RECORD_START ||
			msg == NeutrinoMessages::ZAPTO ||
			msg == NeutrinoMessages::STANDBY_ON ||
			msg == NeutrinoMessages::SHUTDOWN ||
			msg == NeutrinoMessages::SLEEPTIMER)
		{
			loop=false;
			g_RCInput->postMsg(msg, data);
		}
		else if(msg == NeutrinoMessages::EVT_TIMER)
		{
			CNeutrinoApp::getInstance()->handleMsg( msg, data );
		}
		else
		{
			if( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
				loop = false;
			changed=true;
		}
#ifdef FB_BLIT	
		m_frameBuffer->blit();//FIXME
#endif		
	}
	
	delete scanBox;
}
Example #10
0
int CScreenSetup::exec(CMenuTarget* parent, const std::string &)
{
	neutrino_msg_t      msg;
	neutrino_msg_data_t data;

	int res = menu_return::RETURN_REPAINT;

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

	x_coord[0] = g_settings.screen_StartX;
	x_coord[1] = g_settings.screen_EndX;
	y_coord[0] = g_settings.screen_StartY;
	y_coord[1] = g_settings.screen_EndY;

	paint();
	
#ifdef FB_BLIT
	frameBuffer->blit();
#endif	

	selected = 0;

	unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);

	bool loop=true;
	while (loop)
	{
		g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd, true );

		if ( msg <= CRCInput::RC_MaxRC )
			timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);

		switch ( msg )
		{
			case CRCInput::RC_ok:
				// abspeichern
				g_settings.screen_StartX = x_coord[0];
				g_settings.screen_EndX = x_coord[1];
				g_settings.screen_StartY = y_coord[0];
				g_settings.screen_EndY = y_coord[1];
				loop = false;
				break;

			case CRCInput::RC_home:
				if ( ( ( g_settings.screen_StartX != x_coord[0] ) || ( g_settings.screen_EndX != x_coord[1] ) || ( g_settings.screen_StartY != y_coord[0] ) || ( g_settings.screen_EndY != y_coord[1] ) ) &&
						(ShowLocalizedMessage(LOCALE_VIDEOMENU_SCREENSETUP, LOCALE_MESSAGEBOX_DISCARD, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel))
					break;

			case CRCInput::RC_timeout:
				loop = false;
				break;

			case CRCInput::RC_red:
			case CRCInput::RC_green:
				{
					selected = ( msg == CRCInput::RC_green ) ? 1 : 0 ;

					frameBuffer->paintBoxRel(x,y, BoxWidth,BoxHeight/2, (selected==0)? COL_MENUCONTENTSELECTED_PLUS_0:COL_MENUCONTENT_PLUS_0);
					frameBuffer->paintBoxRel(x,y+BoxHeight/2, BoxWidth,BoxHeight/2, (selected==1)? COL_MENUCONTENTSELECTED_PLUS_0:COL_MENUCONTENT_PLUS_0);

					g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+30,y+BoxHeight/2, BoxWidth, g_Locale->getText(LOCALE_SCREENSETUP_UPPERLEFT ), (selected == 0)?COL_MENUCONTENTSELECTED:COL_MENUCONTENT, 0, true); // UTF-8

					g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+30,y+BoxHeight, BoxWidth, g_Locale->getText(LOCALE_SCREENSETUP_LOWERRIGHT), (selected == 1)?COL_MENUCONTENTSELECTED:COL_MENUCONTENT, 0, true); // UTF-8

					paintIcons();
					break;
				}
				
			case CRCInput::RC_up:
				{
					y_coord[selected]--;

					int min = ( selected == 0 ) ? 0 : 400;
					if ( y_coord[selected] < min )
						y_coord[selected] = min ;
					else
						paintBorder( selected );
					break;
				}
				
			case CRCInput::RC_down:
				{
					y_coord[selected]++;

					//int max = ( selected == 0 ) ? 200 : 575;
					int max = ( selected == 0 ) ? 200 : frameBuffer->getScreenHeight(true)-1;
					//printf("selected %d y %d max %d\n", selected, y_coord[selected], max);
					if ( y_coord[selected] > max )
						y_coord[selected] = max ;
					else
						paintBorder( selected );
					break;
				}
				
			case CRCInput::RC_left:
				{
					x_coord[selected]--;

					int min = ( selected == 0 ) ? 0 : 400;
					if ( x_coord[selected] < min )
						x_coord[selected] = min ;
					else
						paintBorder( selected );
					break;
				}
				
			case CRCInput::RC_right:
				{
					x_coord[selected]++;

					//int max = ( selected == 0 ) ? 200 : 719;
					int max = ( selected == 0 ) ? 200 : frameBuffer->getScreenWidth(true)-1;
					//printf("selected %d y %d max %d\n", selected, x_coord[selected], max);
					if ( x_coord[selected] > max )
						x_coord[selected] = max ;
					else
						paintBorder( selected );
					break;
				}
				
			case CRCInput::RC_favorites:
			case CRCInput::RC_sat:
				break;

			default:
				if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
				{
					loop = false;
					res = menu_return::RETURN_EXIT_ALL;
				}
		}
#ifdef FB_BLIT
		frameBuffer->blit();
#endif		
	}

	hide();
	return res;
}
int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string&)
{
	neutrino_msg_t      msg;
	neutrino_msg_data_t data;

	int res = menu_return::RETURN_REPAINT;

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

// getting all bouquets from zapit
	Bouquets.clear();
	g_Zapit->getBouquets(Bouquets, true);
	paintHead();
	paint();
	paintFoot();

	bouquetsChanged = false;

	unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]);

	bool loop=true;
	while (loop)
	{
		g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd );
		neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat;

		if ( msg <= CRCInput::RC_MaxRC )
			timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]);

		if (msg == CRCInput::RC_timeout || msg == g_settings.key_channelList_cancel)
		{
			if (state == beDefault)
			{
				if (bouquetsChanged)
				{
					int result = ShowLocalizedMessage(LOCALE_BOUQUETEDITOR_NAME, LOCALE_BOUQUETEDITOR_SAVECHANGES, CMessageBox::mbrYes, CMessageBox::mbAll);

					switch( result )
					{
						case CMessageBox::mbrYes :
							loop=false;
							saveChanges();
						break;
						case CMessageBox::mbrNo :
							loop=false;
							discardChanges();
						break;
						case CMessageBox::mbrCancel :
							paintHead();
							paint();
							paintFoot();
						break;
					}
				}
				else
				{
					loop = false;
				}
			}
			else if (state == beMoving)
			{
				cancelMoveBouquet();
			}
		}
		//
		// -- For more convenience: include browsing of list (paging)  (rasc, 2002-04-02)
		// -- The keys should be configurable. Problem is: red/green key, which is the
		// -- default in neutrino is used as a function key here... so use left/right
		//
		else if (msg_repeatok==CRCInput::RC_up || msg_repeatok == g_settings.key_channelList_pageup)
		{
			if (!(Bouquets.empty()))
			{
				int step = 0;
				int prev_selected = selected;

				step = (msg_repeatok == g_settings.key_channelList_pageup) ? listmaxshow : 1;  // browse or step 1
				selected -= step;
				if((prev_selected-step) < 0)		// because of uint
				{
					selected = Bouquets.size()-1;
				}

				if (state == beDefault)
				{
					paintItem(prev_selected - liststart);
					unsigned int oldliststart = liststart;
					liststart = (selected/listmaxshow)*listmaxshow;
					if(oldliststart!=liststart)
					{
						paint();
					}
					else
					{
						paintItem(selected - liststart);
					}
				}
				else if (state == beMoving)
				{
					internalMoveBouquet(prev_selected, selected);
				}
			}
		}
		else if (msg_repeatok == CRCInput::RC_down || msg_repeatok == g_settings.key_channelList_pagedown)
		{
			unsigned int step = 0;
			int prev_selected = selected;

			step = (msg_repeatok == g_settings.key_channelList_pagedown) ? listmaxshow : 1;  // browse or step 1
			selected += step;

			if(selected >= Bouquets.size())
			{
				if (((Bouquets.size() / listmaxshow) + 1) * listmaxshow == Bouquets.size() + listmaxshow) // last page has full entries
					selected = 0;
				else
					selected = ((step == listmaxshow) && (selected < (((Bouquets.size() / listmaxshow) + 1) * listmaxshow))) ? (Bouquets.size() - 1) : 0;
			}


			if (state == beDefault)
			{
				paintItem(prev_selected - liststart);
				unsigned int oldliststart = liststart;
				liststart = (selected/listmaxshow)*listmaxshow;
				if(oldliststart!=liststart)
				{
					paint();
				}
				else
				{
					paintItem(selected - liststart);
				}
			}
			else if (state == beMoving)
			{
				internalMoveBouquet(prev_selected, selected);
			}
		}
		else if(msg==CRCInput::RC_red)
		{
			if (state == beDefault)
				deleteBouquet();
		}
		else if(msg==CRCInput::RC_green)
		{
			if (state == beDefault)
				addBouquet();
		}
		else if(msg==CRCInput::RC_yellow)
		{
			if (selected < Bouquets.size()) /* Bouquets.size() might be 0 */
			{
				liststart = (selected/listmaxshow)*listmaxshow;
				if (state == beDefault)
					beginMoveBouquet();
				paintItem(selected - liststart);
			}
		}
		else if(msg==CRCInput::RC_blue)
		{
			if (selected < Bouquets.size()) /* Bouquets.size() might be 0 */
			{
				if (state == beDefault)
					switch (blueFunction)
					{
					case beRename:
						renameBouquet();
						break;
					case beHide:
						switchHideBouquet();
						break;
					case beLock:
						switchLockBouquet();
						break;
					}
			}
		}
		else if(msg==CRCInput::RC_setup)
		{
			if (state == beDefault)
			switch (blueFunction)
			{
				case beRename:
					blueFunction = beHide;
				break;
				case beHide:
					blueFunction = beLock;
				break;
				case beLock:
					blueFunction = beRename;
				break;
			}
			paintFoot();
		}
		else if(msg==CRCInput::RC_ok)
		{
			if (state == beDefault)
			{
				if (selected < Bouquets.size()) /* Bouquets.size() might be 0 */
				{
					CBEChannelWidget* channelWidget = new CBEChannelWidget(Bouquets[selected].name, selected);
					channelWidget->exec( this, "");
					if (channelWidget->hasChanged())
						bouquetsChanged = true;
					delete channelWidget;
					paintHead();
					paint();
					paintFoot();
				}
			}
			else if (state == beMoving)
			{
				finishMoveBouquet();
			}
		}
		else if( CRCInput::isNumeric(msg) )
		{
			if (state == beDefault)
			{
				//kein pushback - wenn man versehentlich wo draufkommt is die edit-arbeit umsonst
				//selected = oldselected;
				//g_RCInput->postMsg( msg, data );
				//loop=false;
			}
			else if (state == beMoving)
			{
				cancelMoveBouquet();
			}
		}
		else
		{
			CNeutrinoApp::getInstance()->handleMsg( msg, data );
			// kein canceling...
		}
	}
	hide();
	return res;
}
Example #12
0
int CRecordSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
	dprintf(DEBUG_DEBUG, "init record setup\n");
	int   res = menu_return::RETURN_REPAINT;
	char timeshiftDir[255];

	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;
	}
	else if(actionKey == "recordingdir") 
	{
		//parent->hide();
		const char *action_str = "recordingdir";
		if(chooserDir(g_settings.network_nfs_recordingdir, true, action_str, sizeof(g_settings.network_nfs_recordingdir)-1)){
			printf("New recordingdir: %s (timeshift %s)\n", g_settings.network_nfs_recordingdir, g_settings.timeshiftdir);
			if(strlen(g_settings.timeshiftdir) == 0) 
			{
				sprintf(timeshiftDir, "%s/.timeshift", g_settings.network_nfs_recordingdir);
				safe_mkdir(timeshiftDir);
				printf("New timeshift dir: %s\n", timeshiftDir);
			}
			CRecordManager::getInstance()->SetTimeshiftDirectory(timeshiftDir);
		}
		return res;
	}
	else if(actionKey == "timeshiftdir") 
	{
		//parent->hide();
		CFileBrowser b;
		b.Dir_Mode=true;
		if (b.exec(g_settings.timeshiftdir)) 
		{
			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, g_settings.network_nfs_recordingdir);
				if(strcmp(newdir, g_settings.network_nfs_recordingdir)) 
				{
					printf("New timeshift != rec dir\n");
					strncpy(g_settings.timeshiftdir, b.getSelectedFile()->Name.c_str(), sizeof(g_settings.timeshiftdir)-1);
					strcpy(timeshiftDir, g_settings.timeshiftdir);
				} 
				else 
				{
					sprintf(timeshiftDir, "%s/.timeshift", g_settings.network_nfs_recordingdir);
					strcpy(g_settings.timeshiftdir, newdir);
					safe_mkdir(timeshiftDir);
					printf("New timeshift == rec dir\n");
				}
				printf("New timeshift dir: %s\n", timeshiftDir);
				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;
}
Example #13
0
int CAlphaSetup::exec(CMenuTarget* parent, const std::string &)
{
    neutrino_msg_t      msg;
    neutrino_msg_data_t data;

    int res = menu_return::RETURN_REPAINT;
    if (parent)
    {
        parent->hide();
    }
    unsigned char alpha1_alt= *alpha1;
    unsigned char alpha2_alt= *alpha2;

    paint();

    int selected = 0;
    int max = 1;

    unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]);

    bool loop=true;
    while (loop)
    {
        g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);

        if ( msg <= CRCInput::RC_MaxRC )
        {
            timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
        }

        switch (msg & ~CRCInput::RC_Repeat)
        {
        case CRCInput::RC_down:
        {
            if(selected<max)
            {
                paintSlider(x + 10, y + hheight          , alpha1, LOCALE_GTXALPHA_ALPHA1, NEUTRINO_ICON_VOLUMESLIDER2     , false);
                paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, NEUTRINO_ICON_VOLUMESLIDER2     , false);

                selected++;

                switch (selected)
                {
                case 0:
                    paintSlider(x + 10, y + hheight          , alpha1, LOCALE_GTXALPHA_ALPHA1, NEUTRINO_ICON_VOLUMESLIDER2RED, true );
                    break;
                case 1:
                    paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, NEUTRINO_ICON_VOLUMESLIDER2GREEN, true );
                    break;
                }
            }
            break;
        }
        case CRCInput::RC_up:
        {
            if (selected > 0)
            {
                paintSlider(x + 10, y + hheight          , alpha1, LOCALE_GTXALPHA_ALPHA1, NEUTRINO_ICON_VOLUMESLIDER2     , false);
                paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, NEUTRINO_ICON_VOLUMESLIDER2     , false);

                selected--;

                switch (selected)
                {
                case 0:
                    paintSlider(x + 10, y + hheight          , alpha1, LOCALE_GTXALPHA_ALPHA1, NEUTRINO_ICON_VOLUMESLIDER2RED, true );
                    break;
                case 1:
                    paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, NEUTRINO_ICON_VOLUMESLIDER2GREEN, true );
                    break;
                }
            }
            break;
        }
        case CRCInput::RC_right:
        {
            switch (selected)
            {
            case 0:
                if (*alpha1<8)
                {
                    *alpha1+=1;
                    paintSlider(x + 10, y + hheight          , alpha1, LOCALE_GTXALPHA_ALPHA1, NEUTRINO_ICON_VOLUMESLIDER2RED, true );
                    frameBuffer->setBlendLevel(*alpha1, *alpha2);
                }
                break;
            case 1:
                if (*alpha2<8)
                {
                    *alpha2+=1;
                    paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, NEUTRINO_ICON_VOLUMESLIDER2GREEN, true );
                    frameBuffer->setBlendLevel(*alpha1, *alpha2);
                }
                break;
            }
            break;
        }
        case CRCInput::RC_left:
        {
            switch (selected)
            {
            case 0:
                if (*alpha1>=1)
                {
                    *alpha1-=1;
                    paintSlider(x + 10, y + hheight          , alpha1, LOCALE_GTXALPHA_ALPHA1, NEUTRINO_ICON_VOLUMESLIDER2RED, true );
                    frameBuffer->setBlendLevel(*alpha1, *alpha2);
                }
                break;
            case 1:
                if (*alpha2>=1)
                {
                    *alpha2-=1;
                    paintSlider(x + 10, y + hheight + mheight, alpha2, LOCALE_GTXALPHA_ALPHA2, NEUTRINO_ICON_VOLUMESLIDER2GREEN, true );
                    frameBuffer->setBlendLevel(*alpha1, *alpha2);
                }
                break;
            }
            break;
        }
        case CRCInput::RC_home:
            if ((*alpha1 != alpha1_alt) || (*alpha2 != alpha2_alt))
            {
                if (ShowLocalizedMessage(name, LOCALE_MESSAGEBOX_DISCARD, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel)
                {
                    break;
                }
            }

            // sonst abbruch...
            *alpha1 = alpha1_alt;
            *alpha2 = alpha2_alt;
            frameBuffer->setBlendLevel(*alpha1, *alpha2);
            loop = false;
            break;
        case CRCInput::RC_ok:
            if (msg != CRCInput::RC_ok) // ignore repeat
                break;
        /* else fallthrough */
        case CRCInput::RC_timeout:
            loop = false;
            break;

        default:
            if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all)
            {
                loop = false;
                res = menu_return::RETURN_EXIT_ALL;
            }
        }
    }

    hide();

    return res;
}