mirror of https://github.com/procxx/kepka.git
Allow empty arg list in rpl next/error handlers.
This commit is contained in:
parent
21b1ba1f88
commit
5cc7cb1d85
|
@ -288,7 +288,7 @@ void EditPrivacyBox::createWidgets() {
|
||||||
auto createExceptionLink = [this](Exception exception) {
|
auto createExceptionLink = [this](Exception exception) {
|
||||||
exceptionLink(exception).create(this, object_ptr<Ui::LinkButton>(this, exceptionLinkText(exception)), exceptionLinkMargins());
|
exceptionLink(exception).create(this, object_ptr<Ui::LinkButton>(this, exceptionLinkText(exception)), exceptionLinkMargins());
|
||||||
exceptionLink(exception)->heightValue()
|
exceptionLink(exception)->heightValue()
|
||||||
| rpl::start_with_next([this](int) {
|
| rpl::start_with_next([this] {
|
||||||
resizeToWidth(width());
|
resizeToWidth(width());
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
exceptionLink(exception)->entity()->setClickedCallback([this, exception] { editExceptionUsers(exception); });
|
exceptionLink(exception)->entity()->setClickedCallback([this, exception] { editExceptionUsers(exception); });
|
||||||
|
|
|
@ -129,7 +129,7 @@ void NotificationsBox::prepare() {
|
||||||
_countSlider->setActiveSectionFast(_oldCount - 1);
|
_countSlider->setActiveSectionFast(_oldCount - 1);
|
||||||
_countSlider->sectionActivated()
|
_countSlider->sectionActivated()
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](int) { countChanged(); },
|
[this] { countChanged(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
|
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
|
@ -52,7 +52,7 @@ void PeerListBox::createMultiSelect() {
|
||||||
_select.create(this, std::move(entity));
|
_select.create(this, std::move(entity));
|
||||||
_select->heightValue()
|
_select->heightValue()
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](int) { updateScrollSkips(); },
|
[this] { updateScrollSkips(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
_select->entity()->setSubmittedCallback([this](bool chtrlShiftEnter) { content()->submitted(); });
|
_select->entity()->setSubmittedCallback([this](bool chtrlShiftEnter) { content()->submitted(); });
|
||||||
_select->entity()->setQueryChangedCallback([this](const QString &query) { searchQueryChanged(query); });
|
_select->entity()->setQueryChangedCallback([this](const QString &query) { searchQueryChanged(query); });
|
||||||
|
|
|
@ -246,7 +246,7 @@ void StickersBox::prepare() {
|
||||||
setNoContentMargin(true);
|
setNoContentMargin(true);
|
||||||
_tabs->sectionActivated()
|
_tabs->sectionActivated()
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](int) { switchTab(); },
|
[this] { switchTab(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
refreshTabs();
|
refreshTabs();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ TabbedPanel::TabbedPanel(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_selector->showRequests()
|
_selector->showRequests()
|
||||||
| rpl::start_with_next([this](auto&&) {
|
| rpl::start_with_next([this] {
|
||||||
this->showFromSelector();
|
this->showFromSelector();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
|
|
|
@ -609,7 +609,7 @@ void TabbedSelector::createTabsSlider() {
|
||||||
_tabsSlider->setActiveSectionFast(static_cast<int>(_currentTabType));
|
_tabsSlider->setActiveSectionFast(static_cast<int>(_currentTabType));
|
||||||
_tabsSlider->sectionActivated()
|
_tabsSlider->sectionActivated()
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](int) { switchTab(); },
|
[this] { switchTab(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
|
|
||||||
_tabsSlider->resizeToWidth(width());
|
_tabsSlider->resizeToWidth(width());
|
||||||
|
|
|
@ -81,7 +81,7 @@ object_ptr<TopBar> LayerWrap::createTopBar() {
|
||||||
result.data(),
|
result.data(),
|
||||||
st::infoLayerTopBarClose));
|
st::infoLayerTopBarClose));
|
||||||
close->clicks()
|
close->clicks()
|
||||||
| rpl::start_with_next([this](auto&&) {
|
| rpl::start_with_next([this] {
|
||||||
_controller->hideSpecialLayer();
|
_controller->hideSpecialLayer();
|
||||||
}, close->lifetime());
|
}, close->lifetime());
|
||||||
result->setTitle(TitleValue(
|
result->setTitle(TitleValue(
|
||||||
|
|
|
@ -94,7 +94,7 @@ object_ptr<TopBar> NarrowWrap::createTopBar() {
|
||||||
st::infoLayerTopBar);
|
st::infoLayerTopBar);
|
||||||
result->enableBackButton(true);
|
result->enableBackButton(true);
|
||||||
result->backRequest()
|
result->backRequest()
|
||||||
| rpl::start_with_next([this](auto&&) {
|
| rpl::start_with_next([this] {
|
||||||
this->controller()->showBackFromStack();
|
this->controller()->showBackFromStack();
|
||||||
}, result->lifetime());
|
}, result->lifetime());
|
||||||
result->setTitle(TitleValue(
|
result->setTitle(TitleValue(
|
||||||
|
|
|
@ -58,7 +58,7 @@ void TopBar::pushButton(object_ptr<Ui::RpWidget> button) {
|
||||||
auto weak = Ui::AttachParentChild(this, button);
|
auto weak = Ui::AttachParentChild(this, button);
|
||||||
_buttons.push_back(std::move(button));
|
_buttons.push_back(std::move(button));
|
||||||
weak->widthValue()
|
weak->widthValue()
|
||||||
| rpl::start_with_next([this](auto&&) {
|
| rpl::start_with_next([this] {
|
||||||
this->updateControlsGeometry(this->width());
|
this->updateControlsGeometry(this->width());
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ Button *Button::toggleOn(rpl::producer<bool> &&toggled) {
|
||||||
false,
|
false,
|
||||||
[this] { rtlupdate(toggleRect()); });
|
[this] { rtlupdate(toggleRect()); });
|
||||||
clicks()
|
clicks()
|
||||||
| rpl::start_with_next([this](auto) {
|
| rpl::start_with_next([this] {
|
||||||
_toggle->setCheckedAnimated(!_toggle->checked());
|
_toggle->setCheckedAnimated(!_toggle->checked());
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
std::move(toggled)
|
std::move(toggled)
|
||||||
|
|
|
@ -254,16 +254,16 @@ void Cover::initViewers() {
|
||||||
using Flag = Notify::PeerUpdate::Flag;
|
using Flag = Notify::PeerUpdate::Flag;
|
||||||
PeerUpdateValue(_peer, Flag::PhotoChanged)
|
PeerUpdateValue(_peer, Flag::PhotoChanged)
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](auto&&) { this->refreshUserpicLink(); },
|
[this] { this->refreshUserpicLink(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
PeerUpdateValue(_peer, Flag::NameChanged)
|
PeerUpdateValue(_peer, Flag::NameChanged)
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](auto&&) { this->refreshNameText(); },
|
[this] { this->refreshNameText(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
PeerUpdateValue(_peer,
|
PeerUpdateValue(_peer,
|
||||||
Flag::UserOnlineChanged | Flag::MembersChanged)
|
Flag::UserOnlineChanged | Flag::MembersChanged)
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](auto&&) { this->refreshStatusText(); },
|
[this] { this->refreshStatusText(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ FloatingIcon::FloatingIcon(
|
||||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
parent->widthValue()
|
parent->widthValue()
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](auto&&) { moveToLeft(0, 0); },
|
[this] { moveToLeft(0, 0); },
|
||||||
lifetime());
|
lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupMuteToggle(
|
||||||
result->toggleOn(
|
result->toggleOn(
|
||||||
NotificationsEnabledValue(_peer)
|
NotificationsEnabledValue(_peer)
|
||||||
)->clicks()
|
)->clicks()
|
||||||
| rpl::start_with_next([this](auto) {
|
| rpl::start_with_next([this] {
|
||||||
App::main()->updateNotifySetting(
|
App::main()->updateNotifySetting(
|
||||||
_peer,
|
_peer,
|
||||||
_peer->isMuted()
|
_peer->isMuted()
|
||||||
|
@ -239,7 +239,7 @@ void InnerWidget::setupUserButtons(
|
||||||
_controller->historyPeer.value()
|
_controller->historyPeer.value()
|
||||||
| rpl::map($1 != user)
|
| rpl::map($1 != user)
|
||||||
)->entity()->clicks()
|
)->entity()->clicks()
|
||||||
| rpl::start_with_next([this, user](auto&&) {
|
| rpl::start_with_next([this, user] {
|
||||||
_controller->showPeerHistory(
|
_controller->showPeerHistory(
|
||||||
user,
|
user,
|
||||||
Ui::ShowWay::Forward);
|
Ui::ShowWay::Forward);
|
||||||
|
@ -250,7 +250,7 @@ void InnerWidget::setupUserButtons(
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
CanAddContactValue(user)
|
CanAddContactValue(user)
|
||||||
)->entity()->clicks()
|
)->entity()->clicks()
|
||||||
| rpl::start_with_next([user](auto&&) {
|
| rpl::start_with_next([user] {
|
||||||
auto firstName = user->firstName;
|
auto firstName = user->firstName;
|
||||||
auto lastName = user->lastName;
|
auto lastName = user->lastName;
|
||||||
auto phone = user->phone().isEmpty()
|
auto phone = user->phone().isEmpty()
|
||||||
|
@ -310,7 +310,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
||||||
return phrase(lt_count, count);
|
return phrase(lt_count, count);
|
||||||
}
|
}
|
||||||
)->entity()->clicks()
|
)->entity()->clicks()
|
||||||
| rpl::start_with_next([peer = _peer, type](auto&&) {
|
| rpl::start_with_next([peer = _peer, type] {
|
||||||
SharedMediaShowOverview(type, App::history(peer));
|
SharedMediaShowOverview(type, App::history(peer));
|
||||||
}, content->lifetime());
|
}, content->lifetime());
|
||||||
};
|
};
|
||||||
|
@ -321,7 +321,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
||||||
return lng_profile_common_groups(lt_count, count);
|
return lng_profile_common_groups(lt_count, count);
|
||||||
}
|
}
|
||||||
)->entity()->clicks()
|
)->entity()->clicks()
|
||||||
| rpl::start_with_next([peer = _peer](auto&&) {
|
| rpl::start_with_next([peer = _peer] {
|
||||||
App::main()->showSection(
|
App::main()->showSection(
|
||||||
::Profile::CommonGroups::SectionMemento(
|
::Profile::CommonGroups::SectionMemento(
|
||||||
peer->asUser()),
|
peer->asUser()),
|
||||||
|
@ -389,7 +389,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupUserActions(
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
std::move(toggleOn)
|
std::move(toggleOn)
|
||||||
)->entity()->clicks()
|
)->entity()->clicks()
|
||||||
| rpl::start_with_next([callback = std::move(callback)](auto&&) {
|
| rpl::start_with_next([callback = std::move(callback)] {
|
||||||
callback();
|
callback();
|
||||||
}, result->lifetime());
|
}, result->lifetime());
|
||||||
};
|
};
|
||||||
|
@ -432,7 +432,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupUserActions(
|
||||||
st::infoBlockButtonSkip));
|
st::infoBlockButtonSkip));
|
||||||
|
|
||||||
auto text = PeerUpdateValue(user, Notify::PeerUpdate::Flag::UserIsBlocked)
|
auto text = PeerUpdateValue(user, Notify::PeerUpdate::Flag::UserIsBlocked)
|
||||||
| rpl::map([user](auto&&) -> rpl::producer<QString> {
|
| rpl::map([user]() -> rpl::producer<QString> {
|
||||||
switch (user->blockStatus()) {
|
switch (user->blockStatus()) {
|
||||||
case UserData::BlockStatus::Blocked:
|
case UserData::BlockStatus::Blocked:
|
||||||
return Lang::Viewer(lng_profile_unblock_user);
|
return Lang::Viewer(lng_profile_unblock_user);
|
||||||
|
|
|
@ -118,7 +118,7 @@ void Members::setupButtons() {
|
||||||
}, _addMember->lifetime());
|
}, _addMember->lifetime());
|
||||||
_addMember->showOn(rpl::duplicate(addMemberShown));
|
_addMember->showOn(rpl::duplicate(addMemberShown));
|
||||||
_addMember->clicks() // TODO throttle(ripple duration)
|
_addMember->clicks() // TODO throttle(ripple duration)
|
||||||
| rpl::start_with_next([this](auto&&) {
|
| rpl::start_with_next([this] {
|
||||||
this->addMember();
|
this->addMember();
|
||||||
}, _addMember->lifetime());
|
}, _addMember->lifetime());
|
||||||
|
|
||||||
|
@ -128,18 +128,18 @@ void Members::setupButtons() {
|
||||||
| rpl::start_spawning(lifetime());
|
| rpl::start_spawning(lifetime());
|
||||||
_search->showOn(rpl::duplicate(searchShown));
|
_search->showOn(rpl::duplicate(searchShown));
|
||||||
_search->clicks()
|
_search->clicks()
|
||||||
| rpl::start_with_next([this](auto&&) {
|
| rpl::start_with_next([this] {
|
||||||
this->showSearch();
|
this->showSearch();
|
||||||
}, _search->lifetime());
|
}, _search->lifetime());
|
||||||
_cancelSearch->clicks()
|
_cancelSearch->clicks()
|
||||||
| rpl::start_with_next([this](auto&&) {
|
| rpl::start_with_next([this] {
|
||||||
this->cancelSearch();
|
this->cancelSearch();
|
||||||
}, _cancelSearch->lifetime());
|
}, _cancelSearch->lifetime());
|
||||||
|
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
std::move(addMemberShown),
|
std::move(addMemberShown),
|
||||||
std::move(searchShown))
|
std::move(searchShown))
|
||||||
| rpl::start_with_next([this](auto&&) {
|
| rpl::start_with_next([this] {
|
||||||
this->resizeToWidth(width());
|
this->resizeToWidth(width());
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ rpl::producer<TextWithEntities> PhoneValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
user,
|
user,
|
||||||
Notify::PeerUpdate::Flag::UserPhoneChanged)
|
Notify::PeerUpdate::Flag::UserPhoneChanged)
|
||||||
| rpl::map([user](auto&&) {
|
| rpl::map([user] {
|
||||||
return App::formatPhone(user->phone());
|
return App::formatPhone(user->phone());
|
||||||
})
|
})
|
||||||
| WithEmptyEntities();
|
| WithEmptyEntities();
|
||||||
|
@ -79,7 +79,7 @@ rpl::producer<TextWithEntities> BioValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
user,
|
user,
|
||||||
Notify::PeerUpdate::Flag::AboutChanged)
|
Notify::PeerUpdate::Flag::AboutChanged)
|
||||||
| rpl::map([user](auto&&) { return user->about(); })
|
| rpl::map([user] { return user->about(); })
|
||||||
| WithEmptyEntities();
|
| WithEmptyEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ rpl::producer<QString> PlainUsernameViewer(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
peer,
|
peer,
|
||||||
Notify::PeerUpdate::Flag::UsernameChanged)
|
Notify::PeerUpdate::Flag::UsernameChanged)
|
||||||
| rpl::map([peer](auto&&) {
|
| rpl::map([peer] {
|
||||||
return peer->userName();
|
return peer->userName();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ rpl::producer<TextWithEntities> AboutValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
channel,
|
channel,
|
||||||
Notify::PeerUpdate::Flag::AboutChanged)
|
Notify::PeerUpdate::Flag::AboutChanged)
|
||||||
| rpl::map([channel](auto&&) { return channel->about(); })
|
| rpl::map([channel] { return channel->about(); })
|
||||||
| WithEmptyEntities();
|
| WithEmptyEntities();
|
||||||
}
|
}
|
||||||
return rpl::single(TextWithEntities{});
|
return rpl::single(TextWithEntities{});
|
||||||
|
@ -132,7 +132,7 @@ rpl::producer<bool> NotificationsEnabledValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
peer,
|
peer,
|
||||||
Notify::PeerUpdate::Flag::NotificationsEnabled)
|
Notify::PeerUpdate::Flag::NotificationsEnabled)
|
||||||
| rpl::map([peer](auto&&) { return !peer->isMuted(); });
|
| rpl::map([peer] { return !peer->isMuted(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<bool> IsContactValue(
|
rpl::producer<bool> IsContactValue(
|
||||||
|
@ -140,7 +140,7 @@ rpl::producer<bool> IsContactValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
user,
|
user,
|
||||||
Notify::PeerUpdate::Flag::UserIsContact)
|
Notify::PeerUpdate::Flag::UserIsContact)
|
||||||
| rpl::map([user](auto&&) { return user->isContact(); });
|
| rpl::map([user] { return user->isContact(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<bool> CanShareContactValue(
|
rpl::producer<bool> CanShareContactValue(
|
||||||
|
@ -148,7 +148,7 @@ rpl::producer<bool> CanShareContactValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
user,
|
user,
|
||||||
Notify::PeerUpdate::Flag::UserCanShareContact)
|
Notify::PeerUpdate::Flag::UserCanShareContact)
|
||||||
| rpl::map([user](auto&&) {
|
| rpl::map([user] {
|
||||||
return user->canShareThisContact();
|
return user->canShareThisContact();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ rpl::producer<int> MembersCountValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
peer,
|
peer,
|
||||||
Notify::PeerUpdate::Flag::MembersChanged)
|
Notify::PeerUpdate::Flag::MembersChanged)
|
||||||
| rpl::map([chat](auto&&) {
|
| rpl::map([chat] {
|
||||||
return chat->amIn()
|
return chat->amIn()
|
||||||
? qMax(chat->count, chat->participants.size())
|
? qMax(chat->count, chat->participants.size())
|
||||||
: 0;
|
: 0;
|
||||||
|
@ -177,7 +177,7 @@ rpl::producer<int> MembersCountValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
peer,
|
peer,
|
||||||
Notify::PeerUpdate::Flag::MembersChanged)
|
Notify::PeerUpdate::Flag::MembersChanged)
|
||||||
| rpl::map([channel](auto &&) {
|
| rpl::map([channel] {
|
||||||
auto canViewCount = channel->canViewMembers()
|
auto canViewCount = channel->canViewMembers()
|
||||||
|| !channel->isMegagroup();
|
|| !channel->isMegagroup();
|
||||||
return canViewCount
|
return canViewCount
|
||||||
|
@ -215,7 +215,7 @@ rpl::producer<int> CommonGroupsCountValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
user,
|
user,
|
||||||
Notify::PeerUpdate::Flag::UserCommonChatsChanged)
|
Notify::PeerUpdate::Flag::UserCommonChatsChanged)
|
||||||
| rpl::map([user](auto&&) {
|
| rpl::map([user] {
|
||||||
return user->commonChatsCount();
|
return user->commonChatsCount();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -226,14 +226,14 @@ rpl::producer<bool> CanAddMemberValue(
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
chat,
|
chat,
|
||||||
Notify::PeerUpdate::Flag::ChatCanEdit)
|
Notify::PeerUpdate::Flag::ChatCanEdit)
|
||||||
| rpl::map([chat](auto&&) {
|
| rpl::map([chat] {
|
||||||
return chat->canEdit();
|
return chat->canEdit();
|
||||||
});
|
});
|
||||||
} else if (auto channel = peer->asChannel()) {
|
} else if (auto channel = peer->asChannel()) {
|
||||||
return PeerUpdateValue(
|
return PeerUpdateValue(
|
||||||
channel,
|
channel,
|
||||||
Notify::PeerUpdate::Flag::ChannelRightsChanged)
|
Notify::PeerUpdate::Flag::ChannelRightsChanged)
|
||||||
| rpl::map([channel](auto&&) {
|
| rpl::map([channel] {
|
||||||
return channel->canAddMembers();
|
return channel->canAddMembers();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -504,7 +504,7 @@ rpl::producer<QString> Viewer(LangKey key) {
|
||||||
rpl::single(Current().getValue(key))
|
rpl::single(Current().getValue(key))
|
||||||
| then(
|
| then(
|
||||||
base::ObservableViewer(Current().updated())
|
base::ObservableViewer(Current().updated())
|
||||||
| rpl::map([=](auto&&) {
|
| rpl::map([=] {
|
||||||
return Current().getValue(key);
|
return Current().getValue(key);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1847,7 +1847,7 @@ void MainWidget::createPlayer() {
|
||||||
_player.create(this);
|
_player.create(this);
|
||||||
_player->heightValue()
|
_player->heightValue()
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](int) { playerHeightUpdated(); },
|
[this] { playerHeightUpdated(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
_player->entity()->setCloseCallback([this] { closeBothPlayers(); });
|
_player->entity()->setCloseCallback([this] { closeBothPlayers(); });
|
||||||
_playerVolume.create(this);
|
_playerVolume.create(this);
|
||||||
|
|
|
@ -91,31 +91,62 @@ struct is_callable<Method>
|
||||||
template <typename Method, typename Arg>
|
template <typename Method, typename Arg>
|
||||||
struct is_callable<Method, Arg>
|
struct is_callable<Method, Arg>
|
||||||
: std::bool_constant<
|
: std::bool_constant<
|
||||||
is_callable_plain_v<Method, Arg>
|
is_callable_plain_v<Method, Arg> ||
|
||||||
|| is_callable_tuple_v<Method, Arg>> {
|
is_callable_tuple_v<Method, Arg> ||
|
||||||
|
is_callable_plain_v<Method>> {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Method, typename ...Args>
|
template <typename Method, typename ...Args>
|
||||||
constexpr bool is_callable_v = is_callable<Method, Args...>::value;
|
constexpr bool is_callable_v = is_callable<Method, Args...>::value;
|
||||||
|
|
||||||
|
enum class CallableArgTag {
|
||||||
|
Plain,
|
||||||
|
Tuple,
|
||||||
|
Empty,
|
||||||
|
};
|
||||||
|
template <CallableArgTag Arg>
|
||||||
|
using callable_arg_tag = std::integral_constant<CallableArgTag, Arg>;
|
||||||
|
|
||||||
template <typename Method, typename Arg>
|
template <typename Method, typename Arg>
|
||||||
inline decltype(auto) callable_helper(Method &&method, Arg &&arg, std::true_type) {
|
inline decltype(auto) callable_helper(
|
||||||
|
Method &&method,
|
||||||
|
Arg &&arg,
|
||||||
|
callable_arg_tag<CallableArgTag::Plain>) {
|
||||||
return std::forward<Method>(method)(std::forward<Arg>(arg));
|
return std::forward<Method>(method)(std::forward<Arg>(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Method, typename Arg>
|
template <typename Method, typename Arg>
|
||||||
inline decltype(auto) callable_helper(Method &&method, Arg &&arg, std::false_type) {
|
inline decltype(auto) callable_helper(
|
||||||
|
Method &&method,
|
||||||
|
Arg &&arg,
|
||||||
|
callable_arg_tag<CallableArgTag::Tuple>) {
|
||||||
return std::apply(
|
return std::apply(
|
||||||
std::forward<Method>(method),
|
std::forward<Method>(method),
|
||||||
std::forward<Arg>(arg));
|
std::forward<Arg>(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Method, typename Arg>
|
||||||
|
inline decltype(auto) callable_helper(
|
||||||
|
Method &&method,
|
||||||
|
Arg &&,
|
||||||
|
callable_arg_tag<CallableArgTag::Empty>) {
|
||||||
|
return std::forward<Method>(method)();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Method, typename Arg>
|
template <typename Method, typename Arg>
|
||||||
inline decltype(auto) callable_invoke(Method &&method, Arg &&arg) {
|
inline decltype(auto) callable_invoke(Method &&method, Arg &&arg) {
|
||||||
|
// #TODO if constexpr
|
||||||
|
constexpr auto kTag = is_callable_plain_v<Method, Arg>
|
||||||
|
? CallableArgTag::Plain
|
||||||
|
: is_callable_tuple_v<Method, Arg>
|
||||||
|
? CallableArgTag::Tuple
|
||||||
|
: is_callable_v<Method>
|
||||||
|
? CallableArgTag::Empty
|
||||||
|
: throw "Bad callable_invoke instance.";
|
||||||
return callable_helper(
|
return callable_helper(
|
||||||
std::forward<Method>(method),
|
std::forward<Method>(method),
|
||||||
std::forward<Arg>(arg),
|
std::forward<Arg>(arg),
|
||||||
is_callable_plain<Method, Arg>());
|
callable_arg_tag<kTag>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Method, typename Arg>
|
template <typename Method, typename Arg>
|
||||||
|
|
|
@ -62,7 +62,7 @@ void ScaleWidget::createControls() {
|
||||||
_scale->setActiveSectionFast(cEvalScale(cConfigScale()) - 1);
|
_scale->setActiveSectionFast(cEvalScale(cConfigScale()) - 1);
|
||||||
_scale->sectionActivated()
|
_scale->sectionActivated()
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](int) { scaleChanged(); },
|
[this] { scaleChanged(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ RpWidget *VerticalLayout::addChild(
|
||||||
width() - margins.left() - margins.right(),
|
width() - margins.left() - margins.right(),
|
||||||
height() - margins.top() - margins.bottom());
|
height() - margins.top() - margins.bottom());
|
||||||
weak->heightValue()
|
weak->heightValue()
|
||||||
| rpl::start_with_next_done([this, weak](int) {
|
| rpl::start_with_next_done([this, weak] {
|
||||||
childHeightUpdated(weak);
|
childHeightUpdated(weak);
|
||||||
}, [this, weak] {
|
}, [this, weak] {
|
||||||
removeChild(weak);
|
removeChild(weak);
|
||||||
|
|
|
@ -119,7 +119,7 @@ TopBarWidget::TopBarWidget(
|
||||||
Auth().data().thirdSectionInfoEnabledValue(),
|
Auth().data().thirdSectionInfoEnabledValue(),
|
||||||
Auth().data().tabbedReplacedWithInfoValue())
|
Auth().data().tabbedReplacedWithInfoValue())
|
||||||
| rpl::start_with_next(
|
| rpl::start_with_next(
|
||||||
[this](auto&&) { updateInfoToggleActive(); },
|
[this] { updateInfoToggleActive(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
|
|
||||||
setCursor(style::cur_pointer);
|
setCursor(style::cur_pointer);
|
||||||
|
|
Loading…
Reference in New Issue