2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Change application icon only in support mode.

Fixes #23895.
This commit is contained in:
John Preston
2022-01-22 16:11:12 +03:00
parent 8407b0cccf
commit 07f72c20eb
3 changed files with 14 additions and 6 deletions

View File

@@ -106,16 +106,20 @@ void ConvertIconToBlack(QImage &image) {
}
}
QIcon CreateOfficialIcon(Main::Session *session) {
QIcon CreateOfficialIcon(Main::Session *session, bool returnNullIfDefault) {
const auto support = (session && session->supportMode());
if (!support && returnNullIfDefault) {
return QIcon();
}
auto image = Logo();
if (session && session->supportMode()) {
if (support) {
ConvertIconToBlack(image);
}
return QIcon(Ui::PixmapFromImage(std::move(image)));
}
QIcon CreateIcon(Main::Session *session) {
auto result = CreateOfficialIcon(session);
QIcon CreateIcon(Main::Session *session, bool returnNullIfDefault) {
auto result = CreateOfficialIcon(session, returnNullIfDefault);
#if defined Q_OS_UNIX && !defined Q_OS_MAC
const auto iconFromTheme = QIcon::fromTheme(
Platform::GetIconName(),

View File

@@ -38,7 +38,9 @@ struct TermsLock;
[[nodiscard]] const QImage &Logo();
[[nodiscard]] const QImage &LogoNoMargin();
[[nodiscard]] QIcon CreateIcon(Main::Session *session = nullptr);
[[nodiscard]] QIcon CreateIcon(
Main::Session *session = nullptr,
bool returnNullIfDefault = false);
void ConvertIconToBlack(QImage &image);
struct CounterLayerArgs {