From f2c5dd09336cf3256f9b9a6bf81e5717eb0f4e31 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Wed, 30 Mar 2022 20:50:15 +0430 Subject: [PATCH 01/31] fix(dialogs): fix cornerBadge position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/dialogs_row.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/dialogs_row.cpp b/Telegram/SourceFiles/dialogs/dialogs_row.cpp index 716c45eec0caf..9a39bf4f6b470 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_row.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_row.cpp @@ -197,8 +197,11 @@ void BasicRow::PaintCornerBadgeFrame( q.setBrush(data->active ? st::dialogsOnlineBadgeFgActive : st::dialogsOnlineBadgeFg); + //paints corner online or calling badge next to userpic in dialogs q.drawEllipse(QRectF( - st::dialogsPhotoSize - skip.x() - size, + (rtl() + ? skip.x() + : (st::dialogsPhotoSize - skip.x() - size)), st::dialogsPhotoSize - skip.y() - size, size, size From fb9cd494a5f21967b7f053cefaf7fe3e5af283bc Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Thu, 31 Mar 2022 18:39:00 +0430 Subject: [PATCH 02/31] fix(dialogs): fix userpic postion when userbadge exists Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/dialogs_row.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/dialogs_row.cpp b/Telegram/SourceFiles/dialogs/dialogs_row.cpp index 9a39bf4f6b470..828f79827d22d 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_row.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_row.cpp @@ -250,7 +250,10 @@ void BasicRow::paintUserpic( _cornerBadgeUserpic->active = active; PaintCornerBadgeFrame(_cornerBadgeUserpic.get(), peer, _userpic); } - p.drawImage(st::dialogsPadding, _cornerBadgeUserpic->frame); + //when a corner badge exists this function is called to paint userpic + rtl() + ? p.drawImage(fullWidth - st::dialogsPadding.x() - st::dialogsPhotoSize, st::dialogsPadding.y(), _cornerBadgeUserpic->frame) + : p.drawImage(st::dialogsPadding, _cornerBadgeUserpic->frame); if (historyForCornerBadge->peer->isUser()) { return; } From d683ae09861ab16dba6bd6dc27701dba7e649d89 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Thu, 31 Mar 2022 18:45:48 +0430 Subject: [PATCH 03/31] fix(dialogs): fix empty unread badge's position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index dd209de13aa5b..5ff33bd199629 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -102,6 +102,7 @@ void PaintNarrowCounter( : 3; const auto unreadRight = st::dialogsPadding.x() + st::dialogsPhotoSize; + const auto unreadLeft = st::dialogsPadding.x(); const auto unreadTop = st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight; @@ -110,10 +111,14 @@ void PaintNarrowCounter( st.active = active; st.selected = selected; st.muted = unreadMuted; + st.align = rtl() ? style::al_left : style::al_right; + //paints unread counter or mark badge in narrow dialogs const auto badge = PaintUnreadBadge( p, counter, - unreadRight, + (rtl() + ? unreadLeft + : unreadRight), unreadTop, st, allowDigits); From b22cd451aeeb328d970618b23a5f6956219c0e07 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 11:45:08 +0430 Subject: [PATCH 04/31] fix(dialogs): fix paintRowTopRight to be rtl compatible by adding another parameter with default value of -1 to avoid breaking of the current experience it can adjust position in rtl mode. Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 5ff33bd199629..688aa68045db7 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -51,12 +51,16 @@ const auto kPsaBadgePrefix = "cloud_lng_badge_psa_"; || history->peer->asUser()->onlineTill > 0); } -void PaintRowTopRight(Painter &p, const QString &text, QRect &rectForName, bool active, bool selected) { +void PaintRowTopRight(Painter &p, const QString &text, QRect &rectForName, bool active, bool selected, int outerw = -1) { const auto width = st::dialogsDateFont->width(text); rectForName.setWidth(rectForName.width() - width - st::dialogsDateSkip); p.setFont(st::dialogsDateFont); p.setPen(active ? st::dialogsDateFgActive : (selected ? st::dialogsDateFgOver : st::dialogsDateFg)); - p.drawText(rectForName.left() + rectForName.width() + st::dialogsDateSkip, rectForName.top() + st::msgNameFont->height - st::msgDateFont->descent, text); + auto left = rectForName.left() + rectForName.width() + st::dialogsDateSkip; + if (rtl() && outerw > 0){ + left = outerw - left - width; + } + p.drawText(left, rectForName.top() + st::msgNameFont->height - st::msgDateFont->descent, text); } void PaintRowDate(Painter &p, QDateTime date, QRect &rectForName, bool active, bool selected) { From 33c2fe78745c50b63b94bfc3e8d4cbef75405a91 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 12:06:12 +0430 Subject: [PATCH 05/31] fix(dialogs): fix last message date position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 688aa68045db7..5613e5fe41a84 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -63,7 +63,7 @@ void PaintRowTopRight(Painter &p, const QString &text, QRect &rectForName, bool p.drawText(left, rectForName.top() + st::msgNameFont->height - st::msgDateFont->descent, text); } -void PaintRowDate(Painter &p, QDateTime date, QRect &rectForName, bool active, bool selected) { +void PaintRowDate(Painter &p, QDateTime date, QRect &rectForName, bool active, bool selected, int outerw) { const auto now = QDateTime::currentDateTime(); const auto &lastTime = date; const auto nowDate = now.date(); @@ -81,7 +81,8 @@ void PaintRowDate(Painter &p, QDateTime date, QRect &rectForName, bool active, b return lastDate.toString(cDateFormat()); } }(); - PaintRowTopRight(p, dt, rectForName, active, selected); + //paints dialogs last message date on each row + PaintRowTopRight(p, dt, rectForName, active, selected, outerw); } void PaintNarrowCounter( From 4f7637ae0355ee5521f5fd6570a76822f12c1e88 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 12:26:41 +0430 Subject: [PATCH 06/31] fix(dialogs): fix unread counter and unread mark position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 5613e5fe41a84..a73258759785f 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -185,8 +185,10 @@ int PaintWideCounter( const auto counter = (unreadCount > 0) ? QString::number(unreadCount) : QString(); + //sets unread counter or unread mark badge coordination const auto unreadRight = fullWidth - st::dialogsPadding.x(); + const auto unreadLeft = st::dialogsPadding.x(); const auto unreadTop = texttop + st::dialogsTextFont->ascent - st::dialogsUnreadFont->ascent @@ -196,10 +198,14 @@ int PaintWideCounter( st.active = active; st.selected = selected; st.muted = unreadMuted; + st.align = rtl() ? style::al_left : style::al_right; + //paints unread counter or unread mark badge const auto badge = PaintUnreadBadge( p, counter, - unreadRight, + (rtl() + ? unreadLeft + : unreadRight), unreadTop, st); availableWidth -= badge.width() + st.padding; From 4b63190591f4b955aa3937efc3efcaa1afea0b0a Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 12:27:30 +0430 Subject: [PATCH 07/31] fix(dialogs): fix pinned icon position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index a73258759785f..9035f91532da3 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -217,6 +217,7 @@ int PaintWideCounter( : selected ? st::dialogsPinnedIconOver : st::dialogsPinnedIcon; + //paints pinned icon on dialogs if unread counter or unread mark doesn't exist icon.paint( p, fullWidth - st::dialogsPadding.x() - icon.width(), From 4531441ab6b010f135fc1487f7a757a5c0ada7f5 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 12:33:32 +0430 Subject: [PATCH 08/31] fix(dialogs): fix mention or reaction badge position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 9035f91532da3..699db5d96a807 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -229,9 +229,11 @@ int PaintWideCounter( } if (displayMentionBadge || displayReactionBadge) { const auto counter = QString(); + //mention or reaction badge coordination const auto unreadRight = fullWidth - st::dialogsPadding.x() - (initial - availableWidth); + const auto unreadLeft = st::dialogsPadding.x() + (initial - availableWidth); const auto unreadTop = texttop + st::dialogsTextFont->ascent - st::dialogsUnreadFont->ascent @@ -243,12 +245,13 @@ int PaintWideCounter( st.muted = mentionOrReactionMuted; st.padding = 0; st.textTop = 0; + st.align = rtl() ? style::al_left : style::al_right; const auto badge = PaintUnreadBadge( p, counter, - unreadRight, + rtl() ? unreadLeft : unreadRight, unreadTop, - st); + st); /**paints mention or reaction badge*/ (displayMentionBadge ? (st.active ? st::dialogsUnreadMentionActive @@ -259,7 +262,7 @@ int PaintWideCounter( ? st::dialogsUnreadReactionActive : st.selected ? st::dialogsUnreadReactionOver - : st::dialogsUnreadReaction)).paintInCenter(p, badge); + : st::dialogsUnreadReaction)).paintInCenter(p, badge); /**paints mention or reaction inner icon at the center*/ availableWidth -= badge.width() + st.padding + (hadOneBadge ? st::dialogsUnreadPadding : 0); From 7e70fd12af8f11a99c690a071f274e470661be7d Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 12:42:39 +0430 Subject: [PATCH 09/31] fix(dialogs): fix drawScamFakeBadge to be rtl compatible Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/ui/unread_badge.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/ui/unread_badge.cpp b/Telegram/SourceFiles/ui/unread_badge.cpp index bc82d4a502643..b0755340b92b5 100644 --- a/Telegram/SourceFiles/ui/unread_badge.cpp +++ b/Telegram/SourceFiles/ui/unread_badge.cpp @@ -76,12 +76,21 @@ void DrawScamFakeBadge( p.setBrush(Qt::NoBrush); p.drawRoundedRect(rect, st::dialogsScamRadius, st::dialogsScamRadius); p.setFont(st::dialogsScamFont); - p.drawTextLeft( - rect.x() + st::dialogsScamPadding.left(), - rect.y() + st::dialogsScamPadding.top(), - outerWidth, - phrase, - phraseWidth); + if (rtl()) { + p.drawTextRight( + rect.x() + st::dialogsScamPadding.left(), + rect.y() + st::dialogsScamPadding.top(), + outerWidth, + phrase, + phraseWidth); + } else { + p.drawTextLeft( + rect.x() + st::dialogsScamPadding.left(), + rect.y() + st::dialogsScamPadding.top(), + outerWidth, + phrase, + phraseWidth); + } } void DrawScamBadge( From e00a501108760b0992d63e804721f35e7f97f8cd Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 12:44:16 +0430 Subject: [PATCH 10/31] fix(dialogs): fix scam badge position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/ui/unread_badge.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/ui/unread_badge.cpp b/Telegram/SourceFiles/ui/unread_badge.cpp index b0755340b92b5..c1a57ffdab431 100644 --- a/Telegram/SourceFiles/ui/unread_badge.cpp +++ b/Telegram/SourceFiles/ui/unread_badge.cpp @@ -137,11 +137,11 @@ int DrawPeerBadgeGetWidth( const auto height = st::dialogsScamPadding.top() + st::dialogsScamFont->height + st::dialogsScamPadding.bottom(); + auto x = (rtl() + ? rectForName.right() - qMin(nameWidth + st::dialogsScamSkip, rectForName.width() - width) - width + : rectForName.x() + qMin(nameWidth + st::dialogsScamSkip, rectForName.width() - width)); const auto rect = QRect( - (rectForName.x() - + qMin( - nameWidth + st::dialogsScamSkip, - rectForName.width() - width)), + x, rectForName.y() + (rectForName.height() - height) / 2, width, height); From b882976144b5a5757e7d99e846fc936596164ed1 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 14:06:10 +0430 Subject: [PATCH 11/31] fix(dialogs): fix sender name position in message view Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp index 0f814de793fa2..030118a091dbd 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp @@ -164,7 +164,9 @@ void MessageView::paint( if (!_senderCache.isEmpty()) { _senderCache.drawElided( p, - rect.left(), + (rtl() + ? (geometry.left() + geometry.right() - rect.left() - _senderCache.maxWidth()) + : rect.left()), rect.top(), rect.width(), rect.height() / st::dialogsTextFont->height); From e6884c145d8bd7548c93899afc4081674c4d625e Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 14:07:12 +0430 Subject: [PATCH 12/31] fix(dialogs): fix mini image preview position in message view Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp index 030118a091dbd..7a6164ae5656c 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp @@ -179,7 +179,9 @@ void MessageView::paint( break; } p.drawImage( - rect.x(), + (rtl() + ? (geometry.left() + geometry.right() - rect.left() - st::dialogsMiniPreview) + : rect.x()), rect.y() + st::dialogsMiniPreviewTop, image.data); rect.setLeft(rect.x() From def7be619c40425648a0ac650106af7959dc7efb Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 14:08:08 +0430 Subject: [PATCH 13/31] fix(dialogs): fix text preview position in message view Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp index 7a6164ae5656c..5a9830a289051 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_message_view.cpp @@ -196,7 +196,9 @@ void MessageView::paint( } _textCache.drawElided( p, - rect.left(), + (rtl() + ? geometry.left() + : rect.left()), rect.top(), rect.width(), rect.height() / st::dialogsTextFont->height); From 7d46366262531b0755c6e9a6d841031027bd39d2 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 14:16:19 +0430 Subject: [PATCH 14/31] fix(dialogs): fix archived chats title's position in collapsed row Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 699db5d96a807..f0430d0dc9c58 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -1115,7 +1115,11 @@ void PaintCollapsedRow( const auto left = narrow ? ((fullWidth - st::semiboldFont->width(text)) / 2) : st::dialogsPadding.x(); - p.drawText(left, textBaseline, text); + const auto right = (narrow + ? (fullWidth - st::semiboldFont->width(text)) / 2 + : (fullWidth - st::semiboldFont->width(text) - st::dialogsPadding.x())); + //draws achived chats title when collapsed + p.drawText(rtl() ? right : left, textBaseline, text); } else { folder->paintUserpicLeft( p, From 212b04d346e0305d578dc351ef62c0286ebd49dc Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 14:18:43 +0430 Subject: [PATCH 15/31] fix(dialogs): fix unread message count position in collapsed row Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index f0430d0dc9c58..3188a1f159f7a 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -1131,12 +1131,17 @@ void PaintCollapsedRow( } if (!narrow && unread) { const auto unreadRight = fullWidth - st::dialogsPadding.x(); + const auto unreadLeft = st::dialogsPadding.x(); UnreadBadgeStyle st; st.muted = true; + st.align = rtl() ? style::al_left : style::al_right; + //paints unread counter badge in collapsed archived folder in wide mode PaintUnreadBadge( p, QString::number(unread), - unreadRight, + (rtl() + ? unreadLeft + : unreadRight), unreadTop, st); } From e4726d5c7dbaade7cc1d7c076c019d5d658a78a6 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Mon, 4 Apr 2022 12:23:06 +0430 Subject: [PATCH 16/31] docs(dialogs): explain conditions in paintRow Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 3188a1f159f7a..78145e608d937 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -386,6 +386,7 @@ void paintRow( fullWidth, st::dialogsPhotoSize); } else { + //Archived Chats folder goes here entry->paintUserpicLeft( p, row->userpicView(), From 2afacb00d7e1ff5bbd05edf09681b08dbc21e758 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Mon, 4 Apr 2022 12:25:23 +0430 Subject: [PATCH 17/31] fix(dialogs): fix topPromotionType position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 78145e608d937..41d55fb182b58 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -425,7 +425,8 @@ void paintRow( : custom.isEmpty() ? tr::lng_badge_psa_default(tr::now) : custom; - PaintRowTopRight(p, text, rectForName, active, selected); + //paints promoted chat's type for example "proxy sponsor" + PaintRowTopRight(p, text, rectForName, active, selected, fullWidth); } else if (from) { if (const auto chatTypeIcon = ChatTypeIcon(from, active, selected)) { chatTypeIcon->paint(p, rectForName.topLeft(), fullWidth); From 16b13f2ea2d88e1e28d4ef228826aefc3b62863e Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Mon, 4 Apr 2022 12:25:58 +0430 Subject: [PATCH 18/31] fix(dialogs): fix chatTypeIcon position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 41d55fb182b58..72f1f05dc4a82 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -429,6 +429,7 @@ void paintRow( PaintRowTopRight(p, text, rectForName, active, selected, fullWidth); } else if (from) { if (const auto chatTypeIcon = ChatTypeIcon(from, active, selected)) { + //paints chat type icon(it's rtl compatible due to lib_ui function usage) chatTypeIcon->paint(p, rectForName.topLeft(), fullWidth); rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip); } From 946287bafc7af82f5a7fa3f2c02332bdb1b136fb Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Tue, 5 Apr 2022 12:23:43 +0430 Subject: [PATCH 19/31] fix(dialogs): fix last message summary position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 72f1f05dc4a82..d8bf0829c5fbe 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -879,8 +879,11 @@ void RowPainter::paint( : (selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService); + //creates rect for last message in each dialog const auto itemRect = QRect( - nameleft, + (rtl() + ? fullWidth - nameleft - availableWidth + : nameleft), texttop, availableWidth, st::dialogsTextFont->height); From 4c663b49003405f9ec85092b602015e0d4e6849e Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Tue, 5 Apr 2022 12:29:10 +0430 Subject: [PATCH 20/31] docs(dialogs): explain hiddenSenderInfo Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index d8bf0829c5fbe..dae377b27ab8b 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -379,6 +379,7 @@ void paintRow( active, fullWidth); } else if (hiddenSenderInfo) { + //hiddenSenderInfo: For example a forwarded message from a user, who disabled forwarded links in his privacy settings, is displayed as this hidden sender info hiddenSenderInfo->userpic.paint( p, st::dialogsPadding.x(), From e92da6357ae67ea5c2b57a42b55599eb37634f75 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Tue, 5 Apr 2022 13:26:46 +0430 Subject: [PATCH 21/31] fix(dialogs): fix Date position when draft exists Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index dae377b27ab8b..b293ed7efc52a 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -453,7 +453,8 @@ void paintRow( || (supportMode && entry->session().supportHelper().isOccupiedBySomeone(history))) { if (!promoted) { - PaintRowDate(p, date, rectForName, active, selected); + //paints date when drafts exists + PaintRowDate(p , date, rectForName, active, selected, fullWidth); } auto availableWidth = namewidth; From 4792d4905bcd8bfa47012f4b52727aad0318d592 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Tue, 5 Apr 2022 13:28:31 +0430 Subject: [PATCH 22/31] fix(dialogs): fix date position in dialogs Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index b293ed7efc52a..24743cf15d231 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -514,7 +514,8 @@ void paintRow( } } else if (!item->isEmpty()) { if (history && !promoted) { - PaintRowDate(p, date, rectForName, active, selected); + //paints date + PaintRowDate(p, date, rectForName, active, selected, fullWidth); } paintItemCallback(nameleft, namewidth); From 7784c9bbccd7c277665801707784dabe7f6dc035 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Tue, 5 Apr 2022 14:03:35 +0430 Subject: [PATCH 23/31] fix(dialogs): fix chat's name position Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 24743cf15d231..2bc47099d6c15 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -604,7 +604,8 @@ void paintRow( : selected ? st::dialogsNameFgOver : st::dialogsNameFg); - from->nameText().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); + //draw chat's name + from->nameText().drawLeftElided(p, rectForName.left(), rectForName.top(), rectForName.width(), fullWidth, 1); } else if (hiddenSenderInfo) { p.setPen(active ? st::dialogsNameFgActive From 0079c41768259c58e319dba49c6dba604bc56663 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Tue, 5 Apr 2022 14:04:03 +0430 Subject: [PATCH 24/31] fix(dialogs): fix dialog's name when hidden sender exists Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 2bc47099d6c15..0002aa913cce5 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -612,7 +612,8 @@ void paintRow( : selected ? st::dialogsNameFgOver : st::dialogsNameFg); - hiddenSenderInfo->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); + //draw chat's name when hidden sender info exists + hiddenSenderInfo->nameText.drawLeftElided(p, rectForName.left(), rectForName.top(), rectForName.width(), fullWidth); } else { p.setPen(active ? st::dialogsNameFgActive From 577a333dcc53af1c75e8d1683f1b6c2bbc350f5f Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Sun, 3 Apr 2022 13:51:12 +0430 Subject: [PATCH 25/31] fix(connecting_widget): fix connecting widget's circle when connected Signed-off-by: AmirReza_Ashouri --- .../window/window_connecting_widget.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/window/window_connecting_widget.cpp b/Telegram/SourceFiles/window/window_connecting_widget.cpp index 06da3c87207c9..2c8b8cfcd2f6b 100644 --- a/Telegram/SourceFiles/window/window_connecting_widget.cpp +++ b/Telegram/SourceFiles/window/window_connecting_widget.cpp @@ -507,10 +507,17 @@ void ConnectionState::Widget::paintEvent(QPaintEvent *e) { const auto text = textRect(); const auto left = inner.topLeft(); const auto right = content.topLeft() + QPoint(content.width(), 0); - st::connectingLeftShadow.paint(p, left, width()); - st::connectingLeft.paint(p, left, width()); - st::connectingRightShadow.paint(p, right, width()); - st::connectingRight.paint(p, right, width()); + if (rtl()) { + st::connectingLeftShadow.paint(p, right, width()); + st::connectingLeft.paint(p, right, width()); + st::connectingRightShadow.paint(p, left, width()); + st::connectingRight.paint(p, left, width()); + } else { + st::connectingLeftShadow.paint(p, left, width()); + st::connectingLeft.paint(p, left, width()); + st::connectingRightShadow.paint(p, right, width()); + st::connectingRight.paint(p, right, width()); + } st::connectingBodyShadow.fill(p, content); st::connectingBody.fill(p, content); From 1012f8909e5281f791eafab18bcc3dcc27294a73 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Thu, 28 Apr 2022 20:41:44 +0430 Subject: [PATCH 26/31] fix(history): fix history's geometry Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/mainwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index a18022cce3722..7dbd9bf87e5e3 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2236,7 +2236,9 @@ void MainWidget::updateControlsGeometry() { _callTopBarHeight + _exportTopBarHeight); } _history->setGeometryWithTopMoved(QRect( - dialogsWidth, + (rtl() + ? thirdSectionWidth + : dialogsWidth), mainSectionTop, mainSectionWidth, height() - mainSectionTop From 703a91c114dbf64c049b66b6f440d7c511511768 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Thu, 28 Apr 2022 20:49:27 +0430 Subject: [PATCH 27/31] fix(histroy): fix history's resize area geometry Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/mainwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 7dbd9bf87e5e3..bd58172b67b52 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2275,7 +2275,9 @@ void MainWidget::refreshResizeAreas() { if (!isOneColumn()) { ensureFirstColumnResizeAreaCreated(); _firstColumnResizeArea->setGeometryToLeft( - _history->x(), + (rtl() + ? _dialogsWidth + : _history->x()), 0, st::historyResizeWidth, height()); From 40bd013a7280e42defc9321436826b237a39c75d Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Thu, 28 Apr 2022 20:51:51 +0430 Subject: [PATCH 28/31] fix(history): fix history's resize area direction Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/mainwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index bd58172b67b52..b0dce4756e569 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2317,6 +2317,9 @@ void MainWidget::ensureFirstColumnResizeAreaCreated() { } auto moveLeftCallback = [=](int globalLeft) { auto newWidth = globalLeft - mapToGlobal(QPoint(0, 0)).x(); + newWidth = rtl() + ? width() - newWidth + : newWidth; auto newRatio = (newWidth < st::columnMinimalWidthLeft / 2) ? 0. : float64(newWidth) / width(); From d4e819ae8f507cc7b1c7366f1e19581c217ceb59 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Thu, 28 Apr 2022 20:39:45 +0430 Subject: [PATCH 29/31] fix(third_section): fix third section geometry Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/mainwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index b0dce4756e569..1ea42d0887c90 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2191,7 +2191,9 @@ void MainWidget::updateControlsGeometry() { if (_thirdSection) { auto thirdSectionTop = getThirdSectionTop(); _thirdSection->setGeometry( - width() - thirdSectionWidth, + (rtl() + ? 0 + : width() - thirdSectionWidth), thirdSectionTop, thirdSectionWidth, height() - thirdSectionTop); From e2f14e66f9c4e8fa42de9c5627e771edfe899585 Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Thu, 28 Apr 2022 20:50:38 +0430 Subject: [PATCH 30/31] fix(third_section): fix third section's resize area geometry Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/mainwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 1ea42d0887c90..e6e969ea4dc35 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2290,7 +2290,9 @@ void MainWidget::refreshResizeAreas() { if (isThreeColumn() && _thirdSection) { ensureThirdColumnResizeAreaCreated(); _thirdColumnResizeArea->setGeometryToLeft( - _thirdSection->x(), + (rtl() + ? (width() - _thirdSection->width()) + : _thirdSection->x()), 0, st::historyResizeWidth, height()); From dc7e047f82067abeb433db2ba1ed2ce51b5c436c Mon Sep 17 00:00:00 2001 From: AmirReza_Ashouri Date: Thu, 28 Apr 2022 20:52:28 +0430 Subject: [PATCH 31/31] fix(third_section): fix third section's resize direction Signed-off-by: AmirReza_Ashouri --- Telegram/SourceFiles/mainwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index e6e969ea4dc35..c3141ef09d32e 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2351,6 +2351,9 @@ void MainWidget::ensureThirdColumnResizeAreaCreated() { } auto moveLeftCallback = [=](int globalLeft) { auto newWidth = mapToGlobal(QPoint(width(), 0)).x() - globalLeft; + newWidth = rtl() + ? (width() - newWidth) + : newWidth; Core::App().settings().setThirdColumnWidth(newWidth); }; auto moveFinishedCallback = [=] {