JosefNemec / Playnite

Video game library manager with support for wide range of 3rd party libraries and game emulation support, providing one unified interface for your games.
https://playnite.link
MIT License
9.08k stars 492 forks source link

Generic way of integrating extension UI elements #2646

Open JosefNemec opened 2 years ago

JosefNemec commented 2 years ago

One of the issues with current way of integrating extension UI elements is that themes have to specifically support each and every element/extension. This has an advantage in that the integration can be tailor made to each theme for elements to better fit in, but has big disadvantage that if a theme doesn't support specific extension, there's no way how to display it. This is especially big issue with default theme which doesn't support any 3rd party extensions.

So we need some way how extensions can be added to any theme and give user options to select where and how those extension elements will be displayed.

Current plan is: TBD

Mobile313 commented 2 years ago

I would like to propose an additional issue here, which is that not all themes actually bother to check that the extension is installed, and merely ASSUMES it is. This can cause issues if the end user just installed the theme thinking that all functionality (including those provided by extensions) were just going to magically work/display. I think the easiest way to fix this would be to require themes to include a list of all extensions used in the theme manifest so that Playnite knows to let the user know that there are dependencies that haven't be met yet.

As far as implementing what you described, my two cents are below:

For extensions to be used as you're describing they would need to specify the dimensions of every element they produce, so that Playnite can calculate what portions of the screen have enough room to display it properly (that way the user won't be able to accidentally move something offscreen or cause overflow issues because they're trying to cram a large item into a small container).

The easiest way to implement something like this would be to use predetermined screen regions that the extension pins/inserts into. A grid could be created, and the user simply specifies which spot in the grid to plop the extension into. Playnite MAY be able to read where existing elements are placed in the xaml views, and blackout the portions of the grid that are already being used by the theme; that way you can add this really cool functionality without stepping on the toes of the theme designers.

A significantly more complex (and subsequently much more robust) way to do this would be to change the way themes are made. If themes are forced to place all elements into modules, the user could be given the option to move those modules wherever they like using a drag and drop type GUI editor. For instance you click a button in setting to go into the GUI editor, which then gives you the ability to click on the Game-Title field, and use the arrow keys to move it up/down/left/right. This would effectively turn Playnite "themes" into GUI "templates." Going to this extreme would potentially be overkill.

JosefNemec commented 2 years ago

Themes already have a way to check if specific extension is installed or not and adjust based on that.

Mobile313 commented 2 years ago

Themes already have a way to check if specific extension is installed or not and adjust based on that.

That's true. There's a number of us that share our homebrew themes amongst ourselves, and I've noticed that some designers handle it better than others. The level that Playnite exposes the UI for UI designers is pretty impressive, but not all custom theme makers take the time to get it done at the same level as those of us who tend to show our OCD sides with this type of stuff.

darklinkpower commented 2 years ago

I would like to propose an additional issue here, which is that not all themes actually bother to check that the extension is installed, and merely ASSUMES it is

You should report issues like that to the developer of the theme. Unfortunately I've seen that themes introduce several issues like that but there's not much or nothing that can be done from Playnite's side for issues like that

As far as a generic solution, I think that the easiest and working solution is to place all extension elements in different tabs in a tabcontrol. I've done that in the Stardust and Harmony themes and in my opinion it works fine and it's easy to add new extensions since it doesn't require changes in layout.

image

I think the solutions @Mobile313 proposed would be significantly more complex to implement but they can also work

Mobile313 commented 2 years ago

As far as a generic solution, I think that the easiest and working solution is to place all extension elements in different tabs in a tabcontrol. I've done that in the Stardust and Harmony themes and in my opinion it works fine and it's easy to add new extensions since it doesn't require changes in layout.

That seems like a pretty clever workaround. Tabs seem like it would work great in desktop mode, but I think it would make things a little cumbersome for full-screen mode (especially if using a controller). Adding it to the Game Menu would make things a bit more controller friendly, but the Game Menu can be accessed from more than just the game detail page which may be problematic. The other concern with a tab approach would be that you don't really know what kind of extension (and thus space requirements) it will need. At the same time though the simplicity and elegance of a tab based system is a pretty cool approach.