Skip to content
Permalink
Browse files

Move GeoNode browser/source select from app -> new 'geonode' provider

Instead of including these classes in app, we instead make a
shell data provider which implements only the dataItemProviders()
and sourceSelectProviders() methods.

Helps keep GeoNode GUI related code partitioned
  • Loading branch information
nyalldawson committed Sep 12, 2017
1 parent 54df0a2 commit 220c5e85e36d24e883673e044216dd0487e94e0a
@@ -2,6 +2,7 @@ usr/lib/qgis/crssync
usr/lib/qgis/plugins/libbasicauthmethod.so
usr/lib/qgis/plugins/libdelimitedtextprovider.so
usr/lib/qgis/plugins/libgdalprovider.so
usr/lib/qgis/plugins/libgeonodeprovider.so
usr/lib/qgis/plugins/libgpxprovider.so
usr/lib/qgis/plugins/libidentcertauthmethod.so
usr/lib/qgis/plugins/libmssqlprovider.so
@@ -301,6 +301,7 @@ tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-common/%PACKAGENAME
"apps/%PACKAGENAME%/plugins/basicauthmethod.dll" ^
"apps/%PACKAGENAME%/plugins/delimitedtextprovider.dll" ^
"apps/%PACKAGENAME%/plugins/gdalprovider.dll" ^
"apps/%PACKAGENAME%/plugins/geonodeprovider.dll" ^
"apps/%PACKAGENAME%/plugins/gpxprovider.dll" ^
"apps/%PACKAGENAME%/plugins/identcertauthmethod.dll" ^
"apps/%PACKAGENAME%/plugins/mssqlprovider.dll" ^
@@ -153,11 +153,6 @@ SET(QGIS_APP_SRCS
composer/qgscompositionwidget.cpp
composer/qgsatlascompositionwidget.cpp

geocms/qgsgeocmsproviderregistry.cpp
geocms/geonode/qgsgeonodedataitems.cpp
geocms/geonode/qgsgeonodenewconnection.cpp
geocms/geonode/qgsgeonodesourceselect.cpp

layout/qgslayoutaddpagesdialog.cpp
layout/qgslayoutdesignerdialog.cpp
layout/qgslayoutguidewidget.cpp
@@ -338,10 +333,6 @@ SET (QGIS_APP_MOC_HDRS
composer/qgscompositionwidget.h
composer/qgsatlascompositionwidget.h

geocms/geonode/qgsgeonodedataitems.h
geocms/geonode/qgsgeonodenewconnection.h
geocms/geonode/qgsgeonodesourceselect.h

layout/qgslayoutaddpagesdialog.h
layout/qgslayoutappmenuprovider.h
layout/qgslayoutdesignerdialog.h
@@ -507,8 +498,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/app/openstreetmap
${CMAKE_SOURCE_DIR}/src/app/dwg
${CMAKE_SOURCE_DIR}/src/app/dwg/libdxfrw
${CMAKE_SOURCE_DIR}/src/app/geocms
${CMAKE_SOURCE_DIR}/src/app/geocms/geonode
${CMAKE_SOURCE_DIR}/src/app/locator
${CMAKE_SOURCE_DIR}/src/analysis/raster
${CMAKE_SOURCE_DIR}/src/analysis/openstreetmap

This file was deleted.

@@ -1081,10 +1081,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
QgsStyle::defaultStyle();
endProfile();

startProfile( QStringLiteral( "Loading GeoCMS providers" ) );
mGeoCmsProviderRegistry.reset( new QgsGeoCmsProviderRegistry() );
endProfile();

mSplash->showMessage( tr( "QGIS Ready!" ), Qt::AlignHCenter | Qt::AlignBottom );

QgsMessageLog::logMessage( QgsApplication::showSettings(), QString(), QgsMessageLog::INFO );
@@ -146,7 +146,6 @@ class QgsGeoCmsProviderRegistry;
#include "qgsrasterminmaxorigin.h"
#include "qgsmaplayeractionregistry.h"
#include "qgsoptionswidgetfactory.h"
#include "geocms/qgsgeocmsproviderregistry.h"

#include "ui_qgisapp.h"
#include "qgis_app.h"
@@ -2078,8 +2077,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QTimer mRenderProgressBarTimer;
QMetaObject::Connection mRenderProgressBarTimerConnection;

std::unique_ptr< QgsGeoCmsProviderRegistry > mGeoCmsProviderRegistry;

QgsBrowserModel *mBrowserModel = nullptr;

friend class TestQgisAppPython;
@@ -7,6 +7,7 @@ ADD_SUBDIRECTORY(ogr)
ADD_SUBDIRECTORY(wms)
ADD_SUBDIRECTORY(delimitedtext)
ADD_SUBDIRECTORY(gdal)
ADD_SUBDIRECTORY(geonode)
ADD_SUBDIRECTORY(mssql)
ADD_SUBDIRECTORY(ows)
ADD_SUBDIRECTORY(wcs)
@@ -0,0 +1,58 @@

SET (GEONODE_SRCS
qgsgeonodedataitems.cpp
qgsgeonodenewconnection.cpp
qgsgeonodeprovider.cpp
qgsgeonodesourceselect.cpp
)

SET(GEONODE_MOC_HDRS
qgsgeonodedataitems.h
qgsgeonodenewconnection.h
qgsgeonodesourceselect.h
)

########################################################
# Build

QT5_WRAP_CPP(GEONODE_MOC_SRCS ${GEONODE_MOC_HDRS})

INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/core
${CMAKE_SOURCE_DIR}/src/core/raster
${CMAKE_SOURCE_DIR}/src/core/geocms/geonode
${CMAKE_SOURCE_DIR}/src/core/geometry
${CMAKE_SOURCE_DIR}/src/core/metadata
${CMAKE_SOURCE_DIR}/src/core/symbology
${CMAKE_SOURCE_DIR}/src/core/expression
${CMAKE_SOURCE_DIR}/src/gui

${CMAKE_BINARY_DIR}/src/core
${CMAKE_BINARY_DIR}/src/gui
${CMAKE_BINARY_DIR}/src/ui
)

ADD_LIBRARY(geonodeprovider MODULE ${GEONODE_SRCS} ${GEONODE_MOC_SRCS})

TARGET_LINK_LIBRARIES(geonodeprovider
qgis_core
)

IF (WITH_GUI)
TARGET_LINK_LIBRARIES (geonodeprovider
qgis_gui
)
ENDIF ()

# clang-tidy
IF(CLANG_TIDY_EXE)
SET_TARGET_PROPERTIES(
geonodeprovider PROPERTIES
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
)
ENDIF(CLANG_TIDY_EXE)

INSTALL (TARGETS geonodeprovider
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})

@@ -278,3 +278,12 @@ QgsDataItem *QgsGeoNodeDataItemProvider::createDataItem( const QString &path, Qg

return nullptr;
}

QGISEXTERN QList<QgsDataItemProvider *> *dataItemProviders()
{
QList<QgsDataItemProvider *> *providers = new QList<QgsDataItemProvider *>();

*providers << new QgsGeoNodeDataItemProvider();

return providers;
}
File renamed without changes.
@@ -1,10 +1,12 @@
/***************************************************************************
qgsgeocmsproviderregistry.cpp
-----------------------------
qgsgeonodeprovider.cpp
----------------------
begin : September 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -13,23 +15,30 @@
* *
***************************************************************************/

#include "qgsgeocmsproviderregistry.h"
#include "qgsdataitemproviderregistry.h"
#include "qgsgui.h"
#include "qgssourceselectproviderregistry.h"
#include "geocms/geonode/qgsgeonodesourceselect.h"
#include "geocms/geonode/qgsgeonodedataitems.h"
#include "qgis.h"


QgsGeoCmsProviderRegistry::QgsGeoCmsProviderRegistry()
/** Required key function (used to map the plugin to a data store type)
*/
QGISEXTERN QString providerKey()
{
init();
return QStringLiteral( "geonode" );
}

void QgsGeoCmsProviderRegistry::init()
/**
* Required description function
*/
QGISEXTERN QString description()
{
// source select providers
QgsGui::sourceSelectProviderRegistry()->addProvider( new QgsGeoNodeSourceSelectProvider() );
return QStringLiteral( "GeoNode provider" );
}

/**
* Required isProvider function. Used to determine if this shared library
* is a data provider plugin
*/

// data item providers
QgsApplication::dataItemProviderRegistry()->addProvider( new QgsGeoNodeDataItemProvider() );
QGISEXTERN bool isProvider()
{
return true;
}
@@ -470,3 +470,13 @@ QgsGeoNodeConnection QgsGeoNodeSourceSelect::currentConnection() const
{
return QgsGeoNodeConnection( cmbConnections->currentText() );
}

QGISEXTERN QList<QgsSourceSelectProvider *> *sourceSelectProviders()
{
QList<QgsSourceSelectProvider *> *providers = new QList<QgsSourceSelectProvider *>();

*providers
<< new QgsGeoNodeSourceSelectProvider;

return providers;
}

0 comments on commit 220c5e8

Please sign in to comment.
You can’t perform that action at this time.