예제 #1
0
//restores settings
void CNetworkSetup::restoreNetworkSettings()
{
	g_settings.ifname = old_ifname;
	networkConfig->readConfig(g_settings.ifname);//FIXME ?

	mac_addr			= networkConfig->mac_addr;

	network_automatic_start		= old_network_automatic_start;
	network_dhcp			= old_network_dhcp;
	network_address			= old_network_address;
	network_netmask			= old_network_netmask;
	setBroadcast();
	network_nameserver		= old_network_nameserver;
	network_gateway			= old_network_gateway;
	network_hostname		= old_network_hostname;
	network_ssid			= old_network_ssid;
	network_key			= old_network_key;

	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->hostname 	= network_hostname;
	networkConfig->ssid 		= network_ssid;
	networkConfig->key 		= network_key;

	networkConfig->commitConfig();
	changeNotify(LOCALE_NETWORKMENU_SELECT_IF, NULL);
}
예제 #2
0
bool CNetworkSetup::changeNotify(const neutrino_locale_t locale, void * Data)
{
	if(locale == LOCALE_NETWORKMENU_IPADDRESS) {
		char ip[16];
		unsigned char _ip[4];
		sscanf((char*) Data, "%hhu.%hhu.%hhu.%hhu", &_ip[0], &_ip[1], &_ip[2], &_ip[3]);

		sprintf(ip, "%hhu.%hhu.%hhu.255", _ip[0], _ip[1], _ip[2]);
		networkConfig->broadcast = ip;
		network_broadcast = networkConfig->broadcast;

		networkConfig->netmask = (_ip[0] == 10) ? "255.0.0.0" : "255.255.255.0";
		network_netmask = networkConfig->netmask;

	} else if(locale == LOCALE_NETWORKMENU_SELECT_IF) {
		networkConfig->readConfig(g_settings.ifname);
		readNetworkSettings();
		printf("CNetworkSetup::changeNotify: using %s, static %d\n", g_settings.ifname, CNetworkConfig::getInstance()->inet_static);

		changeNotify(LOCALE_NETWORKMENU_DHCP, &CNetworkConfig::getInstance()->inet_static);

		int ecnt = sizeof(wlanEnable) / sizeof(CMenuForwarder*);
		for(int i = 0; i < ecnt; i++)
			wlanEnable[i]->setActive(CNetworkConfig::getInstance()->wireless);

	} else if(locale == LOCALE_NETWORKMENU_DHCP) {
		CNetworkConfig::getInstance()->inet_static = (network_dhcp == NETWORK_DHCP_OFF);
		int ecnt = sizeof(dhcpDisable) / sizeof(CMenuForwarder*);

		for(int i = 0; i < ecnt; i++)
			dhcpDisable[i]->setActive(CNetworkConfig::getInstance()->inet_static);
	}
	return false;
}
예제 #3
0
// IP notifier
bool CIPChangeNotifier::changeNotify(const neutrino_locale_t locale, void * Data)
{
	if(locale == LOCALE_NETWORKMENU_IPADDRESS) 
	{
		char ip[16];
		unsigned char _ip[4];
		sscanf((char*) Data, "%hhu.%hhu.%hhu.%hhu", &_ip[0], &_ip[1], &_ip[2], &_ip[3]);

		sprintf(ip, "%hhu.%hhu.%hhu.255", _ip[0], _ip[1], _ip[2]);
		CNetworkSettings::getInstance()->networkConfig->broadcast = ip;

		CNetworkSettings::getInstance()->networkConfig->netmask = (_ip[0] == 10) ? "255.0.0.0" : "255.255.255.0";
	}
	else if(locale == LOCALE_NETWORKMENU_SELECT_IF) 
	{
		CNetworkSettings::getInstance()->networkConfig->readConfig(g_settings.ifname);
		//readNetworkSettings(); //???
		
		dprintf(DEBUG_NORMAL, "CNetworkSetup::changeNotify: using %s, static %d\n", g_settings.ifname, CNetworkSettings::getInstance()->networkConfig->inet_static);

		changeNotify(LOCALE_NETWORKMENU_DHCP, &CNetworkSettings::getInstance()->networkConfig->inet_static);

		int ecnt = sizeof(CNetworkSettings::getInstance()->wlanEnable) / sizeof(CMenuItem*);

		for(int i = 0; i < ecnt; i++)
			CNetworkSettings::getInstance()->wlanEnable[i]->setActive(CNetworkSettings::getInstance()->networkConfig->wireless);

	}

	return true;
}
// online services
int CMiscMenue::showMiscSettingsMenuOnlineServices()
{
	CMenuWidget *ms_oservices = new CMenuWidget(LOCALE_MISCSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_MISCSETUP_ONLINESERVICES);
	ms_oservices->addIntroItems(LOCALE_MISCSETTINGS_ONLINESERVICES);

	tmdb_onoff = new CMenuOptionChooser(LOCALE_TMDB_ENABLED, &g_settings.tmdb_enabled, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, check_tmdb_api_key());
	tmdb_onoff->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_TMDB_ENABLED);
	ms_oservices->addItem(tmdb_onoff);

	changeNotify(LOCALE_TMDB_API_KEY, NULL);
	CKeyboardInput tmdb_api_key_input(LOCALE_TMDB_API_KEY, &g_settings.tmdb_api_key, 32, this);
	CMenuForwarder *mf = new CMenuForwarder(LOCALE_TMDB_API_KEY, true, tmdb_api_key_short, &tmdb_api_key_input);
	mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_TMDB_API_KEY);
	ms_oservices->addItem(mf);

	ms_oservices->addItem(GenericMenuSeparator);

	youtube_onoff = new CMenuOptionChooser(LOCALE_YOUTUBE_ENABLED, &g_settings.youtube_enabled, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, check_youtube_dev_id());
	youtube_onoff->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_YOUTUBE_ENABLED);
	ms_oservices->addItem(youtube_onoff);

	changeNotify(LOCALE_YOUTUBE_DEV_ID, NULL);
	CKeyboardInput youtube_dev_id_input(LOCALE_YOUTUBE_DEV_ID, &g_settings.youtube_dev_id, 39, this);
	mf = new CMenuForwarder(LOCALE_YOUTUBE_DEV_ID, true, youtube_dev_id_short, &youtube_dev_id_input);
	mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_YOUTUBE_DEV_ID);
	ms_oservices->addItem(mf);

	ms_oservices->addItem(GenericMenuSeparator);

	shoutcast_onoff = new CMenuOptionChooser(LOCALE_SHOUTCAST_ENABLED, &g_settings.shoutcast_enabled, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, check_shoutcast_dev_id());
	shoutcast_onoff->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_SHOUTCAST_ENABLED);
	ms_oservices->addItem(shoutcast_onoff);

	changeNotify(LOCALE_SHOUTCAST_DEV_ID, NULL);
	CKeyboardInput shoutcast_dev_id_input(LOCALE_SHOUTCAST_DEV_ID, &g_settings.shoutcast_dev_id, 16, this);
	mf = new CMenuForwarder(LOCALE_SHOUTCAST_DEV_ID, true, shoutcast_dev_id_short, &shoutcast_dev_id_input);
	mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_SHOUTCAST_DEV_ID);
	ms_oservices->addItem(mf);

	int res = ms_oservices->exec(NULL, "");
	delete ms_oservices;
	return res;
}
예제 #5
0
bool CNetworkSetup::changeNotify(const neutrino_locale_t locale, void * /*Data*/)
{
	if(locale == LOCALE_NETWORKMENU_IPADDRESS) {
		setBroadcast();
	} else if(locale == LOCALE_NETWORKMENU_NETMASK) {
		setBroadcast();
	} else if(locale == LOCALE_NETWORKMENU_SELECT_IF) {
		networkConfig->readConfig(g_settings.ifname);
		readNetworkSettings();
		printf("CNetworkSetup::changeNotify: using %s, static %d\n", g_settings.ifname.c_str(), CNetworkConfig::getInstance()->inet_static);

		changeNotify(LOCALE_NETWORKMENU_DHCP, &CNetworkConfig::getInstance()->inet_static);

		wlanEnable.Activate(CNetworkConfig::getInstance()->wireless);
	} else if(locale == LOCALE_NETWORKMENU_DHCP) {
		CNetworkConfig::getInstance()->inet_static = (network_dhcp == NETWORK_DHCP_OFF);
		dhcpDisable.Activate(CNetworkConfig::getInstance()->inet_static);
	}
	return false;
}
CKeybindSetup::CKeybindSetup()
{
	changeNotify(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, NULL);

	width = w_max (40, 10);
}