diff --git a/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp b/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp index 488a50a1cc..2904c3fbb4 100644 --- a/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp +++ b/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp @@ -46,8 +46,7 @@ RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const m_destinationFolder = downloadFolder; m_webServiceAddress = webServiceAddress; - - m_progressDialog = new QProgressDialog(this); + m_myProgressDialog = new QProgressDialog(this); m_firstTimeRequestingAuthentication = true; @@ -65,8 +64,6 @@ RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const this, SLOT(sslErrors(QNetworkReply*,QList))); #endif - connect(m_progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); - } //-------------------------------------------------------------------------------------------------- @@ -122,9 +119,6 @@ void RiuWellImportWizard::issueHttpRequestToFile(QString completeUrlText, QStrin return; } - m_progressDialog->setWindowTitle(tr("HTTP")); - m_progressDialog->setLabelText(tr("Downloading %1.").arg(destinationFileName)); - // schedule the request m_httpRequestAborted = false; startRequest(m_url); @@ -153,7 +147,7 @@ void RiuWellImportWizard::httpFinished() m_file = 0; } m_reply->deleteLater(); - m_progressDialog->hide(); + m_myProgressDialog->hide(); return; } @@ -216,7 +210,12 @@ void RiuWellImportWizard::httpFinished() out << singleWellPathContent; } } + + m_myProgressDialog->setLabelText(QString("Downloaded well path : %1").arg(wellPathName)); } + + int newValue = m_myProgressDialog->maximum() - m_wellRequestQueue.size(); + m_myProgressDialog->setValue(newValue); } m_reply->deleteLater(); @@ -248,20 +247,6 @@ void RiuWellImportWizard::httpReadyRead() m_file->write(m_reply->readAll()); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuWellImportWizard::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes) -{ - if (m_httpRequestAborted) - return; - - m_progressDialog->setMaximum(totalBytes); - m_progressDialog->setValue(bytesRead); - -} - - //-------------------------------------------------------------------------------------------------- /// This slot will be called for the first network reply that will need authentication. /// If the authentication is successful, the username/password is cached in the QNetworkAccessManager @@ -324,8 +309,6 @@ void RiuWellImportWizard::startRequest(QUrl url) this, SLOT(httpFinished())); connect(m_reply, SIGNAL(readyRead()), this, SLOT(httpReadyRead())); - connect(m_reply, SIGNAL(downloadProgress(qint64,qint64)), - this, SLOT(updateDataReadProgress(qint64,qint64))); } @@ -421,7 +404,7 @@ void RiuWellImportWizard::downloadWells() } else { - wellRequest = QString("/resinsight/projects/%1/wellsInArea?north=%2&south=%3&east=%4&west=%5&utmZone=32N") + wellRequest = QString("/resinsight/projects/%1/wellsInArea?north=%2&south=%3&east=%4&west=%5&utmzone=32N") .arg(oilField->edmId) .arg(QString::number(m_wellPathImportObject->north, 'g', 10)) .arg(QString::number(m_wellPathImportObject->south, 'g', 10)) @@ -480,6 +463,11 @@ void RiuWellImportWizard::downloadWellPaths() m_currentDownloadState = DOWNLOAD_WELL_PATH; + m_myProgressDialog->setMaximum(m_wellRequestQueue.size()); + m_myProgressDialog->setValue(0); + m_myProgressDialog->show(); + + checkDownloadQueueAndIssueRequests(); } @@ -504,6 +492,8 @@ void RiuWellImportWizard::checkDownloadQueueAndIssueRequests() if (m_currentDownloadState == DOWNLOAD_WELLS) { + m_myProgressDialog->hide(); + // Update UI with downloaded wells for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++) @@ -535,7 +525,7 @@ void RiuWellImportWizard::checkDownloadQueueAndIssueRequests() m_currentDownloadState = DOWNLOAD_UNDEFINED; - m_progressDialog->hide(); + m_myProgressDialog->hide(); } //-------------------------------------------------------------------------------------------------- @@ -884,7 +874,7 @@ void WellSelectionPage::buildWellTreeView() for (size_t fIdx = 0; fIdx < regGroup->objects.size(); fIdx++) { - caf::PdmObjectGroup* fieldGroup = dynamic_cast(regGroup->objects[rIdx]); + caf::PdmObjectGroup* fieldGroup = dynamic_cast(regGroup->objects[fIdx]); if (!fieldGroup) continue; diff --git a/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.h b/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.h index 7beef558fb..aea5bee92e 100644 --- a/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.h +++ b/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.h @@ -167,7 +167,6 @@ public slots: void httpFinished(); void httpReadyRead(); - void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes); void slotAuthenticationRequired(QNetworkReply* networkReply, QAuthenticator* authenticator); @@ -199,7 +198,7 @@ private: RimWellPathImport* m_wellPathImportObject; caf::PdmUiTreeView* m_pdmTreeView; - QProgressDialog* m_progressDialog; + QProgressDialog* m_myProgressDialog; QUrl m_url; QNetworkAccessManager m_networkAccessManager;