sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.05k stars 70 forks source link

SteamGridDB: Implement GUI for getSteamGridDBArtwork command #1007

Closed sonic2kk closed 6 months ago

sonic2kk commented 6 months ago

Implements #933.

Overview

This PR adds a GUI dialog frontend for the commandlineGetSteamGridDBArtwork SteamGridDB command, fully implementing the work for #933 and completing the SteamGridDB Overhaul. It allows a user to enter information on the frontend instead of manually entering it all on the commandline, which is a small Quality of Life enhancement.

The options on this dialog are essentially a form for taking input for the SteamGridDB Command.

image

Implementation

Not much to add to this since the bulk of the implementation detail is for commandlineGetSteamGridDBArtwork.

Usage: steamtinkerlaunch sgdb <appid>

This works by the user running the sgdb command and give it an AppID, and then a dialog appears, allowing them to enter information to download artwork from SteamGridDB for that specific game. They can search for artwork using a Steam AppID (it doesn't have to be the AppID of the current game, i.e. they can get artwork for a version of a game on Steam that they don't own if it has better artwork), the SteamGridDB Game ID, or they can attempt to get artwork from a fuzzy Game Name search. SteamGridDB has an endpoint for fetching artwork by Game Name. This is all implemented on the commandlineGetSteamGridDBArtwork function, we just massage some of the entered data to make it easier to pass to the command.

Managing Game Type Search

We use a variable to denote if we pass --steam or --nonsteam to the commandlineGetSteamGridDBArtwork command, and we set this variable based on whether the user

If the user enters a Steam AppID, it will take priority and we will assume we're searching for artwork for a Steam game. Otherwise, we will search based on the SteamGridDB Game ID and assume we're using its game endpoint.

Since the command takes the AppID of a specific Steam game, we can force the filename AppID to this file, as we have the context of what AppID the user wants to set the SteamGridDB game artwork for. Therefore we should be able to search for artwork for a Non-Steam Game using a Steam AppID (for example, if using the GOG release of Oblivion, the user could still use the Steam AppID to fetch the game artwork, since the grids will use the --filename-appid).

Some Specified Defaults

For selecting how to handle existing grids, we have a combobox, and this defaults to the option selected on the Global Menu just like the command does, except we select it visually as the default option on the GUI.

We also default to having the "Apply" option enabled, as it is probably sensible to have this on by default for the GUI portion of this work. A user can toggle it off and it is more likely that from the GUI a user will want the default behaviour to be that grids are set on Steam.

Remaining Work

This still needs a lot of testing, it's not ready for merging yet. There are also some other UI changes I want to make, such as changing the dialog size, and adding the notifier. I have noted the remaining work in a checklist under the "TODO" section at the bottom of this PR.


TODO:

sonic2kk commented 6 months ago

Updated the description to be a bit more informative, updated the heading to display the Game Name and AppID to add visual clarity for the current game, and added the showPic for further visual clarity. If the showPic is not found, the "Game Name (AppID)" in the title should help make it clearer what the current game is, this way the user should be less likely to forget what the game they're downloading artwork for is.

image

sonic2kk commented 6 months ago

Can't figure out how to change the window dimensions, maybe this is some Wayland weirdness with Yad so I'll leave it be.

sonic2kk commented 6 months ago

Had to make a couple of fixes, but as of 1ea5a89, this is working in initial testing!

Tested with Persona 4 Golden (Steam) and the artwork downloaded and applied perfectly. Did not test the SteamGridDB Game ID yet, or Game Name, or Non-Steam Games. I also need to test the Apply checkbox to make sure it works, as well as the override for how to manage existing grids.

sonic2kk commented 6 months ago

Removed some comments and unneeded logging, and as of 4e8d0dd, ShellCheck is green on this. I will do a final check before merging (not ready to merge yet) but good progress is being made at a surprising rate.

sonic2kk commented 6 months ago

Helpscreen has been updated. Remaining work:

sonic2kk commented 6 months ago

Tested SteamGridDB Game Name, works as expected for Steam and Non-Steam Games.

sonic2kk commented 6 months ago

Added notifier and some extra echo output for downloading SteamGridDB artwork, and a notifier on error when no Steam AppID, SteamGridDB Game ID, or Game Name is provided.

sonic2kk commented 6 months ago

Non-Steam Games are not displaying their titles because of a bug with getTitleFromID which will be fixed with #1011.

sonic2kk commented 6 months ago

Tested toggling the "Apply" checkbox and it works as expected.

sonic2kk commented 6 months ago

Tested SteamGridDB Game ID, works as expected.

sonic2kk commented 6 months ago

Tested the "Existing grids" dropdown, works as expected as well!

sonic2kk commented 6 months ago

The notifier is going to need changed, as my idea of displaying when a game is "Steam" and "Non-Steam" does not work. It is using --nonsteam when using SteamGridDB Game ID or Game Name, even for a Steam Game, which is correct behaviour but incorrect for the notifier. For example, using SteamGridDB Game ID 5259688 for PowerWash Simulator would display in the notifier that it was a Non-Steam Game, even though it isn't. Likewise, using a Steam Store AppID 22330 to fetch artwork for "The Elder Scrolls IV: Oblivion Game of the Year Edition" even if the AppID is for a Non-Steam Game (such as the GOG release), it would incorrectly display that it was downloading artwork for a Steam game.

I will push a fix soon.

sonic2kk commented 6 months ago

Notifier is fixed in 7cdc7d5.

sonic2kk commented 6 months ago

Testing for this PR is now complete. The remaining work is some last minute code checks, then some phrasing checks + langfile update, and finally a wiki update and a merge.

sonic2kk commented 6 months ago

Langfiles updated, phrasing looks ok.

sonic2kk commented 6 months ago

Testing is good on this, code is ready, langfiles updated, version bumped, ShellCheck is green.

I will write the wiki update and then this will be ready to merge!

sonic2kk commented 6 months ago

Wiki update is ready, this can be merged!