Fixed link color for status with profile color in profile top bar.

This commit is contained in:
23rd
2025-10-24 17:01:30 +03:00
parent fce459f612
commit f62869e4df
4 changed files with 43 additions and 10 deletions
@@ -140,6 +140,10 @@ void StatusLabel::setMembersLinkCallback(Fn<void()> callback) {
_membersLinkCallback = std::move(callback);
}
Fn<void()> StatusLabel::membersLinkCallback() const {
return _membersLinkCallback;
}
void StatusLabel::setColorized(bool enabled) {
_colorized = enabled;
refresh();
@@ -23,6 +23,7 @@ public:
void refresh();
void setMembersLinkCallback(Fn<void()> callback);
[[nodiscard]] Fn<void()> membersLinkCallback() const;
void setOnlineCount(int count);
void setColorized(bool enabled);
@@ -246,12 +246,7 @@ TopBar::TopBar(
? [=] { return _peer->owner().pendingStarsRating(); }
: Fn<Data::StarsRatingPending()>()))
: nullptr)
, _status(
this,
QString(),
_peer->isMegagroup()
? st::infoProfileMegagroupCover.status
: st::infoProfileCover.status)
, _status(this, QString(), statusStyle())
, _statusLabel(std::make_unique<StatusLabel>(_status.data(), _peer))
, _showLastSeen(
this,
@@ -371,10 +366,34 @@ void TopBar::adjustColors(const std::optional<QColor> &edgeColor) {
_title->setTextColorOverride(shouldOverrideTitle
? std::optional<QColor>(st::groupCallMembersFg->c)
: std::nullopt);
_status->setTextColorOverride(shouldOverrideStatus
? std::optional<QColor>(st::groupCallVideoSubTextFg->c)
: std::nullopt);
_statusLabel->setColorized(!shouldOverrideStatus);
{
const auto statusPosition = _status->pos();
const auto membersLinkCallback = _statusLabel->membersLinkCallback();
{
_statusLabel = nullptr;
delete _status.release();
}
if (shouldOverrideStatus) {
const auto copySt = [&](const style::FlatLabel &st) {
auto result = std::make_unique<style::FlatLabel>(
base::duplicate(st));
result->palette.linkFg = st::groupCallVideoSubTextFg;
return result;
};
_statusSt = copySt(statusStyle());
_status.create(this, QString(), *(_statusSt.get()));
} else {
_status.create(this, QString(), statusStyle());
}
_status->moveToLeft(statusPosition.x(), statusPosition.y());
_status->show();
_statusLabel = std::make_unique<StatusLabel>(_status.data(), _peer);
_statusLabel->setMembersLinkCallback(membersLinkCallback);
_status->setTextColorOverride(shouldOverrideStatus
? std::optional<QColor>(st::groupCallVideoSubTextFg->c)
: std::nullopt);
_statusLabel->setColorized(!shouldOverrideStatus);
}
const auto shouldOverrideBadges = shouldOverride(
st::infoBotVerifyBadge.premiumFg);
@@ -1983,4 +2002,10 @@ rpl::producer<std::optional<QColor>> TopBar::edgeColor() const {
return _edgeColor.value();
}
const style::FlatLabel &TopBar::statusStyle() const {
return _peer->isMegagroup()
? st::infoProfileMegagroupCover.status
: st::infoProfileCover.status;
}
} // namespace Info::Profile
@@ -45,6 +45,7 @@ class Timer;
namespace style {
struct InfoTopBar;
struct InfoPeerBadge;
struct FlatLabel;
} //namespace style
class QGraphicsOpacityEffect;
@@ -171,6 +172,7 @@ private:
void setupStoryOutline(const QRect &geometry = QRect());
void updateStoryOutline(std::optional<QColor> edgeColor);
void paintStoryOutline(QPainter &p, const QRect &geometry);
[[nodiscard]] const style::FlatLabel &statusStyle() const;
const not_null<PeerData*> _peer;
Data::ForumTopic *_topic = nullptr;
@@ -198,6 +200,7 @@ private:
object_ptr<Ui::RoundButton> _showLastSeen = { nullptr };
QGraphicsOpacityEffect *_showLastSeenOpacity = nullptr;
std::shared_ptr<style::FlatLabel> _statusSt;
std::shared_ptr<style::InfoPeerBadge> _botVerifySt;
std::shared_ptr<style::InfoPeerBadge> _badgeSt;
std::shared_ptr<style::InfoPeerBadge> _verifiedSt;