[PATCH 07/10] Minor code cleanup of GeoJSON plugin, adding the new author and date
John Zaitseff
J.Zaitseff at zap.org.au
Tue Aug 27 11:55:09 BST 2019
---
src/plugins/runner/json/JsonPlugin.cpp | 19 ++++++++++---------
src/plugins/runner/json/JsonPlugin.h | 11 ++++++-----
src/plugins/runner/json/JsonRunner.cpp | 24 +++++++++++++-----------
src/plugins/runner/json/JsonRunner.h | 14 ++++++++------
4 files changed, 37 insertions(+), 31 deletions(-)
diff --git a/src/plugins/runner/json/JsonPlugin.cpp b/src/plugins/runner/json/JsonPlugin.cpp
index 7fdc56b9d..e006ebe8e 100644
--- 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 <ander.pijoan at deusto.es>
+ Copyright 2013 Ander Pijoan <ander.pijoan at deusto.es>
+ Copyright 2019 John Zaitseff <J.Zaitseff at zap.org.au>
*/
#include "JsonPlugin.h"
@@ -31,7 +32,7 @@ QString JsonPlugin::nameId() const
QString JsonPlugin::version() const
{
- return QStringLiteral("1.0");
+ return QStringLiteral("2.0");
}
QString JsonPlugin::description() const
@@ -41,13 +42,14 @@ QString JsonPlugin::description() const
QString JsonPlugin::copyrightYears() const
{
- return QStringLiteral("2012");
+ return QStringLiteral("2012, 2019");
}
QVector<PluginAuthor> JsonPlugin::pluginAuthors() const
{
return QVector<PluginAuthor>()
- << PluginAuthor(QStringLiteral("Ander Pijoan"), QStringLiteral("ander.pijoan at deusto.es"));
+ << PluginAuthor(QStringLiteral("Ander Pijoan"), QStringLiteral("ander.pijoan at deusto.es"))
+ << PluginAuthor(QStringLiteral("John Zaitseff"), QStringLiteral("J.Zaitseff at zap.org.au"));
}
QString JsonPlugin::fileFormatDescription() const
@@ -68,4 +70,3 @@ ParsingRunner* JsonPlugin::newRunner() const
}
#include "moc_JsonPlugin.cpp"
-
diff --git a/src/plugins/runner/json/JsonPlugin.h b/src/plugins/runner/json/JsonPlugin.h
index 3241f81f7..595b9400d 100644
--- 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 <ander.pijoan at deusto.es>
+ Copyright 2013 Ander Pijoan <ander.pijoan at deusto.es>
+ Copyright 2019 John Zaitseff <J.Zaitseff at zap.org.au>
*/
#ifndef MARBLE_JSONPLUGIN_H
diff --git a/src/plugins/runner/json/JsonRunner.cpp b/src/plugins/runner/json/JsonRunner.cpp
index f7da32b59..c77f21014 100644
--- 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 <ander.pijoan at deusto.es>
+ Copyright 2013 Ander Pijoan <ander.pijoan at deusto.es>
+ Copyright 2019 John Zaitseff <J.Zaitseff at zap.org.au>
*/
#include "JsonRunner.h"
@@ -30,22 +31,22 @@ JsonRunner::~JsonRunner()
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;
@@ -53,6 +54,7 @@ GeoDataDocument *JsonRunner::parseFile(const QString &fileName, DocumentRole rol
GeoDataDocument* document = parser.releaseDocument();
file.close();
+
document->setDocumentRole( role );
document->setFileName( fileName );
diff --git a/src/plugins/runner/json/JsonRunner.h b/src/plugins/runner/json/JsonRunner.h
index dfcf35753..bc26bee1e 100644
--- 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 <ander.pijoan at deusto.es>
+ Copyright 2013 Ander Pijoan <ander.pijoan at deusto.es>
+ Copyright 2019 John Zaitseff <J.Zaitseff at zap.org.au>
*/
#ifndef MARBLE_JSONRUNNER_H
@@ -22,8 +23,9 @@ class JsonRunner : public ParsingRunner
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
--
2.20.1
More information about the Marble-devel
mailing list