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
This commit is contained in:
Nyall Dawson 2017-09-12 20:46:07 +10:00
parent 54df0a28fd
commit 220c5e85e3
15 changed files with 106 additions and 84 deletions

View File

@ -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

View File

@ -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" ^

View File

@ -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

View File

@ -1,49 +0,0 @@
/***************************************************************************
qgsgeocmsproviderregistry.h
---------------------------
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 *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSGEOCMSPROVIDERREGISTRY_H
#define QGSGEOCMSPROVIDERREGISTRY_H
#include "qgis.h"
/**
* \ingroup app
*
* This is a trivial registry for GeoCMS providers. It will be 'fleshed out'
* as additional GeoCMS providers are added, and the required common functionality
* between the different providers is determined.
*
* \since QGIS 3.0
*/
class QgsGeoCmsProviderRegistry
{
public:
QgsGeoCmsProviderRegistry();
//! QgsGeoCmsProviderRegistry cannot be copied.
QgsGeoCmsProviderRegistry( const QgsGeoCmsProviderRegistry &rh ) = delete;
//! QgsGeoCmsProviderRegistry cannot be copied.
QgsGeoCmsProviderRegistry &operator=( const QgsGeoCmsProviderRegistry &rh ) = delete;
private:
//! Initializes the registry
void init();
};
#endif // QGSGEOCMSPROVIDERREGISTRY_H

View File

@ -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 );

View File

@ -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;

View File

@ -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)

View File

@ -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})

View File

@ -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;
}

View File

@ -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() );
// data item providers
QgsApplication::dataItemProviderRegistry()->addProvider( new QgsGeoNodeDataItemProvider() );
return QStringLiteral( "GeoNode provider" );
}
/**
* Required isProvider function. Used to determine if this shared library
* is a data provider plugin
*/
QGISEXTERN bool isProvider()
{
return true;
}

View File

@ -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;
}