mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Merge tag 'v6.3.10' & extra into dev
This commit is contained in:
@@ -207,7 +207,7 @@ void ListController::prepare() {
|
||||
|
||||
session().changes().peerUpdates(
|
||||
Data::PeerUpdate::Flag::GroupCall
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
processPeer(update.peer);
|
||||
finishProcess();
|
||||
}, lifetime());
|
||||
@@ -493,7 +493,7 @@ Main::Session &BoxController::session() const {
|
||||
|
||||
void BoxController::prepare() {
|
||||
session().data().itemRemoved(
|
||||
) | rpl::start_with_next([=](not_null<const HistoryItem*> item) {
|
||||
) | rpl::on_next([=](not_null<const HistoryItem*> item) {
|
||||
if (const auto row = rowForItem(item)) {
|
||||
row->itemRemoved(item);
|
||||
if (!row->hasItems()) {
|
||||
@@ -511,7 +511,7 @@ void BoxController::prepare() {
|
||||
) | rpl::filter([=](const Data::MessageUpdate &update) {
|
||||
const auto media = update.item->media();
|
||||
return (media != nullptr) && (media->call() != nullptr);
|
||||
}) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
|
||||
}) | rpl::on_next([=](const Data::MessageUpdate &update) {
|
||||
insertRow(update.item, InsertWay::Prepend);
|
||||
}, lifetime());
|
||||
|
||||
@@ -783,14 +783,14 @@ void ClearCallsBox(
|
||||
lt_count,
|
||||
rpl::single(controller->session().appConfig().confcallSizeLimit()
|
||||
* 1.),
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
|
||||
const auto icon = Ui::CreateChild<Info::Profile::FloatingIcon>(
|
||||
result,
|
||||
st::inviteViaLinkIcon,
|
||||
QPoint());
|
||||
result->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
icon->moveToLeft(
|
||||
st::inviteViaLinkIconPosition.x(),
|
||||
(height - st::inviteViaLinkIcon.height()) / 2);
|
||||
@@ -846,7 +846,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) {
|
||||
button->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||
return (e->type() == QEvent::Enter);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
state->callsDelegate.peerListMouseLeftGeometry();
|
||||
}, button->lifetime());
|
||||
|
||||
@@ -858,7 +858,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) {
|
||||
|
||||
box->setWidth(state->callsController.contentWidth());
|
||||
state->callsController.boxHeightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
box->setMinHeight(height);
|
||||
}, box->lifetime());
|
||||
box->setTitle(tr::lng_call_box_title());
|
||||
|
||||
@@ -349,7 +349,7 @@ void Call::startOutgoing() {
|
||||
: MTPphone_RequestCall::Flag(0);
|
||||
_api.request(MTPphone_RequestCall(
|
||||
MTP_flags(flags),
|
||||
_user->inputUser,
|
||||
_user->inputUser(),
|
||||
MTP_int(base::RandomValue<int32>()),
|
||||
MTP_bytes(_gaHash),
|
||||
MTP_phoneCallProtocol(
|
||||
@@ -530,7 +530,7 @@ void Call::setupMediaDevices() {
|
||||
|
||||
_playbackDeviceId.changes() | rpl::filter([=] {
|
||||
return _instance && _setDeviceIdCallback;
|
||||
}) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
}) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
_setDeviceIdCallback(deviceId);
|
||||
|
||||
// Value doesn't matter here, just trigger reading of the new value.
|
||||
@@ -539,7 +539,7 @@ void Call::setupMediaDevices() {
|
||||
|
||||
_captureDeviceId.changes() | rpl::filter([=] {
|
||||
return _instance && _setDeviceIdCallback;
|
||||
}) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
}) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
_setDeviceIdCallback(deviceId);
|
||||
|
||||
// Value doesn't matter here, just trigger reading of the new value.
|
||||
@@ -557,7 +557,7 @@ void Call::setupOutgoingVideo() {
|
||||
_videoOutgoing->setState(Webrtc::VideoState::Inactive);
|
||||
}
|
||||
_videoOutgoing->stateValue(
|
||||
) | rpl::start_with_next([=](Webrtc::VideoState state) {
|
||||
) | rpl::on_next([=](Webrtc::VideoState state) {
|
||||
if (state != Webrtc::VideoState::Inactive
|
||||
&& cameraId().isEmpty()
|
||||
&& !_videoCaptureIsScreencast) {
|
||||
@@ -598,7 +598,7 @@ void Call::setupOutgoingVideo() {
|
||||
_cameraDeviceId.changes(
|
||||
) | rpl::filter([=] {
|
||||
return !_videoCaptureIsScreencast;
|
||||
}) | rpl::start_with_next([=](Webrtc::DeviceResolvedId deviceId) {
|
||||
}) | rpl::on_next([=](Webrtc::DeviceResolvedId deviceId) {
|
||||
const auto &id = deviceId.value;
|
||||
_videoCaptureDeviceId = id;
|
||||
if (_videoCapture) {
|
||||
@@ -822,7 +822,7 @@ bool Call::handleUpdate(const MTPPhoneCall &call) {
|
||||
box->sends(
|
||||
) | rpl::take(
|
||||
1 // Instead of keeping requestId.
|
||||
) | rpl::start_with_next([=](const Ui::RateCallBox::Result &r) {
|
||||
) | rpl::on_next([=](const Ui::RateCallBox::Result &r) {
|
||||
sender->request(MTPphone_SetCallRating(
|
||||
MTP_flags(0),
|
||||
MTP_inputPhoneCall(
|
||||
@@ -1196,7 +1196,7 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
|
||||
raw->setIncomingVideoOutput(_videoIncoming->sink());
|
||||
raw->setAudioOutputDuckingEnabled(settings.callAudioDuckingEnabled());
|
||||
|
||||
_state.value() | rpl::start_with_next([=](State state) {
|
||||
_state.value() | rpl::on_next([=](State state) {
|
||||
const auto track = (state != State::FailedHangingUp)
|
||||
&& (state != State::Failed)
|
||||
&& (state != State::HangingUp)
|
||||
@@ -1207,13 +1207,13 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
|
||||
Core::App().mediaDevices().setCaptureMuteTracker(this, track);
|
||||
}, _instanceLifetime);
|
||||
|
||||
_muted.value() | rpl::start_with_next([=](bool muted) {
|
||||
_muted.value() | rpl::on_next([=](bool muted) {
|
||||
Core::App().mediaDevices().setCaptureMuted(muted);
|
||||
}, _instanceLifetime);
|
||||
|
||||
#if 0
|
||||
Core::App().batterySaving().value(
|
||||
) | rpl::start_with_next([=](bool isSaving) {
|
||||
) | rpl::on_next([=](bool isSaving) {
|
||||
crl::on_main(weak, [=] {
|
||||
if (_instance) {
|
||||
_instance->setIsLowBatteryLevel(isSaving);
|
||||
|
||||
@@ -150,7 +150,7 @@ void WebrtcController::setOnStateUpdated(
|
||||
Fn<void(TgVoipState)> onStateUpdated) {
|
||||
_stateUpdatedLifetime.destroy();
|
||||
_impl->state().changes(
|
||||
) | rpl::start_with_next([=](CallState state) {
|
||||
) | rpl::on_next([=](CallState state) {
|
||||
onStateUpdated([&] {
|
||||
switch (state) {
|
||||
case CallState::Initializing: return TgVoipState::WaitInit;
|
||||
|
||||
@@ -205,7 +205,7 @@ base::unique_qptr<Ui::RpWidget> CreateFingerprintAndSignalBars(
|
||||
call->user()->name()));
|
||||
raw->setMouseTracking(true);
|
||||
raw->events(
|
||||
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
) | rpl::on_next([=](not_null<QEvent*> e) {
|
||||
if (e->type() == QEvent::MouseMove) {
|
||||
Ui::Tooltip::Show(kTooltipShowTimeoutMs, shower);
|
||||
} else if (e->type() == QEvent::Leave) {
|
||||
@@ -254,7 +254,7 @@ base::unique_qptr<Ui::RpWidget> CreateFingerprintAndSignalBars(
|
||||
rpl::single(rpl::empty),
|
||||
Ui::Emoji::Updated(),
|
||||
style::PaletteChanged()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
background->fill(Qt::transparent);
|
||||
|
||||
// Prepare.
|
||||
@@ -300,7 +300,7 @@ base::unique_qptr<Ui::RpWidget> CreateFingerprintAndSignalBars(
|
||||
}, raw->lifetime());
|
||||
|
||||
raw->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
QPainter(raw).drawImage(raw->rect(), *background);
|
||||
}, raw->lifetime());
|
||||
|
||||
@@ -522,7 +522,7 @@ FingerprintBadge SetupFingerprintBadge(
|
||||
|
||||
std::move(
|
||||
fingerprint
|
||||
) | rpl::start_with_next([=](const QByteArray &fingerprint) {
|
||||
) | rpl::on_next([=](const QByteArray &fingerprint) {
|
||||
auto buffered = base::BufferedRandom<uint32>(
|
||||
kEmojiInCarousel * kEmojiInFingerprint);
|
||||
const auto now = crl::now();
|
||||
@@ -592,7 +592,7 @@ void SetupFingerprintTooltip(not_null<Ui::RpWidget*> widget) {
|
||||
}
|
||||
const auto text = tr::lng_confcall_e2e_about(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities);
|
||||
tr::marked);
|
||||
if (text.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -615,7 +615,7 @@ void SetupFingerprintTooltip(not_null<Ui::RpWidget*> widget) {
|
||||
raw->toggleAnimated(true);
|
||||
};
|
||||
|
||||
widget->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
widget->events() | rpl::on_next([=](not_null<QEvent*> e) {
|
||||
const auto type = e->type();
|
||||
if (type == QEvent::Enter) {
|
||||
// Enter events may come from widget destructors,
|
||||
@@ -681,7 +681,7 @@ void SetupFingerprintBadgeWidget(
|
||||
const auto ratio = style::DevicePixelRatio();
|
||||
const auto esize = Ui::Emoji::GetSizeNormal();
|
||||
const auto size = esize / ratio;
|
||||
widget->widthValue() | rpl::start_with_next([=](int width) {
|
||||
widget->widthValue() | rpl::on_next([=](int width) {
|
||||
static_assert(!(kEmojiInFingerprint % 2));
|
||||
|
||||
const auto available = width
|
||||
@@ -729,7 +729,7 @@ void SetupFingerprintBadgeWidget(
|
||||
}, lifetime);
|
||||
|
||||
const auto cache = lifetime.make_state<FingerprintBadgeCache>();
|
||||
button->paintRequest() | rpl::start_with_next([=] {
|
||||
button->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(button);
|
||||
|
||||
const auto outer = button->rect();
|
||||
@@ -770,7 +770,7 @@ void SetupFingerprintBadgeWidget(
|
||||
}
|
||||
}, lifetime);
|
||||
|
||||
std::move(repaints) | rpl::start_with_next([=] {
|
||||
std::move(repaints) | rpl::on_next([=] {
|
||||
button->update();
|
||||
}, lifetime);
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ void Instance::startOrJoinConferenceCall(StartConferenceInfo args) {
|
||||
const auto raw = call.get();
|
||||
|
||||
session->account().sessionChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
destroyGroupCall(raw);
|
||||
}, raw->lifetime());
|
||||
|
||||
@@ -432,7 +432,7 @@ void Instance::createCall(
|
||||
const auto raw = call.get();
|
||||
|
||||
user->session().account().sessionChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
destroyCall(raw);
|
||||
}, raw->lifetime());
|
||||
|
||||
@@ -446,7 +446,7 @@ void Instance::createCall(
|
||||
}
|
||||
if (raw->state() == Call::State::WaitingUserConfirmation) {
|
||||
_currentCallPanel->startOutgoingRequests(
|
||||
) | rpl::start_with_next([=](bool video) {
|
||||
) | rpl::on_next([=](bool video) {
|
||||
repeater.callback(video, true, repeater);
|
||||
}, raw->lifetime());
|
||||
} else {
|
||||
@@ -488,7 +488,7 @@ void Instance::createGroupCall(
|
||||
const auto raw = call.get();
|
||||
|
||||
info.peer->session().account().sessionChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
destroyGroupCall(raw);
|
||||
}, raw->lifetime());
|
||||
|
||||
@@ -1182,7 +1182,7 @@ void Instance::showConferenceInvite(
|
||||
const auto raw = call.get();
|
||||
|
||||
user->session().account().sessionChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
destroyCall(raw);
|
||||
}, raw->lifetime());
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "calls/calls_panel.h"
|
||||
|
||||
#include "boxes/peers/replace_boost_box.h" // CreateUserpicsWithMoreBadge
|
||||
#include "calls/calls_panel_background.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
@@ -272,7 +273,7 @@ void Panel::initWindow() {
|
||||
: Flag::None;
|
||||
});
|
||||
|
||||
_window->maximizeRequests() | rpl::start_with_next([=](bool maximized) {
|
||||
_window->maximizeRequests() | rpl::on_next([=](bool maximized) {
|
||||
toggleFullScreen(maximized);
|
||||
}, lifetime());
|
||||
// Don't do that, it looks awful :(
|
||||
@@ -306,12 +307,12 @@ void Panel::initWidget() {
|
||||
widget()->setMouseTracking(true);
|
||||
|
||||
widget()->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
paint(clip);
|
||||
}, lifetime());
|
||||
|
||||
widget()->sizeValue(
|
||||
) | rpl::skip(1) | rpl::start_with_next([=] {
|
||||
) | rpl::skip(1) | rpl::on_next([=] {
|
||||
updateControlsGeometry();
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -466,7 +467,7 @@ void Panel::initConferenceInvite() {
|
||||
+ padding.right();
|
||||
const auto height = add + userpics->height() + add;
|
||||
|
||||
_status->geometryValue() | rpl::start_with_next([=] {
|
||||
_status->geometryValue() | rpl::on_next([=] {
|
||||
const auto top = _bodyTop + _bodySt->participantsTop;
|
||||
const auto left = (widget()->width() - width) / 2;
|
||||
raw->setGeometry(left, top, width, height);
|
||||
@@ -474,7 +475,7 @@ void Panel::initConferenceInvite() {
|
||||
label->move(add + userpics->width() + padding.left(), padding.top());
|
||||
}, raw->lifetime());
|
||||
|
||||
raw->paintRequest() | rpl::start_with_next([=] {
|
||||
raw->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(raw);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
const auto radius = raw->height() / 2.;
|
||||
@@ -570,8 +571,15 @@ void Panel::reinitWithCall(Call *call) {
|
||||
|
||||
_user = _call->user();
|
||||
|
||||
_background = std::make_unique<PanelBackground>(
|
||||
_user,
|
||||
[=] {
|
||||
updateTextColors();
|
||||
widget()->update();
|
||||
});
|
||||
|
||||
_call->confereceSupportedValue(
|
||||
) | rpl::start_with_next([=](bool supported) {
|
||||
) | rpl::on_next([=](bool supported) {
|
||||
_conferenceSupported = supported;
|
||||
_addPeople->toggle(_conferenceSupported
|
||||
&& (_call->state() != State::WaitingUserConfirmation),
|
||||
@@ -584,7 +592,7 @@ void Panel::reinitWithCall(Call *call) {
|
||||
) | rpl::map(rpl::mappers::_1 == Call::RemoteAudioState::Muted);
|
||||
rpl::duplicate(
|
||||
remoteMuted
|
||||
) | rpl::start_with_next([=](bool muted) {
|
||||
) | rpl::on_next([=](bool muted) {
|
||||
if (muted) {
|
||||
createRemoteAudioMute();
|
||||
} else {
|
||||
@@ -593,7 +601,7 @@ void Panel::reinitWithCall(Call *call) {
|
||||
}
|
||||
}, _callLifetime);
|
||||
_call->remoteBatteryStateValue(
|
||||
) | rpl::start_with_next([=](Call::RemoteBatteryState state) {
|
||||
) | rpl::on_next([=](Call::RemoteBatteryState state) {
|
||||
if (state == Call::RemoteBatteryState::Low) {
|
||||
createRemoteLowBattery();
|
||||
} else {
|
||||
@@ -613,13 +621,13 @@ void Panel::reinitWithCall(Call *call) {
|
||||
_window->backend());
|
||||
_incoming->widget()->hide();
|
||||
|
||||
_incoming->rp()->shownValue() | rpl::start_with_next([=] {
|
||||
_incoming->rp()->shownValue() | rpl::on_next([=] {
|
||||
updateControlsShown();
|
||||
}, _incoming->rp()->lifetime());
|
||||
|
||||
_hideControlsFilter = nullptr;
|
||||
_fullScreenOrMaximized.value(
|
||||
) | rpl::start_with_next([=](bool fullScreenOrMaximized) {
|
||||
) | rpl::on_next([=](bool fullScreenOrMaximized) {
|
||||
if (fullScreenOrMaximized) {
|
||||
class Filter final : public QObject {
|
||||
public:
|
||||
@@ -659,7 +667,7 @@ void Panel::reinitWithCall(Call *call) {
|
||||
}, _incoming->rp()->lifetime());
|
||||
|
||||
_call->mutedValue(
|
||||
) | rpl::start_with_next([=](bool mute) {
|
||||
) | rpl::on_next([=](bool mute) {
|
||||
_mute->entity()->setProgress(mute ? 1. : 0.);
|
||||
_mute->entity()->setText(mute
|
||||
? tr::lng_call_unmute_audio()
|
||||
@@ -667,7 +675,7 @@ void Panel::reinitWithCall(Call *call) {
|
||||
}, _callLifetime);
|
||||
|
||||
_call->videoOutgoing()->stateValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
{
|
||||
const auto active = _call->isSharingCamera();
|
||||
_camera->setProgress(active ? 0. : 1.);
|
||||
@@ -684,12 +692,12 @@ void Panel::reinitWithCall(Call *call) {
|
||||
}, _callLifetime);
|
||||
|
||||
_call->stateValue(
|
||||
) | rpl::start_with_next([=](State state) {
|
||||
) | rpl::on_next([=](State state) {
|
||||
stateChanged(state);
|
||||
}, _callLifetime);
|
||||
|
||||
_call->videoIncoming()->renderNextFrame(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto track = _call->videoIncoming();
|
||||
setIncomingSize(track->state() == Webrtc::VideoState::Active
|
||||
? track->frameSize()
|
||||
@@ -706,14 +714,14 @@ void Panel::reinitWithCall(Call *call) {
|
||||
}, _callLifetime);
|
||||
|
||||
_call->videoIncoming()->stateValue(
|
||||
) | rpl::start_with_next([=](Webrtc::VideoState state) {
|
||||
) | rpl::on_next([=](Webrtc::VideoState state) {
|
||||
setIncomingSize((state == Webrtc::VideoState::Active)
|
||||
? _call->videoIncoming()->frameSize()
|
||||
: QSize());
|
||||
}, _callLifetime);
|
||||
|
||||
_call->videoOutgoing()->renderNextFrame(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto incoming = incomingFrameGeometry();
|
||||
const auto outgoing = outgoingFrameGeometry();
|
||||
widget()->update(outgoing);
|
||||
@@ -727,7 +735,7 @@ void Panel::reinitWithCall(Call *call) {
|
||||
rpl::single(
|
||||
rpl::empty_value()
|
||||
) | rpl::then(_call->videoOutgoing()->renderNextFrame())
|
||||
) | rpl::start_with_next([=](State state, auto) {
|
||||
) | rpl::on_next([=](State state, auto) {
|
||||
if (state != State::Ended
|
||||
&& state != State::EndedByOtherDevice
|
||||
&& state != State::Failed
|
||||
@@ -739,7 +747,7 @@ void Panel::reinitWithCall(Call *call) {
|
||||
}, _callLifetime);
|
||||
|
||||
_call->errors(
|
||||
) | rpl::start_with_next([=](Error error) {
|
||||
) | rpl::on_next([=](Error error) {
|
||||
const auto text = [=] {
|
||||
switch (error.type) {
|
||||
case ErrorType::NoCamera:
|
||||
@@ -763,6 +771,7 @@ void Panel::reinitWithCall(Call *call) {
|
||||
|
||||
_name->setText(_user->name());
|
||||
updateStatusText(_call->state());
|
||||
updateTextColors();
|
||||
|
||||
_answerHangupRedial->raise();
|
||||
_decline->raise();
|
||||
@@ -793,7 +802,7 @@ void Panel::createRemoteAudioMute() {
|
||||
_remoteAudioMute->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
_remoteAudioMute->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = QPainter(_remoteAudioMute);
|
||||
const auto r = _remoteAudioMute->rect();
|
||||
|
||||
@@ -830,7 +839,7 @@ void Panel::createRemoteLowBattery() {
|
||||
_remoteLowBattery->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_remoteLowBattery = nullptr;
|
||||
createRemoteLowBattery();
|
||||
}, _remoteLowBattery->lifetime());
|
||||
@@ -856,7 +865,7 @@ void Panel::createRemoteLowBattery() {
|
||||
}();
|
||||
|
||||
_remoteLowBattery->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = QPainter(_remoteLowBattery);
|
||||
const auto r = _remoteLowBattery->rect();
|
||||
|
||||
@@ -896,7 +905,7 @@ void Panel::initLayout() {
|
||||
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||
// _user may change for the same Panel.
|
||||
return (_call != nullptr) && (update.peer == _user);
|
||||
}) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
}) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
_name->setText(_call->user()->name());
|
||||
updateControlsGeometry();
|
||||
}, lifetime());
|
||||
@@ -1239,9 +1248,21 @@ void Panel::paint(QRect clip) {
|
||||
if (!_incoming->widget()->isHidden()) {
|
||||
region = region.subtracted(QRegion(_incoming->widget()->geometry()));
|
||||
}
|
||||
for (const auto &rect : region) {
|
||||
p.fillRect(rect, st::callBgOpaque);
|
||||
|
||||
if (_background) {
|
||||
_background->paint(
|
||||
p,
|
||||
widget()->size(),
|
||||
_bodyTop,
|
||||
_bodySt->photoTop,
|
||||
_bodySt->photoSize,
|
||||
region);
|
||||
} else {
|
||||
for (const auto &rect : region) {
|
||||
p.fillRect(rect, st::callBgOpaque);
|
||||
}
|
||||
}
|
||||
|
||||
if (_incoming && _incoming->widget()->isHidden()) {
|
||||
_call->videoIncoming()->markFrameShown();
|
||||
}
|
||||
@@ -1403,6 +1424,18 @@ void Panel::updateStatusText(State state) {
|
||||
updateStatusGeometry();
|
||||
}
|
||||
|
||||
void Panel::updateTextColors() {
|
||||
if (!_background) {
|
||||
_name->setTextColorOverride(std::nullopt);
|
||||
_status->setTextColorOverride(std::nullopt);
|
||||
return;
|
||||
}
|
||||
_name->setTextColorOverride(
|
||||
_background->textColorOverride(st::callName.textFg));
|
||||
_status->setTextColorOverride(
|
||||
_background->textColorOverride(st::callStatus.textFg));
|
||||
}
|
||||
|
||||
void Panel::startDurationUpdateTimer(crl::time currentDuration) {
|
||||
auto msTillNextSecond = 1000 - (currentDuration % 1000);
|
||||
_updateDurationTimer.callOnce(msTillNextSecond + 5);
|
||||
|
||||
@@ -64,6 +64,7 @@ class Window;
|
||||
class Userpic;
|
||||
class SignalBars;
|
||||
class VideoBubble;
|
||||
class PanelBackground;
|
||||
struct DeviceSelection;
|
||||
struct ConferencePanelMigration;
|
||||
|
||||
@@ -140,6 +141,7 @@ private:
|
||||
void stateChanged(State state);
|
||||
void showControls();
|
||||
void updateStatusText(State state);
|
||||
void updateTextColors();
|
||||
void startDurationUpdateTimer(crl::time currentDuration);
|
||||
void setIncomingSize(QSize size);
|
||||
void refreshIncomingGeometry();
|
||||
@@ -214,6 +216,8 @@ private:
|
||||
|
||||
rpl::event_stream<bool> _startOutgoingRequests;
|
||||
|
||||
std::unique_ptr<PanelBackground> _background;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "calls/calls_panel_background.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_peer_colors.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_emoji_statuses.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/stickers/data_custom_emoji.h"
|
||||
#include "main/main_session.h"
|
||||
#include "ui/color_contrast.h"
|
||||
#include "ui/top_background_gradient.h"
|
||||
#include "styles/style_calls.h"
|
||||
|
||||
namespace Calls {
|
||||
|
||||
PanelBackground::PanelBackground(
|
||||
not_null<PeerData*> peer,
|
||||
Fn<void()> updateCallback)
|
||||
: _peer(peer)
|
||||
, _updateCallback(std::move(updateCallback)) {
|
||||
updateColors();
|
||||
updateEmojiId();
|
||||
|
||||
_peer->session().changes().peerFlagsValue(
|
||||
_peer,
|
||||
Data::PeerUpdate::Flag::ColorProfile
|
||||
| Data::PeerUpdate::Flag::EmojiStatus
|
||||
) | rpl::on_next([=] {
|
||||
updateColors();
|
||||
_brushSize = QSize();
|
||||
if (_updateCallback) {
|
||||
_updateCallback();
|
||||
}
|
||||
}, _lifetime);
|
||||
|
||||
_peer->session().changes().peerFlagsValue(
|
||||
_peer,
|
||||
Data::PeerUpdate::Flag::BackgroundEmoji
|
||||
| Data::PeerUpdate::Flag::EmojiStatus
|
||||
) | rpl::on_next([=] {
|
||||
updateEmojiId();
|
||||
if (_updateCallback) {
|
||||
_updateCallback();
|
||||
}
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
void PanelBackground::paint(
|
||||
QPainter &p,
|
||||
QSize widgetSize,
|
||||
int bodyTop,
|
||||
int photoTop,
|
||||
int photoSize,
|
||||
const QRegion ®ion) {
|
||||
if (!_colors || _colors->bg.empty()) {
|
||||
for (const auto &rect : region) {
|
||||
p.fillRect(rect, st::callBgOpaque);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &colors = _colors->bg;
|
||||
if (colors.size() == 1) {
|
||||
for (const auto &rect : region) {
|
||||
p.fillRect(rect, colors.front());
|
||||
}
|
||||
} else {
|
||||
const auto center = QPoint(
|
||||
widgetSize.width() / 2,
|
||||
bodyTop + photoTop + photoSize / 2);
|
||||
const auto radius = std::max(
|
||||
std::hypot(center.x(), center.y()),
|
||||
std::hypot(widgetSize.width() - center.x(),
|
||||
widgetSize.height() - center.y()));
|
||||
if (_brushSize != widgetSize) {
|
||||
updateBrush(widgetSize, center, radius, colors);
|
||||
}
|
||||
for (const auto &rect : region) {
|
||||
p.fillRect(rect, _brush);
|
||||
}
|
||||
}
|
||||
|
||||
const auto emojiId = _currentEmojiId;
|
||||
if (!emojiId) {
|
||||
_emoji = nullptr;
|
||||
_cachedImage = QImage();
|
||||
_cachedEmojiId = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const auto userpicX = (widgetSize.width() - photoSize) / 2;
|
||||
const auto userpicY = bodyTop + photoTop;
|
||||
const auto padding = photoSize;
|
||||
const auto patternRect = QRect(
|
||||
userpicX - padding,
|
||||
userpicY - padding / 2,
|
||||
photoSize + padding * 2,
|
||||
photoSize + padding);
|
||||
|
||||
if (!_emoji
|
||||
|| _emoji->entityData()
|
||||
!= Data::SerializeCustomEmojiId(emojiId)) {
|
||||
const auto document = _peer->owner().document(emojiId);
|
||||
_emoji = document->owner().customEmojiManager().create(
|
||||
document,
|
||||
[=] {
|
||||
_cachedImage = QImage();
|
||||
if (_updateCallback) {
|
||||
_updateCallback();
|
||||
}
|
||||
},
|
||||
Data::CustomEmojiSizeTag::Large);
|
||||
_cachedImage = QImage();
|
||||
_cachedEmojiId = 0;
|
||||
}
|
||||
|
||||
if (_emoji && _emoji->ready()) {
|
||||
if (_cachedImage.isNull()
|
||||
|| _cachedRect != patternRect
|
||||
|| _cachedEmojiId != emojiId) {
|
||||
renderPattern(patternRect, emojiId);
|
||||
}
|
||||
p.drawImage(patternRect, _cachedImage);
|
||||
}
|
||||
}
|
||||
|
||||
void PanelBackground::updateBrush(
|
||||
QSize widgetSize,
|
||||
QPoint center,
|
||||
float64 radius,
|
||||
const std::vector<QColor> &colors) {
|
||||
_brushSize = widgetSize;
|
||||
auto gradient = QRadialGradient(center, radius);
|
||||
const auto step = 1.0 / (colors.size() - 1);
|
||||
for (auto i = 0; i < colors.size(); ++i) {
|
||||
gradient.setColorAt(i * step, colors[colors.size() - 1 - i]);
|
||||
}
|
||||
_brush = QBrush(gradient);
|
||||
}
|
||||
|
||||
void PanelBackground::renderPattern(const QRect &rect, DocumentId emojiId) {
|
||||
const auto ratio = style::DevicePixelRatio();
|
||||
_cachedImage = QImage(
|
||||
rect.size() * ratio,
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
_cachedImage.setDevicePixelRatio(ratio);
|
||||
_cachedImage.fill(Qt::transparent);
|
||||
|
||||
auto painter = QPainter(&_cachedImage);
|
||||
const auto patternColor = QColor(0, 0, 0, int(0.6 * 255));
|
||||
const auto &points = Ui::PatternBgPoints();
|
||||
const auto localRect = QRect(QPoint(), rect.size());
|
||||
Ui::PaintBgPoints(
|
||||
painter,
|
||||
points,
|
||||
_cache,
|
||||
_emoji.get(),
|
||||
patternColor,
|
||||
localRect,
|
||||
1.);
|
||||
|
||||
_cachedRect = rect;
|
||||
_cachedEmojiId = emojiId;
|
||||
}
|
||||
|
||||
void PanelBackground::updateColors() {
|
||||
const auto collectible = _peer->emojiStatusId().collectible;
|
||||
if (collectible && collectible->centerColor.isValid()) {
|
||||
_colors = Data::ColorProfileSet{
|
||||
.bg = { collectible->edgeColor, collectible->centerColor },
|
||||
};
|
||||
} else {
|
||||
_colors = _peer->session().api().peerColors().colorProfileFor(_peer);
|
||||
}
|
||||
}
|
||||
|
||||
void PanelBackground::updateEmojiId() {
|
||||
const auto collectible = _peer->emojiStatusId().collectible;
|
||||
_currentEmojiId = (collectible && collectible->patternDocumentId)
|
||||
? collectible->patternDocumentId
|
||||
: _peer->profileBackgroundEmojiId();
|
||||
}
|
||||
|
||||
std::optional<QColor> PanelBackground::edgeColor() const {
|
||||
const auto collectible = _peer->emojiStatusId().collectible;
|
||||
if (collectible && collectible->edgeColor.isValid()) {
|
||||
return collectible->edgeColor;
|
||||
}
|
||||
if (_colors && !_colors->bg.empty()) {
|
||||
return _colors->bg.front();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<QColor> PanelBackground::textColorOverride(
|
||||
const style::color &defaultColor) const {
|
||||
const auto collectible = _peer->emojiStatusId().collectible;
|
||||
if (collectible && collectible->textColor.isValid()) {
|
||||
return collectible->textColor;
|
||||
}
|
||||
const auto edge = edgeColor();
|
||||
if (!edge) {
|
||||
return std::nullopt;
|
||||
}
|
||||
constexpr auto kMinContrast = 5.5;
|
||||
if (kMinContrast > Ui::CountContrast(defaultColor->c, *edge)) {
|
||||
return st::groupCallMembersFg->c;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
rpl::lifetime &PanelBackground::lifetime() {
|
||||
return _lifetime;
|
||||
}
|
||||
|
||||
} // namespace Calls
|
||||
@@ -0,0 +1,75 @@
|
||||
// This file is part of Desktop App Toolkit,
|
||||
// a set of libraries for developing nice desktop applications.
|
||||
//
|
||||
// For license and copyright information please follow this link:
|
||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "data/data_peer_colors.h"
|
||||
|
||||
class DocumentData;
|
||||
class PeerData;
|
||||
|
||||
namespace Data {
|
||||
class CustomEmoji;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
namespace Text {
|
||||
class CustomEmoji;
|
||||
} // namespace Text
|
||||
} // namespace Ui
|
||||
|
||||
namespace Calls {
|
||||
|
||||
class PanelBackground final {
|
||||
public:
|
||||
explicit PanelBackground(
|
||||
not_null<PeerData*> peer,
|
||||
Fn<void()> updateCallback);
|
||||
|
||||
void paint(
|
||||
QPainter &p,
|
||||
QSize widgetSize,
|
||||
int bodyTop,
|
||||
int photoTop,
|
||||
int photoSize,
|
||||
const QRegion ®ion);
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime();
|
||||
|
||||
[[nodiscard]] std::optional<QColor> textColorOverride(
|
||||
const style::color &defaultColor) const;
|
||||
|
||||
private:
|
||||
void updateBrush(
|
||||
QSize widgetSize,
|
||||
QPoint center,
|
||||
float64 radius,
|
||||
const std::vector<QColor> &colors);
|
||||
void renderPattern(const QRect &rect, DocumentId emojiId);
|
||||
void updateColors();
|
||||
void updateEmojiId();
|
||||
[[nodiscard]] std::optional<QColor> edgeColor() const;
|
||||
|
||||
const not_null<PeerData*> _peer;
|
||||
const Fn<void()> _updateCallback;
|
||||
|
||||
QBrush _brush;
|
||||
QSize _brushSize;
|
||||
|
||||
std::optional<Data::ColorProfileSet> _colors;
|
||||
|
||||
std::unique_ptr<Ui::Text::CustomEmoji> _emoji;
|
||||
base::flat_map<float64, QImage> _cache;
|
||||
QImage _cachedImage;
|
||||
QRect _cachedRect;
|
||||
DocumentId _cachedEmojiId = 0;
|
||||
DocumentId _currentEmojiId = 0;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Calls
|
||||
@@ -24,7 +24,7 @@ SignalBars::SignalBars(
|
||||
_st.width + (_st.width + _st.skip) * (Call::kSignalBarCount - 1),
|
||||
_st.max);
|
||||
call->signalBarCountValue(
|
||||
) | rpl::start_with_next([=](int count) {
|
||||
) | rpl::on_next([=](int count) {
|
||||
changed(count);
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
installEventFilter(this);
|
||||
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_crossLineMuteAnimation.invalidate();
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -319,12 +319,12 @@ void TopBar::initControls() {
|
||||
_call->mutedValue() | rpl::map(mapToState),
|
||||
rpl::single(GroupCall::InstanceState::Connected),
|
||||
rpl::single(TimeId(0))
|
||||
) | rpl::type_erased()
|
||||
) | rpl::type_erased
|
||||
: rpl::combine(
|
||||
(_groupCall->mutedValue()
|
||||
| MapPushToTalkToActive()
|
||||
| rpl::distinct_until_changed()
|
||||
| rpl::type_erased()),
|
||||
| rpl::type_erased),
|
||||
rpl::single(
|
||||
_groupCall->instanceState()
|
||||
) | rpl::then(_groupCall->instanceStateValue() | rpl::filter(
|
||||
@@ -339,7 +339,7 @@ void TopBar::initControls() {
|
||||
muted
|
||||
) | rpl::map(
|
||||
BarStateFromMuteState
|
||||
) | rpl::start_with_next([=](BarState state) {
|
||||
) | rpl::on_next([=](BarState state) {
|
||||
_isGroupConnecting = (state == BarState::Connecting);
|
||||
setMuted(state != BarState::Active);
|
||||
update();
|
||||
@@ -387,7 +387,7 @@ void TopBar::initControls() {
|
||||
subscribeToMembersChanges(group);
|
||||
|
||||
_isGroupConnecting.value(
|
||||
) | rpl::start_with_next([=](bool isConnecting) {
|
||||
) | rpl::on_next([=](bool isConnecting) {
|
||||
_mute->setAttribute(
|
||||
Qt::WA_TransparentForMouseEvents,
|
||||
isConnecting);
|
||||
@@ -401,7 +401,7 @@ void TopBar::initControls() {
|
||||
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||
// _user may change for the same Panel.
|
||||
return (_call != nullptr) && (update.peer == _call->user());
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
updateInfoLabels();
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -491,7 +491,7 @@ void TopBar::initBlobsUnder(
|
||||
});
|
||||
|
||||
group->stateValue(
|
||||
) | rpl::start_with_next([=](Calls::GroupCall::State state) {
|
||||
) | rpl::on_next([=](Calls::GroupCall::State state) {
|
||||
if (state == Calls::GroupCall::State::HangingUp) {
|
||||
_blobs->hide();
|
||||
}
|
||||
@@ -507,7 +507,7 @@ void TopBar::initBlobsUnder(
|
||||
std::move(
|
||||
hideBlobs
|
||||
) | rpl::distinct_until_changed(
|
||||
) | rpl::start_with_next([=](bool hide) {
|
||||
) | rpl::on_next([=](bool hide) {
|
||||
if (hide) {
|
||||
state->paint.setLevel(0.);
|
||||
}
|
||||
@@ -530,7 +530,7 @@ void TopBar::initBlobsUnder(
|
||||
|
||||
std::move(
|
||||
barGeometry
|
||||
) | rpl::start_with_next([=](QRect rect) {
|
||||
) | rpl::on_next([=](QRect rect) {
|
||||
_blobs->resize(
|
||||
rect.width(),
|
||||
(int)state->paint.maxRadius());
|
||||
@@ -538,12 +538,12 @@ void TopBar::initBlobsUnder(
|
||||
}, lifetime());
|
||||
|
||||
shownValue(
|
||||
) | rpl::start_with_next([=](bool shown) {
|
||||
) | rpl::on_next([=](bool shown) {
|
||||
_blobs->setVisible(shown);
|
||||
}, lifetime());
|
||||
|
||||
_blobs->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
const auto hidden = state->hideAnimation.value(
|
||||
state->hideLastTime ? 1. : 0.);
|
||||
if (hidden == 1.) {
|
||||
@@ -563,7 +563,7 @@ void TopBar::initBlobsUnder(
|
||||
group->levelUpdates(
|
||||
) | rpl::filter([=](const LevelUpdate &update) {
|
||||
return !state->hideLastTime && (update.value > state->lastLevel);
|
||||
}) | rpl::start_with_next([=](const LevelUpdate &update) {
|
||||
}) | rpl::on_next([=](const LevelUpdate &update) {
|
||||
if (state->lastLevel == 0.) {
|
||||
state->levelTimer.callEach(kBlobUpdateInterval);
|
||||
}
|
||||
@@ -584,7 +584,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
|
||||
const auto group = _groupCall.get();
|
||||
const auto conference = group && group->conference();
|
||||
auto realValue = conference
|
||||
? (rpl::single(group->sharedCall().get()) | rpl::type_erased())
|
||||
? (rpl::single(group->sharedCall().get()) | rpl::type_erased)
|
||||
: peer->session().changes().peerFlagsValue(
|
||||
peer,
|
||||
Data::PeerUpdate::Flag::GroupCall
|
||||
@@ -597,7 +597,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
|
||||
std::move(
|
||||
realValue
|
||||
) | rpl::before_next([=](not_null<Data::GroupCall*> real) {
|
||||
real->titleValue() | rpl::start_with_next([=] {
|
||||
real->titleValue() | rpl::on_next([=] {
|
||||
updateInfoLabels();
|
||||
}, lifetime());
|
||||
}) | rpl::map([=](not_null<Data::GroupCall*> real) {
|
||||
@@ -617,7 +617,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}) | rpl::start_with_next([=](const Ui::GroupCallBarContent &content) {
|
||||
}) | rpl::on_next([=](const Ui::GroupCallBarContent &content) {
|
||||
_users = content.users;
|
||||
_usersCount = content.count;
|
||||
for (auto &user : _users) {
|
||||
@@ -630,7 +630,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
|
||||
}, lifetime());
|
||||
|
||||
_userpics->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
_userpicsWidth = width;
|
||||
updateControlsGeometry();
|
||||
}, lifetime());
|
||||
@@ -641,7 +641,7 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> call) {
|
||||
// _peer may change for the same Panel.
|
||||
const auto call = _groupCall.get();
|
||||
return (call != nullptr) && (update.peer == call->peer());
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
updateInfoLabels();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
@@ -58,25 +58,25 @@ void Userpic::setup(rpl::producer<bool> muted) {
|
||||
_content.setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
_content.paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
paint();
|
||||
}, lifetime());
|
||||
|
||||
std::move(
|
||||
muted
|
||||
) | rpl::start_with_next([=](bool muted) {
|
||||
) | rpl::on_next([=](bool muted) {
|
||||
setMuted(muted);
|
||||
}, lifetime());
|
||||
|
||||
_peer->session().changes().peerFlagsValue(
|
||||
_peer,
|
||||
Data::PeerUpdate::Flag::Photo
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
processPhoto();
|
||||
}, lifetime());
|
||||
|
||||
_peer->session().downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshPhoto();
|
||||
}, lifetime());
|
||||
|
||||
|
||||
@@ -30,17 +30,17 @@ void VideoBubble::setup() {
|
||||
applyDragMode(_dragMode);
|
||||
|
||||
_content.paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
paint();
|
||||
}, lifetime());
|
||||
|
||||
_track->stateValue(
|
||||
) | rpl::start_with_next([=](Webrtc::VideoState state) {
|
||||
) | rpl::on_next([=](Webrtc::VideoState state) {
|
||||
setState(state);
|
||||
}, lifetime());
|
||||
|
||||
_track->renderNextFrame(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (_track->frameSize().isEmpty()) {
|
||||
_track->markFrameShown();
|
||||
} else {
|
||||
|
||||
@@ -114,7 +114,7 @@ private:
|
||||
Panel::Incoming::RendererGL::RendererGL(not_null<Incoming*> owner)
|
||||
: _owner(owner) {
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_controlsShadowImage.invalidate();
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ void ChooseJoinAsBox(
|
||||
if ((context == Context::Create)
|
||||
&& (peer->isChannel() && peer->asChannel()->hasAdminRights())) {
|
||||
const auto makeLink = [](const QString &text) {
|
||||
return Ui::Text::Link(text);
|
||||
return tr::link(text);
|
||||
};
|
||||
const auto label = box->addRow(object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
@@ -246,7 +246,7 @@ void ChooseJoinAsBox(
|
||||
(livestream
|
||||
? tr::lng_group_call_schedule_channel
|
||||
: tr::lng_group_call_schedule)(makeLink),
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
labelSt));
|
||||
label->overrideLinkClickHandler([=] {
|
||||
auto withJoinAs = info;
|
||||
@@ -294,8 +294,8 @@ void ChooseJoinAsBox(
|
||||
: tr::lng_group_call_join_confirm)(
|
||||
tr::now,
|
||||
lt_chat,
|
||||
Ui::Text::Bold(name),
|
||||
Ui::Text::WithEntities);
|
||||
tr::bold(name),
|
||||
tr::marked);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -352,7 +352,7 @@ void ChooseJoinAsProcess::start(
|
||||
|
||||
createRequest();
|
||||
session->account().sessionChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_request = nullptr;
|
||||
}, _request->lifetime);
|
||||
|
||||
@@ -362,7 +362,7 @@ void ChooseJoinAsProcess::start(
|
||||
void ChooseJoinAsProcess::requestList() {
|
||||
const auto session = &_request->peer->session();
|
||||
_request->id = session->api().request(MTPphone_GetGroupCallJoinAs(
|
||||
_request->peer->input
|
||||
_request->peer->input()
|
||||
)).done([=](const MTPphone_JoinAsPeers &result) {
|
||||
auto list = result.match([&](const MTPDphone_joinAsPeers &data) {
|
||||
session->data().processUsers(data.vusers());
|
||||
@@ -451,10 +451,10 @@ void ChooseJoinAsProcess::processList(
|
||||
.append(tr::lng_group_call_or_schedule(
|
||||
tr::now,
|
||||
lt_link,
|
||||
Ui::Text::Link((livestream
|
||||
tr::link((livestream
|
||||
? tr::lng_group_call_schedule_channel
|
||||
: tr::lng_group_call_schedule)(tr::now)),
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
}
|
||||
const auto guard = base::make_weak(&_request->guard);
|
||||
const auto safeFinish = crl::guard(guard, [=] { finish(info); });
|
||||
@@ -476,7 +476,7 @@ void ChooseJoinAsProcess::processList(
|
||||
.labelFilter = filter,
|
||||
});
|
||||
box->boxClosing(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_request = nullptr;
|
||||
}, _request->lifetime);
|
||||
|
||||
@@ -490,7 +490,7 @@ void ChooseJoinAsProcess::processList(
|
||||
std::move(info),
|
||||
crl::guard(&_request->guard, [=](auto info) { finish(info); }));
|
||||
box->boxClosing(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_request = nullptr;
|
||||
}, _request->lifetime);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ CoverItem::CoverItem(
|
||||
|
||||
_cover.widget()->move(0, 0);
|
||||
_cover.moveRequests(
|
||||
) | rpl::start_with_next(userpic.move, lifetime());
|
||||
) | rpl::on_next(userpic.move, lifetime());
|
||||
}
|
||||
|
||||
not_null<QAction*> CoverItem::action() const {
|
||||
|
||||
@@ -635,7 +635,7 @@ GroupCall::GroupCall(
|
||||
|
||||
_muted.value(
|
||||
) | rpl::combine_previous(
|
||||
) | rpl::start_with_next([=](MuteState previous, MuteState state) {
|
||||
) | rpl::on_next([=](MuteState previous, MuteState state) {
|
||||
if (_instance) {
|
||||
updateInstanceMuteState();
|
||||
}
|
||||
@@ -649,7 +649,7 @@ GroupCall::GroupCall(
|
||||
_instanceState.value(
|
||||
) | rpl::filter([=] {
|
||||
return _hadJoinedState;
|
||||
}) | rpl::start_with_next([=](InstanceState state) {
|
||||
}) | rpl::on_next([=](InstanceState state) {
|
||||
if (state == InstanceState::Disconnected) {
|
||||
playConnectingSound();
|
||||
} else {
|
||||
@@ -676,7 +676,7 @@ GroupCall::GroupCall(
|
||||
return not_null{ real };
|
||||
}) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=](not_null<Data::GroupCall*> real) {
|
||||
) | rpl::on_next([=](not_null<Data::GroupCall*> real) {
|
||||
subscribeToReal(real);
|
||||
_realChanges.fire_copy(real);
|
||||
}, _lifetime);
|
||||
@@ -769,16 +769,16 @@ void GroupCall::initConferenceE2E() {
|
||||
_e2e = std::make_unique<TdE2E::Call>(tde2eUserId);
|
||||
|
||||
_e2e->subchainRequests(
|
||||
) | rpl::start_with_next([=](TdE2E::Call::SubchainRequest request) {
|
||||
) | rpl::on_next([=](TdE2E::Call::SubchainRequest request) {
|
||||
requestSubchainBlocks(request.subchain, request.height);
|
||||
}, _e2e->lifetime());
|
||||
|
||||
_e2e->sendOutboundBlock(
|
||||
) | rpl::start_with_next([=](QByteArray &&block) {
|
||||
) | rpl::on_next([=](QByteArray &&block) {
|
||||
sendOutboundBlock(std::move(block));
|
||||
}, _e2e->lifetime());
|
||||
|
||||
_e2e->failures() | rpl::start_with_next([=] {
|
||||
_e2e->failures() | rpl::on_next([=] {
|
||||
LOG(("TdE2E: Got failure, scheduling rejoin!"));
|
||||
crl::on_main(this, [=] { startRejoin(); });
|
||||
}, _e2e->lifetime());
|
||||
@@ -792,7 +792,7 @@ void GroupCall::setupConferenceCall() {
|
||||
Expects(_sharedCall != nullptr);
|
||||
|
||||
_sharedCall->staleParticipantIds(
|
||||
) | rpl::start_with_next([=](const base::flat_set<UserId> &staleIds) {
|
||||
) | rpl::on_next([=](const base::flat_set<UserId> &staleIds) {
|
||||
removeConferenceParticipants(staleIds, true);
|
||||
}, _lifetime);
|
||||
}
|
||||
@@ -803,7 +803,7 @@ void GroupCall::trackParticipantsWithAccess() {
|
||||
}
|
||||
|
||||
_e2e->participantsSetValue(
|
||||
) | rpl::start_with_next([=](const TdE2E::ParticipantsSet &set) {
|
||||
) | rpl::on_next([=](const TdE2E::ParticipantsSet &set) {
|
||||
auto users = base::flat_set<UserId>();
|
||||
users.reserve(set.list.size());
|
||||
for (const auto &id : set.list) {
|
||||
@@ -967,12 +967,12 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||
_listenersHidden = real->listenersHidden();
|
||||
|
||||
real->scheduleDateValue(
|
||||
) | rpl::start_with_next([=](TimeId date) {
|
||||
) | rpl::on_next([=](TimeId date) {
|
||||
setScheduledDate(date);
|
||||
}, _lifetime);
|
||||
|
||||
real->messagesEnabledValue(
|
||||
) | rpl::start_with_next([=](bool enabled) {
|
||||
) | rpl::on_next([=](bool enabled) {
|
||||
setMessagesEnabled(enabled);
|
||||
}, _lifetime);
|
||||
|
||||
@@ -981,7 +981,7 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||
Ui::PostponeCall(this, [=] {
|
||||
if (const auto real = lookupReal()) {
|
||||
real->participantsReloaded(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
fillActiveVideoEndpoints();
|
||||
}, _lifetime);
|
||||
fillActiveVideoEndpoints();
|
||||
@@ -990,7 +990,7 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||
|
||||
using Update = Data::GroupCall::ParticipantUpdate;
|
||||
real->participantUpdated(
|
||||
) | rpl::start_with_next([=](const Update &data) {
|
||||
) | rpl::on_next([=](const Update &data) {
|
||||
const auto regularEndpoint = [&](const std::string &endpoint)
|
||||
-> const std::string & {
|
||||
return (endpoint.empty()
|
||||
@@ -1067,7 +1067,7 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||
}, _lifetime);
|
||||
|
||||
real->participantsResolved(
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
not_null<const base::flat_map<
|
||||
uint32,
|
||||
Data::LastSpokeTimes>*> ssrcs) {
|
||||
@@ -1079,7 +1079,7 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||
real->participantSpeaking(
|
||||
) | rpl::filter([=] {
|
||||
return _videoEndpointLarge.current();
|
||||
}) | rpl::start_with_next([=](not_null<Data::GroupCallParticipant*> p) {
|
||||
}) | rpl::on_next([=](not_null<Data::GroupCallParticipant*> p) {
|
||||
const auto now = crl::now();
|
||||
if (_videoEndpointLarge.current().peer == p->peer) {
|
||||
_videoLargeTillTime = std::max(
|
||||
@@ -1305,7 +1305,7 @@ void GroupCall::start(TimeId scheduleDate, bool rtmp) {
|
||||
_createRequestId = _api.request(MTPphone_CreateGroupCall(
|
||||
MTP_flags((scheduleDate ? Flag::f_schedule_date : Flag(0))
|
||||
| (rtmp ? Flag::f_rtmp_stream : Flag(0))),
|
||||
_peer->input,
|
||||
_peer->input(),
|
||||
MTP_int(base::RandomValue<int32>()),
|
||||
MTPstring(), // title
|
||||
MTP_int(scheduleDate)
|
||||
@@ -1350,7 +1350,7 @@ void GroupCall::initialJoinRequested() {
|
||||
real->participantUpdated(
|
||||
) | rpl::filter([=](const Update &update) {
|
||||
return (_instance != nullptr);
|
||||
}) | rpl::start_with_next([=](const Update &update) {
|
||||
}) | rpl::on_next([=](const Update &update) {
|
||||
if (!update.now) {
|
||||
_instance->removeSsrcs({
|
||||
update.was->ssrc,
|
||||
@@ -1472,7 +1472,7 @@ void GroupCall::markEndpointActive(
|
||||
const auto track = &i->second->track;
|
||||
|
||||
track->renderNextFrame(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto activeTrack = _activeVideoTracks[endpoint].get();
|
||||
const auto size = track->frameSize();
|
||||
if (size.isEmpty()) {
|
||||
@@ -1494,7 +1494,7 @@ void GroupCall::markEndpointActive(
|
||||
) | rpl::filter([=](Webrtc::VideoState state) {
|
||||
return (state == Webrtc::VideoState::Paused)
|
||||
&& !_activeVideoTracks[endpoint]->shown;
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
_activeVideoTracks[endpoint]->shown = true;
|
||||
markTrackShown(endpoint, true);
|
||||
}, i->second->lifetime);
|
||||
@@ -1584,8 +1584,8 @@ void GroupCall::setJoinAs(not_null<PeerData*> as) {
|
||||
void GroupCall::saveDefaultJoinAs(not_null<PeerData*> as) {
|
||||
setJoinAs(as);
|
||||
_api.request(MTPphone_SaveDefaultGroupCallJoinAs(
|
||||
_peer->input,
|
||||
joinAs()->input
|
||||
_peer->input(),
|
||||
joinAs()->input()
|
||||
)).send();
|
||||
}
|
||||
|
||||
@@ -1664,7 +1664,7 @@ void GroupCall::sendJoinRequest() {
|
||||
_api.request(MTPphone_JoinGroupCall(
|
||||
MTP_flags(flags),
|
||||
inputCallSafe(),
|
||||
joinAs()->input,
|
||||
joinAs()->input(),
|
||||
MTP_string(_joinHash),
|
||||
(_e2e ? TdE2E::PublicKeyToMTP(_e2e->myKey()) : MTPint256()),
|
||||
MTP_bytes(joinBlock),
|
||||
@@ -2671,7 +2671,7 @@ void GroupCall::applyOtherParticipantUpdate(
|
||||
void GroupCall::setupMediaDevices() {
|
||||
_playbackDeviceId.changes() | rpl::filter([=] {
|
||||
return _instance && _setDeviceIdCallback;
|
||||
}) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
}) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
_setDeviceIdCallback(deviceId);
|
||||
|
||||
// Value doesn't matter here, just trigger reading of the new value.
|
||||
@@ -2680,7 +2680,7 @@ void GroupCall::setupMediaDevices() {
|
||||
|
||||
_captureDeviceId.changes() | rpl::filter([=] {
|
||||
return _instance && _setDeviceIdCallback;
|
||||
}) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
}) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
_setDeviceIdCallback(deviceId);
|
||||
|
||||
// Value doesn't matter here, just trigger reading of the new value.
|
||||
@@ -2689,12 +2689,12 @@ void GroupCall::setupMediaDevices() {
|
||||
|
||||
_cameraDeviceId.changes() | rpl::filter([=] {
|
||||
return _cameraCapture != nullptr;
|
||||
}) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
}) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) {
|
||||
_cameraCapture->switchToDevice(deviceId.value.toStdString(), false);
|
||||
}, _lifetime);
|
||||
|
||||
if (!_rtmp) {
|
||||
_muted.value() | rpl::start_with_next([=](MuteState state) {
|
||||
_muted.value() | rpl::on_next([=](MuteState state) {
|
||||
const auto devices = &Core::App().mediaDevices();
|
||||
const auto muted = (state != MuteState::Active)
|
||||
&& (state != MuteState::PushToTalk);
|
||||
@@ -2804,7 +2804,7 @@ void GroupCall::setupOutgoingVideo() {
|
||||
) | rpl::filter([=](VideoState previous, VideoState state) {
|
||||
// Recursive entrance may happen if error happens when activating.
|
||||
return (previous != state);
|
||||
}) | rpl::start_with_next([=](VideoState previous, VideoState state) {
|
||||
}) | rpl::on_next([=](VideoState previous, VideoState state) {
|
||||
const auto wasActive = (previous != VideoState::Inactive);
|
||||
const auto nowPaused = (state == VideoState::Paused);
|
||||
const auto nowActive = (state != VideoState::Inactive);
|
||||
@@ -2860,7 +2860,7 @@ void GroupCall::setupOutgoingVideo() {
|
||||
) | rpl::filter([=](VideoState previous, VideoState state) {
|
||||
// Recursive entrance may happen if error happens when activating.
|
||||
return (previous != state);
|
||||
}) | rpl::start_with_next([=](VideoState previous, VideoState state) {
|
||||
}) | rpl::on_next([=](VideoState previous, VideoState state) {
|
||||
const auto wasActive = (previous != VideoState::Inactive);
|
||||
const auto nowPaused = (state == VideoState::Paused);
|
||||
const auto nowActive = (state != VideoState::Inactive);
|
||||
@@ -3915,7 +3915,7 @@ void GroupCall::sendSelfUpdate(SendUpdateType type) {
|
||||
? Flag::f_presentation_paused
|
||||
: Flag::f_muted),
|
||||
inputCall(),
|
||||
joinAs()->input,
|
||||
joinAs()->input(),
|
||||
MTP_bool(muted() != MuteState::Active),
|
||||
MTP_int(100000), // volume
|
||||
MTP_bool(muted() == MuteState::RaisedHand),
|
||||
@@ -4012,7 +4012,7 @@ void GroupCall::editParticipant(
|
||||
_api.request(MTPphone_EditGroupCallParticipant(
|
||||
MTP_flags(flags),
|
||||
inputCall(),
|
||||
participantPeer->input,
|
||||
participantPeer->input(),
|
||||
MTP_bool(mute),
|
||||
MTP_int(std::clamp(volume.value_or(0), 1, Group::kMaxVolume)),
|
||||
MTPBool(), // raise_hand
|
||||
@@ -4039,7 +4039,7 @@ void GroupCall::inviteToConference(
|
||||
_api.request(MTPphone_InviteConferenceCallParticipant(
|
||||
MTP_flags(request.video ? Flag::f_video : Flag()),
|
||||
inputCall(),
|
||||
user->inputUser
|
||||
user->inputUser()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
const auto call = _sharedCall.get();
|
||||
user->owner().registerInvitedToCallUser(_id, call, user, true);
|
||||
@@ -4129,7 +4129,7 @@ void GroupCall::inviteUsers(
|
||||
const auto user = request.user;
|
||||
owner->registerInvitedToCallUser(_id, _peer, user, false);
|
||||
usersSlice.push_back(user);
|
||||
slice.push_back(user->inputUser);
|
||||
slice.push_back(user->inputUser());
|
||||
if (slice.size() == kMaxInvitePerSlice) {
|
||||
sendSlice();
|
||||
}
|
||||
@@ -4290,66 +4290,66 @@ TextWithEntities ComposeInviteResultToast(
|
||||
append(tr::lng_confcall_invite_done_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(result.invited.front()->shortName()),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::bold(result.invited.front()->shortName()),
|
||||
tr::rich));
|
||||
} else if (invited > 1) {
|
||||
append(tr::lng_confcall_invite_done_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
invited,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
if (already == 1) {
|
||||
append(tr::lng_confcall_invite_already_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(result.alreadyIn.front()->shortName()),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::bold(result.alreadyIn.front()->shortName()),
|
||||
tr::rich));
|
||||
} else if (already > 1) {
|
||||
append(tr::lng_confcall_invite_already_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
already,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
if (restricted == 1) {
|
||||
append(tr::lng_confcall_invite_fail_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(result.privacyRestricted.front()->shortName()),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::bold(result.privacyRestricted.front()->shortName()),
|
||||
tr::rich));
|
||||
} else if (restricted > 1) {
|
||||
append(tr::lng_confcall_invite_fail_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
restricted,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
if (kicked == 1) {
|
||||
append(tr::lng_confcall_invite_kicked_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(result.kicked.front()->shortName()),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::bold(result.kicked.front()->shortName()),
|
||||
tr::rich));
|
||||
} else if (kicked > 1) {
|
||||
append(tr::lng_confcall_invite_kicked_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
kicked,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
if (failed == 1) {
|
||||
append(tr::lng_confcall_invite_fail_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(result.failed.front()->shortName()),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::bold(result.failed.front()->shortName()),
|
||||
tr::rich));
|
||||
} else if (failed > 1) {
|
||||
append(tr::lng_confcall_invite_fail_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
failed,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ object_ptr<Ui::GenericBox> ScreenSharingPrivacyRequestBox() {
|
||||
tr::lng_group_call_mac_screencast_access(),
|
||||
tr::lng_group_call_mac_recording()
|
||||
) | rpl::map([](QString a, QString b) {
|
||||
auto result = Ui::Text::RichLangValue(a);
|
||||
result.append("\n\n").append(Ui::Text::RichLangValue(b));
|
||||
auto result = tr::rich(a);
|
||||
result.append("\n\n").append(tr::rich(b));
|
||||
return result;
|
||||
}),
|
||||
st::groupCallBoxLabel),
|
||||
@@ -86,7 +86,7 @@ object_ptr<Ui::RpWidget> MakeRoundActiveLogo(
|
||||
auto result = object_ptr<Ui::RpWidget>(parent);
|
||||
const auto logo = result.data();
|
||||
logo->resize(logo->width(), logoOuter.height());
|
||||
logo->paintRequest() | rpl::start_with_next([=, &icon] {
|
||||
logo->paintRequest() | rpl::on_next([=, &icon] {
|
||||
if (logo->width() < logoOuter.width()) {
|
||||
return;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void ConferenceCallJoinConfirm(
|
||||
st::boxRowPadding + st::confcallLinkTitlePadding,
|
||||
style::al_top);
|
||||
const auto wrapName = [&](not_null<PeerData*> peer) {
|
||||
return rpl::single(Ui::Text::Bold(peer->shortName()));
|
||||
return rpl::single(tr::bold(peer->shortName()));
|
||||
};
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
@@ -142,8 +142,8 @@ void ConferenceCallJoinConfirm(
|
||||
? tr::lng_confcall_join_text_inviter(
|
||||
lt_user,
|
||||
wrapName(maybeInviter),
|
||||
Ui::Text::RichLangValue)
|
||||
: tr::lng_confcall_join_text(Ui::Text::RichLangValue)),
|
||||
tr::rich)
|
||||
: tr::lng_confcall_join_text(tr::rich)),
|
||||
st::confcallLinkCenteredText),
|
||||
st::boxRowPadding,
|
||||
style::al_top
|
||||
@@ -156,7 +156,7 @@ void ConferenceCallJoinConfirm(
|
||||
object_ptr<Ui::RpWidget>(box),
|
||||
st::boxRowPadding + st::confcallJoinSepPadding);
|
||||
sep->resize(sep->width(), st::normalFont->height);
|
||||
sep->paintRequest() | rpl::start_with_next([=] {
|
||||
sep->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(sep);
|
||||
const auto line = st::lineWidth;
|
||||
const auto top = st::confcallLinkFooterOrLineTop;
|
||||
@@ -189,14 +189,14 @@ void ConferenceCallJoinConfirm(
|
||||
? tr::lng_confcall_already_joined_one(
|
||||
lt_user,
|
||||
wrapByIndex(0),
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: (known == 2)
|
||||
? tr::lng_confcall_already_joined_two(
|
||||
lt_user,
|
||||
wrapByIndex(0),
|
||||
lt_other,
|
||||
wrapByIndex(1),
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: (known == 3)
|
||||
? tr::lng_confcall_already_joined_three(
|
||||
lt_user,
|
||||
@@ -205,7 +205,7 @@ void ConferenceCallJoinConfirm(
|
||||
wrapByIndex(1),
|
||||
lt_third,
|
||||
wrapByIndex(2),
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: tr::lng_confcall_already_joined_many(
|
||||
lt_count,
|
||||
rpl::single(1. * (std::max(known, call->fullCount()) - 2)),
|
||||
@@ -213,7 +213,7 @@ void ConferenceCallJoinConfirm(
|
||||
wrapByIndex(0),
|
||||
lt_other,
|
||||
wrapByIndex(1),
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
@@ -223,18 +223,13 @@ void ConferenceCallJoinConfirm(
|
||||
style::al_top
|
||||
)->setTryMakeSimilarLines(true);
|
||||
}
|
||||
const auto joinAndClose = [=] {
|
||||
box->addButton(tr::lng_confcall_join_button(), [=] {
|
||||
join([weak = base::make_weak(box)] {
|
||||
if (const auto strong = weak.get()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
});
|
||||
};
|
||||
Info::BotStarRef::AddFullWidthButton(
|
||||
box,
|
||||
tr::lng_confcall_join_button(),
|
||||
joinAndClose,
|
||||
&st::confcallLinkButton);
|
||||
});
|
||||
}
|
||||
|
||||
ConferenceCallLinkStyleOverrides DarkConferenceCallLinkStyle() {
|
||||
@@ -323,7 +318,7 @@ void ShowConferenceCallLinkBox(
|
||||
});
|
||||
|
||||
close->geometryValue(
|
||||
) | rpl::start_with_next([=](QRect geometry) {
|
||||
) | rpl::on_next([=](QRect geometry) {
|
||||
toggle->moveToLeft(
|
||||
geometry.x() - toggle->width(),
|
||||
geometry.y());
|
||||
@@ -380,7 +375,7 @@ void ShowConferenceCallLinkBox(
|
||||
box->widthValue(),
|
||||
copy->widthValue(),
|
||||
share->widthValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto width = st::boxWideWidth;
|
||||
const auto padding = st::confcallLinkBox.buttonPadding;
|
||||
const auto available = width - 2 * padding.right();
|
||||
@@ -399,7 +394,7 @@ void ShowConferenceCallLinkBox(
|
||||
copy->parentWidget(),
|
||||
tr::lng_confcall_link_or(),
|
||||
st::confcallLinkFooterOr);
|
||||
sep->paintRequest() | rpl::start_with_next([=] {
|
||||
sep->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(sep);
|
||||
const auto text = sep->textMaxWidth();
|
||||
const auto white = (sep->width() - 2 * text) / 2;
|
||||
@@ -418,8 +413,8 @@ void ShowConferenceCallLinkBox(
|
||||
tr::lng_confcall_link_join_link(
|
||||
lt_arrow,
|
||||
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
|
||||
[](QString v) { return Ui::Text::Link(v); }),
|
||||
Ui::Text::WithEntities),
|
||||
[](QString v) { return tr::link(v); }),
|
||||
tr::marked),
|
||||
(st.centerLabel
|
||||
? *st.centerLabel
|
||||
: st::confcallLinkCenteredText));
|
||||
@@ -433,7 +428,7 @@ void ShowConferenceCallLinkBox(
|
||||
}
|
||||
return false;
|
||||
});
|
||||
copy->geometryValue() | rpl::start_with_next([=](QRect geometry) {
|
||||
copy->geometryValue() | rpl::on_next([=](QRect geometry) {
|
||||
const auto width = st::boxWideWidth
|
||||
- st::boxRowPadding.left()
|
||||
- st::boxRowPadding.right();
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace {
|
||||
|
||||
const auto raw = result.data();
|
||||
raw->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
auto p = QPainter(raw);
|
||||
p.fillRect(clip, st::groupCallMembersBgOver);
|
||||
}, raw->lifetime());
|
||||
@@ -61,7 +61,7 @@ namespace {
|
||||
std::move(text),
|
||||
st::groupCallBoxLabel);
|
||||
raw->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
const auto padding = st::groupCallInviteDividerPadding;
|
||||
const auto available = width - padding.left() - padding.right();
|
||||
label->resizeToNaturalWidth(available);
|
||||
@@ -412,7 +412,7 @@ void ConfInviteRow::elementsPaint(
|
||||
const auto activate = [=] {
|
||||
content->submitted();
|
||||
};
|
||||
content->noSearchSubmits() | rpl::start_with_next([=] {
|
||||
content->noSearchSubmits() | rpl::on_next([=] {
|
||||
controller->toggleFirst();
|
||||
}, content->lifetime());
|
||||
|
||||
@@ -676,7 +676,7 @@ void ConfInviteController::addShareLinkButton() {
|
||||
: st::createCallInviteLinkIcon),
|
||||
QPoint());
|
||||
button->entity()->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
icon->moveToLeft(
|
||||
st::createCallInviteLinkIconPosition.x(),
|
||||
(height - st::groupCallInviteLinkIcon.height()) / 2);
|
||||
@@ -686,7 +686,7 @@ void ConfInviteController::addShareLinkButton() {
|
||||
button->entity()->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||
return (e->type() == QEvent::Enter);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
delegate()->peerListMouseLeftGeometry();
|
||||
}, button->lifetime());
|
||||
delegate()->peerListSetAboveWidget(std::move(button));
|
||||
@@ -787,7 +787,7 @@ void InviteContactsController::prepareViewHook() {
|
||||
|
||||
std::move(
|
||||
_discoveredInGroup
|
||||
) | rpl::start_with_next([=](not_null<UserData*> user) {
|
||||
) | rpl::on_next([=](not_null<UserData*> user) {
|
||||
if (auto row = delegate()->peerListFindRow(user->id.value)) {
|
||||
delegate()->peerListRemoveRow(row);
|
||||
}
|
||||
@@ -846,7 +846,7 @@ object_ptr<Ui::BoxContent> PrepareInviteBox(
|
||||
&st::groupCallMultiSelect);
|
||||
auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->setTitle(tr::lng_group_call_invite_conf());
|
||||
raw->hasSelectedValue() | rpl::start_with_next([=](bool has) {
|
||||
raw->hasSelectedValue() | rpl::on_next([=](bool has) {
|
||||
box->clearButtons();
|
||||
if (has) {
|
||||
box->addButton(tr::lng_group_call_confcall_add(), [=] {
|
||||
@@ -899,14 +899,14 @@ object_ptr<Ui::BoxContent> PrepareInviteBox(
|
||||
showToast(tr::lng_group_call_invite_done_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(result.invited.front()->firstName),
|
||||
Ui::Text::WithEntities));
|
||||
tr::bold(result.invited.front()->firstName),
|
||||
tr::marked));
|
||||
} else if (result.invited.size() > 1) {
|
||||
showToast(tr::lng_group_call_invite_done_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
result.invited.size(),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1018,7 +1018,7 @@ object_ptr<Ui::BoxContent> PrepareInviteBox(
|
||||
&st::groupCallMultiSelect);
|
||||
auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->setTitle(tr::lng_group_call_invite_conf());
|
||||
raw->hasSelectedValue() | rpl::start_with_next([=](bool has) {
|
||||
raw->hasSelectedValue() | rpl::on_next([=](bool has) {
|
||||
box->clearButtons();
|
||||
if (has) {
|
||||
box->addButton(tr::lng_group_call_invite_button(), [=] {
|
||||
@@ -1067,7 +1067,7 @@ void InitReActivate(not_null<PeerListBox*> box) {
|
||||
|
||||
const auto header = CreateReActivateHeader(box);
|
||||
header->resizeToWidth(st::boxWideWidth);
|
||||
header->heightValue() | rpl::start_with_next([=](int height) {
|
||||
header->heightValue() | rpl::on_next([=](int height) {
|
||||
box->setAddedTopScrollSkip(height, true);
|
||||
}, header->lifetime());
|
||||
header->moveToLeft(0, 0);
|
||||
@@ -1088,12 +1088,12 @@ object_ptr<Ui::BoxContent> PrepareInviteToEmptyBox(
|
||||
const auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
InitReActivate(box);
|
||||
|
||||
box->noSearchSubmits() | rpl::start_with_next([=] {
|
||||
box->noSearchSubmits() | rpl::on_next([=] {
|
||||
raw->noSearchSubmit();
|
||||
}, box->lifetime());
|
||||
|
||||
raw->prioritizeScrollRequests(
|
||||
) | rpl::start_with_next([=](Ui::ScrollToRequest request) {
|
||||
) | rpl::on_next([=](Ui::ScrollToRequest request) {
|
||||
box->scrollTo(request);
|
||||
}, box->lifetime());
|
||||
|
||||
@@ -1171,12 +1171,12 @@ object_ptr<Ui::BoxContent> PrepareCreateCallBox(
|
||||
box->setTitle(tr::lng_confcall_create_title());
|
||||
}
|
||||
|
||||
box->noSearchSubmits() | rpl::start_with_next([=] {
|
||||
box->noSearchSubmits() | rpl::on_next([=] {
|
||||
raw->noSearchSubmit();
|
||||
}, box->lifetime());
|
||||
|
||||
raw->prioritizeScrollRequests(
|
||||
) | rpl::start_with_next([=](Ui::ScrollToRequest request) {
|
||||
) | rpl::on_next([=](Ui::ScrollToRequest request) {
|
||||
box->scrollTo(request);
|
||||
}, box->lifetime());
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ Members::Controller::Controller(
|
||||
st::groupCallMembersBgOver)
|
||||
, _narrowRoundRect(ImageRoundRadius::Large, st::groupCallMembersBg) {
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_inactiveCrossLine.invalidate();
|
||||
_coloredCrossLine.invalidate();
|
||||
_inactiveNarrowCrossLine.invalidate();
|
||||
@@ -251,7 +251,7 @@ Members::Controller::Controller(
|
||||
rpl::combine(
|
||||
PowerSaving::OnValue(PowerSaving::kCalls),
|
||||
Core::App().appDeactivatedValue()
|
||||
) | rpl::start_with_next([=](bool disabled, bool deactivated) {
|
||||
) | rpl::on_next([=](bool disabled, bool deactivated) {
|
||||
const auto hide = disabled || deactivated;
|
||||
|
||||
if (!(hide && _soundingAnimationHideLastTime)) {
|
||||
@@ -284,7 +284,7 @@ Members::Controller::Controller(
|
||||
|
||||
_peer->session().changes().peerUpdates(
|
||||
Data::PeerUpdate::Flag::About
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
if (const auto row = findRow(update.peer)) {
|
||||
row->setAbout(update.peer->about());
|
||||
}
|
||||
@@ -297,12 +297,12 @@ Members::Controller::~Controller() {
|
||||
|
||||
void Members::Controller::setupListChangeViewers() {
|
||||
_call->real(
|
||||
) | rpl::start_with_next([=](not_null<Data::GroupCall*> real) {
|
||||
) | rpl::on_next([=](not_null<Data::GroupCall*> real) {
|
||||
subscribeToChanges(real);
|
||||
}, _lifetime);
|
||||
|
||||
_call->levelUpdates(
|
||||
) | rpl::start_with_next([=](const LevelUpdate &update) {
|
||||
) | rpl::on_next([=](const LevelUpdate &update) {
|
||||
const auto i = _soundingRowBySsrc.find(update.ssrc);
|
||||
if (i != end(_soundingRowBySsrc)) {
|
||||
updateRowLevel(i->second, update.value);
|
||||
@@ -310,7 +310,7 @@ void Members::Controller::setupListChangeViewers() {
|
||||
}, _lifetime);
|
||||
|
||||
_call->videoEndpointLargeValue(
|
||||
) | rpl::start_with_next([=](const VideoEndpoint &large) {
|
||||
) | rpl::on_next([=](const VideoEndpoint &large) {
|
||||
if (large) {
|
||||
hideRowsWithVideoExcept(large);
|
||||
} else {
|
||||
@@ -322,7 +322,7 @@ void Members::Controller::setupListChangeViewers() {
|
||||
) | rpl::filter([=](const VideoStateToggle &update) {
|
||||
const auto &large = _call->videoEndpointLarge();
|
||||
return large && (update.endpoint != large);
|
||||
}) | rpl::start_with_next([=](const VideoStateToggle &update) {
|
||||
}) | rpl::on_next([=](const VideoStateToggle &update) {
|
||||
if (update.value) {
|
||||
hideRowWithVideo(update.endpoint);
|
||||
} else {
|
||||
@@ -331,7 +331,7 @@ void Members::Controller::setupListChangeViewers() {
|
||||
}, _lifetime);
|
||||
|
||||
_call->rejoinEvents(
|
||||
) | rpl::start_with_next([=](const Group::RejoinEvent &event) {
|
||||
) | rpl::on_next([=](const Group::RejoinEvent &event) {
|
||||
const auto guard = gsl::finally([&] {
|
||||
delegate()->peerListRefreshRows();
|
||||
});
|
||||
@@ -411,13 +411,13 @@ void Members::Controller::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||
_fullCount = real->fullCountValue();
|
||||
|
||||
real->participantsReloaded(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
prepareRows(real);
|
||||
}, _lifetime);
|
||||
|
||||
using Update = Data::GroupCall::ParticipantUpdate;
|
||||
real->participantUpdated(
|
||||
) | rpl::start_with_next([=](const Update &update) {
|
||||
) | rpl::on_next([=](const Update &update) {
|
||||
Expects(update.was.has_value() || update.now.has_value());
|
||||
|
||||
const auto participantPeer = update.was
|
||||
@@ -444,7 +444,7 @@ void Members::Controller::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||
toggleVideoEndpointActive(endpoint, true);
|
||||
}
|
||||
_call->videoStreamActiveUpdates(
|
||||
) | rpl::start_with_next([=](const VideoStateToggle &update) {
|
||||
) | rpl::on_next([=](const VideoStateToggle &update) {
|
||||
toggleVideoEndpointActive(update.endpoint, update.value);
|
||||
}, _lifetime);
|
||||
}
|
||||
@@ -516,7 +516,7 @@ void Members::Controller::setupInvitedUsers() {
|
||||
_peer->owner().invitesToCalls(
|
||||
) | rpl::filter([=](const Invite &invite) {
|
||||
return (invite.id == _call->id());
|
||||
}) | rpl::start_with_next([=](const Invite &invite) {
|
||||
}) | rpl::on_next([=](const Invite &invite) {
|
||||
const auto user = invite.user;
|
||||
if (invite.removed) {
|
||||
if (const auto row = findRow(user)) {
|
||||
@@ -550,7 +550,7 @@ void Members::Controller::setupWithAccessUsers() {
|
||||
return;
|
||||
}
|
||||
conference->participantsWithAccessValue(
|
||||
) | rpl::start_with_next([=](base::flat_set<UserId> &&nowIds) {
|
||||
) | rpl::on_next([=](base::flat_set<UserId> &&nowIds) {
|
||||
for (auto i = begin(_withAccess); i != end(_withAccess);) {
|
||||
const auto oldId = *i;
|
||||
if (nowIds.remove(oldId)) {
|
||||
@@ -1587,7 +1587,7 @@ void Members::Controller::addMuteActionsToContextMenu(
|
||||
|| (muteState == Row::State::RaisedHand);
|
||||
const auto mutedByMe = row->mutedByMe();
|
||||
|
||||
auto mutesFromVolume = rpl::never<bool>() | rpl::type_erased();
|
||||
auto mutesFromVolume = rpl::never<bool>() | rpl::type_erased;
|
||||
|
||||
const auto addVolumeItem = (!muted || isMe(participantPeer));
|
||||
if (addVolumeItem) {
|
||||
@@ -1610,7 +1610,7 @@ void Members::Controller::addMuteActionsToContextMenu(
|
||||
mutesFromVolume = volumeItem->toggleMuteRequests();
|
||||
|
||||
volumeItem->toggleMuteRequests(
|
||||
) | rpl::start_with_next([=](bool muted) {
|
||||
) | rpl::on_next([=](bool muted) {
|
||||
if (muted) {
|
||||
// Slider value is changed after the callback is called.
|
||||
// To capture good state inside the slider frame we postpone.
|
||||
@@ -1622,19 +1622,19 @@ void Members::Controller::addMuteActionsToContextMenu(
|
||||
}, volumeItem->lifetime());
|
||||
|
||||
volumeItem->toggleMuteLocallyRequests(
|
||||
) | rpl::start_with_next([=](bool muted) {
|
||||
) | rpl::on_next([=](bool muted) {
|
||||
if (!isMe(participantPeer)) {
|
||||
toggleMute(muted, true);
|
||||
}
|
||||
}, volumeItem->lifetime());
|
||||
|
||||
volumeItem->changeVolumeRequests(
|
||||
) | rpl::start_with_next([=](int volume) {
|
||||
) | rpl::on_next([=](int volume) {
|
||||
changeVolume(volume, false);
|
||||
}, volumeItem->lifetime());
|
||||
|
||||
volumeItem->changeVolumeLocallyRequests(
|
||||
) | rpl::start_with_next([=](int volume) {
|
||||
) | rpl::on_next([=](int volume) {
|
||||
if (!isMe(participantPeer)) {
|
||||
changeVolume(volume, true);
|
||||
}
|
||||
@@ -1680,7 +1680,7 @@ void Members::Controller::addMuteActionsToContextMenu(
|
||||
if (muteAction) {
|
||||
std::move(
|
||||
mutesFromVolume
|
||||
) | rpl::start_with_next([=](bool mutedFromVolume) {
|
||||
) | rpl::on_next([=](bool mutedFromVolume) {
|
||||
const auto state = _call->canManage()
|
||||
? (mutedFromVolume
|
||||
? (row->raisedHandRating()
|
||||
@@ -1825,24 +1825,24 @@ void Members::setupAddMember(not_null<GroupCall*> call) {
|
||||
const auto conference = call->conference();
|
||||
const auto canAddByPeer = [=](not_null<PeerData*> peer) {
|
||||
if (conference) {
|
||||
return rpl::single(true) | rpl::type_erased();
|
||||
return rpl::single(true) | rpl::type_erased;
|
||||
} else if (peer->isBroadcast()) {
|
||||
return rpl::single(false) | rpl::type_erased();
|
||||
return rpl::single(false) | rpl::type_erased;
|
||||
}
|
||||
return rpl::combine(
|
||||
Data::CanSendValue(peer, ChatRestriction::SendOther, false),
|
||||
_call->joinAsValue()
|
||||
) | rpl::map([=](bool can, not_null<PeerData*> joinAs) {
|
||||
return can && joinAs->isSelf();
|
||||
}) | rpl::type_erased();
|
||||
}) | rpl::type_erased;
|
||||
};
|
||||
const auto canInviteByLinkByPeer = [=](not_null<PeerData*> peer) {
|
||||
if (conference) {
|
||||
return rpl::single(true) | rpl::type_erased();
|
||||
return rpl::single(true) | rpl::type_erased;
|
||||
}
|
||||
const auto channel = peer->asChannel();
|
||||
if (!channel) {
|
||||
return rpl::single(false) | rpl::type_erased();
|
||||
return rpl::single(false) | rpl::type_erased;
|
||||
}
|
||||
return rpl::single(
|
||||
false
|
||||
@@ -1851,7 +1851,7 @@ void Members::setupAddMember(not_null<GroupCall*> call) {
|
||||
return Data::PeerFlagValue(
|
||||
channel,
|
||||
ChannelDataFlag::Username);
|
||||
}) | rpl::flatten_latest()) | rpl::type_erased();
|
||||
}) | rpl::flatten_latest()) | rpl::type_erased;
|
||||
};
|
||||
_canAddMembers = canAddByPeer(peer);
|
||||
_canInviteByLink = canInviteByLinkByPeer(peer);
|
||||
@@ -1869,7 +1869,7 @@ void Members::setupAddMember(not_null<GroupCall*> call) {
|
||||
_canAddMembers.value(),
|
||||
_canInviteByLink.value(),
|
||||
_mode.value()
|
||||
) | rpl::start_with_next([=](bool add, bool invite, PanelMode mode) {
|
||||
) | rpl::on_next([=](bool add, bool invite, PanelMode mode) {
|
||||
if (!add && !invite) {
|
||||
if (const auto old = _addMemberButton.current()) {
|
||||
delete old;
|
||||
@@ -1962,7 +1962,7 @@ void Members::setupList() {
|
||||
_layout.get(),
|
||||
st::groupCallMembersTopSkip));
|
||||
result->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
QPainter(result).fillRect(clip, st::groupCallMembersBg);
|
||||
}, result->lifetime());
|
||||
return result;
|
||||
@@ -1979,7 +1979,7 @@ void Members::setupList() {
|
||||
_list->heightValue() | rpl::map(_1 > 0),
|
||||
_addMemberButton.value() | rpl::map(_1 != nullptr)
|
||||
) | rpl::distinct_until_changed(
|
||||
) | rpl::start_with_next([=](bool hasList, bool hasAddMembers) {
|
||||
) | rpl::on_next([=](bool hasList, bool hasAddMembers) {
|
||||
_topSkip->resize(
|
||||
_topSkip->width(),
|
||||
hasList ? st::groupCallMembersTopSkip : 0);
|
||||
@@ -1990,7 +1990,7 @@ void Members::setupList() {
|
||||
|
||||
const auto skip = _layout->add(object_ptr<Ui::RpWidget>(_layout.get()));
|
||||
_mode.value(
|
||||
) | rpl::start_with_next([=](PanelMode mode) {
|
||||
) | rpl::on_next([=](PanelMode mode) {
|
||||
skip->resize(skip->width(), (mode == PanelMode::Default)
|
||||
? st::groupCallMembersBottomSkip
|
||||
: 0);
|
||||
@@ -1999,14 +1999,14 @@ void Members::setupList() {
|
||||
rpl::combine(
|
||||
_mode.value(),
|
||||
_layout->heightValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
resizeToList();
|
||||
}, _layout->lifetime());
|
||||
|
||||
rpl::combine(
|
||||
_scroll->scrollTopValue(),
|
||||
_scroll->heightValue()
|
||||
) | rpl::start_with_next([=](int scrollTop, int scrollHeight) {
|
||||
) | rpl::on_next([=](int scrollTop, int scrollHeight) {
|
||||
_layout->setVisibleTopBottom(scrollTop, scrollTop + scrollHeight);
|
||||
}, _scroll->lifetime());
|
||||
}
|
||||
@@ -2030,7 +2030,7 @@ void Members::setupFingerprint() {
|
||||
|
||||
void Members::trackViewportGeometry() {
|
||||
_call->videoEndpointLargeValue(
|
||||
) | rpl::start_with_next([=](const VideoEndpoint &large) {
|
||||
) | rpl::on_next([=](const VideoEndpoint &large) {
|
||||
_viewport->showLarge(large);
|
||||
}, _viewport->lifetime());
|
||||
|
||||
@@ -2053,19 +2053,19 @@ void Members::trackViewportGeometry() {
|
||||
std::min(_scroll->height(), _viewport->fullHeight()));
|
||||
};
|
||||
_layout->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
_viewport->resizeToWidth(width);
|
||||
resize();
|
||||
}, _viewport->lifetime());
|
||||
|
||||
_scroll->heightValue(
|
||||
) | rpl::skip(1) | rpl::start_with_next(resize, _viewport->lifetime());
|
||||
) | rpl::skip(1) | rpl::on_next(resize, _viewport->lifetime());
|
||||
|
||||
_scroll->scrollTopValue(
|
||||
) | rpl::skip(1) | rpl::start_with_next(move, _viewport->lifetime());
|
||||
) | rpl::skip(1) | rpl::on_next(move, _viewport->lifetime());
|
||||
|
||||
_viewport->fullHeightValue(
|
||||
) | rpl::start_with_next([=](int viewport) {
|
||||
) | rpl::on_next([=](int viewport) {
|
||||
_videoWrap->resize(_videoWrap->width(), viewport);
|
||||
if (viewport > 0) {
|
||||
move();
|
||||
@@ -2124,7 +2124,7 @@ void Members::setupFakeRoundCorners() {
|
||||
result->resize(size, size);
|
||||
result->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
result->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
QPainter(result).drawImage(
|
||||
result->rect(),
|
||||
*image,
|
||||
@@ -2154,7 +2154,7 @@ void Members::setupFakeRoundCorners() {
|
||||
_shareLinkButton.value() | rpl::map(
|
||||
heightValue
|
||||
) | rpl::flatten_latest()
|
||||
) | rpl::start_with_next([=](QRect list, int addMembers, int shareLink) {
|
||||
) | rpl::on_next([=](QRect list, int addMembers, int shareLink) {
|
||||
const auto left = list.x();
|
||||
const auto top = list.y() - _topSkip->height();
|
||||
const auto right = left + list.width() - topright->width();
|
||||
@@ -2173,7 +2173,7 @@ void Members::setupFakeRoundCorners() {
|
||||
|
||||
refreshImage();
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshImage();
|
||||
topleft->update();
|
||||
topright->update();
|
||||
|
||||
@@ -106,7 +106,7 @@ MembersRow::BlobsAnimation::BlobsAnimation(
|
||||
float maxLevel)
|
||||
: blobs(std::move(blobDatas), levelDuration, maxLevel) {
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
userpicCache = QImage();
|
||||
}, lifetime);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ void MembersRow::setSpeaking(bool speaking) {
|
||||
_statusIcon->arcs.setStrokeRatio(kArcsStrokeRatio);
|
||||
_statusIcon->arcsWidth = _statusIcon->arcs.finishedWidth();
|
||||
_statusIcon->arcs.startUpdateRequests(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (!_statusIcon->arcsAnimation.animating()) {
|
||||
_statusIcon->wasArcsWidth = _statusIcon->arcsWidth;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ JoinAsAction::JoinAsAction(
|
||||
setClickedCallback(std::move(callback));
|
||||
|
||||
paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
Painter p(this);
|
||||
paint(p);
|
||||
}, lifetime());
|
||||
@@ -182,7 +182,7 @@ void JoinAsAction::prepare() {
|
||||
rpl::combine(
|
||||
tr::lng_group_call_display_as_header(),
|
||||
Info::Profile::NameValue(_peer)
|
||||
) | rpl::start_with_next([=](QString text, QString name) {
|
||||
) | rpl::on_next([=](QString text, QString name) {
|
||||
const auto &padding = st::groupCallJoinAsPadding;
|
||||
_text.setMarkedText(_st.itemStyle, { text }, MenuTextOptions);
|
||||
_name.setMarkedText(_st.itemStyle, { name }, MenuTextOptions);
|
||||
@@ -253,7 +253,7 @@ RecordingAction::RecordingAction(
|
||||
+ st::groupCallRecordingTimerPadding.bottom()) {
|
||||
std::move(
|
||||
startAtValues
|
||||
) | rpl::start_with_next([=](TimeId startAt) {
|
||||
) | rpl::on_next([=](TimeId startAt) {
|
||||
_startAt = startAt;
|
||||
_startedAt = crl::now();
|
||||
_refreshTimer.cancel();
|
||||
@@ -266,7 +266,7 @@ RecordingAction::RecordingAction(
|
||||
setClickedCallback(std::move(callback));
|
||||
|
||||
paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
Painter p(this);
|
||||
paint(p);
|
||||
}, lifetime());
|
||||
@@ -344,7 +344,7 @@ void RecordingAction::prepare(rpl::producer<QString> text) {
|
||||
_st.widthMax);
|
||||
setMinWidth(w);
|
||||
|
||||
std::move(text) | rpl::start_with_next([=](QString text) {
|
||||
std::move(text) | rpl::on_next([=](QString text) {
|
||||
const auto &padding = _st.itemPadding;
|
||||
_text.setMarkedText(_st.itemStyle, { text }, MenuTextOptions);
|
||||
_textWidth = w - padding.left() - padding.right();
|
||||
|
||||
@@ -167,7 +167,7 @@ void ReactionPanel::create() {
|
||||
_parent = std::make_unique<Ui::RpWidget>(_outer);
|
||||
_parent->show();
|
||||
|
||||
_parent->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
_parent->events() | rpl::on_next([=](not_null<QEvent*> e) {
|
||||
if (e->type() == QEvent::MouseButtonPress) {
|
||||
const auto event = static_cast<QMouseEvent*>(e.get());
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
@@ -191,7 +191,7 @@ void ReactionPanel::create() {
|
||||
true);
|
||||
|
||||
_selector->chosen(
|
||||
) | rpl::start_with_next([=](Chosen reaction) {
|
||||
) | rpl::on_next([=](Chosen reaction) {
|
||||
if (reaction.id.custom() && !_show->session().premium()) {
|
||||
ShowPremiumPreviewBox(
|
||||
_show,
|
||||
@@ -215,7 +215,7 @@ void ReactionPanel::create() {
|
||||
_fieldGeometry.value(),
|
||||
_shownValue.value(),
|
||||
_expanded.value()
|
||||
) | rpl::start_with_next([=](QRect field, float64 shown, bool expanded) {
|
||||
) | rpl::on_next([=](QRect field, float64 shown, bool expanded) {
|
||||
const auto width = margins.left()
|
||||
+ _selector->countAppearedWidth(shown)
|
||||
+ margins.right();
|
||||
@@ -241,7 +241,7 @@ void ReactionPanel::create() {
|
||||
}, _selector->lifetime());
|
||||
|
||||
_selector->willExpand(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_expanded = true;
|
||||
|
||||
const auto raw = _parent.get();
|
||||
@@ -260,7 +260,7 @@ void ReactionPanel::create() {
|
||||
});
|
||||
}, _selector->lifetime());
|
||||
|
||||
_selector->escapes() | rpl::start_with_next([=] {
|
||||
_selector->escapes() | rpl::on_next([=] {
|
||||
collapse();
|
||||
}, _selector->lifetime());
|
||||
}
|
||||
@@ -276,7 +276,7 @@ void ReactionPanel::fadeOutSelector() {
|
||||
raw->widget.setGeometry(geometry);
|
||||
raw->widget.show();
|
||||
raw->widget.paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (const auto opacity = raw->animation.value(0.)) {
|
||||
auto p = QPainter(&raw->widget);
|
||||
p.setOpacity(opacity);
|
||||
@@ -349,7 +349,7 @@ void MessageField::createControls(PeerData *peer) {
|
||||
rpl::combine(
|
||||
_fieldFocused.value(),
|
||||
_fieldEmpty.value()
|
||||
) | rpl::start_with_next([=](bool focused, bool empty) {
|
||||
) | rpl::on_next([=](bool focused, bool empty) {
|
||||
if (!focused) {
|
||||
_reactionPanel->hideIfCollapsed();
|
||||
} else if (empty) {
|
||||
@@ -360,7 +360,7 @@ void MessageField::createControls(PeerData *peer) {
|
||||
}, _field->lifetime());
|
||||
|
||||
_reactionPanel->chosen(
|
||||
) | rpl::start_with_next([=](Chosen reaction) {
|
||||
) | rpl::on_next([=](Chosen reaction) {
|
||||
if (const auto customId = reaction.id.custom()) {
|
||||
const auto document = _show->session().data().document(customId);
|
||||
if (const auto sticker = document->sticker()) {
|
||||
@@ -439,11 +439,11 @@ void MessageField::createControls(PeerData *peer) {
|
||||
panel->hide();
|
||||
panel->selector()->setCurrentPeer(peer);
|
||||
panel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
Ui::InsertEmojiAtCursor(_field->textCursor(), data.emoji);
|
||||
}, lifetime());
|
||||
panel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
const auto info = data.document->sticker();
|
||||
if (info
|
||||
&& info->setType == Data::StickersType::Emoji
|
||||
@@ -467,7 +467,7 @@ void MessageField::createControls(PeerData *peer) {
|
||||
_width.value(
|
||||
) | rpl::filter(
|
||||
rpl::mappers::_1 > 0
|
||||
) | rpl::start_with_next([=](int newWidth) {
|
||||
) | rpl::on_next([=](int newWidth) {
|
||||
const auto fieldWidth = newWidth
|
||||
- st::historySendPadding
|
||||
- _emojiToggle->width()
|
||||
@@ -483,7 +483,7 @@ void MessageField::createControls(PeerData *peer) {
|
||||
rpl::combine(
|
||||
_width.value(),
|
||||
_field->heightValue()
|
||||
) | rpl::start_with_next([=](int width, int height) {
|
||||
) | rpl::on_next([=](int width, int height) {
|
||||
if (width <= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -494,7 +494,7 @@ void MessageField::createControls(PeerData *peer) {
|
||||
updateWrapSize();
|
||||
}, _lifetime);
|
||||
|
||||
_field->cancelled() | rpl::start_with_next([=] {
|
||||
_field->cancelled() | rpl::on_next([=] {
|
||||
_closeRequests.fire({});
|
||||
}, _lifetime);
|
||||
|
||||
@@ -510,7 +510,7 @@ void MessageField::createControls(PeerData *peer) {
|
||||
rpl::merge(
|
||||
_field->submits() | rpl::to_empty,
|
||||
_send->clicks() | rpl::to_empty
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto text = _field->getTextWithTags();
|
||||
if (text.text.size() <= _limit) {
|
||||
_submitted.fire(std::move(text));
|
||||
@@ -527,7 +527,7 @@ void MessageField::updateEmojiPanelGeometry() {
|
||||
}
|
||||
|
||||
void MessageField::setupBackground() {
|
||||
_wrap->paintRequest() | rpl::start_with_next([=] {
|
||||
_wrap->paintRequest() | rpl::on_next([=] {
|
||||
const auto radius = st::historySendSize.height() / 2.;
|
||||
auto p = QPainter(_wrap.get());
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
@@ -568,7 +568,7 @@ void MessageField::toggle(bool shown) {
|
||||
auto image = Ui::GrabWidgetToImage(_wrap.get());
|
||||
_cache = std::make_unique<Ui::RpWidget>(_parent);
|
||||
const auto raw = _cache.get();
|
||||
raw->paintRequest() | rpl::start_with_next([=] {
|
||||
raw->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(raw);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
const auto scale = raw->height() / float64(_wrap->height());
|
||||
|
||||
@@ -80,7 +80,7 @@ Messages::Messages(not_null<GroupCall*> call, not_null<MTP::Sender*> api)
|
||||
, _starsStatsTimer([=] { requestStarsStats(); }) {
|
||||
Ui::PostponeCall(_call, [=] {
|
||||
_call->real(
|
||||
) | rpl::start_with_next([=](not_null<Data::GroupCall*> call) {
|
||||
) | rpl::on_next([=](not_null<Data::GroupCall*> call) {
|
||||
_real = call;
|
||||
if (ready()) {
|
||||
sendPending();
|
||||
@@ -179,7 +179,7 @@ void Messages::send(TextWithTags text, int stars) {
|
||||
MTP_long(randomId),
|
||||
serialized,
|
||||
MTP_long(stars),
|
||||
from->input
|
||||
from->input()
|
||||
)).done([=](
|
||||
const MTPUpdates &result,
|
||||
const MTP::Response &response) {
|
||||
@@ -636,7 +636,7 @@ void Messages::reactionsPaidSend() {
|
||||
MTP_long(randomId),
|
||||
MTP_textWithEntities(MTP_string(), MTP_vector<MTPMessageEntity>()),
|
||||
MTP_long(stars),
|
||||
from->input
|
||||
from->input()
|
||||
)).done([=](
|
||||
const MTPUpdates &result,
|
||||
const MTP::Response &response) {
|
||||
@@ -679,7 +679,7 @@ void Messages::deleteConfirmed(MessageDeleteRequest request) {
|
||||
_api->request(MTPphone_DeleteGroupCallParticipantMessages(
|
||||
MTP_flags(request.reportSpam ? Flag::f_report_spam : Flag()),
|
||||
_call->inputCall(),
|
||||
from->input
|
||||
from->input()
|
||||
)).send();
|
||||
eraseFrom(ranges::remove(_messages, not_null(from), &Message::peer));
|
||||
} else {
|
||||
|
||||
@@ -392,7 +392,7 @@ void MessagesUi::setupBadges() {
|
||||
_adminBadge.setText(st::messageTextStyle, tr::lng_admin_badge(tr::now));
|
||||
|
||||
_topDonors.value(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
for (auto &entry : _views) {
|
||||
const auto place = donorPlace(entry.from);
|
||||
if (entry.place != place) {
|
||||
@@ -419,7 +419,7 @@ void MessagesUi::setupList(
|
||||
rpl::combine(
|
||||
std::move(messages),
|
||||
std::move(shown)
|
||||
) | rpl::start_with_next([=](std::vector<Message> &&list, bool shown) {
|
||||
) | rpl::on_next([=](std::vector<Message> &&list, bool shown) {
|
||||
if (shown) {
|
||||
_hidden = std::nullopt;
|
||||
} else {
|
||||
@@ -500,7 +500,7 @@ void MessagesUi::showList(const std::vector<Message> &list) {
|
||||
void MessagesUi::handleIdUpdates(rpl::producer<MessageIdUpdate> idUpdates) {
|
||||
std::move(
|
||||
idUpdates
|
||||
) | rpl::start_with_next([=](MessageIdUpdate update) {
|
||||
) | rpl::on_next([=](MessageIdUpdate update) {
|
||||
const auto i = ranges::find(
|
||||
_views,
|
||||
update.localId,
|
||||
@@ -643,7 +643,7 @@ void MessagesUi::setContentFailed(MessageView &entry) {
|
||||
TextWithEntities().append(
|
||||
QString::fromUtf8("\xe2\x9d\x97\xef\xb8\x8f")
|
||||
).append(' ').append(
|
||||
Ui::Text::Italic(u"Failed to send the message."_q)),
|
||||
tr::italic(u"Failed to send the message."_q)),
|
||||
kMarkupTextOptions,
|
||||
st::groupCallWidth / 8);
|
||||
entry.price = Ui::Text::String();
|
||||
@@ -673,7 +673,7 @@ void MessagesUi::setContent(MessageView &entry) {
|
||||
}
|
||||
auto composed = entry.admin
|
||||
? entry.original
|
||||
: Ui::Text::Link(name, 1).append(' ').append(entry.original);
|
||||
: tr::link(name, 1).append(' ').append(entry.original);
|
||||
if (!entry.admin) {
|
||||
composed.text.replace(QChar('\n'), QChar(' '));
|
||||
}
|
||||
@@ -960,7 +960,7 @@ TextWithEntities MessagesUi::nameText(
|
||||
}
|
||||
result.append(Ui::Text::SingleCustomEmoji(i->second)).append(' ');
|
||||
}
|
||||
result.append(Ui::Text::Bold(peer->shortName()));
|
||||
result.append(tr::bold(peer->shortName()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1008,7 +1008,7 @@ void MessagesUi::startReactionAnimation(MessageView &entry) {
|
||||
rpl::combine(
|
||||
_scroll->scrollTopValue(),
|
||||
_scroll->RpWidget::positionValue()
|
||||
) | rpl::start_with_next([=](int yshift, QPoint point) {
|
||||
) | rpl::on_next([=](int yshift, QPoint point) {
|
||||
_reactionBasePosition = point - QPoint(0, yshift);
|
||||
for (auto &view : _views) {
|
||||
updateReactionPosition(view);
|
||||
@@ -1029,7 +1029,7 @@ void MessagesUi::startReactionAnimation(MessageView &entry) {
|
||||
const auto effectSize = st::reactionInlineImage * 2;
|
||||
const auto animation = entry.reactionAnimation.get();
|
||||
raw->resize(effectSize, effectSize);
|
||||
raw->paintRequest() | rpl::start_with_next([=] {
|
||||
raw->paintRequest() | rpl::on_next([=] {
|
||||
if (animation->finished()) {
|
||||
crl::on_main(raw, [=] {
|
||||
removeReaction(raw);
|
||||
@@ -1166,7 +1166,7 @@ void MessagesUi::setupMessagesWidget() {
|
||||
scroll->scrollTopValue(),
|
||||
scroll->heightValue(),
|
||||
_messages->heightValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updateTopFade();
|
||||
updateBottomFade();
|
||||
}, scroll->lifetime());
|
||||
@@ -1177,7 +1177,7 @@ void MessagesUi::setupMessagesWidget() {
|
||||
receiveAllMouseEvents();
|
||||
}
|
||||
|
||||
_messages->paintRequest() | rpl::start_with_next([=](QRect clip) {
|
||||
_messages->paintRequest() | rpl::on_next([=](QRect clip) {
|
||||
const auto start = scroll->scrollTop();
|
||||
const auto end = start + scroll->height();
|
||||
const auto ratio = style::DevicePixelRatio();
|
||||
@@ -1429,7 +1429,7 @@ void MessagesUi::receiveSomeMouseEvents() {
|
||||
}
|
||||
|
||||
void MessagesUi::receiveAllMouseEvents() {
|
||||
_messages->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
_messages->events() | rpl::on_next([=](not_null<QEvent*> e) {
|
||||
const auto type = e->type();
|
||||
if (type != QEvent::MouseButtonPress) {
|
||||
return;
|
||||
@@ -1529,7 +1529,7 @@ void MessagesUi::setupPinnedWidget() {
|
||||
scroll->scrollLeftValue(),
|
||||
scroll->widthValue(),
|
||||
_pinned->widthValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updateLeftFade();
|
||||
updateRightFade();
|
||||
}, scroll->lifetime());
|
||||
@@ -1570,7 +1570,7 @@ void MessagesUi::setupPinnedWidget() {
|
||||
});
|
||||
animation->seconds.callEach(crl::time(1000));
|
||||
|
||||
_pinned->paintRequest() | rpl::start_with_next([=](QRect clip) {
|
||||
_pinned->paintRequest() | rpl::on_next([=](QRect clip) {
|
||||
const auto session = &_show->session();
|
||||
const auto &colorings = session->appConfig().groupCallColorings();
|
||||
const auto start = scroll->scrollLeft();
|
||||
@@ -1713,7 +1713,7 @@ void MessagesUi::setupPinnedWidget() {
|
||||
}
|
||||
return MsgId();
|
||||
};
|
||||
_pinned->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
_pinned->events() | rpl::on_next([=](not_null<QEvent*> e) {
|
||||
const auto type = e->type();
|
||||
if (type == QEvent::MouseButtonPress) {
|
||||
const auto pos = static_cast<QMouseEvent*>(e.get())->pos();
|
||||
|
||||
@@ -279,7 +279,7 @@ Panel::~Panel() {
|
||||
|
||||
void Panel::setupRealCallViewers() {
|
||||
_call->real(
|
||||
) | rpl::start_with_next([=](not_null<Data::GroupCall*> real) {
|
||||
) | rpl::on_next([=](not_null<Data::GroupCall*> real) {
|
||||
subscribeToChanges(real);
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -338,7 +338,7 @@ void Panel::migrate(not_null<ChannelData*> channel) {
|
||||
void Panel::subscribeToPeerChanges() {
|
||||
Info::Profile::NameValue(
|
||||
_peer
|
||||
) | rpl::start_with_next([=](const QString &name) {
|
||||
) | rpl::on_next([=](const QString &name) {
|
||||
window()->setTitle(name);
|
||||
}, _peerLifetime);
|
||||
}
|
||||
@@ -383,7 +383,7 @@ void Panel::initWindow() {
|
||||
window()->setTitleStyle(st::groupCallTitle);
|
||||
|
||||
if (_call->conference()) {
|
||||
titleText() | rpl::start_with_next([=](const QString &text) {
|
||||
titleText() | rpl::on_next([=](const QString &text) {
|
||||
window()->setTitle(text);
|
||||
}, lifetime());
|
||||
} else {
|
||||
@@ -448,11 +448,11 @@ void Panel::initWindow() {
|
||||
});
|
||||
|
||||
_call->hasVideoWithFramesValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updateMode();
|
||||
}, lifetime());
|
||||
|
||||
_window->maximizeRequests() | rpl::start_with_next([=](bool maximized) {
|
||||
_window->maximizeRequests() | rpl::on_next([=](bool maximized) {
|
||||
if (_call->rtmp()) {
|
||||
toggleFullScreen(maximized);
|
||||
} else {
|
||||
@@ -462,7 +462,7 @@ void Panel::initWindow() {
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
_window->showingLayer() | rpl::start_with_next([=] {
|
||||
_window->showingLayer() | rpl::on_next([=] {
|
||||
hideStickedTooltip(StickedTooltipHide::Unavailable);
|
||||
}, lifetime());
|
||||
|
||||
@@ -476,12 +476,12 @@ void Panel::initWidget() {
|
||||
widget()->setMouseTracking(true);
|
||||
|
||||
widget()->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
paint(clip);
|
||||
}, lifetime());
|
||||
|
||||
widget()->sizeValue(
|
||||
) | rpl::skip(1) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::skip(1) | rpl::on_next([=](QSize size) {
|
||||
if (!updateMode()) {
|
||||
updateControlsGeometry();
|
||||
}
|
||||
@@ -506,7 +506,7 @@ void Panel::toggleMessageTyping() {
|
||||
_messageField->toggle(true);
|
||||
|
||||
_messageField->submitted(
|
||||
) | rpl::start_with_next([=](TextWithTags text) {
|
||||
) | rpl::on_next([=](TextWithTags text) {
|
||||
_call->sendMessage(std::move(text));
|
||||
|
||||
_messageField->toggle(false);
|
||||
@@ -514,17 +514,17 @@ void Panel::toggleMessageTyping() {
|
||||
updateWideControlsVisibility();
|
||||
}, _messageField->lifetime());
|
||||
|
||||
_messageField->heightValue() | rpl::start_with_next([=] {
|
||||
_messageField->heightValue() | rpl::on_next([=] {
|
||||
updateButtonsGeometry();
|
||||
}, _messageField->lifetime());
|
||||
|
||||
_messageField->closeRequests() | rpl::start_with_next([=] {
|
||||
_messageField->closeRequests() | rpl::on_next([=] {
|
||||
if (_messageTyping.current()) {
|
||||
toggleMessageTyping();
|
||||
}
|
||||
}, _messageField->lifetime());
|
||||
|
||||
_messageField->closed() | rpl::start_with_next([=] {
|
||||
_messageField->closed() | rpl::on_next([=] {
|
||||
_messageField = nullptr;
|
||||
updateButtonsGeometry();
|
||||
}, _messageField->lifetime());
|
||||
@@ -576,7 +576,7 @@ void Panel::initControls() {
|
||||
_mute->clicks(
|
||||
) | rpl::filter([=](Qt::MouseButton button) {
|
||||
return (button == Qt::LeftButton);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
if (_call->scheduleDate()) {
|
||||
if (_call->canManage()) {
|
||||
startScheduledNow();
|
||||
@@ -611,7 +611,7 @@ void Panel::initControls() {
|
||||
rpl::combine(
|
||||
_mode.value(),
|
||||
_call->canManageValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshTopButton();
|
||||
}, lifetime());
|
||||
|
||||
@@ -638,12 +638,12 @@ void Panel::initControls() {
|
||||
_peer,
|
||||
Data::PeerUpdate::Flag::Username
|
||||
) | rpl::skip(1) | rpl::to_empty
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshLeftButton();
|
||||
updateControlsGeometry();
|
||||
}, _callLifetime);
|
||||
|
||||
std::move(started) | rpl::start_with_next([=] {
|
||||
std::move(started) | rpl::on_next([=] {
|
||||
refreshVideoButtons();
|
||||
updateButtonsStyles();
|
||||
setupMembers();
|
||||
@@ -658,19 +658,19 @@ void Panel::initControls() {
|
||||
|| (state == State::Ended)
|
||||
|| (state == State::FailedHangingUp)
|
||||
|| (state == State::Failed);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
closeBeforeDestroy();
|
||||
}, _callLifetime);
|
||||
|
||||
_call->levelUpdates(
|
||||
) | rpl::filter([=](const LevelUpdate &update) {
|
||||
return update.me;
|
||||
}) | rpl::start_with_next([=](const LevelUpdate &update) {
|
||||
}) | rpl::on_next([=](const LevelUpdate &update) {
|
||||
_mute->setLevel(update.value);
|
||||
}, _callLifetime);
|
||||
|
||||
_call->real(
|
||||
) | rpl::start_with_next([=](not_null<Data::GroupCall*> real) {
|
||||
) | rpl::on_next([=](not_null<Data::GroupCall*> real) {
|
||||
setupRealMuteButtonState(real);
|
||||
}, _callLifetime);
|
||||
|
||||
@@ -757,7 +757,7 @@ void Panel::refreshVideoButtons(std::optional<bool> overrideWideMode) {
|
||||
_video->setColorOverrides(
|
||||
toggleableOverrides(_call->isSharingCameraValue()));
|
||||
_call->isSharingCameraValue(
|
||||
) | rpl::start_with_next([=](bool sharing) {
|
||||
) | rpl::on_next([=](bool sharing) {
|
||||
if (sharing) {
|
||||
hideStickedTooltip(
|
||||
StickedTooltip::Camera,
|
||||
@@ -775,7 +775,7 @@ void Panel::refreshVideoButtons(std::optional<bool> overrideWideMode) {
|
||||
_screenShare->setColorOverrides(
|
||||
toggleableOverrides(_call->isSharingScreenValue()));
|
||||
_call->isSharingScreenValue(
|
||||
) | rpl::start_with_next([=](bool sharing) {
|
||||
) | rpl::on_next([=](bool sharing) {
|
||||
_screenShare->setProgress(sharing ? 1. : 0.);
|
||||
}, _screenShare->lifetime());
|
||||
}
|
||||
@@ -869,7 +869,7 @@ void Panel::setupRealMuteButtonState(not_null<Data::GroupCall*> real) {
|
||||
) | rpl::distinct_until_changed(
|
||||
) | rpl::filter(
|
||||
_2 != GroupCall::InstanceState::TransitionToRtc
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
MuteState mute,
|
||||
GroupCall::InstanceState state,
|
||||
TimeId scheduleDate,
|
||||
@@ -969,7 +969,7 @@ void Panel::setupScheduledLabels(rpl::producer<TimeId> date) {
|
||||
rpl::combine(
|
||||
widget()->sizeValue(),
|
||||
_startsIn->widthValue()
|
||||
) | rpl::start_with_next([=](QSize size, int width) {
|
||||
) | rpl::on_next([=](QSize size, int width) {
|
||||
_startsIn->move(
|
||||
(size.width() - width) / 2,
|
||||
top() + st::groupCallStartsInTop);
|
||||
@@ -978,7 +978,7 @@ void Panel::setupScheduledLabels(rpl::producer<TimeId> date) {
|
||||
rpl::combine(
|
||||
widget()->sizeValue(),
|
||||
_startsWhen->widthValue()
|
||||
) | rpl::start_with_next([=](QSize size, int width) {
|
||||
) | rpl::on_next([=](QSize size, int width) {
|
||||
_startsWhen->move(
|
||||
(size.width() - width) / 2,
|
||||
top() + st::groupCallStartsWhenTop);
|
||||
@@ -987,7 +987,7 @@ void Panel::setupScheduledLabels(rpl::producer<TimeId> date) {
|
||||
rpl::combine(
|
||||
widget()->sizeValue(),
|
||||
_countdown->widthValue()
|
||||
) | rpl::start_with_next([=](QSize size, int width) {
|
||||
) | rpl::on_next([=](QSize size, int width) {
|
||||
_countdown->move(
|
||||
(size.width() - width) / 2,
|
||||
top() + st::groupCallCountdownTop);
|
||||
@@ -1014,7 +1014,7 @@ void Panel::setupMembers() {
|
||||
_viewport->mouseInsideValue(
|
||||
) | rpl::filter([=] {
|
||||
return !_rtmpFull;
|
||||
}) | rpl::start_with_next([=](bool inside) {
|
||||
}) | rpl::on_next([=](bool inside) {
|
||||
toggleWideControls(inside);
|
||||
}, _viewport->lifetime());
|
||||
|
||||
@@ -1025,27 +1025,27 @@ void Panel::setupMembers() {
|
||||
raiseControls();
|
||||
|
||||
_members->desiredHeightValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updateMembersGeometry();
|
||||
}, _members->lifetime());
|
||||
|
||||
_members->toggleMuteRequests(
|
||||
) | rpl::start_with_next([=](MuteRequest request) {
|
||||
) | rpl::on_next([=](MuteRequest request) {
|
||||
_call->toggleMute(request);
|
||||
}, _callLifetime);
|
||||
|
||||
_members->changeVolumeRequests(
|
||||
) | rpl::start_with_next([=](VolumeRequest request) {
|
||||
) | rpl::on_next([=](VolumeRequest request) {
|
||||
_call->changeVolume(request);
|
||||
}, _callLifetime);
|
||||
|
||||
_members->kickParticipantRequests(
|
||||
) | rpl::start_with_next([=](not_null<PeerData*> participantPeer) {
|
||||
) | rpl::on_next([=](not_null<PeerData*> participantPeer) {
|
||||
kickParticipant(participantPeer);
|
||||
}, _callLifetime);
|
||||
|
||||
_members->addMembersRequests(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (_call->conference()) {
|
||||
addMembers();
|
||||
} else if (!_peer->isBroadcast()
|
||||
@@ -1060,10 +1060,10 @@ void Panel::setupMembers() {
|
||||
}, _callLifetime);
|
||||
|
||||
_members->shareLinkRequests(
|
||||
) | rpl::start_with_next(shareConferenceLinkCallback(), _callLifetime);
|
||||
) | rpl::on_next(shareConferenceLinkCallback(), _callLifetime);
|
||||
|
||||
_call->videoEndpointLargeValue(
|
||||
) | rpl::start_with_next([=](const VideoEndpoint &large) {
|
||||
) | rpl::on_next([=](const VideoEndpoint &large) {
|
||||
if (large && mode() != PanelMode::Wide) {
|
||||
enlargeVideo();
|
||||
}
|
||||
@@ -1214,7 +1214,7 @@ void Panel::setupVideo(not_null<Viewport*> viewport) {
|
||||
setupTile(endpoint, track);
|
||||
}
|
||||
_call->videoStreamActiveUpdates(
|
||||
) | rpl::start_with_next([=](const VideoStateToggle &update) {
|
||||
) | rpl::on_next([=](const VideoStateToggle &update) {
|
||||
if (update.value) {
|
||||
// Add async (=> the participant row is definitely in Members).
|
||||
const auto endpoint = update.endpoint;
|
||||
@@ -1232,14 +1232,14 @@ void Panel::setupVideo(not_null<Viewport*> viewport) {
|
||||
}, viewport->lifetime());
|
||||
|
||||
viewport->pinToggled(
|
||||
) | rpl::start_with_next([=](bool pinned) {
|
||||
) | rpl::on_next([=](bool pinned) {
|
||||
_call->pinVideoEndpoint(pinned
|
||||
? _call->videoEndpointLarge()
|
||||
: VideoEndpoint{});
|
||||
}, viewport->lifetime());
|
||||
|
||||
viewport->clicks(
|
||||
) | rpl::start_with_next([=](VideoEndpoint &&endpoint) {
|
||||
) | rpl::on_next([=](VideoEndpoint &&endpoint) {
|
||||
if (_call->videoEndpointLarge() == endpoint) {
|
||||
_call->showVideoEndpointLarge({});
|
||||
} else if (_call->videoEndpointPinned()) {
|
||||
@@ -1250,7 +1250,7 @@ void Panel::setupVideo(not_null<Viewport*> viewport) {
|
||||
}, viewport->lifetime());
|
||||
|
||||
viewport->qualityRequests(
|
||||
) | rpl::start_with_next([=](const VideoQualityRequest &request) {
|
||||
) | rpl::on_next([=](const VideoQualityRequest &request) {
|
||||
_call->requestVideoQuality(request.endpoint, request.quality);
|
||||
}, viewport->lifetime());
|
||||
}
|
||||
@@ -1319,7 +1319,7 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||
animate();
|
||||
|
||||
_recordingMark->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = QPainter(_recordingMark.data());
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
@@ -1338,7 +1338,7 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||
) | rpl::map(
|
||||
_1 != 0
|
||||
) | rpl::distinct_until_changed(
|
||||
) | rpl::start_with_next([=](bool recorded) {
|
||||
) | rpl::on_next([=](bool recorded) {
|
||||
const auto livestream = _call->peer()->isBroadcast();
|
||||
const auto isVideo = real->recordVideo();
|
||||
if (recorded) {
|
||||
@@ -1360,19 +1360,19 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||
? tr::lng_group_call_recording_stopped_channel
|
||||
: tr::lng_group_call_recording_stopped))(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}, lifetime());
|
||||
validateRecordingMark(real->recordStartDate() != 0);
|
||||
|
||||
rpl::combine(
|
||||
_call->videoIsWorkingValue(),
|
||||
_call->isSharingCameraValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshVideoButtons();
|
||||
showStickedTooltip();
|
||||
}, lifetime());
|
||||
|
||||
_call->messagesEnabledValue() | rpl::start_with_next([=] {
|
||||
_call->messagesEnabledValue() | rpl::on_next([=] {
|
||||
updateButtonsGeometry();
|
||||
raiseControls();
|
||||
}, lifetime());
|
||||
@@ -1380,12 +1380,12 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||
rpl::combine(
|
||||
_call->videoIsWorkingValue(),
|
||||
_call->isSharingScreenValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshTopButton();
|
||||
}, lifetime());
|
||||
|
||||
_call->mutedValue(
|
||||
) | rpl::skip(1) | rpl::start_with_next([=](MuteState state) {
|
||||
) | rpl::skip(1) | rpl::on_next([=](MuteState state) {
|
||||
updateButtonsGeometry();
|
||||
if (state == MuteState::Active
|
||||
|| state == MuteState::PushToTalk) {
|
||||
@@ -1419,7 +1419,7 @@ void Panel::createPinOnTop() {
|
||||
}
|
||||
};
|
||||
_fullScreenOrMaximized.value(
|
||||
) | rpl::start_with_next([=](bool fullScreenOrMaximized) {
|
||||
) | rpl::on_next([=](bool fullScreenOrMaximized) {
|
||||
_window->setControlsStyle(fullScreenOrMaximized
|
||||
? st::callTitle
|
||||
: st::groupCallTitle);
|
||||
@@ -1436,7 +1436,7 @@ void Panel::createPinOnTop() {
|
||||
_viewport->rp()->events(
|
||||
) | rpl::filter([](not_null<QEvent*> event) {
|
||||
return (event->type() == QEvent::MouseMove);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
_hideControlsTimer.callOnce(kHideControlsTimeout);
|
||||
toggleWideControls(true);
|
||||
}, _hideControlsTimerLifetime);
|
||||
@@ -1491,7 +1491,7 @@ void Panel::refreshTopButton() {
|
||||
) | rpl::then(_call->rejoinEvents(
|
||||
) | rpl::map([](const RejoinEvent &event) {
|
||||
return event.nowJoinAs;
|
||||
})) | rpl::start_with_next([=](not_null<PeerData*> joinAs) {
|
||||
})) | rpl::on_next([=](not_null<PeerData*> joinAs) {
|
||||
auto joinAsToggle = object_ptr<Ui::UserpicButton>(
|
||||
widget(),
|
||||
joinAs,
|
||||
@@ -1739,7 +1739,7 @@ void Panel::initLayout(ConferencePanelMigration info) {
|
||||
_window->raiseControls();
|
||||
|
||||
_window->controlsLayoutChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
// _menuToggle geometry depends on _controls arrangement.
|
||||
crl::on_main(this, [=] { updateControlsGeometry(); });
|
||||
}, lifetime());
|
||||
@@ -1893,7 +1893,7 @@ void Panel::updateButtonsStyles() {
|
||||
|
||||
void Panel::setupEmptyRtmp() {
|
||||
_call->emptyRtmpValue(
|
||||
) | rpl::start_with_next([=](bool empty) {
|
||||
) | rpl::on_next([=](bool empty) {
|
||||
if (!empty) {
|
||||
_emptyRtmp.destroy();
|
||||
return;
|
||||
@@ -1924,13 +1924,13 @@ void Panel::setupEmptyRtmp() {
|
||||
_emptyRtmp->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
_emptyRtmp->show();
|
||||
_emptyRtmp->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = QPainter(_emptyRtmp.data());
|
||||
label->corners.paint(p, _emptyRtmp->rect());
|
||||
}, _emptyRtmp->lifetime());
|
||||
|
||||
widget()->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
const auto padding = st::groupCallWidth / 30;
|
||||
const auto width = std::min(
|
||||
size.width() - padding * 4,
|
||||
@@ -1987,7 +1987,7 @@ void Panel::refreshTitleBackground() {
|
||||
st::roundRadiusLarge,
|
||||
_controlsBackgroundColor.color());
|
||||
_titleBackground->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = QPainter(_titleBackground.data());
|
||||
corners->paintSomeRounded(
|
||||
p,
|
||||
@@ -2014,7 +2014,7 @@ void Panel::setupControlsBackgroundNarrow() {
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
rpl::single(rpl::empty) | rpl::then(
|
||||
style::PaletteChanged()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
full->fill(Qt::transparent);
|
||||
|
||||
auto p = QPainter(full);
|
||||
@@ -2055,7 +2055,7 @@ void Panel::setupControlsBackgroundNarrow() {
|
||||
- st::groupCallMembersMargin.right()),
|
||||
height);
|
||||
_controlsBackgroundNarrow->shadow.paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
auto p = QPainter(&_controlsBackgroundNarrow->shadow);
|
||||
clip = clip.intersected(_controlsBackgroundNarrow->shadow.rect());
|
||||
const auto inner = _members->getInnerGeometry().translated(
|
||||
@@ -2097,7 +2097,7 @@ void Panel::setupControlsBackgroundWide() {
|
||||
st::groupCallControlsBackRadius,
|
||||
_controlsBackgroundColor.color());
|
||||
_controlsBackgroundWide->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = QPainter(_controlsBackgroundWide.data());
|
||||
corners->paint(p, _controlsBackgroundWide->rect());
|
||||
}, lifetime);
|
||||
@@ -2111,7 +2111,7 @@ void Panel::trackControl(Ui::RpWidget *widget, rpl::lifetime &lifetime) {
|
||||
}
|
||||
const auto over = std::make_shared<bool>();
|
||||
widget->events(
|
||||
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
) | rpl::on_next([=](not_null<QEvent*> e) {
|
||||
const auto type = e->type();
|
||||
if (type == QEvent::Enter) {
|
||||
// Enter events may come from widget destructors,
|
||||
@@ -2123,6 +2123,7 @@ void Panel::trackControl(Ui::RpWidget *widget, rpl::lifetime &lifetime) {
|
||||
trackControlOver(widget, true);
|
||||
}
|
||||
});
|
||||
toggleWideControls(true);
|
||||
} else if (type == QEvent::Leave) {
|
||||
*over = false;
|
||||
crl::on_main(widget, [=] {
|
||||
@@ -2130,6 +2131,7 @@ void Panel::trackControl(Ui::RpWidget *widget, rpl::lifetime &lifetime) {
|
||||
trackControlOver(widget, false);
|
||||
}
|
||||
});
|
||||
toggleWideControls(false);
|
||||
}
|
||||
}, lifetime);
|
||||
}
|
||||
@@ -2150,7 +2152,6 @@ void Panel::trackControlOver(not_null<Ui::RpWidget*> control, bool over) {
|
||||
} else {
|
||||
Ui::Integration::Instance().unregisterLeaveSubscription(control);
|
||||
}
|
||||
toggleWideControls(over);
|
||||
}
|
||||
|
||||
void Panel::showStickedTooltip() {
|
||||
@@ -2254,7 +2255,7 @@ void Panel::showNiceTooltip(
|
||||
rpl::combine(
|
||||
label->sizeValue(),
|
||||
button->sizeValue()
|
||||
) | rpl::start_with_next([=](QSize text, QSize close) {
|
||||
) | rpl::on_next([=](QSize text, QSize close) {
|
||||
const auto height = std::max(text.height(), close.height());
|
||||
container->resize(text.width() + close.width(), height);
|
||||
label->move(0, (height - text.height()) / 2);
|
||||
@@ -2285,7 +2286,7 @@ void Panel::showNiceTooltip(
|
||||
base::qt_signal_producer(
|
||||
control.get(),
|
||||
&QObject::destroyed
|
||||
) | rpl::start_with_next(destroy, tooltip->lifetime());
|
||||
) | rpl::on_next(destroy, tooltip->lifetime());
|
||||
|
||||
_niceTooltipControl = control;
|
||||
updateTooltipGeometry();
|
||||
@@ -2765,7 +2766,7 @@ void Panel::refreshTitle() {
|
||||
|
||||
refreshTitleColors();
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshTitleColors();
|
||||
}, _title->lifetime());
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void StartRtmpProcess::start(
|
||||
.done = std::move(done),
|
||||
});
|
||||
session->account().sessionChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_request = nullptr;
|
||||
}, _request->lifetime);
|
||||
|
||||
@@ -161,7 +161,7 @@ void StartRtmpProcess::requestUrl(bool revoke) {
|
||||
const auto session = &_request->peer->session();
|
||||
_request->id = session->api().request(MTPphone_GetGroupCallStreamRtmpUrl(
|
||||
MTP_flags(0),
|
||||
_request->peer->input,
|
||||
_request->peer->input(),
|
||||
MTP_bool(revoke)
|
||||
)).done([=](const MTPphone_GroupCallStreamRtmpUrl &result) {
|
||||
auto data = result.match([&](
|
||||
@@ -214,7 +214,7 @@ void StartRtmpProcess::createBox() {
|
||||
_request->show,
|
||||
_request->data.value());
|
||||
object->boxClosing(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_request = nullptr;
|
||||
}, _request->lifetime);
|
||||
_request->box = base::make_weak(object.data());
|
||||
@@ -272,7 +272,7 @@ void StartRtmpProcess::FillRtmpRows(
|
||||
const auto weak = container->add(std::move(wrap), rowPadding);
|
||||
Ui::AddSkip(container, st::groupCallRtmpCopyButtonBottomSkip);
|
||||
button->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
weak->resize(weak->width(), height);
|
||||
}, container->lifetime());
|
||||
return weak;
|
||||
@@ -335,7 +335,7 @@ void StartRtmpProcess::FillRtmpRows(
|
||||
if (button == Qt::LeftButton) {
|
||||
show->showBox(Ui::MakeConfirmBox({
|
||||
.text = tr::lng_group_call_rtmp_key_warning(
|
||||
Ui::Text::RichLangValue),
|
||||
tr::rich),
|
||||
.confirmed = [=](Fn<void()> &&close) {
|
||||
handler->onClick({});
|
||||
close();
|
||||
|
||||
@@ -377,7 +377,7 @@ void SettingsBox(
|
||||
))->toggleOn(rpl::single(
|
||||
settings.groupCallNoiseSuppression()
|
||||
))->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool enabled) {
|
||||
) | rpl::on_next([=](bool enabled) {
|
||||
Core::App().settings().setGroupCallNoiseSuppression(enabled);
|
||||
call->setNoiseSuppression(enabled);
|
||||
Core::App().saveSettingsDelayed();
|
||||
@@ -457,8 +457,8 @@ void SettingsBox(
|
||||
? tr::lng_group_call_mac_input()
|
||||
: tr::lng_group_call_mac_accessibility())
|
||||
) | rpl::map([](QString a, QString b) {
|
||||
auto result = Ui::Text::RichLangValue(a);
|
||||
result.append("\n\n").append(Ui::Text::RichLangValue(b));
|
||||
auto result = tr::rich(a);
|
||||
result.append("\n\n").append(tr::rich(b));
|
||||
return result;
|
||||
}),
|
||||
st::groupCallBoxLabel),
|
||||
@@ -482,7 +482,7 @@ void SettingsBox(
|
||||
kCheckAccessibilityInterval
|
||||
) | rpl::filter([] {
|
||||
return base::GlobalShortcutsAllowed();
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
}
|
||||
@@ -579,7 +579,7 @@ void SettingsBox(
|
||||
settings.groupCallPushToTalk(),
|
||||
anim::type::instant);
|
||||
pushToTalk->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
) | rpl::on_next([=](bool toggled) {
|
||||
if (!toggled) {
|
||||
stopRecording();
|
||||
} else if (!ensureManager()) {
|
||||
@@ -694,7 +694,7 @@ void SettingsBox(
|
||||
state->requestId = session->api().request(
|
||||
MTPphone_GetGroupCallStreamRtmpUrl(
|
||||
MTP_flags(0),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_bool(true)
|
||||
)).done([=](const MTPphone_GroupCallStreamRtmpUrl &result) {
|
||||
auto data = result.match([&](
|
||||
@@ -801,12 +801,12 @@ void SettingsBox(
|
||||
});
|
||||
|
||||
volumeItem->toggleMuteLocallyRequests(
|
||||
) | rpl::start_with_next([=](bool muted) {
|
||||
) | rpl::on_next([=](bool muted) {
|
||||
toggleMute(muted, true);
|
||||
}, volumeItem->lifetime());
|
||||
|
||||
volumeItem->changeVolumeLocallyRequests(
|
||||
) | rpl::start_with_next([=](int volume) {
|
||||
) | rpl::on_next([=](int volume) {
|
||||
changeVolume(volume, true);
|
||||
}, volumeItem->lifetime());
|
||||
}
|
||||
@@ -849,7 +849,7 @@ void SettingsBox(
|
||||
|
||||
box->setTitle(tr::lng_group_call_settings_title());
|
||||
box->boxClosing(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (canChangeJoinMuted
|
||||
&& muteJoined
|
||||
&& muteJoined->toggled() != joinMuted) {
|
||||
|
||||
@@ -50,14 +50,14 @@ void Toasts::setupJoinAsChanged() {
|
||||
return _call->stateValue() | rpl::filter([](State state) {
|
||||
return (state == State::Joined);
|
||||
}) | rpl::take(1);
|
||||
}) | rpl::flatten_latest() | rpl::start_with_next([=] {
|
||||
}) | rpl::flatten_latest() | rpl::on_next([=] {
|
||||
_panel->uiShow()->showToast((_call->peer()->isBroadcast()
|
||||
? tr::lng_group_call_join_as_changed_channel
|
||||
: tr::lng_group_call_join_as_changed)(
|
||||
tr::now,
|
||||
lt_name,
|
||||
Ui::Text::Bold(_call->joinAs()->name()),
|
||||
Ui::Text::WithEntities));
|
||||
tr::bold(_call->joinAs()->name()),
|
||||
tr::marked));
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
@@ -70,20 +70,20 @@ void Toasts::setupTitleChanged() {
|
||||
return peer->groupCall()->title().isEmpty()
|
||||
? peer->name()
|
||||
: peer->groupCall()->title();
|
||||
}) | rpl::start_with_next([=](const QString &title) {
|
||||
}) | rpl::on_next([=](const QString &title) {
|
||||
_panel->uiShow()->showToast((_call->peer()->isBroadcast()
|
||||
? tr::lng_group_call_title_changed_channel
|
||||
: tr::lng_group_call_title_changed)(
|
||||
tr::now,
|
||||
lt_title,
|
||||
Ui::Text::Bold(title),
|
||||
Ui::Text::WithEntities));
|
||||
tr::bold(title),
|
||||
tr::marked));
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
void Toasts::setupAllowedToSpeak() {
|
||||
_call->allowedToSpeakNotifications(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (_panel->isActive()) {
|
||||
_panel->uiShow()->showToast(
|
||||
tr::lng_group_call_can_speak_here(tr::now));
|
||||
@@ -96,8 +96,8 @@ void Toasts::setupAllowedToSpeak() {
|
||||
.text = tr::lng_group_call_can_speak(
|
||||
tr::now,
|
||||
lt_chat,
|
||||
Ui::Text::Bold(name),
|
||||
Ui::Text::WithEntities),
|
||||
tr::bold(name),
|
||||
tr::marked),
|
||||
});
|
||||
}
|
||||
}, _lifetime);
|
||||
@@ -112,7 +112,7 @@ void Toasts::setupPinnedVideo() {
|
||||
}) | rpl::flatten_latest(
|
||||
) | rpl::filter([=] {
|
||||
return (_call->shownVideoTracks().size() > 1);
|
||||
}) | rpl::start_with_next([=](const VideoEndpoint &endpoint) {
|
||||
}) | rpl::on_next([=](const VideoEndpoint &endpoint) {
|
||||
const auto pinned = _call->videoEndpointPinned();
|
||||
const auto peer = endpoint.peer;
|
||||
if (!peer) {
|
||||
@@ -147,7 +147,7 @@ void Toasts::setupPinnedVideo() {
|
||||
void Toasts::setupRequestedToSpeak() {
|
||||
_call->mutedValue(
|
||||
) | rpl::combine_previous(
|
||||
) | rpl::start_with_next([=](MuteState was, MuteState now) {
|
||||
) | rpl::on_next([=](MuteState was, MuteState now) {
|
||||
if (was == MuteState::ForceMuted && now == MuteState::RaisedHand) {
|
||||
_panel->uiShow()->showToast(
|
||||
tr::lng_group_call_tooltip_raised_hand(tr::now));
|
||||
@@ -157,7 +157,7 @@ void Toasts::setupRequestedToSpeak() {
|
||||
|
||||
void Toasts::setupError() {
|
||||
_call->errors(
|
||||
) | rpl::start_with_next([=](Error error) {
|
||||
) | rpl::on_next([=](Error error) {
|
||||
const auto key = [&] {
|
||||
switch (error) {
|
||||
case Error::NoCamera: return tr::lng_call_error_no_camera;
|
||||
|
||||
@@ -102,12 +102,12 @@ void Viewport::setup() {
|
||||
_content->sizeValue(
|
||||
) | rpl::filter([=] {
|
||||
return wide() || videoStream();
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
updateTilesGeometry();
|
||||
}, lifetime());
|
||||
|
||||
_content->events(
|
||||
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
) | rpl::on_next([=](not_null<QEvent*> e) {
|
||||
const auto type = e->type();
|
||||
if (type == QEvent::Enter) {
|
||||
Ui::Integration::Instance().registerLeaveSubscription(raw);
|
||||
@@ -299,12 +299,12 @@ void Viewport::add(
|
||||
_tiles.back()->trackSizeValue(
|
||||
) | rpl::filter([](QSize size) {
|
||||
return !size.isEmpty();
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
updateTilesGeometry();
|
||||
}, _tiles.back()->lifetime());
|
||||
|
||||
_tiles.back()->track()->stateValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updateTilesGeometry();
|
||||
}, _tiles.back()->lifetime());
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ Viewport::RendererGL::RendererGL(not_null<Viewport*> owner)
|
||||
st::radialBg) {
|
||||
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_buttons.invalidate();
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ Viewport::VideoTile::VideoTile(
|
||||
_track.track->stateValue(
|
||||
) | rpl::filter(
|
||||
_1 == Webrtc::VideoState::Paused
|
||||
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
) | rpl::take(1) | rpl::on_next([=] {
|
||||
_wasPaused = true;
|
||||
}, _lifetime);
|
||||
|
||||
@@ -260,7 +260,7 @@ void Viewport::VideoTile::setup(rpl::producer<bool> pinned) {
|
||||
pinned
|
||||
) | rpl::filter([=](bool pinned) {
|
||||
return (_pinned != pinned);
|
||||
}) | rpl::start_with_next([=](bool pinned) {
|
||||
}) | rpl::on_next([=](bool pinned) {
|
||||
_pinned = pinned;
|
||||
updateTopControlsSize();
|
||||
if (!_hidden) {
|
||||
@@ -270,7 +270,7 @@ void Viewport::VideoTile::setup(rpl::producer<bool> pinned) {
|
||||
}, _lifetime);
|
||||
|
||||
_track.track->renderNextFrame(
|
||||
) | rpl::start_with_next(_update, _lifetime);
|
||||
) | rpl::on_next(_update, _lifetime);
|
||||
|
||||
updateTopControlsSize();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ MenuVolumeItem::MenuVolumeItem(
|
||||
_slider->setAlwaysDisplayMarker(true);
|
||||
|
||||
sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &size) {
|
||||
) | rpl::on_next([=](const QSize &size) {
|
||||
const auto geometry = QRect(QPoint(), size);
|
||||
_itemRect = geometry - _padding;
|
||||
_speakerRect = QRect(_itemRect.topLeft(), _stCross.icon.size());
|
||||
@@ -90,7 +90,7 @@ MenuVolumeItem::MenuVolumeItem(
|
||||
setCloudVolume(startVolume);
|
||||
|
||||
paintRequest(
|
||||
) | rpl::start_with_next([=](const QRect &clip) {
|
||||
) | rpl::on_next([=](const QRect &clip) {
|
||||
auto p = QPainter(this);
|
||||
|
||||
const auto volume = _localMuted
|
||||
@@ -167,7 +167,7 @@ MenuVolumeItem::MenuVolumeItem(
|
||||
|
||||
std::move(
|
||||
participantState
|
||||
) | rpl::start_with_next([=](const Group::ParticipantState &state) {
|
||||
) | rpl::on_next([=](const Group::ParticipantState &state) {
|
||||
const auto newMuted = state.mutedByMe;
|
||||
const auto newVolume = state.volume.value_or(0);
|
||||
|
||||
@@ -210,7 +210,7 @@ void MenuVolumeItem::initArcsAnimation() {
|
||||
});
|
||||
|
||||
_arcs->startUpdateRequests(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (!_arcsAnimation.animating()) {
|
||||
*lastTime = crl::now();
|
||||
_arcsAnimation.start();
|
||||
@@ -218,7 +218,7 @@ void MenuVolumeItem::initArcsAnimation() {
|
||||
}, lifetime());
|
||||
|
||||
_arcs->stopUpdateRequests(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_arcsAnimation.stop();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ RecordingInfo::RecordingInfo(not_null<Ui::RpWidget*> parent)
|
||||
: RpWidget(parent)
|
||||
, _container(this) {
|
||||
sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &size) {
|
||||
) | rpl::on_next([=](const QSize &size) {
|
||||
_container->resizeToWidth(size.width());
|
||||
}, _container->lifetime());
|
||||
}
|
||||
@@ -140,7 +140,7 @@ void RecordingInfo::prepareAudio() {
|
||||
audioIcon->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &size) {
|
||||
) | rpl::on_next([=](const QSize &size) {
|
||||
audioIcon->moveToLeft((size.width() - audioIcon->width()) / 2, 0);
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -175,7 +175,7 @@ void RecordingInfo::prepareVideo() {
|
||||
};
|
||||
for (const auto icon : icons) {
|
||||
icon->clicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
for (const auto &i : icons) {
|
||||
i->setToggled(icon == i);
|
||||
}
|
||||
@@ -184,7 +184,7 @@ void RecordingInfo::prepareVideo() {
|
||||
}
|
||||
|
||||
wrap->sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &size) {
|
||||
) | rpl::on_next([=](const QSize &size) {
|
||||
const auto wHalf = size.width() / icons.size();
|
||||
for (auto i = 0; i < icons.size(); i++) {
|
||||
const auto &icon = icons[i];
|
||||
@@ -230,7 +230,7 @@ Switcher::Switcher(
|
||||
};
|
||||
|
||||
sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &size) {
|
||||
) | rpl::on_next([=](const QSize &size) {
|
||||
_audio->resize(size.width(), size.height());
|
||||
_video->resize(size.width(), size.height());
|
||||
|
||||
@@ -242,7 +242,7 @@ Switcher::Switcher(
|
||||
|
||||
std::move(
|
||||
toggled
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
) | rpl::on_next([=](bool toggled) {
|
||||
_toggled = toggled;
|
||||
_animation.start(
|
||||
updatePositions,
|
||||
@@ -281,7 +281,7 @@ void EditGroupCallTitleBox(
|
||||
box->closeBox();
|
||||
done(result);
|
||||
};
|
||||
input->submits() | rpl::start_with_next(submit, input->lifetime());
|
||||
input->submits() | rpl::on_next(submit, input->lifetime());
|
||||
box->addButton(tr::lng_settings_save(), submit);
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
}
|
||||
@@ -340,7 +340,7 @@ void AddTitleGroupCallRecordingBox(
|
||||
box->closeBox();
|
||||
done(result);
|
||||
};
|
||||
input->submits() | rpl::start_with_next(submit, input->lifetime());
|
||||
input->submits() | rpl::on_next(submit, input->lifetime());
|
||||
box->addButton(tr::lng_group_call_recording_start_button(), submit);
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ rpl::producer<QString> StartsWhenText(rpl::producer<TimeId> date) {
|
||||
rpl::single(langDayOfMonthFull(dateDay.date())),
|
||||
lt_time,
|
||||
rpl::single(time)
|
||||
) | rpl::type_erased();
|
||||
) | rpl::type_erased;
|
||||
auto tomorrow = tr::lng_group_call_starts_short_tomorrow(
|
||||
lt_time,
|
||||
rpl::single(time));
|
||||
@@ -56,7 +56,7 @@ rpl::producer<QString> StartsWhenText(rpl::producer<TimeId> date) {
|
||||
std::min(tillAfter, kDay) * crl::time(1000)
|
||||
) | rpl::map([=] {
|
||||
return rpl::duplicate(exact);
|
||||
})) | rpl::flatten_latest() | rpl::type_erased();
|
||||
})) | rpl::flatten_latest() | rpl::type_erased;
|
||||
|
||||
auto tomorrowAndAfter = rpl::single(
|
||||
std::move(tomorrow)
|
||||
@@ -64,7 +64,7 @@ rpl::producer<QString> StartsWhenText(rpl::producer<TimeId> date) {
|
||||
std::min(tillToday, kDay) * crl::time(1000)
|
||||
) | rpl::map([=] {
|
||||
return rpl::duplicate(todayAndAfter);
|
||||
})) | rpl::flatten_latest() | rpl::type_erased();
|
||||
})) | rpl::flatten_latest() | rpl::type_erased;
|
||||
|
||||
auto full = rpl::single(
|
||||
rpl::duplicate(exact)
|
||||
@@ -72,7 +72,7 @@ rpl::producer<QString> StartsWhenText(rpl::producer<TimeId> date) {
|
||||
tillTomorrow * crl::time(1000)
|
||||
) | rpl::map([=] {
|
||||
return rpl::duplicate(tomorrowAndAfter);
|
||||
})) | rpl::flatten_latest() | rpl::type_erased();
|
||||
})) | rpl::flatten_latest() | rpl::type_erased;
|
||||
|
||||
if (tillTomorrow > 0) {
|
||||
return full;
|
||||
@@ -99,7 +99,7 @@ object_ptr<Ui::RpWidget> CreateGradientLabel(
|
||||
|
||||
std::move(
|
||||
text
|
||||
) | rpl::start_with_next([=](const QString &text) {
|
||||
) | rpl::on_next([=](const QString &text) {
|
||||
state->path = QPainterPath();
|
||||
const auto &font = st::groupCallCountdownFont;
|
||||
state->path.addText(0, font->ascent, font->f, text);
|
||||
@@ -116,7 +116,7 @@ object_ptr<Ui::RpWidget> CreateGradientLabel(
|
||||
}, raw->lifetime());
|
||||
|
||||
raw->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = QPainter(raw);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
const auto skip = st::groupCallWidth / 20;
|
||||
|
||||
@@ -105,15 +105,15 @@ object_ptr<RpWidget> VideoStreamStarsLevel(
|
||||
});
|
||||
return MakeStarSelectInfoBlocks(box, {
|
||||
{
|
||||
.title = std::move(pinTitle) | Text::ToWithEntities(),
|
||||
.title = std::move(pinTitle) | rpl::map(tr::marked),
|
||||
.subtext = tr::lng_paid_comment_pin_about(),
|
||||
},
|
||||
{
|
||||
.title = std::move(limitTitle) | Text::ToWithEntities(),
|
||||
.title = std::move(limitTitle) | rpl::map(tr::marked),
|
||||
.subtext = std::move(limitSubtext),
|
||||
},
|
||||
{
|
||||
.title = std::move(emojiTitle) | Text::ToWithEntities(),
|
||||
.title = std::move(emojiTitle) | rpl::map(tr::marked),
|
||||
.subtext = std::move(emojiSubtext),
|
||||
},
|
||||
}, {}, true);
|
||||
|
||||
@@ -147,14 +147,14 @@ Source::Source(
|
||||
, _activeRect(ImageRoundRadius::Large, st::groupCallMuted1)
|
||||
, _source(source) {
|
||||
_widget.paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
paint();
|
||||
}, _widget.lifetime());
|
||||
|
||||
_label.setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
_widget.sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
const auto padding = st::desktopCapturePadding;
|
||||
_label.resizeToNaturalWidth(
|
||||
size.width() - padding.left() - padding.right());
|
||||
@@ -237,7 +237,7 @@ void Source::paint() {
|
||||
void Source::setupPreview() {
|
||||
_preview = std::make_unique<Preview>(_source);
|
||||
_preview->track.renderNextFrame(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (_preview->track.frameSize().isEmpty()) {
|
||||
_preview->track.markFrameShown();
|
||||
}
|
||||
@@ -341,7 +341,7 @@ void ChooseSourceProcess::setupPanel() {
|
||||
_window->setStaysOnTop(true);
|
||||
|
||||
_window->body()->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
QPainter(_window->body()).fillRect(clip, st::groupCallMembersBg);
|
||||
}, _window->lifetime());
|
||||
|
||||
@@ -380,7 +380,7 @@ void ChooseSourceProcess::setupPanel() {
|
||||
_finish->widthValue(),
|
||||
_finish->shownValue(),
|
||||
cancel->widthValue()
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
int submitWidth,
|
||||
bool submitShown,
|
||||
int finishWidth,
|
||||
@@ -394,14 +394,14 @@ void ChooseSourceProcess::setupPanel() {
|
||||
}, _bottom->lifetime());
|
||||
|
||||
_withAudio->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
const auto top = (bottomHeight - _withAudio->heightNoMargins()) / 2;
|
||||
_withAudio->moveToLeft(bottomSkip, top);
|
||||
}, _withAudio->lifetime());
|
||||
|
||||
_withAudio->setChecked(_delegate->chooseSourceActiveWithAudio());
|
||||
_withAudio->checkedChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updateButtonsVisibility();
|
||||
}, _withAudio->lifetime());
|
||||
|
||||
@@ -410,7 +410,7 @@ void ChooseSourceProcess::setupPanel() {
|
||||
_submit->setVisible(!sharing);
|
||||
|
||||
_window->body()->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
_scroll->setGeometry(
|
||||
0,
|
||||
0,
|
||||
@@ -419,7 +419,7 @@ void ChooseSourceProcess::setupPanel() {
|
||||
}, _scroll->lifetime());
|
||||
|
||||
_scroll->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
const auto rows = int(std::ceil(_sources.size() / float(kColumns)));
|
||||
const auto innerHeight = margins.top()
|
||||
+ rows * st::desktopCaptureSourceSize.height()
|
||||
@@ -435,7 +435,7 @@ void ChooseSourceProcess::setupPanel() {
|
||||
_window->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||
return e->type() == QEvent::Close;
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
destroy();
|
||||
}, _window->lifetime());
|
||||
}
|
||||
@@ -481,7 +481,7 @@ void ChooseSourceProcess::fillSources() {
|
||||
_sources.back()->activations(
|
||||
) | rpl::filter([=] {
|
||||
return (_selected != raw);
|
||||
}) | rpl::start_with_next([=]{
|
||||
}) | rpl::on_next([=]{
|
||||
if (_selected) {
|
||||
_selected->setActive(false);
|
||||
}
|
||||
@@ -524,7 +524,7 @@ void ChooseSourceProcess::setupSourcesGeometry() {
|
||||
return;
|
||||
}
|
||||
_inner->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
const auto rows = int(std::ceil(_sources.size() / float(kColumns)));
|
||||
const auto margins = st::desktopCaptureMargins;
|
||||
const auto skips = st::desktopCaptureSourceSkips;
|
||||
@@ -554,7 +554,7 @@ void ChooseSourceProcess::setupSourcesGeometry() {
|
||||
rpl::combine(
|
||||
_scroll->scrollTopValue(),
|
||||
_scroll->heightValue()
|
||||
) | rpl::start_with_next([=](int scrollTop, int scrollHeight) {
|
||||
) | rpl::on_next([=](int scrollTop, int scrollHeight) {
|
||||
const auto rows = int(std::ceil(_sources.size() / float(kColumns)));
|
||||
const auto margins = st::desktopCaptureMargins;
|
||||
const auto skips = st::desktopCaptureSourceSkips;
|
||||
|
||||
@@ -116,7 +116,7 @@ Selector::Selector(
|
||||
const auto group = std::make_shared<Ui::RadiobuttonGroup>();
|
||||
std::move(
|
||||
chosen
|
||||
) | rpl::start_with_next([=](Webrtc::DeviceResolvedId id) {
|
||||
) | rpl::on_next([=](Webrtc::DeviceResolvedId id) {
|
||||
const auto value = id.isDefault() ? 0 : registerId(id.value);
|
||||
if (!group->hasValue() || group->current() != value) {
|
||||
group->setValue(value);
|
||||
@@ -138,7 +138,7 @@ Selector::Selector(
|
||||
|
||||
std::move(
|
||||
devices
|
||||
) | rpl::start_with_next([=](const std::vector<Webrtc::DeviceInfo> &v) {
|
||||
) | rpl::on_next([=](const std::vector<Webrtc::DeviceInfo> &v) {
|
||||
while (_list->count()) {
|
||||
delete _list->widgetAt(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user