TopBar::adjustColors recreates the status label when the top bar colors change, for example after switching night mode, and the new label started without the online count. The count is only sent again when it changes, so the group status showed just the members count until then. Carry the online count over to the new label, like its link callbacks.
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
/*
|
|
This file is part of Telegram Desktop,
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
For license and copyright information please follow this link:
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
*/
|
|
#pragma once
|
|
|
|
#include "base/timer.h"
|
|
|
|
namespace Ui {
|
|
class FlatLabel;
|
|
} // namespace Ui
|
|
|
|
namespace Info::Profile {
|
|
|
|
class StatusLabel final {
|
|
public:
|
|
StatusLabel(
|
|
not_null<Ui::FlatLabel*> label,
|
|
not_null<PeerData*> peer);
|
|
|
|
void refresh();
|
|
void setMembersLinkCallback(Fn<void()> callback);
|
|
[[nodiscard]] Fn<void()> membersLinkCallback() const;
|
|
void setHiddenLinkCallback(Fn<void()> callback);
|
|
[[nodiscard]] Fn<void()> hiddenLinkCallback() const;
|
|
void setOnlineCount(int count);
|
|
[[nodiscard]] int onlineCount() const;
|
|
void setColorized(bool enabled);
|
|
|
|
private:
|
|
const not_null<Ui::FlatLabel*> _label;
|
|
const not_null<PeerData*> _peer;
|
|
int _onlineCount = 0;
|
|
bool _colorized = true;
|
|
Fn<void()> _membersLinkCallback;
|
|
Fn<void()> _hiddenLinkCallback;
|
|
base::Timer _refreshTimer;
|
|
rpl::lifetime _lifetime;
|
|
|
|
};
|
|
|
|
} // namespace Info::Profile
|