mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-03-02 22:57:32 -05:00
macOS speed badge display is "wrong" by mac UI conventions #14312
Labels
No labels
Accessibility
AppImage
Bounty
Build system
CI
Can't reproduce
Code cleanup
Confirmed bug
Confirmed bug
Core
Crash
Data loss
Discussion
Docker
Documentation
Duplicate
Feature
Feature request
Feature request
Feature request
Filters
Flatpak
GUI
Has workaround
I2P
Invalid
Libtorrent
Look and feel
Meta
NSIS
Network
Not an issue
OS: *BSD
OS: Linux
OS: Windows
OS: macOS
PPA
Performance
Project management
Proxy/VPN
Qt bugs
Qt6 compat
RSS
Search engine
Security
Temp folder
Themes
Translations
Triggers
Waiting diagnosis
Waiting info
Waiting upstream
Waiting web implementation
Watched folders
WebAPI
WebUI
autoCloseOldIssue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/qBittorrent#14312
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Artoria2e5 on GitHub (Feb 7, 2023).
qBittorrent & operating system versions
qBittorrent: 4.5.0 x64
Operating system: macOS 12.6.1
What is the problem?
badge speed display in #6952 results in:
It's more conventional to draw stuff in the style of Transmission and (sighs) Thunder. The code to do so in Transmission is in
github.com/transmission/transmission@db802afc4f/macosx/BadgeView.mm (L31). There's the added bonus of having space to do both speeds, maybe even an ETA.Steps to reproduce
No response
Additional context
No response
Log(s) & preferences file(s)
No response
@luzpaz commented on GitHub (Aug 31, 2023):
@Artoria2e5 can you provide a screenshot for reference (and a mockup of what is expected as well?)
@Artoria2e5 commented on GitHub (Sep 3, 2023):
@luzpaz


qbt uses the notification banner, which is aligned top-right:
transmission draws its own thing, which is centered:
@luzpaz commented on GitHub (Sep 4, 2023):
Thanks, @Artoria2e5
Can you help locate the code in Qbit source ?
Edit: linking to https://github.com/qbittorrent/qBittorrent/issues/2761
@Artoria2e5 commented on GitHub (Sep 4, 2023):
github.com/qbittorrent/qBittorrent@39efd0e9ff/src/gui/macutilities.mm (L126)@luzpaz commented on GitHub (Sep 5, 2023):
Thanks. The badge is aligned top-right, is that just by default? Because, looking at the code it doesn't look like alignment was specified at all. Or am I just missing it?
@luzpaz commented on GitHub (Sep 5, 2023):
CC @Kolcha (sorry for the ping. Since you've committed in the past to macOS efforts, could you help weigh-in here?)
@Kolcha commented on GitHub (Sep 5, 2023):
I can look, even I don't know Objective-C and macOS APIs, I can at least find how Transmission does it and implement the same for qBittorrent if this is acceptable (I'm not aware of any Apple' style guides and so on).
@Artoria2e5 commented on GitHub (Sep 5, 2023):
The alignment cannot be changed, ever. It is originally designed to display the red bubble with a number we all know and hate...
@Kolcha commented on GitHub (Sep 6, 2023):
Transmission implemented "own component/widget" for this purpose. only need to understand when and how it is created. Will try to integrate it into qBittorrent this weekend.
the hardest part is the dependence on 4 images, need to find the way how to create Apple-specific structures from Qt-specific structures. this may require some undocumented Qt API usage or tricks used in Qt internally.
in any case, it seems not so complex.
@Kolcha commented on GitHub (Sep 10, 2023):
so, I spent some time working on it... unfortunately, I have bad news: I see no way at all to re-use (or port) that component implemented by Transmission devs to qBittorrent. some technical details are below.
as I mentioned above, component relies on 4 images (actually even 8, but it doesn't matter), these images are used in platform-specific code written in Objective-C. qBittorrent is written in C++ using Qt framework, so some "bridge" between C++/Qt and Objective-C is required. fortunately, Objective-C++ perfectly suits these needs.
Qt has its own resource system, so Qt classes should be used to access any images (or whatever) stored as app resources. few image-specific classes can be used to load image from resources. then this Qt-specific object must be "converted" into something that fits macOS frameworks API (as so as platform-specific code is required).
QImageclass provides suitable function for that, but unfortunately it returns null pointer for any valid image for unknown reasons.this is slightly surprising for me, but not completely unexpected, unfortunately. about year ago I already faced similar issues with passing "C pointer" to some Objective-C functions on macOS. things which perfectly worked on macOS 12.4 has stopped working (and lead to crash due to null pointer dereference) after upgrade to macOS 12.5. I have some thoughts what can lead to this, but no idea how to deal with it. I'm not macOS (or whatever Apple product) developer and don't want to be it, especially nowadays (I hate everything made by Apple now, sorry).
so, sorry... I can't help. maybe some experienced Apple developer will help with it, but not me.
P.S> you may ask why Transmission doesn't experience such issues. answer is simple: Transmission has several almost self-contained platform-specific UI implementations which just use C/C++ torrent implementation library, I even not sure that they need to share some string values between C/C++ core and whatever platform-specific UI, let alone some "raw data".
@glassez commented on GitHub (Sep 10, 2023):
@Kolcha
Could you create draft Pull request? Maybe someone can help with it.
@glassez commented on GitHub (Sep 10, 2023):
And how about text only implementation?
@Kolcha commented on GitHub (Sep 10, 2023):
sorry, there is nothing to publish... I tried that on "hello world" application first, as so as qBittorrent is pretty complex app with at least few dependencies and it is pretty inconvenient to setup IDE / dev environment to work on it rather than just build it.
very good idea! I didn't thought about it... should work, as so as
QStringtoNSStringcoversion definitely works. Will try on my test app and will post anything working (even somehow) as PR. but this will happen very likely only on next weekend, it is very unlikely that I'll work on it during the week (usually I don't want to work on something personal in the evening after work)@Kolcha commented on GitHub (Sep 11, 2023):
text-only implementation concept (just a test app to demonstrate the possibilities)

P.S> have some ideas on how to avoid images usage at all. just need to Google for some Apple APIs similar to what
QPainterprovides.wait for PR :)
@Kolcha commented on GitHub (Sep 11, 2023):
almost replicated Transmission' look :) (without arrows and with)

no images are required, everything is painted programmatically
again, still demo app with random image used as app icon