File indexing completed on 2024-12-22 04:57:53

0001 /*
0002     SPDX-License-Identifier: BSD-2-Clause
0003 */
0004 
0005 #include "o2/o1timedreply.h"
0006 
0007 O1TimedReply::O1TimedReply(QNetworkReply *parent, int pTimeout)
0008     : QTimer(parent)
0009 {
0010     setSingleShot(true);
0011     setInterval(pTimeout);
0012     connect(this, &QTimer::timeout, this, &O1TimedReply::onTimeout);
0013     connect(parent, &QNetworkReply::finished, this, &O1TimedReply::onFinished);
0014 }
0015 
0016 void O1TimedReply::onFinished()
0017 {
0018     stop();
0019     Q_EMIT finished();
0020 }
0021 
0022 void O1TimedReply::onTimeout()
0023 {
0024     Q_EMIT error(QNetworkReply::TimeoutError);
0025 }
0026 
0027 #include "moc_o1timedreply.cpp"