From 3b45a120e6b88b141915e672845db136673a89f4 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 3 May 2022 19:37:47 +0300 Subject: [PATCH] Slightly improved style of buttons and icons in Folders settings. --- Telegram/SourceFiles/settings/settings.style | 2 -- .../SourceFiles/settings/settings_folders.cpp | 22 ++++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/settings/settings.style b/Telegram/SourceFiles/settings/settings.style index 2242ce4cbd..79f61a645e 100644 --- a/Telegram/SourceFiles/settings/settings.style +++ b/Telegram/SourceFiles/settings/settings.style @@ -253,8 +253,6 @@ settingsAccentColorSize: 24px; settingsAccentColorSkip: 4px; settingsAccentColorLine: 3px; -settingsFilterIconSkip: 68px; -settingsFilterIconLeft: 17px; settingsFilterDividerLabel: FlatLabel(boxDividerLabel) { minWidth: 258px; maxHeight: 0px; diff --git a/Telegram/SourceFiles/settings/settings_folders.cpp b/Telegram/SourceFiles/settings/settings_folders.cpp index 86e3b3685c..c3e4f1819b 100644 --- a/Telegram/SourceFiles/settings/settings_folders.cpp +++ b/Telegram/SourceFiles/settings/settings_folders.cpp @@ -275,7 +275,7 @@ void FilterRowButton::paintEvent(QPaintEvent *e) { const auto left = (_state == State::Suggested) ? st::settingsSubsectionTitlePadding.left() - : st::settingsFilterIconSkip; + : st::settingsButtonActive.padding.left(); const auto buttonsLeft = std::min( _add.x(), std::min(_remove.x(), _restore.x())); @@ -299,14 +299,24 @@ void FilterRowButton::paintEvent(QPaintEvent *e) { if (_state != State::Suggested) { const auto icon = Ui::LookupFilterIcon(_icon).normal; + + // For now. + const auto iconWidth = icon->width() - style::ConvertScale(9); + const auto scale = st::settingsIconAdd.width() / float64(iconWidth); + p.translate( + st::settingsButtonActive.iconLeft, + (height() - icon->height() * scale) / 2); + p.translate(-iconWidth / 2, -iconWidth / 2); + p.scale(scale, scale); + p.translate(iconWidth / 2, iconWidth / 2); icon->paint( p, - st::settingsFilterIconLeft, - (height() - icon->height()) / 2, + 0, + 0, width(), (over - ? st::dialogsUnreadBgMutedOver - : st::dialogsUnreadBgMuted)->c); + ? st::activeButtonBgOver + : st::activeButtonBg)->c); } } @@ -413,7 +423,7 @@ void FilterRowButton::paintEvent(QPaintEvent *e) { container, tr::lng_filters_create(), st::settingsButtonActive, - { &st::settingsIconFolders, kIconLightBlue } + { &st::settingsIconAdd, 0, IconType::Round, &st::windowBgActive } )->setClickedCallback([=] { if (showLimitReached()) { return;