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

Closed
wants to merge 67 commits into 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

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

@rharish101
Copy link

Is it possibly a Wayland issue? I'm running Hyprland.

@tomboylover93
Copy link
Contributor Author

I use a KDE Plasma Wayland session and don't have this issue, maybe it's something to do with Kvantum or qt6ct.

@tomboylover93
Copy link
Contributor Author

@GHU7924 @C4ndyF1sh Can you try the latest commit on Windows and macOS? From what I've seen (and tested) I'll have to disable widget style selection for Windows and disable the "System" color theme for macOS since it's broken with light mode, and I'm trying to see if there are any other options (I'm not very experienced with Qt for platforms other than Linux).

@GHU7924
Copy link

GHU7924 commented Jan 23, 2025

I confirm that in Windows, the system theme is not selected in the emulator settings, but only Fusion.
The System is reset to Fusion. Since System only works on Linux, it might be worth adding a label, such as System (Linux only). Also, as I understand it, there is no description of the element.

Qt1

Depending on the color mode, the system theme adjusts and switches between Dark and Light.
I also noticed this detail, when choosing a dark theme, shades are applied,
but for some reason they are not when choosing a light one.

Qt4

You should also update your PR first to apply the new changes that were made to PR #2213.
Now you have to transfer the elements of your PR to the GUI tab.

@tomboylover93
Copy link
Contributor Author

I merged it with main (checks are failing for a different reason), and I'll change the text for the System option later. I don't see any missing text, though.
image

@GHU7924
Copy link

GHU7924 commented Jan 23, 2025

@tomboylover93 I honestly don't know what the problem is, but I have it that way.

2025-01-23.19-29-30.mp4

One more thing
Differences

And in my opinion, it's better to do this.
44

@DanielSvoboda
Copy link
Contributor

Putting the volume bar next to the name also seems like a good idea to me

image

@GHU7924
Copy link

GHU7924 commented Jan 24, 2025

@DanielSvoboda I agree, but I suggested doing this: #1828 (comment) (The volume icon would change every 33%)
But then there's more work to be done.

@tomboylover93
Copy link
Contributor Author

Does this look good?

image

@GHU7924
Copy link

GHU7924 commented Jan 24, 2025

Does this look good?

Don't worry, there may still be a few more edits in the future as more improvements, fixes, and new features are added ))

@tomboylover93
Copy link
Contributor Author

@DanielSvoboda Do you happen to know how I can grey out a QComboBox element based on what operating system the app was compiled for?

@GHU7924
Copy link

GHU7924 commented Jan 24, 2025

This is what my Windows window looks like at the moment.
изображение

The problem of the light theme remains.
Qt4

@tomboylover93 At the next PR update, can you make the edit that @DanielSvoboda suggested?
Vol

@tomboylover93
Copy link
Contributor Author

Like this?

image

I'm aware of the spacing between "Volume" and the volume slider but nothing I've tried had an effect on it.

@rainmakerv3
Copy link
Contributor

@DanielSvoboda Do you happen to know how I can grey out a QComboBox element based on what operating system the app was compiled for?

I think it would be better to just ->hide() the groupbox entirely, and hardcode to fusion. I believe I showed you an example of #ifdef previously here, thats for selectively applying code to certain definitions (such as OS)

@tomboylover93
Copy link
Contributor Author

What I'm doing currently is using #if defined(__linux__) || defined(__APPLE__) so that the widget style selection is disabled on Windows (you can still see and interact with the widget however). I don't know how I could adapt this to #if defined(Q_OS_WIN).

@GHU7924
Copy link

GHU7924 commented Jan 24, 2025

@tomboylover93 To be honest, I hate to say this, but maybe you should close your PR or postpone it in order to return to it in the future as a new PR. You tried very hard, but it turned out that the systems are very different, and we can't put everything together. I really want to help you, but since I don't have any programming knowledge, unfortunately I can't offer you solutions.

I tested your latest PR and I also have a large distance between the label and the slider.

My last idea is to close this PR and open a new one containing all the changes at the moment from Main.
Add only this option, which, depending on the operating system, will use Fusion or System, without the code for the GUI tab, as @rainmakerv3 said.
изображение

Windows = System + Fusion
mac OS = System + Fusion
Linux = System only (System + System)

@tomboylover93
Copy link
Contributor Author

If anyone with more Qt experience than me (and especially for more than one platform, as I've learned that writing the best code you could write for the platform that you yourself use is not a good idea) is willing to do it, then that's fine. That said, I think the Linux part is pretty much done, so anyone could just use this as a base while improving it on the Windows and macOS side.

@GHU7924
Copy link

GHU7924 commented Jan 24, 2025

I think that if someone wants to continue your work, it will probably be easier for them to do everything from scratch than to fix existing code. This way the author will have more control over the code and he will know what is implemented and what is not.
I think it would be better for you to close the PR.

@tomboylover93 No negativity towards you, you did well. If you will be doing any PR in the future and you need help with testing, then do not hesitate to contact me, I will be happy to help you (if my knowledge is enough to give you good feedback).

@tomboylover93
Copy link
Contributor Author

I think I'll do one last rebase to make sure it's in a more usable state (doesn't really do anything because this repo has new PRs and commits every day, but why not) and move it to an archive branch and then close this PR. Then I'll open one just for the widgets part and fix the issues with Windows (as I could confirm from other people that the system widgets work as they should on macOS). That should be simple to do. The color themes part, and specifically the issue you described where the accent color doesn't work with the Windows light theme, is not something I could fix considering my knowledge (or lack thereof) of how Qt works on other platforms.

@tomboylover93 tomboylover93 deleted the qt-style branch January 25, 2025 00:52
@DanielSvoboda
Copy link
Contributor

@DanielSvobodaVocê sabe como posso tornar um elemento QComboBox cinza com base no sistema operacional para o qual o aplicativo foi compilado?

I don't know

about the spacing between the 'volume' and the bar, you need to change this: label_Volume
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.

6 participants