2013-09-02 01:39:29 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QWizard>
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QItemSelection>
|
|
|
|
|
|
|
|
class QFile;
|
|
|
|
class QProgressDialog;
|
|
|
|
class QLabel;
|
2013-09-04 01:03:11 -05:00
|
|
|
class QTextEdit;
|
2013-09-02 01:39:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
class RimWellPathImport;
|
2013-09-04 01:03:11 -05:00
|
|
|
class RimWellCollection;
|
2013-09-02 01:39:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
class UiTreeModelPdm;
|
|
|
|
class PdmUiTreeView;
|
2013-09-05 00:34:04 -05:00
|
|
|
class PdmUiListView;
|
|
|
|
class PdmObjectGroup;
|
2013-09-02 01:39:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class IntroPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
IntroPage(const QString& webServiceAddress, QWidget *parent = 0);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class FieldSelectionPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-09-05 00:34:04 -05:00
|
|
|
FieldSelectionPage(RimWellPathImport* wellPathImport, caf::PdmUiTreeView* pdmUiTreeView, QWidget* parent = 0);
|
2013-09-02 01:39:29 -05:00
|
|
|
|
|
|
|
virtual void initializePage();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-09-04 01:03:11 -05:00
|
|
|
class WellSelectionPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
WellSelectionPage(RimWellPathImport* wellPathImport, QWidget* parent = 0);
|
|
|
|
|
|
|
|
virtual void initializePage();
|
|
|
|
|
|
|
|
private:
|
|
|
|
caf::PdmUiTreeView* m_wellSelectionTreeView;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class WellSummaryPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
WellSummaryPage(RimWellPathImport* wellPathImport, QWidget* parent = 0);
|
|
|
|
|
|
|
|
virtual void initializePage();
|
|
|
|
|
|
|
|
void updateSummaryPage();
|
|
|
|
|
|
|
|
private:
|
|
|
|
RimWellPathImport* m_wellPathImportObject;
|
|
|
|
QTextEdit* m_textEdit;
|
2013-09-05 00:34:04 -05:00
|
|
|
caf::PdmUiListView* m_listView;
|
|
|
|
caf::PdmObjectGroup*m_objectGroup;
|
2013-09-04 01:03:11 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DownloadEntity
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QString requestUrl;
|
|
|
|
QString responseFilename;
|
|
|
|
};
|
2013-09-02 01:39:29 -05:00
|
|
|
|
|
|
|
class RiuWellImportWizard : public QWizard
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum DownloadState{ DOWNLOAD_FIELDS, DOWNLOAD_WELLS, DOWNLOAD_WELL_PATH, DOWNLOAD_UNDEFINED};
|
|
|
|
|
|
|
|
public:
|
|
|
|
RiuWellImportWizard(const QString& webServiceAddress, const QString& downloadFolder, RimWellPathImport* wellPathImportObject, QWidget *parent = 0);
|
2013-09-04 01:03:11 -05:00
|
|
|
~RiuWellImportWizard();
|
2013-09-02 01:39:29 -05:00
|
|
|
|
|
|
|
void setWebServiceAddress(const QString& wsAdress);
|
|
|
|
void setJsonDestinationFolder(const QString& folder);
|
|
|
|
void setWellPathImportObject(RimWellPathImport* wellPathImportObject);
|
|
|
|
|
2013-09-04 01:03:11 -05:00
|
|
|
RimWellCollection* wellCollection();
|
|
|
|
|
2013-09-02 01:39:29 -05:00
|
|
|
private:
|
|
|
|
void startRequest(QUrl url);
|
|
|
|
void setUrl(const QString& httpAddress);
|
|
|
|
|
|
|
|
QString jsonFieldsFilePath();
|
|
|
|
QString jsonWellsFilePath();
|
|
|
|
|
|
|
|
void updateFieldsModel();
|
|
|
|
|
|
|
|
QString getValue(const QString& key, const QString& stringContent);
|
|
|
|
|
|
|
|
void getWellPathLinks(QStringList* surveyLinks, QStringList* planLinks);
|
|
|
|
void issueDownloadOfWellPaths(const QStringList& surveyLinks, const QStringList& planLinks);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void downloadWellPaths();
|
2013-09-04 01:03:11 -05:00
|
|
|
void downloadWells();
|
2013-09-02 01:39:29 -05:00
|
|
|
void downloadFields();
|
|
|
|
void checkDownloadQueueAndIssueRequests();
|
2013-09-04 01:03:11 -05:00
|
|
|
|
|
|
|
void checkDownloadQueueAndIssueRequests_v2();
|
2013-09-02 01:39:29 -05:00
|
|
|
|
|
|
|
void issueHttpRequestToFile( QString completeUrlText, QString destinationFileName );
|
|
|
|
void cancelDownload();
|
|
|
|
void httpFinished();
|
|
|
|
|
|
|
|
void httpReadyRead();
|
|
|
|
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
|
|
|
|
void refreshButtonStatus();
|
|
|
|
void slotAuthenticationRequired(QNetworkReply* networkReply, QAuthenticator* authenticator);
|
|
|
|
|
|
|
|
void slotSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef QT_NO_OPENSSL
|
|
|
|
void sslErrors(QNetworkReply*,const QList<QSslError> &errors);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_webServiceAddress;
|
|
|
|
QString m_destinationFolder;
|
|
|
|
|
|
|
|
RimWellPathImport* m_wellPathImport;
|
|
|
|
caf::PdmUiTreeView* m_pdmTreeView;
|
|
|
|
|
2013-09-04 01:03:11 -05:00
|
|
|
RimWellCollection* m_wellCollection;
|
|
|
|
|
2013-09-02 01:39:29 -05:00
|
|
|
QProgressDialog* m_progressDialog;
|
|
|
|
|
|
|
|
QUrl m_url;
|
|
|
|
QNetworkAccessManager m_networkAccessManager;
|
|
|
|
QNetworkReply* m_reply;
|
|
|
|
QFile* m_file;
|
|
|
|
bool m_httpRequestAborted;
|
|
|
|
|
|
|
|
|
2013-09-04 01:03:11 -05:00
|
|
|
QStringList m_wellPathRequestQueue;
|
|
|
|
QList<DownloadEntity> m_wellRequestQueue;
|
2013-09-02 01:39:29 -05:00
|
|
|
|
|
|
|
DownloadState m_currentDownloadState;
|
|
|
|
|
|
|
|
|
|
|
|
// To be deleted
|
|
|
|
QLabel* m_statusLabel;
|
|
|
|
|
2013-09-04 01:03:11 -05:00
|
|
|
int m_wellSummaryPageId;
|
|
|
|
|
2013-09-02 01:39:29 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|