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
Read and use KDE 4/5 colours for torrents list, torrent progress bars, and log window #3936
Conversation
src/gui/torrentmodel_p.cpp
Outdated
@@ -0,0 +1,325 @@ | |||
#include "./torrentmodel_p.h" |
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.
#include "torrentmodel_p.h"
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.
Move this include at the rest of project includes (after utils/colorutils.h).
Don't mix system/Qt/project includes.
For a start, fix coding style. |
As I said, on the other PRs, I am not sure I want to enable custom color values even if they're read from the theme. Also I think you could get the same colors in a DE-agnostic way. Get the application's QPalette and use |
@sledgehammer999 , could you explain me the difference between icons and colours, please? qBt uses system icons and benefits from it. Why can't it use colours then? QPalette was considered, but it does not have required colours. |
I was looking for a good bittorrent client for Plasma desktop. Since KTorrent is stagnating, I was happy to find that qBt support Qt5. The backend is powerful. Its UI is nicely balanced and fits into Plasma desktop quite well. The only two big problems for me were desktop notifications and colours. I think qBt has good chances to be popular among Plasma users if it becomes a bit more friendly to them. |
@sledgehammer999, if you are not going to accept these changes, I will abandon them and instead implement a proper KF5/Plasma integration for myself. Could you let me know this, please, in a foreseeable future? By 'KF5/Plasma integration' I mean the following:
|
@evsh I am not rejecting this outright. I haven't even looked at it. I hope get the time to do it soon. But as you can see I am little bit swamped in PRs :P |
Without looking too much into it: If you are going to somehow maintain "KDE intergration" in the foreseeable future AND that integration code isn't touching too much of qbt code AND it is optional for the user I'll consider it seriously. When I say isn't touching too much qbt code I mean that it is its own set of files/folders, it doesn't introduce big changes and I can easily rip it out if it gets outdated and nobody wants to maintain it. |
Thank you for the quick and informative answer! I have no doubts that I will use qBt and KDE in the foreseeable future and as such will be able to maintain the code. However, I doubt that I can handle it without polluting files with |
I think It should be implemented as compile time option, e.g.:
|
Indeed, you cannot do without |
@glassez , it was already implemented like that in one of the previous versions of this PR, and the maintainer did not like it. That is why I asked. |
@evsh, I looked at the current implementation. Overall, it looks good. It is rather structured and it can be easily changed to make KDE support as compile time option. |
@glassez, this code was written when @sledgehammer999 refused to accept a more direct approach. Initially there was a straightforward code which called KF5 to get the colour corrected for the colour effects. @sledgehammer999 said that he does not want build time dependency on KF5 libraries, because package maintainers will likely to turn it on always. However, if there will be an option in the build system, I would use the direct approach and remove colorutils.[h,cpp] files, parsing of the KDE config file, etc. When an Qt5 app is executed in Plasma environment, all these KF5 libraries are get loaded anyway by the Qt platform integration layer. |
Wait for @sledgehammer999. He's the last word. It will depend on what form he allows to have it here.
Could you describe this solution in General for me. How would this be implemented. I'm more interested in right now, what dependencies it would add and what those dependencies would be. How will this affect the current code. |
OK, with pleasure. Here we go:
|
I forgot to mention that I don't want dependencies on (any) DE libs. A little bit of #ifdef isn't a problem.
As a runtime option. |
@sledgehammer999, no I don't know any remote API to get colours. Approach from this PR is the best I can imagine for KDE.
So, it means a plugin then? |
@evsh, IMO, approach from this PR is runtime option because it determines whether to use KDE colors or not in runtime. |
If it suits @sledgehammer999, I start to comment on code. Waiting... |
|
||
#include "torrentmodel_p.h" | ||
|
||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
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 Q_OS_LINUX
?
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.
What about BSD systems?
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.
you're right. I haven't consider that before. so non-intuitive...
I'm not sure how much other DE will benefit from this, probably a minor thing but I would like KF5 specific code can be placed into a distinct folder in the source tree. |
@evsh ? |
@sledgehammer999 , you must have overlooked my earlier answer. Here it follows with yet another question from myself: @sledgehammer999, no I don't know any remote API to get colours. Approach from this PR is the best I can imagine for KDE.
So, it means a plugin then? |
I think scripting using DBus might be useful. One can do things (and I plan to to them) like "wait two hours, if download progress does not change, suspend the system" or "Once a given file gets ready, remove all other downloads with it or downlods with specific hashes". I think GUI for such tasks in qBt is an overkill. Speaking of colours, I can imagine the following way to do this for other DEs. We use python already, then why don't we supply a python programs which get DE palette and print it out. |
True, an external scripting interface (that's how I interpret) can be very useful, in the sense of devs can create more user-friendly programs.
pardon me, I don't follow.
sounds cool (for me). |
Sorry for being not clear enough. I mean that we can launch a helper python script to get DE colour palette. |
@sledgehammer999 , FYI log window is hardly readable with a dark colour theme; it needs the same colour adjustments as you did for the torrent list (isDarkTheme() and the rest) |
If XDG_CURRENT_DESKTOP environment variable suggests KDE session, read kdeglobals config file and use defined there colours for torrent list, torrent progress bars, and log window. Otherwise hardcoded default values are used.
Superseded by #6698. |
Resurrection of pull request #3819. But now with an option to enable/disable (disabled by default) usage of the system colour theme, and of course without build or run-time dependencies on KF5/KDE4.
The used KDE colours are strongly connected with the torrent states (neutral/negative/positive), shows KDE colour effects (disabled and inactive) and therefore, I believe, are understandable and pleasant for KDE users. However, to implement the effects, colorutils .h + .cpp files from KF5 are directly included. But they are small files.
If XDG_CURRENT_DESKTOP environment variable suggests KDE session, read kdeglobals config file and use defined there colours for torrent list. Otherwise hard-coded default values are used.