diff --git a/Telegram/Resources/art/icon256blue.ico b/Telegram/Resources/art/icon256blue.ico
new file mode 100644
index 000000000..4b0b5a396
Binary files /dev/null and b/Telegram/Resources/art/icon256blue.ico differ
diff --git a/Telegram/Resources/art/icon256green.ico b/Telegram/Resources/art/icon256green.ico
new file mode 100644
index 000000000..de7bdc7cf
Binary files /dev/null and b/Telegram/Resources/art/icon256green.ico differ
diff --git a/Telegram/Resources/art/icon256old.ico b/Telegram/Resources/art/icon256old.ico
new file mode 100644
index 000000000..4749c1f79
Binary files /dev/null and b/Telegram/Resources/art/icon256old.ico differ
diff --git a/Telegram/Resources/art/icon256orange.ico b/Telegram/Resources/art/icon256orange.ico
new file mode 100644
index 000000000..639f37e4a
Binary files /dev/null and b/Telegram/Resources/art/icon256orange.ico differ
diff --git a/Telegram/Resources/art/icon256red.ico b/Telegram/Resources/art/icon256red.ico
new file mode 100644
index 000000000..a5e333fce
Binary files /dev/null and b/Telegram/Resources/art/icon256red.ico differ
diff --git a/Telegram/Resources/art/icon512_blue@2x.png b/Telegram/Resources/art/icon512_blue@2x.png
new file mode 100644
index 000000000..65a165c8e
Binary files /dev/null and b/Telegram/Resources/art/icon512_blue@2x.png differ
diff --git a/Telegram/Resources/art/icon512_green@2x.png b/Telegram/Resources/art/icon512_green@2x.png
new file mode 100644
index 000000000..569e49ae7
Binary files /dev/null and b/Telegram/Resources/art/icon512_green@2x.png differ
diff --git a/Telegram/Resources/art/icon512_orange@2x.png b/Telegram/Resources/art/icon512_orange@2x.png
new file mode 100644
index 000000000..791d1cbbb
Binary files /dev/null and b/Telegram/Resources/art/icon512_orange@2x.png differ
diff --git a/Telegram/Resources/art/icon512_red@2x.png b/Telegram/Resources/art/icon512_red@2x.png
new file mode 100644
index 000000000..89e557c77
Binary files /dev/null and b/Telegram/Resources/art/icon512_red@2x.png differ
diff --git a/Telegram/Resources/art/logo_256_blue.png b/Telegram/Resources/art/logo_256_blue.png
new file mode 100644
index 000000000..8443bd4da
Binary files /dev/null and b/Telegram/Resources/art/logo_256_blue.png differ
diff --git a/Telegram/Resources/art/logo_256_green.png b/Telegram/Resources/art/logo_256_green.png
new file mode 100644
index 000000000..90688030b
Binary files /dev/null and b/Telegram/Resources/art/logo_256_green.png differ
diff --git a/Telegram/Resources/art/logo_256_no_margin_blue.png b/Telegram/Resources/art/logo_256_no_margin_blue.png
new file mode 100644
index 000000000..b772365cf
Binary files /dev/null and b/Telegram/Resources/art/logo_256_no_margin_blue.png differ
diff --git a/Telegram/Resources/art/logo_256_no_margin_green.png b/Telegram/Resources/art/logo_256_no_margin_green.png
new file mode 100644
index 000000000..0522cde26
Binary files /dev/null and b/Telegram/Resources/art/logo_256_no_margin_green.png differ
diff --git a/Telegram/Resources/art/logo_256_no_margin_old.png b/Telegram/Resources/art/logo_256_no_margin_old.png
new file mode 100644
index 000000000..1d4b3d4c2
Binary files /dev/null and b/Telegram/Resources/art/logo_256_no_margin_old.png differ
diff --git a/Telegram/Resources/art/logo_256_no_margin_orange.png b/Telegram/Resources/art/logo_256_no_margin_orange.png
new file mode 100644
index 000000000..b13d32d09
Binary files /dev/null and b/Telegram/Resources/art/logo_256_no_margin_orange.png differ
diff --git a/Telegram/Resources/art/logo_256_no_margin_red.png b/Telegram/Resources/art/logo_256_no_margin_red.png
new file mode 100644
index 000000000..36b08072e
Binary files /dev/null and b/Telegram/Resources/art/logo_256_no_margin_red.png differ
diff --git a/Telegram/Resources/art/logo_256_old.png b/Telegram/Resources/art/logo_256_old.png
new file mode 100644
index 000000000..e03acca61
Binary files /dev/null and b/Telegram/Resources/art/logo_256_old.png differ
diff --git a/Telegram/Resources/art/logo_256_orange.png b/Telegram/Resources/art/logo_256_orange.png
new file mode 100644
index 000000000..888d9cba1
Binary files /dev/null and b/Telegram/Resources/art/logo_256_orange.png differ
diff --git a/Telegram/Resources/art/logo_256_red.png b/Telegram/Resources/art/logo_256_red.png
new file mode 100644
index 000000000..6a8fa31f9
Binary files /dev/null and b/Telegram/Resources/art/logo_256_red.png differ
diff --git a/Telegram/Resources/icons/settings/kotato_old.png b/Telegram/Resources/icons/settings/kotato_old.png
new file mode 100644
index 000000000..78af364a3
Binary files /dev/null and b/Telegram/Resources/icons/settings/kotato_old.png differ
diff --git a/Telegram/Resources/icons/settings/kotato_old@2x.png b/Telegram/Resources/icons/settings/kotato_old@2x.png
new file mode 100644
index 000000000..aa3213202
Binary files /dev/null and b/Telegram/Resources/icons/settings/kotato_old@2x.png differ
diff --git a/Telegram/Resources/icons/settings/kotato_old@3x.png b/Telegram/Resources/icons/settings/kotato_old@3x.png
new file mode 100644
index 000000000..7d2d7e2eb
Binary files /dev/null and b/Telegram/Resources/icons/settings/kotato_old@3x.png differ
diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json
index 6028ca9da..da01f574f 100644
--- a/Telegram/Resources/langs/rewrites/en.json
+++ b/Telegram/Resources/langs/rewrites/en.json
@@ -87,6 +87,16 @@
"ktg_settings_userpic_rounding_big": "Big",
"ktg_settings_userpic_rounding_full": "Circle",
"ktg_settings_userpic_rounding_desc": "You'll need to restart app to save changes.",
+ "ktg_settings_tray_icon": "Tray icon",
+ "ktg_settings_tray_icon_default": "Default",
+ "ktg_settings_tray_icon_blue": "Blue",
+ "ktg_settings_tray_icon_green": "Green",
+ "ktg_settings_tray_icon_orange": "Orange",
+ "ktg_settings_tray_icon_red": "Red",
+ "ktg_settings_tray_icon_legacy": "Legacy",
+ "ktg_settings_tray_icon_desc": "If you don't like any of these icons, you can place icon.png in your profile folder, but you'll need to restart app to see it.\n\nIcons below don't require restart.",
+ "ktg_settings_disable_tray_counter": "Disable tray icon counter",
+ "ktg_settings_use_telegram_panel_icon": "Ask the system for telegram icon",
"ktg_settings_chat_id": "Chat ID in profile",
"ktg_settings_chat_id_desc": "You can choose desired format here.\n\nTelegram API uses IDs as-is, but Bot API adds minus in the beginning for groups, and -100 for channels and supergroups to fit it in one field.\n\nIf you have profile panel opened, re-open it to see changes.",
"ktg_settings_chat_id_disable": "Hide",
diff --git a/Telegram/Resources/qrc/telegram/telegram.qrc b/Telegram/Resources/qrc/telegram/telegram.qrc
index 7833c71cc..ca96a9aef 100644
--- a/Telegram/Resources/qrc/telegram/telegram.qrc
+++ b/Telegram/Resources/qrc/telegram/telegram.qrc
@@ -4,7 +4,17 @@
../../art/bg_thumbnail.png
../../art/bg_initial.jpg
../../art/logo_256.png
+ ../../art/logo_256_blue.png
+ ../../art/logo_256_green.png
+ ../../art/logo_256_orange.png
+ ../../art/logo_256_red.png
+ ../../art/logo_256_old.png
../../art/logo_256_no_margin.png
+ ../../art/logo_256_no_margin_blue.png
+ ../../art/logo_256_no_margin_green.png
+ ../../art/logo_256_no_margin_orange.png
+ ../../art/logo_256_no_margin_red.png
+ ../../art/logo_256_no_margin_old.png
../../art/themeimage.jpg
../../art/dice_idle.tgs
../../art/dart_idle.tgs
diff --git a/Telegram/Resources/winrc/Kotatogram.rc b/Telegram/Resources/winrc/Kotatogram.rc
index 441af8347..131955b55 100644
--- a/Telegram/Resources/winrc/Kotatogram.rc
+++ b/Telegram/Resources/winrc/Kotatogram.rc
@@ -26,6 +26,11 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "..\\art\\icon256.ico"
+IDI_ICON2 ICON "..\\art\\icon256blue.ico"
+IDI_ICON3 ICON "..\\art\\icon256green.ico"
+IDI_ICON4 ICON "..\\art\\icon256orange.ico"
+IDI_ICON5 ICON "..\\art\\icon256red.ico"
+IDI_ICON6 ICON "..\\art\\icon256old.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/Telegram/SourceFiles/kotato/kotato_settings.cpp b/Telegram/SourceFiles/kotato/kotato_settings.cpp
index ca7597585..54b2e38b0 100644
--- a/Telegram/SourceFiles/kotato/kotato_settings.cpp
+++ b/Telegram/SourceFiles/kotato/kotato_settings.cpp
@@ -376,6 +376,16 @@ const std::map> DefinitionMap {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
#endif
+ { "disable_tray_counter", {
+ .type = SettingType::BoolSetting,
+ .defaultValue = Platform::IsLinux(), }},
+ { "use_telegram_panel_icon", {
+ .type = SettingType::BoolSetting,
+ .defaultValue = false, }},
+ { "custom_app_icon", {
+ .type = SettingType::IntSetting,
+ .defaultValue = 0,
+ .limitHandler = IntLimit(0, 5), }},
};
using OldOptionKey = QString;
diff --git a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp
index cb585acc3..058170211 100644
--- a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp
+++ b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp
@@ -86,6 +86,32 @@ QString UserpicRoundingLabel(int rounding) {
return QString();
}
+QString TrayIconLabel(int icon) {
+ switch (icon) {
+ case 0:
+ return ktr("ktg_settings_tray_icon_default");
+
+ case 1:
+ return ktr("ktg_settings_tray_icon_blue");
+
+ case 2:
+ return ktr("ktg_settings_tray_icon_green");
+
+ case 3:
+ return ktr("ktg_settings_tray_icon_orange");
+
+ case 4:
+ return ktr("ktg_settings_tray_icon_red");
+
+ case 5:
+ return ktr("ktg_settings_tray_icon_legacy");
+
+ default:
+ Unexpected("Icon in Settings::TrayIconLabel.");
+ }
+ return QString();
+}
+
QString ChatIdLabel(int option) {
switch (option) {
case 0:
@@ -418,6 +444,62 @@ void SetupKotatoSystem(
}, container->lifetime());
#endif // Qt < 6.0.0
+ AddButton(
+ container,
+ rktr("ktg_settings_disable_tray_counter"),
+ st::settingsButtonNoIcon
+ )->toggleOn(
+ rpl::single(::Kotato::JsonSettings::GetBool("disable_tray_counter"))
+ )->toggledValue(
+ ) | rpl::filter([](bool enabled) {
+ return (enabled != ::Kotato::JsonSettings::GetBool("disable_tray_counter"));
+ }) | rpl::start_with_next([controller](bool enabled) {
+ ::Kotato::JsonSettings::Set("disable_tray_counter", enabled);
+ controller->session().data().notifyUnreadBadgeChanged();
+ ::Kotato::JsonSettings::Write();
+ }, container->lifetime());
+
+ if (Platform::IsLinux()) {
+ AddButton(
+ container,
+ rktr("ktg_settings_use_telegram_panel_icon"),
+ st::settingsButtonNoIcon
+ )->toggleOn(
+ rpl::single(::Kotato::JsonSettings::GetBool("use_telegram_panel_icon"))
+ )->toggledValue(
+ ) | rpl::filter([](bool enabled) {
+ return (enabled != ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon"));
+ }) | rpl::start_with_next([controller](bool enabled) {
+ ::Kotato::JsonSettings::Set("use_telegram_panel_icon", enabled);
+ controller->session().data().notifyUnreadBadgeChanged();
+ ::Kotato::JsonSettings::Write();
+ }, container->lifetime());
+ }
+
+ auto trayIconText = rpl::single(rpl::empty) | rpl::then(
+ controller->session().data().unreadBadgeChanges()
+ ) | rpl::map([] {
+ return TrayIconLabel(::Kotato::JsonSettings::GetInt("custom_app_icon"));
+ });
+
+ AddButtonWithLabel(
+ container,
+ rktr("ktg_settings_tray_icon"),
+ trayIconText,
+ st::settingsButtonNoIcon
+ )->addClickHandler([=] {
+ Ui::show(Box<::Kotato::RadioBox>(
+ ktr("ktg_settings_tray_icon"),
+ ktr("ktg_settings_tray_icon_desc"),
+ ::Kotato::JsonSettings::GetInt("custom_app_icon"),
+ 6,
+ TrayIconLabel,
+ [=] (int value) {
+ ::Kotato::JsonSettings::Set("custom_app_icon", value);
+ controller->session().data().notifyUnreadBadgeChanged();
+ ::Kotato::JsonSettings::Write();
+ }, false));
+ });
AddSkip(container);
}
diff --git a/Telegram/SourceFiles/platform/linux/tray_linux.cpp b/Telegram/SourceFiles/platform/linux/tray_linux.cpp
index affa3566c..b888ed33a 100644
--- a/Telegram/SourceFiles/platform/linux/tray_linux.cpp
+++ b/Telegram/SourceFiles/platform/linux/tray_linux.cpp
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/linux/tray_linux.h"
+#include "kotato/kotato_settings.h"
#include "base/invoke_queued.h"
#include "base/qt_signal_producer.h"
#include "core/application.h"
@@ -47,6 +48,7 @@ private:
[[nodiscard]] QString panelIconName(int counter, bool muted) const;
[[nodiscard]] QString trayIconName(int counter, bool muted) const;
[[nodiscard]] int counterSlice(int counter) const;
+ [[nodiscard]] bool useIconFromTheme(const QString &iconName) const;
void updateIconRegenerationNeeded(
const QIcon &icon,
int counter,
@@ -57,6 +59,9 @@ private:
const QString _panelTrayIconName;
const QString _mutePanelTrayIconName;
const QString _attentionPanelTrayIconName;
+ const QString _telegramPanelTrayIconName;
+ const QString _telegramMutePanelTrayIconName;
+ const QString _telegramAttentionPanelTrayIconName;
const int _iconSizes[5];
@@ -66,6 +71,8 @@ private:
QIcon _trayIcon;
QString _themeName;
QString _name;
+ int _customId = 0;
+ bool _counterDisabled = false;
};
@@ -73,17 +80,27 @@ IconGraphic::IconGraphic()
: _panelTrayIconName("kotatogram-panel")
, _mutePanelTrayIconName("kotatogram-mute-panel")
, _attentionPanelTrayIconName("kotatogram-attention-panel")
+, _telegramPanelTrayIconName("telegram-panel")
+, _telegramMutePanelTrayIconName("telegram-mute-panel")
+, _telegramAttentionPanelTrayIconName("telegram-attention-panel")
, _iconSizes{ 16, 22, 24, 32, 48 } {
}
IconGraphic::~IconGraphic() = default;
QString IconGraphic::panelIconName(int counter, bool muted) const {
+ const auto useTelegramPanelIcon = ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon");
return (counter > 0)
? (muted
- ? _mutePanelTrayIconName
- : _attentionPanelTrayIconName)
- : _panelTrayIconName;
+ ? (useTelegramPanelIcon
+ ? _telegramMutePanelTrayIconName
+ : _mutePanelTrayIconName)
+ : (useTelegramPanelIcon
+ ? _telegramAttentionPanelTrayIconName
+ : _attentionPanelTrayIconName))
+ : (useTelegramPanelIcon
+ ? _telegramPanelTrayIconName
+ : _panelTrayIconName);
}
QString IconGraphic::trayIconName(int counter, bool muted) const {
@@ -106,6 +123,13 @@ int IconGraphic::counterSlice(int counter) const {
: counter;
}
+bool IconGraphic::useIconFromTheme(const QString &iconName) const {
+ return ::Kotato::JsonSettings::GetBool("disable_tray_counter")
+ && !QFileInfo::exists(cWorkingDir() + "tdata/icon.png")
+ && ::Kotato::JsonSettings::GetInt("custom_app_icon") == 0
+ && !iconName.isEmpty();
+}
+
bool IconGraphic::isRefreshNeeded(
int counter,
bool muted,
@@ -116,7 +140,9 @@ bool IconGraphic::isRefreshNeeded(
|| iconThemeName != _themeName
|| iconName != _name
|| muted != _muted
- || counterSlice(counter) != _count;
+ || counterSlice(counter) != _count
+ || ::Kotato::JsonSettings::GetInt("custom_app_icon") != _customId
+ || ::Kotato::JsonSettings::GetBool("disable_tray_counter") != _counterDisabled;
}
void IconGraphic::updateIconRegenerationNeeded(
@@ -131,6 +157,8 @@ void IconGraphic::updateIconRegenerationNeeded(
_count = counterSlice(counter);
_themeName = iconThemeName;
_name = iconName;
+ _customId = ::Kotato::JsonSettings::GetInt("custom_app_icon");
+ _counterDisabled = ::Kotato::JsonSettings::GetBool("disable_tray_counter");
}
QSize IconGraphic::dprSize(const QImage &image) const {
@@ -146,7 +174,7 @@ QIcon IconGraphic::trayIcon(int counter, bool muted) {
const auto iconName = trayIconName(counter, muted);
- if (iconName == panelIconName(counter, muted)) {
+ if (useIconFromTheme(iconName)) {
const auto result = QIcon::fromTheme(iconName);
updateIconRegenerationNeeded(result, counter, muted, iconThemeName);
return result;
@@ -154,6 +182,8 @@ QIcon IconGraphic::trayIcon(int counter, bool muted) {
QIcon result;
QIcon systemIcon;
+ const auto customAppIcon = ::Kotato::JsonSettings::GetInt("custom_app_icon");
+ const auto disableTrayCounter = ::Kotato::JsonSettings::GetInt("disable_tray_counter");
for (const auto iconSize : _iconSizes) {
auto ¤tImageBack = _imageBack[iconSize];
@@ -161,8 +191,14 @@ QIcon IconGraphic::trayIcon(int counter, bool muted) {
if (currentImageBack.isNull()
|| iconThemeName != _themeName
- || iconName != _name) {
- if (!iconName.isEmpty()) {
+ || iconName != _name
+ || customAppIcon != _customId
+ || disableTrayCounter != _counterDisabled) {
+ if (QFileInfo::exists(cWorkingDir() + "tdata/icon.png")) {
+ currentImageBack = QImage(cWorkingDir() + "tdata/icon.png");
+ } else if (customAppIcon != 0) {
+ currentImageBack = Window::Logo(customAppIcon);
+ } else if (!iconName.isEmpty()) {
if (systemIcon.isNull()) {
systemIcon = QIcon::fromTheme(iconName);
}
@@ -205,7 +241,8 @@ QIcon IconGraphic::trayIcon(int counter, bool muted) {
auto iconImage = currentImageBack;
- if (counter > 0) {
+ if (!disableTrayCounter
+ && counter > 0) {
const auto &bg = muted
? st::trayCounterBgMute
: st::trayCounterBg;
diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm
index c2e49e51d..43df34234 100644
--- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm
+++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm
@@ -116,6 +116,7 @@ private:
- (void) darkModeChanged:(NSNotification *)aNotification {
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
Core::App().settings().setSystemDarkMode(Platform::IsDarkMode());
+ Core::App().domain().notifyUnreadBadgeChanged();
});
}
diff --git a/Telegram/SourceFiles/platform/mac/tray_mac.mm b/Telegram/SourceFiles/platform/mac/tray_mac.mm
index 81668aa0c..f70a9d399 100644
--- a/Telegram/SourceFiles/platform/mac/tray_mac.mm
+++ b/Telegram/SourceFiles/platform/mac/tray_mac.mm
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/mac/tray_mac.h"
+#include "kotato/kotato_settings.h"
#include "base/platform/mac/base_utilities_mac.h"
#include "core/application.h"
#include "core/sandbox.h"
@@ -90,13 +91,35 @@ namespace {
return false;
}
-[[nodiscard]] QImage TrayIconBack(bool darkMode) {
+[[nodiscard]] QImage TrayIconBack(bool darkMode, bool selected = false) {
static const auto WithColor = [](QColor color) {
return st::macTrayIcon.instance(color, 100);
};
- static const auto DarkModeResult = WithColor({ 255, 255, 255 });
- static const auto LightModeResult = WithColor({ 0, 0, 0, 180 });
- auto result = darkMode ? DarkModeResult : LightModeResult;
+
+ QImage iconImageLight(cWorkingDir() + "tdata/icon.png");
+ QImage iconImageDark(cWorkingDir() + "tdata/icon_dark.png");
+ QImage iconImageLightSelected(cWorkingDir() + "tdata/icon_selected.png");
+ QImage iconImageDarkSelected(cWorkingDir() + "tdata/icon_dark_selected.png");
+
+
+ static const auto LightModeResult = iconImageLight.isNull()
+ ? WithColor({ 0, 0, 0, 180 })
+ : iconImageLight;
+ static const auto DarkModeResult = iconImageDark.isNull()
+ ? (iconImageLight.isNull()
+ ? WithColor({ 255, 255, 255 })
+ : iconImageLight)
+ : iconImageDark;
+ static const auto LightModeSelectedResult = iconImageLightSelected.isNull()
+ ? DarkModeResult
+ : iconImageLightSelected;
+ static const auto DarkModeSelectedResult = iconImageDarkSelected.isNull()
+ ? LightModeSelectedResult
+ : iconImageDarkSelected;
+
+ auto result = darkMode
+ ? (selected ? DarkModeSelectedResult : DarkModeResult)
+ : (selected ? LightModeSelectedResult : LightModeResult);
result.detach();
return result;
}
@@ -189,20 +212,21 @@ void UpdateIcon(const NSStatusItem *status) {
const auto selectedSize = QSize(side, side);
auto result = TrayIconBack(darkMode);
- auto resultActive = result;
- resultActive.detach();
+ auto resultActive = TrayIconBack(darkMode, true);
- const auto counter = Core::App().unreadBadge();
- const auto muted = Core::App().unreadBadgeMuted();
+ if (!::Kotato::JsonSettings::GetBool("disable_tray_counter")) {
+ const auto counter = Core::App().unreadBadge();
+ const auto muted = Core::App().unreadBadgeMuted();
- const auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
- const auto &fg = st::trayCounterFg;
- const auto &fgInvert = st::trayCounterFgMacInvert;
- const auto &bgInvert = st::trayCounterBgMacInvert;
+ const auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
+ const auto &fg = st::trayCounterFg;
+ const auto &fgInvert = st::trayCounterFgMacInvert;
+ const auto &bgInvert = st::trayCounterBgMacInvert;
- const auto &resultFg = !darkMode ? fg : muted ? fgInvert : fg;
- PlaceCounter(result, side, counter, bg, resultFg);
- PlaceCounter(resultActive, side, counter, bgInvert, fgInvert);
+ const auto &resultFg = !darkMode ? fg : muted ? fgInvert : fg;
+ PlaceCounter(result, side, counter, bg, resultFg);
+ PlaceCounter(resultActive, side, counter, bgInvert, fgInvert);
+ }
// Scale large pixmaps to fit the available menu bar area.
if (result.height() > maxImageHeight) {
diff --git a/Telegram/SourceFiles/platform/win/tray_win.cpp b/Telegram/SourceFiles/platform/win/tray_win.cpp
index b0e6ccfda..b54203bcb 100644
--- a/Telegram/SourceFiles/platform/win/tray_win.cpp
+++ b/Telegram/SourceFiles/platform/win/tray_win.cpp
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/win/tray_win.h"
#include "kotato/kotato_lang.h"
+#include "kotato/kotato_settings.h"
#include "base/invoke_queued.h"
#include "base/qt_signal_producer.h"
#include "core/application.h"
@@ -32,8 +33,11 @@ constexpr auto kTooltipDelay = crl::time(10000);
bool supportMode,
bool smallIcon) {
static constexpr auto kCount = 3;
- static auto ScaledLogo = std::array();
- static auto ScaledLogoNoMargin = std::array();
+ static constexpr auto kLogoCount = 7;
+ static constexpr auto kTotalCount = kLogoCount * kCount;
+ static auto ScaledLogo = std::array();
+ static auto ScaledLogoNoMargin = std::array();
+ static auto CustomIcon = QImage(cWorkingDir() + "tdata/icon.png");
struct Dimensions {
int index = 0;
@@ -62,13 +66,19 @@ constexpr auto kTooltipDelay = crl::time(10000);
auto &scaled = smallIcon ? ScaledLogoNoMargin : ScaledLogo;
auto result = [&] {
- auto &image = scaled[d.index];
+ const auto idx = CustomIcon.isNull()
+ ? ::Kotato::JsonSettings::GetInt("custom_app_icon")
+ : kLogoCount - 1;
+ auto &image = scaled[idx * kCount + d.index];
+
if (image.isNull()) {
- image = (smallIcon
- ? Window::LogoNoMargin()
- : Window::Logo()).scaledToWidth(
- d.size,
- Qt::SmoothTransformation);
+ image = !CustomIcon.isNull()
+ ? CustomIcon.scaledToWidth(d.size, Qt::SmoothTransformation)
+ : (smallIcon
+ ? Window::LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon"))
+ : Window::Logo(::Kotato::JsonSettings::GetInt("custom_app_icon"))).scaledToWidth(
+ d.size,
+ Qt::SmoothTransformation);
}
return image;
}();
@@ -134,7 +144,8 @@ void Tray::updateIcon() {
if (!_icon) {
return;
}
- const auto counter = Core::App().unreadBadge();
+ const auto disableTrayCounter = ::Kotato::JsonSettings::GetBool("disable_tray_counter");
+ const auto counter = disableTrayCounter ? 0 : Core::App().unreadBadge();
const auto muted = Core::App().unreadBadgeMuted();
const auto controller = Core::App().primaryWindow();
const auto session = !controller
diff --git a/Telegram/SourceFiles/settings/settings.style b/Telegram/SourceFiles/settings/settings.style
index 72c8f5b42..36a80dc7c 100644
--- a/Telegram/SourceFiles/settings/settings.style
+++ b/Telegram/SourceFiles/settings/settings.style
@@ -69,6 +69,7 @@ settingsIconStickers: icon {{ "settings/stickers", settingsIconFg }};
settingsIconEmoji: icon {{ "settings/emoji", settingsIconFg }};
settingsIconThemes: icon {{ "settings/palette", settingsIconFg }};
settingsIconKotato: icon {{ "settings/kotato", settingsIconFg }};
+settingsIconKotatoOld: icon {{ "settings/kotato_old", settingsIconFg }};
settingsIconGroup: icon {{ "settings/group", settingsIconFg }};
settingsIconChannel: icon {{ "settings/channel", settingsIconFg }};
settingsIconUser: icon {{ "settings/user", settingsIconFg }};
diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp
index d06bb9859..04af20997 100644
--- a/Telegram/SourceFiles/settings/settings_main.cpp
+++ b/Telegram/SourceFiles/settings/settings_main.cpp
@@ -374,7 +374,9 @@ void SetupSections(
addSection(
rktr("ktg_settings_kotato"),
Kotato::Id(),
- { &st::settingsIconKotato, kIconPurple });
+ {(::Kotato::JsonSettings::GetInt("custom_app_icon") == 5
+ ? &st::settingsIconKotatoOld
+ : &st::settingsIconKotato), kIconPurple });
SetupLanguageButton(container);
diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp
index 5aa6c3dab..08b8b6b67 100644
--- a/Telegram/SourceFiles/settings/settings_notifications.cpp
+++ b/Telegram/SourceFiles/settings/settings_notifications.cpp
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "settings/settings_notifications.h"
+#include "kotato/kotato_settings.h"
#include "settings/settings_common.h"
#include "ui/controls/chat_service_checkbox.h"
#include "ui/effects/animations.h"
@@ -270,7 +271,7 @@ void NotificationsCount::prepareNotificationSampleSmall() {
void NotificationsCount::prepareNotificationSampleUserpic() {
if (_notificationSampleUserpic.isNull()) {
_notificationSampleUserpic = Ui::PixmapFromImage(
- Window::LogoNoMargin().scaled(
+ Window::LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")).scaled(
st::notifyPhotoSize * cIntRetinaFactor(),
st::notifyPhotoSize * cIntRetinaFactor(),
Qt::IgnoreAspectRatio,
diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp
index 920981ab8..abd9d78f9 100644
--- a/Telegram/SourceFiles/window/main_window.cpp
+++ b/Telegram/SourceFiles/window/main_window.cpp
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "window/main_window.h"
+#include "kotato/kotato_settings.h"
#include "storage/localstorage.h"
#include "platform/platform_specific.h"
#include "ui/platform/ui_platform_window.h"
@@ -49,13 +50,41 @@ constexpr auto kSaveWindowPositionTimeout = crl::time(1000);
} // namespace
-const QImage &Logo() {
+const QImage &Logo(int variant) {
static const auto result = QImage(u":/gui/art/logo_256.png"_q);
+ static const auto result_blue = QImage(u":/gui/art/logo_256_blue.png"_q);
+ static const auto result_green = QImage(u":/gui/art/logo_256_green.png"_q);
+ static const auto result_orange = QImage(u":/gui/art/logo_256_orange.png"_q);
+ static const auto result_red = QImage(u":/gui/art/logo_256_red.png"_q);
+ static const auto result_old = QImage(u":/gui/art/logo_256_old.png"_q);
+
+ switch (variant) {
+ case 1: return result_blue;
+ case 2: return result_green;
+ case 3: return result_orange;
+ case 4: return result_red;
+ case 5: return result_old;
+ }
+
return result;
}
-const QImage &LogoNoMargin() {
+const QImage &LogoNoMargin(int variant) {
static const auto result = QImage(u":/gui/art/logo_256_no_margin.png"_q);
+ static const auto result_blue = QImage(u":/gui/art/logo_256_no_margin_blue.png"_q);
+ static const auto result_green = QImage(u":/gui/art/logo_256_no_margin_green.png"_q);
+ static const auto result_orange = QImage(u":/gui/art/logo_256_no_margin_orange.png"_q);
+ static const auto result_red = QImage(u":/gui/art/logo_256_no_margin_red.png"_q);
+ static const auto result_old = QImage(u":/gui/art/logo_256_no_margin_old.png"_q);
+
+ switch (variant) {
+ case 1: return result_blue;
+ case 2: return result_green;
+ case 3: return result_orange;
+ case 4: return result_red;
+ case 5: return result_old;
+ }
+
return result;
}
@@ -111,7 +140,12 @@ QIcon CreateOfficialIcon(Main::Session *session) {
if (!support) {
return QIcon();
}
- auto image = Logo();
+ const auto customIcon = QImage(cWorkingDir() + "tdata/icon.png");
+
+ auto image = customIcon.isNull()
+ ? Logo(::Kotato::JsonSettings::GetInt("custom_app_icon"))
+ : customIcon;
+
ConvertIconToBlack(image);
return QIcon(Ui::PixmapFromImage(std::move(image)));
}
@@ -125,6 +159,12 @@ QIcon CreateIcon(Main::Session *session, bool returnNullIfDefault) {
auto result = QIcon(Ui::PixmapFromImage(base::duplicate(Logo())));
#if defined Q_OS_UNIX && !defined Q_OS_MAC
+ if ((session && session->supportMode())
+ || (::Kotato::JsonSettings::GetInt("custom_app_icon") != 0)
+ || QFileInfo::exists(cWorkingDir() + "tdata/icon.png")) {
+ return result;
+ }
+
const auto iconFromTheme = QIcon::fromTheme(
Platform::GetIconName(),
result);
@@ -414,9 +454,11 @@ void MainWindow::updateWindowIcon() {
? &sessionController()->session()
: nullptr;
const auto supportIcon = session && session->supportMode();
- if (supportIcon != _usingSupportIcon || _icon.isNull()) {
+ const auto customAppIcon = ::Kotato::JsonSettings::GetInt("custom_app_icon");
+ if (supportIcon != _usingSupportIcon || _icon.isNull() || _customIconId != customAppIcon) {
_icon = CreateIcon(session);
_usingSupportIcon = supportIcon;
+ _customIconId = customAppIcon;
}
setWindowIcon(_icon);
}
diff --git a/Telegram/SourceFiles/window/main_window.h b/Telegram/SourceFiles/window/main_window.h
index 9bb035df0..0fe07c718 100644
--- a/Telegram/SourceFiles/window/main_window.h
+++ b/Telegram/SourceFiles/window/main_window.h
@@ -35,8 +35,8 @@ class SessionController;
class TitleWidget;
struct TermsLock;
-[[nodiscard]] const QImage &Logo();
-[[nodiscard]] const QImage &LogoNoMargin();
+[[nodiscard]] const QImage &Logo(int variant = 0);
+[[nodiscard]] const QImage &LogoNoMargin(int variant = 0);
[[nodiscard]] QIcon CreateIcon(
Main::Session *session = nullptr,
bool returnNullIfDefault = false);
@@ -209,6 +209,7 @@ private:
QIcon _icon;
bool _usingSupportIcon = false;
+ int _customIconId = 0;
bool _isActive = false;
diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp
index 2a1c3c593..75e7f5419 100644
--- a/Telegram/SourceFiles/window/notifications_manager_default.cpp
+++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "window/notifications_manager_default.h"
+#include "kotato/kotato_settings.h"
#include "platform/platform_notifications_manager.h"
#include "platform/platform_specific.h"
#include "core/application.h"
@@ -97,7 +98,7 @@ Manager::QueuedNotification::QueuedNotification(NotificationFields &&fields)
QPixmap Manager::hiddenUserpicPlaceholder() const {
if (_hiddenUserpicPlaceholder.isNull()) {
_hiddenUserpicPlaceholder = Ui::PixmapFromImage(
- LogoNoMargin().scaled(
+ LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")).scaled(
st::notifyPhotoSize,
st::notifyPhotoSize,
Qt::IgnoreAspectRatio,
diff --git a/Telegram/SourceFiles/window/notifications_utilities.cpp b/Telegram/SourceFiles/window/notifications_utilities.cpp
index 2911ed575..295a1bd1a 100644
--- a/Telegram/SourceFiles/window/notifications_utilities.cpp
+++ b/Telegram/SourceFiles/window/notifications_utilities.cpp
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "window/notifications_utilities.h"
+#include "kotato/kotato_settings.h"
#include "window/main_window.h"
#include "base/platform/base_platform_file_utilities.h"
#include "base/random.h"
@@ -80,7 +81,7 @@ QString CachedUserpics::get(
peer->saveUserpic(view, v.path, st::notifyMacPhotoSize);
}
} else {
- LogoNoMargin().save(v.path, "PNG");
+ LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")).save(v.path, "PNG");
}
i = _images.insert(key, v);
_someSavedFlag = true;