##// 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 = [this, dateTime, tempFile, token](QNetworkReply *reply, QUuid dataId) noexcept {
98 = [this, dateTime, tempFile, token](QNetworkReply *reply, QUuid dataId) noexcept {
99 Q_UNUSED(dataId);
99 Q_UNUSED(dataId);
100
100
101 if (tempFile) {
101 // Don't do anything if the reply was abort
102 auto replyReadAll = reply->readAll();
102 if (reply->error() != QNetworkReply::OperationCanceledError) {
103 if (!replyReadAll.isEmpty()) {
103
104 tempFile->write(replyReadAll);
104 if (tempFile) {
105 }
105 auto replyReadAll = reply->readAll();
106 tempFile->close();
106 if (!replyReadAll.isEmpty()) {
107
107 tempFile->write(replyReadAll);
108 // Parse results file
108 }
109 if (auto dataSeries = AmdaResultParser::readTxt(tempFile->fileName())) {
109 tempFile->close();
110 emit dataProvided(token, dataSeries, dateTime);
110
111 }
111 // Parse results file
112 else {
112 if (auto dataSeries = AmdaResultParser::readTxt(tempFile->fileName())) {
113 /// @todo ALX : debug
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,
122 auto httpFinishedLambda
120 QUuid dataId) noexcept {
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
132 // Creates destination file
128 if (tempFile->open()) {
133 if (tempFile->open()) {
129 // Executes request
134 // Executes request
130 emit requestConstructed(QNetworkRequest{downloadFileUrl}, dataId, httpDownloadFinished);
135 emit requestConstructed(QNetworkRequest{downloadFileUrl}, dataId,
131 }
136 httpDownloadFinished);
132 };
137 }
138 }
139 };
133
140
134 // //////////////// //
141 // //////////////// //
135 // Executes request //
142 // Executes request //
General Comments 0
You need to be logged in to leave comments. Login now