Use lowercase in 'utmzone' when asking for wells in area

Show one progress dialog when downloading well paths
This commit is contained in:
Magne Sjaastad 2013-09-26 13:54:57 +02:00
parent 24822a611e
commit c30d3bb27e
2 changed files with 18 additions and 29 deletions

View File

@ -46,8 +46,7 @@ RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const
m_destinationFolder = downloadFolder; m_destinationFolder = downloadFolder;
m_webServiceAddress = webServiceAddress; m_webServiceAddress = webServiceAddress;
m_myProgressDialog = new QProgressDialog(this);
m_progressDialog = new QProgressDialog(this);
m_firstTimeRequestingAuthentication = true; m_firstTimeRequestingAuthentication = true;
@ -65,8 +64,6 @@ RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const
this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>))); this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif #endif
connect(m_progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -122,9 +119,6 @@ void RiuWellImportWizard::issueHttpRequestToFile(QString completeUrlText, QStrin
return; return;
} }
m_progressDialog->setWindowTitle(tr("HTTP"));
m_progressDialog->setLabelText(tr("Downloading %1.").arg(destinationFileName));
// schedule the request // schedule the request
m_httpRequestAborted = false; m_httpRequestAborted = false;
startRequest(m_url); startRequest(m_url);
@ -153,7 +147,7 @@ void RiuWellImportWizard::httpFinished()
m_file = 0; m_file = 0;
} }
m_reply->deleteLater(); m_reply->deleteLater();
m_progressDialog->hide(); m_myProgressDialog->hide();
return; return;
} }
@ -216,7 +210,12 @@ void RiuWellImportWizard::httpFinished()
out << singleWellPathContent; 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(); m_reply->deleteLater();
@ -248,20 +247,6 @@ void RiuWellImportWizard::httpReadyRead()
m_file->write(m_reply->readAll()); 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. /// 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 /// 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())); this, SLOT(httpFinished()));
connect(m_reply, SIGNAL(readyRead()), connect(m_reply, SIGNAL(readyRead()),
this, SLOT(httpReadyRead())); this, SLOT(httpReadyRead()));
connect(m_reply, SIGNAL(downloadProgress(qint64,qint64)),
this, SLOT(updateDataReadProgress(qint64,qint64)));
} }
@ -421,7 +404,7 @@ void RiuWellImportWizard::downloadWells()
} }
else 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(oilField->edmId)
.arg(QString::number(m_wellPathImportObject->north, 'g', 10)) .arg(QString::number(m_wellPathImportObject->north, 'g', 10))
.arg(QString::number(m_wellPathImportObject->south, 'g', 10)) .arg(QString::number(m_wellPathImportObject->south, 'g', 10))
@ -480,6 +463,11 @@ void RiuWellImportWizard::downloadWellPaths()
m_currentDownloadState = DOWNLOAD_WELL_PATH; m_currentDownloadState = DOWNLOAD_WELL_PATH;
m_myProgressDialog->setMaximum(m_wellRequestQueue.size());
m_myProgressDialog->setValue(0);
m_myProgressDialog->show();
checkDownloadQueueAndIssueRequests(); checkDownloadQueueAndIssueRequests();
} }
@ -504,6 +492,8 @@ void RiuWellImportWizard::checkDownloadQueueAndIssueRequests()
if (m_currentDownloadState == DOWNLOAD_WELLS) if (m_currentDownloadState == DOWNLOAD_WELLS)
{ {
m_myProgressDialog->hide();
// Update UI with downloaded wells // Update UI with downloaded wells
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++) for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
@ -535,7 +525,7 @@ void RiuWellImportWizard::checkDownloadQueueAndIssueRequests()
m_currentDownloadState = DOWNLOAD_UNDEFINED; 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++) for (size_t fIdx = 0; fIdx < regGroup->objects.size(); fIdx++)
{ {
caf::PdmObjectGroup* fieldGroup = dynamic_cast<caf::PdmObjectGroup*>(regGroup->objects[rIdx]); caf::PdmObjectGroup* fieldGroup = dynamic_cast<caf::PdmObjectGroup*>(regGroup->objects[fIdx]);
if (!fieldGroup) if (!fieldGroup)
continue; continue;

View File

@ -167,7 +167,6 @@ public slots:
void httpFinished(); void httpFinished();
void httpReadyRead(); void httpReadyRead();
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
void slotAuthenticationRequired(QNetworkReply* networkReply, QAuthenticator* authenticator); void slotAuthenticationRequired(QNetworkReply* networkReply, QAuthenticator* authenticator);
@ -199,7 +198,7 @@ private:
RimWellPathImport* m_wellPathImportObject; RimWellPathImport* m_wellPathImportObject;
caf::PdmUiTreeView* m_pdmTreeView; caf::PdmUiTreeView* m_pdmTreeView;
QProgressDialog* m_progressDialog; QProgressDialog* m_myProgressDialog;
QUrl m_url; QUrl m_url;
QNetworkAccessManager m_networkAccessManager; QNetworkAccessManager m_networkAccessManager;