Get rid of deprecated ranges::view usage
This commit is contained in:
parent
03f8ab361f
commit
c74cf04cc6
5 changed files with 15 additions and 15 deletions
|
|
@ -323,12 +323,12 @@ std::vector<QImage> LoadSprites(int id) {
|
|||
? internal::SetDataPath(id) + '/'
|
||||
: QStringLiteral(":/gui/emoji/");
|
||||
const auto base = folder + "emoji_";
|
||||
return ranges::view::ints(
|
||||
return ranges::views::ints(
|
||||
0,
|
||||
SpritesCount
|
||||
) | ranges::view::transform([&](int index) {
|
||||
) | ranges::views::transform([&](int index) {
|
||||
return base + QString::number(index + 1) + ".webp";
|
||||
}) | ranges::view::transform([](const QString &path) {
|
||||
}) | ranges::views::transform([](const QString &path) {
|
||||
return QImage(path, "WEBP").convertToFormat(
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
}) | ranges::to_vector;
|
||||
|
|
@ -343,15 +343,15 @@ std::vector<QImage> LoadAndValidateSprites(int id) {
|
|||
return {};
|
||||
}
|
||||
auto result = LoadSprites(id);
|
||||
const auto sizes = ranges::view::ints(
|
||||
const auto sizes = ranges::views::ints(
|
||||
0,
|
||||
SpritesCount
|
||||
) | ranges::view::transform([](int index) {
|
||||
) | ranges::views::transform([](int index) {
|
||||
return QSize(
|
||||
kImagesPerRow * kUniversalSize,
|
||||
RowsCount(index) * kUniversalSize);
|
||||
});
|
||||
const auto good = ranges::view::zip_with(
|
||||
const auto good = ranges::views::zip_with(
|
||||
[](const QImage &data, QSize size) { return data.size() == size; },
|
||||
result,
|
||||
sizes);
|
||||
|
|
@ -588,10 +588,10 @@ bool SetIsReady(int id) {
|
|||
return true;
|
||||
}
|
||||
const auto folder = internal::SetDataPath(id) + '/';
|
||||
auto names = ranges::view::ints(
|
||||
auto names = ranges::views::ints(
|
||||
0,
|
||||
SpritesCount + 1
|
||||
) | ranges::view::transform([](int index) {
|
||||
) | ranges::views::transform([](int index) {
|
||||
return index
|
||||
? "emoji_" + QString::number(index) + ".webp"
|
||||
: QString("config.json");
|
||||
|
|
|
|||
|
|
@ -274,8 +274,8 @@ QImage BlurLargeImage(QImage image, int radius) {
|
|||
const auto rgb = take(widthxheight * 3).data();
|
||||
const auto dvs = take(dvcount);
|
||||
|
||||
auto &&ints = ranges::view::ints;
|
||||
for (auto &&[value, index] : ranges::view::zip(dvs, ints(0, ranges::unreachable))) {
|
||||
auto &&ints = ranges::views::ints;
|
||||
for (auto &&[value, index] : ranges::views::zip(dvs, ints(0, ranges::unreachable))) {
|
||||
value = (index / divsum);
|
||||
}
|
||||
const auto dv = dvs.data();
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ float ArcsAnimation::width() const {
|
|||
if (_arcs.empty()) {
|
||||
return 0;
|
||||
}
|
||||
for (const auto &arc : ranges::view::reverse(_arcs)) {
|
||||
for (const auto &arc : ranges::views::reverse(_arcs)) {
|
||||
if ((arc.progress != 1.)) {
|
||||
return arc.rect.x() + arc.rect.width();
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ float ArcsAnimation::finishedWidth() const {
|
|||
if (_arcs.empty()) {
|
||||
return 0;
|
||||
}
|
||||
for (const auto &arc : ranges::view::reverse(_arcs)) {
|
||||
for (const auto &arc : ranges::views::reverse(_arcs)) {
|
||||
if (arc.threshold <= _currentValue) {
|
||||
return arc.rect.x() + arc.rect.width();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ void TitleControls::updateControlsPositionBySide(
|
|||
const std::vector<Control> &controls,
|
||||
bool right) {
|
||||
auto preparedControls = right
|
||||
? (ranges::view::reverse(controls) | ranges::to_vector)
|
||||
? (ranges::views::reverse(controls) | ranges::to_vector)
|
||||
: controls;
|
||||
|
||||
RemoveDuplicates(preparedControls);
|
||||
|
|
|
|||
|
|
@ -1146,7 +1146,7 @@ const QRegularExpression &RegExpWordSplit() {
|
|||
auto &&urls = ranges::make_subrange(
|
||||
entities.begin(),
|
||||
entities.end()
|
||||
) | ranges::view::filter([](const EntityInText &entity) {
|
||||
) | ranges::views::filter([](const EntityInText &entity) {
|
||||
return entity.type() == EntityType::CustomUrl;
|
||||
});
|
||||
const auto &original = text.text;
|
||||
|
|
@ -2146,7 +2146,7 @@ int EntityInText::FirstMonospaceOffset(
|
|||
auto &&monospace = ranges::make_subrange(
|
||||
entities.begin(),
|
||||
entities.end()
|
||||
) | ranges::view::filter([](const EntityInText & entity) {
|
||||
) | ranges::views::filter([](const EntityInText & entity) {
|
||||
return (entity.type() == EntityType::Pre)
|
||||
|| (entity.type() == EntityType::Code);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue