Skip to content

Commit 220c5e8

Browse files
committedSep 12, 2017
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
1 parent 54df0a2 commit 220c5e8

15 files changed

+105
-83
lines changed
 

‎debian/qgis-providers.install.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ usr/lib/qgis/crssync
22
usr/lib/qgis/plugins/libbasicauthmethod.so
33
usr/lib/qgis/plugins/libdelimitedtextprovider.so
44
usr/lib/qgis/plugins/libgdalprovider.so
5+
usr/lib/qgis/plugins/libgeonodeprovider.so
56
usr/lib/qgis/plugins/libgpxprovider.so
67
usr/lib/qgis/plugins/libidentcertauthmethod.so
78
usr/lib/qgis/plugins/libmssqlprovider.so

‎ms-windows/osgeo4w/package.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-common/%PACKAGENAME
301301
"apps/%PACKAGENAME%/plugins/basicauthmethod.dll" ^
302302
"apps/%PACKAGENAME%/plugins/delimitedtextprovider.dll" ^
303303
"apps/%PACKAGENAME%/plugins/gdalprovider.dll" ^
304+
"apps/%PACKAGENAME%/plugins/geonodeprovider.dll" ^
304305
"apps/%PACKAGENAME%/plugins/gpxprovider.dll" ^
305306
"apps/%PACKAGENAME%/plugins/identcertauthmethod.dll" ^
306307
"apps/%PACKAGENAME%/plugins/mssqlprovider.dll" ^

‎src/app/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ SET(QGIS_APP_SRCS
153153
composer/qgscompositionwidget.cpp
154154
composer/qgsatlascompositionwidget.cpp
155155

156-
geocms/qgsgeocmsproviderregistry.cpp
157-
geocms/geonode/qgsgeonodedataitems.cpp
158-
geocms/geonode/qgsgeonodenewconnection.cpp
159-
geocms/geonode/qgsgeonodesourceselect.cpp
160-
161156
layout/qgslayoutaddpagesdialog.cpp
162157
layout/qgslayoutdesignerdialog.cpp
163158
layout/qgslayoutguidewidget.cpp
@@ -338,10 +333,6 @@ SET (QGIS_APP_MOC_HDRS
338333
composer/qgscompositionwidget.h
339334
composer/qgsatlascompositionwidget.h
340335

341-
geocms/geonode/qgsgeonodedataitems.h
342-
geocms/geonode/qgsgeonodenewconnection.h
343-
geocms/geonode/qgsgeonodesourceselect.h
344-
345336
layout/qgslayoutaddpagesdialog.h
346337
layout/qgslayoutappmenuprovider.h
347338
layout/qgslayoutdesignerdialog.h
@@ -507,8 +498,6 @@ INCLUDE_DIRECTORIES(
507498
${CMAKE_SOURCE_DIR}/src/app/openstreetmap
508499
${CMAKE_SOURCE_DIR}/src/app/dwg
509500
${CMAKE_SOURCE_DIR}/src/app/dwg/libdxfrw
510-
${CMAKE_SOURCE_DIR}/src/app/geocms
511-
${CMAKE_SOURCE_DIR}/src/app/geocms/geonode
512501
${CMAKE_SOURCE_DIR}/src/app/locator
513502
${CMAKE_SOURCE_DIR}/src/analysis/raster
514503
${CMAKE_SOURCE_DIR}/src/analysis/openstreetmap

‎src/app/geocms/qgsgeocmsproviderregistry.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎src/app/qgisapp.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,10 +1081,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10811081
QgsStyle::defaultStyle();
10821082
endProfile();
10831083

1084-
startProfile( QStringLiteral( "Loading GeoCMS providers" ) );
1085-
mGeoCmsProviderRegistry.reset( new QgsGeoCmsProviderRegistry() );
1086-
endProfile();
1087-
10881084
mSplash->showMessage( tr( "QGIS Ready!" ), Qt::AlignHCenter | Qt::AlignBottom );
10891085

10901086
QgsMessageLog::logMessage( QgsApplication::showSettings(), QString(), QgsMessageLog::INFO );

‎src/app/qgisapp.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ class QgsGeoCmsProviderRegistry;
146146
#include "qgsrasterminmaxorigin.h"
147147
#include "qgsmaplayeractionregistry.h"
148148
#include "qgsoptionswidgetfactory.h"
149-
#include "geocms/qgsgeocmsproviderregistry.h"
150149

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

2081-
std::unique_ptr< QgsGeoCmsProviderRegistry > mGeoCmsProviderRegistry;
2082-
20832080
QgsBrowserModel *mBrowserModel = nullptr;
20842081

20852082
friend class TestQgisAppPython;

‎src/providers/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ADD_SUBDIRECTORY(ogr)
77
ADD_SUBDIRECTORY(wms)
88
ADD_SUBDIRECTORY(delimitedtext)
99
ADD_SUBDIRECTORY(gdal)
10+
ADD_SUBDIRECTORY(geonode)
1011
ADD_SUBDIRECTORY(mssql)
1112
ADD_SUBDIRECTORY(ows)
1213
ADD_SUBDIRECTORY(wcs)

‎src/providers/geonode/CMakeLists.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
SET (GEONODE_SRCS
3+
qgsgeonodedataitems.cpp
4+
qgsgeonodenewconnection.cpp
5+
qgsgeonodeprovider.cpp
6+
qgsgeonodesourceselect.cpp
7+
)
8+
9+
SET(GEONODE_MOC_HDRS
10+
qgsgeonodedataitems.h
11+
qgsgeonodenewconnection.h
12+
qgsgeonodesourceselect.h
13+
)
14+
15+
########################################################
16+
# Build
17+
18+
QT5_WRAP_CPP(GEONODE_MOC_SRCS ${GEONODE_MOC_HDRS})
19+
20+
INCLUDE_DIRECTORIES(
21+
${CMAKE_SOURCE_DIR}/src/core
22+
${CMAKE_SOURCE_DIR}/src/core/raster
23+
${CMAKE_SOURCE_DIR}/src/core/geocms/geonode
24+
${CMAKE_SOURCE_DIR}/src/core/geometry
25+
${CMAKE_SOURCE_DIR}/src/core/metadata
26+
${CMAKE_SOURCE_DIR}/src/core/symbology
27+
${CMAKE_SOURCE_DIR}/src/core/expression
28+
${CMAKE_SOURCE_DIR}/src/gui
29+
30+
${CMAKE_BINARY_DIR}/src/core
31+
${CMAKE_BINARY_DIR}/src/gui
32+
${CMAKE_BINARY_DIR}/src/ui
33+
)
34+
35+
ADD_LIBRARY(geonodeprovider MODULE ${GEONODE_SRCS} ${GEONODE_MOC_SRCS})
36+
37+
TARGET_LINK_LIBRARIES(geonodeprovider
38+
qgis_core
39+
)
40+
41+
IF (WITH_GUI)
42+
TARGET_LINK_LIBRARIES (geonodeprovider
43+
qgis_gui
44+
)
45+
ENDIF ()
46+
47+
# clang-tidy
48+
IF(CLANG_TIDY_EXE)
49+
SET_TARGET_PROPERTIES(
50+
geonodeprovider PROPERTIES
51+
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
52+
)
53+
ENDIF(CLANG_TIDY_EXE)
54+
55+
INSTALL (TARGETS geonodeprovider
56+
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
57+
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
58+

‎src/app/geocms/geonode/qgsgeonodedataitems.cpp renamed to ‎src/providers/geonode/qgsgeonodedataitems.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,12 @@ QgsDataItem *QgsGeoNodeDataItemProvider::createDataItem( const QString &path, Qg
278278

279279
return nullptr;
280280
}
281+
282+
QGISEXTERN QList<QgsDataItemProvider *> *dataItemProviders()
283+
{
284+
QList<QgsDataItemProvider *> *providers = new QList<QgsDataItemProvider *>();
285+
286+
*providers << new QgsGeoNodeDataItemProvider();
287+
288+
return providers;
289+
}
Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/***************************************************************************
2-
qgsgeocmsproviderregistry.cpp
3-
-----------------------------
2+
qgsgeonodeprovider.cpp
3+
----------------------
44
begin : September 2017
55
copyright : (C) 2017 by Nyall Dawson
66
email : nyall dot dawson at gmail dot com
7-
***************************************************************************
7+
***************************************************************************/
8+
9+
/***************************************************************************
810
* *
911
* This program is free software; you can redistribute it and/or modify *
1012
* it under the terms of the GNU General Public License as published by *
@@ -13,23 +15,30 @@
1315
* *
1416
***************************************************************************/
1517

16-
#include "qgsgeocmsproviderregistry.h"
17-
#include "qgsdataitemproviderregistry.h"
18-
#include "qgsgui.h"
19-
#include "qgssourceselectproviderregistry.h"
20-
#include "geocms/geonode/qgsgeonodesourceselect.h"
21-
#include "geocms/geonode/qgsgeonodedataitems.h"
18+
#include "qgis.h"
19+
2220

23-
QgsGeoCmsProviderRegistry::QgsGeoCmsProviderRegistry()
21+
/** Required key function (used to map the plugin to a data store type)
22+
*/
23+
QGISEXTERN QString providerKey()
2424
{
25-
init();
25+
return QStringLiteral( "geonode" );
2626
}
2727

28-
void QgsGeoCmsProviderRegistry::init()
28+
/**
29+
* Required description function
30+
*/
31+
QGISEXTERN QString description()
2932
{
30-
// source select providers
31-
QgsGui::sourceSelectProviderRegistry()->addProvider( new QgsGeoNodeSourceSelectProvider() );
33+
return QStringLiteral( "GeoNode provider" );
34+
}
35+
36+
/**
37+
* Required isProvider function. Used to determine if this shared library
38+
* is a data provider plugin
39+
*/
3240

33-
// data item providers
34-
QgsApplication::dataItemProviderRegistry()->addProvider( new QgsGeoNodeDataItemProvider() );
41+
QGISEXTERN bool isProvider()
42+
{
43+
return true;
3544
}

‎src/app/geocms/geonode/qgsgeonodesourceselect.cpp renamed to ‎src/providers/geonode/qgsgeonodesourceselect.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,13 @@ QgsGeoNodeConnection QgsGeoNodeSourceSelect::currentConnection() const
470470
{
471471
return QgsGeoNodeConnection( cmbConnections->currentText() );
472472
}
473+
474+
QGISEXTERN QList<QgsSourceSelectProvider *> *sourceSelectProviders()
475+
{
476+
QList<QgsSourceSelectProvider *> *providers = new QList<QgsSourceSelectProvider *>();
477+
478+
*providers
479+
<< new QgsGeoNodeSourceSelectProvider;
480+
481+
return providers;
482+
}

0 commit comments

Comments
 (0)