##// END OF EJS Templates
Add implementation of abort impact on Amda plugin
perrinel -
r431:716a6a462efc
parent child
Show More
@@ -98,38 +98,45 void AmdaProvider::retrieveData(QUuid token, const SqpDateTime &dateTime, const
98 98 = [this, dateTime, tempFile, token](QNetworkReply *reply, QUuid dataId) noexcept {
99 99 Q_UNUSED(dataId);
100 100
101 if (tempFile) {
102 auto replyReadAll = reply->readAll();
103 if (!replyReadAll.isEmpty()) {
104 tempFile->write(replyReadAll);
105 }
106 tempFile->close();
107
108 // Parse results file
109 if (auto dataSeries = AmdaResultParser::readTxt(tempFile->fileName())) {
110 emit dataProvided(token, dataSeries, dateTime);
111 }
112 else {
113 /// @todo ALX : debug
101 // Don't do anything if the reply was abort
102 if (reply->error() != QNetworkReply::OperationCanceledError) {
103
104 if (tempFile) {
105 auto replyReadAll = reply->readAll();
106 if (!replyReadAll.isEmpty()) {
107 tempFile->write(replyReadAll);
108 }
109 tempFile->close();
110
111 // Parse results file
112 if (auto dataSeries = AmdaResultParser::readTxt(tempFile->fileName())) {
113 emit dataProvided(token, dataSeries, dateTime);
114 }
115 else {
116 /// @todo ALX : debug
117 }
114 118 }
115 119 }
116 120
117
118 121 };
119 auto httpFinishedLambda = [this, httpDownloadFinished, tempFile](QNetworkReply *reply,
120 QUuid dataId) noexcept {
122 auto httpFinishedLambda
123 = [this, httpDownloadFinished, tempFile](QNetworkReply *reply, QUuid dataId) noexcept {
121 124
122 auto downloadFileUrl = QUrl{QString{reply->readAll()}};
125 // Don't do anything if the reply was abort
126 if (reply->error() != QNetworkReply::OperationCanceledError) {
127 auto downloadFileUrl = QUrl{QString{reply->readAll()}};
123 128
124 129
125 // Executes request for downloading file //
130 // Executes request for downloading file //
126 131
127 // Creates destination file
128 if (tempFile->open()) {
129 // Executes request
130 emit requestConstructed(QNetworkRequest{downloadFileUrl}, dataId, httpDownloadFinished);
131 }
132 };
132 // Creates destination file
133 if (tempFile->open()) {
134 // Executes request
135 emit requestConstructed(QNetworkRequest{downloadFileUrl}, dataId,
136 httpDownloadFinished);
137 }
138 }
139 };
133 140
134 141 // //////////////// //
135 142 // Executes request //
General Comments 0
You need to be logged in to leave comments. Login now