[Option][GUI] Tray icon settings
BIN
Telegram/Resources/art/icon256blue.ico
Normal file
|
After Width: | Height: | Size: 401 KiB |
BIN
Telegram/Resources/art/icon256green.ico
Normal file
|
After Width: | Height: | Size: 401 KiB |
BIN
Telegram/Resources/art/icon256old.ico
Normal file
|
After Width: | Height: | Size: 361 KiB |
BIN
Telegram/Resources/art/icon256orange.ico
Normal file
|
After Width: | Height: | Size: 401 KiB |
BIN
Telegram/Resources/art/icon256red.ico
Normal file
|
After Width: | Height: | Size: 401 KiB |
BIN
Telegram/Resources/art/icon512_blue@2x.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
Telegram/Resources/art/icon512_green@2x.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
Telegram/Resources/art/icon512_orange@2x.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
Telegram/Resources/art/icon512_red@2x.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
Telegram/Resources/art/logo_256_blue.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Telegram/Resources/art/logo_256_green.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
Telegram/Resources/art/logo_256_no_margin_blue.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Telegram/Resources/art/logo_256_no_margin_green.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Telegram/Resources/art/logo_256_no_margin_old.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Telegram/Resources/art/logo_256_no_margin_orange.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Telegram/Resources/art/logo_256_no_margin_red.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Telegram/Resources/art/logo_256_old.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
Telegram/Resources/art/logo_256_orange.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Telegram/Resources/art/logo_256_red.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
Telegram/Resources/icons/settings/kotato_old.png
Normal file
|
After Width: | Height: | Size: 727 B |
BIN
Telegram/Resources/icons/settings/kotato_old@2x.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Telegram/Resources/icons/settings/kotato_old@3x.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -64,6 +64,16 @@
|
||||||
"ktg_settings_recent_stickers_limit_none": "Recent stickers: hide all",
|
"ktg_settings_recent_stickers_limit_none": "Recent stickers: hide all",
|
||||||
"ktg_settings_filters": "Folders",
|
"ktg_settings_filters": "Folders",
|
||||||
"ktg_settings_messages": "Messages",
|
"ktg_settings_messages": "Messages",
|
||||||
|
"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": "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_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",
|
"ktg_settings_chat_id_disable": "Hide",
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,17 @@
|
||||||
<file alias="art/bg_initial.jpg">../../art/bg_initial.jpg</file>
|
<file alias="art/bg_initial.jpg">../../art/bg_initial.jpg</file>
|
||||||
<file alias="art/business_logo.png">../../art/business_logo.png</file>
|
<file alias="art/business_logo.png">../../art/business_logo.png</file>
|
||||||
<file alias="art/logo_256.png">../../art/logo_256.png</file>
|
<file alias="art/logo_256.png">../../art/logo_256.png</file>
|
||||||
|
<file alias="art/logo_256_blue.png">../../art/logo_256_blue.png</file>
|
||||||
|
<file alias="art/logo_256_green.png">../../art/logo_256_green.png</file>
|
||||||
|
<file alias="art/logo_256_orange.png">../../art/logo_256_orange.png</file>
|
||||||
|
<file alias="art/logo_256_red.png">../../art/logo_256_red.png</file>
|
||||||
|
<file alias="art/logo_256_old.png">../../art/logo_256_old.png</file>
|
||||||
<file alias="art/logo_256_no_margin.png">../../art/logo_256_no_margin.png</file>
|
<file alias="art/logo_256_no_margin.png">../../art/logo_256_no_margin.png</file>
|
||||||
|
<file alias="art/logo_256_no_margin_blue.png">../../art/logo_256_no_margin_blue.png</file>
|
||||||
|
<file alias="art/logo_256_no_margin_green.png">../../art/logo_256_no_margin_green.png</file>
|
||||||
|
<file alias="art/logo_256_no_margin_orange.png">../../art/logo_256_no_margin_orange.png</file>
|
||||||
|
<file alias="art/logo_256_no_margin_red.png">../../art/logo_256_no_margin_red.png</file>
|
||||||
|
<file alias="art/logo_256_no_margin_old.png">../../art/logo_256_no_margin_old.png</file>
|
||||||
<file alias="art/themeimage.jpg">../../art/themeimage.jpg</file>
|
<file alias="art/themeimage.jpg">../../art/themeimage.jpg</file>
|
||||||
<file alias="art/dice_idle.tgs">../../art/dice_idle.tgs</file>
|
<file alias="art/dice_idle.tgs">../../art/dice_idle.tgs</file>
|
||||||
<file alias="art/dart_idle.tgs">../../art/dart_idle.tgs</file>
|
<file alias="art/dart_idle.tgs">../../art/dart_idle.tgs</file>
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,11 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
// Icon with lowest ID value placed first to ensure application icon
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
// remains consistent on all systems.
|
// remains consistent on all systems.
|
||||||
IDI_ICON1 ICON "..\\art\\icon256.ico"
|
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"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -296,6 +296,16 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
||||||
{ "always_show_top_userpic", {
|
{ "always_show_top_userpic", {
|
||||||
.type = SettingType::BoolSetting,
|
.type = SettingType::BoolSetting,
|
||||||
.defaultValue = false, }},
|
.defaultValue = false, }},
|
||||||
|
{ "disable_tray_counter", {
|
||||||
|
.type = SettingType::BoolSetting,
|
||||||
|
.defaultValue = false, }},
|
||||||
|
{ "use_telegram_panel_icon", {
|
||||||
|
.type = SettingType::BoolSetting,
|
||||||
|
.defaultValue = false, }},
|
||||||
|
{ "custom_app_icon", {
|
||||||
|
.type = SettingType::IntSetting,
|
||||||
|
.defaultValue = 0,
|
||||||
|
.limitHandler = IntLimit(0, 5), }},
|
||||||
};
|
};
|
||||||
|
|
||||||
using OldOptionKey = QString;
|
using OldOptionKey = QString;
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,31 @@ namespace Settings {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
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) {
|
QString ChatIdLabel(int option) {
|
||||||
switch (option) {
|
switch (option) {
|
||||||
|
|
@ -267,6 +292,62 @@ void SetupKotatoSystem(
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(container);
|
||||||
Ui::AddSubsectionTitle(container, rktr("ktg_settings_system"));
|
Ui::AddSubsectionTitle(container, rktr("ktg_settings_system"));
|
||||||
|
|
||||||
|
container->add(object_ptr<Button>(
|
||||||
|
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()) {
|
||||||
|
container->add(object_ptr<Button>(
|
||||||
|
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));
|
||||||
|
});
|
||||||
|
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(container);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "platform/linux/tray_linux.h"
|
#include "platform/linux/tray_linux.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "base/invoke_queued.h"
|
#include "base/invoke_queued.h"
|
||||||
#include "base/qt_signal_producer.h"
|
#include "base/qt_signal_producer.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
|
@ -25,11 +26,18 @@ namespace Platform {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
[[nodiscard]] QString PanelIconName(int counter, bool muted) {
|
[[nodiscard]] QString PanelIconName(int counter, bool muted) {
|
||||||
|
const auto useTelegramPanelIcon = ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon");
|
||||||
return (counter > 0)
|
return (counter > 0)
|
||||||
? (muted
|
? (muted
|
||||||
? u"kotatogram-mute-panel"_q
|
? (useTelegramPanelIcon
|
||||||
: u"kotatogram-attention-panel"_q)
|
? u"telegram-mute-panel"_q
|
||||||
: u"kotatogram-panel"_q;
|
: u"kotatogram-mute-panel"_q)
|
||||||
|
: (useTelegramPanelIcon
|
||||||
|
? u"telegram-attention-panel"_q
|
||||||
|
: u"kotatogram-attention-panel"_q))
|
||||||
|
: (useTelegramPanelIcon
|
||||||
|
? u"telegram-panel"_q
|
||||||
|
: u"kotatogram-panel"_q);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
@ -76,6 +84,9 @@ private:
|
||||||
QIcon _systemIcon;
|
QIcon _systemIcon;
|
||||||
QString _themeName;
|
QString _themeName;
|
||||||
bool _monochrome;
|
bool _monochrome;
|
||||||
|
int _customId = 0;
|
||||||
|
bool _counterDisabled = false;
|
||||||
|
bool _telegramPanelIcon = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -93,7 +104,8 @@ QIcon IconGraphic::systemIcon(
|
||||||
if (iconThemeName == _themeName
|
if (iconThemeName == _themeName
|
||||||
&& monochrome == _monochrome
|
&& monochrome == _monochrome
|
||||||
&& (counter > 0) == (_count > 0)
|
&& (counter > 0) == (_count > 0)
|
||||||
&& muted == _muted) {
|
&& muted == _muted
|
||||||
|
&& ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon") == _telegramPanelIcon) {
|
||||||
return _systemIcon;
|
return _systemIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,7 +144,10 @@ bool IconGraphic::isRefreshNeeded(
|
||||||
|| systemIcon.name() != _systemIcon.name()
|
|| systemIcon.name() != _systemIcon.name()
|
||||||
|| (systemIcon.name() != PanelIconName(counter, muted)
|
|| (systemIcon.name() != PanelIconName(counter, muted)
|
||||||
? muted != _muted || counterSlice(counter) != _count
|
? muted != _muted || counterSlice(counter) != _count
|
||||||
: false);
|
: false)
|
||||||
|
|| ::Kotato::JsonSettings::GetInt("custom_app_icon") != _customId
|
||||||
|
|| ::Kotato::JsonSettings::GetBool("disable_tray_counter") != _counterDisabled
|
||||||
|
|| ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon") != _telegramPanelIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconGraphic::updateIconRegenerationNeeded(
|
void IconGraphic::updateIconRegenerationNeeded(
|
||||||
|
|
@ -148,6 +163,9 @@ void IconGraphic::updateIconRegenerationNeeded(
|
||||||
_monochrome = monochrome;
|
_monochrome = monochrome;
|
||||||
_count = counterSlice(counter);
|
_count = counterSlice(counter);
|
||||||
_muted = muted;
|
_muted = muted;
|
||||||
|
_customId = ::Kotato::JsonSettings::GetInt("custom_app_icon");
|
||||||
|
_counterDisabled = ::Kotato::JsonSettings::GetBool("disable_tray_counter");
|
||||||
|
_telegramPanelIcon = ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize IconGraphic::dprSize(const QImage &image) const {
|
QSize IconGraphic::dprSize(const QImage &image) const {
|
||||||
|
|
@ -177,6 +195,8 @@ QIcon IconGraphic::trayIcon(
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon result;
|
QIcon result;
|
||||||
|
const auto customAppIcon = ::Kotato::JsonSettings::GetInt("custom_app_icon");
|
||||||
|
const auto disableTrayCounter = ::Kotato::JsonSettings::GetInt("disable_tray_counter");
|
||||||
|
|
||||||
for (const auto iconSize : _iconSizes) {
|
for (const auto iconSize : _iconSizes) {
|
||||||
auto ¤tImageBack = _imageBack[iconSize];
|
auto ¤tImageBack = _imageBack[iconSize];
|
||||||
|
|
@ -184,8 +204,14 @@ QIcon IconGraphic::trayIcon(
|
||||||
|
|
||||||
if (currentImageBack.isNull()
|
if (currentImageBack.isNull()
|
||||||
|| iconThemeName != _themeName
|
|| iconThemeName != _themeName
|
||||||
|| systemIcon.name() != _systemIcon.name()) {
|
|| systemIcon.name() != _systemIcon.name()
|
||||||
if (!systemIcon.isNull()) {
|
|| 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 (!systemIcon.isNull()) {
|
||||||
// We can't use QIcon::actualSize here
|
// We can't use QIcon::actualSize here
|
||||||
// since it works incorrectly with svg icon themes
|
// since it works incorrectly with svg icon themes
|
||||||
currentImageBack = systemIcon
|
currentImageBack = systemIcon
|
||||||
|
|
@ -222,7 +248,7 @@ QIcon IconGraphic::trayIcon(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.addPixmap(Ui::PixmapFromImage(counter > 0
|
result.addPixmap(Ui::PixmapFromImage((!disableTrayCounter && counter > 0)
|
||||||
? Window::WithSmallCounter(std::move(currentImageBack), {
|
? Window::WithSmallCounter(std::move(currentImageBack), {
|
||||||
.size = iconSize,
|
.size = iconSize,
|
||||||
.count = counter,
|
.count = counter,
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,7 @@ private:
|
||||||
#else // Qt >= 6.5.0
|
#else // Qt >= 6.5.0
|
||||||
Core::App().settings().setSystemDarkMode(Platform::IsDarkMode());
|
Core::App().settings().setSystemDarkMode(Platform::IsDarkMode());
|
||||||
#endif // Qt < 6.5.0
|
#endif // Qt < 6.5.0
|
||||||
|
Core::App().domain().notifyUnreadBadgeChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif // Qt < 6.6.0
|
#endif // Qt < 6.6.0
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "platform/mac/tray_mac.h"
|
#include "platform/mac/tray_mac.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "base/platform/mac/base_utilities_mac.h"
|
#include "base/platform/mac/base_utilities_mac.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/sandbox.h"
|
#include "core/sandbox.h"
|
||||||
|
|
@ -91,13 +92,35 @@ namespace {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QImage TrayIconBack(bool darkMode) {
|
[[nodiscard]] QImage TrayIconBack(bool darkMode, bool selected = false) {
|
||||||
static const auto WithColor = [](QColor color) {
|
static const auto WithColor = [](QColor color) {
|
||||||
return st::macTrayIcon.instance(color, 100);
|
return st::macTrayIcon.instance(color, 100);
|
||||||
};
|
};
|
||||||
static const auto DarkModeResult = WithColor({ 255, 255, 255 });
|
|
||||||
static const auto LightModeResult = WithColor({ 0, 0, 0, 180 });
|
QImage iconImageLight(cWorkingDir() + "tdata/icon.png");
|
||||||
auto result = darkMode ? DarkModeResult : LightModeResult;
|
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();
|
result.detach();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -190,20 +213,21 @@ void UpdateIcon(const NSStatusItem *status) {
|
||||||
const auto selectedSize = QSize(side, side);
|
const auto selectedSize = QSize(side, side);
|
||||||
|
|
||||||
auto result = TrayIconBack(darkMode);
|
auto result = TrayIconBack(darkMode);
|
||||||
auto resultActive = result;
|
auto resultActive = TrayIconBack(darkMode, true);
|
||||||
resultActive.detach();
|
|
||||||
|
|
||||||
const auto counter = Core::App().unreadBadge();
|
if (!::Kotato::JsonSettings::GetBool("disable_tray_counter")) {
|
||||||
const auto muted = Core::App().unreadBadgeMuted();
|
const auto counter = Core::App().unreadBadge();
|
||||||
|
const auto muted = Core::App().unreadBadgeMuted();
|
||||||
|
|
||||||
const auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
|
const auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
|
||||||
const auto &fg = st::trayCounterFg;
|
const auto &fg = st::trayCounterFg;
|
||||||
const auto &fgInvert = st::trayCounterFgMacInvert;
|
const auto &fgInvert = st::trayCounterFgMacInvert;
|
||||||
const auto &bgInvert = st::trayCounterBgMacInvert;
|
const auto &bgInvert = st::trayCounterBgMacInvert;
|
||||||
|
|
||||||
const auto &resultFg = !darkMode ? fg : muted ? fgInvert : fg;
|
const auto &resultFg = !darkMode ? fg : muted ? fgInvert : fg;
|
||||||
PlaceCounter(result, side, counter, bg, resultFg);
|
PlaceCounter(result, side, counter, bg, resultFg);
|
||||||
PlaceCounter(resultActive, side, counter, bgInvert, fgInvert);
|
PlaceCounter(resultActive, side, counter, bgInvert, fgInvert);
|
||||||
|
}
|
||||||
|
|
||||||
// Scale large pixmaps to fit the available menu bar area.
|
// Scale large pixmaps to fit the available menu bar area.
|
||||||
if (result.height() > maxImageHeight) {
|
if (result.height() > maxImageHeight) {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/win/tray_win.h"
|
#include "platform/win/tray_win.h"
|
||||||
|
|
||||||
#include "kotato/kotato_lang.h"
|
#include "kotato/kotato_lang.h"
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "base/invoke_queued.h"
|
#include "base/invoke_queued.h"
|
||||||
#include "base/qt_signal_producer.h"
|
#include "base/qt_signal_producer.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
|
@ -127,6 +128,7 @@ bool DarkTasbarValueValid/* = false*/;
|
||||||
static auto ScaledLogoNoMargin = base::flat_map<int, QImage>();
|
static auto ScaledLogoNoMargin = base::flat_map<int, QImage>();
|
||||||
static auto ScaledLogoDark = base::flat_map<int, QImage>();
|
static auto ScaledLogoDark = base::flat_map<int, QImage>();
|
||||||
static auto ScaledLogoLight = base::flat_map<int, QImage>();
|
static auto ScaledLogoLight = base::flat_map<int, QImage>();
|
||||||
|
static auto CustomIcon = QImage(cWorkingDir() + "tdata/icon.png");
|
||||||
|
|
||||||
const auto darkMode = IsDarkTaskbar();
|
const auto darkMode = IsDarkTaskbar();
|
||||||
auto &scaled = (monochrome && darkMode)
|
auto &scaled = (monochrome && darkMode)
|
||||||
|
|
@ -138,17 +140,22 @@ bool DarkTasbarValueValid/* = false*/;
|
||||||
: ScaledLogo;
|
: ScaledLogo;
|
||||||
|
|
||||||
auto result = [&] {
|
auto result = [&] {
|
||||||
|
const auto idx = CustomIcon.isNull()
|
||||||
|
? ::Kotato::JsonSettings::GetInt("custom_app_icon")
|
||||||
|
: 0;
|
||||||
if (const auto it = scaled.find(args.size); it != scaled.end()) {
|
if (const auto it = scaled.find(args.size); it != scaled.end()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
} else if (monochrome && darkMode) {
|
} else if (monochrome && darkMode) {
|
||||||
return MonochromeIconFor(args.size, *darkMode);
|
return MonochromeIconFor(args.size, *darkMode);
|
||||||
}
|
}
|
||||||
return scaled.emplace(
|
return scaled.emplace(
|
||||||
args.size,
|
args.size + idx,
|
||||||
(smallIcon
|
!CustomIcon.isNull()
|
||||||
? Window::LogoNoMargin()
|
? CustomIcon.scaledToWidth(args.size, Qt::SmoothTransformation)
|
||||||
: Window::Logo()
|
: (smallIcon
|
||||||
).scaledToWidth(args.size, Qt::SmoothTransformation)
|
? Window::LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon"))
|
||||||
|
: Window::Logo(::Kotato::JsonSettings::GetInt("custom_app_icon"))
|
||||||
|
).scaledToWidth(args.size, Qt::SmoothTransformation)
|
||||||
).first->second;
|
).first->second;
|
||||||
}();
|
}();
|
||||||
if ((!monochrome || !darkMode) && supportMode) {
|
if ((!monochrome || !darkMode) && supportMode) {
|
||||||
|
|
@ -159,6 +166,8 @@ bool DarkTasbarValueValid/* = false*/;
|
||||||
} else if (smallIcon) {
|
} else if (smallIcon) {
|
||||||
if (monochrome && darkMode) {
|
if (monochrome && darkMode) {
|
||||||
return MonochromeWithDot(std::move(result), args.bg);
|
return MonochromeWithDot(std::move(result), args.bg);
|
||||||
|
} else if (::Kotato::JsonSettings::GetBool("disable_tray_counter")) {
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return Window::WithSmallCounter(std::move(result), std::move(args));
|
return Window::WithSmallCounter(std::move(result), std::move(args));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ settingsIconInterfaceScale: icon {{ "settings/interface_scale", settingsIconFg }
|
||||||
settingsIconStickers: icon {{ "settings/stickers", settingsIconFg }};
|
settingsIconStickers: icon {{ "settings/stickers", settingsIconFg }};
|
||||||
settingsIconEmoji: icon {{ "settings/emoji", settingsIconFg }};
|
settingsIconEmoji: icon {{ "settings/emoji", settingsIconFg }};
|
||||||
settingsIconKotato: icon {{ "settings/kotato", settingsIconFg }};
|
settingsIconKotato: icon {{ "settings/kotato", settingsIconFg }};
|
||||||
|
settingsIconKotatoOld: icon {{ "settings/kotato_old", settingsIconFg }};
|
||||||
|
|
||||||
settingsPremiumIconWallpapers: icon {{ "settings/photo", settingsIconFg }};
|
settingsPremiumIconWallpapers: icon {{ "settings/photo", settingsIconFg }};
|
||||||
settingsPremiumIconStories: icon {{ "settings/stories", settingsIconFg }};
|
settingsPremiumIconStories: icon {{ "settings/stories", settingsIconFg }};
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,9 @@ void SetupSections(
|
||||||
addSection(
|
addSection(
|
||||||
rktr("ktg_settings_kotato"),
|
rktr("ktg_settings_kotato"),
|
||||||
Kotato::Id(),
|
Kotato::Id(),
|
||||||
{ &st::settingsIconKotato });
|
{(::Kotato::JsonSettings::GetInt("custom_app_icon") == 5
|
||||||
|
? &st::settingsIconKotatoOld
|
||||||
|
: &st::settingsIconKotato) });
|
||||||
|
|
||||||
SetupPowerSavingButton(&controller->window(), container);
|
SetupPowerSavingButton(&controller->window(), container);
|
||||||
SetupLanguageButton(&controller->window(), container);
|
SetupLanguageButton(&controller->window(), container);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "settings/settings_notifications.h"
|
#include "settings/settings_notifications.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "settings/settings_notifications_type.h"
|
#include "settings/settings_notifications_type.h"
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/controls/chat_service_checkbox.h"
|
#include "ui/controls/chat_service_checkbox.h"
|
||||||
|
|
@ -430,7 +431,7 @@ void NotificationsCount::prepareNotificationSampleSmall() {
|
||||||
void NotificationsCount::prepareNotificationSampleUserpic() {
|
void NotificationsCount::prepareNotificationSampleUserpic() {
|
||||||
if (_notificationSampleUserpic.isNull()) {
|
if (_notificationSampleUserpic.isNull()) {
|
||||||
_notificationSampleUserpic = Ui::PixmapFromImage(
|
_notificationSampleUserpic = Ui::PixmapFromImage(
|
||||||
Window::LogoNoMargin().scaled(
|
Window::LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")).scaled(
|
||||||
st::notifyPhotoSize * style::DevicePixelRatio(),
|
st::notifyPhotoSize * style::DevicePixelRatio(),
|
||||||
st::notifyPhotoSize * style::DevicePixelRatio(),
|
st::notifyPhotoSize * style::DevicePixelRatio(),
|
||||||
Qt::IgnoreAspectRatio,
|
Qt::IgnoreAspectRatio,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "window/main_window.h"
|
#include "window/main_window.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "api/api_updates.h"
|
#include "api/api_updates.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
|
|
@ -77,13 +78,41 @@ base::options::toggle OptionNewWindowsSizeAsFirst({
|
||||||
|
|
||||||
const char kOptionNewWindowsSizeAsFirst[] = "new-windows-size-as-first";
|
const char kOptionNewWindowsSizeAsFirst[] = "new-windows-size-as-first";
|
||||||
|
|
||||||
const QImage &Logo() {
|
const QImage &Logo(int variant) {
|
||||||
static const auto result = QImage(u":/gui/art/logo_256.png"_q);
|
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;
|
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 = 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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,10 +172,15 @@ QIcon CreateOfficialIcon(Main::Session *session) {
|
||||||
if (!support) {
|
if (!support) {
|
||||||
return QIcon();
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
const auto customIcon = QImage(cWorkingDir() + "tdata/icon.png");
|
||||||
auto overriden = OverridenIcon();
|
auto overriden = OverridenIcon();
|
||||||
auto image = overriden.isNull()
|
|
||||||
? Platform::DefaultApplicationIcon()
|
auto image = customIcon.isNull()
|
||||||
: overriden;
|
? overriden.isNull()
|
||||||
|
? Logo(::Kotato::JsonSettings::GetInt("custom_app_icon"))
|
||||||
|
: overriden
|
||||||
|
: customIcon;
|
||||||
|
|
||||||
ConvertIconToBlack(image);
|
ConvertIconToBlack(image);
|
||||||
return QIcon(Ui::PixmapFromImage(std::move(image)));
|
return QIcon(Ui::PixmapFromImage(std::move(image)));
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +193,9 @@ QIcon CreateIcon(Main::Session *session, bool returnNullIfDefault) {
|
||||||
|
|
||||||
auto result = QIcon(Ui::PixmapFromImage(base::duplicate(Logo())));
|
auto result = QIcon(Ui::PixmapFromImage(base::duplicate(Logo())));
|
||||||
|
|
||||||
if constexpr (!Platform::IsLinux()) {
|
if ((session && session->supportMode())
|
||||||
|
|| (::Kotato::JsonSettings::GetInt("custom_app_icon") != 0)
|
||||||
|
|| QFileInfo::exists(cWorkingDir() + "tdata/icon.png")) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ class SessionController;
|
||||||
class TitleWidget;
|
class TitleWidget;
|
||||||
struct TermsLock;
|
struct TermsLock;
|
||||||
|
|
||||||
[[nodiscard]] const QImage &Logo();
|
[[nodiscard]] const QImage &Logo(int variant = 0);
|
||||||
[[nodiscard]] const QImage &LogoNoMargin();
|
[[nodiscard]] const QImage &LogoNoMargin(int variant = 0);
|
||||||
void OverrideApplicationIcon(QImage image);
|
void OverrideApplicationIcon(QImage image);
|
||||||
[[nodiscard]] QIcon CreateIcon(
|
[[nodiscard]] QIcon CreateIcon(
|
||||||
Main::Session *session = nullptr,
|
Main::Session *session = nullptr,
|
||||||
|
|
@ -217,6 +217,8 @@ private:
|
||||||
object_ptr<Ui::RpWidget> _body;
|
object_ptr<Ui::RpWidget> _body;
|
||||||
object_ptr<TWidget> _rightColumn = { nullptr };
|
object_ptr<TWidget> _rightColumn = { nullptr };
|
||||||
|
|
||||||
|
int _customIconId = 0;
|
||||||
|
|
||||||
bool _isActive = false;
|
bool _isActive = false;
|
||||||
|
|
||||||
rpl::event_stream<> _leaveEvents;
|
rpl::event_stream<> _leaveEvents;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "window/notifications_manager_default.h"
|
#include "window/notifications_manager_default.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "platform/platform_notifications_manager.h"
|
#include "platform/platform_notifications_manager.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
|
@ -103,7 +104,7 @@ QPixmap Manager::hiddenUserpicPlaceholder() const {
|
||||||
if (_hiddenUserpicPlaceholder.isNull()) {
|
if (_hiddenUserpicPlaceholder.isNull()) {
|
||||||
const auto ratio = style::DevicePixelRatio();
|
const auto ratio = style::DevicePixelRatio();
|
||||||
_hiddenUserpicPlaceholder = Ui::PixmapFromImage(
|
_hiddenUserpicPlaceholder = Ui::PixmapFromImage(
|
||||||
LogoNoMargin().scaled(
|
LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")).scaled(
|
||||||
st::notifyPhotoSize * ratio,
|
st::notifyPhotoSize * ratio,
|
||||||
st::notifyPhotoSize * ratio,
|
st::notifyPhotoSize * ratio,
|
||||||
Qt::IgnoreAspectRatio,
|
Qt::IgnoreAspectRatio,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "window/notifications_utilities.h"
|
#include "window/notifications_utilities.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "window/main_window.h"
|
#include "window/main_window.h"
|
||||||
#include "base/platform/base_platform_file_utilities.h"
|
#include "base/platform/base_platform_file_utilities.h"
|
||||||
#include "base/random.h"
|
#include "base/random.h"
|
||||||
|
|
@ -72,7 +73,7 @@ QString CachedUserpics::get(
|
||||||
if (key.first || key.second) {
|
if (key.first || key.second) {
|
||||||
GenerateUserpic(peer, view).save(v.path, "PNG");
|
GenerateUserpic(peer, view).save(v.path, "PNG");
|
||||||
} else {
|
} else {
|
||||||
LogoNoMargin().save(v.path, "PNG");
|
LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")).save(v.path, "PNG");
|
||||||
}
|
}
|
||||||
i = _images.insert(key, v);
|
i = _images.insert(key, v);
|
||||||
_someSavedFlag = true;
|
_someSavedFlag = true;
|
||||||
|
|
|
||||||