Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Right to Left capability to Telegram for languages like arabic, urdu and persian #24467

Draft
wants to merge 34 commits into
base: dev
Choose a base branch
from

Conversation

AMP999
Copy link

@AMP999 AMP999 commented May 1, 2022

No description provided.

Copy link
Member

@john-preston john-preston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use comments in the same way the comments appear in existing code:

// This is a comment.
p.thisIsMethod();

Telegram/SourceFiles/dialogs/dialogs_row.cpp Outdated Show resolved Hide resolved
Telegram/SourceFiles/dialogs/dialogs_row.cpp Outdated Show resolved Hide resolved
Telegram/SourceFiles/ui/unread_badge.cpp Outdated Show resolved Hide resolved
Telegram/SourceFiles/window/window_connecting_widget.cpp Outdated Show resolved Hide resolved
AMP999 added 28 commits May 7, 2022 12:41
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 <[email protected]>
@AMP999 AMP999 requested a review from john-preston May 7, 2022 10:07
AMP999 added 3 commits May 8, 2022 17:41
# Conflicts:
#	Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp

Signed-off-by: AmirReza_Ashouri <[email protected]>
@AMP999
Copy link
Author

AMP999 commented May 15, 2022

Why did snap ubuntu build fail??
@john-preston

@PhongPhan1987

This comment was marked as spam.

@PhongPhan1987

This comment was marked as spam.

@AMP999
Copy link
Author

AMP999 commented May 18, 2022

I have resolved issues you mentioned in my code. Is there any problem in my code yet?
Thank you
@john-preston

Comment on lines +254 to +256
rtl()
? p.drawImage(fullWidth - st::dialogsPadding.x() - st::dialogsPhotoSize, st::dialogsPadding.y(), _cornerBadgeUserpic->frame)
: p.drawImage(st::dialogsPadding, _cornerBadgeUserpic->frame);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rtl()
? p.drawImage(fullWidth - st::dialogsPadding.x() - st::dialogsPhotoSize, st::dialogsPadding.y(), _cornerBadgeUserpic->frame)
: p.drawImage(st::dialogsPadding, _cornerBadgeUserpic->frame);
p.drawImage(
rtl()
? fullWidth - st::dialogsPadding.x() - st::dialogsPhotoSize
: st::dialogsPadding.x(),
st::dialogsPadding.y(),
_cornerBadgeUserpic->frame);

@@ -77,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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PaintRowTopRight(p, dt, rectForName, active, selected, outerw);
PaintRowTopRight(p, dt, rectForName, active, selected, outerw);

Comment on lines +124 to +126
(rtl()
? unreadLeft
: unreadRight),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(rtl()
? unreadLeft
: unreadRight),
(rtl() ? unreadLeft : unreadRight),

Comment on lines +209 to +211
(rtl()
? unreadLeft
: unreadRight),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(rtl()
? unreadLeft
: unreadRight),
(rtl() ? unreadLeft : unreadRight),

Comment on lines +921 to +923
(rtl()
? fullWidth - nameleft - availableWidth
: nameleft),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(rtl()
? fullWidth - nameleft - availableWidth
: nameleft),
(rtl() ? (fullWidth - nameleft - availableWidth) : nameleft),

Comment on lines +2295 to +2297
(rtl()
? (width() - _thirdSection->width())
: _thirdSection->x()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(rtl()
? (width() - _thirdSection->width())
: _thirdSection->x()),
(rtl() ? (width() - _thirdSection->width()) : _thirdSection->x()),

Comment on lines +2326 to +2328
newWidth = rtl()
? width() - newWidth
: newWidth;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
newWidth = rtl()
? width() - newWidth
: newWidth;
newWidth = rtl() ? (width() - newWidth) : newWidth;

Comment on lines +2356 to +2358
newWidth = rtl()
? (width() - newWidth)
: newWidth;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
newWidth = rtl()
? (width() - newWidth)
: newWidth;
newWidth = rtl() ? (width() - newWidth) : newWidth;

Comment on lines +140 to +142
auto x = (rtl()
? rectForName.right() - qMin(nameWidth + st::dialogsScamSkip, rectForName.width() - width) - width
: rectForName.x() + qMin(nameWidth + st::dialogsScamSkip, rectForName.width() - width));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto x = (rtl()
? rectForName.right() - qMin(nameWidth + st::dialogsScamSkip, rectForName.width() - width) - width
: rectForName.x() + qMin(nameWidth + st::dialogsScamSkip, rectForName.width() - width));
const auto minWidth = std::min(
nameWidth + st::dialogsScamSkip,
rectForName.width() - width);
const auto x = rtl()
? (rectForName.x() + rectForName.width() - minWidth - width)
: (rectForName.x() + minWidth);

Comment on lines +516 to +524
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());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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::connectingLeftShadow.paint(p, rtl() ? right : left, width());
st::connectingLeft.paint(p, rtl() ? right : left, width());
st::connectingRightShadow.paint(p, rtl() ? left : right, width());
st::connectingRight.paint(p, rtl() ? left : right, width());

@AMP999 AMP999 marked this pull request as draft January 6, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants