Settings UI for ServerSettings (2 Viewers)

osre

Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    I want to do a little contribution, and I thought I start with an UI for
    MediaPortal.Common.Services.ResourceAccess.Settings.ServerSettings.
    I think I know already how, but I'm not sure where I should add it.
    I guess that "\MediaPortal\Source\UI\UiComponents\SkinBase\plugin.xml" is a good place.
    or "\MediaPortal\Incubator\ServerSettings.Client\plugin.xml"
    But where do I put the entry classes?
    In "\MediaPortal\Source\Core\MediaPortal.Common\Services\ResourceAccess\Settings\" or a sub folder like "
    "\MediaPortal\Source\Core\MediaPortal.Common\Services\ResourceAccess\Settings\ConfigurationClasses\"?
    or
    "\MediaPortal\Incubator\ServerSettings.Client\Settings\Configuration\"

    Please give me advice, and I do it.
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    I'll leave that to @morpheus_xx to answer :)
    "\MediaPortal\Incubator\ServerSettings.Client\plugin.xml is probably right, when you want to implement the possibility that you can change the settings of the MP2-Server from the client front end (that's why this plugin is called "ServerSettings".
    If you want to add the possibility to change the settings of the MP2-Client from the (same) MP2 Client, then probably MediaPortal\Source\UI\UiComponents\SkinBase\plugin.xml would be better.
    As to the settings classes, maybe this helps: http://wiki.team-mediaportal.com/2_...e/Development/4_Modules/Plugins/Configuration

    In any case: Thanks for contributing (y). Any help is appreciated!
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    I think I did it.
    Since the MultiplyEntryListController was not implemented, and I needed it for the IPBindings Setting, I implemented it also.
    It might not be perfect, but it works.
    What is missing (or not so nice so far).
    Changing these settings normally needs some reinitialization.
    Since I did not really know how I should do this, I simply added a notification, that the MediaProtal Client should be restarted.
    Even that I know how to use localized strings, I have currently hard coded these messages in the code.
    May be it would be a good idea to have some kind of global handler where a necessary restart can be notified.

    The patch is based on the Weekly branch from 2014_12_19.
    p.s. I hope the patch works, I'm not really used to use GIT.
     

    Attachments

    • ServerSettings.PNG
      ServerSettings.PNG
      1.4 MB
    • MultipleEntryListController.PNG
      MultipleEntryListController.PNG
      823.2 KB
    • patch0.patch
      18.3 KB
    • dialog_configuration_multipleentrylist.zip
      1 KB

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    I just have seen that I added the check if the ip addresses are valid to the MultipleEntryListController, which is in fact a but stupid :oops:
    I'll fix this and post the updated patch.
     

    MrTechno

    Retired Team Member
  • Premium Supporter
  • February 27, 2011
    1,256
    511
    London
    Home Country
    United Kingdom United Kingdom
    IP filtering is safe up to a point. Loopback and localhost are always bound to so you can talk from client to server on the same machine. It's still possible to use invalid settings by editing the file directly but less likely that anyone will do this if you can do it from the GUI
     

    MrTechno

    Retired Team Member
  • Premium Supporter
  • February 27, 2011
    1,256
    511
    London
    Home Country
    United Kingdom United Kingdom
    What should probably happen is the startup check should make sure there's at least one entry in the filtered list and if not fall back to the full unfiltered list and set a user error notification
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    What should probably happen is the startup check should make sure there's at least one entry in the filtered list and if not fall back to the full unfiltered list and set a user error notification
    An empty list (the default) will result in no filtering, which should be allowed I think.
    If someone enters an invalid IP address, and nothing works anymore, then an error notification would be a good thing I guess. But so far I did not modify anything in the initialization. I made the settings available from UI (with a simple check if a IP entry is really an IP.[DOUBLEPOST=1419695137][/DOUBLEPOST]I've moved the check for valid IP addresses to the IPAddressBindingSetting and added copyright notices and some comments to the code.
    patch0-updated.patch replaces the patch0.patch, means the weekly branch is the direct base.
    If you have already applies the patch0.patch, you can apply patch1.patch to get the latest modifications.
     

    Attachments

    • patch0-updated.patch
      24.8 KB
    • patch1.patch
      16.1 KB
    Last edited:

    MrTechno

    Retired Team Member
  • Premium Supporter
  • February 27, 2011
    1,256
    511
    London
    Home Country
    United Kingdom United Kingdom
    When you say invalid are you using a regex or does it check against the list of IPs assigned to the machine?
     

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,948
    5,617
    France - IDF
    Home Country
    France France
    hello Osre,
    welcome in our community, i can't help on developing side, all our dev are great and have experience with MP. (y) so don't hesitate to their ask.
    what i can say, is don't forget to provide an small wiki page on how work your plugin and what can done... i know it's a bit young ... for now

    Thank you for your contribution, and happy christmas.
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    775
    387
    Home Country
    Germany Germany
    I just use IPAddress.TryParse()
    When you say invalid are you using a regex or does it check against the list of IPs assigned to the machine?
    I use IPAddress.TryParse().
    Checking the actual list of available addresses is a good idea.
    It would also not be a bad idea to use MultipleSelectionListController, prefilled with all actual addresses of the system.
    But my soulution made me implement the MultipleEntryListController, which was kinda fun for my 1st contribution[DOUBLEPOST=1419695673][/DOUBLEPOST]
    hello Osre,
    welcome in our community, i can't help on developing side, all our dev are great and have experience with MP. (y) so don't hesitate to their ask.
    what i can say, is don't forget to provide an small wiki page on how work your plugin and what can done... i know it's a bit young ... for now

    Thank you for your contribution, and happy christmas.
    Thank you for the warm welcome.
    My contribution is not an plugin on it's own, it is an extension to the core, which hopefully will be added to MP2 by one of the devs.
    Generally it allows to edit several of the settings, which were not editable via the GUI so far.
     

    Users who are viewing this thread

    Top Bottom