Skip to content

Commit

Permalink
optimizations + fixed shitty online/videocall with single corner radius
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdnx committed Feb 26, 2024
1 parent e20c3b0 commit 0dad209
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 36 deletions.
49 changes: 14 additions & 35 deletions Telegram/SourceFiles/dialogs/dialogs_row.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,41 +432,20 @@ void Row::PaintCornerBadgeFrame(
q.setBrush(data->active
? st::dialogsOnlineBadgeFgActive
: st::dialogsOnlineBadgeFg);
if ((peer->isChannel() && Data::ChannelHasActiveCall(peer->asChannel())) || online) {
if (!RabbitSettings::JsonSettings::GetBool("general_roundness")) {
q.drawEllipse(
QRectF(
(46 - size -
(RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50
? skip.x()
: -(stroke / 2))),
(46 - size -
(RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50
? skip.y()
: -(stroke / 2))),
size,
size
).marginsRemoved({ shrink, shrink, shrink, shrink })
);
} else {
q.drawRoundedRect(
QRectF(
(46 - size -
(RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50
? skip.x()
: -(stroke / 2))),
(46 - size -
(RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50
? skip.y()
: -(stroke / 2))),
size,
size
).marginsRemoved({ shrink, shrink, shrink, shrink }),
size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100,
size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100
);
}
}

QRectF badgeRect = QRectF(
photoSize - skip.x() - size,
photoSize - skip.y() - size,
size,
size
).marginsRemoved({ shrink, shrink, shrink, shrink });
auto radius = size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100;
auto isVideoCallOrOnline = (peer->isChannel() && Data::ChannelHasActiveCall(peer->asChannel())) || online;
auto drawRect = RabbitSettings::JsonSettings::GetBool("general_roundness");

if (!isVideoCallOrOnline || (isVideoCallOrOnline && drawRect)) {
q.drawRoundedRect(badgeRect, radius, radius);
} else { q.drawEllipse(badgeRect); }
}

void Row::paintUserpic(
Expand Down
2 changes: 1 addition & 1 deletion Telegram/build/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MyAppId "4356CE01-4137-4C55-9F8B-FB4EEBB6EC0C"
#define CurrentYear GetDateTimeString('yyyy','','')
#define MyBuildTarget "win64"
#define MyAppVersionFull "4.15-25022024"
#define MyAppVersionFull "4.15-26022024"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
Expand Down

0 comments on commit 0dad209

Please sign in to comment.