-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Color and font themes part 2 #7623
Conversation
@LordNyriox: in #3 if these two commits will be accepted. |
Uncrustify please. I'd spam the PR if i pointed out everything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coding style
@evsh, I looked here a little bit... const QColor messageColor = Theme::ColorTheme::current().logMessageColor(msg.type); Why ColorTheme needs to know in which place the item is used? |
@glassez: I can't understand your concerns, sorry. Theme elements are named, and as such it is known from the very beginning (from the theme file) where each element will be used. |
Marking this for 4.0.1, since I am really close to releasing 4.0.0 and this seems to be a bit big. |
Again, I haven't watched the entire code thoroughly. I'm just trying to evaluate it outside, i.e. to answer the question "how the application uses this feature?". What I see is contrary to my vision. Maybe I just don't understand the goals of given design... So I describe my vision first. |
The other question is why color and font themes should be separated? |
@glassez, I guess you are missing the starting point for the approach taken here. These theme files are not general by design, i.e. a colour theme does not extend QPalette (but also see below). I proposed already that approach and it got rejected. If the team changed their minds, I can, of course, implement that one again. Let me summarise the two approaches here. The problem: qBt uses more colour roles than QPalette contains. We use colours for torrent states, log message severities, and download progress bar. There may be two principal solutions: extend QPalette with more roles or define colours for each use case. Extending roles does not mean that we get a role for each our UI element, but we need to map role colours onto UI elements either statically or dynamically. Let me point out right away that this PR combines both approaches and makes mapping dynamic. Extending QPalette rolesIt is hard for me to come up with a proposal here, because I use KDE/Plasma colour themes for many years, and those themes do exactly this task, and do that well. So, let me briefly describe their approach for those who never used KDE. They extend colours roles in three directions. Firstly, they add new colour roles for "Active", "Inactive", "Positive", "Neutral", and "Negative" states. Here is the full list: BackgroundAlternate Then these roles are defined for several groups of UI: views, buttons, tooltips, selection, window decoration. Finally they combine these groups into sets (QPalette == set) and define three sets: active, inactive and disabled colours. Transition to these sets are determined by a fixed function and KDE palette just defines values for its parameters. Additionally, there are two standard function to lighten and darken a colour. Taking this approach we would need to define new roles and map them onto UI elements. Additionally, we need to take colour values for these roles from a system palette when possible (Linux desktops). Define explicit colours for our purposesThis is exactly what we are doing now, the only thing that can be changed is to pass the definition to the user side allowing them to customize the colours to their tastes or to match their environment. So, what exactly this PR offers?
I hope, @glassez, this explains why qBt UI elements appear in the theme interface. |
Unfortunatelly, No! const QColor messageColor = Theme::ColorTheme::current().logMessageColor(msg.type); Why not to do as: const QColor messageColor = Theme::current().getColor(colorIdByMsgType(msg.type));
// assuming colorIdByMsgType() returns string key used in theme file and defined somewwhere above without any cross-dependencies. And Yes, I purposely used Theme instead of Theme::ColorTheme in my example to once again ask "why separate font and colort hemes?". |
Because
No, why join them? Is there any logical relation between a colour set for UI and font set? |
Isn't there this dependency? |
That is why I don't understand why this extra (and completely unnecessary) layer that creates cross-dependencies? I don't want to change ColorTheme to get the color for new element. I just want to say "give it to me"! |
What is the new element? |
Look at QSettings! If I want to get settings for class A, I don't have to change QSettings and add |
For example, in the future we will need to use some custom colors in a new widget. |
@glassez: I consolidated the code which makes you unhappy in src/gui/theme/colortheme.cpp. I still believe that 3 functions make more good than evil, producing an easy to use interface and referring only to enumerations from the other parts of the app. Enum
Apparently, we did not understand each other at that time. Let's try harder :)
One has to add a new item to the corresponding enum and update the default theme file to add the new default value. |
Ok.
IMO, I see no good from it. It's just redundant level only complicates the use of this feature by requiring some additional steps to introduce new theme elements.
I don't suggest to use enum ids.
But you still use string keys. |
No, function to map a new element to existing application enum is not required.
I use them for serialization only. As soon as file is parsed, string keys are not used. |
private slots: | ||
void applyColorTheme(); | ||
void applyFontTheme(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed that there is a private slots section already.
Just found out that seeding (black) icons stays black for unregistered torrent, This is not what it supposed to be. Whenever tracker sends a error message the icon should change accordingly... or how else we are going to get informed... I was seeding ~200 unregistered torrent for more than 3 months Btw another dropped project like qbittorrent (cutetorrent, qt libtorrent rasterbar) has option to use theme as well as changing the interface from list(utorrent/qbittorrent) to rows(transmission). Its open source and you can check it out to improve here. |
god damnit |
Pardon? |
I believe the swearing was in response to the fact that you closed this PR. For what it is worth, I cannot help but wonder why you closed this PR. Are you canceling your theming project? Are you rewriting it? Or are you simply suspending it, until you have some time to spare? |
Because my motivation was to make the app look nicer in my desktop environment (Plasma with a dark colour theme). However, @sledgehammer999 expressed clearly that dependencies on any platform except Windows, MacOS, and bare Linux are out of the table. Thus the goal is unreachable. Because of that and a strong resistance from @glassez I rethought the plan and decided that keeping the code in my own fork, which I merge the qBittorrent codebase into, better suit my needs and my (current) time opportunities. |
Why not make PRs for everything but the Plasma theming, and keep just the Plasma component in your own fork? That way, Windows/Mac users can benefit from the basic theming system, while Plasma users can use your fork. I know that I, personally, was really looking forward to using ColorThemes on my Windows system. I use a custom "Dark Red on Lightless Black" system-wide theme (to reduce eyestrain), and I prefer to use app themes that match it. |
I think @sledgehammer999 could approve it if this dependency is optional and it doesn't affect the main code.
I do not oppose this feature in general, although I would personally change the application to not to use any non-system elements (colors, fonts, etc.), but I don't want to discuss it. P.S. All of the above is my personal POV, and it may not coincide with the POV of other project members. If most people think that everything is OK, I will not interfere. |
I am roughly an outsider here, yet as a person trying to somewhat improve the look and feel on macOS, which remains disgusting, I find this change fairly important. Not only as a change itself but as a base to other changes. For example, greyscale icons are more common on modern macOS, and no icons should change their opacity on selection. I very well understand that code-wise it may be imperfect, yet it is always a trade off between having better code or working code. I would rather wait for other opinions, but personally it seems to be the case where we should just take a deep breath, rebase and accept it. As all people are hobbists here, little time could be spared to fully rewrite it anyway. |
How can you compare them?
These changes are bad exactly as a base for other changes.
I would fully rewrite it than try to change it if this will needed. @Chocobo1, @sledgehammer999, please comment it in general. |
I mostly agree with your previous post and here I only want to add that, if the code require maintenance in the future, it is out of my league, I won't be of much help. |
Thanks @glassez for showing right away what type of resistance I referred to. Let me iterate a few points of your latest comment.
Sounds strange at least. The whole point of this PR is exactly that: use system colours and icons (fonts is a side quest, easily solvable).
That, as far as I remember, boils down to these 4 functions and a class that hide theme serialisation interface and theme file format and elements naming from the application logic layer. And I did not receive and reasoning why that is an evil.
But instead I received quite a lot of comments of this kind, which go on personalities and insults... |
I mean "use general purpose system colors" which are compatible with all supported platforms and look good everywhere without any additional "theming support". But since many people prefer to see all sorts of decorations that use specific colors that stand out from this "general purpose" palette, I do not call to change it (as I said "I don't want to discuss it").
I'm not talking about the feature interface, but mostly about its implementation. It's complicated. And I don't mean any brain-dead optimizations. I just compare it with the model that first comes to my narrow mind (I have described it superficially before, but I can repeat it if there are those who want to know it). And I don't understand why this can't be done so easily.
I'm sorry if some of my remarks are too personal and offensive for you. It's just that your reluctance to critically evaluate your own code is really annoying at times, although I try to be diplomatic (it does not always work). I hope that constructive spirit will prevail in our cooperation. |
That's simply impossible with bare Qt. Please follow.
I can't agree with you that lesser number of complex entities is simpler than larger number of simple ones. I attempted to design the classes to be as primitive as possible. That was far from perfect, and thanks to your help they get improved. However, at this point I can't see how mixing different concepts into a single multi-powerful class would simplify maintenance. I would document them well instead. |
I did get through a half of this pull request changes and the comments posted above. Honestly said, I think it is not a problem of the implementation but rather architecture preference. The level of abstraction and entity separation depends on the project, and to my experience a much bigger maintenance issue is a misconception and a problem misunderstanding, both of which feel comparably reasonable here. Regarding the amount of colour preferences I have to agree with Eugene. It should be beared that Qt is a piece of crap every Mac user hates. It unfortunately gives a hey to native Cocoa widgets and attempts to terribly mimic colours, which results in borked stuff. To give you and idea: even the right-click context menu is broken (border, background, selection, padding, font, rounding…). I am not sure it can be easily fixed with theming on Mac, yet I perfectly understand that Qt authors in their attempt to "unify" the UI made it in a way that makes everyone blow. To make the UI at least somewhat better a lot of effort is needed, commonly specific to each element in charge (similarly to how I addressed the stuff via ifdefs and patches on Mac). Mapping stuff to "common" colours/widgets/fonts is simply borked from the beginning. Also, it has been quite some time Eugene had been here with this pull request (more than a year from what I remember). I admit that he still maintains it. From this point of view the question of maintenance is not a concern, he could fix himself what is needed. |
Well, again, I'm not going to discuss the global problems of cross-platform development. I only expressed my opinion about some "ideal" model (for me), when all the colors are not explicitly set, but through their roles and dependencies on each other. But, apparently, this is unattainable in the current situation, when there are no (supported) standards in this area. So let's leave it and get back to the earth (to the current PR).
You're constantly changing my words. I'm the first enemy of extremes. But as soon as I urge you to get out of your extreme, you imagine it's like I'm pulling you to the opposite shore. It's not!
But when the implementation is so fragmented into simple parts that it hides all the basic logic, it's also a bad idea. This is my point of view and I do not pretend to be "the ultimate truth". As I said:
|
@zeule, @glassez: How about you try a middle ground? @zeule: Create two different implementations of this theming system (as separate branches / PRs)—one the way you think it should be best coded (reduced to a more primitive level)—and the other the way you seem to think @glassez would prefer it (larger shared classes). Based on the feedback from the first two "draft" implementations, you can then create a third branch/PR combining the best traits of both. @Both-of-You: And for goodness' sake, butt heads somewhere other than an active PR. Create a new "Issue" thread for it if you have to—just do not clutter up a PR thread with a personal debate. Please. |
Excuse me, I do not do that intentionally, only try to make conclusions from what I read.
No, I simply need a justification for the move.
Not sure I get it. Could you be more specific, please?
What global elements? What usage are you talking about? Again, be less general, please.
Not sure that it's about A compromise has to be reasoned by non-subjective grounds.
Sorry, I have neither enough time nor passion to do that. |
As an end user it saddens me to hear that this feature will probably never be implemented. Alas it was not meant to be it seems. |
@stampis Yeah, this whole situation is ridiculous. Dark themes are so standard these days that even Windows RS5 has a dark mode explorer (will probably be the fall update). If you google Deluge Dark Theme, there's a theme that covers 99% of the UI elements. I didn't like Deluge very much at first, but it has grown on me. There's a large repository of plugins that basically never go obsolete for it |
I also am forced to look elsewhere for my bit torrent needs.. Deluge or Transmission maybe or maybe back to a patched version of utorrent |
Re-submitted as #9283 because GitHub does not allow to reopen a PR after a forced push. |
@zeule, @sledgehammer999, @qbittorrent/demigods etc. QColor getColor(const QString &colorID, const QColor &fallback) const;
bool loadTheme(const QString &themeFilePath);
(signal) void themeChanged();
About reviewed implementation (this PR). |
This PR contains the main part of the themes support code. It introduces code for theme handling (loading and accessing), applying themes and reacting to application palette changes. Here we also introduce a tab in options dialog to consolidate all settings related to app appearance.
Please see #6698 for screenshots.