Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Add options for system colors and system Qt widget styles #1828

Draft
wants to merge 60 commits into
base: main
Choose a base branch
from

Conversation

tomboylover93
Copy link
Contributor

Taken from https://github.com/tomboylover93/shadPS4/releases/tag/v0.4.1_WIP_qt-style:

  • Added "System (Light)" and "System (Dark)" options under View -> Themes. Since I couldn't figure out how to apply different icon colors based on whether or not your system theme is light or dark, they are separate options, so you should use them according to your system colors. Tested on Linux with KDE Plasma. Untested on Windows and macOS, but might be useful on Windows if you use custom system themes.
  • Added "Widget Style" options on the Settings menu, with text that shows up on mouse hover. Defaults to "Fusion", as it is currently hardcoded to do so. "System" uses your system's default Qt widget style (example: Breeze, Oxygen, MS Windows 9x, Kvantum). Linux users can override this with the QT_STYLE_OVERRIDE environment variable, as long as it's set to "System". You can tweak this on config.toml with the line widgetStyle = "Fusion". Since I couldn't figure out how to repaint all widgets after clicking on either "Save" or "Apply", this doesn't reflect in real time and you need to close and reopen shadPS4. Tested on Linux with KDE Plasma. Untested on Windows and macOS.

Screenshots (taken on Linux with KDE Plasma):

  • "System (Dark)" color theme, "Fusion" widget style

Screenshot_20241219_114710

  • "System (Light)" color theme, "Fusion" widget style

Screenshot_20241219_114840

  • "Dark" color theme, "System" widget style (set to Breeze in KDE System Settings)

Screenshot_20241219_115140

  • "System (Dark)" color theme, "System" widget style (set to Bali10050/Lightly in KDE System Settings)

Screenshot_20241219_115317

Additional screenshots

  • Settings menu

Screenshot_20241219_132609

This is purely cosmetical and should not affect the usability of the emulator in any way, but if you do have issues with it, such as the emulator not launching or the color/widget style changes not working, please let me know.

Widget repainting isn't implemented yet, it's necessary to close and reopen shadPS4 after changing widget style
@rainmakerv3
Copy link
Contributor

For checking system dark mode, you can try

if QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark

for refreshing widgets after a save/apply, i think you can have update->widget every widget and then QCoreApplication::processEvents after clicking apply/save (or if i remember right i put the same function for both, if so that would work better).

also i still think the widget style selection is better placed over/under where the theme selection is

@tomboylover93
Copy link
Contributor Author

I tried both of these. The first one broke all themes and their icon colors and the second has no effect. Unless I missed something?

As for placing the widget style selection on the View menu, I tried that before I decided to make a group box in the settings menu for it, and the emulator segfaulted immediately, so I went with the latter.

@tomboylover93
Copy link
Contributor Author

Just to check, does it work as intended if the widget and theme are set to System and with the Windows color mode set to either dark or light?

@GHU7924
Copy link

GHU7924 commented Dec 23, 2024

10

@tomboylover93
Copy link
Contributor Author

This is a strange case. Either I combine the System color theme and widget style into one (which I haven't figured out how to) or I grey out the System option on Windows, which neither is ideal, but the latter is better than the former as it is currently hardcoded to use Fusion because most of the UI was built around it, and Windows has the largest userbase out of all the 3 OSes supported by shadPS4.

Besides that, I also need to know how this works in macOS.

@GHU7924
Copy link

GHU7924 commented Dec 23, 2024

I think that somehow you need to remove the "Not OK" option, leaving only both options OK.

@tomboylover93
Copy link
Contributor Author

I'd have to remove every theme other than System, which means this probably won't get merged. Unless I reworked the theme system to use the Fusion widget for other color themes, like what PCSX2 and Duckstation do.

@GHU7924
Copy link

GHU7924 commented Dec 23, 2024

@tomboylover93 Look at PR 1855, something similar was done there. Yes, PR is completely different, (but if there are items in the menu, you cannot select them, because there is no checkbox in the checkbox). Maybe this can be somehow transferred to the Current Widget Style selection.
Something like, when the system theme is selected, you will not be able to select other themes other than the system theme.

@tomboylover93
Copy link
Contributor Author

Seems like a good alternative, I'll look into it.

@GHU7924
Copy link

GHU7924 commented Dec 26, 2024

Besides that, I also need to know how this works in macOS.

@C4ndyF1sh , you can help @tomboylover93 test this PR on MacOS?

@C4ndyF1sh
Copy link

@GHU7924
Works on Mac Screenshot 2024-12-27 at 16 56 19

@C4ndyF1sh
Copy link

C4ndyF1sh commented Dec 27, 2024

@GHU7924 I switched to light mode but shadps4 doesn't, I even restarted shad (Tried with system theme on and off) Screenshot 2024-12-27 at 16 59 20

@GHU7924
Copy link

GHU7924 commented Dec 27, 2024

@C4ndyF1sh In General, try Current Widget Style = System.

You can see our comments above and compare them with your experience to see if you have similar problems.

Thank you for responding.

P.S. I haven't tested the new build yet, I'll do a test in the near future.

@GHU7924
Copy link

GHU7924 commented Dec 27, 2024

@tomboylover93 Perhaps it would be better to replace the style selection with Radio buttons?
0

Fusion - all themes are available.
System = System + System and click blocking "Themes".

@tomboylover93
Copy link
Contributor Author

I could do that but I don't know how to combine both Qt themes and color themes, nor how to block "Themes" from being clicked when selecting System.

@GHU7924
Copy link

GHU7924 commented Dec 27, 2024

@tomboylover93 Then you should mark your PR as a draft.

Perhaps @f8ith or @DanielSvoboda they will give you some tips, or maybe not.
(The description of the problem begins with comments from about 5-7 days ago to today).

@tomboylover93 tomboylover93 marked this pull request as draft December 27, 2024 20:50
@tomboylover93
Copy link
Contributor Author

I switched to light mode but shadps4 doesn't

@C4ndyF1sh Can you try the latest commit?

@tomboylover93
Copy link
Contributor Author

I forgot to put this here, but I did some testing with a Windows 10 virtual machine (I had to use Mesa's 'lavapipe' Vulkan drivers to get it to open, because it's a virtual machine and shadPS4 requires Vulkan 1.3 support).

Here's what it looks like with the Windows color theme set to "Dark", the app's color theme set to "System" and the widget style set to "Fusion":

Screenshot_20250107_122700

And with the widget style set to "System":

Screenshot_20250107_122709

In the 2 weeks since my last commit to this PR I have not been able to figure out the problems with Windows and the "System" widget style, and they only work fine with "Fusion" which is what the app is hardcoded to use. I think I'll gray out the widget style option on Windows, and possibly macOS.

@rharish101
Copy link

I'm running Arch Linux with Kvantum (not KDE) to set my Qt theme for Qt apps (using QT_QPA_PLATFORMTHEME=qt6ct, and 'kvantum-dark' as the style in the Qt config utility). With this branch, when I launch shadPS4 after setting the widget style to 'System', all widgets use my system style, except for the background, which is in black:
shadps4-theme-before

However, if I open the settings and click on Save without making a single change, then the background changes to the correct system style:
shadps4-theme-after

@tomboylover93
Copy link
Contributor Author

tomboylover93 commented Jan 9, 2025

I believe this has something to do with widget repainting when you click on "Save" or "Apply". I don't know why the background looks like that when launching the app, it looks just fine to me.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants