Bug 429382 - black icon with dark theme for Windows build.
Summary: black icon with dark theme for Windows build.
Status: RESOLVED DUPLICATE of bug 432085
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 20.08.3
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-20 06:52 UTC by Gary Wang
Modified: 2021-01-31 06:16 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Wang 2020-11-20 06:52:34 UTC
SUMMARY

When using breeze-dark theme for Kate under Windows, it will not use the breeze-dark icon theme which caused it will display black icon with breeze-dark theme.

STEPS TO REPRODUCE
1. Download the pre-built binary from https://binary-factory.kde.org/view/Windows%2064-bit/job/Kate_Release_win64/ , file name: kate-20.08.3-1083-windows-msvc2019_64-cl.exe
2. Install it. Launch Kate, set theme to Breeze Dark
3. See the result.

OBSERVED RESULT

Icon color is black, with breeze-dark Qt theme applied.

EXPECTED RESULT

Icon color is white (use the breeze-dark icon theme).


SOFTWARE/OS VERSIONS
Windows: Windows 10 with 20H2 (19042.630)
(available in About System)
Kate Version: 20.08.3

ADDITIONAL INFORMATION

Kdenlive works well so I did checked the source code. Probably related source code here:

 - https://github.com/KDE/kate/blob/b6a9acfe8090b2b174d4097c0864ec22ee43b6d7/kate/katecolorschemechooser.cpp#L39
 - https://github.com/KDE/kdenlive/blob/8b8a947c479a71ccab35b4e02183fe7bcecdd436/src/mainwindow.cpp#L819

As we can see, Kdevlive uses `QIcon::setThemeName()` to tell the application apply breeze-dark icon theme when needed. Kate might need to do the same thing.

I tryed to build Kate under Windows within MSYS2, but it cannot find any other themes along with a "Default" one, so I'm not able to test if adding that will works. I also tryed to install KDE Craft to build Kate since it's the recommended way to build Kate, but it fails on compile libs/gcrypt:1.8.7-3 (no pre-built binary founded for Qt 5.15.1 MinGW64), so I'm not able to test if that can actually fixes this bug..

Let me know if you need any additional information. Thanks.
Comment 1 Gary Wang 2020-11-30 08:39:16 UTC
Reinstalled craft with windows-msvc2019_64-cl ABI, and now I'm able to get Kate build under Windows. Adding `QIcon::setThemeName()` call to set `breeze-dark` icon theme is not enough to fix this bug. There are still two other steps need to be done:

1. Since current windows package doesn't contains breeze-dark icon theme like what Kdenlive did (`bin\data\icons\` folder doesn't exist at all), we also need to package the breeze and breeze-dark icon theme to the installer and install them to the right place so we can use it.
2. In kateapp.cpp or somewhere else, we also need to tell the program to load the icon theme files (.rcc files) like what Kdenlive did in https://github.com/KDE/kdenlive/blob/93a40647ad91fc8f7f606f642cd000cfa074b2d5/src/main.cpp#L110 .

After doing these three steps, Kate will be able to use breeze-dark icon theme when the breeze-dark application theme applied.

I'd like to send a patch but I'm not quite sure about how to make the installer package these icon theme assets, btw, the output of cl.exe is not readable when building under non-English environment (eg. `error C2248: ��QString::QString��: �޷����� private ��Ա(�ڡ�QString����������)`), so sorry I couldn't provide a patch to fix this issue, but let me know if you need any additional information, I'd love to help you fix this issue.

Thanks.
Comment 2 Jan Paul Batrina 2021-01-30 15:51:03 UTC
Hello, this is currently being worked on (see https://bugs.kde.org/show_bug.cgi?id=432085)

As for the gibberish output, that might be an upstream (MSVC) bug, but it might be worth creating a separate bug report under Craft > Core (disclaimer: I'm not 100% sure if that's the right place for that bug)

*** This bug has been marked as a duplicate of bug 432085 ***
Comment 3 Gary Wang 2021-01-31 06:16:11 UTC
Oh, by reading the comments in the newer bug report seems the fix you're working on is so much better approach than what I tried to do! Kdenlive could also get benefit from that patch :)

About Craft build, I guess the gibberish output is just because it's printing Chinese in gb2312 encoding instead of UTF-8. I guess set language to English by using `[Threading.Thread]::CurrentThread.CurrentUICulture = 'en-US'` could be a solution but I haven't tried it out. I'll try to open bug report to Craft project once I got time to work on that.

Thanks for the fix/update <3