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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -153,7 +153,7 @@ PeerPhoto::PeerPhoto(not_null<ApiWrap*> api)
// You can't use _session->lifetime() in the constructor, // You can't use _session->lifetime() in the constructor,
// only queued, because it is not constructed yet. // only queued, because it is not constructed yet.
_session->uploader().photoReady( _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); ready(data.fullId, data.info.file, std::nullopt);
}, _session->lifetime()); }, _session->lifetime());
}); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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