diff --git a/Telegram/SourceFiles/settings/settings_chat.cpp b/Telegram/SourceFiles/settings/settings_chat.cpp index 883ea4f9c8..d5d240804b 100644 --- a/Telegram/SourceFiles/settings/settings_chat.cpp +++ b/Telegram/SourceFiles/settings/settings_chat.cpp @@ -124,27 +124,6 @@ private: }; -void PaintColorButton(QPainter &p, QColor color, float64 selected) { - const auto size = st::settingsAccentColorSize; - const auto rect = QRect(0, 0, size, size); - - p.setBrush(color); - p.setPen(Qt::NoPen); - p.drawEllipse(rect); - - if (selected > 0.) { - const auto startSkip = -st::settingsAccentColorLine / 2.; - const auto endSkip = float64(st::settingsAccentColorSkip); - const auto skip = startSkip + (endSkip - startSkip) * selected; - auto pen = st::boxBg->p; - pen.setWidth(st::settingsAccentColorLine); - p.setBrush(Qt::NoBrush); - p.setPen(pen); - p.setOpacity(selected); - p.drawEllipse(QRectF(rect).marginsRemoved({ skip, skip, skip, skip })); - } -} - void PaintCustomButton(QPainter &p, const std::vector &colors) { Expects(colors.size() >= kCustomColorButtonParts); @@ -229,7 +208,7 @@ void ColorsPalette::Button::paint() { PainterHighQualityEnabler hq(p); if (_colors.size() == 1) { - PaintColorButton( + PaintRoundColorButton( p, _colors.front(), _selectedAnimation.value(_selected ? 1. : 0.)); @@ -392,6 +371,27 @@ void ColorsPalette::updateInnerGeometry() { } // namespace +void PaintRoundColorButton(QPainter &p, QBrush brush, float64 selected) { + const auto size = st::settingsAccentColorSize; + const auto rect = QRect(0, 0, size, size); + + p.setBrush(brush); + p.setPen(Qt::NoPen); + p.drawEllipse(rect); + + if (selected > 0.) { + const auto startSkip = -st::settingsAccentColorLine / 2.; + const auto endSkip = float64(st::settingsAccentColorSkip); + const auto skip = startSkip + (endSkip - startSkip) * selected; + auto pen = st::boxBg->p; + pen.setWidth(st::settingsAccentColorLine); + p.setBrush(Qt::NoBrush); + p.setPen(pen); + p.setOpacity(selected); + p.drawEllipse(QRectF(rect).marginsRemoved({ skip, skip, skip, skip })); + } +} + class BackgroundRow : public Ui::RpWidget { public: BackgroundRow( diff --git a/Telegram/SourceFiles/settings/settings_chat.h b/Telegram/SourceFiles/settings/settings_chat.h index 7db9acb6a5..87be98a4bb 100644 --- a/Telegram/SourceFiles/settings/settings_chat.h +++ b/Telegram/SourceFiles/settings/settings_chat.h @@ -31,6 +31,8 @@ void SetupExport( not_null controller, not_null container); +void PaintRoundColorButton(QPainter &p, QBrush brush, float64 selected); + class Chat : public Section { public: Chat(QWidget *parent, not_null controller);