@@ -3,8 +3,6 | |||
|
3 | 3 | |
|
4 | 4 | #include "AmdaGlobal.h" |
|
5 | 5 | |
|
6 | #include <Common/spimpl.h> | |
|
7 | ||
|
8 | 6 | #include <Data/IDataProvider.h> |
|
9 | 7 | |
|
10 | 8 | #include <QLoggingCategory> |
@@ -25,14 +23,6 public: | |||
|
25 | 23 | |
|
26 | 24 | private: |
|
27 | 25 | void retrieveData(QUuid token, const SqpDateTime &dateTime); |
|
28 | ||
|
29 | class AmdaProviderPrivate; | |
|
30 | spimpl::unique_impl_ptr<AmdaProviderPrivate> impl; | |
|
31 | ||
|
32 | // private slots: | |
|
33 | // void httpFinished(QNetworkReply *reply, QUuid dataId) noexcept; | |
|
34 | // void httpDownloadFinished(QNetworkReply *reply, QUuid dataId) noexcept; | |
|
35 | // void httpDownloadReadyRead(QNetworkReply *reply, QUuid dataId) noexcept; | |
|
36 | 26 | }; |
|
37 | 27 | |
|
38 | 28 | #endif // SCIQLOP_AMDAPROVIDER_H |
@@ -34,18 +34,9 QString dateFormat(double sqpDateTime) noexcept | |||
|
34 | 34 | return dateTime.toString(AMDA_TIME_FORMAT); |
|
35 | 35 | } |
|
36 | 36 | |
|
37 | ||
|
38 | 37 | } // namespace |
|
39 | 38 | |
|
40 |
|
|
|
41 | SqpDateTime m_DateTime{}; | |
|
42 | std::unique_ptr<QNetworkAccessManager> m_AccessManager{nullptr}; | |
|
43 | QNetworkReply *m_Reply{nullptr}; | |
|
44 | // std::unique_ptr<QTemporaryFile> m_File{nullptr}; | |
|
45 | QUuid m_Token; | |
|
46 | }; | |
|
47 | ||
|
48 | AmdaProvider::AmdaProvider() : impl{spimpl::make_unique_impl<AmdaProviderPrivate>()} | |
|
39 | AmdaProvider::AmdaProvider() | |
|
49 | 40 | { |
|
50 | 41 | qCDebug(LOG_NetworkController()) << tr("AmdaProvider::AmdaProvider") |
|
51 | 42 | << QThread::currentThread(); |
@@ -79,9 +70,10 void AmdaProvider::retrieveData(QUuid token, const SqpDateTime &dateTime) | |||
|
79 | 70 | |
|
80 | 71 | auto tempFile = std::make_shared<QTemporaryFile>(); |
|
81 | 72 | |
|
82 | ||
|
83 | 73 | // LAMBDA |
|
84 | auto httpDownloadFinished = [this, tempFile](QNetworkReply *reply, QUuid dataId) noexcept { | |
|
74 | auto httpDownloadFinished | |
|
75 | = [this, dateTime, tempFile, token](QNetworkReply *reply, QUuid dataId) noexcept { | |
|
76 | Q_UNUSED(dataId); | |
|
85 | 77 | |
|
86 | 78 | if (tempFile) { |
|
87 | 79 | auto replyReadAll = reply->readAll(); |
@@ -92,7 +84,7 void AmdaProvider::retrieveData(QUuid token, const SqpDateTime &dateTime) | |||
|
92 | 84 | |
|
93 | 85 | // Parse results file |
|
94 | 86 | if (auto dataSeries = AmdaResultParser::readTxt(tempFile->fileName())) { |
|
95 |
emit dataProvided( |
|
|
87 | emit dataProvided(token, dataSeries, dateTime); | |
|
96 | 88 | } |
|
97 | 89 | else { |
|
98 | 90 | /// @todo ALX : debug |
@@ -122,8 +114,5 void AmdaProvider::retrieveData(QUuid token, const SqpDateTime &dateTime) | |||
|
122 | 114 | // //////////////// // |
|
123 | 115 | // Executes request // |
|
124 | 116 | // //////////////// // |
|
125 | ||
|
126 | impl->m_Token = token; | |
|
127 | impl->m_DateTime = dateTime; | |
|
128 | 117 | emit requestConstructed(QNetworkRequest{url}, token, httpFinishedLambda); |
|
129 | 118 | } |
General Comments 0
You need to be logged in to leave comments.
Login now