2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Use different indentation for rpl operators.

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

View File

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