Skip to content

Commit

Permalink
Move GeoNode browser/source select from app -> new 'geonode' provider
Browse files Browse the repository at this point in the history
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 220c5e8
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 83 deletions.
1 change: 1 addition & 0 deletions debian/qgis-providers.install.in
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ms-windows/osgeo4w/package.cmd
Expand Up @@ -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" ^
Expand Down
11 changes: 0 additions & 11 deletions src/app/CMakeLists.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
49 changes: 0 additions & 49 deletions src/app/geocms/qgsgeocmsproviderregistry.h

This file was deleted.

4 changes: 0 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -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 );
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgisapp.h
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/providers/CMakeLists.txt
Expand Up @@ -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)
Expand Down
58 changes: 58 additions & 0 deletions src/providers/geonode/CMakeLists.txt
@@ -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})

Expand Up @@ -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 *
Expand All @@ -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;
}
Expand Up @@ -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.