[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_filters": "Folders",
|
||||
"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_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",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,17 @@
|
|||
<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/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_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/dice_idle.tgs">../../art/dice_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
|
||||
// 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"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
|||
|
|
@ -296,6 +296,16 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
|||
{ "always_show_top_userpic", {
|
||||
.type = SettingType::BoolSetting,
|
||||
.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;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,31 @@ namespace Settings {
|
|||
|
||||
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) {
|
||||
switch (option) {
|
||||
|
|
@ -267,6 +292,62 @@ void SetupKotatoSystem(
|
|||
Ui::AddSkip(container);
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -25,11 +26,18 @@ namespace Platform {
|
|||
namespace {
|
||||
|
||||
[[nodiscard]] QString PanelIconName(int counter, bool muted) {
|
||||
const auto useTelegramPanelIcon = ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon");
|
||||
return (counter > 0)
|
||||
? (muted
|
||||
? u"kotatogram-mute-panel"_q
|
||||
: u"kotatogram-attention-panel"_q)
|
||||
: u"kotatogram-panel"_q;
|
||||
? (useTelegramPanelIcon
|
||||
? u"telegram-mute-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
|
||||
|
|
@ -76,6 +84,9 @@ private:
|
|||
QIcon _systemIcon;
|
||||
QString _themeName;
|
||||
bool _monochrome;
|
||||
int _customId = 0;
|
||||
bool _counterDisabled = false;
|
||||
bool _telegramPanelIcon = false;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -93,7 +104,8 @@ QIcon IconGraphic::systemIcon(
|
|||
if (iconThemeName == _themeName
|
||||
&& monochrome == _monochrome
|
||||
&& (counter > 0) == (_count > 0)
|
||||
&& muted == _muted) {
|
||||
&& muted == _muted
|
||||
&& ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon") == _telegramPanelIcon) {
|
||||
return _systemIcon;
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +144,10 @@ bool IconGraphic::isRefreshNeeded(
|
|||
|| systemIcon.name() != _systemIcon.name()
|
||||
|| (systemIcon.name() != PanelIconName(counter, muted)
|
||||
? 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(
|
||||
|
|
@ -148,6 +163,9 @@ void IconGraphic::updateIconRegenerationNeeded(
|
|||
_monochrome = monochrome;
|
||||
_count = counterSlice(counter);
|
||||
_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 {
|
||||
|
|
@ -177,6 +195,8 @@ QIcon IconGraphic::trayIcon(
|
|||
}
|
||||
|
||||
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) {
|
||||
auto ¤tImageBack = _imageBack[iconSize];
|
||||
|
|
@ -184,8 +204,14 @@ QIcon IconGraphic::trayIcon(
|
|||
|
||||
if (currentImageBack.isNull()
|
||||
|| iconThemeName != _themeName
|
||||
|| systemIcon.name() != _systemIcon.name()) {
|
||||
if (!systemIcon.isNull()) {
|
||||
|| systemIcon.name() != _systemIcon.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 (!systemIcon.isNull()) {
|
||||
// We can't use QIcon::actualSize here
|
||||
// since it works incorrectly with svg icon themes
|
||||
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), {
|
||||
.size = iconSize,
|
||||
.count = counter,
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ private:
|
|||
#else // Qt >= 6.5.0
|
||||
Core::App().settings().setSystemDarkMode(Platform::IsDarkMode());
|
||||
#endif // Qt < 6.5.0
|
||||
Core::App().domain().notifyUnreadBadgeChanged();
|
||||
});
|
||||
}
|
||||
#endif // Qt < 6.6.0
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -91,13 +92,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;
|
||||
}
|
||||
|
|
@ -190,9 +213,9 @@ 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);
|
||||
|
||||
if (!::Kotato::JsonSettings::GetBool("disable_tray_counter")) {
|
||||
const auto counter = Core::App().unreadBadge();
|
||||
const auto muted = Core::App().unreadBadgeMuted();
|
||||
|
||||
|
|
@ -204,6 +227,7 @@ void UpdateIcon(const NSStatusItem *status) {
|
|||
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) {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -127,6 +128,7 @@ bool DarkTasbarValueValid/* = false*/;
|
|||
static auto ScaledLogoNoMargin = base::flat_map<int, QImage>();
|
||||
static auto ScaledLogoDark = 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();
|
||||
auto &scaled = (monochrome && darkMode)
|
||||
|
|
@ -138,16 +140,21 @@ bool DarkTasbarValueValid/* = false*/;
|
|||
: ScaledLogo;
|
||||
|
||||
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()) {
|
||||
return it->second;
|
||||
} else if (monochrome && darkMode) {
|
||||
return MonochromeIconFor(args.size, *darkMode);
|
||||
}
|
||||
return scaled.emplace(
|
||||
args.size,
|
||||
(smallIcon
|
||||
? Window::LogoNoMargin()
|
||||
: Window::Logo()
|
||||
args.size + idx,
|
||||
!CustomIcon.isNull()
|
||||
? CustomIcon.scaledToWidth(args.size, Qt::SmoothTransformation)
|
||||
: (smallIcon
|
||||
? Window::LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon"))
|
||||
: Window::Logo(::Kotato::JsonSettings::GetInt("custom_app_icon"))
|
||||
).scaledToWidth(args.size, Qt::SmoothTransformation)
|
||||
).first->second;
|
||||
}();
|
||||
|
|
@ -159,6 +166,8 @@ bool DarkTasbarValueValid/* = false*/;
|
|||
} else if (smallIcon) {
|
||||
if (monochrome && darkMode) {
|
||||
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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ settingsIconInterfaceScale: icon {{ "settings/interface_scale", settingsIconFg }
|
|||
settingsIconStickers: icon {{ "settings/stickers", settingsIconFg }};
|
||||
settingsIconEmoji: icon {{ "settings/emoji", settingsIconFg }};
|
||||
settingsIconKotato: icon {{ "settings/kotato", settingsIconFg }};
|
||||
settingsIconKotatoOld: icon {{ "settings/kotato_old", settingsIconFg }};
|
||||
|
||||
settingsPremiumIconWallpapers: icon {{ "settings/photo", settingsIconFg }};
|
||||
settingsPremiumIconStories: icon {{ "settings/stories", settingsIconFg }};
|
||||
|
|
|
|||
|
|
@ -394,7 +394,9 @@ void SetupSections(
|
|||
addSection(
|
||||
rktr("ktg_settings_kotato"),
|
||||
Kotato::Id(),
|
||||
{ &st::settingsIconKotato });
|
||||
{(::Kotato::JsonSettings::GetInt("custom_app_icon") == 5
|
||||
? &st::settingsIconKotatoOld
|
||||
: &st::settingsIconKotato) });
|
||||
|
||||
SetupPowerSavingButton(&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 "kotato/kotato_settings.h"
|
||||
#include "settings/settings_notifications_type.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/controls/chat_service_checkbox.h"
|
||||
|
|
@ -430,7 +431,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 * style::DevicePixelRatio(),
|
||||
st::notifyPhotoSize * style::DevicePixelRatio(),
|
||||
Qt::IgnoreAspectRatio,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "window/main_window.h"
|
||||
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "api/api_updates.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "platform/platform_specific.h"
|
||||
|
|
@ -77,13 +78,41 @@ base::options::toggle OptionNewWindowsSizeAsFirst({
|
|||
|
||||
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_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;
|
||||
}
|
||||
|
||||
|
|
@ -143,10 +172,15 @@ QIcon CreateOfficialIcon(Main::Session *session) {
|
|||
if (!support) {
|
||||
return QIcon();
|
||||
}
|
||||
const auto customIcon = QImage(cWorkingDir() + "tdata/icon.png");
|
||||
auto overriden = OverridenIcon();
|
||||
auto image = overriden.isNull()
|
||||
? Platform::DefaultApplicationIcon()
|
||||
: overriden;
|
||||
|
||||
auto image = customIcon.isNull()
|
||||
? overriden.isNull()
|
||||
? Logo(::Kotato::JsonSettings::GetInt("custom_app_icon"))
|
||||
: overriden
|
||||
: customIcon;
|
||||
|
||||
ConvertIconToBlack(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())));
|
||||
|
||||
if constexpr (!Platform::IsLinux()) {
|
||||
if ((session && session->supportMode())
|
||||
|| (::Kotato::JsonSettings::GetInt("custom_app_icon") != 0)
|
||||
|| QFileInfo::exists(cWorkingDir() + "tdata/icon.png")) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,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);
|
||||
void OverrideApplicationIcon(QImage image);
|
||||
[[nodiscard]] QIcon CreateIcon(
|
||||
Main::Session *session = nullptr,
|
||||
|
|
@ -217,6 +217,8 @@ private:
|
|||
object_ptr<Ui::RpWidget> _body;
|
||||
object_ptr<TWidget> _rightColumn = { nullptr };
|
||||
|
||||
int _customIconId = 0;
|
||||
|
||||
bool _isActive = false;
|
||||
|
||||
rpl::event_stream<> _leaveEvents;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -103,7 +104,7 @@ QPixmap Manager::hiddenUserpicPlaceholder() const {
|
|||
if (_hiddenUserpicPlaceholder.isNull()) {
|
||||
const auto ratio = style::DevicePixelRatio();
|
||||
_hiddenUserpicPlaceholder = Ui::PixmapFromImage(
|
||||
LogoNoMargin().scaled(
|
||||
LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")).scaled(
|
||||
st::notifyPhotoSize * ratio,
|
||||
st::notifyPhotoSize * ratio,
|
||||
Qt::IgnoreAspectRatio,
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -72,7 +73,7 @@ QString CachedUserpics::get(
|
|||
if (key.first || key.second) {
|
||||
GenerateUserpic(peer, view).save(v.path, "PNG");
|
||||
} else {
|
||||
LogoNoMargin().save(v.path, "PNG");
|
||||
LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")).save(v.path, "PNG");
|
||||
}
|
||||
i = _images.insert(key, v);
|
||||
_someSavedFlag = true;
|
||||
|
|
|
|||