2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 06:55:58 +00:00

Update icon on macOS, allow changing back.

This commit is contained in:
John Preston
2023-02-28 20:49:45 +04:00
parent c575e61853
commit aa9e56c633
35 changed files with 157 additions and 8 deletions

View File

@@ -64,6 +64,11 @@ using Core::WindowPosition;
return { skipx, skipy };
}
[[nodiscard]] QImage &OverridenIcon() {
static auto result = QImage();
return result;
}
} // namespace
const QImage &Logo() {
@@ -123,12 +128,19 @@ void ConvertIconToBlack(QImage &image) {
}
}
void OverrideApplicationIcon(QImage image) {
OverridenIcon() = std::move(image);
}
QIcon CreateOfficialIcon(Main::Session *session) {
const auto support = (session && session->supportMode());
if (!support) {
return QIcon();
}
auto image = Logo();
auto overriden = OverridenIcon();
auto image = overriden.isNull()
? Platform::DefaultApplicationIcon()
: overriden;
ConvertIconToBlack(image);
return QIcon(Ui::PixmapFromImage(std::move(image)));
}