gui/network_setup.cpp: add menu hints

This commit is contained in:
[CST] Focus
2012-07-08 21:39:15 +04:00
parent 8e79f096e0
commit d4a73f654b

View File

@@ -198,6 +198,7 @@ int CNetworkSetup::showNetworkSetup()
int ifcount = scandir("/sys/class/net", &namelist, my_filter, alphasort);
CMenuOptionStringChooser * ifSelect = new CMenuOptionStringChooser(LOCALE_NETWORKMENU_SELECT_IF, g_settings.ifname, ifcount > 1, this, CRCInput::RC_nokey, "", true);
ifSelect->setHint("", LOCALE_MENU_HINT_NET_IF);
bool found = false;
@@ -224,6 +225,7 @@ int CNetworkSetup::showNetworkSetup()
//apply button
CMenuForwarder *m0 = new CMenuForwarder(LOCALE_NETWORKMENU_SETUPNOW, true, NULL, this, "networkapply", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
m0->setHint("", LOCALE_MENU_HINT_NET_SETUPNOW);
//eth id
CMenuForwarder *mac = new CMenuForwarderNonLocalized("MAC", false, mac_addr);
@@ -240,6 +242,7 @@ int CNetworkSetup::showNetworkSetup()
//auto start
CMenuOptionChooser* o1 = new CMenuOptionChooser(LOCALE_NETWORKMENU_SETUPONSTARTUP, &network_automatic_start, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
o1->setHint("", LOCALE_MENU_HINT_NET_SETUPONSTARTUP);
//dhcp
network_dhcp = networkConfig->inet_static ? NETWORK_DHCP_OFF : NETWORK_DHCP_ON;
@@ -251,6 +254,13 @@ int CNetworkSetup::showNetworkSetup()
CMenuForwarder *m5 = new CMenuForwarder(LOCALE_NETWORKMENU_NAMESERVER, networkConfig->inet_static, network_nameserver, &networkSettings_NameServer);
CMenuForwarder *m8 = new CMenuForwarder(LOCALE_NETWORKMENU_HOSTNAME , true , network_hostname , &networkSettings_Hostname );
m1->setHint("", LOCALE_MENU_HINT_NET_IPADDRESS);
m2->setHint("", LOCALE_MENU_HINT_NET_NETMASK);
m3->setHint("", LOCALE_MENU_HINT_NET_BROADCAST);
m4->setHint("", LOCALE_MENU_HINT_NET_GATEWAY);
m5->setHint("", LOCALE_MENU_HINT_NET_NAMESERVER);
m8->setHint("", LOCALE_MENU_HINT_NET_HOSTNAME);
dhcpDisable[0] = m1;
dhcpDisable[1] = m2;
dhcpDisable[2] = m3;
@@ -258,13 +268,20 @@ int CNetworkSetup::showNetworkSetup()
dhcpDisable[4] = m5;
CMenuOptionChooser* o2 = new CMenuOptionChooser(LOCALE_NETWORKMENU_DHCP, &network_dhcp, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
o2->setHint("", LOCALE_MENU_HINT_NET_DHCP);
//paint menu items
networkSettings->addIntroItems(LOCALE_MAINSETTINGS_NETWORK); //intros
//-------------------------------------------------
networkSettings->addItem( m0 ); //apply
networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_TEST, true, NULL, this, "networktest", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); //test
networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_SHOW, true, NULL, this, "networkshow", CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP)); //show settings
CMenuForwarder * mf = new CMenuForwarder(LOCALE_NETWORKMENU_TEST, true, NULL, this, "networktest", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mf->setHint("", LOCALE_MENU_HINT_NET_TEST);
networkSettings->addItem(mf); //test
mf = new CMenuForwarder(LOCALE_NETWORKMENU_SHOW, true, NULL, this, "networkshow", CRCInput::RC_info, NEUTRINO_ICON_BUTTON_INFO);
mf->setHint("", LOCALE_MENU_HINT_NET_SHOW);
networkSettings->addItem(mf); //show settings
networkSettings->addItem(GenericMenuSeparatorLine);
//------------------------------------------------
if(ifcount)
@@ -300,6 +317,9 @@ int CNetworkSetup::showNetworkSetup()
CMenuForwarder *m9 = new CMenuDForwarder(LOCALE_NETWORKMENU_SSID , networkConfig->wireless, network_ssid , networkSettings_ssid );
CMenuForwarder *m10 = new CMenuDForwarder(LOCALE_NETWORKMENU_PASSWORD , networkConfig->wireless, network_key , networkSettings_key );
m9->setHint("", LOCALE_MENU_HINT_NET_SSID);
m10->setHint("", LOCALE_MENU_HINT_NET_PASS);
wlanEnable[0] = m9;
wlanEnable[1] = m10;
@@ -311,21 +331,30 @@ int CNetworkSetup::showNetworkSetup()
//ntp submenu
sectionsdConfigNotifier = new CSectionsdConfigNotifier;
CMenuWidget ntp(LOCALE_MAINSETTINGS_NETWORK, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_NETWORKSETUP_NTP);
networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_NTPTITLE, true, NULL, &ntp, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
mf = new CMenuForwarder(LOCALE_NETWORKMENU_NTPTITLE, true, NULL, &ntp, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW);
mf->setHint("", LOCALE_MENU_HINT_NET_NTP);
networkSettings->addItem(mf);
showNetworkNTPSetup(&ntp);
//nfs mount submenu
CMenuWidget networkmounts(LOCALE_MAINSETTINGS_NETWORK, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_NETWORKSETUP_MOUNTS);
networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_MOUNT, true, NULL, &networkmounts, NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));
mf = new CMenuForwarder(LOCALE_NETWORKMENU_MOUNT, true, NULL, &networkmounts, NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE);
mf->setHint("", LOCALE_MENU_HINT_NET_MOUNT);
networkSettings->addItem(mf);
showNetworkNFSMounts(&networkmounts);
//proxyserver submenu
CProxySetup proxy(LOCALE_MAINSETTINGS_NETWORK);
networkSettings->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_PROXYSERVER_SEP, true, NULL, &proxy, NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0));
mf = new CMenuForwarder(LOCALE_FLASHUPDATE_PROXYSERVER_SEP, true, NULL, &proxy, NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0);
mf->setHint("", LOCALE_MENU_HINT_NET_PROXY);
networkSettings->addItem(mf);
//services
CNetworkServiceSetup services;
networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_SERVICES, true, NULL, &services, NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1));
mf = new CMenuForwarder(LOCALE_NETWORKMENU_SERVICES, true, NULL, &services, NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1);
mf->setHint("", LOCALE_MENU_HINT_NET_SERVICES);
networkSettings->addItem(mf);
int ret = 0;
while(true) {
@@ -354,6 +383,10 @@ void CNetworkSetup::showNetworkNTPSetup(CMenuWidget *menu_ntp)
CMenuForwarder *ntp2 = new CMenuDForwarder( LOCALE_NETWORKMENU_NTPSERVER, true , g_settings.network_ntpserver, networkSettings_NtpServer );
CMenuForwarder *ntp3 = new CMenuDForwarder( LOCALE_NETWORKMENU_NTPREFRESH, true , g_settings.network_ntprefresh, networkSettings_NtpRefresh );
ntp1->setHint("", LOCALE_MENU_HINT_NET_NTPENABLE);
ntp2->setHint("", LOCALE_MENU_HINT_NET_NTPSERVER);
ntp3->setHint("", LOCALE_MENU_HINT_NET_NTPREFRESH);
menu_ntp->addIntroItems(LOCALE_NETWORKMENU_NTPTITLE);
menu_ntp->addItem( ntp1);
menu_ntp->addItem( ntp2);
@@ -363,8 +396,12 @@ void CNetworkSetup::showNetworkNTPSetup(CMenuWidget *menu_ntp)
void CNetworkSetup::showNetworkNFSMounts(CMenuWidget *menu_nfs)
{
menu_nfs->addIntroItems(LOCALE_NETWORKMENU_MOUNT);
menu_nfs->addItem(new CMenuDForwarder(LOCALE_NFS_MOUNT , true, NULL, new CNFSMountGui(), NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
menu_nfs->addItem(new CMenuDForwarder(LOCALE_NFS_UMOUNT, true, NULL, new CNFSUmountGui(), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
CMenuForwarder * mf = new CMenuDForwarder(LOCALE_NFS_MOUNT , true, NULL, new CNFSMountGui(), NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
mf->setHint("", LOCALE_MENU_HINT_NET_NFS_MOUNT);
menu_nfs->addItem(mf);
mf = new CMenuDForwarder(LOCALE_NFS_UMOUNT, true, NULL, new CNFSUmountGui(), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mf->setHint("", LOCALE_MENU_HINT_NET_NFS_UMOUNT);
menu_nfs->addItem(mf);
}
typedef struct n_isettings_t