diff --git a/Telegram/Resources/icons/bubble_tail1.png b/Telegram/Resources/icons/bubble_tail1.png new file mode 100644 index 000000000..65d577e95 Binary files /dev/null and b/Telegram/Resources/icons/bubble_tail1.png differ diff --git a/Telegram/Resources/icons/bubble_tail1@2x.png b/Telegram/Resources/icons/bubble_tail1@2x.png new file mode 100644 index 000000000..ebeca1511 Binary files /dev/null and b/Telegram/Resources/icons/bubble_tail1@2x.png differ diff --git a/Telegram/Resources/icons/bubble_tail1@3x.png b/Telegram/Resources/icons/bubble_tail1@3x.png new file mode 100644 index 000000000..e11ccb08b Binary files /dev/null and b/Telegram/Resources/icons/bubble_tail1@3x.png differ diff --git a/Telegram/Resources/icons/bubble_tail2.png b/Telegram/Resources/icons/bubble_tail2.png new file mode 100644 index 000000000..3b6614560 Binary files /dev/null and b/Telegram/Resources/icons/bubble_tail2.png differ diff --git a/Telegram/Resources/icons/bubble_tail2@2x.png b/Telegram/Resources/icons/bubble_tail2@2x.png new file mode 100644 index 000000000..eb2b0a364 Binary files /dev/null and b/Telegram/Resources/icons/bubble_tail2@2x.png differ diff --git a/Telegram/Resources/icons/bubble_tail2@3x.png b/Telegram/Resources/icons/bubble_tail2@3x.png new file mode 100644 index 000000000..aa368174b Binary files /dev/null and b/Telegram/Resources/icons/bubble_tail2@3x.png differ diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index 2ecddf4bc..6434c8c8e 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -546,7 +546,28 @@ void PeerListRow::paintDisabledCheckUserpic( p.setPen(userpicBorderPen); p.setBrush(Qt::NoBrush); - p.drawEllipse(userpicEllipse); + switch (cUserpicCornersType()) { + case 0: + p.drawRoundedRect( + userpicEllipse, + 0, 0); + break; + + case 1: + p.drawRoundedRect( + userpicEllipse, + st::buttonRadius, st::buttonRadius); + break; + + case 2: + p.drawRoundedRect( + userpicEllipse, + st::dateRadius, st::dateRadius); + break; + + default: + p.drawEllipse(userpicEllipse); + } p.setPen(iconBorderPen); p.setBrush(st::contactsPhotoDisabledCheckFg); diff --git a/Telegram/SourceFiles/core/kotato_settings.cpp b/Telegram/SourceFiles/core/kotato_settings.cpp index a750cabcc..292f70f21 100644 --- a/Telegram/SourceFiles/core/kotato_settings.cpp +++ b/Telegram/SourceFiles/core/kotato_settings.cpp @@ -317,6 +317,12 @@ bool Manager::readCustomFile() { SetRecentStickersLimit(v); } }); + + ReadIntOption(settings, "userpic_corner_type", [&](auto v) { + if (v >= 0 || v <= 3) { + cSetUserpicCornersType(v); + } + }); return true; } @@ -358,6 +364,7 @@ void Manager::writeDefaultFile() { settings.insert(qsl("confirm_before_calls"), cConfirmBeforeCall()); settings.insert(qsl("no_taskbar_flash"), cNoTaskbarFlashing()); settings.insert(qsl("recent_stickers_limit"), RecentStickersLimit()); + settings.insert(qsl("userpic_corner_type"), cUserpicCornersType()); auto settingsScales = QJsonArray(); settings.insert(qsl("scales"), settingsScales); @@ -420,6 +427,7 @@ void Manager::writeCurrentSettings() { settings.insert(qsl("confirm_before_calls"), cConfirmBeforeCall()); settings.insert(qsl("no_taskbar_flash"), cNoTaskbarFlashing()); settings.insert(qsl("recent_stickers_limit"), RecentStickersLimit()); + settings.insert(qsl("userpic_corner_type"), cUserpicCornersType()); auto settingsScales = QJsonArray(); auto currentScales = cInterfaceScales(); diff --git a/Telegram/SourceFiles/data/data_folder.cpp b/Telegram/SourceFiles/data/data_folder.cpp index 5229de94b..99175a4c2 100644 --- a/Telegram/SourceFiles/data/data_folder.cpp +++ b/Telegram/SourceFiles/data/data_folder.cpp @@ -248,7 +248,29 @@ void Folder::paintUserpic( p.setBrush(overrideBg ? *overrideBg : st::historyPeerArchiveUserpicBg); { PainterHighQualityEnabler hq(p); - p.drawEllipse(x, y, size, size); + switch (cUserpicCornersType()) { + case 0: + p.drawRoundedRect( + QRect{ x, y, size, size }, + 0, 0); + break; + + case 1: + p.drawRoundedRect( + QRect{ x, y, size, size }, + st::buttonRadius, st::buttonRadius); + break; + + case 2: + p.drawRoundedRect( + QRect{ x, y, size, size }, + st::dateRadius, st::dateRadius); + break; + + default: + p.drawEllipse(x, y, size, size); + } + } if (size == st::dialogsPhotoSize) { const auto rect = QRect{ x, y, size, size }; diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 1044fcc3c..b0a9c6b4d 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -230,6 +230,25 @@ ImagePtr PeerData::currentUserpic() const { } void PeerData::paintUserpic(Painter &p, int x, int y, int size) const { + switch (cUserpicCornersType()) { + case 0: + paintUserpicSquare(p, x, y, size); + break; + + case 1: + paintUserpicRounded(p, x, y, size); + break; + + case 2: + paintUserpicRoundedLarge(p, x, y, size); + break; + + default: + paintUserpicCircled(p, x, y, size); + } +} + +void PeerData::paintUserpicCircled(Painter &p, int x, int y, int size) const { if (auto userpic = currentUserpic()) { p.drawPixmap(x, y, userpic->pixCircled(userpicOrigin(), size, size)); } else { @@ -237,6 +256,14 @@ void PeerData::paintUserpic(Painter &p, int x, int y, int size) const { } } +void PeerData::paintUserpicRoundedLarge(Painter &p, int x, int y, int size) const { + if (auto userpic = currentUserpic()) { + p.drawPixmap(x, y, userpic->pixRounded(userpicOrigin(), size, size, ImageRoundRadius::Large)); + } else { + _userpicEmpty->paintRoundedLarge(p, x, y, x + size + x, size); + } +} + void PeerData::paintUserpicRounded(Painter &p, int x, int y, int size) const { if (auto userpic = currentUserpic()) { p.drawPixmap(x, y, userpic->pixRounded(userpicOrigin(), size, size, ImageRoundRadius::Small)); diff --git a/Telegram/SourceFiles/data/data_peer.h b/Telegram/SourceFiles/data/data_peer.h index 94328faaf..6ab17e0fb 100644 --- a/Telegram/SourceFiles/data/data_peer.h +++ b/Telegram/SourceFiles/data/data_peer.h @@ -252,6 +252,16 @@ public: int size) const { paintUserpic(p, rtl() ? (w - x - size) : x, y, size); } + void paintUserpicCircled( + Painter &p, + int x, + int y, + int size) const; + void paintUserpicRoundedLarge( + Painter &p, + int x, + int y, + int size) const; void paintUserpicRounded( Painter &p, int x, diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 5175955be..bdafcd740 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -2892,9 +2892,18 @@ void InnerWidget::userOnlineUpdated(const Notify::PeerUpdate &update) { const auto stroke = st::dialogsOnlineBadgeStroke; const auto skip = st::dialogsOnlineBadgeSkip; const auto edge = st::dialogsPadding.x() + DialogsPhotoSize(); + auto onlineTop = edge - size; + auto onlineLeft = edge - size; + if (cUserpicCornersType() == 3) { + onlineTop = onlineTop - skip.x(); + onlineLeft = onlineLeft - skip.y(); + } else { + onlineTop = onlineTop - size; + onlineLeft = onlineLeft - size; + } const auto updateRect = QRect( - edge - skip.x() - size, - edge - skip.y() - size, + onlineTop, + onlineLeft, size, size ).marginsAdded( diff --git a/Telegram/SourceFiles/dialogs/dialogs_row.cpp b/Telegram/SourceFiles/dialogs/dialogs_row.cpp index 6f152b9e2..2abd24270 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_row.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_row.cpp @@ -163,9 +163,18 @@ void BasicRow::PaintOnlineFrame( q.setBrush(data->active ? st::dialogsOnlineBadgeFgActive : st::dialogsOnlineBadgeFg); + auto onlineTop = edge - size; + auto onlineLeft = edge - size; + if (cUserpicCornersType() == 3) { + onlineTop = onlineTop - skip.x(); + onlineLeft = onlineLeft - skip.y(); + } else { + onlineTop = onlineTop - size; + onlineLeft = onlineLeft - size; + } q.drawEllipse(QRectF( - edge - skip.x() - size, - edge - skip.y() - size, + onlineTop, + onlineLeft, size, size ).marginsRemoved({ shrink, shrink, shrink, shrink })); diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index 61657eb39..b0c3140af 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -397,6 +397,24 @@ historyBubbleTailInRightSelected: icon {{ "bubble_tail-flip_horizontal", msgInBg historyBubbleTailOutRight: icon {{ "bubble_tail-flip_horizontal", msgOutBg }}; historyBubbleTailOutRightSelected: icon {{ "bubble_tail-flip_horizontal", msgOutBgSelected }}; +historyBubbleTail1InLeft: icon {{ "bubble_tail1", msgInBg }}; +historyBubbleTail1InLeftSelected: icon {{ "bubble_tail1", msgInBgSelected }}; +historyBubbleTail1OutLeft: icon {{ "bubble_tail1", msgOutBg }}; +historyBubbleTail1OutLeftSelected: icon {{ "bubble_tail1", msgOutBgSelected }}; +historyBubbleTail1InRight: icon {{ "bubble_tail1-flip_horizontal", msgInBg }}; +historyBubbleTail1InRightSelected: icon {{ "bubble_tail1-flip_horizontal", msgInBgSelected }}; +historyBubbleTail1OutRight: icon {{ "bubble_tail1-flip_horizontal", msgOutBg }}; +historyBubbleTail1OutRightSelected: icon {{ "bubble_tail1-flip_horizontal", msgOutBgSelected }}; + +historyBubbleTail2InLeft: icon {{ "bubble_tail2", msgInBg }}; +historyBubbleTail2InLeftSelected: icon {{ "bubble_tail2", msgInBgSelected }}; +historyBubbleTail2OutLeft: icon {{ "bubble_tail2", msgOutBg }}; +historyBubbleTail2OutLeftSelected: icon {{ "bubble_tail2", msgOutBgSelected }}; +historyBubbleTail2InRight: icon {{ "bubble_tail2-flip_horizontal", msgInBg }}; +historyBubbleTail2InRightSelected: icon {{ "bubble_tail2-flip_horizontal", msgInBgSelected }}; +historyBubbleTail2OutRight: icon {{ "bubble_tail2-flip_horizontal", msgOutBg }}; +historyBubbleTail2OutRightSelected: icon {{ "bubble_tail2-flip_horizontal", msgOutBgSelected }}; + historyPeerUserpicFont: semiboldFont; historyStatusFg: windowSubTextFg; diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 65f46b1ce..9a990a2a2 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -137,15 +137,31 @@ void PaintBubble(Painter &p, QRect rect, int outerWidth, bool selected, bool out if (tailSide == RectPart::Right) { parts |= RectPart::BottomLeft; p.fillRect(rect.x() + rect.width() - st::historyMessageRadius, rect.y() + rect.height() - st::historyMessageRadius, st::historyMessageRadius, st::historyMessageRadius, bg); - auto &tail = selected ? st::historyBubbleTailOutRightSelected : st::historyBubbleTailOutRight; - tail.paint(p, rect.x() + rect.width(), rect.y() + rect.height() - tail.height(), outerWidth); - p.fillRect(rect.x() + rect.width() - st::historyMessageRadius, rect.y() + rect.height(), st::historyMessageRadius + tail.width(), st::msgShadow, sh); + if (cUserpicCornersType() != 0) { + auto &tail = (cUserpicCornersType() == 1) + ? (selected ? st::historyBubbleTail1OutRightSelected : st::historyBubbleTail1OutRight) + : (cUserpicCornersType() == 2) + ? (selected ? st::historyBubbleTail2OutRightSelected : st::historyBubbleTail2OutRight) + : (selected ? st::historyBubbleTailOutRightSelected : st::historyBubbleTailOutRight); + tail.paint(p, rect.x() + rect.width(), rect.y() + rect.height() - tail.height(), outerWidth); + p.fillRect(rect.x() + rect.width() - st::historyMessageRadius, rect.y() + rect.height(), st::historyMessageRadius + tail.width(), st::msgShadow, sh); + } else { + p.fillRect(rect.x() + rect.width() - st::historyMessageRadius, rect.y() + rect.height(), st::historyMessageRadius, st::msgShadow, sh); + } } else if (tailSide == RectPart::Left) { parts |= RectPart::BottomRight; p.fillRect(rect.x(), rect.y() + rect.height() - st::historyMessageRadius, st::historyMessageRadius, st::historyMessageRadius, bg); - auto &tail = selected ? (outbg ? st::historyBubbleTailOutLeftSelected : st::historyBubbleTailInLeftSelected) : (outbg ? st::historyBubbleTailOutLeft : st::historyBubbleTailInLeft); - tail.paint(p, rect.x() - tail.width(), rect.y() + rect.height() - tail.height(), outerWidth); - p.fillRect(rect.x() - tail.width(), rect.y() + rect.height(), st::historyMessageRadius + tail.width(), st::msgShadow, sh); + if (cUserpicCornersType() != 0) { + auto &tail = (cUserpicCornersType() == 1) + ? (selected ? (outbg ? st::historyBubbleTail1OutLeftSelected : st::historyBubbleTail1InLeftSelected) : (outbg ? st::historyBubbleTail1OutLeft : st::historyBubbleTail1InLeft)) + : (cUserpicCornersType() == 2) + ? (selected ? (outbg ? st::historyBubbleTail2OutLeftSelected : st::historyBubbleTail2InLeftSelected) : (outbg ? st::historyBubbleTail2OutLeft : st::historyBubbleTail2InLeft)) + : (selected ? (outbg ? st::historyBubbleTailOutLeftSelected : st::historyBubbleTailInLeftSelected) : (outbg ? st::historyBubbleTailOutLeft : st::historyBubbleTailInLeft)); + tail.paint(p, rect.x() - tail.width(), rect.y() + rect.height() - tail.height(), outerWidth); + p.fillRect(rect.x() - tail.width(), rect.y() + rect.height(), st::historyMessageRadius + tail.width(), st::msgShadow, sh); + } else { + p.fillRect(rect.x(), rect.y() + rect.height(), st::historyMessageRadius, st::msgShadow, sh); + } } else { parts |= RectPart::FullBottom; } diff --git a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp index 9bfc98ae5..9a5d63c16 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp @@ -794,7 +794,28 @@ void Poll::paintRecentVoters( p.setPen(pen); p.setBrush(Qt::NoBrush); PainterHighQualityEnabler hq(p); - p.drawEllipse(x, y, size, size); + switch (cUserpicCornersType()) { + case 0: + p.drawRoundedRect( + QRect{ x, y, size, size }, + 0, 0); + break; + + case 1: + p.drawRoundedRect( + QRect{ x, y, size, size }, + st::buttonRadius, st::buttonRadius); + break; + + case 2: + p.drawRoundedRect( + QRect{ x, y, size, size }, + st::dateRadius, st::dateRadius); + break; + + default: + p.drawEllipse(x, y, size, size); + } x -= st::historyPollRecentVoterSkip; } } diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index d0efa04e4..6a043a002 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -315,3 +315,5 @@ int RecentStickersLimit() { rpl::producer RecentStickersLimitChanges() { return gRecentStickersLimit.changes(); } + +int gUserpicCornersType = 3; diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index c47cdc7eb..73a0d3b26 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -245,3 +245,5 @@ DeclareSetting(bool, NoTaskbarFlashing); void SetRecentStickersLimit(int limit); [[nodiscard]] int RecentStickersLimit(); [[nodiscard]] rpl::producer RecentStickersLimitChanges(); + +DeclareSetting(int, UserpicCornersType); diff --git a/Telegram/SourceFiles/ui/effects/round_checkbox.cpp b/Telegram/SourceFiles/ui/effects/round_checkbox.cpp index fb2b5f6d7..623442fad 100644 --- a/Telegram/SourceFiles/ui/effects/round_checkbox.cpp +++ b/Telegram/SourceFiles/ui/effects/round_checkbox.cpp @@ -428,7 +428,28 @@ void RoundImageCheckbox::paint(Painter &p, int x, int y, int outerWidth) { auto pen = _st.selectFg->p; pen.setWidth(_st.selectWidth); p.setPen(pen); - p.drawEllipse(style::rtlrect(x, y, _st.imageRadius * 2, _st.imageRadius * 2, outerWidth)); + switch (cUserpicCornersType()) { + case 0: + p.drawRoundedRect( + style::rtlrect(x, y, _st.imageRadius * 2, _st.imageRadius * 2, outerWidth), + 0, 0); + break; + + case 1: + p.drawRoundedRect( + style::rtlrect(x, y, _st.imageRadius * 2, _st.imageRadius * 2, outerWidth), + st::buttonRadius, st::buttonRadius); + break; + + case 2: + p.drawRoundedRect( + style::rtlrect(x, y, _st.imageRadius * 2, _st.imageRadius * 2, outerWidth), + st::dateRadius, st::dateRadius); + break; + + default: + p.drawEllipse(style::rtlrect(x, y, _st.imageRadius * 2, _st.imageRadius * 2, outerWidth)); + } p.setOpacity(1.); } diff --git a/Telegram/SourceFiles/ui/empty_userpic.cpp b/Telegram/SourceFiles/ui/empty_userpic.cpp index 634643e66..2bce5892b 100644 --- a/Telegram/SourceFiles/ui/empty_userpic.cpp +++ b/Telegram/SourceFiles/ui/empty_userpic.cpp @@ -142,8 +142,29 @@ void EmptyUserpic::paint( int y, int outerWidth, int size) const { + switch (cUserpicCornersType()) { + case 0: + paintSquare(p, x, y, outerWidth, size); + break; + + case 1: + paintRounded(p, x, y, outerWidth, size); + break; + + case 2: + paintRoundedLarge(p, x, y, outerWidth, size); + break; + + default: + paint(p, x, y, outerWidth, size, [&p, x, y, size] { + p.drawEllipse(x, y, size, size); + }); + } +} + +void EmptyUserpic::paintRoundedLarge(Painter &p, int x, int y, int outerWidth, int size) const { paint(p, x, y, outerWidth, size, [&p, x, y, size] { - p.drawEllipse(x, y, size, size); + p.drawRoundedRect(x, y, size, size, st::dateRadius, st::dateRadius); }); } @@ -165,9 +186,35 @@ void EmptyUserpic::PaintSavedMessages( int y, int outerWidth, int size) { + switch (cUserpicCornersType()) { + case 0: + PaintSavedMessagesSquared(p, x, y, outerWidth, size); + break; + + case 1: + PaintSavedMessagesRounded(p, x, y, outerWidth, size); + break; + + case 2: + PaintSavedMessagesRoundedLarge(p, x, y, outerWidth, size); + break; + + default: + const auto &bg = st::historyPeerSavedMessagesBg; + const auto &fg = st::historyPeerUserpicFg; + PaintSavedMessages(p, x, y, outerWidth, size, bg, fg); + } +} + +void EmptyUserpic::PaintSavedMessagesRoundedLarge( + Painter &p, + int x, + int y, + int outerWidth, + int size) { const auto &bg = st::historyPeerSavedMessagesBg; const auto &fg = st::historyPeerUserpicFg; - PaintSavedMessages(p, x, y, outerWidth, size, bg, fg); + PaintSavedMessagesRoundedLarge(p, x, y, outerWidth, size, bg, fg); } void EmptyUserpic::PaintSavedMessagesRounded( @@ -181,6 +228,17 @@ void EmptyUserpic::PaintSavedMessagesRounded( PaintSavedMessagesRounded(p, x, y, outerWidth, size, bg, fg); } +void EmptyUserpic::PaintSavedMessagesSquared( + Painter &p, + int x, + int y, + int outerWidth, + int size) { + const auto &bg = st::historyPeerSavedMessagesBg; + const auto &fg = st::historyPeerUserpicFg; + PaintSavedMessagesSquared(p, x, y, outerWidth, size, bg, fg); +} + void EmptyUserpic::PaintSavedMessages( Painter &p, int x, @@ -189,12 +247,45 @@ void EmptyUserpic::PaintSavedMessages( int size, const style::color &bg, const style::color &fg) { + switch (cUserpicCornersType()) { + case 0: + PaintSavedMessagesSquared(p, x, y, outerWidth, size, bg, fg); + break; + + case 1: + PaintSavedMessagesRounded(p, x, y, outerWidth, size, bg, fg); + break; + + case 2: + PaintSavedMessagesRoundedLarge(p, x, y, outerWidth, size, bg, fg); + break; + + default: + x = rtl() ? (outerWidth - x - size) : x; + + PainterHighQualityEnabler hq(p); + p.setBrush(bg); + p.setPen(Qt::NoPen); + p.drawEllipse(x, y, size, size); + + PaintSavedMessagesInner(p, x, y, size, bg, fg); + } +} + +void EmptyUserpic::PaintSavedMessagesRoundedLarge( + Painter &p, + int x, + int y, + int outerWidth, + int size, + const style::color &bg, + const style::color &fg) { x = rtl() ? (outerWidth - x - size) : x; PainterHighQualityEnabler hq(p); p.setBrush(bg); p.setPen(Qt::NoPen); - p.drawEllipse(x, y, size, size); + p.drawRoundedRect(x, y, size, size, st::dateRadius, st::dateRadius); PaintSavedMessagesInner(p, x, y, size, bg, fg); } @@ -217,6 +308,24 @@ void EmptyUserpic::PaintSavedMessagesRounded( PaintSavedMessagesInner(p, x, y, size, bg, fg); } +void EmptyUserpic::PaintSavedMessagesSquared( + Painter &p, + int x, + int y, + int outerWidth, + int size, + const style::color &bg, + const style::color &fg) { + x = rtl() ? (outerWidth - x - size) : x; + + PainterHighQualityEnabler hq(p); + p.setBrush(bg); + p.setPen(Qt::NoPen); + p.drawRoundedRect(x, y, size, size, 0, 0); + + PaintSavedMessagesInner(p, x, y, size, bg, fg); +} + QPixmap EmptyUserpic::GenerateSavedMessages(int size) { return Generate(size, [&](Painter &p) { PaintSavedMessages(p, 0, 0, size, size); diff --git a/Telegram/SourceFiles/ui/empty_userpic.h b/Telegram/SourceFiles/ui/empty_userpic.h index e177baf4e..43a89a5b8 100644 --- a/Telegram/SourceFiles/ui/empty_userpic.h +++ b/Telegram/SourceFiles/ui/empty_userpic.h @@ -19,6 +19,12 @@ public: int y, int outerWidth, int size) const; + void paintRoundedLarge( + Painter &p, + int x, + int y, + int outerWidth, + int size) const; void paintRounded( Painter &p, int x, @@ -40,12 +46,24 @@ public: int y, int outerWidth, int size); + static void PaintSavedMessagesRoundedLarge( + Painter &p, + int x, + int y, + int outerWidth, + int size); static void PaintSavedMessagesRounded( Painter &p, int x, int y, int outerWidth, int size); + static void PaintSavedMessagesSquared( + Painter &p, + int x, + int y, + int outerWidth, + int size); static void PaintSavedMessages( Painter &p, int x, @@ -54,6 +72,14 @@ public: int size, const style::color &bg, const style::color &fg); + static void PaintSavedMessagesRoundedLarge( + Painter &p, + int x, + int y, + int outerWidth, + int size, + const style::color &bg, + const style::color &fg); static void PaintSavedMessagesRounded( Painter &p, int x, @@ -62,6 +88,14 @@ public: int size, const style::color &bg, const style::color &fg); + static void PaintSavedMessagesSquared( + Painter &p, + int x, + int y, + int outerWidth, + int size, + const style::color &bg, + const style::color &fg); static QPixmap GenerateSavedMessages(int size); static QPixmap GenerateSavedMessagesRounded(int size); diff --git a/Telegram/SourceFiles/ui/special_buttons.cpp b/Telegram/SourceFiles/ui/special_buttons.cpp index 1b6e84b17..61c8efe53 100644 --- a/Telegram/SourceFiles/ui/special_buttons.cpp +++ b/Telegram/SourceFiles/ui/special_buttons.cpp @@ -682,11 +682,32 @@ void UserpicButton::paintEvent(QPaintEvent *e) { p.setBrush(_userpicHasImage ? st::msgDateImgBg : _st.changeButton.textBgOver); - p.drawEllipse( - photoLeft, - photoTop, - _st.photoSize, - _st.photoSize); + switch (cUserpicCornersType()) { + case 0: + p.drawRoundedRect( + QRect{ photoLeft, photoTop, _st.photoSize, _st.photoSize }, + 0, 0); + break; + + case 1: + p.drawRoundedRect( + QRect{ photoLeft, photoTop, _st.photoSize, _st.photoSize }, + st::buttonRadius, st::buttonRadius); + break; + + case 2: + p.drawRoundedRect( + QRect{ photoLeft, photoTop, _st.photoSize, _st.photoSize }, + st::dateRadius, st::dateRadius); + break; + + default: + p.drawEllipse( + photoLeft, + photoTop, + _st.photoSize, + _st.photoSize); + } } paintRipple( p, @@ -728,11 +749,32 @@ void UserpicButton::paintEvent(QPaintEvent *e) { PainterHighQualityEnabler hq(p); p.setPen(Qt::NoPen); p.setBrush(_st.uploadBg); - p.drawEllipse( - photoLeft, - photoTop, - _st.photoSize, - _st.photoSize); + switch (cUserpicCornersType()) { + case 0: + p.drawRoundedRect( + QRect{ photoLeft, photoTop, _st.photoSize, _st.photoSize }, + 0, 0); + break; + + case 1: + p.drawRoundedRect( + QRect{ photoLeft, photoTop, _st.photoSize, _st.photoSize }, + st::buttonRadius, st::buttonRadius); + break; + + case 2: + p.drawRoundedRect( + QRect{ photoLeft, photoTop, _st.photoSize, _st.photoSize }, + st::dateRadius, st::dateRadius); + break; + + default: + p.drawEllipse( + photoLeft, + photoTop, + _st.photoSize, + _st.photoSize); + } } auto iconLeft = (_st.uploadIconPosition.x() < 0) ? (_st.photoSize - _st.uploadIcon.width()) / 2 diff --git a/Telegram/SourceFiles/ui/widgets/multi_select.cpp b/Telegram/SourceFiles/ui/widgets/multi_select.cpp index 17ceb2f7c..f85c6b6c4 100644 --- a/Telegram/SourceFiles/ui/widgets/multi_select.cpp +++ b/Telegram/SourceFiles/ui/widgets/multi_select.cpp @@ -72,6 +72,20 @@ void MultiSelect::Item::paintOnce(Painter &p, int x, int y, int outerWidth) { } auto radius = _st.height / 2; + switch (cUserpicCornersType()) { + case 0: + radius = 0; + break; + + case 1: + radius = st::buttonRadius; + break; + + case 2: + radius = st::dateRadius; + break; + } + auto inner = style::rtlrect(x + radius, y, _width - radius, _st.height, outerWidth); auto clipEnabled = p.hasClipping(); @@ -112,7 +126,28 @@ void MultiSelect::Item::paintDeleteButton(Painter &p, int x, int y, int outerWid p.setBrush(_color); { PainterHighQualityEnabler hq(p); - p.drawEllipse(style::rtlrect(x, y, _st.height, _st.height, outerWidth)); + switch (cUserpicCornersType()) { + case 0: + p.drawRoundedRect( + style::rtlrect(x, y, _st.height, _st.height, outerWidth), + 0, 0); + break; + + case 1: + p.drawRoundedRect( + style::rtlrect(x, y, _st.height, _st.height, outerWidth), + st::buttonRadius, st::buttonRadius); + break; + + case 2: + p.drawRoundedRect( + style::rtlrect(x, y, _st.height, _st.height, outerWidth), + st::dateRadius, st::dateRadius); + break; + + default: + p.drawEllipse(style::rtlrect(x, y, _st.height, _st.height, outerWidth)); + } } CrossAnimation::paint(p, _st.deleteCross, _st.deleteFg, x, y, outerWidth, overOpacity);