Providing facility to set IP addess manually through xbmc GUI
#1
Thumbs Up 
Hi friends,
I am trying to provide facility to set IP addess manually through xbmc GUI.
I have searched on internet and have come to conclusion that it was provided many years ago but is now removed.
And to set up IP address one must set it through underlying OS, through network manager or by directly editing the "/etc/network/interfaces"
But I have to provide this facility in xbmc GUI in settings.
So,
In file "xbmc-12.0/xbmc/settings/GUISettings.cpp"
In function "void CGUISettings::Initialize()"
I added following:
PHP Code:
CSettingsCategorynetwork_settings AddCategory(SETTINGS_PREFS"network"798);

    
AddString(network_settings"network.interface",775,""SPIN_CONTROL_TEXT);

    
map<intintnetworkAssignments;
    
networkAssignments.insert(make_pair(716NETWORK_DHCP));
    
networkAssignments.insert(make_pair(717NETWORK_STATIC));
    
networkAssignments.insert(make_pair(787NETWORK_DISABLED));
    
AddInt(network_settings"network.assignment"715NETWORK_DHCPnetworkAssignmentsSPIN_CONTROL_TEXT);

    
AddString(network_settings"network.ipaddress"719"0.0.0.0"EDIT_CONTROL_IP_INPUTtrue);
    
AddString(NULL"network.ipaddress"719"0.0.0.0"EDIT_CONTROL_IP_INPUT);

    
AddString(network_settings"network.subnet"720"255.255.255.0"EDIT_CONTROL_IP_INPUTtrue);
    
AddString(network_settings"network.gateway"721"0.0.0.0"EDIT_CONTROL_IP_INPUTtrue);
    
AddString(network_settings"network.dns"722"0.0.0.0"EDIT_CONTROL_IP_INPUTtrue);
    
AddString(network_settings"network.dnssuffix"22002""EDIT_CONTROL_INPUTtrue);
    
AddString(network_settings"network.essid"776"0.0.0.0"BUTTON_CONTROL_STANDARDtrue); 

Now these are visible in desired category(new one called prefs that I have created), but they were not editable.
So then,
In function "void CGUIWindowSettingsCategory::UpdateSettings()"
I passed true for argument "enabled"
if (pControl) pControl->SetEnabled(enabled);

for the part that follows:

else if (strSetting.Equals("network.ipaddress") || strSetting.Equals("network.subnet") || strSetting.Equals("network.gateway") || strSetting.Equals("network.dns"))
and
else if (strSetting.Equals("network.assignment"))

and now they are visible + Enabled, so I can change their values, I just want to set IP address, so I set the
Assignment to Manual(Static)
and set an IP address and it got saved in "guisettings.xml" so when I restarted the xbmc those newly set values were loaded and are visible but, the IP address was never set to the operating system or computer.

Please help.
Thank You in advance.
Reply
#2
First of all the whole settings system has changed last month and CGUISettings doesn't exist anymore and CGUIWindowSettingsCategory looks quite different so your changes won't work with latest master.
Secondly all your code does is provide the setting but you're missing the code to do something with the value of the settings.
Lastly there's already necessary code for this available but not yet in official xbmc but e.g. in xbmc from pivos.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
is there any discussion or notes about changes made in last month in settings?
Reply
#4
In file "xbmc-12.0/xbmc/settings/GUISettings.cpp"
In function "void CGUISettings::Initialize()"
Following is written:
PHP Code:
CSettingsCategorynet AddCategory(SETTINGS_SYSTEM"network"798);
  if (
g_application.IsStandAlone())
  {
#if !defined(TARGET_DARWIN)
    
AddString(NULL"network.interface",775,""SPIN_CONTROL_TEXT); 
Why first argument is NULL, what does it imply, there should be net in place of NULL.
Reply
#5
It implies that it isn't part of any category so it won't appear in the GUI.

Concerning the recent settings change basically the whole settings system has changed. I started a wiki article on the new system but I don't have much time right now so it's gonna be a while before I really get to it.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#6
(2013-06-05, 10:38)Montellese Wrote: It implies that it isn't part of any category so it won't appear in the GUI.

then what is the need to even write it, could you please explain?
Reply
#7
all settings are now defined in system/settings/settings.xml and handlers are refactored completely to be modular and not one huge monolith.

defining a setting does absolutely nothing before you write the handling code.
Reply
#8
If you are looking into adding IP-address settings to GUI then you might get some ideas from this old branch
https://github.com/topfs2/xbmc/tree/network_abstraction

and also checkout these other pull requests for additional network settings that would be nice to have
https://github.com/xbmc/xbmc/pull/303
https://github.com/xbmc/xbmc/pull/131

not sure how that compare to Pivos code in maturity and work to get it acceptable for merging into mainline
(2013-06-04, 18:03)Montellese Wrote: there's already necessary code for this available but not yet in official xbmc but e.g. in xbmc from pivos
https://github.com/Pivosgroup/xbmc

(2013-06-05, 07:54)slinuxgeek Wrote: is there any discussion or notes about changes made in last month in settings?
You could just look at all Montellese's closed pull requests for settings refactoring and settings cleanup
https://github.com/xbmc/xbmc/pulls/Monte...ate=closed

I believe that the ones with the best summery descriptions are these
https://github.com/xbmc/xbmc/pull/2190
https://github.com/xbmc/xbmc/pull/2660
Reply
#9
I rebased PR303 on master, i'll get it merged and maybe it'll help you with your patch
Reply

Logout Mark Read Team Forum Stats Members Help
Providing facility to set IP addess manually through xbmc GUI0