Use different indentation for rpl operators.

It works better with Visual Studio IDE.
This commit is contained in:
John Preston 2017-12-22 11:05:20 +04:00
parent 44014e62ba
commit 8e45b09083
72 changed files with 1282 additions and 1237 deletions

View File

@ -243,11 +243,10 @@ auto AuthSessionData::megagroupParticipantRemoved() const -> rpl::producer<Megag
rpl::producer<not_null<UserData*>> AuthSessionData::megagroupParticipantRemoved(
not_null<ChannelData*> channel) const {
return megagroupParticipantRemoved()
| rpl::filter([channel](auto updateChannel, auto user) {
return megagroupParticipantRemoved(
) | rpl::filter([channel](auto updateChannel, auto user) {
return (updateChannel == channel);
})
| rpl::map([](auto updateChannel, auto user) {
}) | rpl::map([](auto updateChannel, auto user) {
return user;
});
}
@ -264,11 +263,10 @@ auto AuthSessionData::megagroupParticipantAdded() const -> rpl::producer<Megagro
rpl::producer<not_null<UserData*>> AuthSessionData::megagroupParticipantAdded(
not_null<ChannelData*> channel) const {
return megagroupParticipantAdded()
| rpl::filter([channel](auto updateChannel, auto user) {
return megagroupParticipantAdded(
) | rpl::filter([channel](auto updateChannel, auto user) {
return (updateChannel == channel);
})
| rpl::map([](auto updateChannel, auto user) {
}) | rpl::map([](auto updateChannel, auto user) {
return user;
});
}

View File

@ -287,8 +287,8 @@ void EditPrivacyBox::createWidgets() {
};
auto createExceptionLink = [this](Exception exception) {
exceptionLink(exception).create(this, object_ptr<Ui::LinkButton>(this, exceptionLinkText(exception)), exceptionLinkMargins());
exceptionLink(exception)->heightValue()
| rpl::start_with_next([this] {
exceptionLink(exception)->heightValue(
) | rpl::start_with_next([this] {
resizeToWidth(width());
}, lifetime());
exceptionLink(exception)->entity()->setClickedCallback([this, exception] { editExceptionUsers(exception); });

View File

@ -127,8 +127,8 @@ void NotificationsBox::prepare() {
_sampleOpacities.push_back(Animation());
}
_countSlider->setActiveSectionFast(_oldCount - 1);
_countSlider->sectionActivated()
| rpl::start_with_next(
_countSlider->sectionActivated(
) | rpl::start_with_next(
[this] { countChanged(); },
lifetime());

View File

@ -54,8 +54,8 @@ void PeerListBox::createMultiSelect() {
auto entity = object_ptr<Ui::MultiSelect>(this, st::contactsMultiSelect, langFactory(lng_participant_filter));
_select.create(this, std::move(entity));
_select->heightValue()
| rpl::start_with_next(
_select->heightValue(
) | rpl::start_with_next(
[this] { updateScrollSkips(); },
lifetime());
_select->entity()->setSubmittedCallback([this](bool chtrlShiftEnter) { content()->submitted(); });
@ -109,8 +109,8 @@ void PeerListBox::prepare() {
onScrollToY(0);
}
content()->scrollToRequests()
| rpl::start_with_next([this](Ui::ScrollToRequest request) {
content()->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
onScrollToY(request.ymin, request.ymax);
}, lifetime());

View File

@ -264,12 +264,12 @@ object_ptr<Ui::RpWidget> Controller::createPhotoAndTitleEdit() {
auto titleEdit = Ui::AttachParentChild(
container,
createTitleEdit());
photoWrap->heightValue()
| rpl::start_with_next([container](int height) {
photoWrap->heightValue(
) | rpl::start_with_next([container](int height) {
container->resize(container->width(), height);
}, photoWrap->lifetime());
container->widthValue()
| rpl::start_with_next([titleEdit](int width) {
container->widthValue(
) | rpl::start_with_next([titleEdit](int width) {
auto left = st::editPeerPhotoMargins.left()
+ st::defaultUserpicButton.size.width();
titleEdit->resizeToWidth(width - left);
@ -439,12 +439,12 @@ object_ptr<Ui::RpWidget> Controller::createUsernameEdit() {
base::lambda<QString()>(),
channel->username,
true));
_controls.username->heightValue()
| rpl::start_with_next([placeholder](int height) {
_controls.username->heightValue(
) | rpl::start_with_next([placeholder](int height) {
placeholder->resize(placeholder->width(), height);
}, placeholder->lifetime());
placeholder->widthValue()
| rpl::start_with_next([this](int width) {
placeholder->widthValue(
) | rpl::start_with_next([this](int width) {
_controls.username->resize(
width,
_controls.username->height());
@ -624,8 +624,8 @@ void Controller::showUsernameResult(
*st);
auto label = _controls.usernameResult.get();
label->show();
label->widthValue()
| rpl::start_with_next([label] {
label->widthValue(
) | rpl::start_with_next([label] {
label->moveToRight(
st::editPeerUsernamePosition.x(),
st::editPeerUsernamePosition.y());
@ -729,8 +729,8 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkEdit() {
Notify::PeerUpdateValue(
_peer,
Notify::PeerUpdate::Flag::InviteLinkChanged)
| rpl::start_with_next([this] {
Notify::PeerUpdate::Flag::InviteLinkChanged
) | rpl::start_with_next([this] {
refreshEditInviteLink();
}, _controls.editInviteLinkWrap->lifetime());
@ -794,8 +794,8 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkCreate() {
Notify::PeerUpdateValue(
_peer,
Notify::PeerUpdate::Flag::InviteLinkChanged)
| rpl::start_with_next([this] {
Notify::PeerUpdate::Flag::InviteLinkChanged
) | rpl::start_with_next([this] {
refreshCreateInviteLink();
}, _controls.createInviteLinkWrap->lifetime());
@ -1437,13 +1437,13 @@ EditPeerInfoBox::EditPeerInfoBox(
void EditPeerInfoBox::prepare() {
auto controller = std::make_unique<Controller>(this, _peer);
_focusRequests.events()
| rpl::start_with_next(
_focusRequests.events(
) | rpl::start_with_next(
[c = controller.get()] { c->setFocus(); },
lifetime());
auto content = controller->createContent();
content->heightValue()
| rpl::start_with_next([this](int height) {
content->heightValue(
) | rpl::start_with_next([this](int height) {
setDimensions(st::boxWideWidth, height);
}, content->lifetime());
setInnerWidget(object_ptr<Ui::IgnoreMargins>(

View File

@ -85,8 +85,10 @@ void AddButtonWithCount(
std::move(count),
st::managePeerButtonLabel);
label->setAttribute(Qt::WA_TransparentForMouseEvents);
rpl::combine(button->widthValue(), label->widthValue())
| rpl::start_with_next([label](int outerWidth, int width) {
rpl::combine(
button->widthValue(),
label->widthValue()
) | rpl::start_with_next([label](int outerWidth, int width) {
label->moveToRight(
st::managePeerButtonLabelPosition.x(),
st::managePeerButtonLabelPosition.y(),
@ -228,12 +230,12 @@ void ManagePeerBox::prepare() {
void ManagePeerBox::setupContent() {
auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
FillManageBox(controller(), _channel, content);
widthValue()
| rpl::start_with_next([=](int width) {
widthValue(
) | rpl::start_with_next([=](int width) {
content->resizeToWidth(width);
}, content->lifetime());
content->heightValue()
| rpl::start_with_next([=](int height) {
content->heightValue(
) | rpl::start_with_next([=](int height) {
setDimensions(st::boxWidth, height);
}, content->lifetime());
}

View File

@ -50,8 +50,8 @@ void StickerSetBox::prepare() {
setTitle(langFactory(lng_contacts_loading));
_inner = setInnerWidget(object_ptr<Inner>(this, _set), st::stickersScroll);
Auth().data().stickersUpdated()
| rpl::start_with_next(
Auth().data().stickersUpdated(
) | rpl::start_with_next(
[this] { updateButtons(); },
lifetime());
@ -60,8 +60,8 @@ void StickerSetBox::prepare() {
onUpdateButtons();
connect(_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
_inner->setInstalled()
| rpl::start_with_next([this](auto &&setId) {
_inner->setInstalled(
) | rpl::start_with_next([this](auto &&setId) {
Auth().api().stickerSetInstalled(setId);
this->closeBox();
}, lifetime());

View File

@ -90,8 +90,8 @@ StickersBox::CounterWidget::CounterWidget(QWidget *parent)
_st.padding = st::stickersFeaturedBadgePadding;
_st.font = st::stickersFeaturedBadgeFont;
Auth().data().featuredStickerSetsUnreadCountValue()
| rpl::start_with_next([this](int count) {
Auth().data().featuredStickerSetsUnreadCountValue(
) | rpl::start_with_next([this](int count) {
setCounter(count);
update();
}, lifetime());
@ -242,8 +242,8 @@ void StickersBox::prepare() {
preloadArchivedSets();
}
setNoContentMargin(true);
_tabs->sectionActivated()
| rpl::start_with_next(
_tabs->sectionActivated(
) | rpl::start_with_next(
[this] { switchTab(); },
lifetime());
refreshTabs();
@ -277,8 +277,8 @@ void StickersBox::prepare() {
setInnerWidget(_tab->takeWidget(), getTopSkip());
setDimensions(st::boxWideWidth, st::boxMaxListHeight);
Auth().data().stickersUpdated()
| rpl::start_with_next(
Auth().data().stickersUpdated(
) | rpl::start_with_next(
[this] { handleStickersUpdated(); },
lifetime());
Auth().api().updateStickers();

View File

@ -214,8 +214,8 @@ void BoxController::Row::stopLastActionRipple() {
}
void BoxController::prepare() {
Auth().data().itemRemoved()
| rpl::start_with_next([this](auto item) {
Auth().data().itemRemoved(
) | rpl::start_with_next([this](auto item) {
if (auto row = rowForItem(item)) {
row->itemRemoved(item);
if (!row->hasItems()) {

View File

@ -365,8 +365,10 @@ void Panel::initLayout() {
initGeometry();
Notify::PeerUpdateValue(_user, Notify::PeerUpdate::Flag::PhotoChanged)
| rpl::start_with_next(
Notify::PeerUpdateValue(
_user,
Notify::PeerUpdate::Flag::PhotoChanged
) | rpl::start_with_next(
[this] { processUserPhoto(); },
lifetime());
subscribe(Auth().downloaderTaskFinished(), [this] {

View File

@ -148,8 +148,8 @@ GifsListWidget::GifsListWidget(
_inlineRequestTimer.setSingleShot(true);
connect(&_inlineRequestTimer, &QTimer::timeout, this, [this] { sendInlineRequest(); });
Auth().data().savedGifsUpdated()
| rpl::start_with_next([this] {
Auth().data().savedGifsUpdated(
) | rpl::start_with_next([this] {
refreshSavedGifs();
}, lifetime());
subscribe(Auth().downloaderTaskFinished(), [this] {

View File

@ -63,8 +63,8 @@ TabbedPanel::TabbedPanel(
_controller->disableGifPauseReason(Window::GifPauseReason::SavedGifs);
}
});
_selector->showRequests()
| rpl::start_with_next([this] {
_selector->showRequests(
) | rpl::start_with_next([this] {
this->showFromSelector();
}, lifetime());

View File

@ -339,8 +339,8 @@ TabbedSelector::TabbedSelector(QWidget *parent, not_null<Window::Controller*> co
}
}));
Auth().api().stickerSetInstalled()
| rpl::start_with_next([this](uint64 setId) {
Auth().api().stickerSetInstalled(
) | rpl::start_with_next([this](uint64 setId) {
_tabsSlider->setActiveSection(
static_cast<int>(SelectorTab::Stickers));
stickers()->showStickerSet(setId);
@ -638,8 +638,8 @@ void TabbedSelector::createTabsSlider() {
_tabsSlider->setSections(sections);
_tabsSlider->setActiveSectionFast(static_cast<int>(_currentTabType));
_tabsSlider->sectionActivated()
| rpl::start_with_next(
_tabsSlider->sectionActivated(
) | rpl::start_with_next(
[this] { switchTab(); },
lifetime());
}

View File

@ -576,8 +576,10 @@ void ChatData::setInviteLink(const QString &newInviteLink) {
ChannelData::ChannelData(const PeerId &id)
: PeerData(id)
, inputChannel(MTP_inputChannel(MTP_int(bareId()), MTP_long(0))) {
Data::PeerFlagValue(this, MTPDchannel::Flag::f_megagroup)
| rpl::start_with_next([this](bool megagroup) {
Data::PeerFlagValue(
this,
MTPDchannel::Flag::f_megagroup
) | rpl::start_with_next([this](bool megagroup) {
if (megagroup) {
if (!mgInfo) {
mgInfo = std::make_unique<MegagroupInfo>();

View File

@ -31,11 +31,11 @@ template <typename ChangeType, typename Error, typename Generator>
inline auto FlagsValueWithMask(
rpl::producer<ChangeType, Error, Generator> &&value,
typename ChangeType::Type mask) {
return std::move(value)
| rpl::filter([mask](const ChangeType &change) {
return std::move(
value
) | rpl::filter([mask](const ChangeType &change) {
return change.diff & mask;
})
| rpl::map([mask](const ChangeType &change) {
}) | rpl::map([mask](const ChangeType &change) {
return change.value & mask;
});
}
@ -44,8 +44,10 @@ template <typename ChangeType, typename Error, typename Generator>
inline auto SingleFlagValue(
rpl::producer<ChangeType, Error, Generator> &&value,
typename ChangeType::Enum flag) {
return FlagsValueWithMask(std::move(value), flag)
| rpl::map([flag](typename ChangeType::Type value) {
return FlagsValueWithMask(
std::move(value),
flag
) | rpl::map([flag](typename ChangeType::Type value) {
return !!value;
});
}

View File

@ -260,8 +260,8 @@ rpl::producer<SparseIdsSlice> SearchController::simpleIdsSlice(
aroundId,
limitBefore,
limitAfter);
builder->insufficientAround()
| rpl::start_with_next([=](
builder->insufficientAround(
) | rpl::start_with_next([=](
const SparseIdsSliceBuilder::AroundData &data) {
requestMore(data, query, listData);
}, lifetime);
@ -270,37 +270,33 @@ rpl::producer<SparseIdsSlice> SearchController::simpleIdsSlice(
consumer.put_next(builder->snapshot());
};
listData->list.sliceUpdated()
| rpl::filter([=](const SliceUpdate &update) {
listData->list.sliceUpdated(
) | rpl::filter([=](const SliceUpdate &update) {
return builder->applyUpdate(update);
})
| rpl::start_with_next(pushNextSnapshot, lifetime);
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
Auth().data().itemRemoved()
| rpl::filter([=](not_null<const HistoryItem*> item) {
Auth().data().itemRemoved(
) | rpl::filter([=](not_null<const HistoryItem*> item) {
return (item->history()->peer->id == peerId);
})
| rpl::filter([=](not_null<const HistoryItem*> item) {
}) | rpl::filter([=](not_null<const HistoryItem*> item) {
return builder->removeOne(item->id);
})
| rpl::start_with_next(pushNextSnapshot, lifetime);
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
Auth().data().historyCleared()
| rpl::filter([=](not_null<const History*> history) {
Auth().data().historyCleared(
) | rpl::filter([=](not_null<const History*> history) {
return (history->peer->id == peerId);
})
| rpl::filter([=] { return builder->removeAll(); })
| rpl::start_with_next(pushNextSnapshot, lifetime);
}) | rpl::filter([=] {
return builder->removeAll();
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
using Result = Storage::SparseIdsListResult;
listData->list.query(Storage::SparseIdsListQuery(
aroundId,
limitBefore,
limitAfter))
| rpl::filter([=](const Result &result) {
limitAfter
)) | rpl::filter([=](const Result &result) {
return builder->applyInitial(result);
})
| rpl::start_with_next_done(
}) | rpl::start_with_next_done(
pushNextSnapshot,
[=] { builder->checkInsufficient(); },
lifetime);

View File

@ -93,53 +93,47 @@ rpl::producer<SparseIdsSlice> SharedMediaViewer(
data.aroundId,
data.direction);
};
builder->insufficientAround()
| rpl::start_with_next(requestMediaAround, lifetime);
builder->insufficientAround(
) | rpl::start_with_next(requestMediaAround, lifetime);
auto pushNextSnapshot = [=] {
consumer.put_next(builder->snapshot());
};
using SliceUpdate = Storage::SharedMediaSliceUpdate;
Auth().storage().sharedMediaSliceUpdated()
| rpl::filter([=](const SliceUpdate &update) {
Auth().storage().sharedMediaSliceUpdated(
) | rpl::filter([=](const SliceUpdate &update) {
return (update.peerId == key.peerId)
&& (update.type == key.type);
})
| rpl::filter([=](const SliceUpdate &update) {
}) | rpl::filter([=](const SliceUpdate &update) {
return builder->applyUpdate(update.data);
})
| rpl::start_with_next(pushNextSnapshot, lifetime);
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
using OneRemoved = Storage::SharedMediaRemoveOne;
Auth().storage().sharedMediaOneRemoved()
| rpl::filter([=](const OneRemoved &update) {
Auth().storage().sharedMediaOneRemoved(
) | rpl::filter([=](const OneRemoved &update) {
return (update.peerId == key.peerId)
&& update.types.test(key.type);
})
| rpl::filter([=](const OneRemoved &update) {
}) | rpl::filter([=](const OneRemoved &update) {
return builder->removeOne(update.messageId);
})
| rpl::start_with_next(pushNextSnapshot, lifetime);
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
using AllRemoved = Storage::SharedMediaRemoveAll;
Auth().storage().sharedMediaAllRemoved()
| rpl::filter([=](const AllRemoved &update) {
Auth().storage().sharedMediaAllRemoved(
) | rpl::filter([=](const AllRemoved &update) {
return (update.peerId == key.peerId);
})
| rpl::filter([=] { return builder->removeAll(); })
| rpl::start_with_next(pushNextSnapshot, lifetime);
}) | rpl::filter([=] {
return builder->removeAll();
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
using Result = Storage::SharedMediaResult;
Auth().storage().query(
Storage::SharedMediaQuery(
Auth().storage().query(Storage::SharedMediaQuery(
key,
limitBefore,
limitAfter))
| rpl::filter([=](const Result &result) {
limitAfter
)) | rpl::filter([=](const Result &result) {
return builder->applyInitial(result);
})
| rpl::start_with_next_done(
}) | rpl::start_with_next_done(
pushNextSnapshot,
[=] { builder->checkInsufficient(); },
lifetime);
@ -353,8 +347,11 @@ rpl::producer<SharedMediaWithLastSlice> SharedMediaWithLastReversedViewer(
SharedMediaWithLastSlice::Key key,
int limitBefore,
int limitAfter) {
return SharedMediaWithLastViewer(key, limitBefore, limitAfter)
| rpl::map([](SharedMediaWithLastSlice &&slice) {
return SharedMediaWithLastViewer(
key,
limitBefore,
limitAfter
) | rpl::map([](SharedMediaWithLastSlice &&slice) {
slice.reverse();
return std::move(slice);
});

View File

@ -415,8 +415,9 @@ rpl::producer<SparseIdsMergedSlice> SparseIdsMergedSlice::CreateViewer(
limitAfter
);
if (!key.migratedPeerId) {
return std::move(partViewer)
| rpl::start_with_next([=](SparseIdsSlice &&part) {
return std::move(
partViewer
) | rpl::start_with_next([=](SparseIdsSlice &&part) {
consumer.put_next(SparseIdsMergedSlice(
key,
std::move(part),

View File

@ -233,8 +233,8 @@ rpl::producer<UserPhotosSlice> UserPhotosViewer(
Auth().storage().query(Storage::UserPhotosQuery(
key,
limitBefore,
limitAfter))
| rpl::start_with_next_done(
limitAfter
)) | rpl::start_with_next_done(
applyUpdate,
[=] { builder->checkInsufficientPhotos(); },
lifetime);
@ -248,8 +248,11 @@ rpl::producer<UserPhotosSlice> UserPhotosReversedViewer(
UserPhotosSlice::Key key,
int limitBefore,
int limitAfter) {
return UserPhotosViewer(key, limitBefore, limitAfter)
| rpl::map([](UserPhotosSlice &&slice) {
return UserPhotosViewer(
key,
limitBefore,
limitAfter
) | rpl::map([](UserPhotosSlice &&slice) {
slice.reverse();
return std::move(slice);
});

View File

@ -96,12 +96,12 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> contro
_cancelSearchFromUser->hide();
subscribe(Auth().downloaderTaskFinished(), [this] { update(); });
Auth().data().itemRemoved()
| rpl::start_with_next(
Auth().data().itemRemoved(
) | rpl::start_with_next(
[this](auto item) { itemRemoved(item); },
lifetime());
Auth().data().itemRepaintRequest()
| rpl::start_with_next([this](auto item) {
Auth().data().itemRepaintRequest(
) | rpl::start_with_next([this](auto item) {
if (item->history()->lastMsg == item) {
item->history()->updateChatListEntry();
}

View File

@ -220,8 +220,8 @@ InnerWidget::InnerWidget(
, _emptyText(st::historyAdminLogEmptyWidth - st::historyAdminLogEmptyPadding.left() - st::historyAdminLogEmptyPadding.left()) {
setMouseTracking(true);
_scrollDateHideTimer.setCallback([this] { scrollDateHideByTimer(); });
Auth().data().itemRepaintRequest()
| rpl::start_with_next([this](auto item) {
Auth().data().itemRepaintRequest(
) | rpl::start_with_next([this](auto item) {
if (item->isLogEntry() && _history == item->history()) {
repaintItem(item);
}

View File

@ -159,17 +159,16 @@ HistoryInner::HistoryInner(
subscribe(_controller->window()->dragFinished(), [this] {
mouseActionUpdate(QCursor::pos());
});
Auth().data().itemRemoved()
| rpl::start_with_next(
Auth().data().itemRemoved(
) | rpl::start_with_next(
[this](auto item) { itemRemoved(item); },
lifetime());
rpl::merge(
Auth().data().historyUnloaded(),
Auth().data().historyCleared())
| rpl::filter([this](not_null<const History*> history) {
Auth().data().historyCleared()
) | rpl::filter([this](not_null<const History*> history) {
return (_history == history);
})
| rpl::start_with_next([this] {
}) | rpl::start_with_next([this] {
mouseActionCancel();
}, lifetime());
}

View File

@ -77,9 +77,10 @@ HistoryTopBarWidget::HistoryTopBarWidget(
rpl::combine(
_controller->historyPeer.value(),
_controller->searchInPeer.value())
| rpl::combine_previous(std::make_tuple(nullptr, nullptr))
| rpl::map([](
_controller->searchInPeer.value()
) | rpl::combine_previous(
std::make_tuple(nullptr, nullptr)
) | rpl::map([](
const std::tuple<PeerData*, PeerData*> &previous,
const std::tuple<PeerData*, PeerData*> &current) {
auto peer = std::get<0>(current);
@ -88,8 +89,7 @@ HistoryTopBarWidget::HistoryTopBarWidget(
auto searchInPeer
= (peer != nullptr) && (peer == searchPeer);
return std::make_tuple(searchInPeer, peerChanged);
})
| rpl::start_with_next([this](
}) | rpl::start_with_next([this](
bool searchInHistoryPeer,
bool peerChanged) {
auto animated = peerChanged
@ -126,8 +126,8 @@ HistoryTopBarWidget::HistoryTopBarWidget(
rpl::combine(
Auth().data().thirdSectionInfoEnabledValue(),
Auth().data().tabbedReplacedWithInfoValue())
| rpl::start_with_next(
Auth().data().tabbedReplacedWithInfoValue()
) | rpl::start_with_next(
[this] { updateInfoToggleActive(); },
lifetime());

View File

@ -552,12 +552,12 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
connect(&_updateEditTimeLeftDisplay, SIGNAL(timeout()), this, SLOT(updateField()));
subscribe(Adaptive::Changed(), [this] { update(); });
Auth().data().itemRemoved()
| rpl::start_with_next(
Auth().data().itemRemoved(
) | rpl::start_with_next(
[this](auto item) { itemRemoved(item); },
lifetime());
Auth().data().itemRepaintRequest()
| rpl::start_with_next(
Auth().data().itemRepaintRequest(
) | rpl::start_with_next(
[this](auto item) { repaintHistoryItem(item); },
lifetime());
subscribe(Auth().data().contactsLoaded(), [this](bool) {
@ -639,8 +639,8 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
}
}
});
Auth().data().itemLayoutChanged()
| rpl::start_with_next([this](auto item) {
Auth().data().itemLayoutChanged(
) | rpl::start_with_next([this](auto item) {
if (_peer && _list) {
if ((item == App::mousedItem())
|| (item == App::hoveredItem())
@ -649,8 +649,8 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
}
}
}, lifetime());
_topBar->membersShowAreaActive()
| rpl::start_with_next([this](bool active) {
_topBar->membersShowAreaActive(
) | rpl::start_with_next([this](bool active) {
setMembersShowAreaActive(active);
}, _topBar->lifetime());
@ -883,8 +883,8 @@ int HistoryWidget::itemTopForHighlight(not_null<HistoryItem*> item) const {
}
void HistoryWidget::start() {
Auth().data().stickersUpdated()
| rpl::start_with_next([this] {
Auth().data().stickersUpdated(
) | rpl::start_with_next([this] {
_tabbedSelector->refreshStickers();
updateStickersByEmoji();
}, lifetime());

View File

@ -184,8 +184,8 @@ InnerWidget::InnerWidget(
setContent(_list.data());
_listController->setDelegate(static_cast<PeerListDelegate*>(this));
_controller->searchFieldController()->queryValue()
| rpl::start_with_next([this](QString &&query) {
_controller->searchFieldController()->queryValue(
) | rpl::start_with_next([this](QString &&query) {
peerListScrollToTop();
content()->searchQueryChanged(std::move(query));
}, lifetime());
@ -224,8 +224,8 @@ object_ptr<InnerWidget::ListWidget> InnerWidget::setupList(
parent,
controller,
st::infoCommonGroupsList);
result->scrollToRequests()
| rpl::start_with_next([this](Ui::ScrollToRequest request) {
result->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
auto addmin = (request.ymin < 0)
? 0
: st::infoCommonGroupsMargin.top();
@ -237,12 +237,12 @@ object_ptr<InnerWidget::ListWidget> InnerWidget::setupList(
request.ymax + addmax });
}, result->lifetime());
result->moveToLeft(0, st::infoCommonGroupsMargin.top());
parent->widthValue()
| rpl::start_with_next([list = result.data()](int newWidth) {
parent->widthValue(
) | rpl::start_with_next([list = result.data()](int newWidth) {
list->resizeToWidth(newWidth);
}, result->lifetime());
result->heightValue()
| rpl::start_with_next([parent](int listHeight) {
result->heightValue(
) | rpl::start_with_next([parent](int listHeight) {
auto newHeight = st::infoCommonGroupsMargin.top()
+ listHeight
+ st::infoCommonGroupsMargin.bottom();

View File

@ -51,8 +51,8 @@ ContentWidget::ContentWidget(
using namespace rpl::mappers;
setAttribute(Qt::WA_OpaquePaintEvent);
_controller->wrapValue()
| rpl::start_with_next([this](Wrap value) {
_controller->wrapValue(
) | rpl::start_with_next([this](Wrap value) {
if (value != Wrap::Layer) {
applyAdditionalScroll(0);
}
@ -65,13 +65,13 @@ ContentWidget::ContentWidget(
rpl::combine(
_controller->wrapValue(),
_controller->searchEnabledByContent(),
(_1 == Wrap::Layer) && _2)
| rpl::start_with_next([this](bool shown) {
(_1 == Wrap::Layer) && _2
) | rpl::start_with_next([this](bool shown) {
refreshSearchField(shown);
}, lifetime());
}
_scrollTopSkip.changes()
| rpl::start_with_next([this] {
_scrollTopSkip.changes(
) | rpl::start_with_next([this] {
updateControlsGeometry();
}, lifetime());
}
@ -144,8 +144,8 @@ Ui::RpWidget *ContentWidget::doSetInnerWidget(
_scroll->scrollTopValue(),
_scroll->heightValue(),
_innerWrap->entity()->desiredHeightValue(),
tuple(_1, _1 + _2, _3))
| rpl::start_with_next([this](
tuple(_1, _1 + _2, _3)
) | rpl::start_with_next([this](
int top,
int bottom,
int desired) {
@ -190,16 +190,16 @@ rpl::producer<int> ContentWidget::desiredHeightValue() const {
using namespace rpl::mappers;
return rpl::combine(
_innerWrap->entity()->desiredHeightValue(),
_scrollTopSkip.value())
| rpl::map(_1 + _2);
_scrollTopSkip.value()
) | rpl::map(_1 + _2);
}
rpl::producer<bool> ContentWidget::desiredShadowVisibility() const {
using namespace rpl::mappers;
return rpl::combine(
_scroll->scrollTopValue(),
_scrollTopSkip.value())
| rpl::map((_1 > 0) || (_2 > 0));
_scrollTopSkip.value()
) | rpl::map((_1 > 0) || (_2 > 0));
}
bool ContentWidget::hasTopBarShadow() const {
@ -248,8 +248,8 @@ void ContentWidget::refreshSearchField(bool shown) {
_searchField = rowView.field;
const auto view = _searchWrap.get();
widthValue()
| rpl::start_with_next([=](int newWidth) {
widthValue(
) | rpl::start_with_next([=](int newWidth) {
view->resizeToWidth(newWidth);
view->moveToLeft(0, 0);
}, view->lifetime());

View File

@ -93,8 +93,10 @@ void Controller::setupMigrationViewer() {
if (!_peer->isChat() && (!_peer->isChannel() || _migrated != nullptr)) {
return;
}
Notify::PeerUpdateValue(_peer, Notify::PeerUpdate::Flag::MigrationChanged)
| rpl::start_with_next([this] {
Notify::PeerUpdateValue(
_peer,
Notify::PeerUpdate::Flag::MigrationChanged
) | rpl::start_with_next([this] {
if (_peer->migrateTo() || (_peer->migrateFrom() != _migrated)) {
auto window = parentController();
auto peerId = _peer->id;
@ -160,8 +162,8 @@ void Controller::updateSearchControllers(
= std::make_unique<Ui::SearchFieldController>(
searchQuery);
if (_searchController) {
_searchFieldController->queryValue()
| rpl::start_with_next([=](QString &&query) {
_searchFieldController->queryValue(
) | rpl::start_with_next([=](QString &&query) {
_searchController->setQuery(
produceSearchQuery(std::move(query)));
}, _searchFieldController->lifetime());

View File

@ -55,13 +55,14 @@ LayerWidget::LayerWidget(
}
void LayerWidget::setupHeightConsumers() {
_content->scrollTillBottomChanges()
| rpl::filter([this] { return !_inResize; })
| rpl::start_with_next([this] {
_content->scrollTillBottomChanges(
) | rpl::filter([this] {
return !_inResize;
}) | rpl::start_with_next([this] {
resizeToWidth(width());
}, lifetime());
_content->desiredHeightValue()
| rpl::start_with_next([this](int height) {
_content->desiredHeightValue(
) | rpl::start_with_next([this](int height) {
accumulate_max(_desiredHeight, height);
if (_content && !_inResize) {
resizeToWidth(width());

View File

@ -49,8 +49,8 @@ SectionWidget::SectionWidget(
}
void SectionWidget::init() {
sizeValue()
| rpl::start_with_next([wrap = _content.data()](QSize size) {
sizeValue(
) | rpl::start_with_next([wrap = _content.data()](QSize size) {
auto wrapGeometry = QRect{ { 0, 0 }, size };
auto additionalScroll = 0;
wrap->updateGeometry(wrapGeometry, additionalScroll);

View File

@ -158,8 +158,8 @@ Ui::FadeWrap<Ui::RpWidget> *TopBar::pushButton(
weak->toggle(
!selectionMode() && !_searchModeEnabled,
anim::type::instant);
weak->widthValue()
| rpl::start_with_next([this] {
weak->widthValue(
) | rpl::start_with_next([this] {
updateControlsGeometry(width());
}, lifetime());
return weak;
@ -207,9 +207,7 @@ void TopBar::createSearchView(
*focusLifetime = field->shownValue()
| rpl::filter([](bool shown) { return shown; })
| rpl::take(1)
| rpl::start_with_next([=] {
field->setFocus();
});
| rpl::start_with_next([=] { field->setFocus(); });
} else {
focusLifetime->destroy();
}
@ -247,8 +245,8 @@ void TopBar::createSearchView(
cancel->addClickHandler(cancelSearch);
field->connect(field, &Ui::InputField::cancelled, cancelSearch);
wrap->widthValue()
| rpl::start_with_next([=](int newWidth) {
wrap->widthValue(
) | rpl::start_with_next([=](int newWidth) {
auto availableWidth = newWidth
- _st.searchRow.fieldCancelSkip;
fieldWrap->resizeToWidth(availableWidth);
@ -258,8 +256,8 @@ void TopBar::createSearchView(
cancel->moveToRight(0, 0);
}, wrap->lifetime());
widthValue()
| rpl::start_with_next([=](int newWidth) {
widthValue(
) | rpl::start_with_next([=](int newWidth) {
auto left = _back
? _st.back.width
: _st.titlePosition.x();
@ -271,8 +269,8 @@ void TopBar::createSearchView(
newWidth);
}, wrap->lifetime());
field->alive()
| rpl::start_with_done([=] {
field->alive(
) | rpl::start_with_done([=] {
field->setParent(nullptr);
removeButton(search);
clearSearchField();
@ -281,8 +279,9 @@ void TopBar::createSearchView(
_searchModeEnabled = !field->getLastText().isEmpty() || startsFocused;
updateControlsVisibility(anim::type::instant);
std::move(shown)
| rpl::start_with_next([=](bool visible) {
std::move(
shown
) | rpl::start_with_next([=](bool visible) {
auto alreadyInSearch = !field->getLastText().isEmpty();
_searchModeAvailable = visible || alreadyInSearch;
updateControlsVisibility(anim::type::instant);
@ -440,8 +439,8 @@ void TopBar::createSelectionControls() {
object_ptr<Ui::IconButton>(this, _st.mediaCancel),
st::infoTopBarScale));
_cancelSelection->setDuration(st::infoTopBarDuration);
_cancelSelection->entity()->clicks()
| rpl::start_to_stream(
_cancelSelection->entity()->clicks(
) | rpl::start_to_stream(
_cancelSelectionClicks,
_cancelSelection->lifetime());
_selectionText = wrap(Ui::CreateChild<Ui::FadeWrap<Ui::LabelWithNumbers>>(

View File

@ -73,17 +73,18 @@ WrapWidget::WrapWidget(
, _wrap(wrap)
, _controller(createController(window, memento->content()))
, _topShadow(this) {
_topShadow->toggleOn(topShadowToggledValue()
| rpl::filter([](bool shown) {
_topShadow->toggleOn(
topShadowToggledValue(
) | rpl::filter([](bool shown) {
return true;
}));
_wrap.changes()
| rpl::start_with_next([this] {
_wrap.changes(
) | rpl::start_with_next([this] {
setupTop();
finishShowContent();
}, lifetime());
selectedListValue()
| rpl::start_with_next([this](SelectedItems &&items) {
selectedListValue(
) | rpl::start_with_next([this](SelectedItems &&items) {
InvokeQueued(this, [this, items = std::move(items)]() mutable {
if (_topBar) _topBar->setSelectedItems(std::move(items));
});
@ -116,10 +117,12 @@ void WrapWidget::startInjectingActivePeerProfiles() {
using namespace rpl::mappers;
rpl::combine(
_wrap.value(),
_controller->parentController()->activePeer.value())
| rpl::filter((_1 == Wrap::Side) && (_2 != nullptr))
| rpl::map(_2)
| rpl::start_with_next([this](not_null<PeerData*> peer) {
_controller->parentController()->activePeer.value()
) | rpl::filter(
(_1 == Wrap::Side) && (_2 != nullptr)
) | rpl::map(
_2
) | rpl::start_with_next([this](not_null<PeerData*> peer) {
injectActivePeerProfile(peer);
}, lifetime());
@ -190,9 +193,10 @@ not_null<PeerData*> WrapWidget::peer() const {
// _topTabs->setActiveSection(static_cast<int>(_tab));
// _topTabs->finishAnimating();
//
// _topTabs->sectionActivated()
// | rpl::map([](int index) { return static_cast<Tab>(index); })
// | rpl::start_with_next(
// _topTabs->sectionActivated(
// ) | rpl::map([](int index) {
// return static_cast<Tab>(index);
// }) | rpl::start_with_next(
// [this](Tab tab) { showTab(tab); },
// lifetime());
//
@ -310,8 +314,8 @@ void WrapWidget::createTopBar() {
? _topBar->takeSelectedItems()
: SelectedItems(Section::MediaType::kCount);
_topBar.create(this, TopBarStyle(wrapValue), std::move(selectedItems));
_topBar->cancelSelectionRequests()
| rpl::start_with_next([this](auto) {
_topBar->cancelSelectionRequests(
) | rpl::start_with_next([this] {
_content->cancelSelection();
}, _topBar->lifetime());
@ -321,8 +325,8 @@ void WrapWidget::createTopBar() {
!hasStackHistory()));
if (wrapValue == Wrap::Narrow || hasStackHistory()) {
_topBar->enableBackButton();
_topBar->backRequest()
| rpl::start_with_next([this] {
_topBar->backRequest(
) | rpl::start_with_next([this] {
_controller->showBackFromStack();
}, _topBar->lifetime());
} else if (wrapValue == Wrap::Side) {
@ -425,8 +429,9 @@ void WrapWidget::addProfileNotificationsButton() {
: Data::NotifySettings::MuteChange::Mute;
App::main()->updateNotifySettings(peer, muteState);
});
Profile::NotificationsEnabledValue(peer)
| rpl::start_with_next([notifications](bool enabled) {
Profile::NotificationsEnabledValue(
peer
) | rpl::start_with_next([notifications](bool enabled) {
const auto iconOverride = enabled
? &st::infoNotificationsActive
: nullptr;

View File

@ -68,8 +68,9 @@ inline auto AddCountedButton(
using Button = Profile::Button;
auto forked = std::move(count)
| start_spawning(parent->lifetime());
auto text = rpl::duplicate(forked)
| rpl::map([textFromCount](int count) {
auto text = rpl::duplicate(
forked
) | rpl::map([textFromCount](int count) {
return (count > 0)
? textFromCount(count)
: QString();

View File

@ -33,8 +33,9 @@ EmptyWidget::EmptyWidget(QWidget *parent)
}
void EmptyWidget::setFullHeight(rpl::producer<int> fullHeightValue) {
std::move(fullHeightValue)
| rpl::start_with_next([this](int fullHeight) {
std::move(
fullHeightValue
) | rpl::start_with_next([this](int fullHeight) {
// Make icon center be on 1/3 height.
auto iconCenter = fullHeight / 3;
auto iconHeight = st::infoEmptyFile.height();

View File

@ -44,8 +44,8 @@ InnerWidget::InnerWidget(
: RpWidget(parent)
, _controller(controller)
, _empty(this) {
_empty->heightValue()
| rpl::start_with_next(
_empty->heightValue(
) | rpl::start_with_next(
[this] { refreshHeight(); },
_empty->lifetime());
_list = setupList();
@ -63,8 +63,8 @@ void InnerWidget::setupOtherTypes() {
}
//rpl::combine(
// _controller->wrapValue(),
// _controller->searchEnabledByContent())
// | rpl::start_with_next([this](Wrap wrap, bool enabled) {
// _controller->searchEnabledByContent()
//) | rpl::start_with_next([this](Wrap wrap, bool enabled) {
// _searchEnabled = enabled;
// refreshSearchField();
//}, lifetime());
@ -83,8 +83,8 @@ void InnerWidget::createOtherTypes() {
//createTabs();
_otherTypes->resizeToWidth(width());
_otherTypes->heightValue()
| rpl::start_with_next(
_otherTypes->heightValue(
) | rpl::start_with_next(
[this] { refreshHeight(); },
_otherTypes->lifetime());
}
@ -161,9 +161,10 @@ void InnerWidget::createTypeButtons() {
// _otherTabs->setActiveSection(*TypeToTabIndex(type()));
// _otherTabs->finishAnimating();
//
// _otherTabs->sectionActivated()
// | rpl::map([](int index) { return TabIndexToType(index); })
// | rpl::start_with_next(
// _otherTabs->sectionActivated(
// ) | rpl::map([](int index) {
// return TabIndexToType(index);
// }) | rpl::start_with_next(
// [this](Type newType) {
// if (type() != newType) {
// switchToTab(Memento(
@ -233,8 +234,8 @@ bool InnerWidget::showInternal(not_null<Memento*> memento) {
// st::infoMediaSearch);
// _searchField->resizeToWidth(width());
// _searchField->show();
// search->queryChanges()
// | rpl::start_with_next([this] {
// search->queryChanges(
// ) | rpl::start_with_next([this] {
// scrollToSearchField();
// }, _searchField->lifetime());
// } else {
@ -254,26 +255,25 @@ object_ptr<ListWidget> InnerWidget::setupList() {
auto result = object_ptr<ListWidget>(
this,
_controller);
result->heightValue()
| rpl::start_with_next(
result->heightValue(
) | rpl::start_with_next(
[this] { refreshHeight(); },
result->lifetime());
using namespace rpl::mappers;
result->scrollToRequests()
| rpl::map([widget = result.data()](int to) {
result->scrollToRequests(
) | rpl::map([widget = result.data()](int to) {
return Ui::ScrollToRequest {
widget->y() + to,
-1
};
})
| rpl::start_to_stream(
}) | rpl::start_to_stream(
_scrollToRequests,
result->lifetime());
_selectedLists.fire(result->selectedListValue());
_listTops.fire(result->topValue());
_empty->setType(_controller->section().mediaType());
_controller->mediaSourceQueryValue()
| rpl::start_with_next([this](const QString &query) {
_controller->mediaSourceQueryValue(
) | rpl::start_with_next([this](const QString &query) {
_empty->setSearchQuery(query);
}, result->lifetime());
return result;
@ -288,8 +288,9 @@ void InnerWidget::restoreState(not_null<Memento*> memento) {
}
rpl::producer<SelectedItems> InnerWidget::selectedListValue() const {
return _selectedLists.events_starting_with(_list->selectedListValue())
| rpl::flatten_latest();
return _selectedLists.events_starting_with(
_list->selectedListValue()
) | rpl::flatten_latest();
}
void InnerWidget::cancelSelection() {
@ -352,8 +353,9 @@ void InnerWidget::setScrollHeightValue(rpl::producer<int> value) {
using namespace rpl::mappers;
_empty->setFullHeight(rpl::combine(
std::move(value),
_listTops.events_starting_with(_list->topValue())
| rpl::flatten_latest(),
_listTops.events_starting_with(
_list->topValue()
) | rpl::flatten_latest(),
_1 - _2));
}

View File

@ -560,28 +560,30 @@ ListWidget::ListWidget(
void ListWidget::start() {
_controller->setSearchEnabledByContent(false);
ObservableViewer(*Window::Theme::Background())
| rpl::start_with_next([this](const auto &update) {
ObservableViewer(
*Window::Theme::Background()
) | rpl::start_with_next([this](const auto &update) {
if (update.paletteChanged()) {
invalidatePaletteCache();
}
}, lifetime());
ObservableViewer(Auth().downloader().taskFinished())
| rpl::start_with_next([this] { update(); }, lifetime());
Auth().data().itemLayoutChanged()
| rpl::start_with_next([this](auto item) {
ObservableViewer(
Auth().downloader().taskFinished()
) | rpl::start_with_next([this] { update(); }, lifetime());
Auth().data().itemLayoutChanged(
) | rpl::start_with_next([this](auto item) {
itemLayoutChanged(item);
}, lifetime());
Auth().data().itemRemoved()
| rpl::start_with_next([this](auto item) {
Auth().data().itemRemoved(
) | rpl::start_with_next([this](auto item) {
itemRemoved(item);
}, lifetime());
Auth().data().itemRepaintRequest()
| rpl::start_with_next([this](auto item) {
Auth().data().itemRepaintRequest(
) | rpl::start_with_next([this](auto item) {
repaintItem(item);
}, lifetime());
_controller->mediaSourceQueryValue()
| rpl::start_with_next([this]{
_controller->mediaSourceQueryValue(
) | rpl::start_with_next([this]{
restart();
}, lifetime());
}
@ -800,8 +802,8 @@ void ListWidget::refreshViewer() {
_controller->mediaSource(
idForViewer,
_idsLimit,
_idsLimit)
| rpl::start_with_next([=](
_idsLimit
) | rpl::start_with_next([=](
SparseIdsMergedSlice &&slice) {
if (!slice.fullCount()) {
// Don't display anything while full count is unknown.

View File

@ -88,8 +88,8 @@ Widget::Widget(
this,
controller));
_inner->setScrollHeightValue(scrollHeightValue());
_inner->scrollToRequests()
| rpl::start_with_next([this](Ui::ScrollToRequest request) {
_inner->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
scrollTo(request);
}, _inner->lifetime());
}

View File

@ -230,8 +230,9 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
UsernameValue(user),
lang(lng_context_copy_mention));
} else {
auto linkText = LinkValue(_peer)
| rpl::map([](const QString &link) {
auto linkText = LinkValue(
_peer
) | rpl::map([](const QString &link) {
auto result = TextWithEntities{ link, {} };
if (!link.isEmpty()) {
auto remove = qstr("https://");
@ -487,8 +488,8 @@ void ActionsFiller::addBotCommandActions(not_null<UserData*> user) {
auto hasBotCommandValue = [=](const QString &command) {
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::BotCommandsChanged)
| rpl::map([=] {
Notify::PeerUpdate::Flag::BotCommandsChanged
) | rpl::map([=] {
return !findBotCommand(command).isEmpty();
});
};
@ -523,8 +524,8 @@ void ActionsFiller::addReportAction() {
void ActionsFiller::addBlockAction(not_null<UserData*> user) {
auto text = Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::UserIsBlocked)
| rpl::map([user] {
Notify::PeerUpdate::Flag::UserIsBlocked
) | rpl::map([user] {
switch (user->blockStatus()) {
case UserData::BlockStatus::Blocked:
return Lang::Viewer(user->botInfo
@ -536,12 +537,12 @@ void ActionsFiller::addBlockAction(not_null<UserData*> user) {
? lng_profile_block_bot
: lng_profile_block_user);
}
})
| rpl::flatten_latest()
| rpl::start_spawning(_wrap->lifetime());
}) | rpl::flatten_latest(
) | rpl::start_spawning(_wrap->lifetime());
auto toggleOn = rpl::duplicate(text)
| rpl::map([](const QString &text) {
auto toggleOn = rpl::duplicate(
text
) | rpl::map([](const QString &text) {
return !text.isEmpty();
});
auto callback = [user] {
@ -690,8 +691,8 @@ void SetupAddChannelMember(
add->addClickHandler([channel] {
Window::PeerMenuAddChannelMembers(channel);
});
parent->widthValue()
| rpl::start_with_next([add](int newWidth) {
parent->widthValue(
) | rpl::start_with_next([add](int newWidth) {
auto availableWidth = newWidth
- st::infoMembersButtonPosition.x();
add->moveToLeft(
@ -718,8 +719,9 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
channel,
MTPDchannelFull::Flag::f_can_view_participants),
(_1 > 0) && _2);
auto membersText = MembersCountValue(channel)
| rpl::map([](int count) {
auto membersText = MembersCountValue(
channel
) | rpl::map([](int count) {
return lng_chat_status_members(lt_count, count);
});
auto membersCallback = [controller, channel] {

View File

@ -39,8 +39,9 @@ Button::Button(
const style::InfoProfileButton &st)
: RippleButton(parent, st.ripple)
, _st(st) {
std::move(text)
| rpl::start_with_next([this](QString &&value) {
std::move(
text
) | rpl::start_with_next([this](QString &&value) {
setText(std::move(value));
}, lifetime());
}
@ -54,8 +55,9 @@ Button *Button::toggleOn(rpl::producer<bool> &&toggled) {
addClickHandler([this] {
_toggle->setCheckedAnimated(!_toggle->checked());
});
std::move(toggled)
| rpl::start_with_next([this](bool toggled) {
std::move(
toggled
) | rpl::start_with_next([this](bool toggled) {
_toggle->setCheckedAnimated(toggled);
}, lifetime());
_toggle->finishAnimating();

View File

@ -174,12 +174,13 @@ SectionWithToggle *SectionWithToggle::setToggleShown(
_toggle->hide();
_toggle->lower();
_toggle->setCheckAlignment(style::al_right);
widthValue()
| rpl::start_with_next([this](int newValue) {
widthValue(
) | rpl::start_with_next([this](int newValue) {
_toggle->setGeometry(0, 0, newValue, height());
}, _toggle->lifetime());
std::move(shown)
| rpl::start_with_next([this](bool shown) {
std::move(
shown
) | rpl::start_with_next([this](bool shown) {
if (_toggle->isHidden() == shown) {
_toggle->setVisible(shown);
_toggleShown.fire_copy(shown);
@ -203,9 +204,9 @@ bool SectionWithToggle::toggled() const {
rpl::producer<bool> SectionWithToggle::toggledValue() const {
if (_toggle) {
return rpl::single(_toggle->checked())
| rpl::then(
base::ObservableViewer(_toggle->checkedChanged));
return rpl::single(
_toggle->checked()
) | rpl::then(base::ObservableViewer(_toggle->checkedChanged));
}
return rpl::never<bool>();
}
@ -268,12 +269,14 @@ void Cover::setupChildGeometry() {
//rpl::combine(
// toggleShownValue(),
// widthValue(),
// _2)
// _2
//) | rpl::map([](bool shown, int width) {
rpl::combine(
toggleShownValue(),
widthValue())
| rpl::map([](bool shown, int width) { return width; })
| rpl::start_with_next([this](int newWidth) {
widthValue()
) | rpl::map([](bool shown, int width) {
return width;
}) | rpl::start_with_next([this](int newWidth) {
_userpic->moveToLeft(
st::infoProfilePhotoLeft,
st::infoProfilePhotoTop,
@ -284,8 +287,9 @@ void Cover::setupChildGeometry() {
}
Cover *Cover::setOnlineCount(rpl::producer<int> &&count) {
std::move(count)
| rpl::start_with_next([this](int count) {
std::move(
count
) | rpl::start_with_next([this](int count) {
_onlineCount = count;
refreshStatusText();
}, lifetime());
@ -294,24 +298,29 @@ Cover *Cover::setOnlineCount(rpl::producer<int> &&count) {
void Cover::initViewers() {
using Flag = Notify::PeerUpdate::Flag;
Notify::PeerUpdateValue(_peer, Flag::NameChanged)
| rpl::start_with_next(
Notify::PeerUpdateValue(
_peer,
Flag::NameChanged
) | rpl::start_with_next(
[this] { refreshNameText(); },
lifetime());
Notify::PeerUpdateValue(_peer,
Flag::UserOnlineChanged | Flag::MembersChanged)
| rpl::start_with_next(
Notify::PeerUpdateValue(
_peer,
Flag::UserOnlineChanged | Flag::MembersChanged
) | rpl::start_with_next(
[this] { refreshStatusText(); },
lifetime());
if (!_peer->isUser()) {
Notify::PeerUpdateValue(_peer,
Flag::ChannelRightsChanged | Flag::ChatCanEdit)
| rpl::start_with_next(
Notify::PeerUpdateValue(
_peer,
Flag::ChannelRightsChanged | Flag::ChatCanEdit
) | rpl::start_with_next(
[this] { refreshUploadPhotoOverlay(); },
lifetime());
}
VerifiedValue(_peer)
| rpl::start_with_next(
VerifiedValue(
_peer
) | rpl::start_with_next(
[this](bool verified) { setVerified(verified); },
lifetime());
}
@ -335,8 +344,8 @@ void Cover::setVerified(bool verified) {
_verifiedCheck.create(this);
_verifiedCheck->show();
_verifiedCheck->resize(st::infoVerifiedCheck.size());
_verifiedCheck->paintRequest()
| rpl::start_with_next([check = _verifiedCheck.data()] {
_verifiedCheck->paintRequest(
) | rpl::start_with_next([check = _verifiedCheck.data()] {
Painter p(check);
st::infoVerifiedCheck.paint(p, 0, 0, check->width());
}, _verifiedCheck->lifetime());
@ -465,12 +474,14 @@ void SharedMediaCover::createLabel() {
//rpl::combine(
// toggleShownValue(),
// widthValue(),
// _2)
// _2
//) | rpl::map([](bool shown, int width) {
rpl::combine(
toggleShownValue(),
widthValue())
| rpl::map([](bool shown, int width) { return width; })
| rpl::start_with_next([this, weak = label.data()](int newWidth) {
widthValue()
) | rpl::map([](bool shown, int width) {
return width;
}) | rpl::start_with_next([this, weak = label.data()](int newWidth) {
auto availableWidth = newWidth
- st::infoBlockHeaderPosition.x()
- st::infoSharedMediaButton.padding.right()

View File

@ -42,8 +42,8 @@ FloatingIcon::FloatingIcon(
_point.x() + _icon->width(),
_point.y() + _icon->height());
setAttribute(Qt::WA_TransparentForMouseEvents);
parent->widthValue()
| rpl::start_with_next(
parent->widthValue(
) | rpl::start_with_next(
[this] { moveToLeft(0, 0); },
lifetime());
}

View File

@ -66,8 +66,8 @@ InnerWidget::InnerWidget(
, _peer(_controller->peer())
, _migrated(_controller->migrated())
, _content(setupContent(this)) {
_content->heightValue()
| rpl::start_with_next([this](int height) {
_content->heightValue(
) | rpl::start_with_next([this](int height) {
if (!_inResize) {
resizeToWidth(width());
updateDesiredHeight();
@ -122,8 +122,8 @@ object_ptr<Ui::RpWidget> InnerWidget::setupContent(
_controller,
_peer)
);
_members->scrollToRequests()
| rpl::start_with_next([this](Ui::ScrollToRequest request) {
_members->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
auto min = (request.ymin < 0)
? request.ymin
: mapFromGlobal(_members->mapToGlobal({ 0, request.ymin })).y();
@ -198,9 +198,10 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
//rpl::combine(
// tracker.atLeastOneShownValue(),
// _controller->wrapValue(),
// _isStackBottom.value())
// | rpl::combine_previous(ToggledData())
// | rpl::start_with_next([wrap = result.data()](
// _isStackBottom.value()
//) | rpl::combine_previous(
// ToggledData()
//) | rpl::start_with_next([wrap = result.data()](
// const ToggledData &was,
// const ToggledData &now) {
// bool wasOneShown, wasStackBottom, nowOneShown, nowStackBottom;

View File

@ -65,13 +65,14 @@ Members::Members(
setContent(_list.data());
_listController->setDelegate(static_cast<PeerListDelegate*>(this));
_controller->searchFieldController()->queryValue()
| rpl::start_with_next([this](QString &&query) {
_controller->searchFieldController()->queryValue(
) | rpl::start_with_next([this](QString &&query) {
peerListScrollToTop();
content()->searchQueryChanged(std::move(query));
}, lifetime());
MembersCountValue(_peer)
| rpl::start_with_next([this](int count) {
MembersCountValue(
_peer
) | rpl::start_with_next([this](int count) {
const auto enabled = (count >= kEnableSearchMembersAfterCount);
_controller->setSearchEnabledByContent(enabled);
}, lifetime());
@ -159,13 +160,13 @@ void Members::setupHeader() {
setupButtons();
//_controller->wrapValue()
// | rpl::start_with_next([this](Wrap wrap) {
//_controller->wrapValue(
//) | rpl::start_with_next([this](Wrap wrap) {
// _wrap = wrap;
// updateSearchOverrides();
//}, lifetime());
widthValue()
| rpl::start_with_next([this](int width) {
widthValue(
) | rpl::start_with_next([this](int width) {
_header->resizeToWidth(width);
}, _header->lifetime());
}
@ -173,11 +174,11 @@ void Members::setupHeader() {
object_ptr<Ui::FlatLabel> Members::setupTitle() {
auto result = object_ptr<Ui::FlatLabel>(
_titleWrap,
MembersCountValue(_peer)
| rpl::map([](int count) {
MembersCountValue(
_peer
) | rpl::map([](int count) {
return lng_chat_status_members(lt_count, count);
})
| ToUpperValue(),
}) | ToUpperValue(),
st::infoBlockHeaderLabel);
result->setAttribute(Qt::WA_TransparentForMouseEvents);
return result;
@ -214,8 +215,8 @@ void Members::setupButtons() {
rpl::combine(
std::move(addMemberShown),
std::move(searchShown))
| rpl::start_with_next([this] {
std::move(searchShown)
) | rpl::start_with_next([this] {
updateHeaderControlsGeometry(width());
}, lifetime());
}
@ -226,8 +227,8 @@ void Members::setupList() {
this,
_listController.get(),
st::infoMembersList);
_list->scrollToRequests()
| rpl::start_with_next([this](Ui::ScrollToRequest request) {
_list->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
auto addmin = (request.ymin < 0 || !_header)
? 0
: _header->height();
@ -238,12 +239,12 @@ void Members::setupList() {
request.ymin + addmin,
request.ymax + addmax });
}, _list->lifetime());
widthValue()
| rpl::start_with_next([this](int newWidth) {
widthValue(
) | rpl::start_with_next([this](int newWidth) {
_list->resizeToWidth(newWidth);
}, _list->lifetime());
_list->heightValue()
| rpl::start_with_next([=](int listHeight) {
_list->heightValue(
) | rpl::start_with_next([=](int listHeight) {
auto newHeight = (listHeight > st::membersMarginBottom)
? (topSkip
+ listHeight

View File

@ -152,8 +152,10 @@ std::unique_ptr<PeerListState> ChatMembersController::saveState() const {
auto result = PeerListController::saveState();
auto my = std::make_unique<SavedState>();
using Flag = Notify::PeerUpdate::Flag;
Notify::PeerUpdateViewer(_chat, Flag::MembersChanged)
| rpl::start_with_next([state = result.get()](auto update) {
Notify::PeerUpdateViewer(
_chat,
Flag::MembersChanged
) | rpl::start_with_next([state = result.get()](auto update) {
state->controllerState = nullptr;
}, my->lifetime);
result->controllerState = std::move(my);

View File

@ -45,17 +45,16 @@ TextWithLabel CreateTextWithLabel(
st::infoSlideDuration
);
auto layout = result->entity();
auto nonEmptyText = std::move(text)
| rpl::before_next([slide = result.data()](
auto nonEmptyText = std::move(
text
) | rpl::before_next([slide = result.data()](
const TextWithEntities &value) {
if (value.text.isEmpty()) {
slide->hide(anim::type::normal);
}
})
| rpl::filter([](const TextWithEntities &value) {
}) | rpl::filter([](const TextWithEntities &value) {
return !value.text.isEmpty();
})
| rpl::after_next([slide = result.data()](
}) | rpl::after_next([slide = result.data()](
const TextWithEntities &value) {
slide->show(anim::type::normal);
});

View File

@ -37,19 +37,18 @@ rpl::producer<TextWithEntities> PhoneValue(
not_null<UserData*> user) {
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::UserPhoneChanged)
| rpl::map([user] {
Notify::PeerUpdate::Flag::UserPhoneChanged
) | rpl::map([user] {
return App::formatPhone(user->phone());
})
| WithEmptyEntities();
}) | WithEmptyEntities();
}
auto PlainBioValue(
not_null<UserData*> user) {
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::AboutChanged)
| rpl::map([user] { return user->about(); });
Notify::PeerUpdate::Flag::AboutChanged
) | rpl::map([user] { return user->about(); });
}
rpl::producer<TextWithEntities> BioValue(
@ -63,21 +62,21 @@ auto PlainUsernameValue(
not_null<PeerData*> peer) {
return Notify::PeerUpdateValue(
peer,
Notify::PeerUpdate::Flag::UsernameChanged)
| rpl::map([peer] {
Notify::PeerUpdate::Flag::UsernameChanged
) | rpl::map([peer] {
return peer->userName();
});
}
rpl::producer<TextWithEntities> UsernameValue(
not_null<UserData*> user) {
return PlainUsernameValue(user)
| rpl::map([](QString &&username) {
return PlainUsernameValue(
user
) | rpl::map([](QString &&username) {
return username.isEmpty()
? QString()
: ('@' + username);
})
| WithEmptyEntities();
}) | WithEmptyEntities();
}
rpl::producer<QString> PlainAboutValue(
@ -85,8 +84,8 @@ rpl::producer<QString> PlainAboutValue(
if (auto channel = peer->asChannel()) {
return Notify::PeerUpdateValue(
channel,
Notify::PeerUpdate::Flag::AboutChanged)
| rpl::map([channel] { return channel->about(); });
Notify::PeerUpdate::Flag::AboutChanged
) | rpl::map([channel] { return channel->about(); });
} else if (auto user = peer->asUser()) {
if (user->botInfo) {
return PlainBioValue(user);
@ -104,9 +103,10 @@ rpl::producer<TextWithEntities> AboutValue(
if (peer->isUser()) {
flags |= TextParseBotCommands;
}
return PlainAboutValue(peer)
| WithEmptyEntities()
| rpl::map([=](TextWithEntities &&text) {
return PlainAboutValue(
peer
) | WithEmptyEntities(
) | rpl::map([=](TextWithEntities &&text) {
TextUtilities::ParseEntities(text, flags);
return std::move(text);
});
@ -114,8 +114,9 @@ rpl::producer<TextWithEntities> AboutValue(
rpl::producer<QString> LinkValue(
not_null<PeerData*> peer) {
return PlainUsernameValue(peer)
| rpl::map([](QString &&username) {
return PlainUsernameValue(
peer
) | rpl::map([](QString &&username) {
return username.isEmpty()
? QString()
: Messenger::Instance().createInternalLinkFull(username);
@ -126,17 +127,18 @@ rpl::producer<bool> NotificationsEnabledValue(
not_null<PeerData*> peer) {
return Notify::PeerUpdateValue(
peer,
Notify::PeerUpdate::Flag::NotificationsEnabled)
| rpl::map([peer] { return !peer->isMuted(); })
| rpl::distinct_until_changed();
Notify::PeerUpdate::Flag::NotificationsEnabled
) | rpl::map([peer] {
return !peer->isMuted();
}) | rpl::distinct_until_changed();
}
rpl::producer<bool> IsContactValue(
not_null<UserData*> user) {
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::UserIsContact)
| rpl::map([user] { return user->isContact(); });
Notify::PeerUpdate::Flag::UserIsContact
) | rpl::map([user] { return user->isContact(); });
}
rpl::producer<bool> CanInviteBotToGroupValue(
@ -146,8 +148,8 @@ rpl::producer<bool> CanInviteBotToGroupValue(
}
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::BotCanAddToGroups)
| rpl::map([user] {
Notify::PeerUpdate::Flag::BotCanAddToGroups
) | rpl::map([user] {
return !user->botInfo->cantJoinGroups;
});
}
@ -156,8 +158,8 @@ rpl::producer<bool> CanShareContactValue(
not_null<UserData*> user) {
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::UserCanShareContact)
| rpl::map([user] {
Notify::PeerUpdate::Flag::UserCanShareContact
) | rpl::map([user] {
return user->canShareThisContact();
});
}
@ -175,8 +177,8 @@ rpl::producer<bool> AmInChannelValue(
not_null<ChannelData*> channel) {
return Notify::PeerUpdateValue(
channel,
Notify::PeerUpdate::Flag::ChannelAmIn)
| rpl::map([channel] { return channel->amIn(); });
Notify::PeerUpdate::Flag::ChannelAmIn
) | rpl::map([channel] { return channel->amIn(); });
}
rpl::producer<int> MembersCountValue(
@ -184,8 +186,8 @@ rpl::producer<int> MembersCountValue(
if (auto chat = peer->asChat()) {
return Notify::PeerUpdateValue(
peer,
Notify::PeerUpdate::Flag::MembersChanged)
| rpl::map([chat] {
Notify::PeerUpdate::Flag::MembersChanged
) | rpl::map([chat] {
return chat->amIn()
? std::max(chat->count, int(chat->participants.size()))
: 0;
@ -193,8 +195,8 @@ rpl::producer<int> MembersCountValue(
} else if (auto channel = peer->asChannel()) {
return Notify::PeerUpdateValue(
channel,
Notify::PeerUpdate::Flag::MembersChanged)
| rpl::map([channel] {
Notify::PeerUpdate::Flag::MembersChanged
) | rpl::map([channel] {
return channel->membersCount();
});
}
@ -206,8 +208,8 @@ rpl::producer<int> AdminsCountValue(
using Flag = Notify::PeerUpdate::Flag;
return Notify::PeerUpdateValue(
channel,
Flag::AdminsChanged | Flag::ChannelRightsChanged)
| rpl::map([channel] {
Flag::AdminsChanged | Flag::ChannelRightsChanged
) | rpl::map([channel] {
return channel->canViewAdmins()
? channel->adminsCount()
: 0;
@ -219,8 +221,8 @@ rpl::producer<int> RestrictedCountValue(
using Flag = Notify::PeerUpdate::Flag;
return Notify::PeerUpdateValue(
channel,
Flag::BannedUsersChanged | Flag::ChannelRightsChanged)
| rpl::map([channel] {
Flag::BannedUsersChanged | Flag::ChannelRightsChanged
) | rpl::map([channel] {
return channel->canViewBanned()
? channel->restrictedCount()
: 0;
@ -232,8 +234,8 @@ rpl::producer<int> KickedCountValue(
using Flag = Notify::PeerUpdate::Flag;
return Notify::PeerUpdateValue(
channel,
Flag::BannedUsersChanged | Flag::ChannelRightsChanged)
| rpl::map([channel] {
Flag::BannedUsersChanged | Flag::ChannelRightsChanged
) | rpl::map([channel] {
return channel->canViewBanned()
? channel->kickedCount()
: 0;
@ -254,11 +256,10 @@ rpl::producer<int> SharedMediaCountValue(
aroundId),
type),
limit,
limit)
| rpl::map([](const SparseIdsMergedSlice &slice) {
limit
) | rpl::map([](const SparseIdsMergedSlice &slice) {
return slice.fullCount();
})
| rpl::filter_optional();
}) | rpl::filter_optional();
return rpl::single(0) | rpl::then(std::move(updated));
}
@ -266,8 +267,8 @@ rpl::producer<int> CommonGroupsCountValue(
not_null<UserData*> user) {
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::UserCommonChatsChanged)
| rpl::map([user] {
Notify::PeerUpdate::Flag::UserCommonChatsChanged
) | rpl::map([user] {
return user->commonChatsCount();
});
}
@ -277,15 +278,15 @@ rpl::producer<bool> CanAddMemberValue(
if (auto chat = peer->asChat()) {
return Notify::PeerUpdateValue(
chat,
Notify::PeerUpdate::Flag::ChatCanEdit)
| rpl::map([chat] {
Notify::PeerUpdate::Flag::ChatCanEdit
) | rpl::map([chat] {
return chat->canEdit();
});
} else if (auto channel = peer->asChannel()) {
return Notify::PeerUpdateValue(
channel,
Notify::PeerUpdate::Flag::ChannelRightsChanged)
| rpl::map([channel] {
Notify::PeerUpdate::Flag::ChannelRightsChanged
) | rpl::map([channel] {
return channel->canAddMembers();
});
}

View File

@ -69,8 +69,8 @@ Widget::Widget(
this,
controller));
_inner->move(0, 0);
_inner->scrollToRequests()
| rpl::start_with_next([this](Ui::ScrollToRequest request) {
_inner->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
if (request.ymin < 0) {
scrollTopRestore(
qMin(scrollTopSave(), request.ymax));

View File

@ -500,11 +500,11 @@ Instance &Current() {
}
rpl::producer<QString> Viewer(LangKey key) {
return
rpl::single(Current().getValue(key))
| then(
base::ObservableViewer(Current().updated())
| rpl::map([=] {
return rpl::single(
Current().getValue(key)
) | then(base::ObservableViewer(
Current().updated()
) | rpl::map([=] {
return Current().getValue(key);
}));
}

View File

@ -237,8 +237,8 @@ MainWidget::MainWidget(
Auth().data().dialogsWidthRatioChanges()
| rpl::map([] { return rpl::empty_value(); }),
Auth().data().thirdColumnWidthChanges()
| rpl::map([] { return rpl::empty_value(); }))
| rpl::start_with_next(
| rpl::map([] { return rpl::empty_value(); })
) | rpl::start_with_next(
[this] { updateControlsGeometry(); },
lifetime());
subscribe(_controller->floatPlayerAreaUpdated(), [this] {
@ -246,16 +246,14 @@ MainWidget::MainWidget(
});
using namespace rpl::mappers;
_controller->activePeer.value()
| rpl::map([](PeerData *peer) {
_controller->activePeer.value(
) | rpl::map([](PeerData *peer) {
auto canWrite = peer
? Data::CanWriteValue(peer)
: rpl::single(false);
return std::move(canWrite)
| rpl::map(tuple(peer, _1));
})
| rpl::flatten_latest()
| rpl::start_with_next([this](PeerData *peer, bool canWrite) {
return std::move(canWrite) | rpl::map(tuple(peer, _1));
}) | rpl::flatten_latest(
) | rpl::start_with_next([this](PeerData *peer, bool canWrite) {
updateThirdColumnToCurrentPeer(peer, canWrite);
}, lifetime());
@ -1758,8 +1756,8 @@ void MainWidget::createPlayer() {
_player.create(this);
rpl::merge(
_player->heightValue() | rpl::map([] { return true; }),
_player->shownValue())
| rpl::start_with_next(
_player->shownValue()
) | rpl::start_with_next(
[this] { playerHeightUpdated(); },
lifetime());
_player->entity()->setCloseCallback([this] { closeBothPlayers(); });
@ -1819,8 +1817,8 @@ void MainWidget::setCurrentCall(Calls::Call *call) {
void MainWidget::createCallTopBar() {
Expects(_currentCall != nullptr);
_callTopBar.create(this, object_ptr<Calls::TopBar>(this, _currentCall));
_callTopBar->heightValue()
| rpl::start_with_next([this](int value) {
_callTopBar->heightValue(
) | rpl::start_with_next([this](int value) {
callTopBarHeightUpdated(value);
}, lifetime());
orderWidgets();

View File

@ -55,17 +55,16 @@ Float::Float(
prepareShadow();
// #TODO rpl::merge
rpl::merge(
Auth().data().itemLayoutChanged(),
Auth().data().itemRepaintRequest())
| rpl::start_with_next([this](auto item) {
Auth().data().itemRepaintRequest()
) | rpl::start_with_next([this](auto item) {
if (_item == item) {
repaintItem();
}
}, lifetime());
Auth().data().itemRemoved()
| rpl::start_with_next([this](auto item) {
Auth().data().itemRemoved(
) | rpl::start_with_next([this](auto item) {
if (_item == item) {
detach();
}

View File

@ -1008,8 +1008,8 @@ void Messenger::registerLeaveSubscription(QWidget *widget) {
if (auto topLevel = widget->window()) {
if (topLevel == _window.get()) {
auto weak = make_weak(widget);
auto subscription = _window->leaveEvents()
| rpl::start_with_next([weak] {
auto subscription = _window->leaveEvents(
) | rpl::start_with_next([weak] {
if (const auto window = weak.data()) {
QEvent ev(QEvent::Leave);
QGuiApplication::sendEvent(window, &ev);

View File

@ -260,7 +260,9 @@ private:
base::DelayedCallTimer _callDelayedTimer;
struct LeaveSubscription {
LeaveSubscription(QPointer<QWidget> pointer, rpl::lifetime &&subscription)
LeaveSubscription(
QPointer<QWidget> pointer,
rpl::lifetime &&subscription)
: pointer(pointer), subscription(std::move(subscription)) {
}

View File

@ -121,8 +121,9 @@ rpl::producer<PeerUpdate> PeerUpdateViewer(
rpl::producer<PeerUpdate> PeerUpdateViewer(
not_null<PeerData*> peer,
PeerUpdate::Flags flags) {
return PeerUpdateViewer(flags)
| rpl::filter([=](const PeerUpdate &update) {
return PeerUpdateViewer(
flags
) | rpl::filter([=](const PeerUpdate &update) {
return (update.peer == peer);
});
}
@ -132,8 +133,9 @@ rpl::producer<PeerUpdate> PeerUpdateValue(
PeerUpdate::Flags flags) {
auto initial = PeerUpdate(peer);
initial.flags = flags;
return rpl::single(initial)
| rpl::then(PeerUpdateViewer(peer, flags));
return rpl::single(
initial
) | rpl::then(PeerUpdateViewer(peer, flags));
}
} // namespace Notify

View File

@ -80,8 +80,9 @@ void ParticipantsBoxController::setupListChangeViewers() {
if (!_channel->isMegagroup()) {
return;
}
Auth().data().megagroupParticipantAdded(_channel)
| rpl::start_with_next([this](not_null<UserData*> user) {
Auth().data().megagroupParticipantAdded(
_channel
) | rpl::start_with_next([this](not_null<UserData*> user) {
if (delegate()->peerListFullRowsCount() > 0) {
if (delegate()->peerListRowAt(0)->peer() == user) {
return;
@ -97,8 +98,9 @@ void ParticipantsBoxController::setupListChangeViewers() {
sortByOnline();
}
}, lifetime());
Auth().data().megagroupParticipantRemoved(_channel)
| rpl::start_with_next([this](not_null<UserData*> user) {
Auth().data().megagroupParticipantRemoved(
_channel
) | rpl::start_with_next([this](not_null<UserData*> user) {
if (auto row = delegate()->peerListFindRow(user->id)) {
delegate()->peerListRemoveRow(row);
}
@ -270,8 +272,9 @@ std::unique_ptr<PeerListState> ParticipantsBoxController::saveState() const {
if (_channel->isMegagroup()) {
auto weak = result.get();
Auth().data().megagroupParticipantAdded(_channel)
| rpl::start_with_next([weak](not_null<UserData*> user) {
Auth().data().megagroupParticipantAdded(
_channel
) | rpl::start_with_next([weak](not_null<UserData*> user) {
if (!weak->list.empty()) {
if (weak->list[0] == user) {
return;
@ -285,8 +288,9 @@ std::unique_ptr<PeerListState> ParticipantsBoxController::saveState() const {
weak->list,
[user](auto peer) { return (peer == user); });
}, my->lifetime);
Auth().data().megagroupParticipantRemoved(_channel)
| rpl::start_with_next([weak](not_null<UserData*> user) {
Auth().data().megagroupParticipantRemoved(
_channel
) | rpl::start_with_next([weak](not_null<UserData*> user) {
weak->list.erase(std::remove(
weak->list.begin(),
weak->list.end(),

View File

@ -258,7 +258,7 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
{
rpl::lifetime lifetime;
{
rpl::event_stream<int> stream;
event_stream<int> stream;
single(single(1) | then(single(2)))
| then(single(single(3) | then(single(4))))
| then(single(single(5) | then(stream.events())))
@ -291,11 +291,11 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
auto sum = std::make_shared<std::string>("");
{
rpl::lifetime lifetime;
rpl::event_stream<bool> a;
rpl::event_stream<bool> b;
rpl::event_stream<bool> c;
event_stream<bool> a;
event_stream<bool> b;
event_stream<bool> c;
std::vector<rpl::producer<bool>> v;
std::vector<producer<bool>> v;
v.push_back(a.events());
v.push_back(b.events());
v.push_back(c.events());
@ -322,9 +322,9 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
auto sum = std::make_shared<std::string>("");
{
rpl::lifetime lifetime;
rpl::event_stream<int> a;
rpl::event_stream<short> b;
rpl::event_stream<char> c;
event_stream<int> a;
event_stream<short> b;
event_stream<char> c;
combine(
a.events(),
@ -374,9 +374,9 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
auto sum = std::make_shared<std::string>("");
{
rpl::lifetime lifetime;
rpl::event_stream<int> a;
rpl::event_stream<short> b;
rpl::event_stream<char> c;
event_stream<int> a;
event_stream<short> b;
event_stream<char> c;
using namespace mappers;
@ -403,7 +403,7 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
auto sum = std::make_shared<std::string>("");
{
rpl::lifetime lifetime;
rpl::ints(3)
ints(3)
| after_next([=](int value) {
*sum += std::to_string(-value-1);
})
@ -418,7 +418,7 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
auto sum = std::make_shared<std::string>("");
{
rpl::lifetime lifetime;
rpl::ints(10) | take(3)
ints(10) | take(3)
| start_with_next_done([=](int value) {
*sum += std::to_string(value);
}, [=] {
@ -427,7 +427,7 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
}
{
rpl::lifetime lifetime;
rpl::ints(3) | take(3)
ints(3) | take(3)
| start_with_next_done([=](int value) {
*sum += std::to_string(value);
}, [=] {
@ -436,7 +436,7 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
}
{
rpl::lifetime lifetime;
rpl::ints(3) | take(10)
ints(3) | take(10)
| start_with_next_done([=](int value) {
*sum += std::to_string(value);
}, [=] {

View File

@ -31,8 +31,8 @@ BlockWidget::BlockWidget(QWidget *parent, UserData *self, const QString &title)
, _content(this)
, _self(self)
, _title(title) {
_content->heightValue()
| rpl::start_with_next([this](int contentHeight) {
_content->heightValue(
) | rpl::start_with_next([this](int contentHeight) {
resize(
width(),
contentTop()

View File

@ -383,8 +383,8 @@ void CoverWidget::showSetPhotoBox(const QImage &img) {
auto peer = _self;
auto box = Ui::show(Box<PhotoCropBox>(img, peer));
box->ready()
| rpl::start_with_next([=](QImage &&image) {
box->ready(
) | rpl::start_with_next([=](QImage &&image) {
Messenger::Instance().uploadProfilePhoto(
std::move(image),
peer->id);

View File

@ -79,8 +79,8 @@ void InnerWidget::refreshBlocks() {
_cover->show();
}
_blocks->show();
_blocks->heightValue()
| rpl::start_with_next([this](int blocksHeight) {
_blocks->heightValue(
) | rpl::start_with_next([this](int blocksHeight) {
resize(width(), _blocks->y() + blocksHeight);
}, lifetime());
}

View File

@ -71,8 +71,8 @@ void Layer::resizeToWidth(int newWidth, int newContentLeft) {
void Layer::doSetInnerWidget(object_ptr<LayerInner> widget) {
_inner = _scroll->setOwnedWidget(std::move(widget));
_inner->heightValue()
| rpl::start_with_next([this](int innerHeight) {
_inner->heightValue(
) | rpl::start_with_next([this](int innerHeight) {
resizeUsingInnerHeight(width(), innerHeight);
}, lifetime());
}

View File

@ -60,8 +60,8 @@ void ScaleWidget::createControls() {
_scale->addSection(scaleLabel(dbisOneAndHalf));
_scale->addSection(scaleLabel(dbisTwo));
_scale->setActiveSectionFast(cEvalScale(cConfigScale()) - 1);
_scale->sectionActivated()
| rpl::start_with_next(
_scale->sectionActivated(
) | rpl::start_with_next(
[this] { scaleChanged(); },
lifetime());
}

View File

@ -36,14 +36,13 @@ std::map<PeerId, SharedMedia::Lists>::iterator
auto &list = result->second[index];
auto type = static_cast<SharedMediaType>(index);
list.sliceUpdated()
| rpl::map([=](const SparseIdsSliceUpdate &update) {
list.sliceUpdated(
) | rpl::map([=](const SparseIdsSliceUpdate &update) {
return SharedMediaSliceUpdate(
peer,
type,
update);
})
| rpl::start_to_stream(_sliceUpdated, _lifetime);
}) | rpl::start_to_stream(_sliceUpdated, _lifetime);
}
return result;
}

View File

@ -61,7 +61,8 @@ public:
}
template <typename Handler>
void addClickHandler(Handler &&handler) {
clicks() | rpl::start_with_next(
clicks(
) | rpl::start_with_next(
std::forward<Handler>(handler),
lifetime());
}

View File

@ -35,8 +35,8 @@ public:
}
template <typename Callback>
void addMoveLeftCallback(Callback &&callback) {
moveLeft()
| rpl::start_with_next(
moveLeft(
) | rpl::start_with_next(
std::forward<Callback>(callback),
lifetime());
}
@ -46,8 +46,8 @@ public:
}
template <typename Callback>
void addMoveFinishedCallback(Callback &&callback) {
moveFinished()
| rpl::start_with_next(
moveFinished(
) | rpl::start_with_next(
std::forward<Callback>(callback),
lifetime());
}

View File

@ -92,8 +92,9 @@ public:
template <typename Error, typename Generator>
void showOn(rpl::producer<bool, Error, Generator> &&shown) {
std::move(shown)
| rpl::start_with_next([this](bool visible) {
std::move(
shown
) | rpl::start_with_next([this](bool visible) {
callSetVisible(visible);
}, lifetime());
}

View File

@ -53,11 +53,10 @@ auto SearchFieldController::createRowView(
cancel->addClickHandler([=] {
field->setText(QString());
});
queryValue()
| rpl::map([](const QString &value) {
queryValue(
) | rpl::map([](const QString &value) {
return !value.isEmpty();
})
| rpl::start_with_next([cancel](bool shown) {
}) | rpl::start_with_next([cancel](bool shown) {
cancel->toggle(shown, anim::type::normal);
}, cancel->lifetime());
cancel->finishAnimating();
@ -65,8 +64,8 @@ auto SearchFieldController::createRowView(
auto shadow = CreateChild<Ui::PlainShadow>(wrap);
shadow->show();
wrap->widthValue()
| rpl::start_with_next([=, &st](int newWidth) {
wrap->widthValue(
) | rpl::start_with_next([=, &st](int newWidth) {
auto availableWidth = newWidth
- st.fieldIconSkip
- st.fieldCancelSkip;
@ -82,8 +81,8 @@ auto SearchFieldController::createRowView(
newWidth,
st::lineWidth);
}, wrap->lifetime());
wrap->paintRequest()
| rpl::start_with_next([=, &st] {
wrap->paintRequest(
) | rpl::start_with_next([=, &st] {
Painter p(wrap);
st.fieldIcon.paint(
p,

View File

@ -74,8 +74,8 @@ void SuggestPhoto(
auto box = Ui::show(
Box<PhotoCropBox>(image, peerForCrop),
LayerOption::KeepOther);
box->ready()
| rpl::start_with_next(
box->ready(
) | rpl::start_with_next(
std::forward<Callback>(callback),
box->lifetime());
}
@ -498,13 +498,14 @@ void UserpicButton::openPeerPhoto() {
void UserpicButton::setupPeerViewers() {
Notify::PeerUpdateViewer(
_peer,
Notify::PeerUpdate::Flag::PhotoChanged)
| rpl::start_with_next([this] {
Notify::PeerUpdate::Flag::PhotoChanged
) | rpl::start_with_next([this] {
processNewPeerPhoto();
update();
}, lifetime());
base::ObservableViewer(Auth().downloaderTaskFinished())
| rpl::start_with_next([this] {
base::ObservableViewer(
Auth().downloaderTaskFinished()
) | rpl::start_with_next([this] {
if (_waiting && _peer->userpicLoaded()) {
_waiting = false;
startNewPhotoShowing();

View File

@ -171,8 +171,9 @@ FlatLabel::FlatLabel(
, _st(st)
, _contextCopyText(lang(lng_context_copy_text)) {
textUpdated();
std::move(text)
| rpl::start_with_next([this](const QString &value) {
std::move(
text
) | rpl::start_with_next([this](const QString &value) {
setText(value);
}, lifetime());
}
@ -186,8 +187,9 @@ FlatLabel::FlatLabel(
, _st(st)
, _contextCopyText(lang(lng_context_copy_text)) {
textUpdated();
std::move(text)
| rpl::start_with_next([this](const TextWithEntities &value) {
std::move(
text
) | rpl::start_with_next([this](const TextWithEntities &value) {
setMarkedText(value);
}, lifetime());
}

View File

@ -71,8 +71,9 @@ FadeWrap<RpWidget> *FadeWrap<RpWidget>::finishAnimating() {
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggleOn(
rpl::producer<bool> &&shown) {
std::move(shown)
| rpl::start_with_next([this](bool shown) {
std::move(
shown
) | rpl::start_with_next([this](bool shown) {
toggle(shown, anim::type::normal);
}, lifetime());
finishAnimating();

View File

@ -93,8 +93,9 @@ SlideWrap<RpWidget> *SlideWrap<RpWidget>::finishAnimating() {
SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleOn(
rpl::producer<bool> &&shown) {
std::move(shown)
| rpl::start_with_next([this](bool shown) {
std::move(
shown
) | rpl::start_with_next([this](bool shown) {
toggle(shown, anim::type::normal);
}, lifetime());
finishAnimating();

View File

@ -117,8 +117,8 @@ RpWidget *VerticalLayout::addChild(
margin,
width() - margins.left() - margins.right(),
height() - margins.top() - margins.bottom());
weak->heightValue()
| rpl::start_with_next_done([this, weak] {
weak->heightValue(
) | rpl::start_with_next_done([this, weak] {
if (!_inResize) {
childHeightUpdated(weak);
}

View File

@ -121,14 +121,14 @@ Wrap<Widget, RpWidget>::Wrap(
: RpWidget(parent)
, _wrapped(std::move(child)) {
if (_wrapped) {
_wrapped->sizeValue()
| rpl::start_with_next([this](const QSize &value) {
_wrapped->sizeValue(
) | rpl::start_with_next([this](const QSize &value) {
wrappedSizeUpdated(value);
}, lifetime());
AttachParentChild(this, _wrapped);
_wrapped->move(0, 0);
_wrapped->alive()
| rpl::start_with_done([this] {
_wrapped->alive(
) | rpl::start_with_done([this] {
_wrapped->setParent(nullptr);
_wrapped = nullptr;
delete this;

View File

@ -26,8 +26,8 @@ namespace Window {
PlayerWrapWidget::PlayerWrapWidget(QWidget *parent)
: Parent(parent, object_ptr<Media::Player::Widget>(parent)) {
sizeValue()
| rpl::start_with_next([this](const QSize &size) {
sizeValue(
) | rpl::start_with_next([this](const QSize &size) {
updateShadowGeometry(size);
}, lifetime());
}

View File

@ -161,8 +161,8 @@ void Filler::addPinToggle() {
auto lifetime = Notify::PeerUpdateViewer(
peer,
Notify::PeerUpdate::Flag::PinnedChanged)
| rpl::start_with_next([peer, pinAction, pinText] {
Notify::PeerUpdate::Flag::PinnedChanged
) | rpl::start_with_next([peer, pinAction, pinText] {
auto isPinned = App::history(peer)->isPinnedDialog();
pinAction->setText(pinText(isPinned));
});
@ -202,10 +202,11 @@ void Filler::addNotifications() {
auto lifetime = Notify::PeerUpdateViewer(
_peer,
Notify::PeerUpdate::Flag::NotificationsEnabled)
| rpl::map([=] { return peer->isMuted(); })
| rpl::distinct_until_changed()
| rpl::start_with_next([=](bool muted) {
Notify::PeerUpdate::Flag::NotificationsEnabled
) | rpl::map([=] {
return peer->isMuted();
}) | rpl::distinct_until_changed(
) | rpl::start_with_next([=](bool muted) {
muteAction->setText(muteText(muted));
});
@ -248,8 +249,8 @@ void Filler::addBlockUser(not_null<UserData*> user) {
auto lifetime = Notify::PeerUpdateViewer(
_peer,
Notify::PeerUpdate::Flag::UserIsBlocked)
| rpl::start_with_next([=] {
Notify::PeerUpdate::Flag::UserIsBlocked
) | rpl::start_with_next([=] {
blockAction->setText(blockText(user));
});