diff --git a/Telegram/SourceFiles/api/api_authorizations.cpp b/Telegram/SourceFiles/api/api_authorizations.cpp index e690c618f..4d2f93fcc 100644 --- a/Telegram/SourceFiles/api/api_authorizations.cpp +++ b/Telegram/SourceFiles/api/api_authorizations.cpp @@ -107,7 +107,7 @@ void Authorizations::reload() { result.match([&](const MTPDaccount_authorizations &auths) { _list = ( auths.vauthorizations().v - ) | ranges::view::transform([](const MTPAuthorization &d) { + ) | ranges::views::transform([](const MTPAuthorization &d) { return ParseEntry(d.c_authorization()); }) | ranges::to; _listChanges.fire({}); diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index e465ec4bc..ef434f50b 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -906,7 +906,7 @@ void ApiWrap::updateDialogsOffset( auto lastDate = TimeId(0); auto lastPeer = PeerId(0); auto lastMsgId = MsgId(0); - for (const auto &dialog : ranges::view::reverse(dialogs)) { + for (const auto &dialog : ranges::views::reverse(dialogs)) { dialog.match([&](const auto &dialog) { const auto peer = peerFromMTP(dialog.vpeer()); const auto messageId = dialog.vtop_message().v; @@ -919,7 +919,7 @@ void ApiWrap::updateDialogsOffset( if (!lastMsgId) { lastMsgId = messageId; } - for (const auto &message : ranges::view::reverse(messages)) { + for (const auto &message : ranges::views::reverse(messages)) { if (IdFromMessage(message) == messageId && PeerFromMessage(message) == peer) { if (const auto date = DateFromMessage(message)) { diff --git a/Telegram/SourceFiles/boxes/auto_download_box.cpp b/Telegram/SourceFiles/boxes/auto_download_box.cpp index 85e0e5fd5..2908405a2 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_download_box.cpp @@ -158,15 +158,15 @@ void AutoDownloadBox::setupContent() { }; addButton(tr::lng_connection_save(), [=] { - auto &&values = ranges::view::concat( + auto &&values = ranges::views::concat( *downloadValues, *autoPlayValues); - auto allowMore = values | ranges::view::filter([&](Pair pair) { + auto allowMore = values | ranges::views::filter([&](Pair pair) { const auto [type, enabled] = pair; const auto value = enabled ? limitByType(type) : 0; const auto old = settings->bytesLimit(_source, type); return (old < value); - }) | ranges::view::transform([](Pair pair) { + }) | ranges::views::transform([](Pair pair) { return pair.first; }); const auto less = ranges::any_of(*autoPlayValues, [&](Pair pair) { diff --git a/Telegram/SourceFiles/boxes/background_box.cpp b/Telegram/SourceFiles/boxes/background_box.cpp index 3de10653c..3df6df80a 100644 --- a/Telegram/SourceFiles/boxes/background_box.cpp +++ b/Telegram/SourceFiles/boxes/background_box.cpp @@ -248,9 +248,9 @@ void BackgroundBox::Inner::updatePapers() { _over = _overDown = Selection(); _papers = _session->data().wallpapers( - ) | ranges::view::filter([](const Data::WallPaper &paper) { + ) | ranges::views::filter([](const Data::WallPaper &paper) { return !paper.isPattern() || paper.backgroundColor().has_value(); - }) | ranges::view::transform([](const Data::WallPaper &paper) { + }) | ranges::views::transform([](const Data::WallPaper &paper) { return Paper{ paper }; }) | ranges::to_vector; sortPapers(); @@ -268,7 +268,7 @@ void BackgroundBox::Inner::resizeToContentAndPreload() { + st::backgroundPadding)); const auto preload = kBackgroundsInRow * 3; - for (const auto &paper : _papers | ranges::view::take(preload)) { + for (const auto &paper : _papers | ranges::views::take(preload)) { if (!paper.data.localThumbnail() && !paper.dataMedia) { if (const auto document = paper.data.document()) { paper.dataMedia = document->createMediaView(); diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index 423f0ee23..a0d08a23c 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -762,11 +762,11 @@ auto DeleteMessagesBox::revokeText(not_null peer) const return result; } - const auto items = ranges::view::all( + const auto items = ranges::views::all( _ids - ) | ranges::view::transform([&](FullMsgId id) { + ) | ranges::views::transform([&](FullMsgId id) { return peer->owner().message(id); - }) | ranges::view::filter([](HistoryItem *item) { + }) | ranges::views::filter([](HistoryItem *item) { return (item != nullptr); }) | ranges::to_vector; @@ -783,7 +783,7 @@ auto DeleteMessagesBox::revokeText(not_null peer) const return !item->canDeleteForEveryone(now); }; const auto canRevokeAll = ranges::none_of(items, cannotRevoke); - auto outgoing = items | ranges::view::filter(&HistoryItem::out); + auto outgoing = items | ranges::views::filter(&HistoryItem::out); const auto canRevokeOutgoingCount = canRevokeAll ? -1 : ranges::count_if(outgoing, canRevoke); diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 7423a3715..18f1dcc61 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -1051,9 +1051,9 @@ void ProxyBox::addLabel( ProxiesBoxController::ProxiesBoxController(not_null account) : _account(account) , _saveTimer([] { Local::writeSettings(); }) { - _list = ranges::view::all( + _list = ranges::views::all( Global::ProxiesList() - ) | ranges::view::transform([&](const ProxyData &proxy) { + ) | ranges::views::transform([&](const ProxyData &proxy) { return Item{ ++_idCounter, proxy }; }) | ranges::to_vector; diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index 7bd2ba965..c72618cea 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -536,8 +536,8 @@ std::vector Options::toPollAnswers() const { }; ranges::copy( _list - | ranges::view::filter(&Option::isGood) - | ranges::view::transform(makeAnswer), + | ranges::views::filter(&Option::isGood) + | ranges::views::transform(makeAnswer), ranges::back_inserter(result)); return result; } @@ -593,7 +593,7 @@ void Options::removeEmptyTail() { _list, &Option::hasFocus); const auto end = _list.end(); - const auto reversed = ranges::view::reverse(_list); + const auto reversed = ranges::views::reverse(_list); const auto emptyItem = ranges::find_if( reversed, ranges::not_fn(&Option::isEmpty)).base(); diff --git a/Telegram/SourceFiles/boxes/filters/edit_filter_box.cpp b/Telegram/SourceFiles/boxes/filters/edit_filter_box.cpp index 91c800534..ec546d184 100644 --- a/Telegram/SourceFiles/boxes/filters/edit_filter_box.cpp +++ b/Telegram/SourceFiles/boxes/filters/edit_filter_box.cpp @@ -333,9 +333,9 @@ void EditExceptions( box->addButton(tr::lng_settings_save(), crl::guard(context, [=] { const auto peers = box->collectSelectedRows(); const auto rules = data->current(); - auto &&histories = ranges::view::all( + auto &&histories = ranges::views::all( peers - ) | ranges::view::transform([=](not_null peer) { + ) | ranges::views::transform([=](not_null peer) { return window->session().data().history(peer); }); auto changed = base::flat_set>{ diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index 80d7dc7f4..87ad7c289 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -424,11 +424,11 @@ void Rows::remove(not_null row) { void Rows::restore(not_null row) { row->removed = false; - Local::saveRecentLanguages(ranges::view::all( + Local::saveRecentLanguages(ranges::views::all( _rows - ) | ranges::view::filter([](const Row &row) { + ) | ranges::views::filter([](const Row &row) { return !row.removed; - }) | ranges::view::transform([](const Row &row) { + }) | ranges::views::transform([](const Row &row) { return row.data; }) | ranges::to_vector); } diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp index fc00d47aa..4a37d1b93 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp @@ -219,9 +219,9 @@ bool AddParticipantsBoxController::inviteSelectedUsers( Expects(_peer != nullptr); const auto rows = box->collectSelectedRows(); - const auto users = ranges::view::all( + const auto users = ranges::views::all( rows - ) | ranges::view::transform([](not_null peer) { + ) | ranges::views::transform([](not_null peer) { Expects(peer->isUser()); Expects(!peer->isSelf()); diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index 5ca87bd85..6ec9063d3 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -1196,7 +1196,7 @@ void ParticipantsBoxController::rebuildChatAdmins( return; } - auto list = ranges::view::all(chat->admins) | ranges::to_vector; + auto list = ranges::views::all(chat->admins) | ranges::to_vector; if (const auto creator = chat->owner().userLoaded(chat->creator)) { list.emplace_back(creator); } diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index 041ae00e5..cc4662345 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -920,7 +920,7 @@ void SendFilesBox::updateControlsGeometry() { _groupFiles.data(), _sendImagesAsPhotos.data(), }; - for (const auto pointer : ranges::view::reverse(pointers)) { + for (const auto pointer : ranges::views::reverse(pointers)) { if (pointer && !pointer->isHidden()) { pointer->moveToLeft( st::boxPhotoPadding.left(), diff --git a/Telegram/SourceFiles/boxes/single_choice_box.cpp b/Telegram/SourceFiles/boxes/single_choice_box.cpp index ec26c105a..af788ecf6 100644 --- a/Telegram/SourceFiles/boxes/single_choice_box.cpp +++ b/Telegram/SourceFiles/boxes/single_choice_box.cpp @@ -30,8 +30,8 @@ void SingleChoiceBox( layout->add(object_ptr( layout, st::boxOptionListPadding.top() + st::autolockButton.margin.top())); - auto &&ints = ranges::view::ints(0, ranges::unreachable); - for (const auto &[i, text] : ranges::view::zip(ints, args.options)) { + auto &&ints = ranges::views::ints(0, ranges::unreachable); + for (const auto &[i, text] : ranges::views::zip(ints, args.options)) { layout->add( object_ptr( layout, diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index a0f163a40..f244fe0c7 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -632,9 +632,9 @@ bool Call::handleSignalingData( if (data.vphone_call_id().v != _id || !_instance) { return false; } - auto prepared = ranges::view::all( + auto prepared = ranges::views::all( data.vdata().v - ) | ranges::view::transform([](char byte) { + ) | ranges::views::transform([](char byte) { return static_cast(byte); }) | ranges::to_vector; _instance->receiveSignalingData(std::move(prepared)); diff --git a/Telegram/SourceFiles/calls/calls_controller_webrtc.cpp b/Telegram/SourceFiles/calls/calls_controller_webrtc.cpp index f29b06853..6df83c2d5 100644 --- a/Telegram/SourceFiles/calls/calls_controller_webrtc.cpp +++ b/Telegram/SourceFiles/calls/calls_controller_webrtc.cpp @@ -51,9 +51,9 @@ using namespace Webrtc; encryptionKey.value.size()), .outgoing = encryptionKey.isOutgoing, .primary = ConvertEndpoint(endpoints.front()), - .alternatives = endpoints | ranges::view::drop( + .alternatives = endpoints | ranges::views::drop( 1 - ) | ranges::view::transform(ConvertEndpoint) | ranges::to_vector, + ) | ranges::views::transform(ConvertEndpoint) | ranges::to_vector, .maxLayer = config.maxApiLayer, .allowP2P = config.enableP2P, .sendSignalingData = std::move(sendSignalingData), diff --git a/Telegram/SourceFiles/calls/calls_group_call.cpp b/Telegram/SourceFiles/calls/calls_group_call.cpp index b38670d4d..8d39ec9a5 100644 --- a/Telegram/SourceFiles/calls/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/calls_group_call.cpp @@ -1437,7 +1437,7 @@ std::variant> GroupCall::inviteUsers( const auto owner = &_peer->owner(); const auto &invited = owner->invitedToCallUsers(_id); const auto &participants = real->participants(); - auto &&toInvite = users | ranges::view::filter([&]( + auto &&toInvite = users | ranges::views::filter([&]( not_null user) { return !invited.contains(user) && !ranges::contains( participants, diff --git a/Telegram/SourceFiles/calls/calls_group_panel.cpp b/Telegram/SourceFiles/calls/calls_group_panel.cpp index 5d1dd7ac1..0b27e91ae 100644 --- a/Telegram/SourceFiles/calls/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_group_panel.cpp @@ -837,15 +837,15 @@ void GroupPanel::addMembers() { box->addButton(tr::lng_group_call_invite_button(), [=] { const auto rows = box->collectSelectedRows(); - const auto users = ranges::view::all( + const auto users = ranges::views::all( rows - ) | ranges::view::transform([](not_null peer) { + ) | ranges::views::transform([](not_null peer) { return not_null(peer->asUser()); }) | ranges::to_vector; - const auto nonMembers = ranges::view::all( + const auto nonMembers = ranges::views::all( users - ) | ranges::view::filter([&](not_null user) { + ) | ranges::views::filter([&](not_null user) { return !controller->hasRowFor(user); }) | ranges::to_vector; diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp index 206a5c0f0..692535903 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp @@ -179,16 +179,16 @@ void AppendFoundEmoji( const auto alreadyBegin = begin(result); const auto alreadyEnd = alreadyBegin + result.size(); - auto &&add = ranges::view::all( + auto &&add = ranges::views::all( list - ) | ranges::view::filter([&](const LangPackEmoji &entry) { + ) | ranges::views::filter([&](const LangPackEmoji &entry) { const auto i = ranges::find( alreadyBegin, alreadyEnd, entry.emoji, &Result::emoji); return (i == alreadyEnd); - }) | ranges::view::transform([&](const LangPackEmoji &entry) { + }) | ranges::views::transform([&](const LangPackEmoji &entry) { return Result{ entry.emoji, label, entry.text }; }); result.insert(end(result), add.begin(), add.end()); @@ -216,15 +216,15 @@ void AppendLegacySuggestions( const auto alreadyBegin = begin(result); const auto alreadyEnd = alreadyBegin + result.size(); - auto &&add = ranges::view::all( + auto &&add = ranges::views::all( suggestions - ) | ranges::view::transform([](const Suggestion &suggestion) { + ) | ranges::views::transform([](const Suggestion &suggestion) { return Result{ Find(QStringFromUTF16(suggestion.emoji())), QStringFromUTF16(suggestion.label()), QStringFromUTF16(suggestion.replacement()) }; - }) | ranges::view::filter([&](const Result &entry) { + }) | ranges::views::filter([&](const Result &entry) { const auto i = entry.emoji ? ranges::find( alreadyBegin, @@ -250,15 +250,15 @@ void ApplyDifference( return; } auto &list = data.emoji[word]; - auto &&emoji = ranges::view::all( + auto &&emoji = ranges::views::all( keyword.vemoticons().v - ) | ranges::view::transform([](const MTPstring &string) { + ) | ranges::views::transform([](const MTPstring &string) { const auto text = qs(string); const auto emoji = MustAddPostfix(text) ? (text + QChar(Ui::Emoji::kPostfix)) : text; return LangPackEmoji{ FindExact(emoji), text }; - }) | ranges::view::filter([&](const LangPackEmoji &entry) { + }) | ranges::views::filter([&](const LangPackEmoji &entry) { if (!entry.emoji) { LOG(("API Warning: emoji %1 is not supported, word: %2." ).arg( @@ -291,9 +291,9 @@ void ApplyDifference( if (data.emoji.empty()) { data.maxKeyLength = 0; } else { - auto &&lengths = ranges::view::all( + auto &&lengths = ranges::views::all( data.emoji - ) | ranges::view::transform([](auto &&pair) { + ) | ranges::views::transform([](auto &&pair) { return pair.first.size(); }); data.maxKeyLength = *ranges::max_element(lengths); @@ -480,7 +480,7 @@ std::vector EmojiKeywords::LangPack::query( auto &&chosen = ranges::make_subrange( from, end(_data.emoji) - ) | ranges::view::take_while([&](const auto &pair) { + ) | ranges::views::take_while([&](const auto &pair) { const auto &key = pair.first; return exact ? (key == normalized) : key.startsWith(normalized); }); @@ -619,9 +619,9 @@ std::vector EmojiKeywords::query( const auto alreadyBegin = begin(result); const auto alreadyEnd = alreadyBegin + result.size(); - auto &&add = ranges::view::all( + auto &&add = ranges::views::all( list - ) | ranges::view::filter([&](Result entry) { + ) | ranges::views::filter([&](Result entry) { // In each item->query() result the list has no duplicates. // So we need to check only for duplicates between queries. const auto i = ranges::find( @@ -643,7 +643,7 @@ int EmojiKeywords::maxQueryLength() const { if (_data.empty()) { return 0; } - auto &&lengths = _data | ranges::view::transform([](const auto &pair) { + auto &&lengths = _data | ranges::views::transform([](const auto &pair) { return pair.second->maxQueryLength(); }); return *ranges::max_element(lengths); @@ -663,9 +663,9 @@ void EmojiKeywords::refreshRemoteList() { _langsRequestId = _api->request(MTPmessages_GetEmojiKeywordsLanguages( MTP_vector(languages) )).done([=](const MTPVector &result) { - setRemoteList(ranges::view::all( + setRemoteList(ranges::views::all( result.v - ) | ranges::view::transform([](const MTPEmojiLanguage &language) { + ) | ranges::views::transform([](const MTPEmojiLanguage &language) { return language.match([&](const MTPDemojiLanguage &language) { return qs(language.vlang_code()); }); diff --git a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp index 2fc1331c2..ddd25a5d7 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp @@ -246,7 +246,7 @@ void Row::paintPreview(Painter &p) const { const auto y = st::manageEmojiPreviewPadding.top(); const auto width = st::manageEmojiPreviewWidth; const auto height = st::manageEmojiPreviewWidth; - auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0, int(_preview.size()))); + auto &&preview = ranges::views::zip(_preview, ranges::views::ints(0, int(_preview.size()))); for (const auto &[pixmap, index] : preview) { const auto row = (index / 2); const auto column = (index % 2); @@ -454,7 +454,7 @@ void Row::setupPreview(const Set &set) { const auto size = st::manageEmojiPreview * cIntRetinaFactor(); const auto original = QImage(set.previewPath); const auto full = original.height(); - auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0, int(_preview.size()))); + auto &&preview = ranges::views::zip(_preview, ranges::views::ints(0, int(_preview.size()))); for (auto &&[pixmap, index] : preview) { pixmap = App::pixmapFromImageInPlace(original.copy( { full * index, 0, full, full } diff --git a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp index d96472682..09cb1224d 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp @@ -109,9 +109,9 @@ auto SuggestionsWidget::getRowsByQuery() const -> std::vector { return {}; } using Entry = ChatHelpers::EmojiKeywords::Result; - auto result = ranges::view::all( + auto result = ranges::views::all( list - ) | ranges::view::transform([](const Entry &result) { + ) | ranges::views::transform([](const Entry &result) { return Row(result.emoji, result.replacement); }) | ranges::to_vector; diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index 2a29c7188..0e5f123ec 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -308,9 +308,9 @@ FieldAutocomplete::StickerRows FieldAutocomplete::getStickerSuggestions() { _emoji, _stickersSeed ); - auto result = ranges::view::all( + auto result = ranges::views::all( list - ) | ranges::view::transform([](not_null sticker) { + ) | ranges::views::transform([](not_null sticker) { return StickerSuggestion{ sticker, sticker->createMediaView() diff --git a/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp b/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp index 1daf71ebe..782618dc4 100644 --- a/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp +++ b/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp @@ -178,7 +178,7 @@ void DownloadDictionaryInBackground( } void AddExceptions() { - const auto exceptions = ranges::view::all( + const auto exceptions = ranges::views::all( kExceptions ) | ranges::views::transform([](const auto &word) { return word.utf16(); @@ -326,7 +326,7 @@ rpl::producer ButtonManageDictsState( return QString(); } const auto dicts = Core::App().settings().dictionariesEnabled(); - const auto filtered = ranges::view::all( + const auto filtered = ranges::views::all( dicts ) | ranges::views::filter( DictionaryExists diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 547890288..d7b478995 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -201,9 +201,9 @@ private: auto StickersListWidget::PrepareStickers( const QVector &pack) -> std::vector { - return ranges::view::all( + return ranges::views::all( pack - ) | ranges::view::transform([](DocumentData *document) { + ) | ranges::views::transform([](DocumentData *document) { return Sticker{ document }; }) | ranges::to_vector; } diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index b59887976..f2ba8b879 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -372,9 +372,9 @@ void Manager::fillDefaults() { set(qsl("ctrl+4"), Command::ChatPinned4); set(qsl("ctrl+5"), Command::ChatPinned5); - auto &&folders = ranges::view::zip( + auto &&folders = ranges::views::zip( kShowFolder, - ranges::view::ints(1, ranges::unreachable)); + ranges::views::ints(1, ranges::unreachable)); for (const auto [command, index] : folders) { set(qsl("%1+%2").arg(ctrl).arg(index), command); diff --git a/Telegram/SourceFiles/data/data_auto_download.cpp b/Telegram/SourceFiles/data/data_auto_download.cpp index a18734111..3e6ad0f13 100644 --- a/Telegram/SourceFiles/data/data_auto_download.cpp +++ b/Telegram/SourceFiles/data/data_auto_download.cpp @@ -24,7 +24,7 @@ constexpr auto kVersion = char(2); template auto enums_view(int from, int till) { - using namespace ranges::view; + using namespace ranges::views; return ints(from, till) | transform([](int index) { return static_cast(index); }); diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index f6d0454ea..84f607747 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -902,7 +902,7 @@ void ApplyMegagroupAdmins( auto adding = base::flat_map(); auto admins = ranges::make_subrange( list.begin(), list.end() - ) | ranges::view::transform([](const MTPChannelParticipant &p) { + ) | ranges::views::transform([](const MTPChannelParticipant &p) { const auto userId = p.match([](const auto &data) { return data.vuser_id().v; }); diff --git a/Telegram/SourceFiles/data/data_chat_filters.cpp b/Telegram/SourceFiles/data/data_chat_filters.cpp index cf62f5dc4..47e234837 100644 --- a/Telegram/SourceFiles/data/data_chat_filters.cpp +++ b/Telegram/SourceFiles/data/data_chat_filters.cpp @@ -58,7 +58,7 @@ ChatFilter ChatFilter::FromTL( | (data.is_exclude_muted() ? Flag::NoMuted : Flag(0)) | (data.is_exclude_read() ? Flag::NoRead : Flag(0)) | (data.is_exclude_archived() ? Flag::NoArchived : Flag(0)); - auto &&to_histories = ranges::view::transform([&]( + auto &&to_histories = ranges::views::transform([&]( const MTPInputPeer &data) { const auto peer = data.match([&](const MTPDinputPeerUser &data) { const auto user = owner->user(data.vuser_id().v); @@ -76,21 +76,21 @@ ChatFilter ChatFilter::FromTL( return (PeerData*)nullptr; }); return peer ? owner->history(peer).get() : nullptr; - }) | ranges::view::filter([](History *history) { + }) | ranges::views::filter([](History *history) { return history != nullptr; - }) | ranges::view::transform([](History *history) { + }) | ranges::views::transform([](History *history) { return not_null(history); }); - auto &&always = ranges::view::concat( + auto &&always = ranges::views::concat( data.vinclude_peers().v ) | to_histories; - auto pinned = ranges::view::all( + auto pinned = ranges::views::all( data.vpinned_peers().v ) | to_histories | ranges::to_vector; - auto &&never = ranges::view::all( + auto &&never = ranges::views::all( data.vexclude_peers().v ) | to_histories; - auto &&all = ranges::view::concat(always, pinned); + auto &&all = ranges::views::concat(always, pinned); auto list = base::flat_set>{ all.begin(), all.end() @@ -411,9 +411,9 @@ bool ChatFilters::applyOrder(const QVector &order) { } else if (_list.empty()) { return true; } - auto indices = ranges::view::all( + auto indices = ranges::views::all( _list - ) | ranges::view::transform( + ) | ranges::views::transform( &ChatFilter::id ) | ranges::to_vector; auto b = indices.begin(), e = indices.end(); @@ -582,9 +582,9 @@ void ChatFilters::requestSuggested() { _suggestedRequestId = 0; _suggestedLastReceived = crl::now(); - _suggested = ranges::view::all( + _suggested = ranges::views::all( data.v - ) | ranges::view::transform([&](const MTPDialogFilterSuggested &f) { + ) | ranges::views::transform([&](const MTPDialogFilterSuggested &f) { return f.match([&](const MTPDdialogFilterSuggested &data) { return SuggestedFilter{ Data::ChatFilter::FromTL(data.vfilter(), _owner), diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 472faf74d..5c1d9c049 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -1649,7 +1649,7 @@ void DocumentData::collectLocalData(not_null local) { namespace Data { QString FileExtension(const QString &filepath) { - const auto reversed = ranges::view::reverse(filepath); + const auto reversed = ranges::views::reverse(filepath); const auto last = ranges::find_first_of(reversed, ".\\/"); if (last == reversed.end() || *last != '.') { return QString(); diff --git a/Telegram/SourceFiles/data/data_folder.cpp b/Telegram/SourceFiles/data/data_folder.cpp index 20792a643..cbab84508 100644 --- a/Telegram/SourceFiles/data/data_folder.cpp +++ b/Telegram/SourceFiles/data/data_folder.cpp @@ -156,9 +156,9 @@ bool Folder::applyChatListMessage(HistoryItem *item) { } void Folder::computeChatListMessage() { - auto &&items = ranges::view::all( + auto &&items = ranges::views::all( *_chatsList.indexed() - ) | ranges::view::filter([](not_null row) { + ) | ranges::views::filter([](not_null row) { return row->entry()->chatListMessage() != nullptr; }); const auto chatListDate = [](not_null row) { @@ -187,13 +187,13 @@ void Folder::reorderLastHistories() { }; _lastHistories.erase(_lastHistories.begin(), _lastHistories.end()); _lastHistories.reserve(kShowChatNamesCount + 1); - auto &&histories = ranges::view::all( + auto &&histories = ranges::views::all( *_chatsList.indexed() - ) | ranges::view::transform([](not_null row) { + ) | ranges::views::transform([](not_null row) { return row->history(); - }) | ranges::view::filter([](History *history) { + }) | ranges::views::filter([](History *history) { return (history != nullptr); - }) | ranges::view::transform([](History *history) { + }) | ranges::views::transform([](History *history) { return not_null(history); }); for (const auto history : histories) { diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index 03d0666c6..700656589 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -305,11 +305,11 @@ void Histories::sendDialogRequests() { if (_dialogRequestsPending.empty()) { return; } - const auto histories = ranges::view::all( + const auto histories = ranges::views::all( _dialogRequestsPending - ) | ranges::view::transform([](const auto &pair) { + ) | ranges::views::transform([](const auto &pair) { return pair.first; - }) | ranges::view::filter([&](not_null history) { + }) | ranges::views::filter([&](not_null history) { const auto state = lookup(history); if (!state) { return true; diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp index e1df3afb9..bccad1a5e 100644 --- a/Telegram/SourceFiles/data/data_media_types.cpp +++ b/Telegram/SourceFiles/data/data_media_types.cpp @@ -1271,9 +1271,9 @@ TextForMimeData MediaPoll::clipboardText() const { + _poll->question + qstr(" ]") + ranges::accumulate( - ranges::view::all( + ranges::views::all( _poll->answers - ) | ranges::view::transform([](const PollAnswer &answer) { + ) | ranges::views::transform([](const PollAnswer &answer) { return "\n- " + answer.text; }), QString()); diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 511ccde6f..36b612466 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -422,9 +422,9 @@ QString PeerData::computeUnavailableReason() const { const auto skip = config.get>( "ignore_restriction_reasons", std::vector()); - auto &&filtered = ranges::view::all( + auto &&filtered = ranges::views::all( list - ) | ranges::view::filter([&](const Data::UnavailableReason &reason) { + ) | ranges::views::filter([&](const Data::UnavailableReason &reason) { return !ranges::contains(skip, reason.reason); }); const auto first = filtered.begin(); diff --git a/Telegram/SourceFiles/data/data_poll.cpp b/Telegram/SourceFiles/data/data_poll.cpp index 63ceb2a1a..26777a50c 100644 --- a/Telegram/SourceFiles/data/data_poll.cpp +++ b/Telegram/SourceFiles/data/data_poll.cpp @@ -77,16 +77,16 @@ bool PollData::applyChanges(const MTPDpoll &poll) { | (poll.is_quiz() ? Flag::Quiz : Flag(0)); const auto newCloseDate = poll.vclose_date().value_or_empty(); const auto newClosePeriod = poll.vclose_period().value_or_empty(); - auto newAnswers = ranges::view::all( + auto newAnswers = ranges::views::all( poll.vanswers().v - ) | ranges::view::transform([](const MTPPollAnswer &data) { + ) | ranges::views::transform([](const MTPPollAnswer &data) { return data.match([](const MTPDpollAnswer &answer) { auto result = PollAnswer(); result.option = answer.voption().v; result.text = qs(answer.vtext()); return result; }); - }) | ranges::view::take( + }) | ranges::views::take( kMaxOptions ) | ranges::to_vector; @@ -141,14 +141,14 @@ bool PollData::applyResults(const MTPPollResults &results) { &MTPint::v); if (recentChanged) { changed = true; - recentVoters = ranges::view::all( + recentVoters = ranges::views::all( recent->v - ) | ranges::view::transform([&](MTPint userId) { + ) | ranges::views::transform([&](MTPint userId) { const auto user = _owner->user(userId.v); return user->isMinimalLoaded() ? user.get() : nullptr; - }) | ranges::view::filter([](UserData *user) { + }) | ranges::views::filter([](UserData *user) { return user != nullptr; - }) | ranges::view::transform([](UserData *user) { + }) | ranges::views::transform([](UserData *user) { return not_null(user); }) | ranges::to_vector; } diff --git a/Telegram/SourceFiles/data/data_replies_list.cpp b/Telegram/SourceFiles/data/data_replies_list.cpp index 26af2e370..7870cecb7 100644 --- a/Telegram/SourceFiles/data/data_replies_list.cpp +++ b/Telegram/SourceFiles/data/data_replies_list.cpp @@ -204,7 +204,7 @@ void RepliesList::injectRootMessage(not_null viewer) { injectRootDivider(root, slice); if (const auto group = _history->owner().groups().find(root)) { - for (const auto item : ranges::view::reverse(group->items)) { + for (const auto item : ranges::views::reverse(group->items)) { slice->ids.push_back(item->fullId()); } viewer->injectedForRoot = group->items.size(); diff --git a/Telegram/SourceFiles/data/data_scheduled_messages.cpp b/Telegram/SourceFiles/data/data_scheduled_messages.cpp index 36d9134e0..9a7647058 100644 --- a/Telegram/SourceFiles/data/data_scheduled_messages.cpp +++ b/Telegram/SourceFiles/data/data_scheduled_messages.cpp @@ -362,9 +362,9 @@ Data::MessagesSlice ScheduledMessages::list(not_null history) { const auto &list = i->second.items; result.skippedAfter = result.skippedBefore = 0; result.fullCount = int(list.size()); - result.ids = ranges::view::all( + result.ids = ranges::views::all( list - ) | ranges::view::transform( + ) | ranges::views::transform( &HistoryItem::fullId ) | ranges::to_vector; return result; @@ -534,11 +534,11 @@ int32 ScheduledMessages::countListHash(const List &list) const { using namespace Api; auto hash = HashInit(); - auto &&serverside = ranges::view::all( + auto &&serverside = ranges::views::all( list.items - ) | ranges::view::filter([](const OwnedItem &item) { + ) | ranges::views::filter([](const OwnedItem &item) { return !item->isSending() && !item->hasFailed(); - }) | ranges::view::reverse; + }) | ranges::views::reverse; for (const auto &item : serverside) { const auto j = list.idByItem.find(item.get()); HashUpdate(hash, j->second); diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 45f5b24a8..753532696 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -114,9 +114,9 @@ void CheckForSwitchInlineButton(not_null item) { // need to find an "-all" tag in {full}, otherwise ignore this restriction. std::vector ExtractUnavailableReasons( const QVector &restrictions) { - return ranges::view::all( + return ranges::views::all( restrictions - ) | ranges::view::filter([](const MTPRestrictionReason &restriction) { + ) | ranges::views::filter([](const MTPRestrictionReason &restriction) { return restriction.match([&](const MTPDrestrictionReason &data) { const auto platform = qs(data.vplatform()); return false @@ -127,7 +127,7 @@ std::vector ExtractUnavailableReasons( #endif // OS_MAC_STORE || OS_WIN_STORE || (platform == qstr("all")); }); - }) | ranges::view::transform([](const MTPRestrictionReason &restriction) { + }) | ranges::views::transform([](const MTPRestrictionReason &restriction) { return restriction.match([&](const MTPDrestrictionReason &data) { return UnavailableReason{ qs(data.vreason()), qs(data.vtext()) }; }); @@ -1667,22 +1667,22 @@ rpl::producer> Session::megagroupParticipantAdded( HistoryItemsList Session::idsToItems( const MessageIdsList &ids) const { - return ranges::view::all( + return ranges::views::all( ids - ) | ranges::view::transform([&](const FullMsgId &fullId) { + ) | ranges::views::transform([&](const FullMsgId &fullId) { return message(fullId); - }) | ranges::view::filter([](HistoryItem *item) { + }) | ranges::views::filter([](HistoryItem *item) { return item != nullptr; - }) | ranges::view::transform([](HistoryItem *item) { + }) | ranges::views::transform([](HistoryItem *item) { return not_null(item); }) | ranges::to_vector; } MessageIdsList Session::itemsToIds( const HistoryItemsList &items) const { - return ranges::view::all( + return ranges::views::all( items - ) | ranges::view::transform([](not_null item) { + ) | ranges::views::transform([](not_null item) { return item->fullId(); }) | ranges::to_vector; } diff --git a/Telegram/SourceFiles/data/stickers/data_stickers.cpp b/Telegram/SourceFiles/data/stickers/data_stickers.cpp index 08ab4fa47..cad684d5e 100644 --- a/Telegram/SourceFiles/data/stickers/data_stickers.cpp +++ b/Telegram/SourceFiles/data/stickers/data_stickers.cpp @@ -787,9 +787,9 @@ void Stickers::featuredSetsReceived( const QVector &list, const QVector &unread, int32 hash) { - auto &&unreadIds = ranges::view::all( + auto &&unreadIds = ranges::views::all( unread - ) | ranges::view::transform([](const MTPlong &id) { + ) | ranges::views::transform([](const MTPlong &id) { return id.v; }); const auto unreadMap = base::flat_set{ @@ -1098,9 +1098,9 @@ std::vector> Stickers::getListByEmoji( std::greater<>(), &StickerWithDate::date); - return ranges::view::all( + return ranges::views::all( result - ) | ranges::view::transform([](const StickerWithDate &data) { + ) | ranges::views::transform([](const StickerWithDate &data) { return data.document; }) | ranges::to_vector; } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 710623806..51090e959 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -3108,9 +3108,9 @@ void InnerWidget::setupShortcuts() { const auto filters = &session().data().chatsFilters().list(); if (const auto filtersCount = int(filters->size())) { - auto &&folders = ranges::view::zip( + auto &&folders = ranges::views::zip( Shortcuts::kShowFolder, - ranges::view::ints(0, ranges::unreachable)); + ranges::views::ints(0, ranges::unreachable)); for (const auto [command, index] : folders) { const auto select = (command == Command::ShowFolderLast) @@ -3134,9 +3134,9 @@ void InnerWidget::setupShortcuts() { Command::ChatPinned4, Command::ChatPinned5, }; - auto &&pinned = ranges::view::zip( + auto &&pinned = ranges::views::zip( kPinned, - ranges::view::ints(0, ranges::unreachable)); + ranges::views::ints(0, ranges::unreachable)); for (const auto [command, index] : pinned) { request->check(command) && request->handle([=, index = index] { const auto list = (_filterId diff --git a/Telegram/SourceFiles/dialogs/dialogs_row.cpp b/Telegram/SourceFiles/dialogs/dialogs_row.cpp index 0159eee80..372f2e619 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_row.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_row.cpp @@ -32,9 +32,9 @@ QString ComposeFolderListEntryText(not_null folder) { const auto throwAwayLastName = (list.size() > 1) && (count == list.size() + 1); - auto &&peers = ranges::view::all( + auto &&peers = ranges::views::all( list - ) | ranges::view::take( + ) | ranges::views::take( list.size() - (throwAwayLastName ? 1 : 0) ); const auto wrapName = [](not_null history) { diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp index 050752f20..2caf79935 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.cpp +++ b/Telegram/SourceFiles/export/data/export_data_types.cpp @@ -546,9 +546,9 @@ Poll ParsePoll(const MTPDmessageMediaPoll &data) { result.id = poll.vid().v; result.question = ParseString(poll.vquestion()); result.closed = poll.is_closed(); - result.answers = ranges::view::all( + result.answers = ranges::views::all( poll.vanswers().v - ) | ranges::view::transform([](const MTPPollAnswer &answer) { + ) | ranges::views::transform([](const MTPPollAnswer &answer) { return answer.match([](const MTPDpollAnswer &answer) { auto result = Poll::Answer(); result.text = ParseString(answer.vtext()); @@ -1334,15 +1334,15 @@ ContactsList ParseContactsList(const MTPVector &data) { } std::vector SortedContactsIndices(const ContactsList &data) { - const auto names = ranges::view::all( + const auto names = ranges::views::all( data.list - ) | ranges::view::transform([](const Data::ContactInfo &info) { + ) | ranges::views::transform([](const Data::ContactInfo &info) { return (QString::fromUtf8(info.firstName) + ' ' + QString::fromUtf8(info.lastName)).toLower(); }) | ranges::to_vector; - auto indices = ranges::view::ints(0, int(data.list.size())) + auto indices = ranges::views::ints(0, int(data.list.size())) | ranges::to_vector; ranges::sort(indices, [&](int i, int j) { return names[i] < names[j]; diff --git a/Telegram/SourceFiles/export/export_api_wrap.cpp b/Telegram/SourceFiles/export/export_api_wrap.cpp index 6d59b91d9..fa076a80f 100644 --- a/Telegram/SourceFiles/export/export_api_wrap.cpp +++ b/Telegram/SourceFiles/export/export_api_wrap.cpp @@ -1333,9 +1333,9 @@ void ApiWrap::appendChatsSlice( const auto goodByTypes = [&](const Data::DialogInfo &info) { return ((types & SettingsFromDialogsType(info.type)) != 0); }; - auto filtered = ranges::view::all( + auto filtered = ranges::views::all( from - ) | ranges::view::filter([&](const Data::DialogInfo &info) { + ) | ranges::views::filter([&](const Data::DialogInfo &info) { if (goodByTypes(info)) { return true; } else if (info.migratedToChannelId diff --git a/Telegram/SourceFiles/export/output/export_output_html.cpp b/Telegram/SourceFiles/export/output/export_output_html.cpp index a8bc27cdb..4ed0cdcd8 100644 --- a/Telegram/SourceFiles/export/output/export_output_html.cpp +++ b/Telegram/SourceFiles/export/output/export_output_html.cpp @@ -220,9 +220,9 @@ QByteArray JoinList( QByteArray FormatText( const std::vector &data, const QString &internalLinksDomain) { - return JoinList(QByteArray(), ranges::view::all( + return JoinList(QByteArray(), ranges::views::all( data - ) | ranges::view::transform([&](const Data::TextPart &part) { + ) | ranges::views::transform([&](const Data::TextPart &part) { const auto text = SerializeString(part.text); using Type = Data::TextPart::Type; switch (part.type) { diff --git a/Telegram/SourceFiles/export/output/export_output_json.cpp b/Telegram/SourceFiles/export/output/export_output_json.cpp index 4a36652eb..c0e9390ed 100644 --- a/Telegram/SourceFiles/export/output/export_output_json.cpp +++ b/Telegram/SourceFiles/export/output/export_output_json.cpp @@ -150,9 +150,9 @@ QByteArray SerializeText( context.nesting.push_back(Context::kArray); - const auto text = ranges::view::all( + const auto text = ranges::views::all( data - ) | ranges::view::transform([&](const Data::TextPart &part) { + ) | ranges::views::transform([&](const Data::TextPart &part) { if (part.type == Type::Text) { return SerializeString(part.text); } @@ -615,9 +615,9 @@ QByteArray SerializeMessage( })); }, [&](const Poll &data) { context.nesting.push_back(Context::kObject); - const auto answers = ranges::view::all( + const auto answers = ranges::views::all( data.answers - ) | ranges::view::transform([&](const Poll::Answer &answer) { + ) | ranges::views::transform([&](const Poll::Answer &answer) { context.nesting.push_back(Context::kArray); auto result = SerializeObject(context, { { "text", SerializeString(answer.text) }, diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index f0b9c6d37..07748ff17 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -431,7 +431,7 @@ void InnerWidget::requestAdmins() { const QVector &list) { auto filtered = ( list - ) | ranges::view::transform([&](const MTPChannelParticipant &p) { + ) | ranges::views::transform([&](const MTPChannelParticipant &p) { const auto userId = p.match([](const auto &data) { return data.vuser_id().v; }); @@ -442,11 +442,11 @@ void InnerWidget::requestAdmins() { return false; }); return std::make_pair(userId, canEdit); - }) | ranges::view::transform([&](auto &&pair) { + }) | ranges::views::transform([&](auto &&pair) { return std::make_pair( session().data().userLoaded(pair.first), pair.second); - }) | ranges::view::filter([&](auto &&pair) { + }) | ranges::views::filter([&](auto &&pair) { return (pair.first != nullptr); }); @@ -818,7 +818,7 @@ int InnerWidget::resizeGetHeight(int newWidth) { const auto resizeAllItems = (_itemsWidth != newWidth); auto newHeight = 0; - for (const auto &item : ranges::view::reverse(_items)) { + for (const auto &item : ranges::views::reverse(_items)) { item->setY(newHeight); if (item->pendingResize() || resizeAllItems) { newHeight += item->resizeGetHeight(newWidth); diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index ee59d08ff..c678d24d8 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -1125,9 +1125,9 @@ const base::flat_set> &History::localMessages() { } HistoryItem *History::latestSendingMessage() const { - auto sending = ranges::view::all( + auto sending = ranges::views::all( _localMessages - ) | ranges::view::filter([](not_null item) { + ) | ranges::views::filter([](not_null item) { return item->isSending(); }); const auto i = ranges::max_element(sending, ranges::less(), []( @@ -1287,7 +1287,7 @@ void History::addItemsToLists( // lastParticipants are displayed in Profile as members list. markupSenders = &peer->asChannel()->mgInfo->markupSenders; } - for (const auto item : ranges::view::reverse(items)) { + for (const auto item : ranges::views::reverse(items)) { item->addToUnreadMentions(UnreadMentionType::Existing); if (item->from()->id) { if (lastAuthors) { // chats @@ -1400,8 +1400,8 @@ void History::calculateFirstUnreadMessage() { if (!unreadCount() || !trackUnreadMessages()) { return; } - for (const auto &block : ranges::view::reverse(blocks)) { - for (const auto &message : ranges::view::reverse(block->messages)) { + for (const auto &block : ranges::views::reverse(blocks)) { + for (const auto &message : ranges::views::reverse(block->messages)) { const auto item = message->data(); if (!IsServerMsgId(item->id)) { continue; @@ -1488,8 +1488,8 @@ std::optional History::countStillUnreadLocal(MsgId readTillId) const { return std::nullopt; } auto result = 0; - for (const auto &block : ranges::view::reverse(blocks)) { - for (const auto &message : ranges::view::reverse(block->messages)) { + for (const auto &block : ranges::views::reverse(blocks)) { + for (const auto &message : ranges::views::reverse(block->messages)) { const auto item = message->data(); if (IsServerMsgId(item->id)) { if (item->id <= readTillId) { @@ -2250,9 +2250,9 @@ auto History::computeChatListMessageFromLast() const return std::nullopt; } const auto before = [&]() -> HistoryItem* { - for (const auto &block : ranges::view::reverse(blocks)) { + for (const auto &block : ranges::views::reverse(blocks)) { const auto &messages = block->messages; - for (const auto &item : ranges::view::reverse(messages)) { + for (const auto &item : ranges::views::reverse(messages)) { if (item->data() != last) { return item->data(); } @@ -2653,8 +2653,8 @@ MsgId History::minMsgId() const { } MsgId History::maxMsgId() const { - for (const auto &block : ranges::view::reverse(blocks)) { - for (const auto &message : ranges::view::reverse(block->messages)) { + for (const auto &block : ranges::views::reverse(blocks)) { + for (const auto &message : ranges::views::reverse(block->messages)) { const auto item = message->data(); if (IsServerMsgId(item->id)) { return item->id; @@ -2679,8 +2679,8 @@ HistoryItem *History::lastEditableMessage() const { return nullptr; } const auto now = base::unixtime::now(); - for (const auto &block : ranges::view::reverse(blocks)) { - for (const auto &message : ranges::view::reverse(block->messages)) { + for (const auto &block : ranges::views::reverse(blocks)) { + for (const auto &message : ranges::views::reverse(block->messages)) { const auto item = message->data(); if (item->allowsEdit(now)) { return owner().groups().findItemToEdit(item); @@ -2922,8 +2922,8 @@ auto History::findFirstDisplayed() const -> Element* { } auto History::findLastNonEmpty() const -> Element* { - for (const auto &block : ranges::view::reverse(blocks)) { - for (const auto &element : ranges::view::reverse(block->messages)) { + for (const auto &block : ranges::views::reverse(blocks)) { + for (const auto &element : ranges::views::reverse(block->messages)) { if (!element->data()->isEmpty()) { return element.get(); } @@ -2933,8 +2933,8 @@ auto History::findLastNonEmpty() const -> Element* { } auto History::findLastDisplayed() const -> Element* { - for (const auto &block : ranges::view::reverse(blocks)) { - for (const auto &element : ranges::view::reverse(block->messages)) { + for (const auto &block : ranges::views::reverse(blocks)) { + for (const auto &element : ranges::views::reverse(block->messages)) { if (!element->data()->isEmpty() && !element->isHidden()) { return element.get(); } diff --git a/Telegram/SourceFiles/history/history_item_text.cpp b/Telegram/SourceFiles/history/history_item_text.cpp index 5a1d9adfb..b444d84a6 100644 --- a/Telegram/SourceFiles/history/history_item_text.cpp +++ b/Telegram/SourceFiles/history/history_item_text.cpp @@ -135,11 +135,11 @@ TextForMimeData HistoryGroupText(not_null group) { } } auto caption = [&] { - auto &&nonempty = ranges::view::all( + auto &&nonempty = ranges::views::all( group->items - ) | ranges::view::filter( + ) | ranges::views::filter( hasCaption - ) | ranges::view::take(2); + ) | ranges::views::take(2); auto first = nonempty.begin(); auto end = nonempty.end(); if (first == end) { diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 80d6139f0..316cb492f 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -5143,9 +5143,9 @@ void HistoryWidget::mousePressEvent(QMouseEvent *e) { if (readyToForward()) { const auto items = std::move(_toForward); session().data().cancelForwarding(_history); - auto list = ranges::view::all( + auto list = ranges::views::all( items - ) | ranges::view::transform( + ) | ranges::views::transform( &HistoryItem::fullId ) | ranges::to_vector; Window::ShowForwardMessagesBox(controller(), std::move(list)); diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 2d6784e6a..599507574 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -285,9 +285,9 @@ void AddPostLinkAction( } MessageIdsList ExtractIdsList(const SelectedItems &items) { - return ranges::view::all( + return ranges::views::all( items - ) | ranges::view::transform( + ) | ranges::views::transform( &SelectedItem::msgId ) | ranges::to_vector; } @@ -370,13 +370,13 @@ bool AddSendNowSelectedAction( } const auto session = &request.navigation->session(); - auto histories = ranges::view::all( + auto histories = ranges::views::all( request.selectedItems - ) | ranges::view::transform([&](const SelectedItem &item) { + ) | ranges::views::transform([&](const SelectedItem &item) { return session->data().message(item.msgId); - }) | ranges::view::filter([](HistoryItem *item) { + }) | ranges::views::filter([](HistoryItem *item) { return item != nullptr; - }) | ranges::view::transform( + }) | ranges::views::transform( &HistoryItem::history ); if (histories.begin() == histories.end()) { diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index f5be86cad..2849fc1fb 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -805,9 +805,9 @@ auto ListWidget::collectSelectedItems() const -> SelectedItems { MessageIdsList ListWidget::collectSelectedIds() const { const auto selected = collectSelectedItems(); - return ranges::view::all( + return ranges::views::all( selected - ) | ranges::view::transform([](const SelectedItem &item) { + ) | ranges::views::transform([](const SelectedItem &item) { return item.msgId; }) | ranges::to_vector; } @@ -2735,7 +2735,7 @@ bool ListWidget::lastMessageEditRequestNotify() const { auto proj = [&](not_null view) { return view->data()->allowsEdit(now); }; - const auto &list = ranges::view::reverse(_items); + const auto &list = ranges::views::reverse(_items); const auto it = ranges::find_if(list, std::move(proj)); if (it == end(list)) { return false; @@ -2785,7 +2785,7 @@ void ListWidget::replyNextMessage(FullMsgId fullId, bool next) { auto proj = [&](not_null view) { return view->data()->fullId() == fullId; }; - const auto &list = ranges::view::reverse(_items); + const auto &list = ranges::views::reverse(_items); const auto it = ranges::find_if(list, std::move(proj)); if (it == end(list)) { replyFirst(); diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index 057e69826..c1f16596d 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -1706,7 +1706,7 @@ void RepliesWidget::readTill(not_null item) { } void RepliesWidget::listVisibleItemsChanged(HistoryItemsList &&items) { - const auto reversed = ranges::view::reverse(items); + const auto reversed = ranges::views::reverse(items); const auto good = ranges::find_if(reversed, [](auto item) { return IsServerMsgId(item->id); }); diff --git a/Telegram/SourceFiles/history/view/media/history_view_large_emoji.cpp b/Telegram/SourceFiles/history/view/media/history_view_large_emoji.cpp index 56ac0ceb0..881233ffc 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_large_emoji.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_large_emoji.cpp @@ -38,7 +38,7 @@ auto ResolveImages( auto NonEmpty(const std::array, Ui::Text::kIsolatedEmojiLimit> &images) { using namespace rpl::mappers; - return images | ranges::view::filter(_1 != nullptr); + return images | ranges::views::filter(_1 != nullptr); } } // namespace diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp index 8352267d0..304fad1a2 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp @@ -62,11 +62,11 @@ GroupedMedia::GroupedMedia( const std::vector> &medias) : Media(parent) , _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) { - const auto truncated = ranges::view::all( + const auto truncated = ranges::views::all( medias - ) | ranges::view::transform([](const std::unique_ptr &v) { + ) | ranges::views::transform([](const std::unique_ptr &v) { return v.get(); - }) | ranges::view::take(kMaxSize); + }) | ranges::views::take(kMaxSize); const auto result = applyGroup(truncated); Ensures(result); @@ -77,11 +77,11 @@ GroupedMedia::GroupedMedia( const std::vector> &items) : Media(parent) , _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) { - const auto medias = ranges::view::all( + const auto medias = ranges::views::all( items - ) | ranges::view::transform([](not_null item) { + ) | ranges::views::transform([](not_null item) { return item->media(); - }) | ranges::view::take(kMaxSize); + }) | ranges::views::take(kMaxSize); const auto result = applyGroup(medias); Ensures(result); diff --git a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp index 3d5b393da..58a82deec 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp @@ -105,10 +105,10 @@ void CountNicePercent( PercentCounterItem ItemsStorage[PollData::kMaxOptions]; const auto items = gsl::make_span(ItemsStorage).subspan(0, count); auto left = 100; - auto &&zipped = ranges::view::zip( + auto &&zipped = ranges::views::zip( votes, items, - ranges::view::ints(0, int(items.size()))); + ranges::views::ints(0, int(items.size()))); for (auto &&[votes, item, index] : zipped) { item.index = index; item.percent = (votes * 100) / total; @@ -248,9 +248,9 @@ QSize Poll::countOptimalSize() { + st::historyPollAnswerPadding.right()); } - const auto answersHeight = ranges::accumulate(ranges::view::all( + const auto answersHeight = ranges::accumulate(ranges::views::all( _answers - ) | ranges::view::transform([](const Answer &answer) { + ) | ranges::views::transform([](const Answer &answer) { return st::historyPollAnswerPadding.top() + answer.text.minHeight() + st::historyPollAnswerPadding.bottom(); @@ -307,9 +307,9 @@ int Poll::countAnswerTop( } tshift += _question.countHeight(innerWidth) + st::historyPollSubtitleSkip; tshift += st::msgDateFont->height + st::historyPollAnswersSkip; - auto &&answers = ranges::view::zip( + auto &&answers = ranges::views::zip( _answers, - ranges::view::ints(0, int(_answers.size()))); + ranges::views::ints(0, int(_answers.size()))); const auto i = ranges::find( _answers, &answer, @@ -345,9 +345,9 @@ QSize Poll::countCurrentSize(int newWidth) { - st::msgPadding.left() - st::msgPadding.right(); - const auto answersHeight = ranges::accumulate(ranges::view::all( + const auto answersHeight = ranges::accumulate(ranges::views::all( _answers - ) | ranges::view::transform([&](const Answer &answer) { + ) | ranges::views::transform([&](const Answer &answer) { return countAnswerHeight(answer, innerWidth); }), 0); @@ -477,16 +477,16 @@ void Poll::solutionToggled( } void Poll::updateRecentVoters() { - auto &&sliced = ranges::view::all( + auto &&sliced = ranges::views::all( _poll->recentVoters - ) | ranges::view::take(kShowRecentVotersCount); + ) | ranges::views::take(kShowRecentVotersCount); const auto changed = !ranges::equal( _recentVoters, sliced, ranges::equal_to(), &RecentVoter::user); if (changed) { - auto updated = ranges::view::all( + auto updated = ranges::views::all( sliced ) | ranges::views::transform([](not_null user) { return RecentVoter{ user }; @@ -518,15 +518,15 @@ void Poll::updateAnswers() { &Answer::option, &PollAnswer::option); if (!changed) { - auto &&answers = ranges::view::zip(_answers, _poll->answers); + auto &&answers = ranges::views::zip(_answers, _poll->answers); for (auto &&[answer, original] : answers) { answer.fillData(_poll, original); } return; } - _answers = ranges::view::all( + _answers = ranges::views::all( _poll->answers - ) | ranges::view::transform([&](const PollAnswer &answer) { + ) | ranges::views::transform([&](const PollAnswer &answer) { auto result = Answer(); result.option = answer.option; result.fillData(_poll, answer); @@ -583,9 +583,9 @@ void Poll::toggleMultiOption(const QByteArray &option) { } void Poll::sendMultiOptions() { - auto chosen = _answers | ranges::view::filter( + auto chosen = _answers | ranges::views::filter( &Answer::selected - ) | ranges::view::transform( + ) | ranges::views::transform( &Answer::option ) | ranges::to_vector; if (!chosen.empty()) { @@ -697,9 +697,9 @@ void Poll::updateAnswerVotes() { int VotesStorage[kMaxCount] = { 0 }; ranges::copy( - ranges::view::all( + ranges::views::all( _poll->answers - ) | ranges::view::transform(&PollAnswer::votes), + ) | ranges::views::transform(&PollAnswer::votes), ranges::begin(VotesStorage)); CountNicePercent( @@ -707,7 +707,7 @@ void Poll::updateAnswerVotes() { totalVotes, gsl::make_span(PercentsStorage).subspan(0, count)); - auto &&answers = ranges::view::zip( + auto &&answers = ranges::views::zip( _answers, _poll->answers, PercentsStorage); @@ -756,9 +756,9 @@ void Poll::draw(Painter &p, const QRect &r, TextSelection selection, crl::time m resetAnswersAnimation(); } - auto &&answers = ranges::view::zip( + auto &&answers = ranges::views::zip( _answers, - ranges::view::ints(0, int(_answers.size()))); + ranges::views::ints(0, int(_answers.size()))); for (const auto &[answer, index] : answers) { const auto animation = _answersAnimation ? &_answersAnimation->data[index] @@ -1292,7 +1292,7 @@ void Poll::startAnswersAnimation() const { } const auto show = showVotes(); - auto &&both = ranges::view::zip(_answers, _answersAnimation->data); + auto &&both = ranges::views::zip(_answers, _answersAnimation->data); for (auto &&[answer, data] : both) { data.percent.start(show ? float64(answer.votesPercent) : 0.); data.filling.start(show ? answer.filling : 0.); diff --git a/Telegram/SourceFiles/info/info_top_bar.cpp b/Telegram/SourceFiles/info/info_top_bar.cpp index 68cd53558..c57955372 100644 --- a/Telegram/SourceFiles/info/info_top_bar.cpp +++ b/Telegram/SourceFiles/info/info_top_bar.cpp @@ -510,11 +510,11 @@ bool TopBar::searchMode() const { } MessageIdsList TopBar::collectItems() const { - return ranges::view::all( + return ranges::views::all( _selectedItems.list - ) | ranges::view::transform([](auto &&item) { + ) | ranges::views::transform([](auto &&item) { return item.msgId; - }) | ranges::view::filter([&](FullMsgId msgId) { + }) | ranges::views::filter([&](FullMsgId msgId) { return _navigation->session().data().message(msgId) != nullptr; }) | ranges::to_vector; } diff --git a/Telegram/SourceFiles/info/media/info_media_list_widget.cpp b/Telegram/SourceFiles/info/media/info_media_list_widget.cpp index 0670b44b7..37d2e3c7d 100644 --- a/Telegram/SourceFiles/info/media/info_media_list_widget.cpp +++ b/Telegram/SourceFiles/info/media/info_media_list_widget.cpp @@ -724,9 +724,9 @@ auto ListWidget::collectSelectedItems() const -> SelectedItems { MessageIdsList ListWidget::collectSelectedIds() const { const auto selected = collectSelectedItems(); - return ranges::view::all( + return ranges::views::all( selected.list - ) | ranges::view::transform([](const SelectedItem &item) { + ) | ranges::views::transform([](const SelectedItem &item) { return item.msgId; }) | ranges::to_vector; } diff --git a/Telegram/SourceFiles/info/profile/info_profile_members.cpp b/Telegram/SourceFiles/info/profile/info_profile_members.cpp index f3621ca6b..0acdf6521 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_members.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_members.cpp @@ -326,9 +326,9 @@ void Members::addMember() { AddParticipantsBoxController::Start(_controller, chat); } else if (const auto channel = _peer->asChannel()) { const auto state = _listController->saveState(); - const auto users = ranges::view::all( + const auto users = ranges::views::all( state->list - ) | ranges::view::transform([](not_null peer) { + ) | ranges::views::transform([](not_null peer) { return peer->asUser(); }) | ranges::to_vector; AddParticipantsBoxController::Start( diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp index 04c4c5600..aad9ce1f7 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp @@ -212,7 +212,7 @@ template auto Reader::StackIntVector::values() const { using namespace rpl::mappers; - return ranges::view::all(_storage) | ranges::view::take_while(_1 >= 0); + return ranges::views::all(_storage) | ranges::views::take_while(_1 >= 0); } struct Reader::CacheHelper { @@ -1057,9 +1057,9 @@ void Reader::pruneDoneDownloaderRequests() { } void Reader::sendDownloaderRequests() { - auto &&offsets = ranges::view::all( + auto &&offsets = ranges::views::all( _offsetsForDownloader - ) | ranges::view::take(kDownloaderRequestsLimit); + ) | ranges::views::take(kDownloaderRequestsLimit); for (const auto offset : offsets) { if ((!_cacheHelper || !downloaderWaitForCachedSlice(offset)) && _downloaderOffsetsRequested.emplace(offset).second) { diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_utility.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_utility.cpp index 3a4386b0a..5cde41782 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_utility.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_utility.cpp @@ -139,8 +139,8 @@ QImage ConvertFrame( - storage.width(); const auto deltaFrom = (frame->linesize[0] / sizeof(uint32)) - frame->width; - for (const auto y : ranges::view::ints(0, frame->height)) { - for (const auto x : ranges::view::ints(0, frame->width)) { + for (const auto y : ranges::views::ints(0, frame->height)) { + for (const auto x : ranges::views::ints(0, frame->width)) { // Wipe out possible alpha values. *to++ = 0xFF000000U | *from++; } diff --git a/Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp b/Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp index f232c2eb6..4eb28b0c8 100644 --- a/Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp +++ b/Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp @@ -748,9 +748,9 @@ void DcOptions::FilterIfHasWithFlag(Variants &variants, Flag flag) { for (auto &byAddress : variants.data) { for (auto &list : byAddress) { if (has(list)) { - list = ranges::view::all( + list = ranges::views::all( list - ) | ranges::view::filter( + ) | ranges::views::filter( is ) | ranges::to_vector; } diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index 64b08c271..1df040603 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -464,9 +464,9 @@ int Value::whatNotFilled() const { void Value::saveInEdit(not_null session) { const auto saveList = [&](FileType type) { - filesInEdit(type) = ranges::view::all( + filesInEdit(type) = ranges::views::all( files(type) - ) | ranges::view::transform([=](const File &file) { + ) | ranges::views::transform([=](const File &file) { return EditFile(session, this, type, file, nullptr); }) | ranges::to_vector; }; @@ -2541,7 +2541,7 @@ bool FormController::parseForm(const MTPaccount_AuthorizationForm &result) { value.nativeNames = requested.nativeNames; } _form.request.push_back(row.values - | ranges::view::transform([](const RequestedValue &value) { + | ranges::views::transform([](const RequestedValue &value) { return value.type; }) | ranges::to_vector); } diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.cpp b/Telegram/SourceFiles/passport/passport_panel_controller.cpp index 28498f407..a18be2540 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_controller.cpp @@ -1005,11 +1005,11 @@ void PanelController::requestScopeFilesType(int index) { [=](int documentIndex) { editWithUpload(index, documentIndex); }, - ranges::view::all( + ranges::views::all( _scopes[index].documents - ) | ranges::view::transform([](auto value) { + ) | ranges::views::transform([](auto value) { return value->type; - }) | ranges::view::transform([](Value::Type type) { + }) | ranges::views::transform([](Value::Type type) { switch (type) { case Value::Type::Passport: return tr::lng_passport_identity_passport(tr::now); @@ -1028,11 +1028,11 @@ void PanelController::requestScopeFilesType(int index) { [=](int documentIndex) { editWithUpload(index, documentIndex); }, - ranges::view::all( + ranges::views::all( _scopes[index].documents - ) | ranges::view::transform([](auto value) { + ) | ranges::views::transform([](auto value) { return value->type; - }) | ranges::view::transform([](Value::Type type) { + }) | ranges::views::transform([](Value::Type type) { switch (type) { case Value::Type::UtilityBill: return tr::lng_passport_address_bill(tr::now); diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp index 75766ba28..fc018a42c 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp @@ -637,7 +637,7 @@ bool PanelEditDocument::validate() { error = firsttop.y(); } auto first = QPointer(); - for (const auto &[i, field] : ranges::view::reverse(_details)) { + for (const auto &[i, field] : ranges::views::reverse(_details)) { const auto &row = _scheme.rows[i]; if (row.valueClass == Scheme::ValueClass::Additional && !_additionalShown) { diff --git a/Telegram/SourceFiles/platform/mac/touchbar/items/mac_pinned_chats_item.mm b/Telegram/SourceFiles/platform/mac/touchbar/items/mac_pinned_chats_item.mm index 933036325..85e48229c 100644 --- a/Telegram/SourceFiles/platform/mac/touchbar/items/mac_pinned_chats_item.mm +++ b/Telegram/SourceFiles/platform/mac/touchbar/items/mac_pinned_chats_item.mm @@ -632,9 +632,9 @@ TimeId CalculateOnlineTill(not_null peer) { }; const auto updatePinnedChats = [=] { - _pins = ranges::view::zip( + _pins = ranges::views::zip( _session->data().pinnedChatsOrder(nullptr, FilterId()), - ranges::view::ints(0, ranges::unreachable) + ranges::views::ints(0, ranges::unreachable) ) | ranges::views::transform([=](const auto &pair) { const auto index = pair.second; auto peer = pair.first.history()->peer; diff --git a/Telegram/SourceFiles/settings/settings_calls.cpp b/Telegram/SourceFiles/settings/settings_calls.cpp index dc0d49eff..4faea034e 100644 --- a/Telegram/SourceFiles/settings/settings_calls.cpp +++ b/Telegram/SourceFiles/settings/settings_calls.cpp @@ -101,9 +101,9 @@ void Calls::setupContent() { st::settingsButton )->addClickHandler([=] { const auto &devices = GetVideoInputList(); - const auto options = ranges::view::concat( - ranges::view::single(tr::lng_settings_call_device_default(tr::now)), - devices | ranges::view::transform(&VideoInput::name) + const auto options = ranges::views::concat( + ranges::views::single(tr::lng_settings_call_device_default(tr::now)), + devices | ranges::views::transform(&VideoInput::name) ) | ranges::to_vector; const auto i = ranges::find( devices, @@ -375,9 +375,9 @@ object_ptr ChooseAudioOutputBox( const style::Radio *radioSt) { const auto &settings = Core::App().settings(); const auto list = GetAudioOutputList(settings.callAudioBackend()); - const auto options = ranges::view::concat( - ranges::view::single(tr::lng_settings_call_device_default(tr::now)), - list | ranges::view::transform(&AudioOutput::name) + const auto options = ranges::views::concat( + ranges::views::single(tr::lng_settings_call_device_default(tr::now)), + list | ranges::views::transform(&AudioOutput::name) ) | ranges::to_vector; const auto i = ranges::find( list, @@ -411,9 +411,9 @@ object_ptr ChooseAudioInputBox( const style::Radio *radioSt) { const auto &settings = Core::App().settings(); const auto list = GetAudioInputList(settings.callAudioBackend()); - const auto options = ranges::view::concat( - ranges::view::single(tr::lng_settings_call_device_default(tr::now)), - list | ranges::view::transform(&AudioInput::name) + const auto options = ranges::views::concat( + ranges::views::single(tr::lng_settings_call_device_default(tr::now)), + list | ranges::views::transform(&AudioInput::name) ) | ranges::to_vector; const auto i = ranges::find( list, diff --git a/Telegram/SourceFiles/settings/settings_chat.cpp b/Telegram/SourceFiles/settings/settings_chat.cpp index f1d653504..c257a1ba8 100644 --- a/Telegram/SourceFiles/settings/settings_chat.cpp +++ b/Telegram/SourceFiles/settings/settings_chat.cpp @@ -1039,9 +1039,9 @@ void SetupDefaultThemes( }; auto checks = base::flat_map>(); - auto buttons = ranges::view::all( + auto buttons = ranges::views::all( kSchemesList - ) | ranges::view::transform([&](const Scheme &scheme) { + ) | ranges::views::transform([&](const Scheme &scheme) { auto check = std::make_unique( ColorsFromScheme(scheme), false); diff --git a/Telegram/SourceFiles/settings/settings_folders.cpp b/Telegram/SourceFiles/settings/settings_folders.cpp index 568fc9000..265fadfc5 100644 --- a/Telegram/SourceFiles/settings/settings_folders.cpp +++ b/Telegram/SourceFiles/settings/settings_folders.cpp @@ -555,7 +555,7 @@ void FilterRowButton::paintEvent(QPaintEvent *e) { tl)); } auto previousId = mtpRequestId(0); - auto &&requests = ranges::view::concat(removeRequests, addRequests); + auto &&requests = ranges::views::concat(removeRequests, addRequests); for (auto &request : requests) { previousId = session->api().request( std::move(request) diff --git a/Telegram/SourceFiles/support/support_templates.cpp b/Telegram/SourceFiles/support/support_templates.cpp index 6c3939a6b..1c0558e17 100644 --- a/Telegram/SourceFiles/support/support_templates.cpp +++ b/Telegram/SourceFiles/support/support_templates.cpp @@ -730,14 +730,14 @@ auto Templates::query(const QString &text) const -> std::vector { return (a.first.second < b.first.second); } }; - const auto good = narrowed->second | ranges::view::transform( + const auto good = narrowed->second | ranges::views::transform( pairById - ) | ranges::view::filter([](const Pair &pair) { + ) | ranges::views::filter([](const Pair &pair) { return pair.second > 0; }) | ranges::to_vector | ranges::action::stable_sort(sorter); - return good | ranges::view::transform([&](const Pair &pair) { + return good | ranges::views::transform([&](const Pair &pair) { return questionById(pair.first); - }) | ranges::view::take(kQueryLimit) | ranges::to_vector; + }) | ranges::views::take(kQueryLimit) | ranges::to_vector; } } // namespace Support diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_album_preview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_album_preview.cpp index 3154bc41b..b1a26d22a 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_album_preview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_album_preview.cpp @@ -85,14 +85,14 @@ std::vector AlbumPreview::defaultOrder(int count) const { if (count < 0) { count = _order.size(); } - return ranges::view::ints(0, count) | ranges::to_vector; + return ranges::views::ints(0, count) | ranges::to_vector; } void AlbumPreview::prepareThumbs(gsl::span items) { _order = defaultOrder(items.size()); - _itemsShownDimensions = ranges::view::all( + _itemsShownDimensions = ranges::views::all( _order - ) | ranges::view::transform([&](int index) { + ) | ranges::views::transform([&](int index) { return items[index].shownDimensions; }) | ranges::to_vector; @@ -108,9 +108,9 @@ void AlbumPreview::prepareThumbs(gsl::span items) { [=] { deleteThumbByIndex(thumbIndex(thumbUnderCursor())); })); } _thumbsHeight = countLayoutHeight(layout); - _photosHeight = ranges::accumulate(ranges::view::all( + _photosHeight = ranges::accumulate(ranges::views::all( _thumbs - ) | ranges::view::transform([](const auto &thumb) { + ) | ranges::views::transform([](const auto &thumb) { return thumb->photoHeight(); }), 0) + (count - 1) * st::sendMediaRowSkip; diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_prepare.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_prepare.cpp index 8ba397094..4bf0d5c51 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_prepare.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_prepare.cpp @@ -111,7 +111,7 @@ bool PreparedList::canBeSentInSlowmodeWith(const PreparedList &other) const { } using Type = PreparedFile::Type; - auto &&all = ranges::view::concat(files, other.files); + auto &&all = ranges::views::concat(files, other.files); const auto has = [&](Type type) { return ranges::contains(all, type, &PreparedFile::type); }; diff --git a/Telegram/SourceFiles/ui/chat/group_call_userpics.cpp b/Telegram/SourceFiles/ui/chat/group_call_userpics.cpp index 68fab5f16..40f89176b 100644 --- a/Telegram/SourceFiles/ui/chat/group_call_userpics.cpp +++ b/Telegram/SourceFiles/ui/chat/group_call_userpics.cpp @@ -141,7 +141,7 @@ GroupCallUserpics::~GroupCallUserpics() = default; void GroupCallUserpics::paint(Painter &p, int x, int y, int size) { const auto factor = style::DevicePixelRatio(); const auto &minScale = kUserpicMinScale; - for (auto &userpic : ranges::view::reverse(_list)) { + for (auto &userpic : ranges::views::reverse(_list)) { const auto shown = userpic.shownAnimation.value( userpic.hiding ? 0. : 1.); if (shown == 0.) { diff --git a/Telegram/SourceFiles/ui/grouped_layout.cpp b/Telegram/SourceFiles/ui/grouped_layout.cpp index cefc127b5..82b688a7b 100644 --- a/Telegram/SourceFiles/ui/grouped_layout.cpp +++ b/Telegram/SourceFiles/ui/grouped_layout.cpp @@ -105,17 +105,17 @@ Layouter::Layouter( } std::vector Layouter::CountRatios(const std::vector &sizes) { - return ranges::view::all( + return ranges::views::all( sizes - ) | ranges::view::transform([](const QSize &size) { + ) | ranges::views::transform([](const QSize &size) { return size.width() / float64(size.height()); }) | ranges::to_vector; } std::string Layouter::CountProportions(const std::vector &ratios) { - return ranges::view::all( + return ranges::views::all( ratios - ) | ranges::view::transform([](float64 ratio) { + ) | ranges::views::transform([](float64 ratio) { return (ratio > 1.2) ? 'w' : (ratio < 0.8) ? 'n' : 'q'; }) | ranges::to(); } @@ -438,9 +438,9 @@ ComplexLayouter::ComplexLayouter( std::vector ComplexLayouter::CropRatios( const std::vector &ratios, float64 averageRatio) { - return ranges::view::all( + return ranges::views::all( ratios - ) | ranges::view::transform([&](float64 ratio) { + ) | ranges::views::transform([&](float64 ratio) { constexpr auto kMaxRatio = 2.75; constexpr auto kMinRatio = 0.6667; return (averageRatio > 1.1) diff --git a/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp b/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp index 4b18cca3b..cab61629f 100644 --- a/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp +++ b/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp @@ -475,12 +475,12 @@ bool CloudList::insertTillLimit( }) - begin(_elements); auto positionForBad = end(_elements) - begin(_elements); - auto insertElements = ranges::view::all( + auto insertElements = ranges::views::all( list - ) | ranges::view::filter([&](const Data::CloudTheme &theme) { + ) | ranges::views::filter([&](const Data::CloudTheme &theme) { const auto i = ranges::find(_elements, theme.id, &Element::id); return (i == end(_elements)); - }) | ranges::view::take(insertCount); + }) | ranges::views::take(insertCount); for (const auto &theme : insertElements) { const auto good = isGood(theme); @@ -665,7 +665,7 @@ void CloudList::subscribeToDownloadFinished() { } _window->session().downloaderTaskFinished( ) | rpl::start_with_next([=] { - auto &&waiting = _elements | ranges::view::filter(&Element::waiting); + auto &&waiting = _elements | ranges::views::filter(&Element::waiting); const auto still = ranges::count_if(waiting, [&](Element &element) { if (!element.media) { element.waiting = false; diff --git a/Telegram/SourceFiles/window/window_filters_menu.cpp b/Telegram/SourceFiles/window/window_filters_menu.cpp index be983090b..2ecf02137 100644 --- a/Telegram/SourceFiles/window/window_filters_menu.cpp +++ b/Telegram/SourceFiles/window/window_filters_menu.cpp @@ -371,9 +371,9 @@ void FiltersMenu::applyReorder( Assert(i != end(_filters)); Assert(i->second == widget); - auto order = ranges::view::all( + auto order = ranges::views::all( list - ) | ranges::view::transform( + ) | ranges::views::transform( &Data::ChatFilter::id ) | ranges::to_vector; base::reorder(order, oldPosition, newPosition); diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 2f7b0247a..8c98416c6 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -1067,13 +1067,13 @@ void PeerMenuAddChannelMembers( const QVector &list) { auto already = ( list - ) | ranges::view::transform([](const MTPChannelParticipant &p) { + ) | ranges::views::transform([](const MTPChannelParticipant &p) { return p.match([](const auto &data) { return data.vuser_id().v; }); - }) | ranges::view::transform([&](UserId userId) { + }) | ranges::views::transform([&](UserId userId) { return channel->owner().userLoaded(userId); - }) | ranges::view::filter([](UserData *user) { + }) | ranges::views::filter([](UserData *user) { return (user != nullptr); }) | ranges::to_vector; diff --git a/Telegram/SourceFiles/window/window_title_qt.cpp b/Telegram/SourceFiles/window/window_title_qt.cpp index a5465b9ea..9ca4ac1a8 100644 --- a/Telegram/SourceFiles/window/window_title_qt.cpp +++ b/Telegram/SourceFiles/window/window_title_qt.cpp @@ -189,7 +189,7 @@ void TitleWidgetQt::updateControlsPositionBySide( const std::vector &controls, bool right) { auto preparedControls = right - ? (ranges::view::reverse(controls) | ranges::to_vector) + ? (ranges::views::reverse(controls) | ranges::to_vector) : controls; RemoveDuplicates(preparedControls);