diff --git a/src/plugins/runner/json/JsonPlugin.h b/src/plugins/runner/json/JsonPlugin.h --- a/src/plugins/runner/json/JsonPlugin.h +++ b/src/plugins/runner/json/JsonPlugin.h @@ -1,11 +1,12 @@ /* - This file is part of the Marble Virtual Globe. + This file is part of the Marble Virtual Globe. - This program is free software licensed under the GNU LGPL. You can - find a copy of this license in LICENSE.txt in the top directory of - the source code. + This program is free software licensed under the GNU LGPL. You can + find a copy of this license in LICENSE.txt in the top directory of + the source code. - Copyright 2013 Ander Pijoan + Copyright 2013 Ander Pijoan + Copyright 2019 John Zaitseff */ #ifndef MARBLE_JSONPLUGIN_H diff --git a/src/plugins/runner/json/JsonPlugin.cpp b/src/plugins/runner/json/JsonPlugin.cpp --- a/src/plugins/runner/json/JsonPlugin.cpp +++ b/src/plugins/runner/json/JsonPlugin.cpp @@ -1,11 +1,12 @@ /* - This file is part of the Marble Virtual Globe. + This file is part of the Marble Virtual Globe. - This program is free software licensed under the GNU LGPL. You can - find a copy of this license in LICENSE.txt in the top directory of - the source code. + This program is free software licensed under the GNU LGPL. You can + find a copy of this license in LICENSE.txt in the top directory of + the source code. - Copyright 2013 Ander Pijoan + Copyright 2013 Ander Pijoan + Copyright 2019 John Zaitseff */ #include "JsonPlugin.h" @@ -31,7 +32,7 @@ QString JsonPlugin::version() const { - return QStringLiteral("1.0"); + return QStringLiteral("2.0"); } QString JsonPlugin::description() const @@ -41,13 +42,14 @@ QString JsonPlugin::copyrightYears() const { - return QStringLiteral("2012"); + return QStringLiteral("2012, 2019"); } QVector JsonPlugin::pluginAuthors() const { return QVector() - << PluginAuthor(QStringLiteral("Ander Pijoan"), QStringLiteral("ander.pijoan@deusto.es")); + << PluginAuthor(QStringLiteral("Ander Pijoan"), QStringLiteral("ander.pijoan@deusto.es")) + << PluginAuthor(QStringLiteral("John Zaitseff"), QStringLiteral("J.Zaitseff@zap.org.au")); } QString JsonPlugin::fileFormatDescription() const @@ -68,4 +70,3 @@ } #include "moc_JsonPlugin.cpp" - diff --git a/src/plugins/runner/json/JsonRunner.h b/src/plugins/runner/json/JsonRunner.h --- a/src/plugins/runner/json/JsonRunner.h +++ b/src/plugins/runner/json/JsonRunner.h @@ -1,11 +1,12 @@ /* - This file is part of the Marble Virtual Globe. + This file is part of the Marble Virtual Globe. - This program is free software licensed under the GNU LGPL. You can - find a copy of this license in LICENSE.txt in the top directory of - the source code. + This program is free software licensed under the GNU LGPL. You can + find a copy of this license in LICENSE.txt in the top directory of + the source code. - Copyright 2013 Ander Pijoan + Copyright 2013 Ander Pijoan + Copyright 2019 John Zaitseff */ #ifndef MARBLE_JSONRUNNER_H @@ -22,8 +23,9 @@ public: explicit JsonRunner(QObject *parent = nullptr); ~JsonRunner() override; - GeoDataDocument* parseFile( const QString &fileName, DocumentRole role, QString& error ) override; + GeoDataDocument* parseFile(const QString &fileName, DocumentRole role, QString& error) override; }; } + #endif // MARBLE_JSONRUNNER_H diff --git a/src/plugins/runner/json/JsonRunner.cpp b/src/plugins/runner/json/JsonRunner.cpp --- a/src/plugins/runner/json/JsonRunner.cpp +++ b/src/plugins/runner/json/JsonRunner.cpp @@ -1,11 +1,12 @@ /* - This file is part of the Marble Virtual Globe. + This file is part of the Marble Virtual Globe. - This program is free software licensed under the GNU LGPL. You can - find a copy of this license in LICENSE.txt in the top directory of - the source code. + This program is free software licensed under the GNU LGPL. You can + find a copy of this license in LICENSE.txt in the top directory of + the source code. - Copyright 2013 Ander Pijoan + Copyright 2013 Ander Pijoan + Copyright 2019 John Zaitseff */ #include "JsonRunner.h" @@ -30,29 +31,30 @@ GeoDataDocument *JsonRunner::parseFile(const QString &fileName, DocumentRole role, QString &error) { - // Check file exists - QFile file( fileName ); - if ( !file.exists() ) { + // Check that the file exists + QFile file(fileName); + if (! file.exists()) { error = QStringLiteral("File %1 does not exist").arg(fileName); mDebug() << error; return nullptr; } - // Open file in right mode - file.open( QIODevice::ReadOnly ); + // Open file in the correct mode + file.open(QIODevice::ReadOnly); // Create parser JsonParser parser; // Start parsing - if ( !parser.read( &file ) ) { + if (! parser.read(&file)) { error = QStringLiteral("Could not parse GeoJSON from %1").arg(fileName); mDebug() << error; return nullptr; } GeoDataDocument* document = parser.releaseDocument(); file.close(); + document->setDocumentRole( role ); document->setFileName( fileName );