File indexing completed on 2024-05-12 04:42:39

0001 /*
0002     SPDX-FileCopyrightText: 2024 Jonah BrĂ¼chert <jbb@kaidan.im>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "networkreplycollection.h"
0008 
0009 NetworkReplyCollection::NetworkReplyCollection(std::vector<QNetworkReply *> replies, QObject *parent)
0010     : QObject(parent)
0011 {
0012     m_replies = std::move(replies);
0013 
0014     QMetaObject::invokeMethod(this, &NetworkReplyCollection::checkFinished, Qt::QueuedConnection);
0015 
0016     for (auto *reply : m_replies) {
0017         connect(reply, &QNetworkReply::finished, this, &NetworkReplyCollection::checkFinished);
0018         connect(reply, &QNetworkReply::errorOccurred, this, [reply, this](auto error) {
0019             Q_EMIT errorOccured(reply, error);
0020         });
0021     }
0022 }