mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Simplified ranges::find_if with ranges::any_of and ranges::none_of.
This commit is contained in:
parent
5f238a71f9
commit
e318a7d65f
33 changed files with 71 additions and 105 deletions
|
@ -1811,9 +1811,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
|||
return !session().data().folderLoaded(data.vfolder_id().v);
|
||||
});
|
||||
};
|
||||
const auto allLoaded = ranges::find_if(order, notLoaded)
|
||||
== order.end();
|
||||
if (!allLoaded) {
|
||||
if (!ranges::none_of(order, notLoaded)) {
|
||||
return false;
|
||||
}
|
||||
session().data().applyPinnedChats(folder, order);
|
||||
|
|
|
@ -3578,8 +3578,8 @@ void ApiWrap::addChatParticipants(
|
|||
}).afterDelay(crl::time(5)).send();
|
||||
}
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
const auto bot = ranges::find_if(users, &UserData::isBot);
|
||||
if (!peer->isMegagroup() && bot != end(users)) {
|
||||
const auto hasBot = ranges::any_of(users, &UserData::isBot);
|
||||
if (!peer->isMegagroup() && hasBot) {
|
||||
ShowAddParticipantsError("USER_BOT", peer, users);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -172,8 +172,7 @@ void ShowAddParticipantsError(
|
|||
return;
|
||||
}
|
||||
}
|
||||
const auto bot = ranges::find_if(users, &UserData::isBot);
|
||||
const auto hasBot = (bot != end(users));
|
||||
const auto hasBot = ranges::any_of(users, &UserData::isBot);
|
||||
const auto text = [&] {
|
||||
if (error == qstr("USER_BOT")) {
|
||||
return tr::lng_cant_invite_bot_to_channel(tr::now);
|
||||
|
|
|
@ -172,26 +172,26 @@ void AutoDownloadBox::setupContent() {
|
|||
}) | ranges::view::transform([](Pair pair) {
|
||||
return pair.first;
|
||||
});
|
||||
const auto less = ranges::find_if(*autoPlayValues, [&](Pair pair) {
|
||||
const auto less = ranges::any_of(*autoPlayValues, [&](Pair pair) {
|
||||
const auto [type, enabled] = pair;
|
||||
const auto value = enabled ? limitByType(type) : 0;
|
||||
return value < settings->bytesLimit(_source, type);
|
||||
}) != end(*autoPlayValues);
|
||||
});
|
||||
const auto allowMoreTypes = base::flat_set<Type>(
|
||||
allowMore.begin(),
|
||||
allowMore.end());
|
||||
|
||||
const auto changed = ranges::find_if(values, [&](Pair pair) {
|
||||
const auto changed = ranges::any_of(values, [&](Pair pair) {
|
||||
const auto [type, enabled] = pair;
|
||||
const auto value = enabled ? limitByType(type) : 0;
|
||||
return value != settings->bytesLimit(_source, type);
|
||||
}) != end(values);
|
||||
});
|
||||
|
||||
const auto &kHidden = kStreamedTypes;
|
||||
const auto hiddenChanged = ranges::find_if(kHidden, [&](Type type) {
|
||||
const auto hiddenChanged = ranges::any_of(kHidden, [&](Type type) {
|
||||
const auto now = settings->bytesLimit(_source, type);
|
||||
return (now > 0) && (now != limitByType(type));
|
||||
}) != end(kHidden);
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
for (const auto [type, enabled] : values) {
|
||||
|
@ -216,8 +216,7 @@ void AutoDownloadBox::setupContent() {
|
|||
if (allowMoreTypes.contains(Type::Photo)) {
|
||||
_session->data().photoLoadSettingsChanged();
|
||||
}
|
||||
if (ranges::find_if(allowMoreTypes, _1 != Type::Photo)
|
||||
!= allowMoreTypes.end()) {
|
||||
if (ranges::any_of(allowMoreTypes, _1 != Type::Photo)) {
|
||||
_session->data().documentLoadSettingsChanged();
|
||||
}
|
||||
if (less) {
|
||||
|
|
|
@ -271,14 +271,14 @@ bool ServiceCheck::checkRippleStartPosition(QPoint position) const {
|
|||
if (slug.isEmpty() || slug.size() > kMaxWallPaperSlugLength) {
|
||||
return false;
|
||||
}
|
||||
return ranges::find_if(slug, [](QChar ch) {
|
||||
return ranges::none_of(slug, [](QChar ch) {
|
||||
return (ch != '.')
|
||||
&& (ch != '_')
|
||||
&& (ch != '-')
|
||||
&& (ch < '0' || ch > '9')
|
||||
&& (ch < 'a' || ch > 'z')
|
||||
&& (ch < 'A' || ch > 'Z');
|
||||
}) == slug.end();
|
||||
});
|
||||
}
|
||||
|
||||
AdminLog::OwnedItem GenerateTextItem(
|
||||
|
|
|
@ -678,10 +678,7 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
|
|||
const auto cannotRevoke = [&](HistoryItem *item) {
|
||||
return !item->canDeleteForEveryone(now);
|
||||
};
|
||||
const auto canRevokeAll = ranges::find_if(
|
||||
items,
|
||||
cannotRevoke
|
||||
) == end(items);
|
||||
const auto canRevokeAll = ranges::none_of(items, cannotRevoke);
|
||||
auto outgoing = items | ranges::view::filter(&HistoryItem::out);
|
||||
const auto canRevokeOutgoingCount = canRevokeAll
|
||||
? -1
|
||||
|
|
|
@ -1028,7 +1028,7 @@ void ProxiesBoxController::ShowApplyConfirmation(
|
|||
: QString());
|
||||
*box = Ui::show(Box<ConfirmBox>(text, tr::lng_sure_enable(tr::now), [=] {
|
||||
auto &proxies = Global::RefProxiesList();
|
||||
if (ranges::find(proxies, proxy) == end(proxies)) {
|
||||
if (!ranges::contains(proxies, proxy)) {
|
||||
proxies.push_back(proxy);
|
||||
}
|
||||
Core::App().setCurrentProxy(
|
||||
|
|
|
@ -724,9 +724,8 @@ void Options::removeDestroyed(not_null<Option*> option) {
|
|||
void Options::validateState() {
|
||||
checkLastOption();
|
||||
_hasOptions = (ranges::count_if(_list, &Option::isGood) > 1);
|
||||
_isValid = _hasOptions
|
||||
&& (ranges::find_if(_list, &Option::isTooLong) == end(_list));
|
||||
_hasCorrect = ranges::find_if(_list, &Option::isCorrect) != end(_list);
|
||||
_isValid = _hasOptions && ranges::none_of(_list, &Option::isTooLong);
|
||||
_hasCorrect = ranges::any_of(_list, &Option::isCorrect);
|
||||
|
||||
const auto lastEmpty = !_list.empty() && _list.back()->isEmpty();
|
||||
_usedCount = _list.size() - (lastEmpty ? 1 : 0);
|
||||
|
|
|
@ -485,12 +485,12 @@ void Controller::usernameChanged() {
|
|||
_checkUsernameTimer.cancel();
|
||||
return;
|
||||
}
|
||||
const auto bad = ranges::find_if(username, [](QChar ch) {
|
||||
const auto bad = ranges::any_of(username, [](QChar ch) {
|
||||
return (ch < 'A' || ch > 'Z')
|
||||
&& (ch < 'a' || ch > 'z')
|
||||
&& (ch < '0' || ch > '9')
|
||||
&& (ch != '_');
|
||||
}) != username.end();
|
||||
});
|
||||
if (bad) {
|
||||
showUsernameError(tr::lng_create_channel_link_bad_symbols());
|
||||
} else if (username.size() < kMinUsernameLength) {
|
||||
|
|
|
@ -62,10 +62,7 @@ enum class ButtonType {
|
|||
};
|
||||
|
||||
inline bool CanAddUrls(const QList<QUrl> &urls) {
|
||||
return !urls.isEmpty() && ranges::find_if(
|
||||
urls,
|
||||
[](const QUrl &url) { return !url.isLocalFile(); }
|
||||
) == urls.end();
|
||||
return !urls.isEmpty() && ranges::all_of(urls, &QUrl::isLocalFile);
|
||||
}
|
||||
|
||||
inline bool IsFirstAlbumItem(const Storage::PreparedList &list) {
|
||||
|
|
|
@ -205,7 +205,7 @@ void AppendLegacySuggestions(
|
|||
&& (ch != '-')
|
||||
&& (ch != '+');
|
||||
};
|
||||
if (ranges::find_if(query, badSuggestionChar) != query.end()) {
|
||||
if (ranges::any_of(query, badSuggestionChar)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,8 +101,7 @@ auto SuggestionsWidget::getRowsByQuery() const -> std::vector<Row> {
|
|||
return false;
|
||||
}
|
||||
// Suggest :D and :-P only as exact matches.
|
||||
return ranges::find_if(_query, [](QChar ch) { return ch.isLower(); })
|
||||
== _query.end();
|
||||
return ranges::none_of(_query, [](QChar ch) { return ch.isLower(); });
|
||||
}();
|
||||
const auto exact = !middle || simple;
|
||||
const auto list = Core::App().emojiKeywords().query(real, exact);
|
||||
|
|
|
@ -119,9 +119,9 @@ void EnsurePath() {
|
|||
}
|
||||
|
||||
bool IsGoodPartName(const QString &name) {
|
||||
return ranges::find_if(kDictExtensions, [&](const auto &ext) {
|
||||
return ranges::any_of(kDictExtensions, [&](const auto &ext) {
|
||||
return name.endsWith(ext);
|
||||
}) != end(kDictExtensions);
|
||||
});
|
||||
}
|
||||
|
||||
using DictLoaderPtr = std::shared_ptr<base::unique_qptr<DictLoader>>;
|
||||
|
@ -268,11 +268,10 @@ bool DictionaryExists(int langId) {
|
|||
return true;
|
||||
}
|
||||
const auto folder = DictPathByLangId(langId) + '/';
|
||||
const auto bad = ranges::find_if(kDictExtensions, [&](const auto &ext) {
|
||||
return ranges::none_of(kDictExtensions, [&](const auto &ext) {
|
||||
const auto name = Spellchecker::LocaleFromLangId(langId).name();
|
||||
return !QFile(folder + name + '.' + ext).exists();
|
||||
});
|
||||
return (bad == end(kDictExtensions));
|
||||
}
|
||||
|
||||
bool RemoveDictionary(int langId) {
|
||||
|
|
|
@ -145,8 +145,8 @@ void ChatData::refreshBotStatus() {
|
|||
if (participants.empty()) {
|
||||
botStatus = 0;
|
||||
} else {
|
||||
const auto bot = ranges::find_if(participants, &UserData::isBot);
|
||||
botStatus = (bot == end(participants)) ? -1 : 2;
|
||||
const auto bot = ranges::none_of(participants, &UserData::isBot);
|
||||
botStatus = bot ? -1 : 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1482,7 +1482,7 @@ bool DocumentData::isAudioFile() const {
|
|||
}
|
||||
const auto left = _mimeString.midRef(prefix.size()).toString();
|
||||
const auto types = { qstr("x-wav"), qstr("wav"), qstr("mp4") };
|
||||
return ranges::find(types, left) != end(types);
|
||||
return ranges::contains(types, left);
|
||||
}
|
||||
|
||||
bool DocumentData::isSharedMediaMusic() const {
|
||||
|
|
|
@ -548,10 +548,9 @@ bool Histories::postponeHistoryRequest(const State &state) const {
|
|||
}
|
||||
|
||||
bool Histories::postponeEntryRequest(const State &state) const {
|
||||
const auto i = ranges::find_if(state.sent, [](const auto &pair) {
|
||||
return ranges::any_of(state.sent, [](const auto &pair) {
|
||||
return pair.second.type != RequestType::History;
|
||||
});
|
||||
return (i != end(state.sent));
|
||||
}
|
||||
|
||||
void Histories::deleteMessages(
|
||||
|
|
|
@ -416,7 +416,7 @@ QString PeerData::computeUnavailableReason() const {
|
|||
auto &&filtered = ranges::view::all(
|
||||
list
|
||||
) | ranges::view::filter([&](const Data::UnavailableReason &reason) {
|
||||
return ranges::find(skip, reason.reason) == end(skip);
|
||||
return !ranges::contains(skip, reason.reason);
|
||||
});
|
||||
const auto first = filtered.begin();
|
||||
return (first != filtered.end()) ? first->text : QString();
|
||||
|
|
|
@ -236,7 +236,7 @@ PollData::Flags PollData::flags() const {
|
|||
}
|
||||
|
||||
bool PollData::voted() const {
|
||||
return ranges::find(answers, true, &PollAnswer::chosen) != end(answers);
|
||||
return ranges::contains(answers, true, &PollAnswer::chosen);
|
||||
}
|
||||
|
||||
bool PollData::closed() const {
|
||||
|
|
|
@ -3822,10 +3822,7 @@ void Session::setWallpapers(const QVector<MTPWallPaper> &data, int32 hash) {
|
|||
_wallpapers.push_back(*parsed);
|
||||
}
|
||||
}
|
||||
const auto defaultFound = ranges::find_if(
|
||||
_wallpapers,
|
||||
Data::IsDefaultWallPaper);
|
||||
if (defaultFound == end(_wallpapers)) {
|
||||
if (ranges::none_of(_wallpapers, Data::IsDefaultWallPaper)) {
|
||||
_wallpapers.push_back(Data::DefaultWallPaper());
|
||||
_wallpapers.back().setLocalImageAsThumbnail(std::make_shared<Image>(
|
||||
u":/gui/arg/bg.jpg"_q));
|
||||
|
|
|
@ -51,11 +51,11 @@ std::optional<QColor> MaybeColorFromSerialized(quint32 serialized) {
|
|||
std::optional<QColor> ColorFromString(const QString &string) {
|
||||
if (string.size() != 6) {
|
||||
return {};
|
||||
} else if (ranges::find_if(string, [](QChar ch) {
|
||||
} else if (ranges::any_of(string, [](QChar ch) {
|
||||
return (ch < 'a' || ch > 'f')
|
||||
&& (ch < 'A' || ch > 'F')
|
||||
&& (ch < '0' || ch > '9');
|
||||
}) != string.end()) {
|
||||
})) {
|
||||
return {};
|
||||
}
|
||||
const auto component = [](const QString &text, int index) {
|
||||
|
|
|
@ -245,9 +245,9 @@ void AddPostLinkAction(
|
|||
MessageIdsList ExtractIdsList(const SelectedItems &items) {
|
||||
return ranges::view::all(
|
||||
items
|
||||
) | ranges::view::transform([](const auto &item) {
|
||||
return item.msgId;
|
||||
}) | ranges::to_vector;
|
||||
) | ranges::view::transform(
|
||||
&SelectedItem::msgId
|
||||
) | ranges::to_vector;
|
||||
}
|
||||
|
||||
bool AddForwardSelectedAction(
|
||||
|
@ -257,9 +257,7 @@ bool AddForwardSelectedAction(
|
|||
if (!request.overSelection || request.selectedItems.empty()) {
|
||||
return false;
|
||||
}
|
||||
if (ranges::find_if(request.selectedItems, [](const auto &item) {
|
||||
return !item.canForward;
|
||||
}) != end(request.selectedItems)) {
|
||||
if (!ranges::all_of(request.selectedItems, &SelectedItem::canForward)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -292,9 +290,7 @@ bool AddForwardMessageAction(
|
|||
const auto asGroup = (request.pointState != PointState::GroupPart);
|
||||
if (asGroup) {
|
||||
if (const auto group = owner->groups().find(item)) {
|
||||
if (ranges::find_if(group->items, [](auto item) {
|
||||
return !item->allowsForward();
|
||||
}) != end(group->items)) {
|
||||
if (!ranges::all_of(group->items, &HistoryItem::allowsForward)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -327,9 +323,7 @@ bool AddSendNowSelectedAction(
|
|||
if (!request.overSelection || request.selectedItems.empty()) {
|
||||
return false;
|
||||
}
|
||||
if (ranges::find_if(request.selectedItems, [](const auto &item) {
|
||||
return !item.canSendNow;
|
||||
}) != end(request.selectedItems)) {
|
||||
if (!ranges::all_of(request.selectedItems, &SelectedItem::canSendNow)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -340,9 +334,9 @@ bool AddSendNowSelectedAction(
|
|||
return session->data().message(item.msgId);
|
||||
}) | ranges::view::filter([](HistoryItem *item) {
|
||||
return item != nullptr;
|
||||
}) | ranges::view::transform([](not_null<HistoryItem*> item) {
|
||||
return item->history();
|
||||
});
|
||||
}) | ranges::view::transform(
|
||||
&HistoryItem::history
|
||||
);
|
||||
if (histories.begin() == histories.end()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -376,9 +370,7 @@ bool AddSendNowMessageAction(
|
|||
const auto asGroup = (request.pointState != PointState::GroupPart);
|
||||
if (asGroup) {
|
||||
if (const auto group = owner->groups().find(item)) {
|
||||
if (ranges::find_if(group->items, [](auto item) {
|
||||
return !item->allowsSendNow();
|
||||
}) != end(group->items)) {
|
||||
if (!ranges::all_of(group->items, &HistoryItem::allowsSendNow)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -464,9 +456,7 @@ bool AddDeleteSelectedAction(
|
|||
if (!request.overSelection || request.selectedItems.empty()) {
|
||||
return false;
|
||||
}
|
||||
if (ranges::find_if(request.selectedItems, [](const auto &item) {
|
||||
return !item.canDelete;
|
||||
}) != end(request.selectedItems)) {
|
||||
if (!ranges::all_of(request.selectedItems, &SelectedItem::canDelete)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -499,10 +489,10 @@ bool AddDeleteMessageAction(
|
|||
const auto asGroup = (request.pointState != PointState::GroupPart);
|
||||
if (asGroup) {
|
||||
if (const auto group = owner->groups().find(item)) {
|
||||
if (ranges::find_if(group->items, [](auto item) {
|
||||
if (ranges::any_of(group->items, [](auto item) {
|
||||
const auto id = ItemIdAcrossData(item);
|
||||
return !IsServerMsgId(id) || !item->canDelete();
|
||||
}) != end(group->items)) {
|
||||
})) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -480,10 +480,7 @@ void TopBar::createSelectionControls() {
|
|||
}
|
||||
|
||||
bool TopBar::computeCanDelete() const {
|
||||
return ranges::find_if(
|
||||
_selectedItems.list,
|
||||
[](const SelectedItem &item) { return !item.canDelete; }
|
||||
) == _selectedItems.list.end();
|
||||
return ranges::all_of(_selectedItems.list, &SelectedItem::canDelete);
|
||||
}
|
||||
|
||||
Ui::StringWithNumbers TopBar::generateSelectedText() const {
|
||||
|
|
|
@ -1280,14 +1280,14 @@ void ListWidget::showContextMenu(
|
|||
}
|
||||
|
||||
auto canDeleteAll = [&] {
|
||||
return ranges::find_if(_selected, [](auto &&item) {
|
||||
return ranges::none_of(_selected, [](auto &&item) {
|
||||
return !item.second.canDelete;
|
||||
}) == _selected.end();
|
||||
});
|
||||
};
|
||||
auto canForwardAll = [&] {
|
||||
return ranges::find_if(_selected, [](auto &&item) {
|
||||
return ranges::none_of(_selected, [](auto &&item) {
|
||||
return !item.second.canForward;
|
||||
}) == _selected.end();
|
||||
});
|
||||
};
|
||||
|
||||
auto link = ClickHandler::getActive();
|
||||
|
|
|
@ -514,10 +514,9 @@ bool Reader::Slices::checkFullInCache() const {
|
|||
if (isFullInHeader()) {
|
||||
return (_header.flags & Flag::FullInCache);
|
||||
}
|
||||
const auto i = ranges::find_if(_data, [](const Slice &slice) {
|
||||
return ranges::none_of(_data, [](const Slice &slice) {
|
||||
return !(slice.flags & Flag::FullInCache);
|
||||
});
|
||||
return (i == end(_data));
|
||||
}
|
||||
|
||||
void Reader::Slices::processPart(
|
||||
|
|
|
@ -742,7 +742,7 @@ void DcOptions::FilterIfHasWithFlag(Variants &variants, Flag flag) {
|
|||
return (endpoint.flags & flag) != 0;
|
||||
};
|
||||
const auto has = [&](const std::vector<Endpoint> &list) {
|
||||
return ranges::find_if(list, is) != end(list);
|
||||
return ranges::any_of(list, is);
|
||||
};
|
||||
for (auto &byAddress : variants.data) {
|
||||
for (auto &list : byAddress) {
|
||||
|
|
|
@ -502,15 +502,15 @@ bool Value::uploadingScan() const {
|
|||
};
|
||||
const auto uploadingInList = [&](FileType type) {
|
||||
const auto &list = filesInEdit(type);
|
||||
return ranges::find_if(list, uploading) != end(list);
|
||||
return ranges::any_of(list, uploading);
|
||||
};
|
||||
if (uploadingInList(FileType::Scan)
|
||||
|| uploadingInList(FileType::Translation)) {
|
||||
return true;
|
||||
}
|
||||
if (ranges::find_if(specialScansInEdit, [&](const auto &pair) {
|
||||
if (ranges::any_of(specialScansInEdit, [&](const auto &pair) {
|
||||
return uploading(pair.second);
|
||||
}) != end(specialScansInEdit)) {
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -73,15 +73,14 @@ bool InlineDetails(
|
|||
if (count != 1) {
|
||||
return false;
|
||||
}
|
||||
const auto has = ranges::find_if(
|
||||
return ranges::any_of(
|
||||
request,
|
||||
[&](const std::vector<Value::Type> &types) {
|
||||
Expects(!types.empty());
|
||||
|
||||
return (types[0] == details);
|
||||
}
|
||||
) != end(request);
|
||||
return has;
|
||||
);
|
||||
}
|
||||
|
||||
bool InlineDetails(const Form::Request &request, Value::Type details) {
|
||||
|
|
|
@ -186,16 +186,15 @@ bool EditScans::List::uploadMoreRequired() const {
|
|||
if (!upload) {
|
||||
return false;
|
||||
}
|
||||
const auto exists = ranges::find_if(
|
||||
const auto exists = ranges::any_of(
|
||||
files,
|
||||
[](const ScanInfo &file) { return !file.deleted; }) != end(files);
|
||||
[](const ScanInfo &file) { return !file.deleted; });
|
||||
if (!exists) {
|
||||
return true;
|
||||
}
|
||||
const auto errorExists = ranges::find_if(
|
||||
const auto errorExists = ranges::any_of(
|
||||
files,
|
||||
[](const ScanInfo &file) { return !file.error.isEmpty(); }
|
||||
) != end(files);
|
||||
[](const ScanInfo &file) { return !file.error.isEmpty(); });
|
||||
return (errorExists || uploadMoreError) && !uploadedSomeMore();
|
||||
}
|
||||
|
||||
|
|
|
@ -879,9 +879,9 @@ bool OpenSystemSettings(SystemSettingsType type) {
|
|||
add("pavucontrol-qt");
|
||||
add("pavucontrol");
|
||||
add("alsamixergui");
|
||||
return ranges::find_if(options, [](const QString &command) {
|
||||
return ranges::any_of(options, [](const QString &command) {
|
||||
return QProcess::startDetached(command);
|
||||
}) != end(options);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -805,7 +805,7 @@ void AppendEmojiPacks(
|
|||
};
|
||||
|
||||
const auto checkState = [&](const auto &states) {
|
||||
return ranges::find(states, gesture.state) != end(states);
|
||||
return ranges::contains(states, gesture.state);
|
||||
};
|
||||
|
||||
if (checkState(kGestureStateProcessed)) {
|
||||
|
|
|
@ -240,9 +240,9 @@ void CodesFeedString(SessionController *window, const QString &text) {
|
|||
}
|
||||
if (found) break;
|
||||
|
||||
found = ranges::find_if(codes, [&](const auto &pair) {
|
||||
found = ranges::any_of(codes, [&](const auto &pair) {
|
||||
return pair.first.startsWith(piece);
|
||||
}) != end(codes);
|
||||
});
|
||||
if (found) break;
|
||||
|
||||
++from;
|
||||
|
|
|
@ -268,11 +268,11 @@ void DownloadManagerMtproto::requestSucceeded(
|
|||
).arg(data.maxWaitedAmount));
|
||||
}
|
||||
data.successes = std::min(data.successes + 1, kMaxTrackedSuccesses);
|
||||
const auto notEnough = ranges::find_if(
|
||||
const auto notEnough = ranges::any_of(
|
||||
dc.sessions,
|
||||
_1 < (dc.sessionRemoveTimes + 1) * kRetryAddSessionSuccesses,
|
||||
&DcSessionBalanceData::successes);
|
||||
if (notEnough != end(dc.sessions)) {
|
||||
if (notEnough) {
|
||||
return;
|
||||
}
|
||||
for (auto &session : dc.sessions) {
|
||||
|
|
|
@ -400,13 +400,12 @@ bool CopyColorsToPalette(
|
|||
if (slug.size() < kMinSlugSize || slug.size() > kMaxSlugSize) {
|
||||
return false;
|
||||
}
|
||||
const auto i = ranges::find_if(slug, [](QChar ch) {
|
||||
return ranges::none_of(slug, [](QChar ch) {
|
||||
return (ch < 'A' || ch > 'Z')
|
||||
&& (ch < 'a' || ch > 'z')
|
||||
&& (ch < '0' || ch > '9')
|
||||
&& (ch != '_');
|
||||
});
|
||||
return (i == slug.end());
|
||||
}
|
||||
|
||||
SendMediaReady PrepareThemeMedia(
|
||||
|
|
Loading…
Add table
Reference in a new issue