pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

Qt: Add Custom background support

Open kamfretoz opened this issue 6 months ago • 12 comments

Description of Changes

This PR adds the ability to set custom background on the game list.

Preview: Screenshot_20250526_204507 Screenshot_20250526_204651 image Screenshot_20250526_204732

Rationale behind Changes

Nice eye-candy and more customizations

Suggested Testing Steps

To set a custom image: View -> Set Custom Background

Things to test:

  • Applying custom background
  • Removing custom background

Known issues so far:

  • ~~The background doesn't get cleared automatically when clearing the custom background~~
  • ~~Unreadable text when using bright backgrounds~~

Did you use AI to help find, test, or implement this issue or feature?

Nuh-uh

kamfretoz avatar May 26 '25 14:05 kamfretoz

In future we could add a customisable dark filter on top for easier reading gamelist itself in as a sort of pseudo dropshadow that movie subtitles would do.

The current form limits the usecase to less viable screenshots.

But it's good for now to add some more personality (or make people crazy with meme images)

RedDevilus avatar May 26 '25 14:05 RedDevilus

Yeah i do hope to add some kind of brightness/opacity option (or drop shadow for texts if viable) and cropping mode in the future.

kamfretoz avatar May 26 '25 14:05 kamfretoz

Works quiet well! (Arch linux based distro)

Screenshot_20250526_113148 image

AmandaRoseChaqueta avatar May 26 '25 16:05 AmandaRoseChaqueta

I remember I previously said this could be implemented by subclassing QStackedWidget and overriding the paint event. I think I may have been overthinking that, ~~what you're doing is probably fine~~ (edit: actually, the palette approach does have issues, see below).

A few things I noticed:

  • The option to clear the background image currently doesn't work for me. It looks like it's because of an incorrect if (path.empty()) check right at the start of GameListWidget::setCustomBackground.
  • The background is currently being drawn by the viewport widgets inside the QTableView and GameListGridListView widgets rather than the QStackedWidget itself (verified with GammaRay) since the palette is inherited. This means that the space for the image is ever so slightly different depending on which one is visible (hence with the table view the bottom of the image is getting cut off slightly as it's offset by the header).

chaoticgd avatar May 26 '25 22:05 chaoticgd

A few things I noticed:

  • The option to clear the background image currently doesn't work for me. It looks like it's because of an incorrect if (path.empty()) check right at the start of GameListWidget::setCustomBackground.

Whoops you were right, that check was too aggressive. I'll fix it later.

  • The background is currently being drawn by the viewport widgets inside the QTableView and GameListGridListView widgets rather than the QStackedWidget itself (verified with GammaRay) since the palette is inherited.

I'm not sure how to reach the QStackWidget itself. I did use the setPallete on the m_ui.stack but apparently its not correct?

kamfretoz avatar May 27 '25 01:05 kamfretoz

I'm not sure how to reach the QStackWidget itself. I did use the setPallete on the m_ui.stack but apparently its not correct?

I've done some testing and I can't seem to get it to work with the palette method either, I'm not sure why. I think subclassing QStackedWidget and drawing the pixmap in the paintEvent function should still work though. Just make sure to use drawTiledPixmap and pass in the invalidated region. You'll need to disable autoFillBackground on the viewports (e.g. QTableView::viewport).

chaoticgd avatar May 27 '25 12:05 chaoticgd

I wonder if it could be possible to add support for animated webps (in a future PR). It would be quiet nice to have! Gif works too but gif is yucky

AmandaRoseChaqueta avatar Jun 02 '25 21:06 AmandaRoseChaqueta

I wonder if it could be possible to add support for animated webps (in a future PR).

I don't think Qt can do that.

kamfretoz avatar Jun 04 '25 00:06 kamfretoz

What if you decode the frames manually then update the background every few ms from a worker thread? 🤔

KrossX avatar Jun 04 '25 00:06 KrossX

Animated WEBP and GIF now works!

https://github.com/user-attachments/assets/e9bda970-262a-489b-8a30-c6c81f26d746

kamfretoz avatar Jun 08 '25 07:06 kamfretoz

Animated WEBP and GIF now works!

2025-06-08.14-51-36.mp4

NO WAY :0, I will test that later this day!

AmandaRoseChaqueta avatar Jun 08 '25 07:06 AmandaRoseChaqueta

It works! Opacity also works and the "clear background" button works as well. (testing on linux)

Screenshot_20250608_120609 Screenshot_20250608_120551-1 Screenshot_20250608_120551

AmandaRoseChaqueta avatar Jun 08 '25 17:06 AmandaRoseChaqueta

macOS works.

Screenshot_2025-07-13_at_19 44 11

kamfretoz avatar Jul 13 '25 12:07 kamfretoz

Selecting a game from the game list breaks this on Flatpak, tested with the Grey Matter theme (it also doesn't stretch to fill the window):

image

TheTechnician27 avatar Jul 13 '25 17:07 TheTechnician27

Selecting a game from the game list breaks this on Flatpak, tested with the Grey Matter theme (it also doesn't stretch to fill the window):

Its not a bug, its a feature.

  1. The selections are fully opaque for readability sake.
  2. And no its set to keep the aspect ratio (we can expand it in the future with Stretch to Fill)

kamfretoz avatar Jul 14 '25 09:07 kamfretoz

APNG support has been added courtesy of @TheLastRar !

also has been re-tested on Linux and macOS:

Screenshot 2025-07-16 at 21 49 33

kamfretoz avatar Jul 16 '25 14:07 kamfretoz

Works great! But I have a few notes to refine it.

  • Move all buttons to "Interface". There's enough room there if you add a scrollbar to it. This will de-clutter the current UI. image

  • Because pictures' resolutions can be small/big, it leaves gaps that flare up anyone's OCD - it needs more "fitting" options. Windows has stretch, fill, and fit. Yours is 'fit', leaving you with two more to add. image

ghost avatar Jul 25 '25 02:07 ghost

Works great! But I have a few notes to refine it.

* Move all buttons to "Interface". There's enough room there if you add a scrollbar to it. This will de-clutter the current UI.
* Because pictures' resolutions can be small/big, it leaves gaps that flare up anyone's OCD - it needs more "fitting" options. Windows has stretch, fill, and fit. Yours is 'fit', leaving you with two more to add.
  • The Interface section is already crowded enough as it is. Plus i think the "View" menu is far more fitting place for it.
  • The PR has been struggling with scope creep as it is already, i wanted to leave that feature for the future.

kamfretoz avatar Jul 27 '25 00:07 kamfretoz

The ui options should be put in Interface, would fit better there. Ideally in the Preferences section.

I'd recommend waiting for #13066 and rebasing on top of that then, just to minimize merge conflicts (otherwise you'd need to add another scroll area manually, since with the auto updater group box shown there's no space).

chaoticgd avatar Aug 03 '25 18:08 chaoticgd

Latest update, the entire custom background settings have been moved to Settings -> Interface. also added an option to fill the custom image to the available background space.

https://github.com/user-attachments/assets/4aea51f7-6f82-4085-8507-5cb704febd60

kamfretoz avatar Sep 11 '25 10:09 kamfretoz

With these new changes, can I have testers retest?

F0bes avatar Sep 21 '25 16:09 F0bes

image

Also macOS just in case works good there too

SternXD avatar Sep 21 '25 20:09 SternXD

Supported Image Types (*.bmp *.gif *.jpg *.jpeg *.png *.webp) is untranslatable

xujibbs avatar Sep 24 '25 12:09 xujibbs