Skip to content

Commit

Permalink
General: make it possible to open remote binary files (closes #1319).
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed May 27, 2017
2 parents 0290804 + 403cc05 commit a488148
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 33 deletions.
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Expand Up @@ -37,7 +37,7 @@ var jsonData = { "versions": [
}
],
"changes": [
{ "change": "<strong>General:</strong> OpenGL now works in an Ubuntu virtual machine (see issue <a href=\"https://github.com/opencor/opencor/issues/1307\">#1307</a>). Added OpenSSL as a third-party plugin (see issues <a href=\"https://github.com/opencor/opencor/issues/1101\">#1101</a> and <a href=\"https://github.com/opencor/opencor/issues/1314\">#1314</a>)." }
{ "change": "<strong>General:</strong> OpenGL now works in an Ubuntu virtual machine (see issue <a href=\"https://github.com/opencor/opencor/issues/1307\">#1307</a>). Added OpenSSL as a third-party plugin (see issues <a href=\"https://github.com/opencor/opencor/issues/1101\">#1101</a> and <a href=\"https://github.com/opencor/opencor/issues/1314\">#1314</a>). Can now open remote binary files (see issue <a href=\"https://github.com/opencor/opencor/issues/1319\">#1319</a>)." }
]
},
{ "major": 0, "minor": 4, "patch": 1, "day": 20, "month": 5, "year": 2015, "type": 0,
Expand Down
2 changes: 1 addition & 1 deletion src/misc/cliutils.h
Expand Up @@ -52,7 +52,7 @@ static const auto HomePageUrl = QStringLiteral("http://www.opencor.ws/");

//==============================================================================
// Note: both cliutils.h and corecliutils.h must specifically define
// SynchronousFileDownloader. To have it in cliutils.h.inl is NOT good
// SynchronousFileDownloader. To have it in corecliutils.h.inl is NOT good
// enough since the MOC won't pick it up...

class SynchronousFileDownloader : public QObject
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/miscellaneous/Core/src/centralwidget.cpp
Expand Up @@ -860,7 +860,7 @@ void CentralWidget::openRemoteFile(const QString &pUrl,
if (fileName.isEmpty()) {
// The remote file isn't already opened, so download its contents

QString fileContents;
QByteArray fileContents;
QString errorMessage;

if (readFileContentsFromUrlWithBusyWidget(fileNameOrUrl, fileContents, &errorMessage)) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/miscellaneous/Core/src/corecliutils.h
Expand Up @@ -89,7 +89,7 @@ class CORE_EXPORT DummyMessageHandler : public QAbstractMessageHandler

//==============================================================================
// Note: both cliutils.h and corecliutils.h must specifically define
// SynchronousFileDownloader. To have it in cliutils.h.inl is NOT good
// SynchronousFileDownloader. To have it in corecliutils.h.inl is NOT good
// enough since the MOC won't pick it up...

class SynchronousFileDownloader : public QObject
Expand Down
16 changes: 13 additions & 3 deletions src/plugins/miscellaneous/Core/src/filemanager.cpp
Expand Up @@ -509,7 +509,7 @@ void FileManager::reload(const QString &pFileName,

//==============================================================================

bool FileManager::newFile(QString &pFileName, const QString &pContents)
bool FileManager::newFile(QString &pFileName, const QByteArray &pContents)
{
// Retrieve a temporary file name for our new file

Expand All @@ -531,7 +531,7 @@ bool FileManager::newFile(QString &pFileName, const QString &pContents)
//==============================================================================

FileManager::Status FileManager::create(const QString &pUrl,
const QString &pContents)
const QByteArray &pContents)
{
// Create a new file

Expand All @@ -550,6 +550,16 @@ FileManager::Status FileManager::create(const QString &pUrl,

//==============================================================================

FileManager::Status FileManager::create(const QString &pUrl,
const QString &pContents)
{
// Create a new file

return create(pUrl, pContents.toUtf8());
}

//==============================================================================

FileManager::Status FileManager::rename(const QString &pOldFileName,
const QString &pNewFileName)
{
Expand Down Expand Up @@ -589,7 +599,7 @@ FileManager::Status FileManager::duplicate(const QString &pFileName)
if (nativeFile) {
// The file is managed, so retrieve its contents

QString fileContents;
QByteArray fileContents;

if (readFileContentsFromFile(pFileName, fileContents)) {
// Now, we can create a new file, which contents will be that of our
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/miscellaneous/Core/src/filemanager.h
Expand Up @@ -136,7 +136,8 @@ class CORE_EXPORT FileManager : public QObject
const bool &pForceFileChanged = false);

Status create(const QString &pUrl = QString(),
const QString &pContents = QString());
const QByteArray &pContents = QByteArray());
Status create(const QString &pUrl, const QString &pContents);
Status rename(const QString &pOldFileName, const QString &pNewFileName);
Status duplicate(const QString &pFileName);

Expand All @@ -158,7 +159,8 @@ class CORE_EXPORT FileManager : public QObject

void startStopTimer();

bool newFile(QString &pFileName, const QString &pContents = QString());
bool newFile(QString &pFileName,
const QByteArray &pContents = QByteArray());

void emitFilePermissionsChanged(const QString &pFileName);

Expand Down
Expand Up @@ -3847,6 +3847,7 @@ bool SimulationExperimentViewSimulationWidget::combineArchiveSupported(COMBINESu
void SimulationExperimentViewSimulationWidget::retrieveCellmlFile(const QString &pFileName,
CellMLSupport::CellmlFile *&pCellmlFile,
SEDMLSupport::SedmlFile *pSedmlFile,
COMBINESupport::CombineArchive *pCombineArchive,
const FileType &pFileType,
SEDMLSupport::SedmlFileIssues &pSedmlFileIssues)
{
Expand All @@ -3870,7 +3871,7 @@ void SimulationExperimentViewSimulationWidget::retrieveCellmlFile(const QString

Core::checkFileNameOrUrl(modelSource, isLocalFile, dummy);

if (isLocalFile && url.isEmpty()) {
if (isLocalFile && (url.isEmpty() || pCombineArchive)) {
// By default, our model source refers to a file name relative to our
// SED-ML file

Expand Down Expand Up @@ -3984,8 +3985,10 @@ void SimulationExperimentViewSimulationWidget::retrieveFileDetails(const QString
if (pCombineArchive)
retrieveSedmlFile(pSedmlFile, pCombineArchive, pCombineArchiveIssues);

if (pSedmlFile)
retrieveCellmlFile(pFileName, pCellmlFile, pSedmlFile, pFileType, pSedmlFileIssues);
if (pSedmlFile) {
retrieveCellmlFile(pFileName, pCellmlFile, pSedmlFile, pCombineArchive,
pFileType, pSedmlFileIssues);
}
}

//==============================================================================
Expand Down
Expand Up @@ -294,6 +294,7 @@ class SimulationExperimentViewSimulationWidget : public Core::Widget
void retrieveCellmlFile(const QString &pFileName,
CellMLSupport::CellmlFile *&pCellmlFile,
SEDMLSupport::SedmlFile *pSedmlFile,
COMBINESupport::CombineArchive *pCombineArchive,
const FileType &pFileType,
SEDMLSupport::SedmlFileIssues &pSedmlFileIssues);
void retrieveSedmlFile(SEDMLSupport::SedmlFile *&pSedmlFile,
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/support/CellMLSupport/src/cellmlsupportplugin.cpp
Expand Up @@ -241,10 +241,10 @@ void CellMLSupportPlugin::newCellmlFile()
Core::FileManager::Status createStatus =
#endif
fileManagerInstance->create(QString(),
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<model xmlns=\"http://www.cellml.org/cellml/"+QString(Cellml_Latest)+"#\" name=\"my_model\">\n"
" <!-- Your code goes here-->\n"
"</model>\n");
QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<model xmlns=\"http://www.cellml.org/cellml/%1#\" name=\"my_model\">\n"
" <!-- Your code goes here-->\n"
"</model>\n").arg(Cellml_Latest));

#ifdef QT_DEBUG
// Make sure that the file has indeed been created
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/support/SEDMLSupport/src/sedmlsupportplugin.cpp
Expand Up @@ -241,10 +241,10 @@ void SEDMLSupportPlugin::newSedmlFile()
Core::FileManager::Status createStatus =
#endif
fileManagerInstance->create(QString(),
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<sedML xmlns=\"http://sed-ml.org/sed-ml/level1/version2\" level=\"1\" version=\"2\">\n"
" <!-- Your code goes here-->\n"
"</sedML>\n");
QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<sedML xmlns=\"http://sed-ml.org/sed-ml/level1/version2\" level=\"1\" version=\"2\">\n"
" <!-- Your code goes here-->\n"
"</sedML>\n"));

#ifdef QT_DEBUG
// Make sure that the file has indeed been created
Expand Down
26 changes: 13 additions & 13 deletions src/plugins/thirdParty/OpenSSL/CMakeLists.txt
Expand Up @@ -71,22 +71,22 @@ IF(USE_PREBUILT_OPENSSL_PACKAGE)
IF(WIN32)
IF(RELEASE_MODE)
RETRIEVE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
${RELATIVE_PROJECT_SOURCE_DIR} 3acf4912793bb796e91b5f88903e134ccc664b14
${RELATIVE_PROJECT_SOURCE_DIR} 2bda3172badee3f1daca3a05fad02d914b975f56
RELEASE_TAG ${RELEASE_TAG}
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES ddbb7491d59caa3a61297f81a13d3e25b6c09bc0
3efe6f60e279b52f27934b92ac8c5d183d0e84d0
aa4cd8163b9cc97e87f872b3b71b520fb045a6aa
a87ba18be63256fdc0b87b563caa6356ee9f5279)
SHA1_VALUES 9322e41caec6b4087ad4a7ac9665b5dfb7bfc867
369340018f310bd7cb631a773ab5921812a568f0
d33797a9bd0df69694a39db0224de907cd382585
a61987feb80d7b1565da22f407c1e99c613d8ad1)
ELSE()
RETRIEVE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
${RELATIVE_PROJECT_SOURCE_DIR} 993b7b921bea105477d359a48e7b84f555ead43c
${RELATIVE_PROJECT_SOURCE_DIR} 07fea34f373bc63a63fe622802c14b13b6715763
RELEASE_TAG ${RELEASE_TAG}
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES 6d3bc9a5c8cd8a9f2dc04062b36973e3d0b6eb73
1131626c1c72ec55a1e3eae86824c4df67d4673c
33dfed89cf676b95300a8c1b455169437a4f1c74
76059318ded5f4b06938191f3c1ef9e1b3e394bd)
SHA1_VALUES 2e5d35e882783398d8026d7ea8e604e7dcfcc690
3c1c6f367f38b1e5b9a0aca97e4bb910f48f11cf
1078cc30575d001248951db9cdeb0ed74635588e
55932ae5d960a309d137f3b919efe3a5a6907b2a)
ENDIF()
ELSEIF(APPLE)
RETRIEVE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
Expand All @@ -97,11 +97,11 @@ IF(USE_PREBUILT_OPENSSL_PACKAGE)
8d0c3218cb2090c42e11e013823115177a701ba1)
ELSE()
RETRIEVE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
${RELATIVE_PROJECT_SOURCE_DIR} b36071fe6d377596d1152fabef2e279862d68085
${RELATIVE_PROJECT_SOURCE_DIR} acc1dafdb5e5e2a3ce75779ba2956875300373c5
RELEASE_TAG ${RELEASE_TAG}
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES c24fac02bcecb0d3e7f438401562acd72333ea66
88583b407a4625ee157d25b35ce9328e023d8584)
SHA1_VALUES 449160cd3e6420c180199f19c1e0685d0e5770a1
be3a2cc75ffcbfbdccf7eff62f0fc7bbc5a09cd8)
ENDIF()
ELSE()
# Rely on the ExternalProject module to build our package
Expand Down

0 comments on commit a488148

Please sign in to comment.