mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Removed Adaptive namespace from Profile::BackButton.
This commit is contained in:
parent
0d814066d6
commit
295a863d69
3 changed files with 22 additions and 19 deletions
|
@ -114,7 +114,8 @@ FixedBar::FixedBar(
|
||||||
, _backButton(
|
, _backButton(
|
||||||
this,
|
this,
|
||||||
&controller->session(),
|
&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)
|
, _search(this, st::topBarSearch)
|
||||||
, _cancel(this, st::historyAdminLogCancelSearch)
|
, _cancel(this, st::historyAdminLogCancelSearch)
|
||||||
, _filter(this, tr::lng_admin_log_filter(), st::topBarButton) {
|
, _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_window.h"
|
||||||
#include "styles/style_profile.h"
|
#include "styles/style_profile.h"
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
#include "facades.h"
|
|
||||||
|
|
||||||
namespace Profile {
|
namespace Profile {
|
||||||
|
|
||||||
BackButton::BackButton(
|
BackButton::BackButton(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const QString &text)
|
const QString &text,
|
||||||
|
rpl::producer<bool> oneColumnValue)
|
||||||
: Ui::AbstractButton(parent)
|
: Ui::AbstractButton(parent)
|
||||||
, _session(session)
|
, _session(session)
|
||||||
, _text(text.toUpper()) {
|
, _text(text.toUpper()) {
|
||||||
setCursor(style::cur_pointer);
|
setCursor(style::cur_pointer);
|
||||||
|
|
||||||
subscribe(Adaptive::Changed(), [=] { updateAdaptiveLayout(); });
|
std::move(
|
||||||
updateAdaptiveLayout();
|
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) {
|
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
|
} // namespace Profile
|
||||||
|
|
|
@ -20,7 +20,8 @@ public:
|
||||||
BackButton(
|
BackButton(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const QString &text);
|
const QString &text,
|
||||||
|
rpl::producer<bool> oneColumnValue);
|
||||||
|
|
||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
|
|
||||||
|
@ -31,8 +32,6 @@ protected:
|
||||||
void onStateChanged(State was, StateChangeSource source) override;
|
void onStateChanged(State was, StateChangeSource source) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateAdaptiveLayout();
|
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
|
||||||
rpl::lifetime _unreadBadgeLifetime;
|
rpl::lifetime _unreadBadgeLifetime;
|
||||||
|
|
Loading…
Add table
Reference in a new issue