[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/settings_kotato_old.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
Telegram/Resources/icons/settings/settings_kotato_old@2x.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
Telegram/Resources/icons/settings/settings_kotato_old@3x.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
|
|
@ -91,6 +91,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",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,17 @@
|
|||
<file alias="art/bg_thumbnail.png">../../art/bg_thumbnail.png</file>
|
||||
<file alias="art/bg_initial.jpg">../../art/bg_initial.jpg</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"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
|||
|
|
@ -397,6 +397,16 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
|||
.type = SettingType::IntSetting,
|
||||
.defaultValue = int(Platform::FileDialog::ImplementationType::Default),
|
||||
.limitHandler = FileDialogLimit(), }},
|
||||
{ "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;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,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:
|
||||
|
|
@ -461,6 +487,64 @@ void SetupKotatoSystem(
|
|||
});
|
||||
}
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
rktr("ktg_settings_disable_tray_counter"),
|
||||
st::settingsButton
|
||||
)->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::settingsButton
|
||||
)->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_value()
|
||||
) | 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::settingsButton
|
||||
)->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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "platform/linux/main_window_linux.h"
|
||||
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "platform/linux/specific_linux.h"
|
||||
#include "platform/linux/linux_wayland_integration.h"
|
||||
|
|
@ -63,12 +64,17 @@ using WorkMode = Core::Settings::WorkMode;
|
|||
constexpr auto kPanelTrayIconName = "kotatogram-panel"_cs;
|
||||
constexpr auto kMutePanelTrayIconName = "kotatogram-mute-panel"_cs;
|
||||
constexpr auto kAttentionPanelTrayIconName = "kotatogram-attention-panel"_cs;
|
||||
constexpr auto kTelegramPanelTrayIconName = "telegram-panel"_cs;
|
||||
constexpr auto kTelegramMutePanelTrayIconName = "telegram-mute-panel"_cs;
|
||||
constexpr auto kTelegramAttentionPanelTrayIconName = "telegram-attention-panel"_cs;
|
||||
|
||||
bool TrayIconMuted = true;
|
||||
int32 TrayIconCount = 0;
|
||||
base::flat_map<int, QImage> TrayIconImageBack;
|
||||
QIcon TrayIcon;
|
||||
QString TrayIconThemeName, TrayIconName;
|
||||
int TrayIconCustomId = 0;
|
||||
bool TrayIconCounterDisabled = false;
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
void XCBSkipTaskbar(QWindow *window, bool skip) {
|
||||
|
|
@ -166,11 +172,24 @@ void SkipTaskbar(QWindow *window, bool skip) {
|
|||
}
|
||||
|
||||
QString GetPanelIconName(int counter, bool muted) {
|
||||
const auto useTelegramPanelIcon = ::Kotato::JsonSettings::GetBool("use_telegram_panel_icon");
|
||||
const auto iconName = useTelegramPanelIcon
|
||||
? kTelegramPanelTrayIconName.utf16()
|
||||
: kPanelTrayIconName.utf16();
|
||||
|
||||
const auto muteIconName = useTelegramPanelIcon
|
||||
? kTelegramMutePanelTrayIconName.utf16()
|
||||
: kMutePanelTrayIconName.utf16();
|
||||
|
||||
const auto attentionIconName = useTelegramPanelIcon
|
||||
? kTelegramAttentionPanelTrayIconName.utf16()
|
||||
: kAttentionPanelTrayIconName.utf16();
|
||||
|
||||
return (counter > 0)
|
||||
? (muted
|
||||
? kMutePanelTrayIconName.utf16()
|
||||
: kAttentionPanelTrayIconName.utf16())
|
||||
: kPanelTrayIconName.utf16();
|
||||
? muteIconName
|
||||
: attentionIconName)
|
||||
: iconName;
|
||||
}
|
||||
|
||||
QString GetTrayIconName(int counter, bool muted) {
|
||||
|
|
@ -192,6 +211,13 @@ int GetCounterSlice(int counter) {
|
|||
: counter;
|
||||
}
|
||||
|
||||
bool UseIconFromTheme(const QString &iconName) {
|
||||
return ::Kotato::JsonSettings::GetBool("disable_tray_counter")
|
||||
&& !QFileInfo::exists(cWorkingDir() + "tdata/icon.png")
|
||||
&& ::Kotato::JsonSettings::GetInt("custom_app_icon") == 0
|
||||
&& !iconName.isEmpty();
|
||||
}
|
||||
|
||||
bool IsIconRegenerationNeeded(
|
||||
int counter,
|
||||
bool muted,
|
||||
|
|
@ -203,7 +229,9 @@ bool IsIconRegenerationNeeded(
|
|||
|| iconThemeName != TrayIconThemeName
|
||||
|| iconName != TrayIconName
|
||||
|| muted != TrayIconMuted
|
||||
|| counterSlice != TrayIconCount;
|
||||
|| counterSlice != TrayIconCount
|
||||
|| ::Kotato::JsonSettings::GetInt("custom_app_icon") != TrayIconCustomId
|
||||
|| ::Kotato::JsonSettings::GetBool("disable_tray_counter") != TrayIconCounterDisabled;
|
||||
}
|
||||
|
||||
void UpdateIconRegenerationNeeded(
|
||||
|
|
@ -219,6 +247,8 @@ void UpdateIconRegenerationNeeded(
|
|||
TrayIconCount = counterSlice;
|
||||
TrayIconThemeName = iconThemeName;
|
||||
TrayIconName = iconName;
|
||||
TrayIconCustomId = ::Kotato::JsonSettings::GetInt("custom_app_icon");
|
||||
TrayIconCounterDisabled = ::Kotato::JsonSettings::GetBool("disable_tray_counter");
|
||||
}
|
||||
|
||||
QIcon TrayIconGen(int counter, bool muted) {
|
||||
|
|
@ -229,9 +259,8 @@ QIcon TrayIconGen(int counter, bool muted) {
|
|||
}
|
||||
|
||||
const auto iconName = GetTrayIconName(counter, muted);
|
||||
const auto panelIconName = GetPanelIconName(counter, muted);
|
||||
|
||||
if (iconName == panelIconName) {
|
||||
if (UseIconFromTheme(iconName)) {
|
||||
const auto result = QIcon::fromTheme(iconName);
|
||||
UpdateIconRegenerationNeeded(result, counter, muted, iconThemeName);
|
||||
return result;
|
||||
|
|
@ -252,14 +281,23 @@ QIcon TrayIconGen(int counter, bool muted) {
|
|||
return image.size() / image.devicePixelRatio();
|
||||
};
|
||||
|
||||
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 = TrayIconImageBack[iconSize];
|
||||
const auto desiredSize = QSize(iconSize, iconSize);
|
||||
|
||||
if (currentImageBack.isNull()
|
||||
|| iconThemeName != TrayIconThemeName
|
||||
|| iconName != TrayIconName) {
|
||||
if (!iconName.isEmpty()) {
|
||||
|| iconName != TrayIconName
|
||||
|| customAppIcon != TrayIconCustomId
|
||||
|| disableTrayCounter != TrayIconCounterDisabled) {
|
||||
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);
|
||||
}
|
||||
|
|
@ -302,7 +340,8 @@ QIcon TrayIconGen(int counter, bool muted) {
|
|||
|
||||
auto iconImage = currentImageBack;
|
||||
|
||||
if (counter > 0) {
|
||||
if (!disableTrayCounter
|
||||
&& counter > 0) {
|
||||
const auto &bg = muted
|
||||
? st::trayCounterBgMute
|
||||
: st::trayCounterBg;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/mac/main_window_mac.h"
|
||||
|
||||
#include "kotato/kotato_lang.h"
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "data/data_session.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "mainwindow.h"
|
||||
|
|
@ -66,13 +67,35 @@ namespace {
|
|||
// fullscreen mode, after that we'll hide the window no matter what.
|
||||
constexpr auto kHideAfterFullscreenTimeoutMs = 3000;
|
||||
|
||||
[[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;
|
||||
}
|
||||
|
|
@ -127,6 +150,7 @@ private:
|
|||
- (void) darkModeChanged:(NSNotification *)aNotification {
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||
Core::App().settings().setSystemDarkMode(Platform::IsDarkMode());
|
||||
Core::App().domain().notifyUnreadBadgeChanged();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -395,34 +419,23 @@ void MainWindow::updateIconCounters() {
|
|||
|
||||
QIcon MainWindow::generateIconForTray(int counter, bool muted) const {
|
||||
auto result = QIcon();
|
||||
auto lightMode = TrayIconBack(false);
|
||||
auto darkMode = TrayIconBack(true);
|
||||
auto lightModeActive = darkMode;
|
||||
auto darkModeActive = darkMode;
|
||||
lightModeActive.detach();
|
||||
darkModeActive.detach();
|
||||
const auto dm = Platform::IsDarkMenuBar();
|
||||
auto img = TrayIconBack(dm);
|
||||
auto imgsel = TrayIconBack(dm, true);
|
||||
img.detach();
|
||||
imgsel.detach();
|
||||
const auto size = 22 * cIntRetinaFactor();
|
||||
const auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
|
||||
_placeCounter(lightMode, size, counter, bg, st::trayCounterFg);
|
||||
_placeCounter(darkMode, size, counter, bg, muted ? st::trayCounterFgMacInvert : st::trayCounterFg);
|
||||
_placeCounter(lightModeActive, size, counter, st::trayCounterBgMacInvert, st::trayCounterFgMacInvert);
|
||||
_placeCounter(darkModeActive, size, counter, st::trayCounterBgMacInvert, st::trayCounterFgMacInvert);
|
||||
if (!::Kotato::JsonSettings::GetBool("disable_tray_counter")) {
|
||||
_placeCounter(img, size, counter, bg, (dm && muted) ? st::trayCounterFgMacInvert : st::trayCounterFg);
|
||||
_placeCounter(imgsel, size, counter, st::trayCounterBgMacInvert, st::trayCounterFgMacInvert);
|
||||
}
|
||||
result.addPixmap(Ui::PixmapFromImage(
|
||||
std::move(lightMode)),
|
||||
QIcon::Normal,
|
||||
QIcon::Off);
|
||||
std::move(img)),
|
||||
QIcon::Normal);
|
||||
result.addPixmap(Ui::PixmapFromImage(
|
||||
std::move(darkMode)),
|
||||
QIcon::Normal,
|
||||
QIcon::On);
|
||||
result.addPixmap(Ui::PixmapFromImage(
|
||||
std::move(lightModeActive)),
|
||||
QIcon::Active,
|
||||
QIcon::Off);
|
||||
result.addPixmap(Ui::PixmapFromImage(
|
||||
std::move(darkModeActive)),
|
||||
QIcon::Active,
|
||||
QIcon::On);
|
||||
std::move(imgsel)),
|
||||
QIcon::Active);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/win/main_window_win.h"
|
||||
|
||||
#include "kotato/kotato_lang.h"
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "platform/platform_specific.h"
|
||||
#include "platform/platform_notifications_manager.h"
|
||||
|
|
@ -101,8 +102,11 @@ uint32 kTaskbarCreatedMsgId = 0;
|
|||
Main::Session *session,
|
||||
bool smallIcon) {
|
||||
static constexpr auto kCount = 3;
|
||||
static auto ScaledLogo = std::array<QImage, kCount>();
|
||||
static auto ScaledLogoNoMargin = std::array<QImage, kCount>();
|
||||
static constexpr auto kLogoCount = 7;
|
||||
static constexpr auto kTotalCount = kLogoCount * kCount;
|
||||
static auto ScaledLogo = std::array<QImage, kTotalCount>();
|
||||
static auto ScaledLogoNoMargin = std::array<QImage, kTotalCount>();
|
||||
static auto CustomIcon = QImage(cWorkingDir() + "tdata/icon.png");
|
||||
|
||||
struct Dimensions {
|
||||
int index = 0;
|
||||
|
|
@ -131,13 +135,19 @@ uint32 kTaskbarCreatedMsgId = 0;
|
|||
|
||||
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;
|
||||
}();
|
||||
|
|
@ -317,9 +327,11 @@ void MainWindow::psTrayMenuUpdated() {
|
|||
void MainWindow::psSetupTrayIcon() {
|
||||
if (!trayIcon) {
|
||||
trayIcon = new QSystemTrayIcon(this);
|
||||
|
||||
const auto icon = QIcon(Ui::PixmapFromImage(
|
||||
QImage(Window::LogoNoMargin())));
|
||||
auto icon = QIcon(cWorkingDir() + "tdata/icon.png");
|
||||
if (icon.isNull()) {
|
||||
icon = QIcon(Ui::PixmapFromImage(
|
||||
QImage(Window::LogoNoMargin(::Kotato::JsonSettings::GetInt("custom_app_icon")))));
|
||||
}
|
||||
|
||||
trayIcon->setIcon(icon);
|
||||
connect(
|
||||
|
|
@ -482,9 +494,16 @@ void MainWindow::updateIconCounters() {
|
|||
if (trayIcon) {
|
||||
// Force Qt to use right icon size, not the larger one.
|
||||
QIcon forTrayIcon;
|
||||
const auto disableTrayCounter = ::Kotato::JsonSettings::GetBool("disable_tray_counter");
|
||||
auto forTrayIcon16 = disableTrayCounter
|
||||
? iconWithCounter(16, 0, true)
|
||||
: iconSmallPixmap16;
|
||||
auto forTrayIcon32 = disableTrayCounter
|
||||
? iconWithCounter(32, 0, true)
|
||||
: iconSmallPixmap32;
|
||||
forTrayIcon.addPixmap(iconSizeSmall.width() >= 20
|
||||
? iconSmallPixmap32
|
||||
: iconSmallPixmap16);
|
||||
? forTrayIcon32
|
||||
: forTrayIcon16);
|
||||
trayIcon->setIcon(forTrayIcon);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ settingsIconStickers: icon {{ "settings/settings_stickers", menuIconFg }};
|
|||
settingsIconEmoji: icon {{ "settings/settings_emoji", menuIconFg }};
|
||||
settingsIconThemes: icon {{ "settings/settings_themes", menuIconFg }};
|
||||
settingsIconKotato: icon {{ "settings/settings_kotato", menuIconFg }};
|
||||
settingsIconKotatoOld: icon {{ "settings/settings_kotato_old", menuIconFg }};
|
||||
|
||||
settingsSetPhotoSkip: 7px;
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,9 @@ void SetupSections(
|
|||
addSection(
|
||||
rktr("ktg_settings_kotato"),
|
||||
Type::Kotato,
|
||||
&st::settingsIconKotato);
|
||||
(::Kotato::JsonSettings::GetInt("custom_app_icon") == 5
|
||||
? &st::settingsIconKotatoOld
|
||||
: &st::settingsIconKotato));
|
||||
|
||||
SetupLanguageButton(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_common.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
|
|
@ -259,7 +260,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,
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -48,13 +49,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;
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +139,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)));
|
||||
}
|
||||
|
|
@ -124,6 +158,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);
|
||||
|
|
@ -412,9 +452,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,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);
|
||||
|
|
@ -230,6 +230,7 @@ private:
|
|||
|
||||
QIcon _icon;
|
||||
bool _usingSupportIcon = false;
|
||||
int _customIconId = 0;
|
||||
|
||||
bool _isActive = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -93,7 +94,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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||