[Approved] - Patch to allow skins to open plugins with a parameter *Updated for 1.1*

Discussion in 'Archive' started by DieBagger, December 1, 2009.

  1. DieBagger
    • Premium Supporter

    DieBagger Retired Team Member

    Joined:
    September 11, 2007
    Messages:
    2,516
    Likes Received:
    1,257
    Gender:
    Male
    Occupation:
    Android Developer
    Location:
    Austria
    Ratings:
    +1,302 / 0
    Home Country:
    Austria Austria
    Show System Specs
    The original idea can be found here: https://forum.team-mediaportal.com/improvement-suggestions-46/allow-skins-plugins-parameters-74058/

    I'll outline the idea again: The patch adds a new property (hyperlinkParameter) to GUIButtonControl. This property will be passed to the plugin that is opened with the hyperlink property. The plugin can then open a specific view/site/part of the plugin, depending on the parameter.

    Here are some usecases for a few of the most popular plugins:

    MovingPictures
    The BasicHome screen contains two hyperlinks to MovingPictures with two different hyperlinkParameters
    • Link 1 is named "Kids Movies" and will open MovingPictures with the category defined for save usage by the children
    • Link2 is named "Movies" and will open MovingPictures and show all movies (it may be secured with a pin)

    MP-TVSeries

    The BasicHome of skin x contains two links to mp-tvseries each with a different hyperlinkParameter
    • Link 1 will open mp-tvseries and show Bobs Favorite series
    • Link2 will open Janes favorite series
    • Link3 will show all shows for the kids

    OnlineVideos
    BasicHome will have own icons for OnlineVideos->Youtube and OnlineVideos->GameTrailers, you get the idea ;)

    Other Plugins
    • MyTrailers can be called from other plugins with an imdb id as parameter, MyTrailers will show trailer for this specific movie
    • Weather plugin could be called for different cities
    • ...

    Implementation
    That's why I think why this patch would provide an improvement to MediaPortal, now here's what I've done:
    - Added skin property to GuiButtonControl class
    Code (Text):
    1. [XMLSkinElement("hyperlinkParameter")] protected string _hyperLinkParameter = "";
    - When button is pressed and contains a hyperlink AND a hyperlinkParameter the method
    Code (Text):
    1. GUIWindowManager.ActivateWindow((int)_hyperLinkWindowId, _hyperLinkParameter);
    2.  
    is called instead of
    Code (Text):
    1. GUIWindowManager.ActivateWindow((int)_hyperLinkWindowId);
    - the parameter will be added (as lpVoid) to the GuiMessage GUI_MSG_WINDOW_INIT
    - in the GUIWindow class, the parameter will be stored in the new field _loadParameter
    Code (Text):
    1. protected string _loadParameter = null;
    - a plugin can then check if(_loadParameter != null) in the OnPageLoad() method



    Remarks:
    • I did consider using a second OnPageLoad(string parameter) method but this would cause sideeffects with the overrides
    • I talked to fforde (movingpictures) and damienh (mp-tvseries) and both agreed that a simple string would be sufficient as a parameter
    • This is my first patch so please be gentle :p Comments are very welcome!

    Patch: View attachment AllowSkinToOpenPluginWithParameter.patch


    Files for testing (Needs the latest svn snapshot and MovingPictures 1.0 installed), just overwrite the files with the ones included in the rar file and you'll have a BasicHome that opens moving pictures in different category views.
    View attachment LoadMovingPicturesWithSpecifiedCategory.rar
    • Modified BasicHome.xml for Blue3Wide
    • Modified MovingPictures 1.0
    • Modified Core.dll (including the changes)
     
    • Like Like x 10
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. ltfearme
    • Premium Supporter

    ltfearme Community Plugin Dev

    Joined:
    June 10, 2007
    Messages:
    6,562
    Likes Received:
    4,439
    Gender:
    Male
    Occupation:
    Software Test Engineer
    Location:
    Sydney
    Ratings:
    +5,663 / 0
    Home Country:
    Australia Australia
    Great enhancement, im sure others whom ask for multiple instances of a plugin will agree :)

    I will definitely support adding this to TVSeries once its approved.
     
  4. fforde

    fforde Community Plugin Dev

    Joined:
    June 7, 2007
    Messages:
    2,666
    Likes Received:
    1,690
    Occupation:
    Software Engineer
    Location:
    Texas
    Ratings:
    +1,696 / 0
    Home Country:
    United States of America United States of America
    Fantastic work DieBagger. I definitely look forward to this patch making it into MP! Well done. :)


    :D
     
  5. rekenaar
    • Premium Supporter

    rekenaar Retired Team Member

    Joined:
    December 17, 2006
    Messages:
    4,421
    Likes Received:
    782
    Ratings:
    +785 / 0
    Home Country:
    South Africa South Africa
    Great work.

    We will of course have to wait until MediaPortal 1.1.0 final has been released before the patch will be evaluated by our devs.
     
  6. fforde

    fforde Community Plugin Dev

    Joined:
    June 7, 2007
    Messages:
    2,666
    Likes Received:
    1,690
    Occupation:
    Software Engineer
    Location:
    Texas
    Ratings:
    +1,696 / 0
    Home Country:
    United States of America United States of America
    Would it make sense to evaluate now and if it looks good schedule it on mantis? Would hate to see a great patch like this lost in the shuffle.
     
  7. Inker
    • Premium Supporter

    Inker Retired Team Member

    Joined:
    December 6, 2004
    Messages:
    2,055
    Likes Received:
    319
    Ratings:
    +319 / 0
    Re: Patch to allow skins to open plugins with a parameter

    Just giving this a bump as I agree, this would be a fantastic addition which opens up many new possibilities. Hope it won't be forgotten :)
     
  8. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    Re: Patch to allow skins to open plugins with a parameter

    Nice Addition! Would love to see this in MePo as well.
     
  9. chemelli
    • Premium Supporter

    chemelli Retired Team Member

    Joined:
    September 28, 2006
    Messages:
    6,159
    Likes Received:
    1,126
    Gender:
    Male
    Occupation:
    Activation Manager - Cloud Services
    Location:
    Trento, Italy
    Ratings:
    +1,127 / 0
    Home Country:
    Italy Italy
    Re: Patch to allow skins to open plugins with a parameter

    :D for help improving MP.

    As you may now MP is currently in feature freeze so we have to postpone the validation of your patch.

    Cheers,
    Simone
     
  10. DieBagger
    • Premium Supporter

    DieBagger Retired Team Member

    Joined:
    September 11, 2007
    Messages:
    2,516
    Likes Received:
    1,257
    Gender:
    Male
    Occupation:
    Android Developer
    Location:
    Austria
    Ratings:
    +1,302 / 0
    Home Country:
    Austria Austria
    Show System Specs
    Ok, so since the patch sadly didn't make it into 1.1, here's the updated version for the current svn. The changes I did are pretty much the same as in the original patch, I tested it with a modified version of moving pictures that will directly open the category that is specified with the parameter.

    Patch:
    View attachment AllowSkinToOpenPluginWithParameter.patch

    Compiled Testversion:

    This archive includes the patched core.dll, a modified basic home of blue3wide and the modified moving picutures binaries. Just override the existing files (don't forget to backup ;)) and you'll get a basichome from which you can directly open the following categories of movingpictures:
    • All movies
    • Unwatched Movies
    • Genres
    • Recently Added
    • Year

    View attachment OpenMovingPicturesWithParameter.rar

    :D
     
    • Like Like x 7
  11. DieBagger
    • Premium Supporter

    DieBagger Retired Team Member

    Joined:
    September 11, 2007
    Messages:
    2,516
    Likes Received:
    1,257
    Gender:
    Male
    Occupation:
    Android Developer
    Location:
    Austria
    Ratings:
    +1,302 / 0
    Home Country:
    Austria Austria
    Show System Specs
    Anyone? ^^
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!