2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

Fixes for window icon (#38)

* Give priority for custom icon on linux
* Add support for icon from file, as in tray
This commit is contained in:
ilya-fedin
2020-05-06 22:55:57 +04:00
committed by GitHub
parent 8487cf2a38
commit e425912490

View File

@@ -119,20 +119,37 @@ void ConvertIconToBlack(QImage &image) {
}
QIcon CreateOfficialIcon(Main::Account *account) {
auto image = Core::IsAppLaunched() ? Core::App().logo(cCustomAppIcon()) : LoadLogo(cCustomAppIcon());
const auto customIcon = QImage(cWorkingDir() + "tdata/icon.png");
auto image = customIcon.isNull()
? Core::IsAppLaunched()
? Core::App().logo(cCustomAppIcon())
: LoadLogo(cCustomAppIcon())
: customIcon;
if (account
&& account->sessionExists()
&& account->session().supportMode()) {
ConvertIconToBlack(image);
}
return QIcon(App::pixmapFromImageInPlace(std::move(image)));
}
QIcon CreateIcon(Main::Account *account) {
auto result = CreateOfficialIcon(account);
#ifdef Q_OS_LINUX
return QIcon::fromTheme(Platform::GetIconName(), result);
if (
(!account
|| !account->sessionExists()
|| !account->session().supportMode())
&& cCustomAppIcon() == 0
&& !QFileInfo::exists(cWorkingDir() + "tdata/icon.png")) {
return QIcon::fromTheme(Platform::GetIconName(), result);
}
#endif
return result;
}