Renamed rpl::start_with_ with rpl::on_.

This commit is contained in:
23rd
2025-12-10 20:51:57 +03:00
parent 29b714dd5f
commit eca8dfb0ec
623 changed files with 4524 additions and 4524 deletions

View File

@@ -60,7 +60,7 @@ rpl::lifetime &parentLifetime = /* ... get lifetime from context ... */;
To consume values from a producer, you start a pipeline using one of the `rpl::start_...` methods. These methods subscribe to the producer and execute callbacks for the events they handle.
The most common method is `rpl::start_with_next`:
The most common method is `rpl::on_next`:
```cpp
auto counter = /* ... */; // Type: rpl::producer<int>
@@ -69,20 +69,20 @@ rpl::lifetime lifetime;
// Counter is consumed here, use std::move if it's an l-value.
std::move(
counter
) | rpl::start_with_next([=]\(int nextValue) {
) | rpl::on_next([=]\(int nextValue) {
// Process the next integer value emitted by the producer.
qDebug() << "Received: " << nextValue;
}, lifetime); // Pass the lifetime to manage the subscription.
// Note: `counter` is now in a moved-from state and likely invalid.
// If you need to start the same producer multiple times, duplicate it:
// rpl::duplicate(counter) | rpl::start_with_next(...);
// rpl::duplicate(counter) | rpl::on_next(...);
// If you DON'T pass a lifetime to a start_... method:
auto counter2 = /* ... */; // Type: rpl::producer<int>
rpl::lifetime subscriptionLifetime = std::move(
counter2
) | rpl::start_with_next([=]\(int nextValue) { /* ... */ });
) | rpl::on_next([=]\(int nextValue) { /* ... */ });
// The returned lifetime MUST be stored. If it's discarded immediately,
// the subscription stops instantly.
// `counter2` is also moved-from here.
@@ -98,7 +98,7 @@ rpl::lifetime lifetime;
// If it's the only use, std::move(dataStream) would be preferred.
rpl::duplicate(
dataStream
) | rpl::start_with_error([=]\(Error &&error) {
) | rpl::on_error([=]\(Error &&error) {
// Handle the error signaled by the producer.
qDebug() << "Error: " << error.text();
}, lifetime);
@@ -106,7 +106,7 @@ rpl::duplicate(
// Using dataStream again, perhaps duplicated again or moved if last use.
rpl::duplicate(
dataStream
) | rpl::start_with_done([=] {
) | rpl::on_done([=] {
// Execute when the producer signals it's finished emitting values.
qDebug() << "Stream finished.";
}, lifetime);
@@ -114,7 +114,7 @@ rpl::duplicate(
// Last use of dataStream, so we move it.
std::move(
dataStream
) | rpl::start_with_next_error_done(
) | rpl::on_next_error_done(
[=]\(QString &&value) { /* handle next value */ },
[=]\(Error &&error) { /* handle error */ },
[=] { /* handle done */ },
@@ -169,7 +169,7 @@ You can combine multiple producers into one:
// The lambda receives unpacked arguments, not the tuple itself.
std::move(
combined
) | rpl::start_with_next([=]\(int count, const QString &text) {
) | rpl::on_next([=]\(int count, const QString &text) {
// No need for std::get<0>(latest), etc.
qDebug() << "Combined: Count=" << count << ", Text=" << text;
}, lifetime);
@@ -181,7 +181,7 @@ You can combine multiple producers into one:
return count > 0 && !text.isEmpty();
}) | rpl::map([=]\(int count, const QString &text) {
return text.repeated(count);
}) | rpl::start_with_next([=]\(const QString &result) {
}) | rpl::on_next([=]\(const QString &result) {
qDebug() << "Mapped & Filtered: " << result;
}, lifetime);
```
@@ -197,7 +197,7 @@ You can combine multiple producers into one:
// Starting the merged producer consumes it.
std::move(
merged
) | rpl::start_with_next([=]\(QString &&value) {
) | rpl::on_next([=]\(QString &&value) {
// Receives values from either sourceA or sourceB as they arrive.
qDebug() << "Merged value: " << value;
}, lifetime);

View File

@@ -100,7 +100,7 @@ Authorizations::Authorizations(not_null<ApiWrap*> api)
_unreviewed = api->session().settings().unreviewed();
crl::on_main(&api->session(), [=] { removeExpiredUnreviewed(); });
Core::App().settings().deviceModelChanges(
) | rpl::start_with_next([=](const QString &model) {
) | rpl::on_next([=](const QString &model) {
auto changed = false;
for (auto &entry : _list) {
if (!entry.hash) {

View File

@@ -227,7 +227,7 @@ void SendBotCallbackDataWithPassword(
api->cloudPassword().state(
) | rpl::take(
1
) | rpl::start_with_next([=](const Core::CloudPasswordState &state) mutable {
) | rpl::on_next([=](const Core::CloudPasswordState &state) mutable {
if (lifetime) {
base::take(lifetime)->destroy();
}

View File

@@ -174,13 +174,13 @@ void InitFilterLinkHeader(
box->setAddedTopScrollSkip(max);
std::move(
header.wheelEvents
) | rpl::start_with_next([=](not_null<QWheelEvent*> e) {
) | rpl::on_next([=](not_null<QWheelEvent*> e) {
box->sendScrollViewportEvent(e);
}, widget->lifetime());
std::move(
header.closeRequests
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
box->closeBox();
}, widget->lifetime());
@@ -193,7 +193,7 @@ void InitFilterLinkHeader(
box->scrolls(
) | rpl::filter([=] {
return !state->processing;
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
state->processing = true;
const auto guard = gsl::finally([&] { state->processing = false; });
@@ -470,7 +470,7 @@ void ToggleChatsController::adjust(
void ToggleChatsController::setRealContentHeight(rpl::producer<int> value) {
std::move(
value
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
const auto desired = _desiredHeight.current();
if (height <= computeListSt().item.height) {
return;
@@ -644,7 +644,7 @@ void ProcessFilterInvite(
const auto button = owned.data();
box->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
const auto &padding = st::filterInviteBox.buttonPadding;
button->resizeToWidth(width
- padding.left()
@@ -662,7 +662,7 @@ void ProcessFilterInvite(
const auto state = box->lifetime().make_state<State>();
raw->selectedValue(
) | rpl::start_with_next([=](
) | rpl::on_next([=](
base::flat_set<not_null<PeerData*>> &&peers) {
button->setClickedCallback([=] {
if (peers.empty()) {
@@ -777,7 +777,7 @@ void CheckFilterInvite(
if (notLoaded) {
const auto lifetime = std::make_shared<rpl::lifetime>();
owner.chatsFilters().changed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
lifetime->destroy();
ProcessFilterInvite(
weak,
@@ -873,7 +873,7 @@ void ProcessFilterRemove(
const auto button = owned.data();
box->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
const auto &padding = st::filterInviteBox.buttonPadding;
button->resizeToWidth(width
- padding.left()
@@ -886,7 +886,7 @@ void ProcessFilterRemove(
HandleEnterInBox(box);
raw->selectedValue(
) | rpl::start_with_next([=](
) | rpl::on_next([=](
base::flat_set<not_null<PeerData*>> &&peers) {
button->setClickedCallback([=] {
done(peers | ranges::to_vector);

View File

@@ -159,7 +159,7 @@ void ConfirmSubscriptionBox(
state->frame.setDevicePixelRatio(style::DevicePixelRatio());
const auto options = Images::Option::RoundCircle;
userpic->paintRequest(
) | rpl::start_with_next([=, small = Data::PhotoSize::Small] {
) | rpl::on_next([=, small = Data::PhotoSize::Small] {
state->frame.fill(Qt::transparent);
{
auto p = QPainter(&state->frame);
@@ -194,7 +194,7 @@ void ConfirmSubscriptionBox(
state->photoMedia->wanted(Data::PhotoSize::Small, Data::FileOrigin());
if (!state->photoMedia->image(Data::PhotoSize::Small)) {
session->downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
userpic->update();
}, userpic->lifetime());
}
@@ -260,7 +260,7 @@ void ConfirmSubscriptionBox(
rpl::combine(
balance->sizeValue(),
content->sizeValue()
) | rpl::start_with_next([=](const QSize &, const QSize &) {
) | rpl::on_next([=](const QSize &, const QSize &) {
balance->moveToRight(
st::creditsHistoryRightSkip * 2,
st::creditsHistoryRightSkip);
@@ -408,7 +408,7 @@ void CheckChatInvite(
box->boxClosing(
) | rpl::filter([=] {
return !invitePeekChannel->amIn();
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
if (const auto strong = weak.get()) {
strong->clearSectionStack(Window::SectionShow(
Window::SectionShow::Way::ClearStack,
@@ -527,7 +527,7 @@ ConfirmInviteBox::ConfirmInviteBox(
_photo->wanted(Data::PhotoSize::Small, Data::FileOrigin());
if (!_photo->image(Data::PhotoSize::Small)) {
_session->downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
update();
}, lifetime());
}

View File

@@ -95,7 +95,7 @@ void ConfirmPhone::resolve(
codeHandles->fire_copy(code);
});
box->resendRequests(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_api.request(MTPauth_ResendCode(
MTP_flags(0),
MTP_string(phone),
@@ -110,7 +110,7 @@ void ConfirmPhone::resolve(
rpl::merge(
codeHandles->events(),
box->checkRequests()
) | rpl::start_with_next([=](const QString &code) {
) | rpl::on_next([=](const QString &code) {
if (_checkRequestId) {
return;
}
@@ -142,7 +142,7 @@ void ConfirmPhone::resolve(
}).handleFloodErrors().send();
}, box->lifetime());
box->boxClosing(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
controller->session().account().setHandleLoginCode(nullptr);
}, box->lifetime());

View File

@@ -69,7 +69,7 @@ void HandleWithdrawalButton(
state->lifetime = session->api().cloudPassword().state(
) | rpl::take(
1
) | rpl::start_with_next([=](const Core::CloudPasswordState &pass) {
) | rpl::on_next([=](const Core::CloudPasswordState &pass) {
state->loading = false;
auto fields = PasscodeBox::CloudFields::From(pass);

View File

@@ -68,7 +68,7 @@ void GlobalPrivacy::reload(Fn<void()> callback) {
}).send();
_session->appConfig().value(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_showArchiveAndMute = _session->appConfig().get<bool>(
u"autoarchive_setting_available"_q,
false);

View File

@@ -36,7 +36,7 @@ MessagesSearchMerged::MessagesSearchMerged(not_null<History*> history)
};
_apiSearch.messagesFounds(
) | rpl::start_with_next([=](const FoundMessages &data) {
) | rpl::on_next([=](const FoundMessages &data) {
if (data.nextToken == _concatedFound.nextToken) {
addFound(data);
checkFull(data);
@@ -50,7 +50,7 @@ MessagesSearchMerged::MessagesSearchMerged(not_null<History*> history)
if (_migratedSearch) {
_migratedSearch->messagesFounds(
) | rpl::start_with_next([=](const FoundMessages &data) {
) | rpl::on_next([=](const FoundMessages &data) {
if (_isFull) {
addFound(data);
}

View File

@@ -153,7 +153,7 @@ PeerPhoto::PeerPhoto(not_null<ApiWrap*> api)
// You can't use _session->lifetime() in the constructor,
// only queued, because it is not constructed yet.
_session->uploader().photoReady(
) | rpl::start_with_next([=](const Storage::UploadedMedia &data) {
) | rpl::on_next([=](const Storage::UploadedMedia &data) {
ready(data.fullId, data.info.file, std::nullopt);
}, _session->lifetime());
});

View File

@@ -95,7 +95,7 @@ Premium::Premium(not_null<ApiWrap*> api)
// only queued, because it is not constructed yet.
Data::AmPremiumValue(
_session
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
reload();
if (_session->premium()) {
reloadCloudSet();

View File

@@ -66,7 +66,7 @@ Ringtones::Ringtones(not_null<ApiWrap*> api)
// You can't use _session->lifetime() in the constructor,
// only queued, because it is not constructed yet.
_session->uploader().documentReady(
) | rpl::start_with_next([=](const Storage::UploadedMedia &data) {
) | rpl::on_next([=](const Storage::UploadedMedia &data) {
ready(data.fullId, data.info.file);
}, _session->lifetime());
});

View File

@@ -351,7 +351,7 @@ void RequestDeclineComment(
}
};
reason->submits(
) | rpl::start_with_next([=](Qt::KeyboardModifiers modifiers) {
) | rpl::on_next([=](Qt::KeyboardModifiers modifiers) {
if (!(modifiers & Qt::ShiftModifier)) {
(*callback)();
}

View File

@@ -246,12 +246,12 @@ Updates::Updates(not_null<Main::Session*> session)
_ptsWaiter.setRequesting(true);
session->account().mtpUpdates(
) | rpl::start_with_next([=](const MTPUpdates &updates) {
) | rpl::on_next([=](const MTPUpdates &updates) {
mtpUpdateReceived(updates);
}, _lifetime);
session->account().mtpNewSessionCreated(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
mtpNewSessionCreated();
}, _lifetime);
@@ -265,7 +265,7 @@ Updates::Updates(not_null<Main::Session*> session)
Data::PeerUpdate::Flag::FullInfo
) | rpl::filter([](const Data::PeerUpdate &update) {
return update.peer->isChat() || update.peer->isMegagroup();
}) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
}) | rpl::on_next([=](const Data::PeerUpdate &update) {
const auto peer = update.peer;
if (const auto list = _pendingSpeakingCallParticipants.take(peer)) {
if (const auto call = peer->groupCall()) {
@@ -766,7 +766,7 @@ void Updates::addActiveChat(rpl::producer<PeerData*> chat) {
const auto key = _activeChats.empty() ? 0 : _activeChats.back().first + 1;
std::move(
chat
) | rpl::start_with_next_done([=](PeerData *peer) {
) | rpl::on_next_done([=](PeerData *peer) {
auto &active = _activeChats[key];
const auto was = active.peer;
if (was != peer) {

View File

@@ -251,7 +251,7 @@ void Usernames::requestToCache(not_null<PeerData*> peer) {
const auto lifetime = std::make_shared<rpl::lifetime>();
*lifetime = loadUsernames(
peer
) | rpl::start_with_next([=, id = peer->id](Data::Usernames usernames) {
) | rpl::on_next([=, id = peer->id](Data::Usernames usernames) {
_tinyCache = std::make_pair(id, std::move(usernames));
lifetime->destroy();
});

View File

@@ -174,7 +174,7 @@ struct State {
}
session->changes().messageUpdates(
Data::MessageUpdate::Flag::Destroyed
) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
) | rpl::on_next([=](const Data::MessageUpdate &update) {
const auto i = context->cachedRead.find(update.item);
if (i != end(context->cachedRead)) {
session->api().request(i->second.requestId).cancel();
@@ -192,7 +192,7 @@ struct State {
session
) | rpl::skip(1) | rpl::filter(
rpl::mappers::_1
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
for (auto &[item, cache] : context->cachedRead) {
if (cache.data.current().state == Ui::WhoReadState::MyHidden) {
cache.data = Peers{ .state = Ui::WhoReadState::Unknown };
@@ -202,7 +202,7 @@ struct State {
session->api().globalPrivacy().hideReadTime(
) | rpl::skip(1) | rpl::filter(
!rpl::mappers::_1
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
for (auto &[item, cache] : context->cachedRead) {
if (cache.data.current().state == Ui::WhoReadState::MyHidden) {
cache.data = Peers{ .state = Ui::WhoReadState::Unknown };
@@ -590,7 +590,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
}
std::move(
idsWithReactions
) | rpl::start_with_next([=](PeersWithReactions &&peers) {
) | rpl::on_next([=](PeersWithReactions &&peers) {
if (peers.state == WhoReadState::Unknown) {
state->userpics.clear();
consumer.put_next(Ui::WhoReadContent{
@@ -624,7 +624,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
item->history()->session().downloaderTaskFinished(
) | rpl::filter([=] {
return state->someUserpicsNotLoaded && !state->scheduled;
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
for (const auto &userpic : state->userpics) {
if (userpic.peer->userpicUniqueKey(userpic.view)
!= userpic.uniqueKey) {

View File

@@ -199,7 +199,7 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
_session->data().chatsFilters().changed(
) | rpl::filter([=] {
return _session->data().chatsFilters().archiveNeeded();
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
requestMoreDialogsIfNeeded();
}, _session->lifetime());
@@ -248,7 +248,7 @@ void ApiWrap::setupSupportMode() {
}
_session->settings().supportChatsTimeSliceValue(
) | rpl::start_with_next([=](int seconds) {
) | rpl::on_next([=](int seconds) {
_dialogsLoadTill = seconds ? std::max(base::unixtime::now() - seconds, 0) : 0;
refreshDialogsLoadBlocked();
}, _session->lifetime());
@@ -1902,7 +1902,7 @@ void ApiWrap::updateNotifySettingsDelayed(
}
if (_updateNotifyTopics.emplace(topic).second) {
topic->destroyed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_updateNotifyTopics.remove(topic);
}, _updateNotifyQueueLifetime);
_updateNotifyTimer.callOnce(kNotifySettingSaveTimeout);

View File

@@ -186,7 +186,7 @@ void ArchiveHintBox(
owned->setNaturalWidth(rect.width());
const auto widget = box->addRow(std::move(owned), style::al_top);
widget->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = Painter(widget);
auto hq = PainterHighQualityEnabler(p);
p.setPen(Qt::NoPen);
@@ -263,13 +263,13 @@ void ArchiveHintBox(
const auto left = Ui::CreateChild<Ui::RpWidget>(
box->verticalLayout().get());
left->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = Painter(left);
icon.paint(p, 0, 0, left->width());
}, left->lifetime());
left->resize(icon.size());
top->geometryValue(
) | rpl::start_with_next([=](const QRect &g) {
) | rpl::on_next([=](const QRect &g) {
left->moveToLeft(
(g.left() - left->width()) / 2,
g.top() + st::channelEarnHistoryThreeSkip);

View File

@@ -42,7 +42,7 @@ void AboutSponsoredBox(not_null<Ui::GenericBox*> box) {
rpl::combine(
row->sizeValue(),
button->sizeValue()
) | rpl::start_with_next([=](
) | rpl::on_next([=](
const QSize &rowSize,
const QSize &buttonSize) {
button->moveToLeft(

View File

@@ -324,9 +324,9 @@ void AddContactBox::prepare() {
const auto submitted = [=] { submit(); };
_first->submits(
) | rpl::start_with_next(submitted, _first->lifetime());
) | rpl::on_next(submitted, _first->lifetime());
_last->submits(
) | rpl::start_with_next(submitted, _last->lifetime());
) | rpl::on_next(submitted, _last->lifetime());
connect(_phone, &Ui::PhoneInput::submitted, [=] { submit(); });
setDimensions(
@@ -598,13 +598,13 @@ void GroupInfoBox::prepare() {
Core::App().settings().sendSubmitWay());
_description->heightChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
descriptionResized();
}, _description->lifetime());
_description->submits(
) | rpl::start_with_next([=] { submit(); }, _description->lifetime());
) | rpl::on_next([=] { submit(); }, _description->lifetime());
_description->cancelled(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
closeBox();
}, _description->lifetime());
@@ -614,7 +614,7 @@ void GroupInfoBox::prepare() {
&_navigation->session());
}
_title->submits(
) | rpl::start_with_next([=] { submitName(); }, _title->lifetime());
) | rpl::on_next([=] { submitName(); }, _title->lifetime());
addButton(
((_type != Type::Group || _canAddBot)
@@ -920,7 +920,7 @@ void GroupInfoBox::checkInviteLink() {
_createdChannel->session().changes().peerUpdates(
_createdChannel,
Data::PeerUpdate::Flag::FullInfo
) | rpl::take(1) | rpl::start_with_next([=] {
) | rpl::take(1) | rpl::on_next([=] {
checkInviteLink();
}, lifetime());
}
@@ -1063,11 +1063,11 @@ void SetupChannelBox::prepare() {
_channel->session().changes().peerUpdates(
_channel,
Data::PeerUpdate::Flag::InviteLinks
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
rtlupdate(_invitationLink);
}, lifetime());
boxClosing() | rpl::start_with_next([=] {
boxClosing() | rpl::on_next([=] {
if (!_mustBePublic) {
AddParticipantsBoxController::Start(_navigation, _channel);
}
@@ -1495,7 +1495,7 @@ void SetupChannelBox::showRevokePublicLinkBoxForEdit() {
Box(PublicLinksLimitBox, navigation, callback));
const auto session = &navigation->session();
revoker->boxClosing(
) | rpl::start_with_next(crl::guard(session, [=] {
) | rpl::on_next(crl::guard(session, [=] {
base::call_delayed(200, session, [=] {
if (*revoked) {
return;
@@ -1563,19 +1563,19 @@ void EditNameBox::prepare() {
_last->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName);
_first->submits(
) | rpl::start_with_next([=] { submit(); }, _first->lifetime());
) | rpl::on_next([=] { submit(); }, _first->lifetime());
_last->submits(
) | rpl::start_with_next([=] { submit(); }, _last->lifetime());
) | rpl::on_next([=] { submit(); }, _last->lifetime());
_first->customTab(true);
_last->customTab(true);
_first->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_last->setFocus();
}, _first->lifetime());
_last->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_first->setFocus();
}, _last->lifetime());
}

View File

@@ -116,7 +116,7 @@ void AutoDownloadBox::setupContent() {
))->toggleOn(
rpl::single(value > 0)
)->toggledChanges(
) | rpl::start_with_next([=](bool enabled) {
) | rpl::on_next([=](bool enabled) {
(*values)[type] = enabled ? 1 : 0;
}, content->lifetime());
values->emplace(type, value);

View File

@@ -102,7 +102,7 @@ void AutoLockBox::prepare() {
};
timeInput->focuses(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
group->setValue(kCustom);
}, lifetime());
@@ -119,7 +119,7 @@ void AutoLockBox::prepare() {
[=] { return group->current() == kCustom; }
),
timeInput->submitRequests()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (const auto result = collect()) {
durationChanged(result);
} else {

View File

@@ -211,12 +211,12 @@ void BackgroundBox::prepare() {
setInnerTopSkip(st::lineWidth);
_inner->chooseEvents(
) | rpl::start_with_next([=](const Data::WallPaper &paper) {
) | rpl::on_next([=](const Data::WallPaper &paper) {
chosen(paper);
}, _inner->lifetime());
_inner->removeRequests(
) | rpl::start_with_next([=](const Data::WallPaper &paper) {
) | rpl::on_next([=](const Data::WallPaper &paper) {
removePaper(paper);
}, _inner->lifetime());
}
@@ -396,30 +396,30 @@ BackgroundBox::Inner::Inner(
+ st::backgroundPadding));
Window::Theme::IsNightModeValue(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updatePapers();
}, lifetime());
requestPapers();
_session->downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
update();
}, lifetime());
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_check->invalidateCache();
}, lifetime());
if (forChannel()) {
_session->data().cloudThemes().chatThemesUpdated(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updatePapers();
}, lifetime());
} else {
using Update = Window::Theme::BackgroundUpdate;
Window::Theme::Background()->updates(
) | rpl::start_with_next([=](const Update &update) {
) | rpl::on_next([=](const Update &update) {
if (update.type == Update::Type::New) {
sortPapers();
requestPapers();

View File

@@ -225,18 +225,18 @@ BackgroundPreviewBox::BackgroundPreviewBox(
}
generateBackground();
_controller->session().downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
update();
}, lifetime());
_appNightMode.changes(
) | rpl::start_with_next([=](bool night) {
) | rpl::on_next([=](bool night) {
_boxDarkMode = night;
update();
}, lifetime());
_boxDarkMode.changes(
) | rpl::start_with_next([=](bool dark) {
) | rpl::on_next([=](bool dark) {
applyDarkMode(dark);
}, lifetime());
@@ -373,7 +373,7 @@ void BackgroundPreviewBox::createDimmingSlider(bool dark) {
_dimmingContent->resize(inner->size());
_dimmingContent->paintRequest(
) | rpl::start_with_next([=](QRect clip) {
) | rpl::on_next([=](QRect clip) {
auto p = QPainter(_dimmingContent);
const auto palette = (dark ? _darkPalette : _lightPalette).get();
p.fillRect(clip, equals ? st::boxBg : palette->boxBg());
@@ -386,13 +386,13 @@ void BackgroundPreviewBox::createDimmingSlider(bool dark) {
heightValue(),
_dimmingWrap->heightValue(),
rpl::mappers::_1 - rpl::mappers::_2
) | rpl::start_with_next([=](int top) {
) | rpl::on_next([=](int top) {
_dimmingWrap->move(0, top);
}, _dimmingWrap->lifetime());
_dimmingWrap->toggle(dark, anim::type::instant);
_dimmingHeight = _dimmingWrap->heightValue();
_dimmingHeight.changes() | rpl::start_with_next([=] {
_dimmingHeight.changes() | rpl::on_next([=] {
update();
}, _dimmingWrap->lifetime());
}
@@ -554,7 +554,7 @@ void BackgroundPreviewBox::recreateBlurCheckbox() {
sizeValue(),
_blur->sizeValue(),
_dimmingHeight.value()
) | rpl::start_with_next([=](QSize outer, QSize inner, int dimming) {
) | rpl::on_next([=](QSize outer, QSize inner, int dimming) {
const auto bottom = st::historyPaddingBottom;
_blur->move(
(outer.width() - inner.width()) / 2,
@@ -562,7 +562,7 @@ void BackgroundPreviewBox::recreateBlurCheckbox() {
}, _blur->lifetime());
_blur->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
checkBlurAnimationStart();
update();
}, _blur->lifetime());
@@ -607,7 +607,7 @@ void BackgroundPreviewBox::uploadForPeer(bool both) {
document->size);
session->uploader().documentProgress(
) | rpl::start_with_next([=](const FullMsgId &fullId) {
) | rpl::on_next([=](const FullMsgId &fullId) {
if (fullId != _uploadId) {
return;
}
@@ -619,7 +619,7 @@ void BackgroundPreviewBox::uploadForPeer(bool both) {
}, _uploadLifetime);
session->uploader().documentReady(
) | rpl::start_with_next([=](const Storage::UploadedMedia &data) {
) | rpl::on_next([=](const Storage::UploadedMedia &data) {
if (data.fullId != _uploadId) {
return;
}
@@ -742,13 +742,13 @@ void BackgroundPreviewBox::applyForPeer() {
object_ptr<Ui::RpWidget>(this));
const auto overlay = _forBothOverlay->entity();
sizeValue() | rpl::start_with_next([=](QSize size) {
sizeValue() | rpl::on_next([=](QSize size) {
_forBothOverlay->setGeometry({ QPoint(), size });
overlay->setGeometry({ QPoint(), size });
}, _forBothOverlay->lifetime());
overlay->paintRequest(
) | rpl::start_with_next([=](QRect clip) {
) | rpl::on_next([=](QRect clip) {
auto p = QPainter(overlay);
p.drawImage(0, 0, bg);
p.fillRect(clip, QColor(0, 0, 0, 64));
@@ -787,7 +787,7 @@ void BackgroundPreviewBox::applyForPeer() {
const auto raw = _forBothOverlay.release();
raw->shownValue() | rpl::filter(
!rpl::mappers::_1
) | rpl::take(1) | rpl::start_with_next(crl::guard(raw, [=] {
) | rpl::take(1) | rpl::on_next(crl::guard(raw, [=] {
delete raw;
}), raw->lifetime());
raw->toggle(false, anim::type::normal);
@@ -797,7 +797,7 @@ void BackgroundPreviewBox::applyForPeer() {
cancel->setTextTransform(RoundButton::TextTransform::NoTransform);
overlay->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
const auto padding = st::backgroundConfirmPadding;
const auto width = size.width()
- padding.left()
@@ -1063,7 +1063,7 @@ void BackgroundPreviewBox::updateServiceBg(const std::vector<QColor> &bg) {
}
_serviceBgLifetime = _paletteServiceBg.value(
) | rpl::start_with_next([=](QColor color) {
) | rpl::on_next([=](QColor color) {
_serviceBg = Ui::ThemeAdjustedColor(
color,
QColor(red / count, green / count, blue / count));

View File

@@ -345,7 +345,7 @@ void FillChooseFilterMenu(
}
history->owner().chatsFilters().changed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
menu->hideMenu();
}, menu->lifetime());
}

View File

@@ -754,7 +754,7 @@ ProxiesBox::ProxiesBox(
, _settings(settings)
, _initialWrap(this) {
_controller->views(
) | rpl::start_with_next([=](View &&view) {
) | rpl::on_next([=](View &&view) {
applyView(std::move(view));
}, lifetime());
}
@@ -883,17 +883,17 @@ void ProxiesBox::setupContent() {
refreshProxyForCalls();
});
_tryIPv6->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
_controller->setTryIPv6(checked);
}, _tryIPv6->lifetime());
_controller->proxySettingsValue(
) | rpl::start_with_next([=](ProxyData::Settings value) {
) | rpl::on_next([=](ProxyData::Settings value) {
_proxySettings->setValue(value);
}, inner->lifetime());
_proxyForCalls->entity()->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
_controller->setProxyForCalls(checked);
}, _proxyForCalls->lifetime());
@@ -930,7 +930,7 @@ void ProxiesBox::setupContent() {
+ 3 * rowHeight()),
st::boxMaxListHeight);
}) | rpl::distinct_until_changed(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
setDimensions(st::boxWideWidth, height);
}, inner->lifetime());
}
@@ -1005,7 +1005,7 @@ void ProxiesBox::createNoRowsLabel() {
tr::lng_proxy_description(tr::now),
st::proxyEmptyListLabel);
_noRows->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
label->resizeToWidth(width);
label->moveToLeft(0, 0);
}, label->lifetime());
@@ -1013,29 +1013,29 @@ void ProxiesBox::createNoRowsLabel() {
void ProxiesBox::setupButtons(int id, not_null<ProxyRow*> button) {
button->deleteClicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_controller->deleteItem(id);
}, button->lifetime());
button->restoreClicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_controller->restoreItem(id);
}, button->lifetime());
button->editClicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
getDelegate()->show(_controller->editItemBox(id));
}, button->lifetime());
rpl::merge(
button->shareClicks() | rpl::map_to(false),
button->showQrClicks() | rpl::map_to(true)
) | rpl::start_with_next([=](bool qr) {
) | rpl::on_next([=](bool qr) {
_controller->shareItem(id, qr);
}, button->lifetime());
button->clicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_controller->applyItem(id);
}, button->lifetime());
}
@@ -1071,7 +1071,7 @@ void ProxyBox::prepare() {
});
});
_port.data()->events(
) | rpl::start_with_next([=](not_null<QEvent*> e) {
) | rpl::on_next([=](not_null<QEvent*> e) {
if (e->type() == QEvent::KeyPress
&& (static_cast<QKeyEvent*>(e.get())->key() == Qt::Key_Backspace)
&& _port->cursorPosition() == 0) {
@@ -1181,7 +1181,7 @@ void ProxyBox::setupSocketAddress(const ProxyData &data) {
data.port ? QString::number(data.port) : QString(),
65535);
address->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
_port->moveToRight(0, 0);
_host->resize(
width - _port->width() - st::proxyEditSkip,
@@ -1213,11 +1213,11 @@ void ProxyBox::setupCredentials(const ProxyData &data) {
(data.type == Type::Mtproto) ? QString() : data.password);
_password->move(0, 0);
_password->heightValue(
) | rpl::start_with_next([=, wrap = passwordWrap.data()](int height) {
) | rpl::on_next([=, wrap = passwordWrap.data()](int height) {
wrap->resize(wrap->width(), height);
}, _password->lifetime());
passwordWrap->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
_password->resize(width, _password->height());
}, _password->lifetime());
credentials->add(std::move(passwordWrap), st::proxyEditInputPadding);
@@ -1239,11 +1239,11 @@ void ProxyBox::setupMtprotoCredentials(const ProxyData &data) {
(data.type == Type::Mtproto) ? data.password : QString());
_secret->move(0, 0);
_secret->heightValue(
) | rpl::start_with_next([=, wrap = secretWrap.data()](int height) {
) | rpl::on_next([=, wrap = secretWrap.data()](int height) {
wrap->resize(wrap->width(), height);
}, _secret->lifetime());
secretWrap->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
_secret->resize(width, _secret->height());
}, _secret->lifetime());
mtproto->add(std::move(secretWrap), st::proxyEditInputPadding);
@@ -1305,7 +1305,7 @@ ProxiesBoxController::ProxiesBoxController(not_null<Main::Account*> account)
}) | ranges::to_vector;
_settings.connectionTypeChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_proxySettingsChanges.fire_copy(_settings.settings());
const auto i = findByProxy(_settings.selected());
if (i != end(_list)) {

View File

@@ -198,7 +198,7 @@ not_null<Ui::FlatLabel*> CreateWarningLabel(
st::createPollWarning);
result->setAttribute(Qt::WA_TransparentForMouseEvents);
field->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Ui::PostponeCall(crl::guard(field, [=] {
const auto length = field->getLastText().size();
const auto value = valueLimit - length;
@@ -251,17 +251,17 @@ Options::Option::Option(
_wrap->hide(anim::type::instant);
_content->widthValue(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateFieldGeometry();
}, _field->lifetime());
_field->heightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
_content->resize(_content->width(), height);
}, _field->lifetime());
_field->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Ui::PostponeCall(crl::guard(_field, [=] {
if (_hasCorrect) {
_correct->toggle(isGood(), anim::type::normal);
@@ -293,7 +293,7 @@ void Options::Option::createShadow() {
_shadow.reset(Ui::CreateChild<Ui::PlainShadow>(field().get()));
_shadow->show();
field()->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
const auto left = st::createPollFieldPadding.left();
_shadow->setGeometry(
left,
@@ -322,7 +322,7 @@ void Options::Option::createRemove() {
_removeAlways = lifetime.make_state<rpl::variable<bool>>(false);
field->changes(
) | rpl::start_with_next([field, toggle] {
) | rpl::on_next([field, toggle] {
// Don't capture 'this'! Because Option is a value type.
*toggle = !field->getLastText().isEmpty();
}, field->lifetime());
@@ -331,13 +331,13 @@ void Options::Option::createRemove() {
toggle->value(),
_removeAlways->value(),
_1 || _2
) | rpl::start_with_next([=](bool shown) {
) | rpl::on_next([=](bool shown) {
remove->toggle(shown, anim::type::normal);
}, remove->lifetime());
#endif
field->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
remove->moveToRight(
st::createPollOptionRemovePosition.x(),
st::createPollOptionRemovePosition.y(),
@@ -359,7 +359,7 @@ void Options::Option::createWarning() {
rpl::combine(
field->sizeValue(),
warning->sizeValue()
) | rpl::start_with_next([=](QSize size, QSize label) {
) | rpl::on_next([=](QSize size, QSize label) {
warning->moveToLeft(
(size.width()
- label.width()
@@ -431,7 +431,7 @@ void Options::Option::enableChooseCorrect(
button->entity()->height());
button->hide(anim::type::instant);
_content->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
const auto left = st::createPollFieldPadding.left();
button->moveToLeft(
left,
@@ -688,19 +688,19 @@ void Options::addEmptyOption() {
QPoint(
-st::createPollOptionFieldPremium.textMargins.right(),
st::createPollOptionEmojiPositionSkip));
emojiToggle->shownValue() | rpl::start_with_next([=](bool shown) {
emojiToggle->shownValue() | rpl::on_next([=](bool shown) {
if (!shown) {
return;
}
_emojiPanelLifetime.destroy();
emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
if (field->hasFocus()) {
Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji);
}
}, _emojiPanelLifetime);
emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
if (field->hasFocus()) {
Data::InsertCustomEmoji(field, data.document);
}
@@ -708,24 +708,24 @@ void Options::addEmptyOption() {
}, emojiToggle->lifetime());
}
field->submits(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto index = findField(field);
if (_list[index]->isGood() && index + 1 < _list.size()) {
_list[index + 1]->setFocus();
}
}, field->lifetime());
field->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Ui::PostponeCall(crl::guard(field, [=] {
validateState();
}));
}, field->lifetime());
field->focusedChanges(
) | rpl::filter(rpl::mappers::_1) | rpl::start_with_next([=] {
) | rpl::filter(rpl::mappers::_1) | rpl::on_next([=] {
_scrollToWidget.fire_copy(field);
}, field->lifetime());
field->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto index = findField(field);
if (index + 1 < _list.size()) {
_list[index + 1]->setFocus();
@@ -753,7 +753,7 @@ void Options::addEmptyOption() {
});
_list.back()->removeClicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Ui::PostponeCall(crl::guard(field, [=] {
Expects(!_list.empty());
@@ -891,13 +891,13 @@ not_null<Ui::InputField*> CreatePollBox::setupQuestion(
emojiPanel,
st::createPollOptionFieldPremiumEmojiPosition);
emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
if (question->hasFocus()) {
Ui::InsertEmojiAtCursor(question->textCursor(), data.emoji);
}
}, emojiToggle->lifetime());
emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
if (question->hasFocus()) {
Data::InsertCustomEmoji(question, data.document);
}
@@ -912,7 +912,7 @@ not_null<Ui::InputField*> CreatePollBox::setupQuestion(
rpl::combine(
question->geometryValue(),
warning->sizeValue()
) | rpl::start_with_next([=](QRect geometry, QSize label) {
) | rpl::on_next([=](QRect geometry, QSize label) {
warning->moveToLeft(
(container->width()
- label.width()
@@ -978,7 +978,7 @@ not_null<Ui::InputField*> CreatePollBox::setupSolution(
rpl::combine(
solution->geometryValue(),
warning->sizeValue()
) | rpl::start_with_next([=](QRect geometry, QSize label) {
) | rpl::on_next([=](QRect geometry, QSize label) {
warning->moveToLeft(
(inner->width()
- label.width()
@@ -1048,7 +1048,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
st::createPollLimitPadding));
question->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
options->focusFirst();
}, question->lifetime());
@@ -1088,7 +1088,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
rpl::single(quiz->checked()) | rpl::then(quiz->checkedChanges()));
options->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (quiz->checked()) {
solution->setFocus();
} else {
@@ -1097,7 +1097,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
}, question->lifetime());
solution->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
question->setFocus();
}, solution->lifetime());
@@ -1109,14 +1109,14 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
) | rpl::filter([=](not_null<QEvent*> e) {
return (e->type() == QEvent::MouseButtonPress)
&& quiz->checked();
}) | rpl::start_with_next([show = uiShow()] {
}) | rpl::on_next([show = uiShow()] {
show->showToast(tr::lng_polls_create_one_answer(tr::now));
}, multiple->lifetime());
}
using namespace rpl::mappers;
quiz->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
if (multiple) {
if (checked && multiple->checked()) {
multiple->setChecked(false);
@@ -1132,7 +1132,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
return !text.isEmpty() && (text.size() <= kQuestionLimit);
};
question->submits(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (isValidQuestion()) {
options->focusFirst();
}
@@ -1216,12 +1216,12 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
crl::guard(this, send));
options->scrollToWidget(
) | rpl::start_with_next([=](not_null<QWidget*> widget) {
) | rpl::on_next([=](not_null<QWidget*> widget) {
scrollToWidget(widget);
}, lifetime());
options->backspaceInFront(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
FocusAtEnd(question);
}, lifetime());

View File

@@ -164,7 +164,7 @@ void DeleteMessagesBox::prepare() {
appendDetails(std::move(revoke->description));
if (!peer->isUser() && !_wipeHistoryJustClear) {
_revoke->checkedValue(
) | rpl::start_with_next([=](bool revokeForAll) {
) | rpl::on_next([=](bool revokeForAll) {
*deleteText = revokeForAll
? tr::lng_box_delete()
: tr::lng_box_leave();
@@ -251,13 +251,13 @@ void DeleteMessagesBox::prepare() {
st::defaultBoxCheckbox));
_revokeRemember->hide(anim::type::instant);
_revoke->checkedValue(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
_revokeRemember->toggle(
checked != revokeByDefault,
anim::type::normal);
}, _revokeRemember->lifetime());
_revokeRemember->heightValue(
) | rpl::start_with_next([=](int h) {
) | rpl::on_next([=](int h) {
setDimensions(st::boxWidth, _fullHeight + h);
}, lifetime());
appendDetails(std::move(revoke->description));
@@ -320,7 +320,7 @@ void DeleteMessagesBox::prepare() {
rpl::combine(
widthValue(),
_text->naturalWidthValue()
) | rpl::start_with_next([=](int full, int) {
) | rpl::on_next([=](int full, int) {
_text->resizeToNaturalWidth(full - padding.left() - padding.right());
auto fullHeight = st::boxPadding.top()

View File

@@ -143,7 +143,7 @@ auto AddButtonWithLoader(
std::move(
query
) | rpl::start_with_next([=](auto string) {
) | rpl::on_next([=](auto string) {
wrap->toggle(
ranges::any_of(indexList, [&](const QString &s) {
return s.startsWith(string, Qt::CaseInsensitive);
@@ -198,7 +198,7 @@ auto AddButtonWithLoader(
};
Spellchecker::GlobalLoaderChanged(
) | rpl::start_with_next([=](int langId) {
) | rpl::on_next([=](int langId) {
if (!langId && rawGlobalLoaderPtr()) {
setGlobalLoaderPtr(nullptr);
} else if (langId == id) {
@@ -215,14 +215,14 @@ auto AddButtonWithLoader(
rpl::combine(
button->widthValue(),
label->widthValue()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
label->moveToLeft(
st::settingsUpdateStatePosition.x(),
st::settingsUpdateStatePosition.y());
}, label->lifetime());
buttonState->value(
) | rpl::start_with_next([=](const DictState &state) {
) | rpl::on_next([=](const DictState &state) {
const auto isToggledSet = v::is<Active>(state);
const auto toggled = isToggledSet ? 1. : 0.;
const auto over = !button->isDisabled()
@@ -279,7 +279,7 @@ auto AddButtonWithLoader(
});
button->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
const auto &state = buttonState->current();
if (toggled && (v::is<Available>(state) || v::is<Failed>(state))) {
const auto weak = base::make_weak(button);
@@ -353,7 +353,7 @@ void Inner::setupContent(
ranges::contains(enabledDictionaries, id),
queryStream->events());
row->toggledValue(
) | rpl::start_with_next([=](auto enabled) {
) | rpl::on_next([=](auto enabled) {
if (enabled) {
_enabledRows.push_back(id);
} else {
@@ -420,7 +420,7 @@ void ManageDictionariesBox::prepare() {
});
addButton(tr::lng_close(), [=] { closeBox(); });
boxClosing() | rpl::start_with_next([=] {
boxClosing() | rpl::on_next([=] {
Core::App().settings().setDictionariesEnabled(
FilterEnabledDict(initialEnabledRows));
Core::App().saveSettingsDelayed();
@@ -434,7 +434,7 @@ void ManageDictionariesBox::prepare() {
inner->heightValue(),
multiSelect->heightValue(),
_1 + _2
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
using std::min;
accumulate_max(*max, height);
setDimensions(st::boxWidth, min(*max, st::boxMaxListHeight), true);

View File

@@ -262,7 +262,7 @@ EditCaptionBox::EditCaptionBox(
_controller->session().data().itemRemoved(
_historyItem->fullId()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
closeBox();
}, lifetime());
}
@@ -490,7 +490,7 @@ void EditCaptionBox::rebuildPreview() {
const auto withCheckbox = _isPhoto && CanBeCompressed(_albumType);
if (media && (!withCheckbox || !_asFile)) {
media->spoileredChanges(
) | rpl::start_with_next([=](bool spoilered) {
) | rpl::on_next([=](bool spoilered) {
_mediaEditManager.apply({ .type = spoilered
? SendMenu::ActionType::SpoilerOn
: SendMenu::ActionType::SpoilerOff
@@ -512,7 +512,7 @@ void EditCaptionBox::rebuildPreview() {
_footerHeight.value(),
rpl::single(st::boxPhotoPadding.top()),
rpl::mappers::_1 + rpl::mappers::_2 + rpl::mappers::_3
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
setDimensions(
st::boxWideWidth,
std::min(st::sendMediaPreviewHeightMax, height),
@@ -525,11 +525,11 @@ void EditCaptionBox::rebuildPreview() {
_content->modifyRequests(
) | rpl::start_to_stream(_photoEditorOpens, _content->lifetime());
_content->editCoverRequests() | rpl::start_with_next([=] {
_content->editCoverRequests() | rpl::on_next([=] {
setupEditCoverHandler();
}, _content->lifetime());
_content->clearCoverRequests() | rpl::start_with_next([=] {
_content->clearCoverRequests() | rpl::on_next([=] {
setupClearCoverHandler();
}, _content->lifetime());
@@ -566,13 +566,13 @@ void EditCaptionBox::setupField() {
_field->setMaxHeight(st::defaultComposeFiles.caption.heightMax);
_field->submits(
) | rpl::start_with_next([=] { save(); }, _field->lifetime());
) | rpl::on_next([=] { save(); }, _field->lifetime());
_field->cancelled(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
closeBox();
}, _field->lifetime());
_field->heightChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
captionResized();
}, _field->lifetime());
_field->setMimeDataHook([=](
@@ -656,7 +656,7 @@ void EditCaptionBox::setInitialText() {
}
});
_field->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_checkChangedTimer.callOnce(kChangesDebounceTimeout);
setCloseByOutsideClick(false);
}, _field->lifetime());
@@ -696,7 +696,7 @@ void EditCaptionBox::setupControls() {
}),
anim::type::instant
)->entity()->checkedChanges(
) | rpl::start_with_next([&](bool checked) {
) | rpl::on_next([&](bool checked) {
applyChanges();
_asFile = !checked;
rebuildPreview();
@@ -707,7 +707,7 @@ void EditCaptionBox::setupControls() {
void EditCaptionBox::setupEditEventHandler() {
_editMediaClicks.events(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
ChooseReplacement(_controller, _albumType, crl::guard(this, [=](
Ui::PreparedList &&list) {
setPreparedList(std::move(list));
@@ -718,7 +718,7 @@ void EditCaptionBox::setupEditEventHandler() {
void EditCaptionBox::setupPhotoEditorEventHandler() {
const auto openedOnce = lifetime().make_state<bool>(false);
_photoEditorOpens.events(
) | rpl::start_with_next([=, controller = _controller] {
) | rpl::on_next([=, controller = _controller] {
if (_preparedList.files.empty()
&& (!_photoMedia
|| !_photoMedia->image(Data::PhotoSize::Large))) {
@@ -880,11 +880,11 @@ void EditCaptionBox::setupEmojiPanel() {
_emojiPanel->hide();
_emojiPanel->selector()->setCurrentPeer(_historyItem->history()->peer);
_emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
Ui::InsertEmojiAtCursor(_field->textCursor(), data.emoji);
}, lifetime());
_emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
const auto info = data.document->sticker();
if (info
&& info->setType == Data::StickersType::Emoji

View File

@@ -111,11 +111,11 @@ void CreateRadiobuttonLock(
lock->resize(st::defaultRadio.diameter, st::defaultRadio.diameter);
widget->sizeValue(
) | rpl::start_with_next([=, &st](QSize size) {
) | rpl::on_next([=, &st](QSize size) {
lock->move(st.checkPosition);
}, lock->lifetime());
lock->paintRequest() | rpl::start_with_next([=] {
lock->paintRequest() | rpl::on_next([=] {
auto p = QPainter(lock);
auto hq = PainterHighQualityEnabler(p);
const auto &icon = st::messagePrivacyLock;
@@ -138,7 +138,7 @@ void AddPremiumRequiredRow(
const auto row = Ui::CreateChild<Ui::AbstractButton>(widget.get());
widget->sizeValue(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
row->resize(s);
}, row->lifetime());
row->setClickedCallback(std::move(clickedCallback));
@@ -147,7 +147,7 @@ void AddPremiumRequiredRow(
Data::AmPremiumValue(
session
) | rpl::start_with_next([=](bool premium) {
) | rpl::on_next([=](bool premium) {
row->setVisible(!premium);
if (!premium) {
setDefaultOption();
@@ -382,7 +382,7 @@ auto PrivacyExceptionsBoxController::prepareSpecialRowList(
tr::lng_edit_privacy_users_and_groups()));
controller->specialChanges(
) | rpl::start_with_next([=](bool chosen) {
) | rpl::on_next([=](bool chosen) {
if (type == SpecialRowType::Premiums) {
_selected.premiums = chosen;
} else {
@@ -391,7 +391,7 @@ auto PrivacyExceptionsBoxController::prepareSpecialRowList(
}, lifetime);
controller->rowSelectionChanges(
) | rpl::start_with_next([=](RowSelectionChange update) {
) | rpl::on_next([=](RowSelectionChange update) {
this->delegate()->peerListSetForeignRowChecked(
update.row,
update.checked,
@@ -543,7 +543,7 @@ auto PrivacyExceptionsBoxController::createRow(not_null<History*> history)
updateByValue(value);
valueFinished(value);
};
style::PaletteChanged() | rpl::start_with_next([=] {
style::PaletteChanged() | rpl::on_next([=] {
min->setTextColorOverride(st::windowSubTextFg->c);
max->setTextColorOverride(st::windowSubTextFg->c);
}, raw->lifetime());
@@ -559,7 +559,7 @@ auto PrivacyExceptionsBoxController::createRow(not_null<History*> history)
state->indexMin);
slider->resize(slider->width(), sliderStyle->seekSize.height());
raw->widthValue() | rpl::start_with_next([=](int width) {
raw->widthValue() | rpl::on_next([=](int width) {
labels->resizeToWidth(width);
updateByIndex();
}, slider->lifetime());
@@ -939,7 +939,7 @@ void EditPrivacyBox::setupContent() {
+ st::settingsButtonNoIcon.padding.bottom();
widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
content->resizeToWidth(width);
}, content->lifetime());
@@ -947,7 +947,7 @@ void EditPrivacyBox::setupContent() {
) | rpl::map([=](int height) {
return height - always->height() - never->height() + 2 * linkHeight;
}) | rpl::distinct_until_changed(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
setDimensions(st::boxWideWidth, height);
}, content->lifetime());
}
@@ -1076,7 +1076,7 @@ void EditMessagesPrivacyBox(
key
) | rpl::take(
1
) | rpl::start_with_next([=](const Api::UserPrivacy::Rule &value) {
) | rpl::on_next([=](const Api::UserPrivacy::Rule &value) {
EditNoPaidMessagesExceptions(controller, value);
});
});
@@ -1233,7 +1233,7 @@ rpl::producer<int> SetupChargeSlider(
const auto details = container->add(
object_ptr<Ui::VerticalLayout>(container));
state->stars.value() | rpl::start_with_next([=](int stars) {
state->stars.value() | rpl::on_next([=](int stars) {
while (details->count()) {
delete details->widgetAt(0);
}
@@ -1313,7 +1313,7 @@ void EditDirectMessagesPriceBox(
savedValue,
channel->session().appConfig().paidMessageChannelStarsDefault(),
true
) | rpl::start_with_next([=](int stars) {
) | rpl::on_next([=](int stars) {
*result = stars;
}, box->lifetime());
@@ -1358,7 +1358,7 @@ void EditDirectMessagesPriceBox(
label->take(),
st::inviteLinkFieldPadding);
label->clicks() | rpl::start_with_next(copyLink, label->lifetime());
label->clicks() | rpl::on_next(copyLink, label->lifetime());
Ui::AddSkip(inner);

View File

@@ -227,7 +227,7 @@ not_null<Ui::FlatLabel*> CreateWarningLabel(
st::createPollWarning);
result->setAttribute(Qt::WA_TransparentForMouseEvents);
field->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Ui::PostponeCall(crl::guard(field, [=] {
const auto length = field->getLastText().size();
const auto value = valueLimit - length;
@@ -310,12 +310,12 @@ Tasks::Task::Task(
_wrap->hide(anim::type::instant);
_content->widthValue(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateFieldGeometry();
}, _field->lifetime());
_field->heightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
_content->resize(_content->width(), height);
}, _field->lifetime());
@@ -340,7 +340,7 @@ void Tasks::Task::createShadow() {
_shadow.reset(Ui::CreateChild<Ui::PlainShadow>(field().get()));
_shadow->show();
field()->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
const auto left = st::createPollFieldPadding.left();
_shadow->setGeometry(
left,
@@ -369,7 +369,7 @@ void Tasks::Task::createRemove() {
_removeAlways = lifetime.make_state<rpl::variable<bool>>(false);
field->changes(
) | rpl::start_with_next([field, toggle] {
) | rpl::on_next([field, toggle] {
// Don't capture 'this'! Because Option is a value type.
*toggle = !field->getLastText().isEmpty();
}, field->lifetime());
@@ -378,13 +378,13 @@ void Tasks::Task::createRemove() {
toggle->value(),
_removeAlways->value(),
_1 || _2
) | rpl::start_with_next([=](bool shown) {
) | rpl::on_next([=](bool shown) {
remove->toggle(shown, anim::type::normal);
}, remove->lifetime());
#endif
field->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
remove->moveToRight(
st::createPollOptionRemovePosition.x(),
st::createPollOptionRemovePosition.y(),
@@ -406,7 +406,7 @@ void Tasks::Task::createWarning() {
rpl::combine(
field->sizeValue(),
warning->sizeValue()
) | rpl::start_with_next([=](QSize size, QSize label) {
) | rpl::on_next([=](QSize size, QSize label) {
warning->moveToLeft(
(size.width()
- label.width()
@@ -717,19 +717,19 @@ void Tasks::initTaskField(not_null<Task*> task, TextWithEntities text) {
QPoint(
-st::createPollOptionFieldPremium.textMargins.right(),
st::createPollOptionEmojiPositionSkip));
emojiToggle->shownValue() | rpl::start_with_next([=](bool shown) {
emojiToggle->shownValue() | rpl::on_next([=](bool shown) {
if (!shown) {
return;
}
_emojiPanelLifetime.destroy();
emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
if (field->hasFocus()) {
Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji);
}
}, _emojiPanelLifetime);
emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
if (field->hasFocus()) {
Data::InsertCustomEmoji(field, data.document);
}
@@ -741,14 +741,14 @@ void Tasks::initTaskField(not_null<Task*> task, TextWithEntities text) {
TextUtilities::ConvertEntitiesToTextTags(text.entities)
});
field->submits(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto index = findField(field);
if (_list[index]->isGood() && index + 1 < _list.size()) {
_list[index + 1]->setFocus();
}
}, field->lifetime());
field->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto list = ParsePastedList(field->getLastText());
if (!list.empty()) {
field->setText(list.front());
@@ -762,11 +762,11 @@ void Tasks::initTaskField(not_null<Task*> task, TextWithEntities text) {
}));
}, field->lifetime());
field->focusedChanges(
) | rpl::filter(rpl::mappers::_1) | rpl::start_with_next([=] {
) | rpl::filter(rpl::mappers::_1) | rpl::on_next([=] {
_scrollToWidget.fire_copy(field);
}, field->lifetime());
field->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto index = findField(field);
if (index + 1 < _list.size()) {
_list[index + 1]->setFocus();
@@ -794,7 +794,7 @@ void Tasks::initTaskField(not_null<Task*> task, TextWithEntities text) {
});
task->removeClicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Ui::PostponeCall(crl::guard(field, [=] {
Expects(!_list.empty());
@@ -895,7 +895,7 @@ EditTodoListBox::EditTodoListBox(
, _titleLimit(controller->session().appConfig().todoListTitleLimit()) {
_controller->session().changes().messageUpdates(
Data::MessageUpdate::Flag::Destroyed
) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
) | rpl::on_next([=](const Data::MessageUpdate &update) {
if (update.item == item) {
closeBox();
}
@@ -946,13 +946,13 @@ not_null<Ui::InputField*> EditTodoListBox::setupTitle(
_emojiPanel.get(),
st::createPollOptionFieldPremiumEmojiPosition);
_emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
if (title->hasFocus()) {
Ui::InsertEmojiAtCursor(title->textCursor(), data.emoji);
}
}, emojiToggle->lifetime());
_emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
if (title->hasFocus()) {
Data::InsertCustomEmoji(title, data.document);
}
@@ -976,7 +976,7 @@ not_null<Ui::InputField*> EditTodoListBox::setupTitle(
rpl::combine(
title->geometryValue(),
warning->sizeValue()
) | rpl::start_with_next([=](QRect geometry, QSize label) {
) | rpl::on_next([=](QRect geometry, QSize label) {
warning->moveToLeft(
(container->width()
- label.width()
@@ -1044,7 +1044,7 @@ object_ptr<Ui::RpWidget> EditTodoListBox::setupContent() {
st::createPollLimitPadding));
title->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
tasks->focusFirst();
}, title->lifetime());
@@ -1067,7 +1067,7 @@ object_ptr<Ui::RpWidget> EditTodoListBox::setupContent() {
st::createPollCheckboxMargin);
tasks->tabbed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
title->setFocus();
}, title->lifetime());
@@ -1076,7 +1076,7 @@ object_ptr<Ui::RpWidget> EditTodoListBox::setupContent() {
return !text.isEmpty() && (text.size() <= _titleLimit);
};
title->submits(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (isValidTitle()) {
tasks->focusFirst();
}
@@ -1146,12 +1146,12 @@ object_ptr<Ui::RpWidget> EditTodoListBox::setupContent() {
crl::guard(this, send));
tasks->scrollToWidget(
) | rpl::start_with_next([=](not_null<QWidget*> widget) {
) | rpl::on_next([=](not_null<QWidget*> widget) {
scrollToWidget(widget);
}, lifetime());
tasks->backspaceInFront(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
FocusAtEnd(title);
}, lifetime());
@@ -1201,7 +1201,7 @@ AddTodoListTasksBox::AddTodoListTasksBox(
, _item(item) {
_controller->session().changes().messageUpdates(
Data::MessageUpdate::Flag::Destroyed
) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
) | rpl::on_next([=](const Data::MessageUpdate &update) {
if (update.item == item) {
closeBox();
}
@@ -1266,7 +1266,7 @@ object_ptr<Ui::RpWidget> AddTodoListTasksBox::setupContent() {
};
tasks->scrollToWidget(
) | rpl::start_with_next([=](not_null<QWidget*> widget) {
) | rpl::on_next([=](not_null<QWidget*> widget) {
scrollToWidget(widget);
}, lifetime());

View File

@@ -94,7 +94,7 @@ not_null<FilterChatsPreview*> SetupChatsPreview(
(rules.*peers)()));
preview->flagRemoved(
) | rpl::start_with_next([=](Flag flag) {
) | rpl::on_next([=](Flag flag) {
const auto rules = data->current();
auto computed = Data::ChatFilter(
rules.id(),
@@ -110,7 +110,7 @@ not_null<FilterChatsPreview*> SetupChatsPreview(
}, preview->lifetime());
preview->peerRemoved(
) | rpl::start_with_next([=](not_null<History*> history) {
) | rpl::on_next([=](not_null<History*> history) {
const auto rules = data->current();
auto always = rules.always();
auto pinned = rules.pinned();
@@ -220,13 +220,13 @@ void CreateIconSelector(
data->value(
) | rpl::map([=](const Data::ChatFilter &filter) {
return Ui::ComputeFilterIcon(filter);
}) | rpl::start_with_next([=](Ui::FilterIcon icon) {
}) | rpl::on_next([=](Ui::FilterIcon icon) {
*type = icon;
toggle->update();
}, toggle->lifetime());
input->geometryValue(
) | rpl::start_with_next([=](QRect geometry) {
) | rpl::on_next([=](QRect geometry) {
const auto left = geometry.x() + geometry.width() - toggle->width();
const auto position = st::windowFilterIconTogglePosition;
toggle->move(
@@ -235,7 +235,7 @@ void CreateIconSelector(
}, toggle->lifetime());
toggle->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(toggle);
const auto icons = Ui::LookupFilterIcon(*type);
icons.normal->paintInCenter(
@@ -253,7 +253,7 @@ void CreateIconSelector(
panel->chosen(
) | rpl::filter([=](Ui::FilterIcon icon) {
return icon != Ui::ComputeFilterIcon(data->current());
}) | rpl::start_with_next([=](Ui::FilterIcon icon) {
}) | rpl::on_next([=](Ui::FilterIcon icon) {
panel->hideAnimated();
const auto rules = data->current();
*data = Data::ChatFilter(
@@ -382,7 +382,7 @@ void EditFilterBox(
});
state->hasLinks.value() | rpl::filter(
_1
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
state->chatlist = true;
}, box->lifetime());
@@ -391,7 +391,7 @@ void EditFilterBox(
owner->chatsFilters().isChatlistChanged(
) | rpl::filter([=](FilterId id) {
return (id == data->current().id());
}) | rpl::start_with_next([=](FilterId id) {
}) | rpl::on_next([=](FilterId id) {
const auto filters = &owner->chatsFilters();
const auto &list = filters->list();
const auto i = ranges::find(list, id, &Data::ChatFilter::id);
@@ -414,7 +414,7 @@ void EditFilterBox(
const auto session = &window->session();
Data::AmPremiumValue(
session
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
@@ -458,7 +458,7 @@ void EditFilterBox(
staticTitle->setClickedCallback([=] {
state->staticTitle = !state->staticTitle.current();
});
state->staticTitle.value() | rpl::start_with_next([=](bool value) {
state->staticTitle.value() | rpl::on_next([=](bool value) {
staticTitle->setText(value
? tr::lng_filters_enable_animations(tr::now)
: tr::lng_filters_disable_animations(tr::now));
@@ -480,7 +480,7 @@ void EditFilterBox(
rpl::combine(
staticTitle->widthValue(),
name->widthValue()
) | rpl::start_with_next([=](int inner, int outer) {
) | rpl::on_next([=](int inner, int outer) {
staticTitle->moveToRight(
st::windowFilterStaticTitlePosition.x(),
st::windowFilterStaticTitlePosition.y(),
@@ -488,7 +488,7 @@ void EditFilterBox(
}, staticTitle->lifetime());
state->creating.value(
) | rpl::filter(!_1) | rpl::start_with_next([=] {
) | rpl::filter(!_1) | rpl::on_next([=] {
nameEditing->custom = true;
}, box->lifetime());
@@ -508,11 +508,11 @@ void EditFilterBox(
state->emojiPanel->hide();
state->emojiPanel->selector()->setCurrentPeer(window->session().user());
state->emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
Ui::InsertEmojiAtCursor(name->textCursor(), data.emoji);
}, name->lifetime());
state->emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
const auto info = data.document->sticker();
if (info
&& info->setType == Data::StickersType::Emoji
@@ -534,7 +534,7 @@ void EditFilterBox(
emojiButton->show();
name->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (!nameEditing->settingDefault) {
nameEditing->custom = true;
}
@@ -558,7 +558,7 @@ void EditFilterBox(
};
state->title.value(
) | rpl::start_with_next([=](const TextWithEntities &value) {
) | rpl::on_next([=](const TextWithEntities &value) {
staticTitle->setVisible(!value.entities.isEmpty());
}, staticTitle->lifetime());
@@ -666,7 +666,7 @@ void EditFilterBox(
rpl::combine(
title->sizeValue(),
titleWrap->widthValue()
) | rpl::start_with_next([=](const QSize &s, int w) {
) | rpl::on_next([=](const QSize &s, int w) {
const auto h = st::normalFont->height;
const auto left = padding.left()
+ s.width()
@@ -687,7 +687,7 @@ void EditFilterBox(
const auto tag = preview->lifetime().make_state<TagState>();
tag->context.textContext = Core::TextContext({ .session = session });
const auto shift = st::settingsFilterTagPreviewSkip / 2;
preview->paintRequest() | rpl::start_with_next([=] {
preview->paintRequest() | rpl::on_next([=] {
auto p = QPainter(preview);
p.setOpacity(tag->alpha);
const auto size = tag->frame.size() / style::DevicePixelRatio();
@@ -725,7 +725,7 @@ void EditFilterBox(
return value;
};
state->title.changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
tag->context.color = palette(state->colorIndex.current())->c;
tag->frame = Ui::ChatsFilterTag(
upperTitle(),
@@ -785,7 +785,7 @@ void EditFilterBox(
});
}
}
line->sizeValue() | rpl::start_with_next([=](const QSize &size) {
line->sizeValue() | rpl::on_next([=](const QSize &size) {
const auto totalWidth = buttons.size() * side;
const auto spacing = (size.width() - totalWidth)
/ (buttons.size() - 1);
@@ -799,7 +799,7 @@ void EditFilterBox(
const auto last = buttons.back();
const auto icon = Ui::CreateChild<Ui::RpWidget>(last);
icon->resize(side, side);
icon->paintRequest() | rpl::start_with_next([=] {
icon->paintRequest() | rpl::on_next([=] {
auto p = QPainter(icon);
(session->premium()
? st::windowFilterSmallRemove.icon
@@ -853,7 +853,7 @@ void EditFilterBox(
tr::lng_filters_link_has(),
tr::lng_filters_link()));
state->hasLinks.changes() | rpl::start_with_next([=] {
state->hasLinks.changes() | rpl::on_next([=] {
content->resizeToWidth(content->widthNoMargins());
}, content->lifetime());
@@ -886,7 +886,7 @@ void EditFilterBox(
addLink->clicks()
) | rpl::filter(
(rpl::mappers::_1 == Qt::LeftButton)
) | rpl::start_with_next([=](Qt::MouseButton button) {
) | rpl::on_next([=](Qt::MouseButton button) {
const auto result = collect();
if (!result || !GoodForExportFilterLink(window, *result)) {
return;

View File

@@ -384,7 +384,7 @@ object_ptr<Ui::RpWidget> CreatePeerListSectionSubtitle(
const auto raw = result.data();
raw->paintRequest(
) | rpl::start_with_next([=](QRect clip) {
) | rpl::on_next([=](QRect clip) {
auto p = QPainter(raw);
p.fillRect(clip, st::searchedBarBg);
}, raw->lifetime());
@@ -394,7 +394,7 @@ object_ptr<Ui::RpWidget> CreatePeerListSectionSubtitle(
std::move(text),
st::windowFilterChatsSectionSubtitle);
raw->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
const auto padding = st::windowFilterChatsSectionSubtitlePadding;
const auto available = width - padding.left() - padding.right();
label->resizeToNaturalWidth(available);
@@ -533,12 +533,12 @@ object_ptr<Ui::RpWidget> EditFilterChatsListController::prepareTypesList() {
tr::lng_filters_edit_chats()));
controller->selectedChanges(
) | rpl::start_with_next([=](Flags selected) {
) | rpl::on_next([=](Flags selected) {
_selected = selected;
}, _lifetime);
controller->rowSelectionChanges(
) | rpl::start_with_next([=](RowSelectionChange update) {
) | rpl::on_next([=](RowSelectionChange update) {
this->delegate()->peerListSetForeignRowChecked(
update.row,
update.checked,

View File

@@ -531,7 +531,7 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
},
st::settingsFilterIconPadding);
_showFinished.events(
) | rpl::start_with_next([animate = std::move(icon.animate)] {
) | rpl::on_next([animate = std::move(icon.animate)] {
animate(anim::repeat::once);
}, verticalLayout->lifetime());
verticalLayout->add(std::move(icon.widget));
@@ -558,7 +558,7 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
style::al_top)->setTryMakeSimilarLines(true);
verticalLayout->geometryValue(
) | rpl::start_with_next([=](const QRect &r) {
) | rpl::on_next([=](const QRect &r) {
divider->setGeometry(r);
}, divider->lifetime());
}
@@ -647,7 +647,7 @@ void LinkController::addLinkBlock(not_null<Ui::VerticalLayout*> container) {
st::inviteLinkFieldPadding);
label->clicks(
) | rpl::start_with_next(copyLink, label->lifetime());
) | rpl::on_next(copyLink, label->lifetime());
AddCopyShareLinkButtons(container, copyLink, shareLink);
@@ -785,7 +785,7 @@ void LinkController::setupAboveWidget() {
[=](bool select) { toggleAllSelected(select); });
// Fix label cutting on text change from smaller to longer.
_selected.changes() | rpl::start_with_next([=] {
_selected.changes() | rpl::on_next([=] {
container->resizeToWidth(container->widthNoMargins());
}, container->lifetime());
@@ -825,7 +825,7 @@ LinksController::LinksController(
, _currentFilter(std::move(currentFilter))
, _rows(std::move(content)) {
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
for (auto &image : _icons) {
image = QImage();
}
@@ -834,7 +834,7 @@ LinksController::LinksController(
void LinksController::prepare() {
_rows.value(
) | rpl::start_with_next([=](const std::vector<InviteLinkData> &rows) {
) | rpl::on_next([=](const std::vector<InviteLinkData> &rows) {
rebuild(rows);
}, _lifetime);
}
@@ -1078,7 +1078,7 @@ object_ptr<Ui::BoxContent> ShowLinkBox(
const auto saving = std::make_shared<bool>(false);
raw->hasChangesValue(
) | rpl::start_with_next([=](bool has) {
) | rpl::on_next([=](bool has) {
box->setCloseByOutsideClick(!has);
box->setCloseByEscape(!has);
box->clearButtons();
@@ -1182,7 +1182,7 @@ void AddFilterSubtitleWithToggles(
const auto canSelect = link->lifetime().make_state<rpl::variable<bool>>(
std::move(selectedCount) | rpl::map(_1 < selectableCount));
canSelect->value(
) | rpl::start_with_next([=](bool can) {
) | rpl::on_next([=](bool can) {
link->setText(can
? tr::lng_filters_by_link_select(tr::now)
: tr::lng_filters_by_link_deselect(tr::now));
@@ -1195,7 +1195,7 @@ void AddFilterSubtitleWithToggles(
container->widthValue(),
title->topValue(),
link->widthValue()
) | rpl::start_with_next([=](int outer, int y, int width) {
) | rpl::on_next([=](int outer, int y, int width) {
link->move(outer - st::boxRowPadding.right() - width, y);
}, link->lifetime());
}

View File

@@ -151,7 +151,7 @@ using Ui::TableRowTooltipData;
auto result = object_ptr<Ui::RpWidget>(parent);
const auto raw = result.data();
raw->paintRequest() | rpl::start_with_next([=] {
raw->paintRequest() | rpl::on_next([=] {
auto p = QPainter(raw);
const auto &icon = st::giveawayGiftCodeLinkCopy;
const auto left = (raw->width() - icon.width()) / 2;
@@ -640,7 +640,7 @@ void GiftCodeBox(
box->closeBox();
});
box->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
close->moveToRight(0, 0);
}, box->lifetime());
@@ -727,7 +727,7 @@ void GiftCodePendingBox(
spoiler->update();
})->start();
linkLabel->sizeValue(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
spoiler->setGeometry(Rect(s));
}, spoiler->lifetime());
const auto spoilerCached = Ui::SpoilerMessCached(
@@ -735,7 +735,7 @@ void GiftCodePendingBox(
st::giveawayGiftCodeLink.textFg->c);
const auto textHeight = st::giveawayGiftCodeLink.style.font->height;
spoiler->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(spoiler);
const auto rect = spoiler->rect();
const auto r = rect
@@ -769,7 +769,7 @@ void GiftCodePendingBox(
const auto closeCallback = [=] { box->closeBox(); };
close->setClickedCallback(closeCallback);
box->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
close->moveToRight(0, 0);
}, box->lifetime());
@@ -862,7 +862,7 @@ void GiveawayInfoBox(
std::move(label),
QMargins(0, skip, 0, skip)),
style::al_justify);
result->paintRequest() | rpl::start_with_next([=] {
result->paintRequest() | rpl::on_next([=] {
auto p = QPainter(result);
p.setPen(Qt::NoPen);
p.setBrush(st::boxDividerBg);
@@ -1059,7 +1059,7 @@ void GiveawayInfoBox(
const auto bg = wrap->lifetime().make_state<Ui::RoundRect>(
st::boxRadius,
st::attentionBoxButton.textBgOver);
wrap->paintRequest() | rpl::start_with_next([=] {
wrap->paintRequest() | rpl::on_next([=] {
auto p = QPainter(wrap);
bg->paint(p, wrap->rect());
}, wrap->lifetime());
@@ -1141,7 +1141,7 @@ struct AddedUniqueDetails {
const auto icon = Ui::CreateChild<Ui::IconButton>(
raw,
st::giveawayGiftMessageRemove);
raw->widthValue() | rpl::start_with_next([=](int outer) {
raw->widthValue() | rpl::on_next([=](int outer) {
label->resizeToWidth(outer - icon->width());
const auto height = std::max(label->height(), icon->height());

View File

@@ -908,7 +908,7 @@ void Content::setupContent(
inner,
st::defaultBox.margin.top()));
rows->isEmpty() | rpl::start_with_next([=](bool empty) {
rows->isEmpty() | rpl::on_next([=](bool empty) {
wrap->toggle(!empty, anim::type::instant);
}, rows->lifetime());
@@ -931,7 +931,7 @@ void Content::setupContent(
tr::lng_languages_none(),
st::membersAbout);
empty->entity()->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
label->move(
(size.width() - label->width()) / 2,
(size.height() - label->height()) / 2);
@@ -951,7 +951,7 @@ void Content::setupContent(
main->isEmpty(),
other->isEmpty(),
_1 || _2
) | rpl::start_with_next([=](bool empty) {
) | rpl::on_next([=](bool empty) {
divider->toggle(!empty, anim::type::instant);
}, divider->lifetime());
@@ -959,7 +959,7 @@ void Content::setupContent(
a->hasSelection(
) | rpl::filter(
_1
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
b->setSelected(-1);
}, a->lifetime());
};
@@ -1134,12 +1134,12 @@ void LanguageBox::prepare() {
inner->heightValue(),
topContainer->heightValue(),
_1 + _2
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
accumulate_max(*max, height);
setDimensions(st::boxWidth, qMin(*max, st::boxMaxListHeight));
}, inner->lifetime());
topContainer->heightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
setInnerTopSkip(height);
}, inner->lifetime());
@@ -1154,7 +1154,7 @@ void LanguageBox::prepare() {
});
inner->activations(
) | rpl::start_with_next([=](const Language &language) {
) | rpl::on_next([=](const Language &language) {
// "#custom" is applied each time it's passed to switchToLanguage().
// So we check that the language really has changed.
const auto currentId = [] {
@@ -1190,7 +1190,7 @@ void LanguageBox::setupTop(not_null<Ui::VerticalLayout*> container) {
translateEnabled->toggledValue(
) | rpl::filter([](bool checked) {
return (checked != Core::App().settings().translateButtonEnabled());
}) | rpl::start_with_next([=](bool checked) {
}) | rpl::on_next([=](bool checked) {
Core::App().settings().setTranslateButtonEnabled(checked);
Core::App().saveSettingsDelayed();
}, translateEnabled->lifetime());
@@ -1207,7 +1207,7 @@ void LanguageBox::setupTop(not_null<Ui::VerticalLayout*> container) {
rpl::duplicate(premium),
_1 && _2),
_translateChatTurnOff.events()));
std::move(premium) | rpl::start_with_next([=](bool value) {
std::move(premium) | rpl::on_next([=](bool value) {
translateChat->setToggleLocked(!value);
}, translateChat->lifetime());
@@ -1222,7 +1222,7 @@ void LanguageBox::setupTop(not_null<Ui::VerticalLayout*> container) {
}
return premium
&& (checked != Core::App().settings().translateChatEnabled());
}) | rpl::start_with_next([=](bool checked) {
}) | rpl::on_next([=](bool checked) {
Core::App().settings().setTranslateChatEnabled(checked);
Core::App().saveSettingsDelayed();
}, translateChat->lifetime());
@@ -1300,7 +1300,7 @@ base::binary_guard LanguageBox::Show(Window::SessionController *controller) {
manager.languageListChanged(
) | rpl::take(
1
) | rpl::start_with_next([=]() mutable {
) | rpl::on_next([=]() mutable {
const auto show = guard->alive();
if (lifetime) {
base::take(lifetime)->destroy();

View File

@@ -288,7 +288,7 @@ void LocalStorageBox::Show(not_null<Window::SessionController*> controller) {
rpl::combine(
controller->session().data().cache().statsOnMain(),
controller->session().data().cacheBigFile().statsOnMain()
) | rpl::start_with_next([=](
) | rpl::on_next([=](
Database::Stats &&stats,
Database::Stats &&statsBig) {
weak->update(std::move(stats), std::move(statsBig));
@@ -379,7 +379,7 @@ void LocalStorageBox::setupControls() {
const auto shown = (data.count && data.totalSize) || !tag;
result->toggle(shown, anim::type::instant);
result->entity()->clearRequests(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
clearByTag(tag);
}, result->lifetime());
_rows.emplace(tag, result);
@@ -431,7 +431,7 @@ void LocalStorageBox::setupControls() {
);
container->resizeToWidth(st::boxWidth);
container->heightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
setDimensions(st::boxWidth, height);
}, container->lifetime());
}

View File

@@ -77,7 +77,7 @@ void MaxInviteBox::prepare() {
_channel->session().changes().peerUpdates(
_channel,
Data::PeerUpdate::Flag::InviteLinks
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
rtlupdate(_invitationLink);
}, lifetime());
}

View File

@@ -118,7 +118,7 @@ ModerateOptions CalculateModerateOptions(const HistoryItemsList &items) {
const auto peer = from[state->index];
const auto peerId = peer->id;
state->apiLifetime = search->messagesFounds(
) | rpl::start_with_next([=](const Api::FoundMessages &found) {
) | rpl::on_next([=](const Api::FoundMessages &found) {
state->messagesCounts[peerId] = found.total;
state->index++;
repeat(repeat);
@@ -201,7 +201,7 @@ void CreateModerateMessagesBox(
not_null<Ui::Checkbox*> checkbox,
not_null<Controller*> controller,
Request request) {
confirms->events() | rpl::start_with_next([=] {
confirms->events() | rpl::on_next([=] {
if (checkbox->checked() && controller->collectRequests) {
sequentiallyRequest(request, controller->collectRequests());
}
@@ -354,7 +354,7 @@ void CreateModerateMessagesBox(
}
return float64(result);
})
) | rpl::start_with_next([=](const QString &text) {
) | rpl::on_next([=](const QString &text) {
title->setText(text);
title->resizeToWidth(inner->width()
- rect::m::sum::h(st::boxRowPadding));
@@ -432,7 +432,7 @@ void CreateModerateMessagesBox(
}
wrap->toggle(!wrap->toggled(), anim::type::normal);
{
inner->heightValue() | rpl::start_with_next([=] {
inner->heightValue() | rpl::on_next([=] {
if (!wrap->animating()) {
scrollLifetime->destroy();
Ui::PostponeCall(crl::guard(box, [=] {
@@ -458,7 +458,7 @@ void CreateModerateMessagesBox(
rpl::single(toggled ? emojiUp : emojiDown),
Ui::Text::WithEntities);
}) | rpl::flatten_latest(
) | rpl::start_with_next([=](const TextWithEntities &text) {
) | rpl::on_next([=](const TextWithEntities &text) {
raw->setMarkedText(Ui::Text::Link(text, u"internal:"_q));
}, label->lifetime());
@@ -509,7 +509,7 @@ void CreateModerateMessagesBox(
disabledMessages,
{ .isForum = peer->isForum() });
computeRestrictions = getRestrictions;
std::move(changes) | rpl::start_with_next([=] {
std::move(changes) | rpl::on_next([=] {
ban->setChecked(true);
}, ban->lifetime());
Ui::AddSkip(container);
@@ -519,7 +519,7 @@ void CreateModerateMessagesBox(
}
// Handle confirmation manually.
confirms->events() | rpl::start_with_next([=] {
confirms->events() | rpl::on_next([=] {
if (ban->checked() && controller->collectRequests) {
const auto kick = !wrap || !wrap->toggled();
const auto restrictions = computeRestrictions

View File

@@ -47,7 +47,7 @@ void SetCloudPassword(
not_null<Ui::GenericBox*> box,
not_null<Main::Session*> session) {
session->api().cloudPassword().state(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
using namespace Settings;
const auto weak = base::make_weak(box);
if (CheckEditCloudPassword(session)) {
@@ -120,7 +120,7 @@ void StartPendingReset(
};
session->api().cloudPassword().resetPassword(
) | rpl::start_with_next_error_done([=](
) | rpl::on_next_error_done([=](
Api::CloudPassword::ResetRetryDate retryDate) {
constexpr auto kMinute = 60;
constexpr auto kHour = 3600;
@@ -309,11 +309,11 @@ void PasscodeBox::prepare() {
connect(_newPasscode, &Ui::MaskedInputField::changed, [=] { newChanged(); });
connect(_reenterPasscode, &Ui::MaskedInputField::changed, [=] { newChanged(); });
_passwordHint->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
newChanged();
}, _passwordHint->lifetime());
_recoverEmail->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (!_emailError.isEmpty()) {
_emailError = QString();
update();
@@ -325,9 +325,9 @@ void PasscodeBox::prepare() {
connect(_newPasscode, &Ui::MaskedInputField::submitted, fieldSubmit);
connect(_reenterPasscode, &Ui::MaskedInputField::submitted, fieldSubmit);
_passwordHint->submits(
) | rpl::start_with_next(fieldSubmit, _passwordHint->lifetime());
) | rpl::on_next(fieldSubmit, _passwordHint->lifetime());
_recoverEmail->submits(
) | rpl::start_with_next(fieldSubmit, _recoverEmail->lifetime());
) | rpl::on_next(fieldSubmit, _recoverEmail->lifetime());
_recover->addClickHandler([=] { recoverByEmail(); });
@@ -607,7 +607,7 @@ void PasscodeBox::validateEmail(
box->boxClosing(
) | rpl::filter([=] {
return !*set;
}) | start_with_next([=, weak = base::make_weak(this)] {
}) | on_next([=, weak = base::make_weak(this)] {
if (weak) {
weak->_clearUnconfirmedPassword.fire({});
}
@@ -1117,7 +1117,7 @@ void PasscodeBox::recover() {
) | rpl::start_to_stream(_newPasswordSet, lifetime());
box->recoveryExpired(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
recoverExpired();
}, lifetime());
@@ -1207,11 +1207,11 @@ void RecoverBox::prepare() {
updateHeight();
_recoverCode->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
codeChanged();
}, _recoverCode->lifetime());
_recoverCode->submits(
) | rpl::start_with_next([=] { submit(); }, _recoverCode->lifetime());
) | rpl::on_next([=] { submit(); }, _recoverCode->lifetime());
}
void RecoverBox::paintEvent(QPaintEvent *e) {
@@ -1342,7 +1342,7 @@ void RecoverBox::proceedToChange(const QString &code) {
auto box = Box<PasscodeBox>(_session, fields);
box->boxClosing(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto weak = base::make_weak(this);
if (const auto onstack = _closeParent) {
onstack();
@@ -1353,7 +1353,7 @@ void RecoverBox::proceedToChange(const QString &code) {
}, lifetime());
box->newPasswordSet(
) | rpl::start_with_next([=](QByteArray &&password) {
) | rpl::on_next([=](QByteArray &&password) {
_newPasswordSet.fire(std::move(password));
}, lifetime());

View File

@@ -113,7 +113,7 @@ void PeerListBox::createMultiSelect() {
tr::lng_participant_filter());
_select.create(this, std::move(entity));
_select->heightValue(
) | rpl::start_with_next(
) | rpl::on_next(
[this] { updateScrollSkips(); },
lifetime());
_select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) {
@@ -191,7 +191,7 @@ void PeerListBox::prepare() {
_controller->setDelegate(this);
_controller->boxHeightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
setDimensions(_controller->contentWidth(), height);
}, lifetime());
@@ -203,7 +203,7 @@ void PeerListBox::prepare() {
}
content()->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
) | rpl::on_next([this](Ui::ScrollToRequest request) {
scrollToY(request.ymin, request.ymax);
}, lifetime());
@@ -1002,14 +1002,14 @@ PeerListContent::PeerListContent(
, _controller(controller)
, _rowHeight(_st.item.height) {
_controller->session().downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
update();
}, lifetime());
using UpdateFlag = Data::PeerUpdate::Flag;
_controller->session().changes().peerUpdates(
UpdateFlag::Name | UpdateFlag::Photo | UpdateFlag::EmojiStatus
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
if (update.flags & UpdateFlag::Name) {
handleNameChanged(update.peer);
}
@@ -1019,7 +1019,7 @@ PeerListContent::PeerListContent(
}, lifetime());
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
invalidatePixmapsCache();
}, lifetime());
@@ -1387,10 +1387,10 @@ void PeerListContent::initDecorateWidget(Ui::RpWidget *widget) {
widget->events(
) | rpl::filter([=](not_null<QEvent*> e) {
return (e->type() == QEvent::Enter) && widget->isVisible();
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
mouseLeftGeometry();
}, widget->lifetime());
widget->heightValue() | rpl::skip(1) | rpl::start_with_next([=] {
widget->heightValue() | rpl::skip(1) | rpl::on_next([=] {
resizeToWidth(width());
}, widget->lifetime());
}

View File

@@ -117,7 +117,7 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
});
raw->setSortMode(Mode::Online);
raw->wheelClicks() | rpl::start_with_next([=](not_null<PeerData*> p) {
raw->wheelClicks() | rpl::on_next([=](not_null<PeerData*> p) {
sessionController->showInNewWindow(p);
}, box->lifetime());
};
@@ -385,7 +385,7 @@ void TrackMessageMoneyRestrictionsChanges(
rpl::merge(
Data::AmPremiumValue(session) | rpl::to_empty,
session->api().premium().someMessageMoneyRestrictionsResolved()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto st = &controller->computeListSt().item;
const auto delegate = controller->delegate();
const auto process = [&](not_null<PeerListRow*> raw) {
@@ -431,18 +431,18 @@ void ChatsListBoxController::prepare() {
session().data().chatsListLoadedEvents(
) | rpl::filter([=](Data::Folder *folder) {
return !folder;
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
checkForEmptyRows();
}, lifetime());
}
session().data().chatsListChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
rebuildRows();
}, lifetime());
session().data().contactsLoaded().value(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
rebuildRows();
}, lifetime());
}
@@ -586,14 +586,14 @@ void PeerListStories::prepare(not_null<PeerListDelegate*> delegate) {
_delegate = delegate;
_unreadBrush = PeerListStoriesGradient(_controller->computeListSt());
style::PaletteChanged() | rpl::start_with_next([=] {
style::PaletteChanged() | rpl::on_next([=] {
_unreadBrush = PeerListStoriesGradient(_controller->computeListSt());
updateColors();
}, _lifetime);
_session->changes().peerUpdates(
Data::PeerUpdate::Flag::StoriesState
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
const auto id = update.peer->id.value;
if (const auto row = _delegate->peerListFindRow(id)) {
process(row);
@@ -601,7 +601,7 @@ void PeerListStories::prepare(not_null<PeerListDelegate*> delegate) {
}, _lifetime);
const auto stories = &_session->data().stories();
stories->sourceChanged() | rpl::start_with_next([=](PeerId id) {
stories->sourceChanged() | rpl::on_next([=](PeerId id) {
const auto source = stories->source(id);
const auto info = source
? source->info()
@@ -662,7 +662,7 @@ void ContactsBoxController::prepare() {
}
session().data().contactsLoaded().value(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
rebuildRows();
}, lifetime());
}
@@ -724,7 +724,7 @@ void ContactsBoxController::setSortMode(SortMode mode) {
) | rpl::filter([=](const Data::PeerUpdate &update) {
return !_sortByOnlineTimer.isActive()
&& delegate()->peerListFindRow(update.peer->id.value);
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
_sortByOnlineTimer.callOnce(kSortByOnlineThrottle);
}, _sortByOnlineLifetime);
} else {
@@ -874,7 +874,7 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
});
forum->destroyed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
});
@@ -913,7 +913,7 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
});
monoforum->destroyed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
});
@@ -1098,12 +1098,12 @@ ChooseTopicBoxController::ChooseTopicBoxController(
setStyleOverrides(&st::chooseTopicList);
_forum->chatsListChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
refreshRows();
}, lifetime());
_forum->topicDestroyed(
) | rpl::start_with_next([=](not_null<Data::ForumTopic*> topic) {
) | rpl::on_next([=](not_null<Data::ForumTopic*> topic) {
const auto id = PeerListRowId(topic->rootId().bare);
if (const auto row = delegate()->peerListFindRow(id)) {
delegate()->peerListRemoveRow(row);
@@ -1133,7 +1133,7 @@ void ChooseTopicBoxController::prepare() {
session().changes().entryUpdates(
Data::EntryUpdate::Flag::Repaint
) | rpl::start_with_next([=](const Data::EntryUpdate &update) {
) | rpl::on_next([=](const Data::EntryUpdate &update) {
if (const auto topic = update.entry->asTopic()) {
if (topic->forum() == _forum) {
const auto id = topic->rootId().bare;
@@ -1200,12 +1200,12 @@ ChooseSublistBoxController::ChooseSublistBoxController(
setStyleOverrides(&st::chooseTopicList);
_monoforum->chatsListChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
refreshRows();
}, lifetime());
_monoforum->sublistDestroyed(
) | rpl::start_with_next([=](not_null<Data::SavedSublist*> sublist) {
) | rpl::on_next([=](not_null<Data::SavedSublist*> sublist) {
const auto id = sublist->sublistPeer()->id.value;
if (const auto row = delegate()->peerListFindRow(id)) {
delegate()->peerListRemoveRow(row);
@@ -1235,7 +1235,7 @@ void ChooseSublistBoxController::prepare() {
session().changes().entryUpdates(
Data::EntryUpdate::Flag::Repaint
) | rpl::start_with_next([=](const Data::EntryUpdate &update) {
) | rpl::on_next([=](const Data::EntryUpdate &update) {
if (const auto sublist = update.entry->asSublist()) {
if (sublist->parent() == _monoforum) {
const auto id = sublist->sublistPeer()->id.value;

View File

@@ -25,7 +25,7 @@ PeerListWidgets::PeerListWidgets(
, _controller(controller)
, _st(controller->computeListSt()) {
_content = base::make_unique_q<Ui::VerticalLayout>(this);
parent->sizeValue() | rpl::start_with_next([this](const QSize &size) {
parent->sizeValue() | rpl::on_next([this](const QSize &size) {
_content->resizeToWidth(size.width());
resize(size.width(), _content->height());
}, lifetime());
@@ -129,7 +129,7 @@ void PeerListWidgets::appendRow(std::unique_ptr<PeerListRow> row) {
st.button.ripple,
st.button.textBgOver)));
widget->resize(widget->width(), st.height);
widget->paintRequest() | rpl::start_with_next([=, this] {
widget->paintRequest() | rpl::on_next([=, this] {
auto p = Painter(widget);
const auto selected = widget->isOver() || widget->isDown();
paintRow(p, crl::now(), selected, raw);

View File

@@ -90,7 +90,7 @@ void PeerListsBox::createMultiSelect() {
tr::lng_participant_filter());
_select.create(this, std::move(entity));
_select->heightValue(
) | rpl::start_with_next(
) | rpl::on_next(
[this] { updateScrollSkips(); },
lifetime());
_select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) {
@@ -158,7 +158,7 @@ void PeerListsBox::prepare() {
list.controller->setDelegate(list.delegate.get());
content->scrollToRequests(
) | rpl::start_with_next([=](Ui::ScrollToRequest request) {
) | rpl::on_next([=](Ui::ScrollToRequest request) {
const auto skip = content->y();
scrollToY(
skip + request.ymin,
@@ -168,7 +168,7 @@ void PeerListsBox::prepare() {
content->selectedIndexValue(
) | rpl::filter([=](int index) {
return (index >= 0);
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
for (const auto &list : _lists) {
if (list.content && list.content != content) {
list.content->clearSelection();

View File

@@ -65,7 +65,7 @@ Controller::Controller(
, _callback(std::move(callback)) {
std::move(
add
) | rpl::start_with_next([=](not_null<PeerData*> peer) {
) | rpl::on_next([=](not_null<PeerData*> peer) {
if (_prepared) {
addRow(peer);
} else {
@@ -359,7 +359,7 @@ object_ptr<Ui::RpWidget> AddBotToGroupBoxController::prepareAdminnedChats() {
delegate->setContent(content);
controller->setDelegate(delegate);
items.events() | rpl::take(1) | rpl::start_with_next([=] {
items.events() | rpl::take(1) | rpl::on_next([=] {
wrap->show(anim::type::instant);
}, inner->lifetime());
};
@@ -373,7 +373,7 @@ object_ptr<Ui::RpWidget> AddBotToGroupBoxController::prepareAdminnedChats() {
rpl::merge(
_groups.events(),
_channels.events()
) | rpl::take(1) | rpl::start_with_next([=] {
) | rpl::take(1) | rpl::on_next([=] {
container->add(CreatePeerListSectionSubtitle(
container,
tr::lng_bot_groups()));
@@ -403,7 +403,7 @@ void AddBotToGroupBoxController::prepareViewHook() {
session().data().chatsListLoadedEvents(
) | rpl::filter([=](Data::Folder *folder) {
return !folder;
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
updateLabels();
}, lifetime());
}

View File

@@ -273,7 +273,7 @@ void SimpleForbiddenBox(
Data::AmPremiumValue(
&peer->session()
) | rpl::skip(1) | rpl::start_with_next([=] {
) | rpl::skip(1) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
}
@@ -555,7 +555,7 @@ void InviteForbiddenController::setComplexCover() {
void InviteForbiddenController::prepare() {
session().api().premium().someMessageMoneyRestrictionsResolved(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto stars = 0;
const auto process = [&](not_null<PeerListRow*> raw) {
const auto row = static_cast<ForbiddenRow*>(raw.get());
@@ -667,7 +667,7 @@ void InviteForbiddenController::send(
if (!waiting.empty()) {
session().changes().peerUpdates(
Data::PeerUpdate::Flag::FullInfo
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
if (waiting.contains(update.peer)) {
withPaymentApproved(alreadyApproved);
}
@@ -677,7 +677,7 @@ void InviteForbiddenController::send(
session().credits().loadedValue(
) | rpl::filter(
rpl::mappers::_1
) | rpl::take(1) | rpl::start_with_next([=] {
) | rpl::take(1) | rpl::on_next([=] {
withPaymentApproved(alreadyApproved);
}, _paymentCheckLifetime);
}
@@ -750,7 +750,7 @@ void InviteForbiddenController::send(
_peer->session().changes().peerUpdates(
_peer,
Data::PeerUpdate::Flag::FullInfo
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
sendForFull();
}, lifetime());
}
@@ -926,7 +926,7 @@ void AddParticipantsBoxController::addInviteLinkButton() {
st::inviteViaLinkIcon,
QPoint());
button->entity()->heightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
icon->moveToLeft(
st::inviteViaLinkIconPosition.x(),
(height - st::inviteViaLinkIcon.height()) / 2);
@@ -938,7 +938,7 @@ void AddParticipantsBoxController::addInviteLinkButton() {
button->entity()->events(
) | rpl::filter([=](not_null<QEvent*> e) {
return (e->type() == QEvent::Enter);
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
delegate()->peerListMouseLeftGeometry();
}, button->lifetime());
delegate()->peerListSetAboveWidget(std::move(button));
@@ -1062,7 +1062,7 @@ void AddParticipantsBoxController::Start(
[=] { box->closeBox(); });
if (justCreated) {
const auto weak = base::make_weak(parent);
box->boxClosing() | rpl::start_with_next([=] {
box->boxClosing() | rpl::on_next([=] {
auto params = Window::SectionShow();
params.activation = anim::activation::background;
if (const auto strong = weak.get()) {
@@ -1145,7 +1145,7 @@ bool ChatInviteForbidden(
) | rpl::map(
rpl::mappers::_1 > 0
) | rpl::distinct_until_changed(
) | rpl::start_with_next([=](bool has) {
) | rpl::on_next([=](bool has) {
box->clearButtons();
if (has) {
const auto send = box->addButton(tr::lng_via_link_send(), [=] {
@@ -1165,7 +1165,7 @@ bool ChatInviteForbidden(
Data::AmPremiumValue(
&peer->session()
) | rpl::skip(1) | rpl::start_with_next([=] {
) | rpl::skip(1) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
};
@@ -1272,7 +1272,7 @@ void AddSpecialBoxController::prepareChatRows(not_null<ChatData*> chat) {
chat->session().changes().peerUpdates(
chat,
UpdateFlag::Members | UpdateFlag::Admins
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
_additional.fillFromPeer();
if (update.flags & UpdateFlag::Members) {
rebuildChatRows(chat);

View File

@@ -373,7 +373,7 @@ void ChoosePeerBoxController::prepareRestrictions() {
st,
QPoint());
button->heightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
icon->moveToLeft(
st::choosePeerCreateIconLeft,
(height - st::inviteViaLinkIcon.height()) / 2);
@@ -387,7 +387,7 @@ void ChoosePeerBoxController::prepareRestrictions() {
button->events(
) | rpl::filter([=](not_null<QEvent*> e) {
return (e->type() == QEvent::Enter);
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
delegate()->peerListMouseLeftGeometry();
}, button->lifetime());
return button;
@@ -522,7 +522,7 @@ void ShowChoosePeerBox(
query,
std::move(callback));
auto initBox = [=, ptr = controller.get()](not_null<PeerListBox*> box) {
ptr->selectedCountValue() | rpl::start_with_next([=](int count) {
ptr->selectedCountValue() | rpl::on_next([=](int count) {
box->clearButtons();
if (limit > 1) {
box->setAdditionalTitle(rpl::single(u"%1 / %2"_q.arg(count).arg(limit)));

View File

@@ -348,8 +348,8 @@ void Controller::initNameFields(
_save();
}
};
first->submits() | rpl::start_with_next(submit, first->lifetime());
last->submits() | rpl::start_with_next(submit, last->lifetime());
first->submits() | rpl::on_next(submit, first->lifetime());
last->submits() | rpl::on_next(submit, last->lifetime());
first->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName);
first->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName);
}
@@ -418,11 +418,11 @@ void Controller::setupNotesField() {
_emojiPanel->hide();
_emojiPanel->selector()->setCurrentPeer(_window->session().user());
_emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
Ui::InsertEmojiAtCursor(_notesField->textCursor(), data.emoji);
}, _notesField->lifetime());
_emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
const auto info = data.document->sticker();
if (info
&& info->setType == Data::StickersType::Emoji
@@ -464,7 +464,7 @@ void Controller::setupNotesField() {
rpl::combine(
limitState->charsLimitation->geometryValue(),
_notesField->geometryValue()
) | rpl::start_with_next([=](QRect limit, QRect field) {
) | rpl::on_next([=](QRect limit, QRect field) {
limitState->charsLimitation->setVisible(
(w->mapToGlobal(limit.bottomLeft()).y() - border)
< w->mapToGlobal(field.bottomLeft()).y());
@@ -474,7 +474,7 @@ void Controller::setupNotesField() {
limitState->charsLimitation->setLeft(remove);
};
_notesField->changes() | rpl::start_with_next([=] {
_notesField->changes() | rpl::on_next([=] {
checkCharsLimitation();
}, _notesField->lifetime());
@@ -558,7 +558,7 @@ void Controller::setupPhotoButtons() {
_suggestIconWidget = Ui::CreateChild<Ui::RpWidget>(suggestButton);
_suggestIconWidget->resize(iconPlaceholder);
_suggestIconWidget->paintRequest() | rpl::start_with_next([=] {
_suggestIconWidget->paintRequest() | rpl::on_next([=] {
if (_suggestIcon && _suggestIcon->valid()) {
auto p = QPainter(_suggestIconWidget);
const auto frame = _suggestIcon->frame(st::lightButtonFg->c);
@@ -566,7 +566,7 @@ void Controller::setupPhotoButtons() {
}
}, _suggestIconWidget->lifetime());
suggestButton->sizeValue() | rpl::start_with_next([=](QSize size) {
suggestButton->sizeValue() | rpl::on_next([=](QSize size) {
_suggestIconWidget->move(
st::settingsButtonLight.iconLeft - iconPlaceholder.width() / 4,
(size.height() - _suggestIconWidget->height()) / 2);
@@ -590,7 +590,7 @@ void Controller::setupPhotoButtons() {
_cameraIconWidget = Ui::CreateChild<Ui::RpWidget>(setButton);
_cameraIconWidget->resize(iconPlaceholder);
_cameraIconWidget->paintRequest() | rpl::start_with_next([=] {
_cameraIconWidget->paintRequest() | rpl::on_next([=] {
if (_cameraIcon && _cameraIcon->valid()) {
auto p = QPainter(_cameraIconWidget);
const auto frame = _cameraIcon->frame(st::lightButtonFg->c);
@@ -598,7 +598,7 @@ void Controller::setupPhotoButtons() {
}
}, _cameraIconWidget->lifetime());
setButton->sizeValue() | rpl::start_with_next([=](QSize size) {
setButton->sizeValue() | rpl::on_next([=](QSize size) {
_cameraIconWidget->move(
st::settingsButtonLight.iconLeft - iconPlaceholder.width() / 4,
(size.height() - _cameraIconWidget->height()) / 2);
@@ -635,7 +635,7 @@ void Controller::setupPhotoButtons() {
userpicButton->setAttribute(Qt::WA_TransparentForMouseEvents);
resetButton->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
userpicButton->move(
st::settingsButtonLight.iconLeft,
(size.height() - userpicButton->height()) / 2);

View File

@@ -81,7 +81,7 @@ Controller::Controller(
Data::PeerUpdate::Flag::FullInfo
) | rpl::filter([=](const Data::PeerUpdate &update) {
return (update.peer == _waitForFull);
}) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
}) | rpl::on_next([=](const Data::PeerUpdate &update) {
choose(std::exchange(_waitForFull, nullptr));
}, lifetime());
}

View File

@@ -73,7 +73,7 @@ DefaultIconEmoji::DefaultIconEmoji(
Fn<void()> repaint,
Data::CustomEmojiSizeTag tag)
: _tag(tag) {
std::move(value) | rpl::start_with_next([=](DefaultIcon value) {
std::move(value) | rpl::on_next([=](DefaultIcon value) {
_icon = value;
_image = QImage();
if (repaint) {
@@ -164,7 +164,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
std::move(
iconId
) | rpl::start_with_next([=](DocumentId id) {
) | rpl::on_next([=](DocumentId id) {
const auto owner = &controller->session().data();
state->icon = id
? owner->customEmojiManager().create(
@@ -177,7 +177,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
std::move(
defaultIcon
) | rpl::start_with_next([=](DefaultIcon icon) {
) | rpl::on_next([=](DefaultIcon icon) {
state->defaultIcon = Data::ForumTopicIconFrame(
icon.colorId,
icon.title,
@@ -189,7 +189,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
result->paintRequest(
) | rpl::filter([=] {
return !paintIconFrame(result);
}) | rpl::start_with_next([=](QRect clip) {
}) | rpl::on_next([=](QRect clip) {
auto args = Ui::Text::CustomEmoji::Context{
.textColor = st::windowFg->c,
.now = crl::now(),
@@ -222,7 +222,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
rpl::single(rpl::empty) | rpl::then(
style::PaletteChanged()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
state->frame = Data::ForumTopicGeneralIconFrame(
st::largeForumTopicIcon.size,
st::windowSubTextFg->c);
@@ -231,7 +231,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
result->resize(size, size);
result->paintRequest(
) | rpl::start_with_next([=](QRect clip) {
) | rpl::on_next([=](QRect clip) {
auto p = QPainter(result);
const auto skip = (size - st::largeForumTopicIcon.size) / 2;
p.drawImage(skip, skip, state->frame);
@@ -300,7 +300,7 @@ struct IconSelector {
icons->requestDefaultIfUnknown();
icons->defaultUpdates(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
selector->provideRecent(DocumentListToRecent(recent()));
}, selector->lifetime());
@@ -312,14 +312,14 @@ struct IconSelector {
rpl::combine(
rpl::duplicate(coverHeight),
selector->widthValue()
) | rpl::start_with_next([=](int top, int width) {
) | rpl::on_next([=](int top, int width) {
shadow->setGeometry(0, top, width, st::lineWidth);
}, shadow->lifetime());
selector->refreshEmoji();
selector->scrollToRequests(
) | rpl::start_with_next([=](int y) {
) | rpl::on_next([=](int y) {
box->scrollToY(y);
shadow->update();
}, selector->lifetime());
@@ -328,7 +328,7 @@ struct IconSelector {
box->heightValue(),
std::move(coverHeight),
rpl::mappers::_1 - rpl::mappers::_2
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
selector->setMinimalHeight(selector->width(), height);
}, body->lifetime());
@@ -345,7 +345,7 @@ struct IconSelector {
};
selector->customChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
const auto owner = &controller->session().data();
const auto document = data.document;
const auto id = document->id;
@@ -465,14 +465,14 @@ void EditForumTopicBox(
paintIconFrame);
title->geometryValue(
) | rpl::start_with_next([=](QRect geometry) {
) | rpl::on_next([=](QRect geometry) {
icon->move(
st::editTopicIconPosition.x(),
st::editTopicIconPosition.y());
}, icon->lifetime());
state->iconId.value(
) | rpl::start_with_next([=](DocumentId iconId) {
) | rpl::on_next([=](DocumentId iconId) {
icon->setAttribute(
Qt::WA_TransparentForMouseEvents,
created || (iconId != 0));
@@ -486,13 +486,13 @@ void EditForumTopicBox(
};
});
title->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
state->defaultIcon = DefaultIcon{
title->getLastText().trimmed(),
state->defaultIcon.current().colorId,
};
}, title->lifetime());
title->submits() | rpl::start_with_next([box] {
title->submits() | rpl::on_next([box] {
box->triggerButton(0);
}, title->lifetime());
@@ -515,7 +515,7 @@ void EditForumTopicBox(
state->paintIconFrame = std::move(selector.paintIconFrame);
std::move(
selector.iconIdValue
) | rpl::start_with_next([=](DocumentId iconId) {
) | rpl::on_next([=](DocumentId iconId) {
state->iconId = (iconId != kDefaultIconId) ? iconId : 0;
}, box->lifetime());
}

View File

@@ -62,7 +62,7 @@ namespace {
Ui::AddDividerText(container, tr::lng_profile_hide_participants_about());
button->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
megagroup->session().api().request(
MTPchannels_ToggleParticipantsHidden(
megagroup->inputChannel,

View File

@@ -94,7 +94,7 @@ EditParticipantBox::Inner::Inner(
, _hasAdminRights(hasAdminRights)
, _rows(this) {
_rows->heightValue(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
resizeToWidth(width());
}, lifetime());
@@ -282,7 +282,7 @@ void EditAdminBox::prepare() {
true)),
st::rightsToggleMargin + (st::rightsDividerMargin / 2));
_addAsAdmin->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
_adminControlsWrap->toggle(checked, anim::type::normal);
refreshButtons();
}, _addAsAdmin->lifetime());
@@ -530,7 +530,7 @@ not_null<Ui::InputField*> EditAdminBox::addRankInput(
result->setMaxLength(kAdminRoleLimit);
result->setInstantReplaces(Ui::InstantReplaces::TextOnly());
result->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto text = result->getLastText();
const auto removed = TextUtilities::RemoveEmoji(text);
if (removed != text) {
@@ -654,7 +654,7 @@ void EditAdminBox::requestTransferPassword(not_null<ChannelData*> channel) {
peer()->session().api().cloudPassword().state(
) | rpl::take(
1
) | rpl::start_with_next([=](const Core::CloudPasswordState &state) {
) | rpl::on_next([=](const Core::CloudPasswordState &state) {
auto fields = PasscodeBox::CloudFields::From(state);
fields.customTitle = tr::lng_rights_transfer_password_title();
fields.customDescription

View File

@@ -296,7 +296,7 @@ void SubscribeToMigration(
return (channel != nullptr);
}) | rpl::take(
1
) | rpl::start_with_next([=](not_null<ChannelData*> channel) {
) | rpl::on_next([=](not_null<ChannelData*> channel) {
const auto onstack = base::duplicate(migrate);
onstack(channel);
}, lifetime);
@@ -812,7 +812,7 @@ ParticipantsOnlineSorter::ParticipantsOnlineSorter(
, _sortByOnlineTimer([=] { sort(); }) {
peer->session().changes().peerUpdates(
Data::PeerUpdate::Flag::OnlineStatus
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
const auto peerId = update.peer->id;
if (const auto row = _delegate->peerListFindRow(peerId.value)) {
row->refreshStatus();
@@ -910,7 +910,7 @@ void ParticipantsBoxController::setupListChangeViewers() {
channel->owner().megagroupParticipantAdded(
channel
) | rpl::start_with_next([=](not_null<UserData*> user) {
) | rpl::on_next([=](not_null<UserData*> user) {
if (delegate()->peerListFullRowsCount() > 0) {
if (delegate()->peerListRowAt(0)->peer() == user) {
return;
@@ -935,7 +935,7 @@ void ParticipantsBoxController::setupListChangeViewers() {
channel->owner().megagroupParticipantRemoved(
channel
) | rpl::start_with_next([=](not_null<UserData*> user) {
) | rpl::on_next([=](not_null<UserData*> user) {
if (const auto row = delegate()->peerListFindRow(user->id.value)) {
delegate()->peerListRemoveRow(row);
}
@@ -1127,13 +1127,13 @@ auto ParticipantsBoxController::saveState() const
chat->session().changes().peerUpdates(
chat,
Data::PeerUpdate::Flag::Members
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
weak->controllerState = nullptr;
}, my->lifetime);
} else if (const auto channel = _peer->asMegagroup()) {
channel->owner().megagroupParticipantAdded(
channel
) | rpl::start_with_next([=](not_null<UserData*> user) {
) | rpl::on_next([=](not_null<UserData*> user) {
if (!weak->list.empty()) {
if (weak->list[0] == user) {
return;
@@ -1150,7 +1150,7 @@ auto ParticipantsBoxController::saveState() const
channel->owner().megagroupParticipantRemoved(
channel
) | rpl::start_with_next([=](not_null<UserData*> user) {
) | rpl::on_next([=](not_null<UserData*> user) {
weak->list.erase(std::remove(
weak->list.begin(),
weak->list.end(),
@@ -1257,7 +1257,7 @@ void ParticipantsBoxController::prepare() {
auto visible = _peer->isMegagroup()
? Info::Profile::CanViewParticipantsValue(_peer->asMegagroup())
: rpl::single(true);
std::move(visible) | rpl::start_with_next([=](bool visible) {
std::move(visible) | rpl::on_next([=](bool visible) {
if (!visible) {
_onlineCountValue = 0;
_onlineSorter = nullptr;
@@ -1275,7 +1275,7 @@ void ParticipantsBoxController::prepare() {
}
_peer->session().changes().chatAdminChanges(
) | rpl::start_with_next([=](const Data::ChatAdminChange &update) {
) | rpl::on_next([=](const Data::ChatAdminChange &update) {
if (update.peer != _peer) {
return;
}
@@ -1347,7 +1347,7 @@ void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
chat->session().changes().peerUpdates(
chat,
UpdateFlag::Members | UpdateFlag::Admins
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
_additional.fillFromPeer();
if ((update.flags & UpdateFlag::Members)
|| (_role == Role::Admins)) {
@@ -2201,7 +2201,7 @@ void ParticipantsBoxController::subscribeToCreatorChange(
return (change.diff & ChannelDataFlag::Creator);
}) | rpl::filter([=] {
return (isCreator != channel->amCreator());
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
if (channel->isBroadcast()) {
fullListRefresh();
return;

View File

@@ -142,7 +142,7 @@ base::unique_qptr<Ui::RpWidget> CreateEmptyPlaceholder(
container->resize(width, totalHeight);
container->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
const auto totalContentHeight = iconWidget->height()
+ st::normalFont->height + emptyLabel->height()
+ (emptyNextLabel
@@ -313,17 +313,17 @@ PreviewWrap::PreviewWrap(
_style->apply(_theme.get());
_fake->setName(peer->name(), QString());
std::move(colorIndexValue) | rpl::start_with_next([=](uint8 index) {
std::move(colorIndexValue) | rpl::on_next([=](uint8 index) {
if (index != kUnsetColorIndex) {
_fake->changeColorIndex(index);
update();
}
}, lifetime());
std::move(backgroundEmojiId) | rpl::start_with_next([=](DocumentId id) {
std::move(backgroundEmojiId) | rpl::on_next([=](DocumentId id) {
_fake->changeBackgroundEmojiId(id);
update();
}, lifetime());
std::move(colorCollectible) | rpl::start_with_next([=](
std::move(colorCollectible) | rpl::on_next([=](
std::optional<Ui::ColorCollectible> &&collectible) {
if (collectible) {
_fake->changeColorCollectible(std::move(*collectible));
@@ -335,7 +335,7 @@ PreviewWrap::PreviewWrap(
const auto session = &_history->session();
session->data().viewRepaintRequest(
) | rpl::start_with_next([=](not_null<const Element*> view) {
) | rpl::on_next([=](not_null<const Element*> view) {
if (view == _element.get()) {
update();
}
@@ -391,7 +391,7 @@ void PreviewWrap::initElements() {
widthValue(
) | rpl::filter([=](int width) {
return width > st::msgMinWidth;
}) | rpl::start_with_next([=](int width) {
}) | rpl::on_next([=](int width) {
const auto height = _position.y()
+ _element->resizeGetHeight(width)
+ st::msgMargin.top();
@@ -749,11 +749,11 @@ void Apply(
};
const auto state = right->lifetime().make_state<State>();
state->panel.someCustomChosen(
) | rpl::start_with_next([=](EmojiStatusPanel::CustomChosen chosen) {
) | rpl::on_next([=](EmojiStatusPanel::CustomChosen chosen) {
emojiIdChosen(chosen.id.documentId);
}, raw->lifetime());
std::move(colorIndexValue) | rpl::start_with_next([=](uint8 index) {
std::move(colorIndexValue) | rpl::on_next([=](uint8 index) {
state->index = index;
if (state->emoji) {
right->update();
@@ -762,7 +762,7 @@ void Apply(
const auto session = &show->session();
const auto added = st::lineWidth * 2;
std::move(emojiIdValue) | rpl::start_with_next([=](DocumentId emojiId) {
std::move(emojiIdValue) | rpl::on_next([=](DocumentId emojiId) {
state->emojiId = emojiId;
state->emoji = emojiId
? session->data().customEmojiManager().create(
@@ -778,14 +778,14 @@ void Apply(
rpl::combine(
raw->sizeValue(),
right->widthValue()
) | rpl::start_with_next([=](QSize outer, int width) {
) | rpl::on_next([=](QSize outer, int width) {
right->resize(width, outer.height());
const auto skip = st::settingsButton.padding.right();
right->moveToRight(skip - button.added, 0, outer.width());
}, right->lifetime());
right->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (state->panel.paintBadgeFrame(right)) {
return;
}
@@ -893,12 +893,12 @@ void Apply(
};
const auto state = right->lifetime().make_state<State>();
state->panel.someCustomChosen(
) | rpl::start_with_next([=](EmojiStatusPanel::CustomChosen chosen) {
) | rpl::on_next([=](EmojiStatusPanel::CustomChosen chosen) {
statusIdChosen({ chosen.id }, chosen.until);
}, raw->lifetime());
const auto session = &show->session();
std::move(statusIdValue) | rpl::start_with_next([=](EmojiStatusId id) {
std::move(statusIdValue) | rpl::on_next([=](EmojiStatusId id) {
state->statusId = id;
state->emoji = id
? session->data().customEmojiManager().create(
@@ -914,14 +914,14 @@ void Apply(
rpl::combine(
raw->sizeValue(),
right->widthValue()
) | rpl::start_with_next([=](QSize outer, int width) {
) | rpl::on_next([=](QSize outer, int width) {
right->resize(width, outer.height());
const auto skip = st::settingsButton.padding.right();
right->moveToRight(skip - button.added, 0, outer.width());
}, right->lifetime());
right->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (state->panel.paintBadgeFrame(right)) {
return;
}
@@ -1007,7 +1007,7 @@ void Apply(
rpl::combine(
raw->sizeValue(),
right->widthValue()
) | rpl::start_with_next([=](QSize outer, int width) {
) | rpl::on_next([=](QSize outer, int width) {
right->resize(width, outer.height());
const auto skip = st::settingsButton.padding.right();
right->moveToRight(skip - button.added, 0, outer.width());
@@ -1016,7 +1016,7 @@ void Apply(
right->paintRequest(
) | rpl::filter([=] {
return state->icon != nullptr;
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
auto p = QPainter(right);
const auto x = button.added;
const auto y = (right->height() - button.emojiWidth) / 2;
@@ -1076,7 +1076,7 @@ void Apply(
return wrapLoaded(sets->find(id));
}));
}) | rpl::flatten_latest(
) | rpl::start_with_next([=](DocumentData *icon) {
) | rpl::on_next([=](DocumentData *icon) {
if (state->icon != icon) {
state->icon = icon;
state->custom = nullptr;
@@ -1111,7 +1111,7 @@ Fn<void()> AddColorGiftTabs(
GiftsStars(
session,
session->user()
) | rpl::start_with_next([=](const std::vector<GiftTypeStars> &list) {
) | rpl::on_next([=](const std::vector<GiftTypeStars> &list) {
auto filtered = std::vector<Data::StarGift>();
for (const auto &gift : list) {
if ((profile || gift.info.peerColorAvailable) && gift.resale) {
@@ -1122,7 +1122,7 @@ Fn<void()> AddColorGiftTabs(
}, container->lifetime());
state->list.value(
) | rpl::start_with_next([=](const std::vector<Data::StarGift> &list) {
) | rpl::on_next([=](const std::vector<Data::StarGift> &list) {
auto tabs = std::vector<Ui::SubTabs::Tab>();
tabs.push_back({
.id = u"my"_q,
@@ -1152,7 +1152,7 @@ Fn<void()> AddColorGiftTabs(
context));
state->tabs->activated(
) | rpl::start_with_next([=](const QString &id) {
) | rpl::on_next([=](const QString &id) {
state->tabs->setActiveTab(id);
chosen(id.toULongLong());
}, state->tabs->lifetime());
@@ -1228,7 +1228,7 @@ void AddGiftSelector(
shownGiftId,
{},
state->current->offset
) | rpl::start_with_next([=](Data::ResaleGiftsDescriptor slice) {
) | rpl::on_next([=](Data::ResaleGiftsDescriptor slice) {
auto &entry = state->lists[shownGiftId];
entry.loading.destroy();
entry.offset = slice.offset;
@@ -1254,7 +1254,7 @@ void AddGiftSelector(
session,
Data::MyUniqueType::OwnedAndHosted,
state->current->offset
) | rpl::start_with_next([=](Data::MyGiftsDescriptor slice) {
) | rpl::on_next([=](Data::MyGiftsDescriptor slice) {
auto &entry = state->lists[shownGiftId];
entry.loading.destroy();
entry.offset = slice.offset;
@@ -1393,7 +1393,7 @@ void AddGiftSelector(
};
state->selected.value(
) | rpl::combine_previous() | rpl::start_with_next([=](
) | rpl::combine_previous() | rpl::on_next([=](
uint64 wasCollectibleId,
uint64 nowCollectibleId) {
if (wasCollectibleId) {
@@ -1409,7 +1409,7 @@ void AddGiftSelector(
}, raw->lifetime());
state->selectedGiftId.value(
) | rpl::combine_previous() | rpl::start_with_next([=](
) | rpl::combine_previous() | rpl::on_next([=](
uint64 wasGiftId,
uint64 nowGiftId) {
if (wasGiftId) {
@@ -1465,7 +1465,7 @@ void AddGiftSelector(
};
state->showingGiftId.value(
) | rpl::start_with_next([=](uint64 showingId) {
) | rpl::on_next([=](uint64 showingId) {
state->current = &state->lists[showingId];
state->buttons.clear();
if (state->emptyPlaceholder) {
@@ -1479,7 +1479,7 @@ void AddGiftSelector(
state->visibleRange = raw->visibleRange();
state->visibleRange.value(
) | rpl::start_with_next(state->rebuild, raw->lifetime());
) | rpl::on_next(state->rebuild, raw->lifetime());
}
Fn<void(int)> CreateTabsWidget(
@@ -1544,7 +1544,7 @@ Fn<void(int)> CreateTabsWidget(
const auto penWidth = st::lineWidth * 2;
tabsContainer->paintRequest() | rpl::start_with_next([=] {
tabsContainer->paintRequest() | rpl::on_next([=] {
auto p = QPainter(tabsContainer);
auto hq = PainterHighQualityEnabler(p);
const auto r = tabsContainer->rect();
@@ -1639,14 +1639,14 @@ void CreateBoostLevelContainer(
};
const auto state = boostLevelContainer->lifetime().make_state<State>();
boostLevelContainer->paintRequest() | rpl::start_with_next([=] {
boostLevelContainer->paintRequest() | rpl::on_next([=] {
auto p = QPainter(boostLevelContainer);
const auto bg = state->currentColor.value_or(st::boxDividerBg->c);
p.fillRect(boostLevelContainer->rect(), bg);
p.fillRect(boostLevelContainer->rect(), st::shadowFg);
}, boostLevelContainer->lifetime());
std::move(colorProducer) | rpl::start_with_next([=](
std::move(colorProducer) | rpl::on_next([=](
std::optional<QColor> color) {
const auto colorChanged = (state->currentColor != color)
|| !state->label;
@@ -1672,7 +1672,7 @@ void CreateBoostLevelContainer(
style);
state->label->show();
boostLevelContainer->sizeValue(
) | rpl::start_with_next([=](QSize s) {
) | rpl::on_next([=](QSize s) {
state->label->moveToLeft(
(s.width() - state->label->width()) / 2,
(s.height() - state->label->height()) / 2);
@@ -1707,7 +1707,7 @@ void AddLevelBadge(
rpl::combine(
button->sizeValue(),
std::move(text)
) | rpl::start_with_next([=](const QSize &s, const QString &) {
) | rpl::on_next([=](const QSize &s, const QString &) {
if (s.isNull()) {
return;
}
@@ -1771,7 +1771,7 @@ void EditPeerColorSection(
state->preview->setPatternEmojiId(
state->profileEmojiId.current());
}
state->statusId.value() | rpl::start_with_next([=](EmojiStatusId id) {
state->statusId.value() | rpl::on_next([=](EmojiStatusId id) {
state->preview->setLocalEmojiStatusId(std::move(id));
}, state->preview->lifetime());
const auto peerColors = &peer->session().api().peerColors();
@@ -1835,7 +1835,7 @@ void EditPeerColorSection(
true));
state->profileIndex.value(
) | rpl::start_with_next([=](uint8 index) {
) | rpl::on_next([=](uint8 index) {
selector->updateSelection(index);
}, selector->lifetime());
@@ -2126,7 +2126,7 @@ void EditPeerColorSection(
}));
});
state->collectible.value(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto buy = state->buyCollectible.get();
while (!button->children().isEmpty()) {
delete button->children().first();
@@ -2294,7 +2294,7 @@ void EditPeerProfileColorSection(
});
state->index.value(
) | rpl::start_with_next([=](uint8 index) {
) | rpl::on_next([=](uint8 index) {
if (state->selector) {
state->selector->updateSelection(index);
}
@@ -2386,7 +2386,7 @@ void EditPeerProfileColorSection(
}));
});
state->wearable.value(
) | rpl::start_with_next([=](EmojiStatusId id) {
) | rpl::on_next([=](EmojiStatusId id) {
const auto buy = state->buyCollectible.get();
while (!button->children().isEmpty()) {
delete button->children().first();
@@ -2469,7 +2469,7 @@ void EditPeerColorBox(
buttonContainer->widthValue(),
profileButton->sizeValue(),
nameButton->sizeValue()
) | rpl::start_with_next([=](int w, QSize, QSize) {
) | rpl::on_next([=](int w, QSize, QSize) {
profileButton->resizeToWidth(w);
nameButton->resizeToWidth(w);
}, buttonContainer->lifetime());
@@ -2602,7 +2602,7 @@ void SetupPeerColorSample(
rpl::duplicate(colorIndexValue),
rpl::duplicate(colorProfileIndexValue),
rpl::duplicate(emojiStatusIdValue)
) | rpl::start_with_next([=](
) | rpl::on_next([=](
int width,
const QString &buttonText,
int colorIndex,
@@ -2668,7 +2668,7 @@ void SetupPeerColorSample(
rpl::duplicate(colorIndexValue),
rpl::duplicate(colorProfileIndexValue),
rpl::duplicate(emojiStatusIdValue)
) | rpl::start_with_next([=](
) | rpl::on_next([=](
QSize outer,
QSize inner,
int colorIndex,
@@ -2746,7 +2746,7 @@ void AddPeerColorButton(
rpl::combine(
rpl::duplicate(label),
button->widthValue()
) | rpl::start_with_next([=](
) | rpl::on_next([=](
const QString &text,
int width) {
const auto space = st.style.font->spacew;

View File

@@ -29,7 +29,7 @@ void EditPeerHistoryVisibilityBox(
HistoryVisibility v) {
const auto button = Ui::CreateChild<Ui::AbstractButton>(inner.get());
inner->sizeValue(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
button->resize(s);
}, button->lifetime());
button->setClickedCallback([=] { historyVisibility->setValue(v); });

View File

@@ -610,11 +610,11 @@ object_ptr<Ui::RpWidget> Controller::createPhotoAndTitleEdit() {
container,
createTitleEdit());
photoWrap->heightValue(
) | rpl::start_with_next([container](int height) {
) | rpl::on_next([container](int height) {
container->resize(container->width(), height);
}, photoWrap->lifetime());
container->widthValue(
) | rpl::start_with_next([titleEdit](int width) {
) | rpl::on_next([titleEdit](int width) {
const auto left = st::editPeerPhotoMargins.left()
+ st::defaultUserpicButton.size.width();
titleEdit->resizeToWidth(width - left);
@@ -669,7 +669,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
&_peer->session());
result->entity()->submits(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
submitTitle();
}, result->entity()->lifetime());
@@ -699,7 +699,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
emojiPanel->hide();
emojiPanel->selector()->setCurrentPeer(_peer);
emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji);
field->setFocus();
}, field->lifetime());
@@ -733,7 +733,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
});
}());
field->widthValue() | rpl::start_with_next([=](int width) {
field->widthValue() | rpl::on_next([=](int width) {
const auto &p = st::editPeerTitleEmojiPosition;
emojiToggle->moveToRight(p.x(), p.y(), width);
updateEmojiPanelGeometry();
@@ -779,7 +779,7 @@ object_ptr<Ui::RpWidget> Controller::createDescriptionEdit() {
&_peer->session());
result->entity()->submits(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
submitDescription();
}, result->entity()->lifetime());
@@ -893,7 +893,7 @@ void Controller::showEditPeerTypeBox(
_typeDataSavedValue,
error));
box->boxClosing(
) | rpl::start_with_next([peer = _peer] {
) | rpl::on_next([peer = _peer] {
peer->session().api().usernames().requestToCache(peer);
}, box->lifetime());
}
@@ -1242,12 +1242,12 @@ void Controller::fillAutoTranslateButton() {
.data = Ui::AskBoostAutotranslate{ .requiredLevel = requiredLevel },
};
state->isLocked.value() | rpl::start_with_next([=](bool locked) {
state->isLocked.value() | rpl::on_next([=](bool locked) {
autotranslate->setToggleLocked(locked);
}, autotranslate->lifetime());
autotranslate->toggledChanges(
) | rpl::start_with_next([=](bool value) {
) | rpl::on_next([=](bool value) {
if (!state->isLocked.current()) {
_autotranslateSavedValue = value;
} else if (value) {
@@ -1269,7 +1269,7 @@ void Controller::fillAutoTranslateButton() {
}, autotranslate->lifetime());
autotranslate->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
_autotranslateSavedValue = toggled;
}, _controls.buttonsLayout->lifetime());
}
@@ -1306,12 +1306,12 @@ void Controller::fillSignaturesButton() {
profiles->entity()->toggleOn(rpl::single(
channel->addsSignature() && channel->signatureProfiles()
))->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
_signatureProfilesSavedValue = toggled;
}, profiles->entity()->lifetime());
signs->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
_signaturesSavedValue = toggled;
if (!toggled) {
_signatureProfilesSavedValue = false;
@@ -1782,7 +1782,7 @@ void Controller::fillPendingRequestsButton() {
{ &st::menuIconInvite });
std::move(
pendingRequestsCount
) | rpl::start_with_next([=](int count) {
) | rpl::on_next([=](int count) {
wrap->toggle(count > 0, anim::type::instant);
}, wrap->lifetime());
}
@@ -1878,7 +1878,7 @@ void Controller::fillBotCurrencyButton() {
const auto currencyLoad
= button->lifetime().make_state<Api::EarnStatistics>(_peer);
currencyLoad->request(
) | rpl::start_with_error_done([=](const QString &error) {
) | rpl::on_error_done([=](const QString &error) {
}, [=] {
const auto balance = currencyLoad->data().currentBalance;
if (balance) {
@@ -1891,13 +1891,13 @@ void Controller::fillBotCurrencyButton() {
const auto icon = Ui::CreateChild<Ui::RpWidget>(button);
icon->resize(st::menuIconLinks.size());
const auto image = Ui::Earn::MenuIconCurrency(icon->size());
icon->paintRequest() | rpl::start_with_next([=] {
icon->paintRequest() | rpl::on_next([=] {
auto p = QPainter(icon);
p.drawImage(0, 0, image);
}, icon->lifetime());
button->sizeValue(
) | rpl::start_with_next([=](const QSize &size) {
) | rpl::on_next([=](const QSize &size) {
icon->moveToLeft(
button->st().iconLeft,
(size.height() - icon->height()) / 2);
@@ -1947,13 +1947,13 @@ void Controller::fillBotCreditsButton() {
const auto icon = Ui::CreateChild<Ui::RpWidget>(button);
const auto image = Ui::Earn::MenuIconCredits();
icon->resize(image.size() / style::DevicePixelRatio());
icon->paintRequest() | rpl::start_with_next([=] {
icon->paintRequest() | rpl::on_next([=] {
auto p = QPainter(icon);
p.drawImage(0, 0, image);
}, icon->lifetime());
button->sizeValue(
) | rpl::start_with_next([=](const QSize &size) {
) | rpl::on_next([=](const QSize &size) {
icon->moveToLeft(
button->st().iconLeft,
(size.height() - icon->height()) / 2);
@@ -2302,7 +2302,7 @@ void Controller::saveUsernamesOrder() {
_peer->session().api().usernames().reorder(
_peer,
newUsernames
) | rpl::start_with_done([=] {
) | rpl::on_done([=] {
channel->setUsernames(ranges::views::all(
newUsernames
) | ranges::views::transform([&](QString username) {
@@ -2875,7 +2875,7 @@ void EditPeerInfoBox::prepare() {
this,
_peer);
_focusRequests.events(
) | rpl::start_with_next(
) | rpl::on_next(
[=] { controller->setFocus(); },
lifetime());
auto content = controller->createContent();
@@ -2939,7 +2939,7 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
rpl::duplicate(text),
std::move(labelText),
button->widthValue()
) | rpl::start_with_next([&st, label](
) | rpl::on_next([&st, label](
const QString &text,
const TextWithEntities &labelText,
int width) {
@@ -2961,7 +2961,7 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
std::move(text),
label->widthValue(),
button->widthValue()
) | rpl::start_with_next([=](
) | rpl::on_next([=](
const QString &text,
int labelWidth,
int width) {

View File

@@ -379,11 +379,11 @@ void QrBox(
const auto button = Ui::CreateChild<Ui::AbstractButton>(container);
button->resize(size, size);
button->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
QPainter(button).drawImage(QRect(0, 0, size, size), qr);
}, button->lifetime());
container->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
button->move((width - size) / 2, st::inviteLinkQrSkip);
}, button->lifetime());
button->setClickedCallback(copyCallback);
@@ -506,7 +506,7 @@ void Controller::addHeaderBlock(not_null<Ui::VerticalLayout*> container) {
st::inviteLinkFieldPadding);
label->clicks(
) | rpl::start_with_next(copyLink, label->lifetime());
) | rpl::on_next(copyLink, label->lifetime());
const auto reactivateWrap = container->add(
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
@@ -566,7 +566,7 @@ void Controller::addHeaderBlock(not_null<Ui::VerticalLayout*> container) {
Ui::AddSkip(container);
dataValue(
) | rpl::start_with_next([=](const LinkData &data) {
) | rpl::on_next([=](const LinkData &data) {
const auto now = base::unixtime::now();
const auto expired = IsExpiredLink(data, now);
reactivateWrap->toggle(
@@ -641,7 +641,7 @@ not_null<Ui::SlideWrap<>*> Controller::addRequestedListBlock(
controller->setDelegate(delegate);
controller->processed(
) | rpl::start_with_next([=](Processed processed) {
) | rpl::on_next([=](Processed processed) {
updateWithProcessed(processed);
}, lifetime());
@@ -755,7 +755,7 @@ void Controller::setupAboveJoinedWidget() {
const auto currency = u"USD"_q;
const auto allCredits = current.subscription.credits * current.usage;
widget->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = Painter(widget);
p.setBrush(Qt::NoBrush);
p.setPen(st.nameFg);
@@ -864,7 +864,7 @@ void Controller::setupAboveJoinedWidget() {
std::move(remainingText),
st::inviteLinkTitleRight);
dataValue(
) | rpl::start_with_next([=](const LinkData &data) {
) | rpl::on_next([=](const LinkData &data) {
remaining->setTextColorOverride(
(data.usageLimit && (data.usageLimit <= data.usage)
? std::make_optional(st::boxTextFgError->c)
@@ -882,7 +882,7 @@ void Controller::setupAboveJoinedWidget() {
listTitle->positionValue(),
remaining->widthValue(),
listHeader->widthValue()
) | rpl::start_with_next([=](
) | rpl::on_next([=](
QPoint position,
int width,
int outerWidth) {
@@ -1006,7 +1006,7 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
style::al_top);
session->credits().rateValue(
channel
) | rpl::start_with_next([=, currency = u"USD"_q](float64 rate) {
) | rpl::on_next([=, currency = u"USD"_q](float64 rate) {
subtitle2->setText(
tr::lng_credits_subscriber_subtitle(
tr::now,
@@ -1169,7 +1169,7 @@ void SingleRowController::prepare() {
if (_status) {
std::move(
_status
) | rpl::start_with_next([=](const QString &status) {
) | rpl::on_next([=](const QString &status) {
raw->setCustomStatus(status);
delegate()->peerListUpdateRow(raw);
}, _lifetime);
@@ -1178,7 +1178,7 @@ void SingleRowController::prepare() {
delegate()->peerListRefreshRows();
if (topic) {
topic->destroyed() | rpl::start_with_next([=] {
topic->destroyed() | rpl::on_next([=] {
while (delegate()->peerListFullRowsCount()) {
delegate()->peerListRemoveRow(delegate()->peerListRowAt(0));
}
@@ -1275,7 +1275,7 @@ void AddPermanentLinkBlock(
} else {
rpl::duplicate(
fromList
) | rpl::start_with_next([=](const Api::InviteLink &link) {
) | rpl::on_next([=](const Api::InviteLink &link) {
*currentLinkFields = link;
}, container->lifetime());
@@ -1351,7 +1351,7 @@ void AddPermanentLinkBlock(
st::inviteLinkFieldPadding);
label->clicks(
) | rpl::start_with_next(copyLink, label->lifetime());
) | rpl::on_next(copyLink, label->lifetime());
AddCopyShareLinkButtons(container, copyLink, shareLink);
@@ -1388,7 +1388,7 @@ void AddPermanentLinkBlock(
data.link,
data.usage);
}) | rpl::flatten_latest(
) | rpl::start_with_next([=](const Api::JoinedByLinkSlice &slice) {
) | rpl::on_next([=](const Api::JoinedByLinkSlice &slice) {
auto list = std::vector<HistoryView::UserpicInRow>();
list.reserve(slice.users.size());
for (const auto &item : slice.users) {
@@ -1410,7 +1410,7 @@ void AddPermanentLinkBlock(
peer->session().downloaderTaskFinished(
) | rpl::filter([=] {
return !state->allUserpicsLoaded;
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
auto pushing = false;
state->allUserpicsLoaded = true;
for (const auto &element : state->list) {
@@ -1701,7 +1701,7 @@ object_ptr<Ui::BoxContent> ShowInviteLinkBox(
not_null<Ui::BoxContent*> box) {
rpl::duplicate(
data
) | rpl::start_with_next([=](const LinkData &link) {
) | rpl::on_next([=](const LinkData &link) {
if (ClosingLinkBox(link, revoked)) {
box->closeBox();
return;

View File

@@ -441,7 +441,7 @@ LinksController::LinksController(
, _count(count)
, _updateExpiringTimer([=] { expiringProgressTimer(); }) {
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
for (auto &image : _icons) {
image = QImage();
}
@@ -450,7 +450,7 @@ LinksController::LinksController(
peer->session().api().inviteLinks().updates(
peer,
admin
) | rpl::start_with_next([=](const Api::InviteLinkUpdate &update) {
) | rpl::on_next([=](const Api::InviteLinkUpdate &update) {
const auto now = base::unixtime::now();
if (!update.now || update.now->revoked != _revoked) {
if (removeRow(update.was)) {
@@ -472,7 +472,7 @@ LinksController::LinksController(
peer->session().api().inviteLinks().allRevokedDestroyed(
peer,
admin
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_requesting = false;
_allLoaded = true;
while (delegate()->peerListFullRowsCount()) {
@@ -961,7 +961,7 @@ void ManageInviteLinksBox(
*countValue = controller->fullCountValue();
controller->permanentFound(
) | rpl::start_with_next([=](InviteLinkData &&data) {
) | rpl::on_next([=](InviteLinkData &&data) {
permanentFromList->fire(std::move(data));
}, container->lifetime());
@@ -1013,7 +1013,7 @@ void ManageInviteLinksBox(
rpl::combine(
revokedHeader->topValue(),
container->widthValue()
) | rpl::start_with_next([=](int top, int outerWidth) {
) | rpl::on_next([=](int top, int outerWidth) {
deleteAll->moveToRight(
st::inviteLinkRevokedTitlePadding.left(),
top + st::inviteLinkRevokedTitlePadding.top(),
@@ -1027,7 +1027,7 @@ void ManageInviteLinksBox(
list->heightValue(),
admins->heightValue(),
revoked->heightValue()
) | rpl::start_with_next([=](int list, int admins, int revoked) {
) | rpl::on_next([=](int list, int admins, int revoked) {
if (otherHeader) {
otherHeader->toggle(list > 0, anim::type::instant);
}
@@ -1058,7 +1058,7 @@ object_ptr<Ui::SettingsButton> MakeCreateLinkButton(
icon->resize(size, size);
raw->heightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
const auto &st = st::inviteLinkList.item;
icon->move(
st.photoPosition.x() + (st.photoSize - size) / 2,
@@ -1066,7 +1066,7 @@ object_ptr<Ui::SettingsButton> MakeCreateLinkButton(
}, icon->lifetime());
icon->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(icon);
p.setPen(Qt::NoPen);
p.setBrush(st::windowBgActive);

View File

@@ -407,14 +407,14 @@ not_null<Ui::RpWidget*> AddInnerToggle(
{
const auto separator = Ui::CreateChild<Ui::RpWidget>(container.get());
separator->paintRequest(
) | rpl::start_with_next([=, bg = st.textBgOver] {
) | rpl::on_next([=, bg = st.textBgOver] {
auto p = QPainter(separator);
p.fillRect(separator->rect(), bg);
}, separator->lifetime());
const auto separatorHeight = 2 * st.toggle.border
+ st.toggle.diameter;
button->geometryValue(
) | rpl::start_with_next([=](const QRect &r) {
) | rpl::on_next([=](const QRect &r) {
const auto w = st::rightsButtonToggleWidth;
toggleButton->setGeometry(
r.x() + r.width() - w,
@@ -431,12 +431,12 @@ not_null<Ui::RpWidget*> AddInnerToggle(
const auto checkWidget = Ui::CreateChild<Ui::RpWidget>(toggleButton);
checkWidget->resize(checkView->getSize());
checkWidget->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(checkWidget);
checkView->paint(p, 0, 0, checkWidget->width());
}, checkWidget->lifetime());
toggleButton->sizeValue(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
checkWidget->moveToRight(
st.toggleSkip,
(s.height() - checkWidget->height()) / 2);
@@ -444,7 +444,7 @@ not_null<Ui::RpWidget*> AddInnerToggle(
}
state->anyChanges.events_starting_with(
rpl::empty_value()
) | rpl::map(countChecked) | rpl::start_with_next([=](int count) {
) | rpl::map(countChecked) | rpl::on_next([=](int count) {
checkView->setChecked(count > 0, anim::type::normal);
}, toggleButton->lifetime());
checkView->setLocked(locked.has_value());
@@ -471,7 +471,7 @@ not_null<Ui::RpWidget*> AddInnerToggle(
const auto &icon = st::permissionsExpandIcon;
arrow->resize(icon.size());
arrow->paintRequest(
) | rpl::start_with_next([=, &icon] {
) | rpl::on_next([=, &icon] {
auto p = QPainter(arrow);
const auto center = QPointF(
icon.width() / 2.,
@@ -489,7 +489,7 @@ not_null<Ui::RpWidget*> AddInnerToggle(
}, arrow->lifetime());
}
button->sizeValue(
) | rpl::start_with_next([=, &st](const QSize &s) {
) | rpl::on_next([=, &st](const QSize &s) {
const auto labelLeft = st.padding.left();
const auto labelRight = s.width() - toggleButton->width();
@@ -504,7 +504,7 @@ not_null<Ui::RpWidget*> AddInnerToggle(
(s.height() - arrow->height()) / 2);
}, button->lifetime());
wrap->toggledValue(
) | rpl::skip(1) | rpl::start_with_next([=](bool toggled) {
) | rpl::skip(1) | rpl::on_next([=](bool toggled) {
state->animation.start(
[=] { arrow->update(); },
toggled ? 0. : 1.,
@@ -521,14 +521,14 @@ not_null<Ui::RpWidget*> AddInnerToggle(
};
button->clicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (!handleLocked()) {
wrap->toggle(!wrap->toggled(), anim::type::normal);
}
}, button->lifetime());
toggleButton->clicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (!handleLocked()) {
const auto checked = !checkView->checked();
for (const auto &innerCheck : state->innerChecks) {
@@ -563,7 +563,7 @@ template <typename Flags>
});
state->forceDisabled.value(
) | rpl::start_with_next([=](bool disabled) {
) | rpl::on_next([=](bool disabled) {
if (disabled) {
for (const auto &[flags, checkView] : state->checkViews) {
checkView->setChecked(false, anim::type::normal);
@@ -629,7 +629,7 @@ template <typename Flags>
rpl::combine(
verticalLayout->widthValue(),
checkbox->geometryValue()
) | rpl::start_with_next([=](int w, const QRect &r) {
) | rpl::on_next([=](int w, const QRect &r) {
button->setGeometry(0, r.y(), w, r.height());
}, button->lifetime());
checkbox->setAttribute(Qt::WA_TransparentForMouseEvents);
@@ -659,12 +659,12 @@ template <typename Flags>
[=] { toggle->update(); });
toggle->resize(checkView->getSize());
toggle->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(toggle);
checkView->paint(p, 0, 0, toggle->width());
}, toggle->lifetime());
button->sizeValue(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
toggle->moveToRight(
st.toggleSkip,
(s.height() - toggle->height()) / 2);
@@ -680,7 +680,7 @@ template <typename Flags>
}();
state->checkViews.emplace(flags, checkView);
checkView->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
if (checked && state->forceDisabled.current()) {
if (!state->toast) {
state->toast = Ui::Toast::Show(container, {
@@ -742,7 +742,7 @@ template <typename Flags>
{ nestedWithLabel.nested.front().icon });
container->add(std::move(wrap));
container->widthValue(
) | rpl::start_with_next([=](int w) {
) | rpl::on_next([=](int w) {
raw->resizeToWidth(w);
}, raw->lifetime());
}
@@ -780,7 +780,7 @@ void AddSlowmodeLabels(
rpl::combine(
labels->widthValue(),
label->widthValue()
) | rpl::start_with_next([=](int outer, int inner) {
) | rpl::on_next([=](int outer, int inner) {
const auto skip = st::localStorageLimitMargin;
const auto size = st::localStorageLimitSlider.seekSize;
const auto available = outer
@@ -903,7 +903,7 @@ void AddBoostsUnrestrictLabels(not_null<Ui::VerticalLayout*> container) {
rpl::combine(
labels->widthValue(),
label->widthValue()
) | rpl::start_with_next([=](int outer, int inner) {
) | rpl::on_next([=](int outer, int inner) {
const auto skip = st::localStorageLimitMargin;
const auto size = st::localStorageLimitSlider.seekSize;
const auto available = outer
@@ -948,7 +948,7 @@ rpl::producer<int> AddBoostsUnrestrictSlider(
tr::lng_rights_boosts_no_restrict(),
st::defaultSettingsButton
))->toggleOn(rpl::duplicate(enabled))->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
if (toggled && !boostsUnrestrict->current()) {
*boostsUnrestrict = 1;
} else if (!toggled && boostsUnrestrict->current()) {

View File

@@ -235,7 +235,7 @@ void SetupOnlyCustomEmojiField(
const auto state = field->lifetime().make_state<State>();
field->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
state->pending = true;
if (state->processing) {
return;
@@ -420,7 +420,7 @@ object_ptr<Ui::RpWidget> AddReactionsSelector(
applyFromState();
std::move(
args.paid
) | rpl::start_with_next([=](bool paid) {
) | rpl::on_next([=](bool paid) {
const auto id = Data::ReactionId::Paid();
if (paid && !ranges::contains(state->reactions, id)) {
state->reactions.insert(begin(state->reactions), id);
@@ -440,7 +440,7 @@ object_ptr<Ui::RpWidget> AddReactionsSelector(
using SelectorState = ReactionsSelectorState;
std::move(
args.stateValue
) | rpl::start_with_next([=](SelectorState value) {
) | rpl::on_next([=](SelectorState value) {
switch (value) {
case SelectorState::Active:
state->overlay = nullptr;
@@ -455,10 +455,10 @@ object_ptr<Ui::RpWidget> AddReactionsSelector(
case SelectorState::Disabled:
state->overlay = std::make_unique<Ui::RpWidget>(parent);
state->overlay->show();
raw->geometryValue() | rpl::start_with_next([=](QRect rect) {
raw->geometryValue() | rpl::on_next([=](QRect rect) {
state->overlay->setGeometry(rect);
}, state->overlay->lifetime());
state->overlay->paintRequest() | rpl::start_with_next([=](QRect clip) {
state->overlay->paintRequest() | rpl::on_next([=](QRect clip) {
auto color = st::boxBg->c;
color.setAlphaF(0.5);
QPainter(state->overlay.get()).fillRect(
@@ -472,7 +472,7 @@ object_ptr<Ui::RpWidget> AddReactionsSelector(
}
raw->setDisabled(true);
raw->focusedChanges(
) | rpl::start_with_next([=](bool focused) {
) | rpl::on_next([=](bool focused) {
if (focused) {
raw->parentWidget()->setFocus();
}
@@ -503,7 +503,7 @@ object_ptr<Ui::RpWidget> AddReactionsSelector(
st::emojiPanMinHeight);
panel->hide();
panel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
Data::InsertCustomEmoji(raw, data.document);
}, panel->lifetime());
@@ -540,7 +540,7 @@ object_ptr<Ui::RpWidget> AddReactionsSelector(
panel->toggleAnimated();
});
raw->geometryValue() | rpl::start_with_next([=](QRect geometry) {
raw->geometryValue() | rpl::on_next([=](QRect geometry) {
toggle->move(
geometry.x() + geometry.width() - toggle->width(),
geometry.y() + geometry.height() - toggle->height());
@@ -669,7 +669,7 @@ void EditAllowedReactionsBox(
if (enabled) {
enabled->toggleOn(rpl::single(optionInitial != Option::None));
enabled->toggledValue(
) | rpl::start_with_next([=](bool value) {
) | rpl::on_next([=](bool value) {
state->selectorState = value
? SelectorState::Active
: SelectorState::Disabled;
@@ -836,7 +836,7 @@ void EditAllowedReactionsBox(
left->sizeValue(),
center->sizeValue(),
right->sizeValue()
) | rpl::start_with_next([=](
) | rpl::on_next([=](
const QSize &s,
const QSize &leftSize,
const QSize &centerSize,
@@ -901,7 +901,7 @@ void EditAllowedReactionsBox(
st::manageGroupNoIconButton.button));
paid->toggleOn(state->paidEnabled.value());
paid->toggledValue(
) | rpl::start_with_next([=](bool value) {
) | rpl::on_next([=](bool value) {
state->paidEnabled = value;
}, paid->lifetime());
Ui::AddSkip(inner);

View File

@@ -234,7 +234,7 @@ void Controller::createContent() {
_controls.joinToWrite->toggleOn(
rpl::single(_dataSavedValue->joinToWrite)
)->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
_dataSavedValue->joinToWrite = toggled;
}, wrap->lifetime());
} else {
@@ -261,7 +261,7 @@ void Controller::createContent() {
_controls.requestToJoin->toggleOn(
rpl::single(_dataSavedValue->requestToJoin)
)->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
_dataSavedValue->requestToJoin = toggled;
}, wrap->lifetime());
@@ -287,7 +287,7 @@ void Controller::createContent() {
_controls.noForwards->toggleOn(
rpl::single(_dataSavedValue->noForwards)
)->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
_dataSavedValue->noForwards = toggled;
}, _wrap->lifetime());
Ui::AddSkip(_wrap.get());
@@ -441,11 +441,11 @@ object_ptr<Ui::RpWidget> Controller::createUsernameEdit() {
username,
_peer->session().createInternalLink(QString())));
_controls.usernameInput->heightValue(
) | rpl::start_with_next([placeholder](int height) {
) | rpl::on_next([placeholder](int height) {
placeholder->resize(placeholder->width(), height);
}, placeholder->lifetime());
placeholder->widthValue(
) | rpl::start_with_next([this](int width) {
) | rpl::on_next([this](int width) {
_controls.usernameInput->resize(
width,
_controls.usernameInput->height());
@@ -739,11 +739,11 @@ void EditPeerTypeBox::prepare() {
_useLocationPhrases,
_dataSavedValue);
controller->scrollToRequests(
) | rpl::start_with_next([=, raw = content.data()](int y) {
) | rpl::on_next([=, raw = content.data()](int y) {
scrollToY(raw->y() + y);
}, lifetime());
_focusRequests.events(
) | rpl::start_with_next(
) | rpl::on_next(
[=] {
controller->setFocusUsername();
if (_usernameError.has_value()) {

View File

@@ -131,7 +131,7 @@ UsernamesList::Row::Row(
_rightAction->setVisible(data.active);
sizeValue(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
_rightAction->moveToLeft(
s.width() - _rightAction->width() - st::inviteLinkThreeDotsSkip,
(s.height() - _rightAction->height()) / 2);
@@ -219,7 +219,7 @@ UsernamesList::UsernamesList(
peer->session().changes().peerFlagsValue(
peer,
Data::PeerUpdate::Flag::Usernames)
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
load();
}, lifetime());
}
@@ -227,7 +227,7 @@ UsernamesList::UsernamesList(
void UsernamesList::load() {
_loadLifetime = _peer->session().api().usernames().loadUsernames(
_peer
) | rpl::start_with_next([=](const Data::Usernames &usernames) {
) | rpl::on_next([=](const Data::Usernames &usernames) {
if (usernames.empty()) {
_container = nullptr;
resize(0, 0);
@@ -320,13 +320,13 @@ void UsernamesList::rebuild(const Data::Usernames &usernames) {
_toggleLifetime = api.usernames().reorder(
_peer,
order()
) | rpl::start_with_done([=] {
) | rpl::on_done([=] {
auto &api = _peer->session().api();
_toggleLifetime = api.usernames().toggle(
_peer,
username.username,
!username.active
) | rpl::start_with_error_done([=](
) | rpl::on_error_done([=](
Api::Usernames::Error error) {
if (error == Api::Usernames::Error::TooMuch) {
constexpr auto kMaxUsernames = 10.;
@@ -378,7 +378,7 @@ void UsernamesList::rebuild(const Data::Usernames &usernames) {
_reorder->start();
_reorder->updates(
) | rpl::start_with_next([=](Ui::VerticalLayoutReorder::Single data) {
) | rpl::on_next([=](Ui::VerticalLayoutReorder::Single data) {
using State = Ui::VerticalLayoutReorder::State;
if (data.state == State::Started) {
++_reordering;

View File

@@ -115,18 +115,18 @@ PeerShortInfoCover::PeerShortInfoCover(
std::move(
userpic
) | rpl::start_with_next([=](PeerShortInfoUserpic &&value) {
) | rpl::on_next([=](PeerShortInfoUserpic &&value) {
applyUserpic(std::move(value));
applyAdditionalStatus(value.additionalStatus);
}, lifetime());
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
refreshBarImages();
}, lifetime());
_widget->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(_widget.get());
paint(p);
}, lifetime());
@@ -478,7 +478,7 @@ void PeerShortInfoCover::applyUserpic(PeerShortInfoUserpic &&value) {
_videoStartPosition = value.videoStartPosition;
_videoInstance->lockPlayer();
_videoInstance->player().updates(
) | rpl::start_with_next_error([=](Update &&update) {
) | rpl::on_next_error([=](Update &&update) {
handleStreamingUpdate(std::move(update));
}, [=](Error &&error) {
handleStreamingError(std::move(error));
@@ -685,7 +685,7 @@ PeerShortInfoBox::PeerShortInfoBox(
_rows->add(_cover.takeOwned());
_scroll->scrolls(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_cover.setScrollTop(_scroll->scrollTop());
}, _cover.lifetime());
}
@@ -720,7 +720,7 @@ void PeerShortInfoBox::prepare() {
_topRoundBackground->resize(st::shortInfoWidth, st::boxRadius);
_topRoundBackground->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (const auto use = fillRoundedTopHeight()) {
const auto width = _topRoundBackground->width();
const auto top = _topRoundBackground->height() - use;
@@ -763,7 +763,7 @@ void PeerShortInfoBox::prepareRows() {
rpl::combine(
std::move(label),
std::move(text)
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_rows->resizeToWidth(st::shortInfoWidth);
}, _rows->lifetime());

View File

@@ -410,13 +410,13 @@ bool ProcessCurrent(
UpdateFlag::Photo | UpdateFlag::FullInfo
) | rpl::filter([=](const Data::PeerUpdate &update) {
return (update.flags & UpdateFlag::Photo) || state->waitingFull;
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
push();
}, lifetime);
rpl::duplicate(
slices
) | rpl::start_with_next([=](UserPhotosSlice &&slice) {
) | rpl::on_next([=](UserPhotosSlice &&slice) {
state->userSlice = std::move(slice);
push();
}, lifetime);
@@ -424,7 +424,7 @@ bool ProcessCurrent(
moveRequests->events(
) | rpl::filter([=] {
return (state->current.count > 1);
}) | rpl::start_with_next([=](int shift) {
}) | rpl::on_next([=](int shift) {
state->current.index = std::clamp(
((state->current.index + shift + state->current.count)
% state->current.count),
@@ -439,7 +439,7 @@ bool ProcessCurrent(
&& (state->photoView
? (!!state->photoView->image(Data::PhotoSize::Large))
: (!Ui::PeerUserpicLoading(state->userpicView)));
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
push();
}, lifetime);
@@ -472,16 +472,16 @@ object_ptr<Ui::BoxContent> PrepareShortInfoBox(
if (menuFiller) {
result->fillMenuRequests(
) | rpl::start_with_next([=](Ui::Menu::MenuCallback callback) {
) | rpl::on_next([=](Ui::Menu::MenuCallback callback) {
menuFiller(std::move(callback));
}, result->lifetime());
}
result->openRequests(
) | rpl::start_with_next(open, result->lifetime());
) | rpl::on_next(open, result->lifetime());
result->moveRequests(
) | rpl::start_with_next(userpic.move, result->lifetime());
) | rpl::on_next(userpic.move, result->lifetime());
return result;
}

View File

@@ -382,7 +382,7 @@ object_ptr<Ui::BoxContent> ReassignBoostSingleBox(
result->boxClosing() | rpl::filter([=] {
return !*reassigned;
}) | rpl::start_with_next(cancel, result->lifetime());
}) | rpl::on_next(cancel, result->lifetime());
return result;
}
@@ -551,7 +551,7 @@ object_ptr<Ui::BoxContent> ReassignBoostsBox(
const auto raw = controller.get();
auto initBox = [=](not_null<Ui::BoxContent*> box) {
raw->selectedValue(
) | rpl::start_with_next([=](std::vector<int> slots) {
) | rpl::on_next([=](std::vector<int> slots) {
box->clearButtons();
if (!slots.empty()) {
const auto sources = SourcesCount(to, from, slots);
@@ -567,7 +567,7 @@ object_ptr<Ui::BoxContent> ReassignBoostsBox(
box->boxClosing() | rpl::filter([=] {
return !*reassigned;
}) | rpl::start_with_next(cancel, box->lifetime());
}) | rpl::on_next(cancel, box->lifetime());
};
return Box<PeerListBox>(std::move(controller), std::move(initBox));
}
@@ -597,7 +597,7 @@ object_ptr<Ui::RpWidget> CreateUserpicsTransfer(
const auto state = raw->lifetime().make_state<State>();
std::move(
from
) | rpl::start_with_next([=](
) | rpl::on_next([=](
const std::vector<not_null<PeerData*>> &list) {
auto was = base::take(state->from);
auto buttons = base::take(state->buttons);
@@ -628,7 +628,7 @@ object_ptr<Ui::RpWidget> CreateUserpicsTransfer(
rpl::combine(
raw->widthValue(),
state->count.value()
) | rpl::start_with_next([=](int width, int count) {
) | rpl::on_next([=](int width, int count) {
const auto skip = st::boostReplaceUserpicsSkip;
const auto left = width - 2 * right->width() - skip;
const auto shift = std::min(
@@ -651,7 +651,7 @@ object_ptr<Ui::RpWidget> CreateUserpicsTransfer(
overlay->paintRequest(
) | rpl::filter([=] {
return !state->buttons.empty();
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
const auto outerw = overlay->width();
const auto ratio = style::DevicePixelRatio();
if (state->layer.size() != QSize(outerw, full) * ratio) {
@@ -737,7 +737,7 @@ object_ptr<Ui::RpWidget> CreateUserpicsWithMoreBadge(
const auto state = raw->lifetime().make_state<State>();
std::move(
peers
) | rpl::start_with_next([=, &st](
) | rpl::on_next([=, &st](
const std::vector<not_null<PeerData*>> &list) {
auto was = base::take(state->from);
auto buttons = base::take(state->buttons);
@@ -774,7 +774,7 @@ object_ptr<Ui::RpWidget> CreateUserpicsWithMoreBadge(
rpl::combine(
raw->widthValue(),
state->count.value()
) | rpl::start_with_next([=, &st](int width, int count) {
) | rpl::on_next([=, &st](int width, int count) {
const auto single = st.button.size.width();
const auto left = width - single;
const auto used = std::min(count, int(state->buttons.size()));
@@ -793,7 +793,7 @@ object_ptr<Ui::RpWidget> CreateUserpicsWithMoreBadge(
overlay->paintRequest(
) | rpl::filter([=] {
return !state->buttons.empty();
}) | rpl::start_with_next([=, &st] {
}) | rpl::on_next([=, &st] {
const auto outerw = overlay->width();
const auto ratio = style::DevicePixelRatio();
if (state->layer.size() != QSize(outerw, full) * ratio) {
@@ -986,7 +986,7 @@ object_ptr<Ui::RpWidget> CreateGiftTransfer(
overlay->update();
raw->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
const auto skip = st::boostReplaceUserpicsSkip;
const auto total = right->width() + skip + right->width();
auto x = (width - total) / 2;
@@ -997,7 +997,7 @@ object_ptr<Ui::RpWidget> CreateGiftTransfer(
}, raw->lifetime());
overlay->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto outerw = overlay->width();
const auto ratio = style::DevicePixelRatio();
if (state->layer.size() != QSize(outerw, full) * ratio) {

View File

@@ -83,7 +83,7 @@ LayoutButton::LayoutButton(
group->setValue(type);
iconAnimate(anim::repeat::once);
});
group->value() | rpl::start_with_next([=](LayoutType value) {
group->value() | rpl::on_next([=](LayoutType value) {
const auto active = (value == type);
_text.setTextColorOverride(active
? st::windowFgActive->c
@@ -99,7 +99,7 @@ LayoutButton::LayoutButton(
}, _active ? 0. : 1., _active ? 0. : 1., st::fadeWrapDuration);
}, lifetime());
_text.paintRequest() | rpl::start_with_next([=](QRect clip) {
_text.paintRequest() | rpl::on_next([=](QRect clip) {
if (_active) {
auto p = QPainter(&_text);
auto hq = PainterHighQualityEnabler(p);
@@ -197,7 +197,7 @@ void ToggleTopicsBox(
group);
buttons->resize(container->width(), tabsButton->height());
buttons->widthValue() | rpl::start_with_next([=](int outer) {
buttons->widthValue() | rpl::on_next([=](int outer) {
const auto skip = st::boxRowPadding.left() - st::boxRadius;
tabsButton->moveToLeft(skip, 0, outer);
listButton->moveToRight(skip, 0, outer);
@@ -209,7 +209,7 @@ void ToggleTopicsBox(
layoutWrap->toggle(enabled, anim::type::instant);
toggle->toggledChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
layoutWrap->toggle(checked, anim::type::normal);
}, layoutWrap->lifetime());

View File

@@ -183,7 +183,7 @@ void Controller::confirmAdd(not_null<PeerData*> peer) {
Ui::AddSkip(box->verticalLayout());
field->changes() | rpl::start_with_next([=] {
field->changes() | rpl::on_next([=] {
state->description = field->getLastText();
}, field->lifetime());

View File

@@ -596,12 +596,12 @@ void ChannelsLimitBox(
using namespace rpl::mappers;
controller->countValue(
) | rpl::filter(_1 > 0) | rpl::start_with_next([=] {
) | rpl::filter(_1 > 0) | rpl::on_next([=] {
delete placeholder;
}, placeholder->lifetime());
delegate->selectedCountChanges(
) | rpl::start_with_next([=](int count) {
) | rpl::on_next([=](int count) {
const auto leave = [=](const base::flat_set<PeerListRowId> &ids) {
for (const auto rowId : ids) {
const auto id = peerToChannel(PeerId(rowId));
@@ -687,7 +687,7 @@ void PublicLinksLimitBox(
using namespace rpl::mappers;
controller->countValue(
) | rpl::filter(_1 > 0) | rpl::start_with_next([=] {
) | rpl::filter(_1 > 0) | rpl::on_next([=] {
delete placeholder;
}, placeholder->lifetime());
}
@@ -1162,7 +1162,7 @@ void AccountsLimitBox(
return;
}
*switchingLifetime = session->domain().activeSessionChanges(
) | rpl::start_with_next([=](Main::Session *session) mutable {
) | rpl::on_next([=](Main::Session *session) mutable {
if (session) {
Settings::ShowPremium(session, ref);
}

View File

@@ -245,7 +245,7 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
const auto raw = result.data();
raw->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(raw);
p.drawImage(0, 0, back);
}, raw->lifetime());
@@ -269,7 +269,7 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
result->show();
parent->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
result->setGeometry(QRect(
QPoint(
(size.width() - effectSize.width()) / 2,
@@ -323,8 +323,8 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
result->update();
};
auto &lifetime = result->lifetime();
state->lottie->updates() | rpl::start_with_next(update, lifetime);
state->effect->updates() | rpl::start_with_next(update, lifetime);
state->lottie->updates() | rpl::on_next(update, lifetime);
state->effect->updates() | rpl::on_next(update, lifetime);
};
createLottieIfReady();
if (!state->lottie || !state->effect) {
@@ -341,7 +341,7 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
rpl::never<>());
result->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
createLottieIfReady();
auto p = QPainter(result);
@@ -399,7 +399,7 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
result->show();
parent->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
result->setGeometry(QRect(QPoint(), size));
}, result->lifetime());
auto &lifetime = result->lifetime();
@@ -425,7 +425,7 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
outer->show();
result->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
outer->resize(size);
}, outer->lifetime());
@@ -495,7 +495,7 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
result->shownValue(
) | rpl::filter([=](bool shown) {
return shown && state->toggleTimerPending;
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
state->toggleTimerPending = false;
state->toggleTimer.callOnce(kToggleStickerTimeout);
}, result->lifetime());
@@ -515,7 +515,7 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
fill();
if (state->medias.empty()) {
premium->stickersUpdated(
) | rpl::take(1) | rpl::start_with_next(fill, lifetime);
) | rpl::take(1) | rpl::on_next(fill, lifetime);
}
return result;
@@ -637,7 +637,7 @@ struct VideoPreviewDocument {
result->show();
parent->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
result->setGeometry(parent->rect());
}, result->lifetime());
auto &lifetime = result->lifetime();
@@ -707,7 +707,7 @@ struct VideoPreviewDocument {
}
};
state->instance.player().updates(
) | rpl::start_with_next_error([=](Media::Streaming::Update &&update) {
) | rpl::on_next_error([=](Media::Streaming::Update &&update) {
if (v::is<Media::Streaming::Information>(update.data)
|| v::is<Media::Streaming::UpdateVideo>(update.data)) {
if (!state->readyInvoked && readyCallback) {
@@ -727,7 +727,7 @@ struct VideoPreviewDocument {
});
result->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(result);
const auto paintFrame = [&](QColor color, float64 thickness) {
auto hq = PainterHighQualityEnabler(p);
@@ -799,7 +799,7 @@ struct VideoPreviewDocument {
result->show();
parent->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
result->setGeometry(QRect(QPoint(), size));
}, result->lifetime());
auto &lifetime = result->lifetime();
@@ -825,7 +825,7 @@ struct VideoPreviewDocument {
create();
if (!state->single) {
session->api().premium().videosUpdated(
) | rpl::take(1) | rpl::start_with_next(create, lifetime);
) | rpl::take(1) | rpl::on_next(create, lifetime);
}
return result;
@@ -874,7 +874,7 @@ struct VideoPreviewDocument {
const auto section = order[i];
const auto button = Ui::CreateChild<Ui::AbstractButton>(raw);
parent->widthValue(
) | rpl::start_with_next([=](int outer) {
) | rpl::on_next([=](int outer) {
const auto full = width * count;
const auto left = (outer - full) / 2 + (i * width);
button->setGeometry(left, 0, width, height);
@@ -883,7 +883,7 @@ struct VideoPreviewDocument {
*selected = section;
});
button->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(button);
auto hq = PainterHighQualityEnabler(p);
p.setBrush((selected->current() == section)
@@ -896,7 +896,7 @@ struct VideoPreviewDocument {
button->rect().marginsRemoved(st::premiumDotPadding));
}, button->lifetime());
selected->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
button->update();
}, button->lifetime());
}
@@ -1021,7 +1021,7 @@ void PreviewBox(
}
buttonsParent->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
const auto outerHeight = st::premiumPreviewHeight;
close->moveToRight(0, 0, width);
if (left) {
@@ -1072,7 +1072,7 @@ void PreviewBox(
state->selected.value(
) | rpl::combine_previous(
) | rpl::start_with_next([=](PremiumFeature was, PremiumFeature now) {
) | rpl::on_next([=](PremiumFeature was, PremiumFeature now) {
const auto animationCallback = [=] {
if (!state->animation.animating()) {
for (const auto &hiding : base::take(state->hiding)) {
@@ -1235,13 +1235,13 @@ void PreviewBox(
if (descriptor.fromSettings) {
Data::AmPremiumValue(
&show->session()
) | rpl::skip(1) | rpl::start_with_next([=] {
) | rpl::skip(1) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
}
box->events(
) | rpl::start_with_next([=](not_null<QEvent*> e) {
) | rpl::on_next([=](not_null<QEvent*> e) {
if (e->type() == QEvent::KeyPress) {
const auto key = static_cast<QKeyEvent*>(e.get())->key();
if (key == Qt::Key_Left) {
@@ -1253,7 +1253,7 @@ void PreviewBox(
}, box->lifetime());
if (const auto &hidden = descriptor.hiddenCallback) {
box->boxClosing() | rpl::start_with_next(hidden, box->lifetime());
box->boxClosing() | rpl::on_next(hidden, box->lifetime());
}
}
@@ -1299,13 +1299,13 @@ void DecorateListPromoBox(
if (!descriptor.hideSubscriptionButton) {
Data::AmPremiumValue(
session
) | rpl::skip(1) | rpl::start_with_next([=] {
) | rpl::skip(1) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
}
if (const auto &hidden = descriptor.hiddenCallback) {
box->boxClosing() | rpl::start_with_next(hidden, box->lifetime());
box->boxClosing() | rpl::on_next(hidden, box->lifetime());
}
if (session->premium() || descriptor.hideSubscriptionButton) {
@@ -1325,7 +1325,7 @@ void DecorateListPromoBox(
box->setStyle(st::premiumPreviewDoubledLimitsBox);
box->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
const auto &padding
= st::premiumPreviewDoubledLimitsBox.buttonPadding;
button->resizeToWidth(width
@@ -1764,7 +1764,7 @@ object_ptr<Ui::GradientButton> CreateUnlockButton(
rpl::combine(
result->widthValue(),
label->widthValue()
) | rpl::start_with_next([=](int outer, int width) {
) | rpl::on_next([=](int outer, int width) {
label->moveToLeft(
(outer - width) / 2,
st::premiumPreviewBox.button.textTop,

View File

@@ -118,7 +118,7 @@ void AddMessage(
widget->widthValue(
) | rpl::filter(
rpl::mappers::_1 >= (st::historyMinimalWidth / 2)
) | rpl::start_with_next(updateWidgetSize, widget->lifetime());
) | rpl::on_next(updateWidgetSize, widget->lifetime());
updateWidgetSize(width);
const auto rightSize = st::settingsReactionCornerSize;
@@ -135,7 +135,7 @@ void AddMessage(
};
widget->paintRequest(
) | rpl::start_with_next([=](const QRect &rect) {
) | rpl::on_next([=](const QRect &rect) {
Window::SectionWidget::PaintBackground(
controller,
controller->defaultChatTheme().get(), // #TODO themes
@@ -173,7 +173,7 @@ void AddMessage(
auto selectedId = rpl::duplicate(idValue);
std::move(
selectedId
) | rpl::start_with_next([
) | rpl::on_next([
=,
idValue = std::move(idValue),
iconSize = st::settingsReactionMessageSize
@@ -242,14 +242,14 @@ not_null<Ui::RpWidget*> AddReactionIconWrap(
std::move(
iconPositionValue
) | rpl::start_with_next([=](const QPoint &point) {
) | rpl::on_next([=](const QPoint &point) {
widget->moveToLeft(point.x(), point.y());
}, widget->lifetime());
const auto update = crl::guard(widget, [=] { widget->update(); });
widget->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(widget);
if (state->finalAnimation.animating()) {
@@ -269,7 +269,7 @@ not_null<Ui::RpWidget*> AddReactionIconWrap(
std::move(
destroys
) | rpl::take(1) | rpl::start_with_next([=, from = 0., to = 1.] {
) | rpl::take(1) | rpl::on_next([=, from = 0., to = 1.] {
state->finalAnimation.start(
[=](float64 value) {
update();
@@ -316,7 +316,7 @@ void AddReactionAnimatedIcon(
state->select.media->checkStickerLarge();
rpl::single() | rpl::then(
reaction.appearAnimation->session().downloaderTaskFinished()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto check = [&](State::Entry &entry) {
if (!entry.media) {
return true;
@@ -367,7 +367,7 @@ void AddReactionAnimatedIcon(
std::move(
selects
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto select = state->select.icon.get();
if (select && !select->animating()) {
select->animate(crl::guard(widget, [=] { widget->update(); }));
@@ -445,7 +445,7 @@ void ReactionsSettingsBox(
check->resize(st::settingsReactionCornerSize);
check->setAttribute(Qt::WA_TransparentForMouseEvents);
check->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Painter p(check);
st::mediaPlayerMenuCheck.paintInCenter(p, check->rect());
}, check->lifetime());
@@ -510,7 +510,7 @@ void ReactionsSettingsBox(
firstCheckedButton->geometryValue(
) | rpl::filter([=](const QRect &r) {
return r.isValid();
}) | rpl::take(1) | rpl::start_with_next([=] {
}) | rpl::take(1) | rpl::on_next([=] {
checkButton(firstCheckedButton);
}, firstCheckedButton->lifetime());
}

View File

@@ -162,7 +162,7 @@ void ShowReportMessageBox(
RectPart::Top | RectPart::Bottom);
background->lower();
widget->sizeValue(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
background->resize(s);
}, background->lifetime());
}
@@ -183,7 +183,7 @@ void ShowReportMessageBox(
repeatRequest(repeatRequest, std::move(copy));
};
details->submits(
) | rpl::start_with_next(submit, details->lifetime());
) | rpl::on_next(submit, details->lifetime());
box->addButton(tr::lng_report_button(), submit);
} else {
box->addButton(

View File

@@ -72,7 +72,7 @@ AudioCreator::AudioCreator()
});
base::timer_each(
kNoDetachTimeout
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Media::Audio::StopDetachIfNotUsedSafe();
}, _lifetime);
}
@@ -210,7 +210,7 @@ void RingtonesBox(
};
session->api().ringtones().uploadFails(
) | rpl::start_with_next([=](const QString &error) {
) | rpl::on_next([=](const QString &error) {
if ((error == u"RINGTONE_DURATION_TOO_LONG"_q)) {
box->getDelegate()->show(Ui::MakeInformBox(
tr::lng_ringtones_error_max_duration(
@@ -274,10 +274,10 @@ void RingtonesBox(
};
session->api().ringtones().listUpdates(
) | rpl::start_with_next(rebuild, container->lifetime());
) | rpl::on_next(rebuild, container->lifetime());
session->api().ringtones().uploadDones(
) | rpl::start_with_next([=](DocumentId id) {
) | rpl::on_next([=](DocumentId id) {
state->chosen = Data::NotifySound{ .id = id };
rebuild();
}, container->lifetime());

View File

@@ -48,7 +48,7 @@ void AddDeleteAccount(
session->api().cloudPassword().state(
) | rpl::take(
1
) | rpl::start_with_next([=](const Core::CloudPasswordState &state) {
) | rpl::on_next([=](const Core::CloudPasswordState &state) {
auto fields = PasscodeBox::CloudFields::From(state);
fields.customTitle = tr::lng_settings_destroy_title();
fields.customDescription = tr::lng_context_mark_read_all_sure_2(
@@ -117,7 +117,7 @@ SelfDestructionBox::SelfDestructionBox(
preloaded
) | rpl::take(
1
) | rpl::start_with_next([=](int days) {
) | rpl::on_next([=](int days) {
gotCurrent(days);
}, lifetime());
}

View File

@@ -125,7 +125,7 @@ void AddTerms(
.shadowIgnoreTopSkip = stBox.shadowIgnoreTopSkip,
.shadowIgnoreBottomSkip = stBox.shadowIgnoreBottomSkip,
});
button->geometryValue() | rpl::start_with_next([=](const QRect &rect) {
button->geometryValue() | rpl::on_next([=](const QRect &rect) {
terms->resizeToWidth(box->width()
- rect::m::sum::h(st::boxRowPadding));
terms->moveToLeft(
@@ -266,7 +266,7 @@ void AddTerms(
const auto radius = smaller.height() / 2.;
widget->resize(size);
widget->paintRequest() | rpl::start_with_next([=] {
widget->paintRequest() | rpl::on_next([=] {
auto p = QPainter(widget);
auto hq = PainterHighQualityEnabler(p);
p.setPen(QPen(st::premiumButtonFg, st::chatGiveawayBadgeStroke * 1.));
@@ -331,13 +331,13 @@ void SendCreditsBox(
ministars->setColorOverride(Ui::Premium::CreditsIconGradientStops());
ministarsContainer->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(ministarsContainer);
ministars->paint(p);
}, ministarsContainer->lifetime());
box->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
ministarsContainer->resize(width, fullHeight);
const auto w = fullHeight / 3 * 2;
ministars->setCenter(QRect(
@@ -354,7 +354,7 @@ void SendCreditsBox(
thumb->setAttribute(Qt::WA_TransparentForMouseEvents);
if (form->invoice.subscriptionPeriod) {
const auto badge = SendCreditsBadge(content, form->invoice.amount);
thumb->geometryValue() | rpl::start_with_next([=](const QRect &r) {
thumb->geometryValue() | rpl::on_next([=](const QRect &r) {
badge->moveToLeft(
r.x() + (r.width() - badge->width()) / 2,
rect::bottom(r) - badge->height() / 2);
@@ -420,7 +420,7 @@ void SendCreditsBox(
if (id == u"BOT_PRECHECKOUT_FAILED"_q) {
auto error = ::Ui::MakeInformBox(
tr::lng_payments_precheckout_stars_failed(tr::now));
error->boxClosing() | rpl::start_with_next([=] {
error->boxClosing() | rpl::on_next([=] {
if (const auto paybox = weak.get()) {
paybox->closeBox();
}
@@ -469,7 +469,7 @@ void SendCreditsBox(
content,
st::boxTitleClose);
close->setClickedCallback([=] { box->closeBox(); });
content->widthValue() | rpl::start_with_next([=](int) {
content->widthValue() | rpl::on_next([=](int) {
close->moveToRight(0, 0);
}, close->lifetime());
}
@@ -484,7 +484,7 @@ void SendCreditsBox(
rpl::combine(
balance->sizeValue(),
content->sizeValue()
) | rpl::start_with_next([=](const QSize &, const QSize &) {
) | rpl::on_next([=](const QSize &, const QSize &) {
balance->moveToLeft(
st::creditsHistoryRightSkip * 2,
st::creditsHistoryRightSkip);
@@ -520,17 +520,17 @@ not_null<FlatLabel*> SetButtonMarkedLabel(
text
) | rpl::filter([=](const TextWithEntities &text) {
return !text.text.isEmpty();
}) | rpl::start_with_next([=](const TextWithEntities &text) {
}) | rpl::on_next([=](const TextWithEntities &text) {
buttonLabel->setMarkedText(text, context);
}, buttonLabel->lifetime());
if (textFg) {
buttonLabel->setTextColorOverride((*textFg)->c);
style::PaletteChanged() | rpl::start_with_next([=] {
style::PaletteChanged() | rpl::on_next([=] {
buttonLabel->setTextColorOverride((*textFg)->c);
}, buttonLabel->lifetime());
}
button->sizeValue(
) | rpl::start_with_next([=](const QSize &size) {
) | rpl::on_next([=](const QSize &size) {
buttonLabel->moveToLeft(
(size.width() - buttonLabel->width()) / 2,
(size.height() - buttonLabel->height()) / 2);

View File

@@ -140,12 +140,12 @@ void EditPriceBox(
price ? QString::number(price) : QString(),
limit);
const auto field = owned.data();
wrap->widthValue() | rpl::start_with_next([=](int width) {
wrap->widthValue() | rpl::on_next([=](int width) {
field->move(0, 0);
field->resize(width, field->height());
wrap->resize(width, field->height());
}, wrap->lifetime());
field->paintRequest() | rpl::start_with_next([=](QRect clip) {
field->paintRequest() | rpl::on_next([=](QRect clip) {
auto p = QPainter(field);
st::paidStarIcon.paint(p, 0, st::paidStarIconTop, field->width());
}, field->lifetime());
@@ -574,7 +574,7 @@ void SendFilesBox::initPreview() {
_footerHeight.value(),
_titleHeight.value(),
_1 + _2 + _3
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
setDimensions(
st::boxWideWidth,
std::min(st::sendMediaPreviewHeightMax, height),
@@ -619,7 +619,7 @@ void SendFilesBox::prepare() {
SetupShadowsToScrollContent(this, _scroll, _inner->heightValue());
setCloseByOutsideClick(false);
boxClosing() | rpl::start_with_next([=] {
boxClosing() | rpl::on_next([=] {
if (!_confirmed && _cancelledCallback) {
_cancelledCallback();
}
@@ -838,7 +838,7 @@ void SendFilesBox::refreshPriceTag() {
const auto raw = _priceTag.get();
raw->show();
raw->paintRequest() | rpl::start_with_next([=] {
raw->paintRequest() | rpl::on_next([=] {
if (_priceTagBg.isNull()) {
_priceTagBg = preparePriceTagBg(raw->size());
}
@@ -860,17 +860,17 @@ void SendFilesBox::refreshPriceTag() {
st::paidTagLabel);
std::move(
text
) | rpl::start_with_next([=](const TextWithEntities &text) {
) | rpl::on_next([=](const TextWithEntities &text) {
label->setMarkedText(text);
}, label->lifetime());
label->show();
label->sizeValue() | rpl::start_with_next([=](QSize size) {
label->sizeValue() | rpl::on_next([=](QSize size) {
const auto inner = QRect(QPoint(), size);
const auto rect = inner.marginsAdded(st::paidTagPadding);
raw->resize(rect.size());
label->move(-rect.topLeft());
}, label->lifetime());
_inner->sizeValue() | rpl::start_with_next([=](QSize size) {
_inner->sizeValue() | rpl::on_next([=](QSize size) {
raw->move(
(size.width() - raw->width()) / 2,
(size.height() - raw->height()) / 2);
@@ -966,7 +966,7 @@ void SendFilesBox::initSendWay() {
return result;
}();
_sendWay.changes(
) | rpl::start_with_next([=](SendFilesWay value) {
) | rpl::on_next([=](SendFilesWay value) {
const auto hidden = [&] {
return !_caption || _caption->isHidden();
};
@@ -1082,7 +1082,7 @@ void SendFilesBox::pushBlock(int from, int till) {
block.itemDeleteRequest(
) | rpl::filter([=] {
return !_removingIndex;
}) | rpl::start_with_next([=](int index) {
}) | rpl::on_next([=](int index) {
applyBlockChanges();
_removingIndex = index;
@@ -1104,7 +1104,7 @@ void SendFilesBox::pushBlock(int from, int till) {
const auto show = uiShow();
block.itemReplaceRequest(
) | rpl::start_with_next([=](int index) {
) | rpl::on_next([=](int index) {
applyBlockChanges();
const auto replace = [=](Ui::PreparedList list) {
@@ -1181,7 +1181,7 @@ void SendFilesBox::pushBlock(int from, int till) {
const auto openedOnce = widget->lifetime().make_state<bool>(false);
block.itemModifyRequest(
) | rpl::start_with_next([=, show = _show](int index) {
) | rpl::on_next([=, show = _show](int index) {
applyBlockChanges();
if (!(*openedOnce)) {
@@ -1198,7 +1198,7 @@ void SendFilesBox::pushBlock(int from, int till) {
}, widget->lifetime());
block.itemEditCoverRequest(
) | rpl::start_with_next([=, show = _show](int index) {
) | rpl::on_next([=, show = _show](int index) {
applyBlockChanges();
const auto replace = [=](Ui::PreparedList list) {
@@ -1261,7 +1261,7 @@ void SendFilesBox::pushBlock(int from, int till) {
}, widget->lifetime());
block.itemClearCoverRequest(
) | rpl::start_with_next([=](int index) {
) | rpl::on_next([=](int index) {
applyBlockChanges();
refreshAllAfterChanges(from, [&] {
auto &entry = _list.files[index];
@@ -1269,7 +1269,7 @@ void SendFilesBox::pushBlock(int from, int till) {
});
}, widget->lifetime());
block.orderUpdated() | rpl::start_with_next([=]{
block.orderUpdated() | rpl::on_next([=]{
if (_priceTag) {
_priceTagBg = QImage();
_priceTag->update();
@@ -1302,13 +1302,13 @@ void SendFilesBox::setupSendWayControls() {
_st.files.check);
_sendWay.changes(
) | rpl::start_with_next([=](SendFilesWay value) {
) | rpl::on_next([=](SendFilesWay value) {
_groupFiles->setChecked(value.groupFiles());
_sendImagesAsPhotos->setChecked(value.sendImagesAsPhotos());
}, lifetime());
_groupFiles->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
auto sendWay = _sendWay.current();
if (sendWay.groupFiles() == checked) {
return;
@@ -1324,7 +1324,7 @@ void SendFilesBox::setupSendWayControls() {
}, lifetime());
_sendImagesAsPhotos->checkedChanges(
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
auto sendWay = _sendWay.current();
if (sendWay.sendImagesAsPhotos() == checked) {
return;
@@ -1349,7 +1349,7 @@ void SendFilesBox::setupSendWayControls() {
rpl::combine(
_groupFiles->checkedValue(),
_sendImagesAsPhotos->checkedValue()
) | rpl::start_with_next([=](bool groupFiles, bool asPhoto) {
) | rpl::on_next([=](bool groupFiles, bool asPhoto) {
_wayRemember->setVisible(
(groupFiles != groupFilesFirst) || (asPhoto != asPhotosFirst));
captionResized();
@@ -1439,18 +1439,18 @@ void SendFilesBox::setupCaption() {
_caption->setMaxLength(kMaxMessageLength);
_caption->heightChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
captionResized();
}, _caption->lifetime());
_caption->submits(
) | rpl::start_with_next([=](Qt::KeyboardModifiers modifiers) {
) | rpl::on_next([=](Qt::KeyboardModifiers modifiers) {
const auto ctrlShiftEnter = modifiers.testFlag(Qt::ShiftModifier)
&& (modifiers.testFlag(Qt::ControlModifier)
|| modifiers.testFlag(Qt::MetaModifier));
send({}, ctrlShiftEnter);
}, _caption->lifetime());
_caption->cancelled(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
closeBox();
}, _caption->lifetime());
_caption->setMimeDataHook([=](
@@ -1469,7 +1469,7 @@ void SendFilesBox::setupCaption() {
rpl::single(rpl::empty_value()) | rpl::then(
_caption->changes()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
checkCharsLimitation();
refreshMessagesCount();
}, _caption->lifetime());
@@ -1543,7 +1543,7 @@ void SendFilesBox::checkCharsLimitation() {
_charsLimitation->show();
Data::AmPremiumValue(
&_show->session()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
checkCharsLimitation();
}, _charsLimitation->lifetime());
}
@@ -1585,11 +1585,11 @@ void SendFilesBox::setupEmojiPanel() {
_emojiPanel->selector()->setAllowEmojiWithoutPremium(
_limits & SendFilesAllow::EmojiWithoutPremium);
_emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
Ui::InsertEmojiAtCursor(_caption->textCursor(), data.emoji);
}, lifetime());
_emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
const auto info = data.document->sticker();
if (info
&& info->setType == Data::StickersType::Emoji

View File

@@ -76,7 +76,7 @@ namespace {
Qt::KeepAspectRatio).height()),
st::boxRowPadding);
widget->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(widget);
if (state->gif && state->gif->started()) {
p.drawImage(
@@ -122,7 +122,7 @@ namespace {
};
if (!updateThumbnail()) {
document->session().downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (updateThumbnail()) {
state->loadingLifetime.destroy();
widget->update();
@@ -175,11 +175,11 @@ namespace {
emojiPanel->hide();
emojiPanel->selector()->setCurrentPeer(controller->session().user());
emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
Ui::InsertEmojiAtCursor(input->textCursor(), data.emoji);
}, input->lifetime());
emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
const auto info = data.document->sticker();
if (info
&& info->setType == Data::StickersType::Emoji
@@ -212,7 +212,7 @@ namespace {
emojiButton,
style::al_top);
state->charsLimitation->show();
Data::AmPremiumValue(session) | rpl::start_with_next([=] {
Data::AmPremiumValue(session) | rpl::on_next([=] {
repeat(repeat);
}, state->charsLimitation->lifetime());
}
@@ -223,7 +223,7 @@ namespace {
}
};
input->changes() | rpl::start_with_next([=] {
input->changes() | rpl::on_next([=] {
checkCharsLimitation(checkCharsLimitation);
}, input->lifetime());
@@ -342,7 +342,7 @@ void CaptionBox(
box->closeBox();
});
input->submits(
) | rpl::start_with_next([=] { send({}); }, input->lifetime());
) | rpl::on_next([=] { send({}); }, input->lifetime());
}
} // namespace
@@ -378,7 +378,7 @@ void EditCaptionBox(
state->fullId = view->data()->fullId();
data->itemIdChanged(
) | rpl::start_with_next([=](Data::Session::IdChange event) {
) | rpl::on_next([=](Data::Session::IdChange event) {
if (event.oldId == state->fullId.msg) {
state->fullId = event.newId;
}

View File

@@ -239,7 +239,7 @@ void ShareBox::prepareCommentField() {
(_bottomWidget
? _bottomWidget->heightValue()
: (rpl::single(0) | rpl::type_erased))
) | rpl::start_with_next([=](int height, int comment, int bottom) {
) | rpl::on_next([=](int height, int comment, int bottom) {
_comment->moveToLeft(0, height - bottom - comment);
if (_bottomWidget) {
_bottomWidget->moveToLeft(0, height - bottom);
@@ -249,7 +249,7 @@ void ShareBox::prepareCommentField() {
const auto field = _comment->entity();
field->submits(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
submit({});
}, field->lifetime());
@@ -263,7 +263,7 @@ void ShareBox::prepareCommentField() {
}
field->setSubmitSettings(Core::App().settings().sendSubmitWay());
field->changes() | rpl::start_with_next([=] {
field->changes() | rpl::on_next([=] {
if (!field->getLastText().isEmpty()) {
setCloseByOutsideClick(false);
} else if (_inner->selected().empty()) {
@@ -324,17 +324,17 @@ void ShareBox::prepare() {
(_bottomWidget
? _bottomWidget->heightValue()
: rpl::single(0) | rpl::type_erased)
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateScrollSkips();
}, _comment->lifetime());
_inner->searchRequests(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
needSearchByUsername();
}, _inner->lifetime());
_inner->scrollToRequests(
) | rpl::start_with_next([=](const Ui::ScrollToRequest &request) {
) | rpl::on_next([=](const Ui::ScrollToRequest &request) {
scrollTo(request);
}, _inner->lifetime());
@@ -368,11 +368,11 @@ void ShareBox::prepare() {
},
Window::GifPauseReason::Layer);
chatsFilters->lower();
chatsFilters->heightValue() | rpl::start_with_next([this](int h) {
chatsFilters->heightValue() | rpl::on_next([this](int h) {
updateScrollSkips();
scrollToY(0);
}, lifetime());
_select->heightValue() | rpl::start_with_next([=](int h) {
_select->heightValue() | rpl::on_next([=](int h) {
chatsFilters->moveToLeft(0, h);
}, chatsFilters->lifetime());
_chatsFilters = chatsFilters;
@@ -557,7 +557,7 @@ void ShareBox::showMenu(not_null<Ui::RpWidget*> parent) {
nullptr);
std::move(
text
) | rpl::start_with_next([action = item->action()](QString text) {
) | rpl::on_next([action = item->action()](QString text) {
action->setText(text);
}, item->lifetime());
item->init(checked);
@@ -620,7 +620,7 @@ void ShareBox::createButtons() {
send->setAcceptBoth();
send->clicks(
) | rpl::start_with_next([=](Qt::MouseButton button) {
) | rpl::on_next([=](Qt::MouseButton button) {
if (button == Qt::RightButton) {
showMenu(send);
}
@@ -708,7 +708,7 @@ void ShareBox::submit(Api::SendOptions options) {
if (!waiting.empty()) {
_descriptor.session->changes().peerUpdates(
Data::PeerUpdate::Flag::FullInfo
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
if (waiting.contains(update.peer)) {
withPaymentApproved(alreadyApproved);
}
@@ -718,7 +718,7 @@ void ShareBox::submit(Api::SendOptions options) {
_descriptor.session->credits().loadedValue(
) | rpl::filter(
rpl::mappers::_1
) | rpl::take(1) | rpl::start_with_next([=] {
) | rpl::take(1) | rpl::on_next([=] {
withPaymentApproved(alreadyApproved);
}, _submitLifetime);
}
@@ -830,7 +830,7 @@ ShareBox::Inner::Inner(
rpl::merge(
Data::AmPremiumValue(session) | rpl::to_empty,
session->api().premium().someMessageMoneyRestrictionsResolved()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
refreshRestrictedRows();
}, lifetime());
}
@@ -863,24 +863,24 @@ ShareBox::Inner::Inner(
_descriptor.session->changes().peerUpdates(
Data::PeerUpdate::Flag::Photo
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
updateChat(update.peer);
}, lifetime());
_descriptor.session->changes().realtimeNameUpdates(
) | rpl::start_with_next([=](const Data::NameUpdate &update) {
) | rpl::on_next([=](const Data::NameUpdate &update) {
_defaultChatsIndexed->peerNameChanged(
update.peer,
update.oldFirstLetters);
}, lifetime());
_descriptor.session->downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
update();
}, lifetime());
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
invalidateCache();
}, lifetime());
}
@@ -1388,7 +1388,7 @@ void ShareBox::Inner::chooseForumTopic(not_null<Data::Forum*> forum) {
Assert(!chat->topic);
chat->topic = topic;
chat->topic->destroyed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
changePeerCheckState(chat, false);
}, chat->topicLifetime);
updateChatName(chat);
@@ -1400,7 +1400,7 @@ void ShareBox::Inner::chooseForumTopic(not_null<Data::Forum*> forum) {
});
forum->destroyed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
};
@@ -1436,7 +1436,7 @@ void ShareBox::Inner::chooseMonoforumSublist(
Assert(!chat->sublist);
chat->sublist = sublist;
chat->sublist->destroyed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
changePeerCheckState(chat, false);
}, chat->sublistLifetime);
updateChatName(chat);
@@ -1448,7 +1448,7 @@ void ShareBox::Inner::chooseMonoforumSublist(
});
monoforum->destroyed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
};

View File

@@ -248,7 +248,7 @@ struct BidSliderValues {
const auto kHuge = u"99999"_q;
const auto userpicLeft = st::auctionBidPlace.style.font->width(kHuge);
std::move(data) | rpl::start_with_next([=](BidRowData bid) {
std::move(data) | rpl::on_next([=](BidRowData bid) {
state->place->setTextColorOverride(
BidColorOverride(bid.position, bid.winners));
if (state->user != bid.user) {
@@ -274,7 +274,7 @@ struct BidSliderValues {
rpl::combine(
raw->widthValue(),
state->stars->widthValue()
) | rpl::start_with_next([=](int outer, int stars) {
) | rpl::on_next([=](int outer, int stars) {
const auto userpicSize = st::auctionBidUserpic.size;
const auto top = (userpicSize.height() - st::normalFont->height) / 2;
state->place->moveToLeft(0, top, outer);
@@ -478,7 +478,7 @@ void AddBidPlaces(
rpl::duplicate(
value
) | rpl::start_with_next([=](const Data::GiftAuctionState &value) {
) | rpl::on_next([=](const Data::GiftAuctionState &value) {
auto cache = std::vector<Ui::PeerUserpicView>();
cache.reserve(value.topBidders.size());
for (const auto &user : value.topBidders) {
@@ -557,7 +557,7 @@ void AddBidPlaces(
const auto myLabel = AddSubsectionTitle(
box->verticalLayout(),
std::move(myLabelText));
state->my.value() | rpl::start_with_next([=](My my) {
state->my.value() | rpl::on_next([=](My my) {
myLabel->setTextColorOverride(
BidColorOverride(my.position, state->winners));
}, myLabel->lifetime());
@@ -707,7 +707,7 @@ void AuctionBidBox(not_null<GenericBox*> box, AuctionBidBoxArgs &&args) {
});
args.peer->owner().giftAuctionGots(
) | rpl::start_with_next([=](const Data::GiftAuctionGot &update) {
) | rpl::on_next([=](const Data::GiftAuctionGot &update) {
if (update.giftId == giftId) {
box->closeBox();
@@ -741,7 +741,7 @@ void AuctionBidBox(not_null<GenericBox*> box, AuctionBidBoxArgs &&args) {
const auto sliderWrap = content->add(
object_ptr<VerticalLayout>(content));
state->sliderValues.value(
) | rpl::start_with_next([=](const BidSliderValues &values) {
) | rpl::on_next([=](const BidSliderValues &values) {
const auto initial = !sliderWrap->count();
if (!initial) {
while (sliderWrap->count()) {
@@ -772,7 +772,7 @@ void AuctionBidBox(not_null<GenericBox*> box, AuctionBidBoxArgs &&args) {
activeFgOverride);
bubble->setAttribute(Qt::WA_TransparentForMouseEvents, false);
bubble->setClickedCallback(setCustom);
state->subtext.value() | rpl::start_with_next([=](QString &&text) {
state->subtext.value() | rpl::on_next([=](QString &&text) {
bubble->setSubtext(std::move(text));
}, bubble->lifetime());
@@ -789,7 +789,7 @@ void AuctionBidBox(not_null<GenericBox*> box, AuctionBidBoxArgs &&args) {
sliderWrap->resizeToWidth(st::boxWideWidth);
const auto custom = CreateChild<AbstractButton>(sliderWrap);
state->chosen.changes() | rpl::start_with_next([=] {
state->chosen.changes() | rpl::on_next([=] {
custom->update();
}, custom->lifetime());
custom->show();
@@ -805,7 +805,7 @@ void AuctionBidBox(not_null<GenericBox*> box, AuctionBidBoxArgs &&args) {
p.fillRect(rem, rem + sub, inner, stroke, color);
p.fillRect(rem + sub, rem + inner - sub, stroke, sub, color);
});
sliderWrap->sizeValue() | rpl::start_with_next([=](QSize size) {
sliderWrap->sizeValue() | rpl::on_next([=](QSize size) {
custom->move(
size.width() - st::boxRowPadding.right() - custom->width(),
size.height() - custom->height());
@@ -1124,7 +1124,7 @@ void AuctionBidBox(not_null<GenericBox*> box, AuctionBidBoxArgs &&args) {
rpl::mappers::_1 != 0
) | rpl::take(
1
) | rpl::start_with_next([=](int64 price) {
) | rpl::on_next([=](int64 price) {
delete round;
raw->insertRow(
@@ -1311,7 +1311,7 @@ void AuctionGotGiftsBox(
put();
base::timer_each(
kSwitchPreviewCoverInterval / 3
) | rpl::start_with_next(put, lifetime);
) | rpl::on_next(put, lifetime);
return lifetime;
};
@@ -1445,7 +1445,7 @@ void AuctionInfoBox(
return !list.models.empty();
}) | rpl::take(
1
) | rpl::start_with_next([=](const UniqueGiftAttributes &list) {
) | rpl::on_next([=](const UniqueGiftAttributes &list) {
auto emoji = tr::marked();
const auto indices = RandomIndicesSubset(list.models.size(), 3);
for (const auto index : indices) {
@@ -1488,7 +1488,7 @@ void AuctionInfoBox(
GiftTypeStars{ .info = *state->value.current().gift },
state->value.value()));
sendBox->boxClosing(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
});
@@ -1539,7 +1539,7 @@ base::weak_qptr<BoxContent> ChooseAndShowAuctionBox(
},
state->value()));
sendBox->boxClosing(
) | rpl::start_with_next(close, sendBox->lifetime());
) | rpl::on_next(close, sendBox->lifetime());
};
const auto from = current.my.to;
const auto text = (from->isSelf()
@@ -1591,7 +1591,7 @@ base::weak_qptr<BoxContent> ChooseAndShowAuctionBox(
}
if (const auto strong = box.get()) {
strong->boxClosing(
) | rpl::start_with_next(boxClosed, strong->lifetime());
) | rpl::on_next(boxClosed, strong->lifetime());
} else {
boxClosed();
}
@@ -1615,7 +1615,7 @@ rpl::lifetime ShowStarGiftAuction(
const auto state = std::make_shared<State>();
auto result = session->giftAuctions().state(
slug
) | rpl::start_with_next([=](Data::GiftAuctionState &&value) {
) | rpl::on_next([=](Data::GiftAuctionState &&value) {
if (const auto onstack = finishRequesting) {
onstack();
}
@@ -1952,7 +1952,7 @@ object_ptr<Ui::RpWidget> MakeActiveAuctionRow(
tag));
raw->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto q = QPainter(raw);
sticker->paint(q, {
.textColor = st::windowFg->c,
@@ -1989,7 +1989,7 @@ object_ptr<Ui::RpWidget> MakeActiveAuctionRow(
st::defaultPopupMenu,
helper.context()),
st::auctionListTextPadding);
rpl::duplicate(value) | rpl::start_with_next([=](const Single &fields) {
rpl::duplicate(value) | rpl::on_next([=](const Single &fields) {
const auto outbid = (fields.position > fields.winning);
subtitle->setTextColorOverride(outbid
? st::attentionButtonFg->c
@@ -2022,7 +2022,7 @@ object_ptr<Ui::RpWidget> MakeActiveAuctionRow(
window->showStarGiftAuction(slug);
});
button->setFullRadius(true);
raw->widthValue() | rpl::start_with_next([=](int width) {
raw->widthValue() | rpl::on_next([=](int width) {
button->setFullWidth(width);
}, button->lifetime());
@@ -2093,7 +2093,7 @@ Fn<void()> ActiveAuctionsCallback(
auctions->state(
now.slug
) | rpl::start_with_next([=](const GiftAuctionState &state) {
) | rpl::on_next([=](const GiftAuctionState &state) {
if (!state.my.bid) {
delete row;
if (const auto now = rows->current(); now > 1) {

View File

@@ -578,13 +578,13 @@ PreviewWrap::PreviewWrap(
using namespace HistoryView;
_history->owner().viewRepaintRequest(
) | rpl::start_with_next([=](not_null<const Element*> view) {
) | rpl::on_next([=](not_null<const Element*> view) {
if (view == _item.get()) {
update();
}
}, lifetime());
_history->session().downloaderTaskFinished() | rpl::start_with_next([=] {
_history->session().downloaderTaskFinished() | rpl::on_next([=] {
update();
}, lifetime());
@@ -654,7 +654,7 @@ void ShowSentToast(
Lottie::Quality::Default);
preview->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (!player->ready()) {
return;
}
@@ -668,7 +668,7 @@ void ShowSentToast(
}, preview->lifetime());
player->updates(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
preview->update();
}, preview->lifetime());
}
@@ -678,7 +678,7 @@ PreviewWrap::~PreviewWrap() {
}
void PreviewWrap::prepare(rpl::producer<GiftSendDetails> details) {
std::move(details) | rpl::start_with_next([=](GiftSendDetails details) {
std::move(details) | rpl::on_next([=](GiftSendDetails details) {
const auto &descriptor = details.descriptor;
const auto cost = v::match(descriptor, [&](GiftTypePremium data) {
const auto stars = (details.byStars && data.stars)
@@ -742,12 +742,12 @@ void PreviewWrap::prepare(rpl::producer<GiftSendDetails> details) {
widthValue(
) | rpl::filter([=](int width) {
return width >= st::msgMinWidth;
}) | rpl::start_with_next([=](int width) {
}) | rpl::on_next([=](int width) {
resizeTo(width);
}, lifetime());
_history->owner().itemResizeRequest(
) | rpl::start_with_next([=](not_null<const HistoryItem*> item) {
) | rpl::on_next([=](not_null<const HistoryItem*> item) {
if (_item && item == _item->data() && width() >= st::msgMinWidth) {
resizeTo(width());
}
@@ -807,7 +807,7 @@ void PreviewWrap::paintEvent(QPaintEvent *e) {
using namespace Api;
const auto api = std::make_shared<PremiumGiftCodeOptions>(peer);
api->request() | rpl::start_with_error_done([=](QString error) {
api->request() | rpl::on_error_done([=](QString error) {
consumer.put_next({});
}, [=] {
const auto &options = api->optionsForPeer();
@@ -975,7 +975,7 @@ struct GiftPriceTabs {
};
state->prices.value(
) | rpl::start_with_next([=](const std::vector<int> &prices) {
) | rpl::on_next([=](const std::vector<int> &prices) {
auto x = st::giftBoxTabsMargin.left();
auto y = st::giftBoxTabsMargin.top();
@@ -1019,13 +1019,13 @@ struct GiftPriceTabs {
rpl::combine(
raw->widthValue(),
state->fullWidth.value()
) | rpl::start_with_next([=](int outer, int inner) {
) | rpl::on_next([=](int outer, int inner) {
state->scrollMax = std::max(0, inner - outer);
state->tabsShift = (outer - inner) / 2;
}, raw->lifetime());
raw->setMouseTracking(true);
raw->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
raw->events() | rpl::on_next([=](not_null<QEvent*> e) {
const auto type = e->type();
switch (type) {
case QEvent::Leave: setSelected(-1); break;
@@ -1084,7 +1084,7 @@ struct GiftPriceTabs {
}
}, raw->lifetime());
raw->paintRequest() | rpl::start_with_next([=] {
raw->paintRequest() | rpl::on_next([=] {
auto p = QPainter(raw);
auto hq = PainterHighQualityEnabler(p);
const auto padding = st::giftBoxTabPadding;
@@ -1159,7 +1159,7 @@ struct GiftPriceTabs {
container,
st::defaultComposeFiles.emoji);
toggle->show();
field->geometryValue() | rpl::start_with_next([=](QRect r) {
field->geometryValue() | rpl::on_next([=](QRect r) {
toggle->move(
r.x() + r.width() - toggle->width(),
r.y() - st::giftBoxEmojiToggleTop);
@@ -1181,11 +1181,11 @@ struct GiftPriceTabs {
panel->hide();
panel->selector()->setAllowEmojiWithoutPremium(true);
panel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
InsertEmojiAtCursor(field->textCursor(), data.emoji);
}, field->lifetime());
panel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
Data::InsertCustomEmoji(field, data.document);
}, field->lifetime());
@@ -1467,7 +1467,7 @@ void AddUpgradeButton(
rpl::single(QString()),
st::settingsButtonNoIcon));
button->toggleOn(rpl::single(false))->toggledValue(
) | rpl::start_with_next(toggled, button->lifetime());
) | rpl::on_next(toggled, button->lifetime());
auto helper = Ui::Text::CustomEmojiHelper();
auto star = helper.paletteDependent(Ui::Earn::IconCreditsEmoji());
@@ -1484,7 +1484,7 @@ void AddUpgradeButton(
helper.context());
label->show();
label->setAttribute(Qt::WA_TransparentForMouseEvents);
button->widthValue() | rpl::start_with_next([=](int outer) {
button->widthValue() | rpl::on_next([=](int outer) {
const auto padding = st::settingsButtonNoIcon.padding;
const auto inner = outer
- padding.left()
@@ -1542,7 +1542,7 @@ void AddSoldLeftSlider(
state->height = st::giftLimitedPadding.top()
+ st::semiboldFont->height
+ st::giftLimitedPadding.bottom();
above->geometryValue() | rpl::start_with_next([=](QRect geometry) {
above->geometryValue() | rpl::on_next([=](QRect geometry) {
const auto space = st::giftLimitedBox.buttonPadding.top();
const auto skip = (space - state->height) / 2;
slider->setGeometry(
@@ -1551,7 +1551,7 @@ void AddSoldLeftSlider(
geometry.width() - added.left() - added.right(),
state->height);
}, slider->lifetime());
slider->paintRequest() | rpl::start_with_next([=] {
slider->paintRequest() | rpl::on_next([=] {
const auto &padding = st::giftLimitedPadding;
const auto left = (padding.left() * 2) + state->still.maxWidth();
const auto right = (padding.right() * 2) + state->sold.maxWidth();
@@ -1618,7 +1618,7 @@ void CheckMaybeGiftLocked(
auto result = object_ptr<VisibleRangeWidget>((QWidget*)nullptr);
const auto raw = result.data();
Data::AmPremiumValue(&window->session()) | rpl::start_with_next([=] {
Data::AmPremiumValue(&window->session()) | rpl::on_next([=] {
raw->update();
}, raw->lifetime());
@@ -1644,7 +1644,7 @@ void CheckMaybeGiftLocked(
const auto extend = shadow.extend;
auto &packs = window->session().giftBoxStickersPacks();
packs.updated() | rpl::start_with_next([=] {
packs.updated() | rpl::on_next([=] {
for (const auto &button : state->buttons) {
if (const auto raw = button.get()) {
raw->update();
@@ -1876,11 +1876,11 @@ void CheckMaybeGiftLocked(
state->visibleRange = raw->visibleRange();
state->visibleRange.value(
) | rpl::start_with_next(rebuild, raw->lifetime());
) | rpl::on_next(rebuild, raw->lifetime());
std::move(
gifts
) | rpl::start_with_next([=](const GiftsDescriptor &gifts) {
) | rpl::on_next([=](const GiftsDescriptor &gifts) {
const auto width = st::boxWideWidth;
const auto padding = st::giftBoxPadding;
const auto available = width - padding.left() - padding.right();
@@ -1915,7 +1915,7 @@ void CheckMaybeGiftLocked(
}
void FillBg(not_null<RpWidget*> box) {
box->paintRequest() | rpl::start_with_next([=] {
box->paintRequest() | rpl::on_next([=] {
auto p = QPainter(box);
auto hq = PainterHighQualityEnabler(p);
@@ -2003,7 +2003,7 @@ void AddBlock(
state->gifts.value(),
!state->my.list.empty() && !peer->isSelf());
state->priceTab = std::move(tabs.priceTab);
state->priceTab.changes() | rpl::start_with_next([=](int tab) {
state->priceTab.changes() | rpl::on_next([=](int tab) {
tabSelected(tab);
}, tabs.widget->lifetime());
result->add(std::move(tabs.widget));
@@ -2061,7 +2061,7 @@ void AddBlock(
&peer->session(),
Data::MyUniqueType::OnlyOwned,
state->my.offset
) | rpl::start_with_next([=](MyGiftsDescriptor &&descriptor) {
) | rpl::on_next([=](MyGiftsDescriptor &&descriptor) {
state->myLoading.destroy();
state->my.offset = descriptor.list.empty()
? QString()
@@ -2593,7 +2593,7 @@ void ChooseStarGiftRecipient(
box->setTitle(tr::lng_gift_premium_or_stars());
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
box->noSearchSubmits() | rpl::start_with_next([=] {
box->noSearchSubmits() | rpl::on_next([=] {
controllerRaw->noSearchSubmit();
}, box->lifetime());
};
@@ -2679,7 +2679,7 @@ void ShowStarGiftBox(
GiftsPremium(
session,
peer
) | rpl::start_with_next([=](PremiumGiftsDescriptor &&gifts) {
) | rpl::on_next([=](PremiumGiftsDescriptor &&gifts) {
auto &entry = Map[session];
entry.premiumGiftsReady = true;
entry.hasPremium = !gifts.list.empty();
@@ -2697,7 +2697,7 @@ void ShowStarGiftBox(
peer->session().changes().peerUpdates(
peer,
Data::PeerUpdate::Flag::FullInfo
) | rpl::take(1) | rpl::start_with_next([=] {
) | rpl::take(1) | rpl::on_next([=] {
auto &entry = Map[session];
entry.fullReady = true;
checkReady();
@@ -2707,7 +2707,7 @@ void ShowStarGiftBox(
GiftsStars(
session,
peer
) | rpl::start_with_next([=](std::vector<GiftTypeStars> &&gifts) {
) | rpl::on_next([=](std::vector<GiftTypeStars> &&gifts) {
auto &entry = Map[session];
entry.starsGiftsReady = true;
for (const auto &gift : gifts) {
@@ -2726,7 +2726,7 @@ void ShowStarGiftBox(
Data::MyUniqueGiftsSlice(
session,
Data::MyUniqueType::OnlyOwned
) | rpl::start_with_next([=](MyGiftsDescriptor &&gifts) {
) | rpl::on_next([=](MyGiftsDescriptor &&gifts) {
auto &entry = Map[session];
entry.my = std::move(gifts);
entry.myReady = true;
@@ -2750,7 +2750,7 @@ void SetupResalePriceButton(
QString(),
st::uniqueGiftResalePrice);
text->setAttribute(Qt::WA_TransparentForMouseEvents);
text->sizeValue() | rpl::start_with_next([=](QSize size) {
text->sizeValue() | rpl::on_next([=](QSize size) {
const auto padding = st::uniqueGiftResalePadding;
const auto margin = st::uniqueGiftResaleMargin;
button->resize(size.grownBy(padding + margin));
@@ -2758,7 +2758,7 @@ void SetupResalePriceButton(
}, button->lifetime());
text->setTextColorOverride(QColor(255, 255, 255, 255));
std::move(price) | rpl::start_with_next([=](CreditsAmount value) {
std::move(price) | rpl::on_next([=](CreditsAmount value) {
if (value) {
text->setMarkedText(value.ton()
? Ui::Text::IconEmoji(&st::tonIconEmoji).append(
@@ -2774,7 +2774,7 @@ void SetupResalePriceButton(
const auto bg = button->lifetime().make_state<rpl::variable<QColor>>(
std::move(background));
button->paintRequest() | rpl::start_with_next([=] {
button->paintRequest() | rpl::on_next([=] {
auto p = QPainter(button);
auto hq = PainterHighQualityEnabler(p);
@@ -2785,7 +2785,7 @@ void SetupResalePriceButton(
p.setBrush(bg->current());
p.drawRoundedRect(inner, radius, radius);
}, button->lifetime());
bg->changes() | rpl::start_with_next([=] {
bg->changes() | rpl::on_next([=] {
button->update();
}, button->lifetime());
@@ -2850,7 +2850,7 @@ void AddUniqueGiftCover(
{ 0., anim::with_alpha(white, .3) },
{ 1., white },
});
pretitle->geometryValue() | rpl::start_with_next([=](QRect rect) {
pretitle->geometryValue() | rpl::on_next([=](QRect rect) {
const auto half = rect.height() / 2;
released->stars->setCenter(rect - QMargins(half, 0, half, 0));
}, pretitle->lifetime());
@@ -2918,11 +2918,11 @@ void AddUniqueGiftCover(
GiftReleasedByHandler(released->by);
});
subtitle->geometryValue(
) | rpl::start_with_next([=](QRect geometry) {
) | rpl::on_next([=](QRect geometry) {
button->setGeometry(
geometry.marginsAdded(st::giftBoxReleasedByMargin));
}, button->lifetime());
button->paintRequest() | rpl::start_with_next([=] {
button->paintRequest() | rpl::on_next([=] {
auto p = QPainter(button);
auto hq = PainterHighQualityEnabler(p);
const auto use = subtitle->textMaxWidth();
@@ -2986,7 +2986,7 @@ void AddUniqueGiftCover(
};
rpl::duplicate(
data
) | rpl::start_with_next([=](const UniqueGiftCover &now) {
) | rpl::on_next([=](const UniqueGiftCover &now) {
const auto setup = [&](GiftView &to) {
to.gift = now.values;
to.forced = now.force;
@@ -2997,7 +2997,7 @@ void AddUniqueGiftCover(
document->session().downloaderTaskFinished()
) | rpl::filter([&to] {
return to.media->loaded();
}) | rpl::start_with_next([=, &to] {
}) | rpl::on_next([=, &to] {
const auto lottieSize = st::creditsHistoryEntryStarGiftSize;
to.lottie = ChatHelpers::LottiePlayerFromDocument(
to.media.get(),
@@ -3007,7 +3007,7 @@ void AddUniqueGiftCover(
to.lifetime.destroy();
const auto lottie = to.lottie.get();
lottie->updates() | rpl::start_with_next([=] {
lottie->updates() | rpl::on_next([=] {
if (state->now.lottie.get() == lottie
|| state->crossfade.animating()) {
cover->update();
@@ -3141,7 +3141,7 @@ void AddUniqueGiftCover(
}
updateAttrs(*state->now.gift);
cover->widthValue() | rpl::start_with_next([=](int width) {
cover->widthValue() | rpl::on_next([=](int width) {
const auto skip = st::uniqueGiftBottom;
if (width <= 3 * skip) {
return;
@@ -3181,7 +3181,7 @@ void AddUniqueGiftCover(
cover->resize(width, top);
}, cover->lifetime());
cover->paintRequest() | rpl::start_with_next([=] {
cover->paintRequest() | rpl::on_next([=] {
auto p = QPainter(cover);
auto progress = state->crossfade.value(state->animating ? 1. : 0.);
@@ -3304,7 +3304,7 @@ void AddWearGiftCover(
[=] { cover->update(); },
Data::CustomEmojiSizeTag::Large);
cover->widthValue() | rpl::start_with_next([=](int width) {
cover->widthValue() | rpl::on_next([=](int width) {
const auto skip = st::uniqueGiftBottom;
if (width <= 3 * skip) {
return;
@@ -3319,7 +3319,7 @@ void AddWearGiftCover(
cover->resize(width, subtitle->y() + subtitle->height() + skip);
}, cover->lifetime());
cover->paintRequest() | rpl::start_with_next([=] {
cover->paintRequest() | rpl::on_next([=] {
auto p = Painter(cover);
const auto width = cover->width();
@@ -3508,7 +3508,7 @@ void PreloadUniqueGiftResellPrices(not_null<Main::Session*> session) {
}
};
entry->requestLifetime = entry->api->requestStarGifts(
) | rpl::start_with_error_done(finish, [=] {
) | rpl::on_error_done(finish, [=] {
const auto &gifts = entry->api->starGifts();
entry->prices.reserve(gifts.size());
for (auto &gift : gifts) {
@@ -3736,7 +3736,7 @@ void UniqueGiftSellBox(
st::boxDividerLabel));
Ui::AddSkip(container);
rpl::duplicate(goods) | rpl::start_with_next([=](bool good) {
rpl::duplicate(goods) | rpl::on_next([=](bool good) {
details->setTextColorOverride(
good ? st::windowSubTextFg->c : st::boxTextFgError->c);
}, details->lifetime());
@@ -3752,7 +3752,7 @@ void UniqueGiftSellBox(
};
std::move(
priceInput.submits
) | rpl::start_with_next(submit, details->lifetime());
) | rpl::on_next(submit, details->lifetime());
auto submitText = priceNow
? tr::lng_gift_sell_update()
: tr::lng_gift_sell_put();
@@ -4005,7 +4005,7 @@ struct UpgradeArgs : StarGiftUpgradeArgs {
put();
base::timer_each(
kSwitchUpgradeCoverInterval / 3
) | rpl::start_with_next(put, lifetime);
) | rpl::on_next(put, lifetime);
return lifetime;
};
@@ -4399,7 +4399,7 @@ void UpgradeBox(
args.addDetailsDefault),
st::defaultCheckbox.margin,
style::al_top);
checkbox->checkedChanges() | rpl::start_with_next([=](bool checked) {
checkbox->checkedChanges() | rpl::on_next([=](bool checked) {
state->preserveDetails = checked;
}, checkbox->lifetime());
}
@@ -4489,7 +4489,7 @@ void UpgradeBox(
st::resaleButtonSubtitle);
state->cost->tillNextValue() | rpl::filter([=](TimeId left) {
return !left;
}) | rpl::take(1) | rpl::start_with_next([=] {
}) | rpl::take(1) | rpl::on_next([=] {
while (!button->children().isEmpty()) {
delete button->children()[0];
}
@@ -4505,7 +4505,7 @@ void UpgradeBox(
[](QString text) { return Ui::Text::Link(text); }),
st::resalePriceTableLink);
link->setTryMakeSimilarLines(true);
button->geometryValue() | rpl::start_with_next([=](QRect geometry) {
button->geometryValue() | rpl::on_next([=](QRect geometry) {
const auto outer = button->parentWidget()->height();
const auto top = geometry.y() + geometry.height();
const auto available = outer - top - st::boxRadius;
@@ -4577,7 +4577,7 @@ void AddUniqueCloseButton(
menu->show();
menu->raise();
}
box->widthValue() | rpl::start_with_next([=](int width) {
box->widthValue() | rpl::on_next([=](int width) {
close->moveToRight(0, 0, width);
close->raise();
if (menu) {
@@ -4647,7 +4647,7 @@ void SubmitTonForm(
const auto session = &show->session();
session->credits().tonLoad();
session->credits().tonLoadedValue(
) | rpl::filter(rpl::mappers::_1) | rpl::start_with_next([=] {
) | rpl::filter(rpl::mappers::_1) | rpl::on_next([=] {
state->lifetime.destroy();
if (session->credits().tonBalance() < ton) {
@@ -4915,7 +4915,7 @@ void SendGiftBox(
tr::lng_gift_send_message(),
QString(),
limit);
text->changes() | rpl::start_with_next([=] {
text->changes() | rpl::on_next([=] {
auto now = state->details.current();
auto textWithTags = text->getTextWithAppliedMarkdown();
now.text = TextWithEntities{
@@ -4987,7 +4987,7 @@ void SendGiftBox(
tr::lng_gift_send_anonymous(),
st::settingsButtonNoIcon)
)->toggleOn(rpl::single(peer->isSelf()))->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
auto now = state->details.current();
now.anonymous = toggled;
state->details = std::move(now);
@@ -5011,7 +5011,7 @@ void SendGiftBox(
Ui::Text::WithEntities),
st::settingsButtonNoIcon)
)->toggleOn(rpl::single(false))->toggledValue(
) | rpl::start_with_next([=](bool toggled) {
) | rpl::on_next([=](bool toggled) {
auto now = state->details.current();
now.byStars = toggled;
state->details = std::move(now);
@@ -5081,7 +5081,7 @@ void SendGiftBox(
.details = std::make_unique<GiftSendDetails>(details),
}));
bidBox->boxClosing(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
box->closeBox();
}, box->lifetime());
return;

View File

@@ -367,7 +367,7 @@ void AttributeButton::setDocument(not_null<DocumentData*> document) {
document->session().downloaderTaskFinished()
) | rpl::filter([=] {
return media->loaded();
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
_mediaLifetime.destroy();
auto result = std::unique_ptr<HistoryView::StickerPlayer>();
@@ -709,7 +709,7 @@ void Delegate::update(
document->session().downloaderTaskFinished()
) | rpl::filter([=] {
return media->loaded();
}) | rpl::start_with_next([=, &model] {
}) | rpl::on_next([=, &model] {
model.mediaLifetime.destroy();
auto result = std::unique_ptr<HistoryView::StickerPlayer>();
@@ -963,7 +963,7 @@ AttributesList::AttributesList(
fill();
_tab.value(
) | rpl::start_with_next([=](Tab tab) {
) | rpl::on_next([=](Tab tab) {
_entries = [&] {
switch (tab) {
case Tab::Model: return &_models;
@@ -977,7 +977,7 @@ AttributesList::AttributesList(
refreshAbout();
}, lifetime());
_selected.value() | rpl::combine_previous() | rpl::start_with_next([=](
_selected.value() | rpl::combine_previous() | rpl::on_next([=](
Selection was,
Selection now) {
const auto tab = _tab.current();
@@ -1356,7 +1356,7 @@ void StarGiftPreviewBox(
&state->attributes,
state->tab.value()));
state->list->selected(
) | rpl::start_with_next([=](Selection value) {
) | rpl::on_next([=](Selection value) {
state->fixed = value;
state->paused = (value.model >= 0)
|| (value.pattern >= 0)
@@ -1381,7 +1381,7 @@ void StarGiftPreviewBox(
state->tab = tab;
});
const auto icon = &active;
state->tab.value() | rpl::start_with_next([=](Tab now) {
state->tab.value() | rpl::on_next([=](Tab now) {
raw->setTextFgOverride((now == tab)
? st::defaultActiveButton.textFg->c
: std::optional<QColor>());
@@ -1408,7 +1408,7 @@ void StarGiftPreviewBox(
st::uniqueAttributeModelActive,
Tab::Model);
state->paused.value() | rpl::start_with_next([=](bool paused) {
state->paused.value() | rpl::on_next([=](bool paused) {
if (paused) {
state->pushNextTimer.cancel();
} else {

View File

@@ -302,7 +302,7 @@ struct ResaleTabs {
};
state->filter.value(
) | rpl::start_with_next([=](const ResaleGiftsFilter &fields) {
) | rpl::on_next([=](const ResaleGiftsFilter &fields) {
auto x = st::giftBoxResaleTabsMargin.left();
auto y = st::giftBoxResaleTabsMargin.top();
@@ -356,12 +356,12 @@ struct ResaleTabs {
rpl::combine(
raw->widthValue(),
state->fullWidth.value()
) | rpl::start_with_next([=](int outer, int inner) {
) | rpl::on_next([=](int outer, int inner) {
state->scrollMax = std::max(0, inner - outer);
}, raw->lifetime());
raw->setMouseTracking(true);
raw->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
raw->events() | rpl::on_next([=](not_null<QEvent*> e) {
const auto type = e->type();
switch (type) {
case QEvent::Leave: setSelected(-1); break;
@@ -420,7 +420,7 @@ struct ResaleTabs {
}
}, raw->lifetime());
raw->paintRequest() | rpl::start_with_next([=] {
raw->paintRequest() | rpl::on_next([=] {
auto p = QPainter(raw);
auto hq = PainterHighQualityEnabler(p);
const auto padding = st::giftBoxTabPadding;
@@ -501,7 +501,7 @@ void GiftResaleBox(
countLabel->setTextColorOverride(st::windowSubTextFg->c);
const auto content = box->verticalLayout();
content->paintRequest() | rpl::start_with_next([=](QRect clip) {
content->paintRequest() | rpl::on_next([=](QRect clip) {
QPainter(content).fillRect(clip, st::boxDividerBg);
}, content->lifetime());
@@ -529,7 +529,7 @@ void GiftResaleBox(
tr::lng_gift_resale_switch_to_ton()));
#endif
box->heightValue() | rpl::start_with_next([=](int height) {
box->heightValue() | rpl::on_next([=](int height) {
if (height > state->lastMinHeight) {
state->lastMinHeight = height;
box->setMinHeight(height);
@@ -544,14 +544,14 @@ void GiftResaleBox(
state->filter = std::move(tabs.filter);
content->add(std::move(tabs.widget));
state->filter.changes() | rpl::start_with_next([=](ResaleGiftsFilter value) {
state->filter.changes() | rpl::on_next([=](ResaleGiftsFilter value) {
state->data.offset = QString();
state->loading = ResaleGiftsSlice(
&peer->session(),
state->data.giftId,
value,
QString()
) | rpl::start_with_next([=](ResaleGiftsDescriptor &&slice) {
) | rpl::on_next([=](ResaleGiftsDescriptor &&slice) {
state->loading.destroy();
state->data.offset = slice.list.empty()
? QString()
@@ -562,7 +562,7 @@ void GiftResaleBox(
}, content->lifetime());
peer->owner().giftUpdates(
) | rpl::start_with_next([=](const Data::GiftUpdate &update) {
) | rpl::on_next([=](const Data::GiftUpdate &update) {
using Action = Data::GiftUpdate::Action;
const auto action = update.action;
if (action != Action::Transfer && action != Action::ResaleChange) {
@@ -608,7 +608,7 @@ void GiftResaleBox(
state->data.giftId,
state->filter.current(),
state->data.offset
) | rpl::start_with_next([=](ResaleGiftsDescriptor &&slice) {
) | rpl::on_next([=](ResaleGiftsDescriptor &&slice) {
state->loading.destroy();
state->data.offset = slice.list.empty()
? QString()
@@ -656,7 +656,7 @@ rpl::lifetime ShowStarGiftResale(
return Data::ResaleGiftsSlice(
session,
giftId
) | rpl::start_with_next([=](ResaleGiftsDescriptor &&info) {
) | rpl::on_next([=](ResaleGiftsDescriptor &&info) {
if (const auto onstack = finishRequesting) {
onstack();
}

View File

@@ -220,14 +220,14 @@ StickerPremiumMark::StickerPremiumMark(
: _lockIcon(lockIcon)
, _part(part) {
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_lockGray = QImage();
_star = QImage();
}, _lifetime);
Data::AmPremiumValue(
session
) | rpl::start_with_next([=](bool premium) {
) | rpl::on_next([=](bool premium) {
_premium = premium;
}, _lifetime);
}
@@ -519,7 +519,7 @@ void StickerSetBox::prepare() {
st::stickersScroll);
_session->data().stickers().updated(
_type
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateButtons();
}, lifetime());
@@ -532,12 +532,12 @@ void StickerSetBox::prepare() {
updateTitleAndButtons();
_inner->updateControls(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateTitleAndButtons();
}, lifetime());
_inner->setInstalled(
) | rpl::start_with_next([=](uint64 setId) {
) | rpl::on_next([=](uint64 setId) {
if (_inner->setType() == Data::StickersType::Masks) {
showToast(tr::lng_masks_installed(tr::now));
} else if (_inner->setType() == Data::StickersType::Emoji) {
@@ -551,12 +551,12 @@ void StickerSetBox::prepare() {
}, lifetime());
_inner->errors(
) | rpl::start_with_next([=](Error error) {
) | rpl::on_next([=](Error error) {
handleError(error);
}, lifetime());
_inner->setArchived(
) | rpl::start_with_next([=](uint64 setId) {
) | rpl::on_next([=](uint64 setId) {
const auto type = _inner->setType();
if (type == Data::StickersType::Emoji) {
return;
@@ -906,7 +906,7 @@ StickerSetBox::Inner::Inner(
_session->api().updateStickers();
_session->downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateItems();
}, lifetime());
@@ -1501,7 +1501,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox(
animation->start();
}
sticker->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = Painter(sticker);
if ([[maybe_unused]] const auto strong = weak.get()) {
const auto paused = On(PowerSaving::kStickersPanel)
@@ -1517,7 +1517,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox(
tr::lng_stickers_context_delete(),
box->getDelegate()->style().title);
line->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
sticker->moveToLeft(st::boxRowPadding.left(), 0);
const auto skip = st::defaultBoxCheckbox.textPosition.x();
label->resizeToWidth(width
@@ -1656,7 +1656,7 @@ not_null<Lottie::MultiPlayer*> StickerSetBox::Inner::getLottiePlayer() {
Lottie::Quality::Default,
Lottie::MakeFrameRenderer());
_lottiePlayer->updates(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateItems();
}, lifetime());
}

View File

@@ -355,7 +355,7 @@ StickersBox::CounterWidget::CounterWidget(
std::move(
count
) | rpl::start_with_next([=](int count) {
) | rpl::on_next([=](int count) {
setCounter(count);
update();
}, lifetime());
@@ -447,7 +447,7 @@ StickersBox::StickersBox(
, _installed(0, this, _show, megagroup, isEmoji)
, _megagroupSet(megagroup) {
_installed.widget()->scrollsToY(
) | rpl::start_with_next([=](int y) {
) | rpl::on_next([=](int y) {
scrollToY(y);
}, lifetime());
}
@@ -607,7 +607,7 @@ void StickersBox::prepare() {
_tabs->sectionActivated(
) | rpl::filter([=] {
return !_ignoreTabActivation;
}) | rpl::start_with_next(
}) | rpl::on_next(
[this] { switchTab(); },
lifetime());
refreshTabs();
@@ -700,7 +700,7 @@ void StickersBox::prepare() {
: _isMasks
? Data::StickersType::Masks
: Data::StickersType::Stickers
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
handleStickersUpdated();
}, lifetime());
@@ -715,13 +715,13 @@ void StickersBox::prepare() {
for (const auto &widget : { _installed.widget(), _masks.widget() }) {
if (widget) {
widget->draggingScrollDelta(
) | rpl::start_with_next([=](int delta) {
) | rpl::on_next([=](int delta) {
scrollByDraggingDelta(delta);
}, widget->lifetime());
}
}
if (!_megagroupSet) {
boxClosing() | rpl::start_with_next([=] {
boxClosing() | rpl::on_next([=] {
saveChanges();
}, lifetime());
}
@@ -1305,7 +1305,7 @@ Main::Session &StickersBox::Inner::session() const {
void StickersBox::Inner::setup() {
session().downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
update();
readVisibleSets();
}, lifetime());
@@ -1580,7 +1580,7 @@ void StickersBox::Inner::validateLottieAnimation(not_null<Row*> row) {
}
row->lottie = std::move(player);
row->lottie->updates(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateRowThumbnail(row);
}, lifetime());
}

View File

@@ -148,7 +148,7 @@ void ExportOnBlockchain(
state->lifetime = session->api().cloudPassword().state(
) | rpl::take(
1
) | rpl::start_with_next([=](const Core::CloudPasswordState &pass) {
) | rpl::on_next([=](const Core::CloudPasswordState &pass) {
state->lifetime.destroy();
auto fields = PasscodeBox::CloudFields::From(pass);
@@ -703,7 +703,7 @@ void ShowTransferGiftBox(
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
box->noSearchSubmits() | rpl::start_with_next([=] {
box->noSearchSubmits() | rpl::on_next([=] {
controllerRaw->noSearchSubmit();
}, box->lifetime());
};
@@ -1019,7 +1019,7 @@ void ShowBuyResaleGiftBox(
},
}),
st::boxRowPadding + st::resaleConfirmTonOnlyMargin);
tabs->activated() | rpl::start_with_next([=](QString id) {
tabs->activated() | rpl::on_next([=](QString id) {
tabs->setActiveTab(id);
state->ton = (id == u"ton"_q);
}, tabs->lifetime());

View File

@@ -61,7 +61,7 @@ ShowButton::ShowButton(not_null<Ui::RpWidget*> parent)
: RpWidget(parent)
, _button(this, tr::lng_usernames_activate_confirm(tr::now)) {
_button.sizeValue(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
resize(
s.width() + st::defaultEmojiSuggestions.fadeRight.width(),
s.height());
@@ -161,7 +161,7 @@ void TranslateBox(
rpl::combine(
container->widthValue(),
original->geometryValue()
) | rpl::start_with_next([=](int width, const QRect &rect) {
) | rpl::on_next([=](int width, const QRect &rect) {
show->moveToLeft(
width - show->width() - st::boxRowPadding.right(),
rect.y() + std::abs(lineHeight - show->height()) / 2);
@@ -169,7 +169,7 @@ void TranslateBox(
original->entity()->heightValue(
) | rpl::filter([](int height) {
return height > 0;
}) | rpl::take(1) | rpl::start_with_next([=](int height) {
}) | rpl::take(1) | rpl::on_next([=](int height) {
if (height > lineHeight) {
show->show(anim::type::instant);
}
@@ -189,7 +189,7 @@ void TranslateBox(
state->to.value() | rpl::map(LanguageName));
// Workaround.
state->to.value() | rpl::start_with_next([=] {
state->to.value() | rpl::on_next([=] {
subtitle->resizeToWidth(container->width()
- padding.left()
- padding.right());
@@ -257,7 +257,7 @@ void TranslateBox(
Ui::Text::Italic(tr::lng_translate_box_error(tr::now)));
}).send();
};
state->to.value() | rpl::start_with_next(send, box->lifetime());
state->to.value() | rpl::on_next(send, box->lifetime());
box->addLeftButton(tr::lng_settings_language(), [=] {
if (loading->toggled()) {

View File

@@ -292,7 +292,7 @@ not_null<Ui::RpWidget*> UrlAuthBox::setupContent(
auth->checked()
) | rpl::then(
auth->checkedChanges()
) | rpl::start_with_next([=](bool checked) {
) | rpl::on_next([=](bool checked) {
if (!checked) {
allow->setChecked(false);
}

View File

@@ -370,15 +370,15 @@ void UsernamesBox(
const auto finish = [=] {
list->save(
) | rpl::start_with_done([=] {
) | rpl::on_done([=] {
editor->save(
) | rpl::start_with_done([=] {
) | rpl::on_done([=] {
box->closeBox();
}, box->lifetime());
}, box->lifetime());
};
editor->submitted(
) | rpl::start_with_next(finish, editor->lifetime());
) | rpl::on_next(finish, editor->lifetime());
if (isBot) {
box->addButton(tr::lng_close(), [=] { box->closeBox(); });
@@ -410,7 +410,7 @@ void AddUsernameCheckLabel(
rpl::combine(
std::move(checkInfo),
container->widthValue()
) | rpl::start_with_next([=](const UsernameCheckInfo &info, int w) {
) | rpl::on_next([=](const UsernameCheckInfo &info, int w) {
using Type = UsernameCheckInfo::Type;
label->setMarkedText(info.text);
const auto &color = (info.type == Type::Good)

View File

@@ -207,7 +207,7 @@ void ListController::prepare() {
session().changes().peerUpdates(
Data::PeerUpdate::Flag::GroupCall
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
processPeer(update.peer);
finishProcess();
}, lifetime());
@@ -493,7 +493,7 @@ Main::Session &BoxController::session() const {
void BoxController::prepare() {
session().data().itemRemoved(
) | rpl::start_with_next([=](not_null<const HistoryItem*> item) {
) | rpl::on_next([=](not_null<const HistoryItem*> item) {
if (const auto row = rowForItem(item)) {
row->itemRemoved(item);
if (!row->hasItems()) {
@@ -511,7 +511,7 @@ void BoxController::prepare() {
) | rpl::filter([=](const Data::MessageUpdate &update) {
const auto media = update.item->media();
return (media != nullptr) && (media->call() != nullptr);
}) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
}) | rpl::on_next([=](const Data::MessageUpdate &update) {
insertRow(update.item, InsertWay::Prepend);
}, lifetime());
@@ -790,7 +790,7 @@ void ClearCallsBox(
st::inviteViaLinkIcon,
QPoint());
result->heightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
icon->moveToLeft(
st::inviteViaLinkIconPosition.x(),
(height - st::inviteViaLinkIcon.height()) / 2);
@@ -846,7 +846,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) {
button->events(
) | rpl::filter([=](not_null<QEvent*> e) {
return (e->type() == QEvent::Enter);
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
state->callsDelegate.peerListMouseLeftGeometry();
}, button->lifetime());
@@ -858,7 +858,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) {
box->setWidth(state->callsController.contentWidth());
state->callsController.boxHeightValue(
) | rpl::start_with_next([=](int height) {
) | rpl::on_next([=](int height) {
box->setMinHeight(height);
}, box->lifetime());
box->setTitle(tr::lng_call_box_title());

View File

@@ -530,7 +530,7 @@ void Call::setupMediaDevices() {
_playbackDeviceId.changes() | rpl::filter([=] {
return _instance && _setDeviceIdCallback;
}) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) {
}) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) {
_setDeviceIdCallback(deviceId);
// Value doesn't matter here, just trigger reading of the new value.
@@ -539,7 +539,7 @@ void Call::setupMediaDevices() {
_captureDeviceId.changes() | rpl::filter([=] {
return _instance && _setDeviceIdCallback;
}) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) {
}) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) {
_setDeviceIdCallback(deviceId);
// Value doesn't matter here, just trigger reading of the new value.
@@ -557,7 +557,7 @@ void Call::setupOutgoingVideo() {
_videoOutgoing->setState(Webrtc::VideoState::Inactive);
}
_videoOutgoing->stateValue(
) | rpl::start_with_next([=](Webrtc::VideoState state) {
) | rpl::on_next([=](Webrtc::VideoState state) {
if (state != Webrtc::VideoState::Inactive
&& cameraId().isEmpty()
&& !_videoCaptureIsScreencast) {
@@ -598,7 +598,7 @@ void Call::setupOutgoingVideo() {
_cameraDeviceId.changes(
) | rpl::filter([=] {
return !_videoCaptureIsScreencast;
}) | rpl::start_with_next([=](Webrtc::DeviceResolvedId deviceId) {
}) | rpl::on_next([=](Webrtc::DeviceResolvedId deviceId) {
const auto &id = deviceId.value;
_videoCaptureDeviceId = id;
if (_videoCapture) {
@@ -822,7 +822,7 @@ bool Call::handleUpdate(const MTPPhoneCall &call) {
box->sends(
) | rpl::take(
1 // Instead of keeping requestId.
) | rpl::start_with_next([=](const Ui::RateCallBox::Result &r) {
) | rpl::on_next([=](const Ui::RateCallBox::Result &r) {
sender->request(MTPphone_SetCallRating(
MTP_flags(0),
MTP_inputPhoneCall(
@@ -1196,7 +1196,7 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
raw->setIncomingVideoOutput(_videoIncoming->sink());
raw->setAudioOutputDuckingEnabled(settings.callAudioDuckingEnabled());
_state.value() | rpl::start_with_next([=](State state) {
_state.value() | rpl::on_next([=](State state) {
const auto track = (state != State::FailedHangingUp)
&& (state != State::Failed)
&& (state != State::HangingUp)
@@ -1207,13 +1207,13 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
Core::App().mediaDevices().setCaptureMuteTracker(this, track);
}, _instanceLifetime);
_muted.value() | rpl::start_with_next([=](bool muted) {
_muted.value() | rpl::on_next([=](bool muted) {
Core::App().mediaDevices().setCaptureMuted(muted);
}, _instanceLifetime);
#if 0
Core::App().batterySaving().value(
) | rpl::start_with_next([=](bool isSaving) {
) | rpl::on_next([=](bool isSaving) {
crl::on_main(weak, [=] {
if (_instance) {
_instance->setIsLowBatteryLevel(isSaving);

View File

@@ -150,7 +150,7 @@ void WebrtcController::setOnStateUpdated(
Fn<void(TgVoipState)> onStateUpdated) {
_stateUpdatedLifetime.destroy();
_impl->state().changes(
) | rpl::start_with_next([=](CallState state) {
) | rpl::on_next([=](CallState state) {
onStateUpdated([&] {
switch (state) {
case CallState::Initializing: return TgVoipState::WaitInit;

View File

@@ -205,7 +205,7 @@ base::unique_qptr<Ui::RpWidget> CreateFingerprintAndSignalBars(
call->user()->name()));
raw->setMouseTracking(true);
raw->events(
) | rpl::start_with_next([=](not_null<QEvent*> e) {
) | rpl::on_next([=](not_null<QEvent*> e) {
if (e->type() == QEvent::MouseMove) {
Ui::Tooltip::Show(kTooltipShowTimeoutMs, shower);
} else if (e->type() == QEvent::Leave) {
@@ -254,7 +254,7 @@ base::unique_qptr<Ui::RpWidget> CreateFingerprintAndSignalBars(
rpl::single(rpl::empty),
Ui::Emoji::Updated(),
style::PaletteChanged()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
background->fill(Qt::transparent);
// Prepare.
@@ -300,7 +300,7 @@ base::unique_qptr<Ui::RpWidget> CreateFingerprintAndSignalBars(
}, raw->lifetime());
raw->paintRequest(
) | rpl::start_with_next([=](QRect clip) {
) | rpl::on_next([=](QRect clip) {
QPainter(raw).drawImage(raw->rect(), *background);
}, raw->lifetime());
@@ -522,7 +522,7 @@ FingerprintBadge SetupFingerprintBadge(
std::move(
fingerprint
) | rpl::start_with_next([=](const QByteArray &fingerprint) {
) | rpl::on_next([=](const QByteArray &fingerprint) {
auto buffered = base::BufferedRandom<uint32>(
kEmojiInCarousel * kEmojiInFingerprint);
const auto now = crl::now();
@@ -615,7 +615,7 @@ void SetupFingerprintTooltip(not_null<Ui::RpWidget*> widget) {
raw->toggleAnimated(true);
};
widget->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
widget->events() | rpl::on_next([=](not_null<QEvent*> e) {
const auto type = e->type();
if (type == QEvent::Enter) {
// Enter events may come from widget destructors,
@@ -681,7 +681,7 @@ void SetupFingerprintBadgeWidget(
const auto ratio = style::DevicePixelRatio();
const auto esize = Ui::Emoji::GetSizeNormal();
const auto size = esize / ratio;
widget->widthValue() | rpl::start_with_next([=](int width) {
widget->widthValue() | rpl::on_next([=](int width) {
static_assert(!(kEmojiInFingerprint % 2));
const auto available = width
@@ -729,7 +729,7 @@ void SetupFingerprintBadgeWidget(
}, lifetime);
const auto cache = lifetime.make_state<FingerprintBadgeCache>();
button->paintRequest() | rpl::start_with_next([=] {
button->paintRequest() | rpl::on_next([=] {
auto p = QPainter(button);
const auto outer = button->rect();
@@ -770,7 +770,7 @@ void SetupFingerprintBadgeWidget(
}
}, lifetime);
std::move(repaints) | rpl::start_with_next([=] {
std::move(repaints) | rpl::on_next([=] {
button->update();
}, lifetime);

View File

@@ -259,7 +259,7 @@ void Instance::startOrJoinConferenceCall(StartConferenceInfo args) {
const auto raw = call.get();
session->account().sessionChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
destroyGroupCall(raw);
}, raw->lifetime());
@@ -432,7 +432,7 @@ void Instance::createCall(
const auto raw = call.get();
user->session().account().sessionChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
destroyCall(raw);
}, raw->lifetime());
@@ -446,7 +446,7 @@ void Instance::createCall(
}
if (raw->state() == Call::State::WaitingUserConfirmation) {
_currentCallPanel->startOutgoingRequests(
) | rpl::start_with_next([=](bool video) {
) | rpl::on_next([=](bool video) {
repeater.callback(video, true, repeater);
}, raw->lifetime());
} else {
@@ -488,7 +488,7 @@ void Instance::createGroupCall(
const auto raw = call.get();
info.peer->session().account().sessionChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
destroyGroupCall(raw);
}, raw->lifetime());
@@ -1182,7 +1182,7 @@ void Instance::showConferenceInvite(
const auto raw = call.get();
user->session().account().sessionChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
destroyCall(raw);
}, raw->lifetime());

View File

@@ -273,7 +273,7 @@ void Panel::initWindow() {
: Flag::None;
});
_window->maximizeRequests() | rpl::start_with_next([=](bool maximized) {
_window->maximizeRequests() | rpl::on_next([=](bool maximized) {
toggleFullScreen(maximized);
}, lifetime());
// Don't do that, it looks awful :(
@@ -307,12 +307,12 @@ void Panel::initWidget() {
widget()->setMouseTracking(true);
widget()->paintRequest(
) | rpl::start_with_next([=](QRect clip) {
) | rpl::on_next([=](QRect clip) {
paint(clip);
}, lifetime());
widget()->sizeValue(
) | rpl::skip(1) | rpl::start_with_next([=] {
) | rpl::skip(1) | rpl::on_next([=] {
updateControlsGeometry();
}, lifetime());
}
@@ -467,7 +467,7 @@ void Panel::initConferenceInvite() {
+ padding.right();
const auto height = add + userpics->height() + add;
_status->geometryValue() | rpl::start_with_next([=] {
_status->geometryValue() | rpl::on_next([=] {
const auto top = _bodyTop + _bodySt->participantsTop;
const auto left = (widget()->width() - width) / 2;
raw->setGeometry(left, top, width, height);
@@ -475,7 +475,7 @@ void Panel::initConferenceInvite() {
label->move(add + userpics->width() + padding.left(), padding.top());
}, raw->lifetime());
raw->paintRequest() | rpl::start_with_next([=] {
raw->paintRequest() | rpl::on_next([=] {
auto p = QPainter(raw);
auto hq = PainterHighQualityEnabler(p);
const auto radius = raw->height() / 2.;
@@ -579,7 +579,7 @@ void Panel::reinitWithCall(Call *call) {
});
_call->confereceSupportedValue(
) | rpl::start_with_next([=](bool supported) {
) | rpl::on_next([=](bool supported) {
_conferenceSupported = supported;
_addPeople->toggle(_conferenceSupported
&& (_call->state() != State::WaitingUserConfirmation),
@@ -592,7 +592,7 @@ void Panel::reinitWithCall(Call *call) {
) | rpl::map(rpl::mappers::_1 == Call::RemoteAudioState::Muted);
rpl::duplicate(
remoteMuted
) | rpl::start_with_next([=](bool muted) {
) | rpl::on_next([=](bool muted) {
if (muted) {
createRemoteAudioMute();
} else {
@@ -601,7 +601,7 @@ void Panel::reinitWithCall(Call *call) {
}
}, _callLifetime);
_call->remoteBatteryStateValue(
) | rpl::start_with_next([=](Call::RemoteBatteryState state) {
) | rpl::on_next([=](Call::RemoteBatteryState state) {
if (state == Call::RemoteBatteryState::Low) {
createRemoteLowBattery();
} else {
@@ -621,13 +621,13 @@ void Panel::reinitWithCall(Call *call) {
_window->backend());
_incoming->widget()->hide();
_incoming->rp()->shownValue() | rpl::start_with_next([=] {
_incoming->rp()->shownValue() | rpl::on_next([=] {
updateControlsShown();
}, _incoming->rp()->lifetime());
_hideControlsFilter = nullptr;
_fullScreenOrMaximized.value(
) | rpl::start_with_next([=](bool fullScreenOrMaximized) {
) | rpl::on_next([=](bool fullScreenOrMaximized) {
if (fullScreenOrMaximized) {
class Filter final : public QObject {
public:
@@ -667,7 +667,7 @@ void Panel::reinitWithCall(Call *call) {
}, _incoming->rp()->lifetime());
_call->mutedValue(
) | rpl::start_with_next([=](bool mute) {
) | rpl::on_next([=](bool mute) {
_mute->entity()->setProgress(mute ? 1. : 0.);
_mute->entity()->setText(mute
? tr::lng_call_unmute_audio()
@@ -675,7 +675,7 @@ void Panel::reinitWithCall(Call *call) {
}, _callLifetime);
_call->videoOutgoing()->stateValue(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
{
const auto active = _call->isSharingCamera();
_camera->setProgress(active ? 0. : 1.);
@@ -692,12 +692,12 @@ void Panel::reinitWithCall(Call *call) {
}, _callLifetime);
_call->stateValue(
) | rpl::start_with_next([=](State state) {
) | rpl::on_next([=](State state) {
stateChanged(state);
}, _callLifetime);
_call->videoIncoming()->renderNextFrame(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto track = _call->videoIncoming();
setIncomingSize(track->state() == Webrtc::VideoState::Active
? track->frameSize()
@@ -714,14 +714,14 @@ void Panel::reinitWithCall(Call *call) {
}, _callLifetime);
_call->videoIncoming()->stateValue(
) | rpl::start_with_next([=](Webrtc::VideoState state) {
) | rpl::on_next([=](Webrtc::VideoState state) {
setIncomingSize((state == Webrtc::VideoState::Active)
? _call->videoIncoming()->frameSize()
: QSize());
}, _callLifetime);
_call->videoOutgoing()->renderNextFrame(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto incoming = incomingFrameGeometry();
const auto outgoing = outgoingFrameGeometry();
widget()->update(outgoing);
@@ -735,7 +735,7 @@ void Panel::reinitWithCall(Call *call) {
rpl::single(
rpl::empty_value()
) | rpl::then(_call->videoOutgoing()->renderNextFrame())
) | rpl::start_with_next([=](State state, auto) {
) | rpl::on_next([=](State state, auto) {
if (state != State::Ended
&& state != State::EndedByOtherDevice
&& state != State::Failed
@@ -747,7 +747,7 @@ void Panel::reinitWithCall(Call *call) {
}, _callLifetime);
_call->errors(
) | rpl::start_with_next([=](Error error) {
) | rpl::on_next([=](Error error) {
const auto text = [=] {
switch (error.type) {
case ErrorType::NoCamera:
@@ -802,7 +802,7 @@ void Panel::createRemoteAudioMute() {
_remoteAudioMute->setAttribute(Qt::WA_TransparentForMouseEvents);
_remoteAudioMute->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(_remoteAudioMute);
const auto r = _remoteAudioMute->rect();
@@ -839,7 +839,7 @@ void Panel::createRemoteLowBattery() {
_remoteLowBattery->setAttribute(Qt::WA_TransparentForMouseEvents);
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_remoteLowBattery = nullptr;
createRemoteLowBattery();
}, _remoteLowBattery->lifetime());
@@ -865,7 +865,7 @@ void Panel::createRemoteLowBattery() {
}();
_remoteLowBattery->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto p = QPainter(_remoteLowBattery);
const auto r = _remoteLowBattery->rect();
@@ -905,7 +905,7 @@ void Panel::initLayout() {
) | rpl::filter([=](const Data::PeerUpdate &update) {
// _user may change for the same Panel.
return (_call != nullptr) && (update.peer == _user);
}) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
}) | rpl::on_next([=](const Data::PeerUpdate &update) {
_name->setText(_call->user()->name());
updateControlsGeometry();
}, lifetime());

View File

@@ -34,7 +34,7 @@ PanelBackground::PanelBackground(
_peer,
Data::PeerUpdate::Flag::ColorProfile
| Data::PeerUpdate::Flag::EmojiStatus
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateColors();
_brushSize = QSize();
if (_updateCallback) {
@@ -46,7 +46,7 @@ PanelBackground::PanelBackground(
_peer,
Data::PeerUpdate::Flag::BackgroundEmoji
| Data::PeerUpdate::Flag::EmojiStatus
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateEmojiId();
if (_updateCallback) {
_updateCallback();

View File

@@ -24,7 +24,7 @@ SignalBars::SignalBars(
_st.width + (_st.width + _st.skip) * (Call::kSignalBarCount - 1),
_st.max);
call->signalBarCountValue(
) | rpl::start_with_next([=](int count) {
) | rpl::on_next([=](int count) {
changed(count);
}, lifetime());
}

View File

@@ -186,7 +186,7 @@ public:
installEventFilter(this);
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_crossLineMuteAnimation.invalidate();
}, lifetime());
}
@@ -339,7 +339,7 @@ void TopBar::initControls() {
muted
) | rpl::map(
BarStateFromMuteState
) | rpl::start_with_next([=](BarState state) {
) | rpl::on_next([=](BarState state) {
_isGroupConnecting = (state == BarState::Connecting);
setMuted(state != BarState::Active);
update();
@@ -387,7 +387,7 @@ void TopBar::initControls() {
subscribeToMembersChanges(group);
_isGroupConnecting.value(
) | rpl::start_with_next([=](bool isConnecting) {
) | rpl::on_next([=](bool isConnecting) {
_mute->setAttribute(
Qt::WA_TransparentForMouseEvents,
isConnecting);
@@ -401,7 +401,7 @@ void TopBar::initControls() {
) | rpl::filter([=](const Data::PeerUpdate &update) {
// _user may change for the same Panel.
return (_call != nullptr) && (update.peer == _call->user());
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
updateInfoLabels();
}, lifetime());
}
@@ -491,7 +491,7 @@ void TopBar::initBlobsUnder(
});
group->stateValue(
) | rpl::start_with_next([=](Calls::GroupCall::State state) {
) | rpl::on_next([=](Calls::GroupCall::State state) {
if (state == Calls::GroupCall::State::HangingUp) {
_blobs->hide();
}
@@ -507,7 +507,7 @@ void TopBar::initBlobsUnder(
std::move(
hideBlobs
) | rpl::distinct_until_changed(
) | rpl::start_with_next([=](bool hide) {
) | rpl::on_next([=](bool hide) {
if (hide) {
state->paint.setLevel(0.);
}
@@ -530,7 +530,7 @@ void TopBar::initBlobsUnder(
std::move(
barGeometry
) | rpl::start_with_next([=](QRect rect) {
) | rpl::on_next([=](QRect rect) {
_blobs->resize(
rect.width(),
(int)state->paint.maxRadius());
@@ -538,12 +538,12 @@ void TopBar::initBlobsUnder(
}, lifetime());
shownValue(
) | rpl::start_with_next([=](bool shown) {
) | rpl::on_next([=](bool shown) {
_blobs->setVisible(shown);
}, lifetime());
_blobs->paintRequest(
) | rpl::start_with_next([=](QRect clip) {
) | rpl::on_next([=](QRect clip) {
const auto hidden = state->hideAnimation.value(
state->hideLastTime ? 1. : 0.);
if (hidden == 1.) {
@@ -563,7 +563,7 @@ void TopBar::initBlobsUnder(
group->levelUpdates(
) | rpl::filter([=](const LevelUpdate &update) {
return !state->hideLastTime && (update.value > state->lastLevel);
}) | rpl::start_with_next([=](const LevelUpdate &update) {
}) | rpl::on_next([=](const LevelUpdate &update) {
if (state->lastLevel == 0.) {
state->levelTimer.callEach(kBlobUpdateInterval);
}
@@ -597,7 +597,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
std::move(
realValue
) | rpl::before_next([=](not_null<Data::GroupCall*> real) {
real->titleValue() | rpl::start_with_next([=] {
real->titleValue() | rpl::on_next([=] {
updateInfoLabels();
}, lifetime());
}) | rpl::map([=](not_null<Data::GroupCall*> real) {
@@ -617,7 +617,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
}
}
return false;
}) | rpl::start_with_next([=](const Ui::GroupCallBarContent &content) {
}) | rpl::on_next([=](const Ui::GroupCallBarContent &content) {
_users = content.users;
_usersCount = content.count;
for (auto &user : _users) {
@@ -630,7 +630,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
}, lifetime());
_userpics->widthValue(
) | rpl::start_with_next([=](int width) {
) | rpl::on_next([=](int width) {
_userpicsWidth = width;
updateControlsGeometry();
}, lifetime());
@@ -641,7 +641,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
// _peer may change for the same Panel.
const auto call = _groupCall.get();
return (call != nullptr) && (update.peer == call->peer());
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
updateInfoLabels();
}, lifetime());
}

View File

@@ -58,25 +58,25 @@ void Userpic::setup(rpl::producer<bool> muted) {
_content.setAttribute(Qt::WA_TransparentForMouseEvents);
_content.paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
paint();
}, lifetime());
std::move(
muted
) | rpl::start_with_next([=](bool muted) {
) | rpl::on_next([=](bool muted) {
setMuted(muted);
}, lifetime());
_peer->session().changes().peerFlagsValue(
_peer,
Data::PeerUpdate::Flag::Photo
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
processPhoto();
}, lifetime());
_peer->session().downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
refreshPhoto();
}, lifetime());

View File

@@ -30,17 +30,17 @@ void VideoBubble::setup() {
applyDragMode(_dragMode);
_content.paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
paint();
}, lifetime());
_track->stateValue(
) | rpl::start_with_next([=](Webrtc::VideoState state) {
) | rpl::on_next([=](Webrtc::VideoState state) {
setState(state);
}, lifetime());
_track->renderNextFrame(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (_track->frameSize().isEmpty()) {
_track->markFrameShown();
} else {

View File

@@ -114,7 +114,7 @@ private:
Panel::Incoming::RendererGL::RendererGL(not_null<Incoming*> owner)
: _owner(owner) {
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_controlsShadowImage.invalidate();
}, _lifetime);
}

Some files were not shown because too many files have changed in this diff Show More