mirror of https://github.com/procxx/kepka.git
Hide send message in Info for current chat.
This commit is contained in:
parent
3db696d52f
commit
e1ba9f8ff8
|
@ -335,7 +335,7 @@ bool StickersListWidget::Footer::event(QEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TWidget::event(e);
|
return InnerFooter::event(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListWidget::Footer::updateSelected() {
|
void StickersListWidget::Footer::updateSelected() {
|
||||||
|
|
|
@ -843,7 +843,7 @@ void DialogsWidget::setSearchInPeer(PeerData *peer, UserData *from) {
|
||||||
if (searchInPeerUpdated) {
|
if (searchInPeerUpdated) {
|
||||||
_searchInPeer = newSearchInPeer;
|
_searchInPeer = newSearchInPeer;
|
||||||
from = nullptr;
|
from = nullptr;
|
||||||
controller()->searchInPeerChanged().notify(_searchInPeer, true);
|
controller()->searchInPeer = _searchInPeer;
|
||||||
updateJumpToDateVisibility();
|
updateJumpToDateVisibility();
|
||||||
} else if (!_searchInPeer) {
|
} else if (!_searchInPeer) {
|
||||||
from = nullptr;
|
from = nullptr;
|
||||||
|
|
|
@ -578,7 +578,7 @@ bool HistoryInner::event(QEvent *e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QWidget::event(e);
|
return TWidget::event(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryInner::onTouchScrollTimer() {
|
void HistoryInner::onTouchScrollTimer() {
|
||||||
|
|
|
@ -1817,7 +1817,8 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
|
||||||
App::main()->dlgUpdated(wasHistory ? wasHistory->peer : nullptr, wasMsgId);
|
App::main()->dlgUpdated(wasHistory ? wasHistory->peer : nullptr, wasMsgId);
|
||||||
emit historyShown(_history, _showAtMsgId);
|
emit historyShown(_history, _showAtMsgId);
|
||||||
|
|
||||||
controller()->historyPeerChanged().notify(_peer, true);
|
controller()->historyCanWrite = _canSendMessages;
|
||||||
|
controller()->historyPeer = _peer;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5913,7 +5914,7 @@ void HistoryWidget::fullPeerUpdated(PeerData *peer) {
|
||||||
bool newCanSendMessages = canSendMessages(_peer);
|
bool newCanSendMessages = canSendMessages(_peer);
|
||||||
if (newCanSendMessages != _canSendMessages) {
|
if (newCanSendMessages != _canSendMessages) {
|
||||||
_canSendMessages = newCanSendMessages;
|
_canSendMessages = newCanSendMessages;
|
||||||
controller()->historyPeerCanWriteChanged().notify(_peer);
|
controller()->historyCanWrite = _canSendMessages;
|
||||||
if (!_canSendMessages) {
|
if (!_canSendMessages) {
|
||||||
cancelReply();
|
cancelReply();
|
||||||
}
|
}
|
||||||
|
@ -5952,7 +5953,7 @@ void HistoryWidget::handlePeerUpdate() {
|
||||||
bool newCanSendMessages = canSendMessages(_peer);
|
bool newCanSendMessages = canSendMessages(_peer);
|
||||||
if (newCanSendMessages != _canSendMessages) {
|
if (newCanSendMessages != _canSendMessages) {
|
||||||
_canSendMessages = newCanSendMessages;
|
_canSendMessages = newCanSendMessages;
|
||||||
controller()->historyPeerCanWriteChanged().notify(_peer);
|
controller()->historyCanWrite = _canSendMessages;
|
||||||
if (!_canSendMessages) {
|
if (!_canSendMessages) {
|
||||||
cancelReply();
|
cancelReply();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/discrete_sliders.h"
|
#include "ui/widgets/discrete_sliders.h"
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/widgets/shadow.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "ui/effects/widget_fade_wrap.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
#include "window/main_window.h"
|
#include "window/main_window.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
@ -44,7 +45,10 @@ NarrowWrap::NarrowWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
not_null<Memento*> memento)
|
not_null<Memento*> memento)
|
||||||
: Window::SectionWidget(parent, controller) {
|
: Window::SectionWidget(parent, controller)
|
||||||
|
, _topShadow(this, object_ptr<Ui::PlainShadow>(this, st::shadowFg)) {
|
||||||
|
_topShadow->hideFast();
|
||||||
|
_topShadow->raise();
|
||||||
setInternalState(geometry(), memento);
|
setInternalState(geometry(), memento);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +56,10 @@ NarrowWrap::NarrowWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
not_null<MoveMemento*> memento)
|
not_null<MoveMemento*> memento)
|
||||||
: Window::SectionWidget(parent, controller) {
|
: Window::SectionWidget(parent, controller)
|
||||||
|
, _topShadow(this, object_ptr<Ui::PlainShadow>(this, st::shadowFg)) {
|
||||||
|
_topShadow->hideFast();
|
||||||
|
_topShadow->raise();
|
||||||
restoreState(memento);
|
restoreState(memento);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,9 +109,11 @@ rpl::producer<int> NarrowWrap::desiredHeightForContent() const {
|
||||||
|
|
||||||
QPixmap NarrowWrap::grabForShowAnimation(
|
QPixmap NarrowWrap::grabForShowAnimation(
|
||||||
const Window::SectionSlideParams ¶ms) {
|
const Window::SectionSlideParams ¶ms) {
|
||||||
// if (params.withTopBarShadow) _topShadow->hide();
|
anim::SetDisabled(true);
|
||||||
|
if (params.withTopBarShadow) _topShadow->hide();
|
||||||
auto result = myGrab(this);
|
auto result = myGrab(this);
|
||||||
// if (params.withTopBarShadow) _topShadow->show();
|
if (params.withTopBarShadow) _topShadow->show();
|
||||||
|
anim::SetDisabled(false);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +121,10 @@ void NarrowWrap::doSetInnerFocus() {
|
||||||
// _content->setInnerFocus();
|
// _content->setInnerFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NarrowWrap::hasTopBarShadow() const {
|
||||||
|
return !_topShadow->isHidden() && !_topShadow->animating();
|
||||||
|
}
|
||||||
|
|
||||||
bool NarrowWrap::showInternal(
|
bool NarrowWrap::showInternal(
|
||||||
not_null<Window::SectionMemento*> memento) {
|
not_null<Window::SectionMemento*> memento) {
|
||||||
if (auto infoMemento = dynamic_cast<Memento*>(memento.get())) {
|
if (auto infoMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||||
|
|
|
@ -26,6 +26,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PlainShadow;
|
class PlainShadow;
|
||||||
class SettingsSlider;
|
class SettingsSlider;
|
||||||
|
template <typename Widget>
|
||||||
|
class WidgetFadeWrap;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
@ -58,9 +60,7 @@ public:
|
||||||
return peer();
|
return peer();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasTopBarShadow() const override {
|
bool hasTopBarShadow() const override;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap grabForShowAnimation(
|
QPixmap grabForShowAnimation(
|
||||||
const Window::SectionSlideParams ¶ms) override;
|
const Window::SectionSlideParams ¶ms) override;
|
||||||
|
@ -99,7 +99,7 @@ private:
|
||||||
void showContent(object_ptr<ContentWidget> content);
|
void showContent(object_ptr<ContentWidget> content);
|
||||||
object_ptr<TopBar> createTopBar();
|
object_ptr<TopBar> createTopBar();
|
||||||
|
|
||||||
object_ptr<Ui::PlainShadow> _topShadow = { nullptr };
|
object_ptr<Ui::WidgetFadeWrap<Ui::PlainShadow>> _topShadow = { nullptr };
|
||||||
object_ptr<ContentWidget> _content = { nullptr };
|
object_ptr<ContentWidget> _content = { nullptr };
|
||||||
object_ptr<TopBar> _topBar = { nullptr };
|
object_ptr<TopBar> _topBar = { nullptr };
|
||||||
|
|
||||||
|
|
|
@ -120,16 +120,24 @@ object_ptr<Ui::RpWidget> InnerWidget::setupMuteToggle(
|
||||||
void InnerWidget::setupMainUserButtons(
|
void InnerWidget::setupMainUserButtons(
|
||||||
Ui::VerticalLayout *wrap,
|
Ui::VerticalLayout *wrap,
|
||||||
not_null<UserData*> user) const {
|
not_null<UserData*> user) const {
|
||||||
auto sendMessage = wrap->add(object_ptr<Button>(
|
auto sendMessage = wrap->add(object_ptr<Ui::SlideWrap<Button>>(
|
||||||
wrap,
|
wrap,
|
||||||
Lang::Viewer(lng_profile_send_message) | ToUpperValue(),
|
object_ptr<Button>(
|
||||||
st::infoMainButton));
|
wrap,
|
||||||
sendMessage->clicks()
|
Lang::Viewer(lng_profile_send_message) | ToUpperValue(),
|
||||||
|
st::infoMainButton)));
|
||||||
|
_controller->historyPeer.value()
|
||||||
|
| rpl::map([user](PeerData *peer) { return peer == user; })
|
||||||
|
| rpl::start([sendMessage](bool peerHistoryShown) {
|
||||||
|
sendMessage->toggleAnimated(!peerHistoryShown);
|
||||||
|
}, sendMessage->lifetime());
|
||||||
|
sendMessage->entity()->clicks()
|
||||||
| rpl::start([this, user](auto&&) {
|
| rpl::start([this, user](auto&&) {
|
||||||
_controller->showPeerHistory(
|
_controller->showPeerHistory(
|
||||||
user,
|
user,
|
||||||
Ui::ShowWay::Forward);
|
Ui::ShowWay::Forward);
|
||||||
}, sendMessage->lifetime());
|
}, sendMessage->lifetime());
|
||||||
|
sendMessage->finishAnimations();
|
||||||
|
|
||||||
auto addContact = wrap->add(object_ptr<Ui::SlideWrap<Button>>(
|
auto addContact = wrap->add(object_ptr<Ui::SlideWrap<Button>>(
|
||||||
wrap,
|
wrap,
|
||||||
|
|
|
@ -23,6 +23,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include <rpl/filter.h>
|
#include <rpl/filter.h>
|
||||||
#include <rpl/never.h>
|
#include <rpl/never.h>
|
||||||
#include <rpl/before_next.h>
|
#include <rpl/before_next.h>
|
||||||
|
#include <rpl/after_next.h>
|
||||||
#include <rpl/combine.h>
|
#include <rpl/combine.h>
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
#include "profile/profile_userpic_button.h"
|
#include "profile/profile_userpic_button.h"
|
||||||
|
@ -274,10 +275,16 @@ LabeledLine::LabeledLine(
|
||||||
auto layout = entity();
|
auto layout = entity();
|
||||||
auto nonEmptyText = std::move(text)
|
auto nonEmptyText = std::move(text)
|
||||||
| rpl::before_next([this](const TextWithEntities &value) {
|
| rpl::before_next([this](const TextWithEntities &value) {
|
||||||
toggleAnimated(!value.text.isEmpty());
|
if (value.text.isEmpty()) {
|
||||||
}) | rpl::filter([this](const TextWithEntities &value) {
|
hideAnimated();
|
||||||
return !value.text.isEmpty();
|
}
|
||||||
});
|
})
|
||||||
|
| rpl::filter([this](const TextWithEntities &value) {
|
||||||
|
return !value.text.isEmpty();
|
||||||
|
})
|
||||||
|
| rpl::after_next([this](const TextWithEntities &value) {
|
||||||
|
showAnimated();
|
||||||
|
});
|
||||||
layout->add(object_ptr<Ui::FlatLabel>(
|
layout->add(object_ptr<Ui::FlatLabel>(
|
||||||
this,
|
this,
|
||||||
std::move(nonEmptyText),
|
std::move(nonEmptyText),
|
||||||
|
|
|
@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
|
||||||
|
#include <rpl/combine.h>
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
#include "styles/style_history.h"
|
#include "styles/style_history.h"
|
||||||
#include "ui/special_buttons.h"
|
#include "ui/special_buttons.h"
|
||||||
|
@ -168,12 +169,12 @@ MainWidget::MainWidget(
|
||||||
subscribe(_controller->floatPlayerAreaUpdated(), [this] {
|
subscribe(_controller->floatPlayerAreaUpdated(), [this] {
|
||||||
checkFloatPlayerVisibility();
|
checkFloatPlayerVisibility();
|
||||||
});
|
});
|
||||||
subscribe(_controller->historyPeerChanged(), [this](PeerData *peer) {
|
rpl::combine(
|
||||||
updateThirdColumnToCurrentPeer(peer);
|
_controller->historyPeer.value(),
|
||||||
});
|
_controller->historyCanWrite.value())
|
||||||
subscribe(_controller->historyPeerCanWriteChanged(), [this](PeerData *peer) {
|
| rpl::start([this](PeerData *peer, bool canWrite) {
|
||||||
updateThirdColumnToCurrentPeer(peer);
|
updateThirdColumnToCurrentPeer(peer, canWrite);
|
||||||
});
|
}, lifetime());
|
||||||
|
|
||||||
QCoreApplication::instance()->installEventFilter(this);
|
QCoreApplication::instance()->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -3545,11 +3546,13 @@ void MainWidget::updateDialogsWidthAnimated() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::updateThirdColumnToCurrentPeer(PeerData *peer) {
|
void MainWidget::updateThirdColumnToCurrentPeer(
|
||||||
|
PeerData *peer,
|
||||||
|
bool canWrite) {
|
||||||
if (Adaptive::ThreeColumn()
|
if (Adaptive::ThreeColumn()
|
||||||
&& Auth().data().tabbedSelectorSectionEnabled()
|
&& Auth().data().tabbedSelectorSectionEnabled()
|
||||||
&& peer) {
|
&& peer) {
|
||||||
if (!peer->canWrite()) {
|
if (!canWrite) {
|
||||||
_controller->showPeerInfo(
|
_controller->showPeerInfo(
|
||||||
peer,
|
peer,
|
||||||
anim::type::instant,
|
anim::type::instant,
|
||||||
|
@ -3750,7 +3753,7 @@ int MainWidget::backgroundFromY() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::onHistoryShown(History *history, MsgId atMsgId) {
|
void MainWidget::onHistoryShown(History *history, MsgId atMsgId) {
|
||||||
updateControlsGeometry();
|
// updateControlsGeometry();
|
||||||
dlgUpdated(history ? history->peer : nullptr, atMsgId);
|
dlgUpdated(history ? history->peer : nullptr, atMsgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -505,7 +505,9 @@ private:
|
||||||
void updateMediaPlaylistPosition(int x);
|
void updateMediaPlaylistPosition(int x);
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void updateDialogsWidthAnimated();
|
void updateDialogsWidthAnimated();
|
||||||
void updateThirdColumnToCurrentPeer(PeerData *peer);
|
void updateThirdColumnToCurrentPeer(
|
||||||
|
PeerData *peer,
|
||||||
|
bool canWrite);
|
||||||
|
|
||||||
void createPlayer();
|
void createPlayer();
|
||||||
void switchToPanelPlayer();
|
void switchToPanelPlayer();
|
||||||
|
|
|
@ -71,6 +71,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include <gsl/gsl>
|
#include <gsl/gsl>
|
||||||
|
|
||||||
|
#ifndef _DEBUG
|
||||||
|
#include <rpl/rpl.h>
|
||||||
|
#endif // _DEBUG
|
||||||
|
|
||||||
#include "base/variant.h"
|
#include "base/variant.h"
|
||||||
#include "base/optional.h"
|
#include "base/optional.h"
|
||||||
#include "base/algorithm.h"
|
#include "base/algorithm.h"
|
||||||
|
|
|
@ -71,12 +71,12 @@ void AbstractButton::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
onStateChanged(was, StateChangeSource::ByPress);
|
onStateChanged(was, StateChangeSource::ByPress);
|
||||||
if (was & StateFlag::Over) {
|
if (was & StateFlag::Over) {
|
||||||
_modifiers = e->modifiers();
|
_modifiers = e->modifiers();
|
||||||
_clicks.fire({});
|
|
||||||
if (_clickedCallback) {
|
if (_clickedCallback) {
|
||||||
_clickedCallback();
|
_clickedCallback();
|
||||||
} else {
|
} else {
|
||||||
emit clicked();
|
emit clicked();
|
||||||
}
|
}
|
||||||
|
_clicks.fire({});
|
||||||
} else {
|
} else {
|
||||||
setOver(false, StateChangeSource::ByHover);
|
setOver(false, StateChangeSource::ByHover);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,9 @@ bool Disabled() {
|
||||||
|
|
||||||
void SetDisabled(bool disabled) {
|
void SetDisabled(bool disabled) {
|
||||||
AnimationsDisabled = disabled;
|
AnimationsDisabled = disabled;
|
||||||
|
if (disabled && _manager) {
|
||||||
|
_manager->timeout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anim
|
} // anim
|
||||||
|
|
|
@ -66,7 +66,9 @@ RippleButton::RippleButton(QWidget *parent, const style::RippleAnimation &st) :
|
||||||
, _st(st) {
|
, _st(st) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RippleButton::setForceRippled(bool rippled, SetForceRippledWay way) {
|
void RippleButton::setForceRippled(
|
||||||
|
bool rippled,
|
||||||
|
anim::type animated) {
|
||||||
if (_forceRippled != rippled) {
|
if (_forceRippled != rippled) {
|
||||||
_forceRippled = rippled;
|
_forceRippled = rippled;
|
||||||
if (_forceRippled) {
|
if (_forceRippled) {
|
||||||
|
@ -80,7 +82,7 @@ void RippleButton::setForceRippled(bool rippled, SetForceRippledWay way) {
|
||||||
_ripple->lastStop();
|
_ripple->lastStop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (way == SetForceRippledWay::SkipAnimation && _ripple) {
|
if (animated == anim::type::instant && _ripple) {
|
||||||
_ripple->lastFinish();
|
_ripple->lastFinish();
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
|
|
|
@ -53,12 +53,9 @@ class RippleButton : public AbstractButton {
|
||||||
public:
|
public:
|
||||||
RippleButton(QWidget *parent, const style::RippleAnimation &st);
|
RippleButton(QWidget *parent, const style::RippleAnimation &st);
|
||||||
|
|
||||||
// Displays full ripple circle constantly.
|
void setForceRippled(
|
||||||
enum class SetForceRippledWay {
|
bool rippled,
|
||||||
Default,
|
anim::type animated = anim::type::normal);
|
||||||
SkipAnimation,
|
|
||||||
};
|
|
||||||
void setForceRippled(bool rippled, SetForceRippledWay way = SetForceRippledWay::Default);
|
|
||||||
bool forceRippled() const {
|
bool forceRippled() const {
|
||||||
return _forceRippled;
|
return _forceRippled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ FlatLabel::FlatLabel(
|
||||||
, _text(st.width ? st.width : QFIXED_MAX)
|
, _text(st.width ? st.width : QFIXED_MAX)
|
||||||
, _st(st)
|
, _st(st)
|
||||||
, _contextCopyText(lang(lng_context_copy_text)) {
|
, _contextCopyText(lang(lng_context_copy_text)) {
|
||||||
|
textUpdated();
|
||||||
std::move(text)
|
std::move(text)
|
||||||
| rpl::start([this](const QString &value) {
|
| rpl::start([this](const QString &value) {
|
||||||
setText(value);
|
setText(value);
|
||||||
|
@ -184,6 +185,7 @@ FlatLabel::FlatLabel(
|
||||||
, _text(st.width ? st.width : QFIXED_MAX)
|
, _text(st.width ? st.width : QFIXED_MAX)
|
||||||
, _st(st)
|
, _st(st)
|
||||||
, _contextCopyText(lang(lng_context_copy_text)) {
|
, _contextCopyText(lang(lng_context_copy_text)) {
|
||||||
|
textUpdated();
|
||||||
std::move(text)
|
std::move(text)
|
||||||
| rpl::start([this](const TextWithEntities &value) {
|
| rpl::start([this](const TextWithEntities &value) {
|
||||||
setMarkedText(value);
|
setMarkedText(value);
|
||||||
|
@ -455,7 +457,7 @@ bool FlatLabel::event(QEvent *e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QWidget::event(e);
|
return RpWidget::event(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlatLabel::touchEvent(QTouchEvent *e) {
|
void FlatLabel::touchEvent(QTouchEvent *e) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "window/top_bar_widget.h"
|
#include "window/top_bar_widget.h"
|
||||||
|
|
||||||
#include <rpl/combine.h>
|
#include <rpl/combine.h>
|
||||||
|
#include <rpl/combine_previous.h>
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "boxes/add_contact_box.h"
|
#include "boxes/add_contact_box.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
|
@ -72,15 +73,28 @@ TopBarWidget::TopBarWidget(
|
||||||
_menuToggle->setClickedCallback([this] { showMenu(); });
|
_menuToggle->setClickedCallback([this] { showMenu(); });
|
||||||
_infoToggle->setClickedCallback([this] { toggleInfoSection(); });
|
_infoToggle->setClickedCallback([this] { toggleInfoSection(); });
|
||||||
|
|
||||||
subscribe(_controller->searchInPeerChanged(), [this](PeerData *peer) {
|
rpl::combine(
|
||||||
_searchInPeer = peer;
|
_controller->historyPeer.value(),
|
||||||
auto historyPeer = App::main() ? App::main()->historyPeer() : nullptr;
|
_controller->searchInPeer.value())
|
||||||
_search->setForceRippled(historyPeer && historyPeer == _searchInPeer);
|
| rpl::combine_previous(std::make_tuple(nullptr, nullptr))
|
||||||
});
|
| rpl::map([](
|
||||||
subscribe(_controller->historyPeerChanged(), [this](PeerData *peer) {
|
const std::tuple<PeerData*, PeerData*> &previous,
|
||||||
_search->setForceRippled(peer && peer == _searchInPeer, Ui::IconButton::SetForceRippledWay::SkipAnimation);
|
const std::tuple<PeerData*, PeerData*> ¤t) {
|
||||||
update();
|
auto peer = std::get<0>(current);
|
||||||
});
|
auto searchPeer = std::get<1>(current);
|
||||||
|
auto peerChanged = (peer != std::get<0>(previous));
|
||||||
|
auto searchInPeer
|
||||||
|
= (peer != nullptr) && (peer == searchPeer);
|
||||||
|
return std::make_tuple(searchInPeer, peerChanged);
|
||||||
|
})
|
||||||
|
| rpl::start([this](
|
||||||
|
bool searchInHistoryPeer,
|
||||||
|
bool peerChanged) {
|
||||||
|
auto animated = peerChanged
|
||||||
|
? anim::type::instant
|
||||||
|
: anim::type::normal;
|
||||||
|
_search->setForceRippled(searchInHistoryPeer, animated);
|
||||||
|
}, lifetime());
|
||||||
|
|
||||||
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
||||||
if (Adaptive::OneColumn()) {
|
if (Adaptive::OneColumn()) {
|
||||||
|
|
|
@ -84,7 +84,6 @@ private:
|
||||||
|
|
||||||
not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
|
|
||||||
PeerData *_searchInPeer = nullptr;
|
|
||||||
int _selectedCount = 0;
|
int _selectedCount = 0;
|
||||||
bool _canDelete = false;
|
bool _canDelete = false;
|
||||||
bool _canForward = false;
|
bool _canForward = false;
|
||||||
|
|
|
@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <rpl/variable.h>
|
||||||
#include "base/flags.h"
|
#include "base/flags.h"
|
||||||
|
|
||||||
class MainWidget;
|
class MainWidget;
|
||||||
|
@ -53,19 +54,13 @@ public:
|
||||||
|
|
||||||
// This is needed for History TopBar updating when searchInPeer
|
// This is needed for History TopBar updating when searchInPeer
|
||||||
// is changed in the DialogsWidget of the current window.
|
// is changed in the DialogsWidget of the current window.
|
||||||
base::Observable<PeerData*> &searchInPeerChanged() {
|
rpl::variable<PeerData*> searchInPeer;
|
||||||
return _searchInPeerChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is needed while we have one HistoryWidget and one TopBarWidget
|
// This is needed while we have one HistoryWidget and one TopBarWidget
|
||||||
// for all histories we show in a window. Once each history is shown
|
// for all histories we show in a window. Once each history is shown
|
||||||
// in its own HistoryWidget with its own TopBarWidget this can be removed.
|
// in its own HistoryWidget with its own TopBarWidget this can be removed.
|
||||||
base::Observable<PeerData*> &historyPeerChanged() {
|
rpl::variable<PeerData*> historyPeer;
|
||||||
return _historyPeerChanged;
|
rpl::variable<bool> historyCanWrite;
|
||||||
}
|
|
||||||
base::Observable<PeerData*> &historyPeerCanWriteChanged() {
|
|
||||||
return _historyPeerCanWriteChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
void enableGifPauseReason(GifPauseReason reason);
|
void enableGifPauseReason(GifPauseReason reason);
|
||||||
void disableGifPauseReason(GifPauseReason reason);
|
void disableGifPauseReason(GifPauseReason reason);
|
||||||
|
@ -180,10 +175,6 @@ private:
|
||||||
|
|
||||||
not_null<MainWindow*> _window;
|
not_null<MainWindow*> _window;
|
||||||
|
|
||||||
base::Observable<PeerData*> _searchInPeerChanged;
|
|
||||||
base::Observable<PeerData*> _historyPeerChanged;
|
|
||||||
base::Observable<PeerData*> _historyPeerCanWriteChanged;
|
|
||||||
|
|
||||||
GifPauseReasons _gifPauseReasons = 0;
|
GifPauseReasons _gifPauseReasons = 0;
|
||||||
base::Observable<void> _gifPauseLevelChanged;
|
base::Observable<void> _gifPauseLevelChanged;
|
||||||
base::Observable<void> _floatPlayerAreaUpdated;
|
base::Observable<void> _floatPlayerAreaUpdated;
|
||||||
|
|
Loading…
Reference in New Issue