Improve Replies chat design.

This commit is contained in:
John Preston 2020-09-15 14:47:42 +03:00
parent 40e925d3f9
commit a1a845dbf1
6 changed files with 21 additions and 61 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -1357,7 +1357,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_comments_open_count#one" = "{count} comment"; "lng_comments_open_count#one" = "{count} comment";
"lng_comments_open_count#other" = "{count} comments"; "lng_comments_open_count#other" = "{count} comments";
"lng_comments_open_none" = "Leave a comment"; "lng_comments_open_none" = "Leave a comment";
"lng_replies_view_original" = "View reply"; "lng_replies_view_original" = "View in chat";
"lng_replies_messages" = "Replies"; "lng_replies_messages" = "Replies";
"lng_archived_name" = "Archived chats"; "lng_archived_name" = "Archived chats";

View file

@ -191,6 +191,7 @@ dialogsBotIconActive: icon {{ "dialogs_bot", dialogsChatIconFgActive, point(1px,
//dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }}; //dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }};
//dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }}; //dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }};
dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }}; dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }};
dialogsRepliesUserpic: icon {{ "replies_userpic", historyPeerUserpicFg }};
dialogsSendStateSkip: 20px; dialogsSendStateSkip: 20px;
dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }}; dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};

View file

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/animation_value.h" #include "ui/effects/animation_value.h"
#include "app.h" #include "app.h"
#include "styles/style_history.h" #include "styles/style_history.h"
#include "styles/style_dialogs.h"
namespace Ui { namespace Ui {
namespace { namespace {
@ -98,66 +99,24 @@ void PaintRepliesMessagesInner(
int size, int size,
const style::color &bg, const style::color &bg,
const style::color &fg) { const style::color &fg) {
// |<---width--->| if (size == st::dialogsPhotoSize) {
// const auto rect = QRect{ x, y, size, size };
// X --- st::dialogsRepliesUserpic.paintInCenter(
// XX | p,
// X X | rect,
// X XXXXXXX | fg->c);
// X XX height } else {
// X XXXXX X | p.save();
// X X XXX X | const auto ratio = size / float64(st::dialogsPhotoSize);
// XX XXX | p.translate(x + size / 2., y + size / 2.);
// X X --- p.scale(ratio, ratio);
const auto skip = st::dialogsPhotoSize;
const auto thinkness = std::round(size * 0.055); const auto rect = QRect{ -skip, -skip, 2 * skip, 2 * skip };
const auto increment = int(thinkness) % 2 + (size % 2); st::dialogsRepliesUserpic.paintInCenter(
const auto width = std::round(size * 0.2) * 2 + increment; p,
const auto arrow = std::round(width * 27. / 57.); rect,
const auto height = 2 * arrow; fg->c);
const auto tail = std::round(height / 5.); p.restore();
const auto add = std::round(size * 0.064);
const auto left = x + (size - width) / 2;
const auto top = y + (size - height) / 2;
const auto right = left + width;
const auto bottom = top + height;
const auto middle = (left + arrow);
const auto half = (top + bottom) / 2;
const auto tailtop = half - tail;
const auto tailbottom = half + tail;
const auto starttop = (top + tailtop) / 2;
const auto bottomcsize = (bottom - tailbottom);
const auto bottomc1x = middle + bottomcsize;
const auto bottomc1y = tailbottom;
const auto bottomc2x = right - bottomcsize / 1.42;
const auto bottomc2y = bottom - bottomcsize / 1.42;
const auto topcsize = (bottom - tailbottom) * 1.5;
const auto topc1x = middle + topcsize;
const auto topc1y = tailtop;
const auto topc2x = right;
const auto topc2y = bottom - topcsize;
p.setBrush(Qt::NoBrush);
auto pen = fg->p;
pen.setWidthF(thinkness);
pen.setCapStyle(Qt::FlatCap);
{
pen.setJoinStyle(Qt::MiterJoin);
p.setPen(pen);
QPainterPath path;
path.moveTo(middle, starttop);
path.lineTo(middle, top);
path.lineTo(left, half);
path.lineTo(middle, bottom);
path.lineTo(middle, tailbottom);
path.cubicTo(bottomc1x, bottomc1y, bottomc2x, bottomc2y, right, bottom);
path.cubicTo(topc2x, topc2y, topc1x, topc1y, middle, tailtop);
path.lineTo(middle, starttop);
p.drawPath(path);
} }
} }