mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-19 06:26:55 +00:00
Removed Adaptive namespace from Profile::BackButton.
This commit is contained in:
parent
0d814066d6
commit
295a863d69
@ -114,7 +114,8 @@ FixedBar::FixedBar(
|
||||
, _backButton(
|
||||
this,
|
||||
&controller->session(),
|
||||
tr::lng_admin_log_title_all(tr::now))
|
||||
tr::lng_admin_log_title_all(tr::now),
|
||||
controller->adaptive().oneColumnValue())
|
||||
, _search(this, st::topBarSearch)
|
||||
, _cancel(this, st::historyAdminLogCancelSearch)
|
||||
, _filter(this, tr::lng_admin_log_filter(), st::topBarButton) {
|
||||
|
@ -14,21 +14,35 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "styles/style_window.h"
|
||||
#include "styles/style_profile.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "facades.h"
|
||||
|
||||
namespace Profile {
|
||||
|
||||
BackButton::BackButton(
|
||||
QWidget *parent,
|
||||
not_null<Main::Session*> session,
|
||||
const QString &text)
|
||||
const QString &text,
|
||||
rpl::producer<bool> oneColumnValue)
|
||||
: Ui::AbstractButton(parent)
|
||||
, _session(session)
|
||||
, _text(text.toUpper()) {
|
||||
setCursor(style::cur_pointer);
|
||||
|
||||
subscribe(Adaptive::Changed(), [=] { updateAdaptiveLayout(); });
|
||||
updateAdaptiveLayout();
|
||||
std::move(
|
||||
oneColumnValue
|
||||
) | rpl::start_with_next([=](bool oneColumn) {
|
||||
if (!oneColumn) {
|
||||
_unreadBadgeLifetime.destroy();
|
||||
} else if (!_unreadBadgeLifetime) {
|
||||
_session->data().unreadBadgeChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
rtlupdate(
|
||||
0,
|
||||
0,
|
||||
st::titleUnreadCounterRight,
|
||||
st::titleUnreadCounterTop);
|
||||
}, _unreadBadgeLifetime);
|
||||
}
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void BackButton::setText(const QString &text) {
|
||||
@ -57,15 +71,4 @@ void BackButton::onStateChanged(State was, StateChangeSource source) {
|
||||
}
|
||||
}
|
||||
|
||||
void BackButton::updateAdaptiveLayout() {
|
||||
if (!Adaptive::OneColumn()) {
|
||||
_unreadBadgeLifetime.destroy();
|
||||
} else if (!_unreadBadgeLifetime) {
|
||||
_session->data().unreadBadgeChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
rtlupdate(0, 0, st::titleUnreadCounterRight, st::titleUnreadCounterTop);
|
||||
}, _unreadBadgeLifetime);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Profile
|
||||
|
@ -20,7 +20,8 @@ public:
|
||||
BackButton(
|
||||
QWidget *parent,
|
||||
not_null<Main::Session*> session,
|
||||
const QString &text);
|
||||
const QString &text,
|
||||
rpl::producer<bool> oneColumnValue);
|
||||
|
||||
void setText(const QString &text);
|
||||
|
||||
@ -31,8 +32,6 @@ protected:
|
||||
void onStateChanged(State was, StateChangeSource source) override;
|
||||
|
||||
private:
|
||||
void updateAdaptiveLayout();
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
|
||||
rpl::lifetime _unreadBadgeLifetime;
|
||||
|
Loading…
Reference in New Issue
Block a user