Userpic corners option
This commit is contained in:
parent
74247e939c
commit
9ecb0c12a0
23 changed files with 434 additions and 28 deletions
BIN
Telegram/Resources/icons/bubble_tail1.png
Normal file
BIN
Telegram/Resources/icons/bubble_tail1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/bubble_tail1@2x.png
Normal file
BIN
Telegram/Resources/icons/bubble_tail1@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/bubble_tail1@3x.png
Normal file
BIN
Telegram/Resources/icons/bubble_tail1@3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/bubble_tail2.png
Normal file
BIN
Telegram/Resources/icons/bubble_tail2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/bubble_tail2@2x.png
Normal file
BIN
Telegram/Resources/icons/bubble_tail2@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/bubble_tail2@3x.png
Normal file
BIN
Telegram/Resources/icons/bubble_tail2@3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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 }));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,3 +315,5 @@ int RecentStickersLimit() {
|
|||
rpl::producer<int> RecentStickersLimitChanges() {
|
||||
return gRecentStickersLimit.changes();
|
||||
}
|
||||
|
||||
int gUserpicCornersType = 3;
|
||||
|
|
|
|||
|
|
@ -245,3 +245,5 @@ DeclareSetting(bool, NoTaskbarFlashing);
|
|||
void SetRecentStickersLimit(int limit);
|
||||
[[nodiscard]] int RecentStickersLimit();
|
||||
[[nodiscard]] rpl::producer<int> RecentStickersLimitChanges();
|
||||
|
||||
DeclareSetting(int, UserpicCornersType);
|
||||
|
|
|
|||
|
|
@ -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.);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue