-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for well paths from OSDU.
- Loading branch information
Showing
33 changed files
with
1,960 additions
and
1,227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include "RiaFileDownloader.h" | ||
|
||
#include <QCoreApplication> | ||
#include <QDebug> | ||
#include <QFile> | ||
#include <QNetworkAccessManager> | ||
#include <QNetworkReply> | ||
#include <QNetworkRequest> | ||
|
||
#include "RiaLogging.h" | ||
|
||
RiaFileDownloader::RiaFileDownloader( QObject* parent ) | ||
: QObject( parent ) | ||
{ | ||
} | ||
|
||
void RiaFileDownloader::downloadFile( const QUrl& url, const QString& filePath ) | ||
{ | ||
QNetworkAccessManager* manager = new QNetworkAccessManager( this ); | ||
QNetworkRequest request( url ); | ||
|
||
RiaLogging::debug( "Downloading from: " + url.toString() ); | ||
|
||
QNetworkReply* reply = manager->get( request ); | ||
|
||
connect( reply, | ||
&QNetworkReply::finished, | ||
[=]() | ||
{ | ||
if ( reply->error() ) | ||
{ | ||
RiaLogging::error( "Download failed:" + reply->errorString() ); | ||
emit done(); | ||
} | ||
else | ||
{ | ||
QFile file( filePath ); | ||
if ( file.open( QIODevice::WriteOnly ) ) | ||
{ | ||
file.write( reply->readAll() ); | ||
file.close(); | ||
RiaLogging::info( "Download succeeded. File saved to " + filePath ); | ||
emit done(); | ||
} | ||
else | ||
{ | ||
RiaLogging::info( "Failed to save file to " + filePath ); | ||
emit done(); | ||
} | ||
} | ||
reply->deleteLater(); | ||
manager->deleteLater(); | ||
} ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include <QObject> | ||
#include <QString> | ||
#include <QUrl> | ||
|
||
class RiaFileDownloader : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit RiaFileDownloader( QObject* parent = nullptr ); | ||
|
||
void downloadFile( const QUrl& url, const QString& filePath ); | ||
signals: | ||
void done(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright (C) 2024 Equinor ASA | ||
// | ||
// 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. | ||
// | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "RiaApplication.h" | ||
|
||
#include "RiaPreferences.h" | ||
#include "RiaPreferencesOsdu.h" | ||
|
||
CAF_PDM_SOURCE_INIT( RiaPreferencesOsdu, "RiaPreferencesOsdu" ); | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RiaPreferencesOsdu::RiaPreferencesOsdu() | ||
{ | ||
CAF_PDM_InitFieldNoDefault( &m_server, "server", "Server" ); | ||
CAF_PDM_InitFieldNoDefault( &m_dataPartitionId, "dataPartitionId", "Data Partition Id" ); | ||
CAF_PDM_InitFieldNoDefault( &m_authority, "authority", "Authority" ); | ||
CAF_PDM_InitFieldNoDefault( &m_scopes, "scopes", "Scopes" ); | ||
CAF_PDM_InitFieldNoDefault( &m_clientId, "clientId", "Client Id" ); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RiaPreferencesOsdu* RiaPreferencesOsdu::current() | ||
{ | ||
return RiaApplication::instance()->preferences()->osduPreferences(); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
QString RiaPreferencesOsdu::server() const | ||
{ | ||
return m_server; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
QString RiaPreferencesOsdu::dataPartitionId() const | ||
{ | ||
return m_dataPartitionId; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
QString RiaPreferencesOsdu::authority() const | ||
{ | ||
return m_authority; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
QString RiaPreferencesOsdu::scopes() const | ||
{ | ||
return m_scopes; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
QString RiaPreferencesOsdu::clientId() const | ||
{ | ||
return m_clientId; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright (C) 2024 Equinor ASA | ||
// | ||
// 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 "cafPdmField.h" | ||
#include "cafPdmObject.h" | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
class RiaPreferencesOsdu : public caf::PdmObject | ||
{ | ||
CAF_PDM_HEADER_INIT; | ||
|
||
public: | ||
RiaPreferencesOsdu(); | ||
|
||
static RiaPreferencesOsdu* current(); | ||
|
||
QString server() const; | ||
QString dataPartitionId() const; | ||
QString authority() const; | ||
QString scopes() const; | ||
QString clientId() const; | ||
|
||
private: | ||
caf::PdmField<QString> m_server; | ||
caf::PdmField<QString> m_dataPartitionId; | ||
caf::PdmField<QString> m_authority; | ||
caf::PdmField<QString> m_scopes; | ||
caf::PdmField<QString> m_clientId; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.