mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Make it possible to build just core lib and providers: -DWITH_GUI=FALSE
This is useful in some cases when working on a third party app/script that only uses qgis_core. For example, I am working on qgis 3D project and it is useful to be able to build QGIS core lib with custom Qt version without having to spend too much time building what I do not need. Also may be useful for QField to simplify the build of QGIS as a dependency (no QScintilla, Qwt) and avoid bits of code in providers that would not be used anyway. No real source code changes, just configuration changes, mainly in providers.
This commit is contained in:
parent
eb8f91a556
commit
a8cceff0fc
@ -58,6 +58,8 @@ IF(WITH_CORE)
|
||||
ENDIF (WITH_GRASS${GRASS_CACHE_VERSION})
|
||||
ENDFOREACH (GRASS_SEARCH_VERSION)
|
||||
|
||||
SET (WITH_GUI TRUE CACHE BOOL "Determines whether QGIS GUI library (and everything built on top of it) should be built")
|
||||
|
||||
SET (WITH_DESKTOP TRUE CACHE BOOL "Determines whether QGIS desktop should be built")
|
||||
|
||||
# server disabled default because it needs FastCGI (which is optional dependency)
|
||||
@ -74,6 +76,16 @@ IF(WITH_CORE)
|
||||
# Custom widgets
|
||||
SET (WITH_CUSTOM_WIDGETS FALSE CACHE BOOL "Determines whether QGIS custom widgets for Qt Designer should be built")
|
||||
|
||||
IF (NOT WITH_GUI)
|
||||
SET (HAVE_GUI FALSE) # used in qgsconfig.h
|
||||
# force value of some options
|
||||
SET(WITH_DESKTOP FALSE)
|
||||
SET(WITH_CUSTOM_WIDGETS FALSE)
|
||||
SET(WITH_SERVER FALSE) # for some reason server also uses GUI library
|
||||
ELSE ()
|
||||
SET (HAVE_GUI TRUE) # used in qgsconfig.h
|
||||
ENDIF()
|
||||
|
||||
# try to configure and build POSTGRESQL support
|
||||
SET (WITH_POSTGRESQL TRUE CACHE BOOL "Determines whether POSTGRESQL support should be built")
|
||||
IF (WITH_POSTGRESQL)
|
||||
@ -103,9 +115,11 @@ IF(WITH_CORE)
|
||||
SET (WITH_STAGED_PLUGINS TRUE CACHE BOOL "Stage-install core Python plugins to run from build directory? (utilities and console are always staged)")
|
||||
SET (WITH_PY_COMPILE FALSE CACHE BOOL "Determines whether Python modules in staged or installed locations are byte-compiled")
|
||||
# concatenate QScintilla2 API files
|
||||
SET (WITH_QSCIAPI TRUE CACHE BOOL "Whether to generate PyQGIS QScintilla2 API file. (For devs) run 'make qsci-pap-src' in between QGIS build and install to regenerate .pap file in source tree for console auto-completion.")
|
||||
# keep casual users from updating their source tree via WITH_QSCIAPI
|
||||
MARK_AS_ADVANCED (WITH_QSCIAPI)
|
||||
IF (WITH_GUI)
|
||||
SET (WITH_QSCIAPI TRUE CACHE BOOL "Whether to generate PyQGIS QScintilla2 API file. (For devs) run 'make qsci-pap-src' in between QGIS build and install to regenerate .pap file in source tree for console auto-completion.")
|
||||
# keep casual users from updating their source tree via WITH_QSCIAPI
|
||||
MARK_AS_ADVANCED (WITH_QSCIAPI)
|
||||
ENDIF (WITH_GUI)
|
||||
ADD_DEFINITIONS(-DWITH_BINDINGS)
|
||||
ENDIF (WITH_BINDINGS)
|
||||
|
||||
@ -196,7 +210,9 @@ IF(WITH_CORE)
|
||||
FIND_PACKAGE(GDAL)
|
||||
FIND_PACKAGE(Expat REQUIRED)
|
||||
FIND_PACKAGE(Spatialindex REQUIRED)
|
||||
FIND_PACKAGE(Qwt REQUIRED)
|
||||
IF (WITH_GUI)
|
||||
FIND_PACKAGE(Qwt REQUIRED)
|
||||
ENDIF (WITH_GUI)
|
||||
|
||||
IF (WITH_INTERNAL_QEXTSERIALPORT)
|
||||
SET(QEXTSERIALPORT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/core/gps/qextserialport)
|
||||
@ -274,7 +290,9 @@ IF(WITH_CORE)
|
||||
ENDIF (WITH_QTMOBILITY)
|
||||
|
||||
# search for QScintilla2 (C++ lib)
|
||||
FIND_PACKAGE(QScintilla REQUIRED)
|
||||
IF (WITH_GUI)
|
||||
FIND_PACKAGE(QScintilla REQUIRED)
|
||||
ENDIF (WITH_GUI)
|
||||
|
||||
# Password helper
|
||||
FIND_PACKAGE(QtKeychain REQUIRED)
|
||||
|
@ -44,6 +44,8 @@
|
||||
|
||||
#cmakedefine USING_NINJA
|
||||
|
||||
#cmakedefine HAVE_GUI
|
||||
|
||||
#cmakedefine HAVE_POSTGRESQL
|
||||
|
||||
#cmakedefine HAVE_ORACLE
|
||||
|
@ -64,7 +64,9 @@ MACRO(PY_2TO3 TARGET_NAME RESOURCE_PATHS)
|
||||
ENDMACRO(PY_2TO3)
|
||||
|
||||
ADD_SUBDIRECTORY(plugins)
|
||||
ADD_SUBDIRECTORY(qsci_apis)
|
||||
IF (WITH_GUI)
|
||||
ADD_SUBDIRECTORY(qsci_apis)
|
||||
ENDIF ()
|
||||
ADD_SUBDIRECTORY(console)
|
||||
ADD_SUBDIRECTORY(PyQt)
|
||||
ADD_SUBDIRECTORY(pyplugin_installer)
|
||||
@ -87,11 +89,17 @@ INCLUDE_DIRECTORIES(SYSTEM
|
||||
${GEOS_INCLUDE_DIR}
|
||||
${QWT_INCLUDE_DIR}
|
||||
${QEXTSERIALPORT_INCLUDE_DIR}
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
${QCA_INCLUDE_DIR}
|
||||
${QTKEYCHAIN_INCLUDE_DIR}
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/src/core
|
||||
${CMAKE_SOURCE_DIR}/src/core/annotations
|
||||
@ -114,26 +122,32 @@ INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/src/core/raster
|
||||
${CMAKE_SOURCE_DIR}/src/core/scalebar
|
||||
${CMAKE_SOURCE_DIR}/src/core/symbology-ng
|
||||
${CMAKE_SOURCE_DIR}/src/gui
|
||||
${CMAKE_SOURCE_DIR}/src/gui/symbology-ng
|
||||
${CMAKE_SOURCE_DIR}/src/gui/raster
|
||||
${CMAKE_SOURCE_DIR}/src/gui/attributetable
|
||||
${CMAKE_SOURCE_DIR}/src/gui/auth
|
||||
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets
|
||||
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets/core
|
||||
${CMAKE_SOURCE_DIR}/src/gui/effects
|
||||
${CMAKE_SOURCE_DIR}/src/gui/layertree
|
||||
${CMAKE_SOURCE_DIR}/src/gui/layout
|
||||
${CMAKE_SOURCE_DIR}/src/gui/locator
|
||||
${CMAKE_SOURCE_DIR}/src/plugins
|
||||
|
||||
${CMAKE_BINARY_DIR} # qgsconfig.h, qgsversion.h
|
||||
${CMAKE_BINARY_DIR}/src/core
|
||||
${CMAKE_BINARY_DIR}/src/gui
|
||||
${CMAKE_BINARY_DIR}/src/ui
|
||||
${CMAKE_BINARY_DIR}/src/analysis
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/src/gui
|
||||
${CMAKE_SOURCE_DIR}/src/gui/symbology-ng
|
||||
${CMAKE_SOURCE_DIR}/src/gui/raster
|
||||
${CMAKE_SOURCE_DIR}/src/gui/attributetable
|
||||
${CMAKE_SOURCE_DIR}/src/gui/auth
|
||||
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets
|
||||
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets/core
|
||||
${CMAKE_SOURCE_DIR}/src/gui/effects
|
||||
${CMAKE_SOURCE_DIR}/src/gui/layertree
|
||||
${CMAKE_SOURCE_DIR}/src/gui/layout
|
||||
${CMAKE_SOURCE_DIR}/src/gui/locator
|
||||
|
||||
${CMAKE_BINARY_DIR}/src/gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
IF(NOT ENABLE_TESTS)
|
||||
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} TESTS)
|
||||
ENDIF(NOT ENABLE_TESTS)
|
||||
@ -159,26 +173,31 @@ GENERATE_SIP_PYTHON_MODULE_CODE(qgis._core core/core.sip cpp_files)
|
||||
BUILD_SIP_PYTHON_MODULE(qgis._core core/core.sip ${cpp_files} "" qgis_core)
|
||||
SET(SIP_CORE_CPP_FILES ${cpp_files})
|
||||
|
||||
# gui module
|
||||
FILE(GLOB_RECURSE sip_files_gui gui/*.sip)
|
||||
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_gui})
|
||||
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
|
||||
IF(QSCI_SIP_DIR)
|
||||
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -I ${QSCI_SIP_DIR})
|
||||
ELSE(QSCI_SIP_DIR)
|
||||
MESSAGE(STATUS "Qsci sip file not found - disabling bindings for derived classes")
|
||||
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} HAVE_QSCI_SIP)
|
||||
ENDIF(QSCI_SIP_DIR)
|
||||
|
||||
IF(UNIX AND NOT SIP_VERSION_NUM LESS 265984)
|
||||
SET(SIP_EXTRA_OPTIONS -P ${SIP_EXTRA_OPTIONS})
|
||||
ADD_DEFINITIONS(-Dprotected=public)
|
||||
ENDIF(UNIX AND NOT SIP_VERSION_NUM LESS 265984)
|
||||
|
||||
GENERATE_SIP_PYTHON_MODULE_CODE(qgis._gui gui/gui.sip cpp_files)
|
||||
BUILD_SIP_PYTHON_MODULE(qgis._gui gui/gui.sip ${cpp_files} "" qgis_core qgis_gui)
|
||||
SET(PY_MODULES core analysis)
|
||||
|
||||
SET(PY_MODULES core gui analysis)
|
||||
# gui module
|
||||
IF (WITH_GUI)
|
||||
SET(PY_MODULES ${PY_MODULES} gui)
|
||||
|
||||
FILE(GLOB_RECURSE sip_files_gui gui/*.sip)
|
||||
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_gui})
|
||||
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
|
||||
|
||||
IF(QSCI_SIP_DIR)
|
||||
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -I ${QSCI_SIP_DIR})
|
||||
ELSE(QSCI_SIP_DIR)
|
||||
MESSAGE(STATUS "Qsci sip file not found - disabling bindings for derived classes")
|
||||
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} HAVE_QSCI_SIP)
|
||||
ENDIF(QSCI_SIP_DIR)
|
||||
|
||||
GENERATE_SIP_PYTHON_MODULE_CODE(qgis._gui gui/gui.sip cpp_files)
|
||||
BUILD_SIP_PYTHON_MODULE(qgis._gui gui/gui.sip ${cpp_files} "" qgis_core qgis_gui)
|
||||
ENDIF (WITH_GUI)
|
||||
|
||||
# server module
|
||||
IF (WITH_SERVER AND WITH_SERVER_PLUGINS)
|
||||
|
@ -2,9 +2,11 @@ ADD_SUBDIRECTORY(native)
|
||||
|
||||
ADD_SUBDIRECTORY(core)
|
||||
ADD_SUBDIRECTORY(analysis)
|
||||
ADD_SUBDIRECTORY(ui)
|
||||
ADD_SUBDIRECTORY(gui)
|
||||
ADD_SUBDIRECTORY(auth)
|
||||
IF (WITH_GUI)
|
||||
ADD_SUBDIRECTORY(ui)
|
||||
ADD_SUBDIRECTORY(gui)
|
||||
ADD_SUBDIRECTORY(auth)
|
||||
ENDIF (WITH_GUI)
|
||||
ADD_SUBDIRECTORY(providers)
|
||||
ADD_SUBDIRECTORY(crssync)
|
||||
ADD_SUBDIRECTORY(test)
|
||||
|
@ -14,9 +14,14 @@ INCLUDE_DIRECTORIES(
|
||||
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${GEOS_INCLUDE_DIR}
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
###############################################################################
|
||||
|
||||
SET (AFS_SRCS
|
||||
@ -25,26 +30,38 @@ SET (AFS_SRCS
|
||||
qgsafsfeatureiterator.cpp
|
||||
qgsafsprovider.cpp
|
||||
qgsafsproviderextern.cpp
|
||||
qgsafssourceselect.cpp
|
||||
qgsafsshareddata.cpp
|
||||
)
|
||||
SET (AFS_MOC_HDRS
|
||||
qgsarcgisrestutils.h
|
||||
qgsafsdataitems.h
|
||||
qgsafsprovider.h
|
||||
qgsafssourceselect.h
|
||||
qgsafsshareddata.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(AFS_SRCS ${AFS_SRCS}
|
||||
qgsafssourceselect.cpp
|
||||
)
|
||||
SET(AFS_MOC_HDRS ${AFS_MOC_HDRS}
|
||||
qgsafssourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
QT5_WRAP_CPP (AFS_MOC_SRCS ${AFS_MOC_HDRS})
|
||||
|
||||
ADD_LIBRARY(arcgisfeatureserverprovider MODULE ${AFS_SRCS} ${AFS_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(arcgisfeatureserverprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES(arcgisfeatureserverprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
INSTALL (TARGETS arcgisfeatureserverprovider
|
||||
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
|
||||
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
|
||||
@ -56,24 +73,36 @@ SET (AMS_SRCS
|
||||
qgsamsdataitems.cpp
|
||||
qgsamsprovider.cpp
|
||||
qgsamsproviderextern.cpp
|
||||
qgsamssourceselect.cpp
|
||||
)
|
||||
SET (AMS_MOC_HDRS
|
||||
qgsarcgisrestutils.h
|
||||
qgsamsdataitems.h
|
||||
qgsamsprovider.h
|
||||
qgsamssourceselect.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(AMS_SRCS ${AMS_SRCS}
|
||||
qgsamssourceselect.cpp
|
||||
)
|
||||
SET(AMS_MOC_HDRS ${AMS_MOC_HDRS}
|
||||
qgsamssourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
QT5_WRAP_CPP (AMS_MOC_SRCS ${AMS_MOC_HDRS})
|
||||
|
||||
ADD_LIBRARY(arcgismapserverprovider MODULE ${AMS_SRCS} ${AMS_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(arcgismapserverprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES(arcgismapserverprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
INSTALL (TARGETS arcgismapserverprovider
|
||||
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
|
||||
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
|
||||
|
@ -13,12 +13,15 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgslogger.h"
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#include "qgsowsconnection.h"
|
||||
#include "qgsafsdataitems.h"
|
||||
#include "qgsafsprovider.h"
|
||||
#include "qgsarcgisrestutils.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#include "qgsafssourceselect.h"
|
||||
#endif
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QSettings>
|
||||
@ -46,6 +49,7 @@ QVector<QgsDataItem *> QgsAfsRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsAfsRootItem::actions()
|
||||
{
|
||||
QAction *actionNew = new QAction( tr( "New Connection..." ), this );
|
||||
@ -75,6 +79,7 @@ void QgsAfsRootItem::newConnection()
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -114,6 +119,7 @@ bool QgsAfsConnectionItem::equal( const QgsDataItem *other )
|
||||
return ( type() == other->type() && o != 0 && mPath == o->mPath && mName == o->mName );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsAfsConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -145,6 +151,7 @@ void QgsAfsConnectionItem::deleteConnection()
|
||||
QgsOwsConnection::deleteConnection( QStringLiteral( "arcgisfeatureserver" ), mName );
|
||||
mParent->refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -25,12 +25,16 @@ class QgsAfsRootItem : public QgsDataCollectionItem
|
||||
public:
|
||||
QgsAfsRootItem( QgsDataItem *parent, const QString &name, const QString &path );
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> actions() override;
|
||||
QWidget *paramWidget() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -41,11 +45,15 @@ class QgsAfsConnectionItem : public QgsDataCollectionItem
|
||||
QgsAfsConnectionItem( QgsDataItem *parent, const QString &name, const QString &path, const QString &url );
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
bool equal( const QgsDataItem *other ) override;
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QString mUrl;
|
||||
|
@ -18,9 +18,12 @@
|
||||
#include "qgis.h"
|
||||
#include "qgsafsdataitems.h"
|
||||
#include "qgsafsprovider.h"
|
||||
#include "qgsafssourceselect.h"
|
||||
#include "qgsowsconnection.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsafssourceselect.h"
|
||||
#endif
|
||||
|
||||
const QString AFS_KEY = QStringLiteral( "arcgisfeatureserver" );
|
||||
const QString AFS_DESCRIPTION = QStringLiteral( "ArcGIS Feature Server data provider" );
|
||||
|
||||
@ -45,10 +48,12 @@ QGISEXTERN bool isProvider()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN QgsAfsSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsAfsSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN int dataCapabilities()
|
||||
{
|
||||
|
@ -15,12 +15,15 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgsamsdataitems.h"
|
||||
#include "qgsamssourceselect.h"
|
||||
#include "qgsarcgisrestutils.h"
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#include "qgsowsconnection.h"
|
||||
#include "qgsproviderregistry.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsamssourceselect.h"
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#endif
|
||||
|
||||
#include <QImageReader>
|
||||
|
||||
QgsAmsRootItem::QgsAmsRootItem( QgsDataItem *parent, QString name, QString path )
|
||||
@ -44,6 +47,7 @@ QVector<QgsDataItem *> QgsAmsRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsAmsRootItem::actions()
|
||||
{
|
||||
QAction *actionNew = new QAction( tr( "New Connection..." ), this );
|
||||
@ -74,6 +78,7 @@ void QgsAmsRootItem::newConnection()
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -130,6 +135,7 @@ bool QgsAmsConnectionItem::equal( const QgsDataItem *other )
|
||||
return ( type() == other->type() && o != 0 && mPath == o->mPath && mName == o->mName );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsAmsConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -161,6 +167,7 @@ void QgsAmsConnectionItem::deleteConnection()
|
||||
QgsOwsConnection::deleteConnection( QStringLiteral( "arcgismapserver" ), mName );
|
||||
mParent->refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -28,12 +28,16 @@ class QgsAmsRootItem : public QgsDataCollectionItem
|
||||
QgsAmsRootItem( QgsDataItem *parent, QString name, QString path );
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
virtual QWidget *paramWidget() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -44,11 +48,15 @@ class QgsAmsConnectionItem : public QgsDataCollectionItem
|
||||
QgsAmsConnectionItem( QgsDataItem *parent, QString name, QString path, QString url );
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
bool equal( const QgsDataItem *other ) override;
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QString mUrl;
|
||||
|
@ -18,9 +18,12 @@
|
||||
#include "qgis.h"
|
||||
#include "qgsamsdataitems.h"
|
||||
#include "qgsamsprovider.h"
|
||||
#include "qgsamssourceselect.h"
|
||||
#include "qgsowsconnection.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsamssourceselect.h"
|
||||
#endif
|
||||
|
||||
const QString AMS_KEY = QStringLiteral( "arcgismapserver" );
|
||||
const QString AMS_DESCRIPTION = QStringLiteral( "ArcGIS Map Server data provider" );
|
||||
|
||||
@ -45,10 +48,12 @@ QGISEXTERN bool isProvider()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN QgsAmsSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsAmsSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN int dataCapabilities()
|
||||
{
|
||||
|
@ -7,19 +7,26 @@ SET(DB2_SRCS
|
||||
qgsdb2expressioncompiler.cpp
|
||||
qgsdb2provider.cpp
|
||||
qgsdb2dataitems.cpp
|
||||
qgsdb2newconnection.cpp
|
||||
qgsdb2tablemodel.cpp
|
||||
qgsdb2featureiterator.cpp
|
||||
qgsdb2sourceselect.cpp
|
||||
)
|
||||
SET(DB2_MOC_HDRS
|
||||
qgsdb2provider.h
|
||||
qgsdb2dataitems.h
|
||||
qgsdb2newconnection.h
|
||||
qgsdb2tablemodel.h
|
||||
qgsdb2sourceselect.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(DB2_SRCS ${DB2_SRCS}
|
||||
qgsdb2newconnection.cpp
|
||||
qgsdb2sourceselect.cpp
|
||||
)
|
||||
SET(DB2_MOC_HDRS ${DB2_MOC_HDRS}
|
||||
qgsdb2newconnection.h
|
||||
qgsdb2sourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
########################################################
|
||||
# Build
|
||||
|
||||
@ -43,17 +50,26 @@ INCLUDE_DIRECTORIES(
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${GEOS_INCLUDE_DIR}
|
||||
${QT_INCLUDE_DIR}
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
ADD_LIBRARY (db2provider MODULE ${DB2_SRCS} ${DB2_HDRS} ${DB2_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES (db2provider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
${QT_QTSQL_LIBRARY}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (db2provider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
########################################################
|
||||
# Install
|
||||
|
@ -17,7 +17,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsdb2dataitems.h"
|
||||
#include "qgsdb2newconnection.h"
|
||||
#include "qgsdb2geometrycolumns.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsmimedatautils.h"
|
||||
@ -26,6 +25,11 @@
|
||||
#include "qgssettings.h"
|
||||
#include "qgsmessageoutput.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsdb2newconnection.h"
|
||||
#include "qgsdb2sourceselect.h"
|
||||
#endif
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QProgressDialog>
|
||||
|
||||
@ -245,6 +249,7 @@ bool QgsDb2ConnectionItem::equal( const QgsDataItem *other )
|
||||
return ( mPath == o->mPath && mName == o->mName );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsDb2ConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -305,6 +310,7 @@ void QgsDb2ConnectionItem::refreshConnection()
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool QgsDb2ConnectionItem::handleDrop( const QMimeData *data, Qt::DropAction )
|
||||
@ -423,6 +429,7 @@ QVector<QgsDataItem *> QgsDb2RootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsDb2RootItem::actions()
|
||||
{
|
||||
QList<QAction *> actionList;
|
||||
@ -450,6 +457,7 @@ void QgsDb2RootItem::newConnection()
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
QgsDb2LayerItem::QgsDb2LayerItem( QgsDataItem *parent, QString name, QString path, QgsLayerItem::LayerType layerType, QgsDb2LayerProperty layerProperty )
|
||||
|
@ -16,7 +16,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsdb2provider.h"
|
||||
#include "qgsdb2sourceselect.h"
|
||||
#include "qgsdb2tablemodel.h"
|
||||
|
||||
#include <qgsdataitem.h>
|
||||
|
||||
class QgsDb2RootItem;
|
||||
@ -41,13 +42,17 @@ class QgsDb2RootItem : public QgsDataCollectionItem
|
||||
*/
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QWidget *paramWidget() override;
|
||||
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
//void connectionsChanged();
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
@ -83,10 +88,13 @@ class QgsDb2ConnectionItem : public QgsDataCollectionItem
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
|
||||
/**
|
||||
* Add Refresh, Edit, and Delete actions for every QgsDb2ConnectionItem.
|
||||
*/
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
virtual bool acceptDrop() override { return true; }
|
||||
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
|
||||
@ -99,6 +107,7 @@ class QgsDb2ConnectionItem : public QgsDataCollectionItem
|
||||
void addGeometryColumn( QgsDb2LayerProperty );
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
|
||||
/**
|
||||
* Refresh with saved connection data.
|
||||
@ -114,6 +123,7 @@ class QgsDb2ConnectionItem : public QgsDataCollectionItem
|
||||
* Delete saved connection data and remove from Browser Panel.
|
||||
*/
|
||||
void deleteConnection();
|
||||
#endif
|
||||
//void setAllowGeometrylessTables( bool allow );
|
||||
|
||||
//void setLayerType( QgsDb2LayerProperty layerProperty );
|
||||
|
@ -16,7 +16,6 @@
|
||||
***************************************************************************/
|
||||
#include "qgsdb2geometrycolumns.h"
|
||||
#include "qgsdb2tablemodel.h" // needed for QgsDB2LayerProperty
|
||||
#include "qgsdb2newconnection.h" // needed for ENV_ZOS, ENV_LUW
|
||||
#include <QtSql>
|
||||
#include <qgslogger.h>
|
||||
|
||||
|
@ -25,6 +25,10 @@
|
||||
#include <qgslogger.h>
|
||||
#include "qgscredentials.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsdb2sourceselect.h"
|
||||
#endif
|
||||
|
||||
static const QString PROVIDER_KEY = QStringLiteral( "DB2" );
|
||||
static const QString PROVIDER_DESCRIPTION = QStringLiteral( "DB2 Spatial Extender provider" );
|
||||
|
||||
@ -1714,10 +1718,12 @@ QGISEXTERN int dataCapabilities()
|
||||
return QgsDataProvider::Database;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN void *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsDb2SourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
|
||||
{
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
class QPushButton;
|
||||
class QStringList;
|
||||
class QgsGeomColumnTypeThread;
|
||||
class QgisApp;
|
||||
|
||||
class QgsDb2SourceSelectDelegate : public QItemDelegate
|
||||
|
@ -6,15 +6,22 @@ SET (DTEXT_SRCS
|
||||
qgsdelimitedtextfeatureiterator.cpp
|
||||
qgsdelimitedtextprovider.cpp
|
||||
qgsdelimitedtextfile.cpp
|
||||
qgsdelimitedtextsourceselect.cpp
|
||||
)
|
||||
|
||||
SET (DTEXT_MOC_HDRS
|
||||
qgsdelimitedtextfile.h
|
||||
qgsdelimitedtextprovider.h
|
||||
qgsdelimitedtextsourceselect.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(DTEXT_SRCS ${DTEXT_SRCS}
|
||||
qgsdelimitedtextsourceselect.cpp
|
||||
)
|
||||
SET(DTEXT_MOC_HDRS ${DTEXT_MOC_HDRS}
|
||||
qgsdelimitedtextsourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
########################################################
|
||||
# Build
|
||||
|
||||
@ -39,9 +46,14 @@ ADD_LIBRARY(delimitedtextprovider MODULE ${DTEXT_SRCS} ${DTEXT_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(delimitedtextprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (delimitedtextprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
# clang-tidy
|
||||
IF(CLANG_TIDY_EXE)
|
||||
SET_TARGET_PROPERTIES(
|
||||
|
@ -42,10 +42,13 @@
|
||||
#include "qgis.h"
|
||||
#include "qgsproviderregistry.h"
|
||||
|
||||
#include "qgsdelimitedtextsourceselect.h"
|
||||
#include "qgsdelimitedtextfeatureiterator.h"
|
||||
#include "qgsdelimitedtextfile.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsdelimitedtextsourceselect.h"
|
||||
#endif
|
||||
|
||||
static const QString TEXT_PROVIDER_KEY = QStringLiteral( "delimitedtext" );
|
||||
static const QString TEXT_PROVIDER_DESCRIPTION = QStringLiteral( "Delimited text data provider" );
|
||||
|
||||
@ -1188,7 +1191,9 @@ QGISEXTERN bool isProvider()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN QgsDelimitedTextSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsDelimitedTextSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
@ -30,9 +30,14 @@ ADD_LIBRARY (gdalprovider MODULE ${GDAL_SRCS} ${GDAL_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES (gdalprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (gdalprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
# clang-tidy
|
||||
IF(CLANG_TIDY_EXE)
|
||||
SET_TARGET_PROPERTIES(
|
||||
|
@ -31,11 +31,10 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
|
||||
SET(GRASS_MINOR_VERSION ${GRASS_MINOR_VERSION${GRASS_BUILD_VERSION}})
|
||||
SET(GRASS_OFF_T_SIZE ${GRASS_OFF_T_SIZE${GRASS_BUILD_VERSION}})
|
||||
|
||||
QT5_WRAP_CPP(GRASS_LIBRARY_MOC_SRCS
|
||||
SET(GRASS_LIBRARY_MOC_HDRS
|
||||
../qgsgrass.h
|
||||
../qgsgrassfeatureiterator.h
|
||||
../qgsgrassimport.h
|
||||
../qgsgrassoptions.h
|
||||
../qgsgrassprovider.h
|
||||
../qgsgrassrasterprovider.h
|
||||
../qgsgrassvector.h
|
||||
@ -49,7 +48,6 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
|
||||
../qgsgrassdatafile.cpp
|
||||
../qgsgrassfeatureiterator.cpp
|
||||
../qgsgrassimport.cpp
|
||||
../qgsgrassoptions.cpp
|
||||
../qgsgrassprovider.cpp
|
||||
../qgsgrassrasterprovider.cpp
|
||||
../qgsgrassundocommand.cpp
|
||||
@ -58,6 +56,17 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
|
||||
../qgsgrassvectormaplayer.cpp
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(GRASS_LIBRARY_MOC_HDRS ${GRASS_LIBRARY_MOC_HDRS}
|
||||
../qgsgrassoptions.h
|
||||
)
|
||||
SET(GRASS_LIBRARY_SRCS ${GRASS_LIBRARY_SRCS}
|
||||
../qgsgrassoptions.cpp
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
QT5_WRAP_CPP(GRASS_LIBRARY_MOC_SRCS ${GRASS_LIBRARY_MOC_HDRS})
|
||||
|
||||
IF(MSVC)
|
||||
# 4611 setjmp
|
||||
SET_SOURCE_FILES_PROPERTIES(
|
||||
@ -120,7 +129,6 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
|
||||
IF (GRASS_MAJOR_VERSION LESS 7 )
|
||||
SET(GRASS_TARGET_LINK_LIBRARIES${GRASS_BUILD_VERSION}
|
||||
qgis_core
|
||||
qgis_gui
|
||||
${GRASS_LIBRARY${GRASS_BUILD_VERSION}_gis}
|
||||
${GRASS_LIBRARY${GRASS_BUILD_VERSION}_vect}
|
||||
${GRASS_LIBRARY${GRASS_BUILD_VERSION}_I}
|
||||
@ -131,7 +139,6 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
|
||||
ELSE (GRASS_MAJOR_VERSION LESS 7 )
|
||||
SET(GRASS_TARGET_LINK_LIBRARIES${GRASS_BUILD_VERSION}
|
||||
qgis_core
|
||||
qgis_gui
|
||||
${GRASS_LIBRARY${GRASS_BUILD_VERSION}_gis}
|
||||
${GRASS_LIBRARY${GRASS_BUILD_VERSION}_vector}
|
||||
${GRASS_LIBRARY${GRASS_BUILD_VERSION}_raster}
|
||||
@ -144,6 +151,12 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
|
||||
|
||||
TARGET_LINK_LIBRARIES(qgisgrass${GRASS_BUILD_VERSION} ${GRASS_TARGET_LINK_LIBRARIES${GRASS_BUILD_VERSION}})
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES(qgisgrass${GRASS_BUILD_VERSION}
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
IF (APPLE)
|
||||
SET_TARGET_PROPERTIES(qgisgrass${GRASS_BUILD_VERSION} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
ENDIF (APPLE)
|
||||
@ -165,9 +178,14 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(grassprovider${GRASS_BUILD_VERSION}
|
||||
qgisgrass${GRASS_BUILD_VERSION}
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES(grassprovider${GRASS_BUILD_VERSION}
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
#
|
||||
# grass raster provider
|
||||
#
|
||||
|
@ -29,9 +29,12 @@
|
||||
#endif
|
||||
|
||||
#include "qgsgrass.h"
|
||||
#include "qgsgrassoptions.h"
|
||||
#include "qgsgrassvector.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsgrassoptions.h"
|
||||
#endif
|
||||
|
||||
#include "qgsapplication.h"
|
||||
#include "qgsconfig.h"
|
||||
#include "qgscoordinatereferencesystem.h"
|
||||
@ -2906,8 +2909,10 @@ void QgsGrass::setModulesDebug( bool debug )
|
||||
|
||||
void QgsGrass::openOptions()
|
||||
{
|
||||
#ifdef HAVE_GUI
|
||||
QgsGrassOptions dialog;
|
||||
dialog.exec();
|
||||
#endif
|
||||
}
|
||||
|
||||
void QgsGrass::warning( const QString &message )
|
||||
|
@ -16,19 +16,23 @@
|
||||
|
||||
#include "qgsmessageoutput.h"
|
||||
#include "qgsmimedatautils.h"
|
||||
#include "qgsnewnamedialog.h"
|
||||
#include "qgsproviderregistry.h"
|
||||
#include "qgsrasterlayer.h"
|
||||
#include "qgsrasterdataprovider.h"
|
||||
#include "qgsrasterprojector.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
#include "qgsgrassprovidermodule.h"
|
||||
#include "qgsgrassprovider.h"
|
||||
#include "qgsgrassoptions.h"
|
||||
#include "qgsgrass.h"
|
||||
#include "qgsgrassvector.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsnewnamedialog.h"
|
||||
#include "qgsgrassoptions.h"
|
||||
#endif
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
@ -39,6 +43,7 @@
|
||||
#include <QTextEdit>
|
||||
|
||||
//----------------------- QgsGrassItemActions ------------------------------
|
||||
#ifdef HAVE_GUI
|
||||
QgsGrassItemActions::QgsGrassItemActions( const QgsGrassObject &grassObject, bool valid, QObject *parent )
|
||||
: QObject( parent )
|
||||
, mGrassObject( grassObject )
|
||||
@ -313,6 +318,7 @@ void QgsGrassItemActions::newPolygonLayer()
|
||||
{
|
||||
newLayer( QStringLiteral( "polygon" ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------- QgsGrassObjectItemBase ------------------------------
|
||||
|
||||
@ -336,7 +342,9 @@ QgsGrassLocationItem::QgsGrassLocationItem( QgsDataItem *parent, QString dirPath
|
||||
QString gisdbase = dir.path();
|
||||
|
||||
mGrassObject = QgsGrassObject( gisdbase, mName, QLatin1String( "" ), QLatin1String( "" ), QgsGrassObject::Location );
|
||||
#ifdef HAVE_GUI
|
||||
mActions = new QgsGrassItemActions( mGrassObject, true, this );
|
||||
#endif
|
||||
|
||||
mIconName = QStringLiteral( "grass_location.png" );
|
||||
|
||||
@ -383,7 +391,9 @@ QgsGrassMapsetItem::QgsGrassMapsetItem( QgsDataItem *parent, QString dirPath, QS
|
||||
QString gisdbase = dir.path();
|
||||
|
||||
mGrassObject = QgsGrassObject( gisdbase, location, mName, QLatin1String( "" ), QgsGrassObject::Mapset );
|
||||
#ifdef HAVE_GUI
|
||||
mActions = new QgsGrassItemActions( mGrassObject, true, this );
|
||||
#endif
|
||||
|
||||
// emit data changed to possibly change icon
|
||||
connect( QgsGrass::instance(), &QgsGrass::mapsetChanged, this, &QgsGrassMapsetItem::updateIcon );
|
||||
@ -684,7 +694,6 @@ bool QgsGrassMapsetItem::handleDrop( const QMimeData *data, Qt::DropAction )
|
||||
|
||||
QStringList errors;
|
||||
QgsMimeDataUtils::UriList lst = QgsMimeDataUtils::decodeUriList( data );
|
||||
Qt::CaseSensitivity caseSensitivity = QgsGrass::caseSensitivity();
|
||||
|
||||
Q_FOREACH ( const QgsMimeDataUtils::Uri &u, lst )
|
||||
{
|
||||
@ -763,6 +772,8 @@ bool QgsGrassMapsetItem::handleDrop( const QMimeData *data, Qt::DropAction )
|
||||
|
||||
// TODO: add a method in QgsGrass to convert a name to GRASS valid name
|
||||
QString destName = srcName.replace( QLatin1String( " " ), QLatin1String( "_" ) );
|
||||
#ifdef HAVE_GUI
|
||||
Qt::CaseSensitivity caseSensitivity = QgsGrass::caseSensitivity();
|
||||
if ( QgsNewNameDialog::exists( destName, extensions, existingNames, caseSensitivity )
|
||||
|| !regExp.exactMatch( destName ) )
|
||||
{
|
||||
@ -774,6 +785,7 @@ bool QgsGrassMapsetItem::handleDrop( const QMimeData *data, Qt::DropAction )
|
||||
}
|
||||
destName = dialog.name();
|
||||
}
|
||||
#endif
|
||||
|
||||
QgsGrassImport *import = 0;
|
||||
if ( useCopy )
|
||||
@ -967,7 +979,9 @@ QgsGrassObjectItem::QgsGrassObjectItem( QgsDataItem *parent, QgsGrassObject gras
|
||||
, mActions( 0 )
|
||||
{
|
||||
setState( Populated ); // no children, to show non expandable in browser
|
||||
#ifdef HAVE_GUI
|
||||
mActions = new QgsGrassItemActions( mGrassObject, true, this );
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QgsGrassObjectItem::equal( const QgsDataItem *other )
|
||||
@ -993,7 +1007,9 @@ QgsGrassVectorItem::QgsGrassVectorItem( QgsDataItem *parent, QgsGrassObject gras
|
||||
setState( Populated );
|
||||
setIconName( QStringLiteral( "/mIconDelete.png" ) );
|
||||
}
|
||||
#ifdef HAVE_GUI
|
||||
mActions = new QgsGrassItemActions( mGrassObject, mValid, this );
|
||||
#endif
|
||||
|
||||
QString watchPath = mGrassObject.mapsetPath() + "/vector/" + mGrassObject.name();
|
||||
QgsDebugMsg( "add watcher on " + watchPath );
|
||||
@ -1108,6 +1124,7 @@ QIcon QgsGrassGroupItem::icon()
|
||||
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconRasterGroup.svg" ) );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
//----------------------- QgsGrassImportItemWidget ------------------------------
|
||||
QgsGrassImportItemWidget::QgsGrassImportItemWidget( QWidget *parent )
|
||||
: QWidget( parent )
|
||||
@ -1142,6 +1159,7 @@ void QgsGrassImportItemWidget::onProgressChanged( const QString &recentHtml, con
|
||||
mProgressBar->setRange( min, max );
|
||||
mProgressBar->setValue( value );
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------- QgsGrassImportItem ------------------------------
|
||||
|
||||
@ -1163,6 +1181,7 @@ QgsGrassImportItem::~QgsGrassImportItem()
|
||||
QgsGrassImportIcon::instance()->disconnectFrameChanged( this, &QgsGrassImportItem::updateIcon );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsGrassImportItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -1204,6 +1223,7 @@ void QgsGrassImportItem::cancel()
|
||||
setName( name() + " : " + tr( "canceling" ) );
|
||||
updateIcon();
|
||||
}
|
||||
#endif
|
||||
|
||||
QIcon QgsGrassImportItem::icon()
|
||||
{
|
||||
|
@ -25,6 +25,7 @@ class QProgressBar;
|
||||
|
||||
class QgsGrassImportItem;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
/* Qt does not allow inheritance from multiple QObjects, that is why we have QgsGrassItemActions
|
||||
* to keep common actions. QgsGrassItemActions must be children of data items, so that when a data item
|
||||
* is moved to to another thread, it moves also QgsGrassItemActions and signals work.
|
||||
@ -57,6 +58,10 @@ class QgsGrassItemActions : public QObject
|
||||
// Grass object is valid
|
||||
bool mValid;
|
||||
};
|
||||
#else
|
||||
// just a forward declaration
|
||||
class QgsGrassItemActions;
|
||||
#endif
|
||||
|
||||
class QgsGrassObjectItemBase
|
||||
{
|
||||
@ -78,7 +83,9 @@ class QgsGrassLocationItem : public QgsDirectoryItem, public QgsGrassObjectItemB
|
||||
QIcon icon() override { return QgsDataItem::icon(); }
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override { return mActions->actions(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
QgsGrassItemActions *mActions = nullptr;
|
||||
@ -95,7 +102,9 @@ class QgsGrassMapsetItem : public QgsDirectoryItem, public QgsGrassObjectItemBas
|
||||
QIcon icon() override;
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override { return mActions->actions(); }
|
||||
#endif
|
||||
virtual bool acceptDrop() override;
|
||||
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
|
||||
|
||||
@ -122,7 +131,9 @@ class QgsGrassObjectItem : public QgsLayerItem, public QgsGrassObjectItemBase
|
||||
QString name, QString path, QString uri,
|
||||
LayerType layerType, QString providerKey );
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override { return mActions->actions(); }
|
||||
#endif
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
|
||||
protected:
|
||||
@ -139,7 +150,9 @@ class QgsGrassVectorItem : public QgsDataCollectionItem, public QgsGrassObjectIt
|
||||
QgsGrassVectorItem( QgsDataItem *parent, QgsGrassObject grassObject, QString path, QString labelName = QString(), bool valid = true );
|
||||
~QgsGrassVectorItem();
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override { return mActions->actions(); }
|
||||
#endif
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
|
||||
public slots:
|
||||
@ -193,6 +206,7 @@ class QgsGrassGroupItem : public QgsGrassObjectItem
|
||||
|
||||
};
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
class QgsGrassImportItemWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -208,6 +222,7 @@ class QgsGrassImportItemWidget : public QWidget
|
||||
QTextEdit *mTextEdit = nullptr;
|
||||
QProgressBar *mProgressBar = nullptr;
|
||||
};
|
||||
#endif
|
||||
|
||||
// item representing a layer being imported
|
||||
class QgsGrassImportItem : public QgsDataItem, public QgsGrassObjectItemBase
|
||||
@ -219,13 +234,17 @@ class QgsGrassImportItem : public QgsDataItem, public QgsGrassObjectItemBase
|
||||
//virtual void setState( State state ) override {
|
||||
// QgsDataItem::setState(state);
|
||||
//} // do nothing to keep Populating
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
virtual QIcon icon() override;
|
||||
virtual QWidget *paramWidget() override;
|
||||
#endif
|
||||
virtual QIcon icon() override;
|
||||
|
||||
public slots:
|
||||
virtual void refresh() override {}
|
||||
#ifdef HAVE_GUI
|
||||
void cancel();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// override refresh to keep Populating state
|
||||
|
@ -1,22 +1,31 @@
|
||||
SET(MSSQL_SRCS
|
||||
qgsmssqlprovider.cpp
|
||||
qgsmssqlgeometryparser.cpp
|
||||
qgsmssqlsourceselect.cpp
|
||||
qgsmssqltablemodel.cpp
|
||||
qgsmssqlnewconnection.cpp
|
||||
qgsmssqldataitems.cpp
|
||||
qgsmssqlexpressioncompiler.cpp
|
||||
qgsmssqlfeatureiterator.cpp
|
||||
qgsmssqlgeomcolumntypethread.cpp
|
||||
)
|
||||
|
||||
SET(MSSQL_MOC_HDRS
|
||||
qgsmssqlprovider.h
|
||||
qgsmssqlsourceselect.h
|
||||
qgsmssqltablemodel.h
|
||||
qgsmssqlnewconnection.h
|
||||
qgsmssqldataitems.h
|
||||
qgsmssqlgeomcolumntypethread.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(MSSQL_SRCS ${MSSQL_SRCS}
|
||||
qgsmssqlsourceselect.cpp
|
||||
qgsmssqlnewconnection.cpp
|
||||
)
|
||||
SET(MSSQL_MOC_HDRS ${MSSQL_MOC_HDRS}
|
||||
qgsmssqlsourceselect.h
|
||||
qgsmssqlnewconnection.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
SET(MSSQL_HDRS
|
||||
qgsmssqlexpressioncompiler.h
|
||||
)
|
||||
@ -41,18 +50,29 @@ INCLUDE_DIRECTORIES(SYSTEM
|
||||
${GDAL_INCLUDE_DIR}
|
||||
${GEOS_INCLUDE_DIR}
|
||||
${QT_INCLUDE_DIR}
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
${PROJ_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
|
||||
ADD_LIBRARY(mssqlprovider MODULE ${MSSQL_SRCS} ${MSSQL_MOC_SRCS} ${MSSQL_HDRS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(mssqlprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
${QT_QTSQL_LIBRARY}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (mssqlprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
########################################################
|
||||
# Install
|
||||
|
||||
|
@ -17,8 +17,7 @@
|
||||
|
||||
#include "qgsmssqldataitems.h"
|
||||
|
||||
#include "qgsmssqlsourceselect.h"
|
||||
#include "qgsmssqlnewconnection.h"
|
||||
#include "qgsmssqlgeomcolumntypethread.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsmimedatautils.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
@ -28,6 +27,11 @@
|
||||
#include "qgssettings.h"
|
||||
#include "qgsmessageoutput.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsmssqlsourceselect.h"
|
||||
#include "qgsmssqlnewconnection.h"
|
||||
#endif
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlError>
|
||||
@ -326,10 +330,10 @@ bool QgsMssqlConnectionItem::equal( const QgsDataItem *other )
|
||||
return ( mPath == o->mPath && mName == o->mName );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsMssqlConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
|
||||
QAction *actionShowNoGeom = new QAction( tr( "Show Non-Spatial Tables" ), this );
|
||||
actionShowNoGeom->setCheckable( true );
|
||||
actionShowNoGeom->setChecked( mAllowGeometrylessTables );
|
||||
@ -372,6 +376,7 @@ void QgsMssqlConnectionItem::deleteConnection()
|
||||
// the parent should be updated
|
||||
mParent->refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool QgsMssqlConnectionItem::handleDrop( const QMimeData *data, Qt::DropAction )
|
||||
{
|
||||
@ -599,6 +604,7 @@ QVector<QgsDataItem *> QgsMssqlRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsMssqlRootItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -630,3 +636,4 @@ void QgsMssqlRootItem::newConnection()
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -22,7 +22,8 @@
|
||||
|
||||
#include "qgsdataitem.h"
|
||||
|
||||
#include "qgsmssqlsourceselect.h"
|
||||
#include "qgsmssqltablemodel.h"
|
||||
class QgsMssqlGeomColumnTypeThread;
|
||||
|
||||
class QgsMssqlRootItem;
|
||||
class QgsMssqlConnectionItem;
|
||||
@ -37,13 +38,16 @@ class QgsMssqlRootItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QWidget *paramWidget() override;
|
||||
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
class QgsMssqlConnectionItem : public QgsDataCollectionItem
|
||||
@ -55,7 +59,9 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
virtual bool acceptDrop() override { return true; }
|
||||
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
|
||||
@ -68,9 +74,11 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem
|
||||
void addGeometryColumn( const QgsMssqlLayerProperty & );
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
void setAllowGeometrylessTables( bool allow );
|
||||
#endif
|
||||
|
||||
void setLayerType( QgsMssqlLayerProperty layerProperty );
|
||||
|
||||
|
107
src/providers/mssql/qgsmssqlgeomcolumntypethread.cpp
Normal file
107
src/providers/mssql/qgsmssqlgeomcolumntypethread.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
#include "qgsmssqlgeomcolumntypethread.h"
|
||||
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "qgslogger.h"
|
||||
#include "qgsmssqlprovider.h"
|
||||
|
||||
QgsMssqlGeomColumnTypeThread::QgsMssqlGeomColumnTypeThread( const QString &connectionName, bool useEstimatedMetadata )
|
||||
: QThread()
|
||||
, mConnectionName( connectionName )
|
||||
, mUseEstimatedMetadata( useEstimatedMetadata )
|
||||
, mStopped( false )
|
||||
{
|
||||
qRegisterMetaType<QgsMssqlLayerProperty>( "QgsMssqlLayerProperty" );
|
||||
}
|
||||
|
||||
void QgsMssqlGeomColumnTypeThread::addGeometryColumn( const QgsMssqlLayerProperty &layerProperty )
|
||||
{
|
||||
layerProperties << layerProperty;
|
||||
}
|
||||
|
||||
void QgsMssqlGeomColumnTypeThread::stop()
|
||||
{
|
||||
mStopped = true;
|
||||
}
|
||||
|
||||
void QgsMssqlGeomColumnTypeThread::run()
|
||||
{
|
||||
mStopped = false;
|
||||
|
||||
for ( QList<QgsMssqlLayerProperty>::iterator it = layerProperties.begin(),
|
||||
end = layerProperties.end();
|
||||
it != end; ++it )
|
||||
{
|
||||
QgsMssqlLayerProperty &layerProperty = *it;
|
||||
|
||||
if ( !mStopped )
|
||||
{
|
||||
QString table;
|
||||
table = QStringLiteral( "%1[%2]" )
|
||||
.arg( layerProperty.schemaName.isEmpty() ? QLatin1String( "" ) : QStringLiteral( "[%1]." ).arg( layerProperty.schemaName ),
|
||||
layerProperty.tableName );
|
||||
|
||||
QString query = QString( "SELECT %3"
|
||||
" UPPER([%1].STGeometryType()),"
|
||||
" [%1].STSrid"
|
||||
" FROM %2"
|
||||
" WHERE [%1] IS NOT NULL %4"
|
||||
" GROUP BY [%1].STGeometryType(), [%1].STSrid" )
|
||||
.arg( layerProperty.geometryColName,
|
||||
table,
|
||||
mUseEstimatedMetadata ? "TOP 1" : "",
|
||||
layerProperty.sql.isEmpty() ? QLatin1String( "" ) : QStringLiteral( " AND %1" ).arg( layerProperty.sql ) );
|
||||
|
||||
// issue the sql query
|
||||
QSqlDatabase db = QSqlDatabase::database( mConnectionName );
|
||||
if ( !QgsMssqlProvider::OpenDatabase( db ) )
|
||||
{
|
||||
QgsDebugMsg( db.lastError().text() );
|
||||
continue;
|
||||
}
|
||||
|
||||
QSqlQuery q = QSqlQuery( db );
|
||||
q.setForwardOnly( true );
|
||||
if ( !q.exec( query ) )
|
||||
{
|
||||
QgsDebugMsg( q.lastError().text() );
|
||||
}
|
||||
|
||||
QString type;
|
||||
QString srid;
|
||||
|
||||
if ( q.isActive() )
|
||||
{
|
||||
QStringList types;
|
||||
QStringList srids;
|
||||
|
||||
while ( q.next() )
|
||||
{
|
||||
QString type = q.value( 0 ).toString().toUpper();
|
||||
QString srid = q.value( 1 ).toString();
|
||||
|
||||
if ( type.isEmpty() )
|
||||
continue;
|
||||
|
||||
types << type;
|
||||
srids << srid;
|
||||
}
|
||||
|
||||
type = types.join( QStringLiteral( "," ) );
|
||||
srid = srids.join( QStringLiteral( "," ) );
|
||||
}
|
||||
|
||||
layerProperty.type = type;
|
||||
layerProperty.srid = srid;
|
||||
}
|
||||
else
|
||||
{
|
||||
layerProperty.type = QLatin1String( "" );
|
||||
layerProperty.srid = QLatin1String( "" );
|
||||
}
|
||||
|
||||
// Now tell the layer list dialog box...
|
||||
emit setLayerType( layerProperty );
|
||||
}
|
||||
}
|
38
src/providers/mssql/qgsmssqlgeomcolumntypethread.h
Normal file
38
src/providers/mssql/qgsmssqlgeomcolumntypethread.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef QGSMSSQLGEOMCOLUMNTYPETHREAD_H
|
||||
#define QGSMSSQLGEOMCOLUMNTYPETHREAD_H
|
||||
|
||||
#include "qgsmssqltablemodel.h"
|
||||
|
||||
#include <QThread>
|
||||
|
||||
// A class that determines the geometry type of a given database
|
||||
// schema.table.column, with the option of doing so in a separate
|
||||
// thread.
|
||||
|
||||
class QgsMssqlGeomColumnTypeThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QgsMssqlGeomColumnTypeThread( const QString &connectionName, bool useEstimatedMetadata );
|
||||
|
||||
// These functions get the layer types and pass that information out
|
||||
// by emitting the setLayerType() signal.
|
||||
virtual void run() override;
|
||||
|
||||
signals:
|
||||
void setLayerType( const QgsMssqlLayerProperty &layerProperty );
|
||||
|
||||
public slots:
|
||||
void addGeometryColumn( const QgsMssqlLayerProperty &layerProperty );
|
||||
void stop();
|
||||
|
||||
private:
|
||||
QgsMssqlGeomColumnTypeThread() {}
|
||||
|
||||
QString mConnectionName;
|
||||
bool mUseEstimatedMetadata;
|
||||
bool mStopped;
|
||||
QList<QgsMssqlLayerProperty> layerProperties;
|
||||
};
|
||||
|
||||
#endif // QGSMSSQLGEOMCOLUMNTYPETHREAD_H
|
@ -44,11 +44,13 @@
|
||||
#include "qgsrectangle.h"
|
||||
#include "qgis.h"
|
||||
|
||||
#include "qgsmssqlsourceselect.h"
|
||||
#include "qgsmssqldataitems.h"
|
||||
|
||||
#include "qgsmssqlfeatureiterator.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsmssqlsourceselect.h"
|
||||
#endif
|
||||
|
||||
static const QString TEXT_PROVIDER_KEY = QStringLiteral( "mssql" );
|
||||
static const QString TEXT_PROVIDER_DESCRIPTION = QStringLiteral( "MSSQL spatial data provider" );
|
||||
int QgsMssqlProvider::sConnectionId = 0;
|
||||
@ -1956,10 +1958,12 @@ QGISEXTERN bool isProvider()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN void *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsMssqlSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN int dataCapabilities()
|
||||
{
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "qgslogger.h"
|
||||
#include "qgsapplication.h"
|
||||
#include "qgscontexthelp.h"
|
||||
#include "qgsmssqlgeomcolumntypethread.h"
|
||||
#include "qgsmssqlprovider.h"
|
||||
#include "qgsmssqlnewconnection.h"
|
||||
#include "qgsmanageconnectionsdialog.h"
|
||||
@ -740,103 +741,3 @@ void QgsMssqlSourceSelect::treeWidgetSelectionChanged( const QItemSelection &sel
|
||||
Q_UNUSED( deselected )
|
||||
mAddButton->setEnabled( !selected.isEmpty() );
|
||||
}
|
||||
|
||||
QgsMssqlGeomColumnTypeThread::QgsMssqlGeomColumnTypeThread( const QString &connectionName, bool useEstimatedMetadata )
|
||||
: QThread()
|
||||
, mConnectionName( connectionName )
|
||||
, mUseEstimatedMetadata( useEstimatedMetadata )
|
||||
, mStopped( false )
|
||||
{
|
||||
qRegisterMetaType<QgsMssqlLayerProperty>( "QgsMssqlLayerProperty" );
|
||||
}
|
||||
|
||||
void QgsMssqlGeomColumnTypeThread::addGeometryColumn( const QgsMssqlLayerProperty &layerProperty )
|
||||
{
|
||||
layerProperties << layerProperty;
|
||||
}
|
||||
|
||||
void QgsMssqlGeomColumnTypeThread::stop()
|
||||
{
|
||||
mStopped = true;
|
||||
}
|
||||
|
||||
void QgsMssqlGeomColumnTypeThread::run()
|
||||
{
|
||||
mStopped = false;
|
||||
|
||||
for ( QList<QgsMssqlLayerProperty>::iterator it = layerProperties.begin(),
|
||||
end = layerProperties.end();
|
||||
it != end; ++it )
|
||||
{
|
||||
QgsMssqlLayerProperty &layerProperty = *it;
|
||||
|
||||
if ( !mStopped )
|
||||
{
|
||||
QString table;
|
||||
table = QStringLiteral( "%1[%2]" )
|
||||
.arg( layerProperty.schemaName.isEmpty() ? QLatin1String( "" ) : QStringLiteral( "[%1]." ).arg( layerProperty.schemaName ),
|
||||
layerProperty.tableName );
|
||||
|
||||
QString query = QString( "SELECT %3"
|
||||
" UPPER([%1].STGeometryType()),"
|
||||
" [%1].STSrid"
|
||||
" FROM %2"
|
||||
" WHERE [%1] IS NOT NULL %4"
|
||||
" GROUP BY [%1].STGeometryType(), [%1].STSrid" )
|
||||
.arg( layerProperty.geometryColName,
|
||||
table,
|
||||
mUseEstimatedMetadata ? "TOP 1" : "",
|
||||
layerProperty.sql.isEmpty() ? QLatin1String( "" ) : QStringLiteral( " AND %1" ).arg( layerProperty.sql ) );
|
||||
|
||||
// issue the sql query
|
||||
QSqlDatabase db = QSqlDatabase::database( mConnectionName );
|
||||
if ( !QgsMssqlProvider::OpenDatabase( db ) )
|
||||
{
|
||||
QgsDebugMsg( db.lastError().text() );
|
||||
continue;
|
||||
}
|
||||
|
||||
QSqlQuery q = QSqlQuery( db );
|
||||
q.setForwardOnly( true );
|
||||
if ( !q.exec( query ) )
|
||||
{
|
||||
QgsDebugMsg( q.lastError().text() );
|
||||
}
|
||||
|
||||
QString type;
|
||||
QString srid;
|
||||
|
||||
if ( q.isActive() )
|
||||
{
|
||||
QStringList types;
|
||||
QStringList srids;
|
||||
|
||||
while ( q.next() )
|
||||
{
|
||||
QString type = q.value( 0 ).toString().toUpper();
|
||||
QString srid = q.value( 1 ).toString();
|
||||
|
||||
if ( type.isEmpty() )
|
||||
continue;
|
||||
|
||||
types << type;
|
||||
srids << srid;
|
||||
}
|
||||
|
||||
type = types.join( QStringLiteral( "," ) );
|
||||
srid = srids.join( QStringLiteral( "," ) );
|
||||
}
|
||||
|
||||
layerProperty.type = type;
|
||||
layerProperty.srid = srid;
|
||||
}
|
||||
else
|
||||
{
|
||||
layerProperty.type = QLatin1String( "" );
|
||||
layerProperty.srid = QLatin1String( "" );
|
||||
}
|
||||
|
||||
// Now tell the layer list dialog box...
|
||||
emit setLayerType( layerProperty );
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,10 @@
|
||||
#include <QPair>
|
||||
#include <QIcon>
|
||||
#include <QItemDelegate>
|
||||
#include <QThread>
|
||||
|
||||
class QPushButton;
|
||||
class QStringList;
|
||||
class QgsGeomColumnTypeThread;
|
||||
class QgsMssqlGeomColumnTypeThread;
|
||||
class QgisApp;
|
||||
|
||||
class QgsMssqlSourceSelectDelegate : public QItemDelegate
|
||||
@ -48,35 +47,7 @@ class QgsMssqlSourceSelectDelegate : public QItemDelegate
|
||||
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
|
||||
};
|
||||
|
||||
// A class that determines the geometry type of a given database
|
||||
// schema.table.column, with the option of doing so in a separate
|
||||
// thread.
|
||||
|
||||
class QgsMssqlGeomColumnTypeThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QgsMssqlGeomColumnTypeThread( const QString &connectionName, bool useEstimatedMetadata );
|
||||
|
||||
// These functions get the layer types and pass that information out
|
||||
// by emitting the setLayerType() signal.
|
||||
virtual void run() override;
|
||||
|
||||
signals:
|
||||
void setLayerType( const QgsMssqlLayerProperty &layerProperty );
|
||||
|
||||
public slots:
|
||||
void addGeometryColumn( const QgsMssqlLayerProperty &layerProperty );
|
||||
void stop();
|
||||
|
||||
private:
|
||||
QgsMssqlGeomColumnTypeThread() {}
|
||||
|
||||
QString mConnectionName;
|
||||
bool mUseEstimatedMetadata;
|
||||
bool mStopped;
|
||||
QList<QgsMssqlLayerProperty> layerProperties;
|
||||
};
|
||||
|
||||
|
||||
/** \class QgsMssqlSourceSelect
|
||||
|
@ -15,6 +15,9 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSMSSQLTABLEMODEL_H
|
||||
#define QGSMSSQLTABLEMODEL_H
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include "qgis.h"
|
||||
@ -84,3 +87,4 @@ class QgsMssqlTableModel : public QStandardItemModel
|
||||
int mTableCount;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -7,7 +7,6 @@ SET(ORACLE_SRCS
|
||||
qgsoracleprovider.cpp
|
||||
qgsoracleconn.cpp
|
||||
qgsoracledataitems.cpp
|
||||
qgsoraclesourceselect.cpp
|
||||
qgsoraclenewconnection.cpp
|
||||
qgsoracletablecache.cpp
|
||||
qgsoracletablemodel.cpp
|
||||
@ -21,13 +20,21 @@ SET(ORACLE_MOC_HDRS
|
||||
qgsoracleprovider.h
|
||||
qgsoracleconn.h
|
||||
qgsoracledataitems.h
|
||||
qgsoraclesourceselect.h
|
||||
qgsoraclenewconnection.h
|
||||
qgsoracletablemodel.h
|
||||
qgsoraclecolumntypethread.h
|
||||
qgsoracleconnpool.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(ORACLE_SRCS ${ORACLE_SRCS}
|
||||
qgsoraclesourceselect.cpp
|
||||
)
|
||||
SET(ORACLE_MOC_HDRS ${ORACLE_MOC_HDRS}
|
||||
qgsoraclesourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
SET(ORACLE_HDRS
|
||||
qgsoracleexpressioncompiler.h
|
||||
)
|
||||
@ -52,17 +59,27 @@ INCLUDE_DIRECTORIES(
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${GEOS_INCLUDE_DIR}
|
||||
${QT_QTSQL_INCLUDEDIR}
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
ADD_LIBRARY (oracleprovider MODULE ${ORACLE_SRCS} ${ORACLE_HDRS} ${ORACLE_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES (oracleprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
${QT_QTSQL_LIBRARY}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (oracleprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
|
||||
########################################################
|
||||
# Install
|
||||
|
@ -27,11 +27,14 @@
|
||||
|
||||
#include "qgsoracleprovider.h"
|
||||
#include "qgsoracletablemodel.h"
|
||||
#include "qgsoraclesourceselect.h"
|
||||
#include "qgsoracledataitems.h"
|
||||
#include "qgsoraclefeatureiterator.h"
|
||||
#include "qgsoracleconnpool.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsoraclesourceselect.h"
|
||||
#endif
|
||||
|
||||
#include <QSqlRecord>
|
||||
#include <QSqlField>
|
||||
#include <QMessageBox>
|
||||
@ -3040,10 +3043,12 @@ QGISEXTERN bool isProvider()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN QgsOracleSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsOracleSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN int dataCapabilities()
|
||||
{
|
||||
|
@ -30,9 +30,14 @@ ADD_LIBRARY (owsprovider MODULE ${OWS_SRCS} ${OWS_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES (owsprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (owsprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
INSTALL(TARGETS owsprovider
|
||||
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
|
||||
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
|
||||
|
@ -18,7 +18,11 @@
|
||||
#include "qgslogger.h"
|
||||
#include "qgsdatasourceuri.h"
|
||||
#include "qgsowsconnection.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#include "qgsowssourceselect.h"
|
||||
#endif
|
||||
|
||||
#include "qgsapplication.h"
|
||||
|
||||
@ -129,6 +133,7 @@ bool QgsOWSConnectionItem::equal( const QgsDataItem *other )
|
||||
return ( o && mPath == o->mPath && mName == o->mName );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsOWSConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -165,6 +170,7 @@ void QgsOWSConnectionItem::deleteConnection()
|
||||
mParent->refresh();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -205,6 +211,7 @@ QVector<QgsDataItem *> QgsOWSRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsOWSRootItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -244,6 +251,7 @@ void QgsOWSRootItem::newConnection()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -27,11 +27,15 @@ class QgsOWSConnectionItem : public QgsDataCollectionItem
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void replacePath( QgsDataItem *item, QString before, QString after );
|
||||
@ -46,14 +50,17 @@ class QgsOWSRootItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
|
||||
virtual QWidget *paramWidget() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // QGSOWSDATAITEMS_H
|
||||
|
@ -8,8 +8,6 @@ SET(PG_SRCS
|
||||
qgspostgresdataitems.cpp
|
||||
qgspostgresfeatureiterator.cpp
|
||||
qgspostgrestransaction.cpp
|
||||
qgspgsourceselect.cpp
|
||||
qgspgnewconnection.cpp
|
||||
qgspgtablemodel.cpp
|
||||
qgscolumntypethread.cpp
|
||||
qgspostgresexpressioncompiler.cpp
|
||||
@ -17,8 +15,6 @@ SET(PG_SRCS
|
||||
|
||||
SET(PG_MOC_HDRS
|
||||
qgscolumntypethread.h
|
||||
qgspgnewconnection.h
|
||||
qgspgsourceselect.h
|
||||
qgspgtablemodel.h
|
||||
qgspostgresconn.h
|
||||
qgspostgresconnpool.h
|
||||
@ -28,6 +24,17 @@ SET(PG_MOC_HDRS
|
||||
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(PG_SRCS ${PG_SRCS}
|
||||
qgspgsourceselect.cpp
|
||||
qgspgnewconnection.cpp
|
||||
)
|
||||
SET(PG_MOC_HDRS ${PG_MOC_HDRS}
|
||||
qgspgnewconnection.h
|
||||
qgspgsourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
SET(PG_HDRS
|
||||
qgspostgresexpressioncompiler.h
|
||||
)
|
||||
@ -54,24 +61,38 @@ INCLUDE_DIRECTORIES(
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${POSTGRES_INCLUDE_DIR}
|
||||
${GEOS_INCLUDE_DIR}
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
${QCA_INCLUDE_DIR}
|
||||
${QTKEYCHAIN_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
ADD_LIBRARY (postgresprovider_a STATIC ${PG_SRCS} ${PG_HDRS} ${PG_MOC_SRCS})
|
||||
ADD_LIBRARY (postgresprovider MODULE ${PG_SRCS} ${PG_HDRS} ${PG_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES (postgresprovider_a
|
||||
${POSTGRES_LIBRARY}
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
TARGET_LINK_LIBRARIES (postgresprovider
|
||||
${POSTGRES_LIBRARY}
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (postgresprovider_a
|
||||
qgis_gui
|
||||
)
|
||||
TARGET_LINK_LIBRARIES (postgresprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
|
||||
# clang-tidy
|
||||
IF(CLANG_TIDY_EXE)
|
||||
SET_TARGET_PROPERTIES(
|
||||
|
@ -16,15 +16,19 @@
|
||||
|
||||
#include "qgspostgresconn.h"
|
||||
#include "qgspostgresconnpool.h"
|
||||
#include "qgspgnewconnection.h"
|
||||
#include "qgscolumntypethread.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsdatasourceuri.h"
|
||||
#include "qgsapplication.h"
|
||||
#include "qgsmessageoutput.h"
|
||||
#include "qgsnewnamedialog.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgspgnewconnection.h"
|
||||
#include "qgsnewnamedialog.h"
|
||||
#include "qgspgsourceselect.h"
|
||||
#endif
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QProgressDialog>
|
||||
@ -91,6 +95,7 @@ bool QgsPGConnectionItem::equal( const QgsDataItem *other )
|
||||
return ( mPath == o->mPath && mName == o->mName );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsPGConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -152,17 +157,6 @@ void QgsPGConnectionItem::refreshConnection()
|
||||
refresh();
|
||||
}
|
||||
|
||||
void QgsPGConnectionItem::refreshSchema( const QString &schema )
|
||||
{
|
||||
Q_FOREACH ( QgsDataItem *child, mChildren )
|
||||
{
|
||||
if ( child->name() == schema || schema.isEmpty() )
|
||||
{
|
||||
child->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QgsPGConnectionItem::createSchema()
|
||||
{
|
||||
QString schemaName = QInputDialog::getText( nullptr, tr( "Create Schema" ), tr( "Schema name:" ) );
|
||||
@ -192,6 +186,18 @@ void QgsPGConnectionItem::createSchema()
|
||||
conn->unref();
|
||||
refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
void QgsPGConnectionItem::refreshSchema( const QString &schema )
|
||||
{
|
||||
Q_FOREACH ( QgsDataItem *child, mChildren )
|
||||
{
|
||||
if ( child->name() == schema || schema.isEmpty() )
|
||||
{
|
||||
child->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsPGConnectionItem::handleDrop( const QMimeData *data, Qt::DropAction )
|
||||
{
|
||||
@ -291,6 +297,7 @@ QString QgsPGLayerItem::comments() const
|
||||
return mLayerProperty.tableComment;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsPGLayerItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -428,6 +435,7 @@ void QgsPGLayerItem::truncateTable()
|
||||
conn->unref();
|
||||
QMessageBox::information( nullptr, tr( "Truncate Table" ), tr( "Table truncated successfully." ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
QString QgsPGLayerItem::createUri()
|
||||
{
|
||||
@ -515,6 +523,7 @@ QVector<QgsDataItem *> QgsPGSchemaItem::createChildren()
|
||||
return items;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsPGSchemaItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -640,6 +649,7 @@ void QgsPGSchemaItem::renameSchema()
|
||||
if ( mParent )
|
||||
mParent->refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
QgsPGLayerItem *QgsPGSchemaItem::createLayer( QgsPostgresLayerProperty layerProperty )
|
||||
{
|
||||
@ -709,6 +719,7 @@ QVector<QgsDataItem *> QgsPGRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsPGRootItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -740,6 +751,7 @@ void QgsPGRootItem::newConnection()
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QMainWindow *QgsPGRootItem::sMainWindow = nullptr;
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "qgsdataitem.h"
|
||||
|
||||
#include "qgspostgresconn.h"
|
||||
#include "qgspgsourceselect.h"
|
||||
#include "qgsmimedatautils.h"
|
||||
#include "qgsvectorlayerexporter.h"
|
||||
|
||||
@ -37,15 +36,19 @@ class QgsPGRootItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QWidget *paramWidget() override;
|
||||
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
static QMainWindow *sMainWindow;
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
class QgsPGConnectionItem : public QgsDataCollectionItem
|
||||
@ -56,7 +59,9 @@ class QgsPGConnectionItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
virtual bool acceptDrop() override { return true; }
|
||||
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
|
||||
@ -67,12 +72,16 @@ class QgsPGConnectionItem : public QgsDataCollectionItem
|
||||
void addGeometryColumn( const QgsPostgresLayerProperty & );
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
void refreshConnection();
|
||||
void createSchema();
|
||||
#endif
|
||||
|
||||
// refresh specified schema or all schemas if schema name is empty
|
||||
void refreshSchema( const QString &schema );
|
||||
void createSchema();
|
||||
|
||||
};
|
||||
|
||||
class QgsPGSchemaItem : public QgsDataCollectionItem
|
||||
@ -82,14 +91,18 @@ class QgsPGSchemaItem : public QgsDataCollectionItem
|
||||
QgsPGSchemaItem( QgsDataItem *parent, const QString &connectionName, const QString &name, const QString &path );
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
virtual bool acceptDrop() override { return true; }
|
||||
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void deleteSchema();
|
||||
void renameSchema();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QgsPGLayerItem *createLayer( QgsPostgresLayerProperty layerProperty );
|
||||
@ -106,13 +119,17 @@ class QgsPGLayerItem : public QgsLayerItem
|
||||
|
||||
QString createUri();
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
virtual QString comments() const override;
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void deleteLayer();
|
||||
void renameLayer();
|
||||
void truncateTable();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QgsPostgresLayerProperty mLayerProperty;
|
||||
|
@ -32,13 +32,16 @@
|
||||
#include "qgspostgresprovider.h"
|
||||
#include "qgspostgresconn.h"
|
||||
#include "qgspostgresconnpool.h"
|
||||
#include "qgspgsourceselect.h"
|
||||
#include "qgspostgresdataitems.h"
|
||||
#include "qgspostgresfeatureiterator.h"
|
||||
#include "qgspostgrestransaction.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsfeedback.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgspgsourceselect.h"
|
||||
#endif
|
||||
|
||||
const QString POSTGRES_KEY = QStringLiteral( "postgres" );
|
||||
const QString POSTGRES_DESCRIPTION = QStringLiteral( "PostgreSQL/PostGIS data provider" );
|
||||
static const QString EDITOR_WIDGET_STYLES_TABLE = QStringLiteral( "qgis_editor_widget_styles" );
|
||||
@ -4262,10 +4265,12 @@ QGISEXTERN bool isProvider()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN QgsPgSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsPgSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN int dataCapabilities()
|
||||
{
|
||||
|
@ -11,7 +11,6 @@ SET(SPATIALITE_SRCS
|
||||
qgsspatialiteconnection.cpp
|
||||
qgsspatialiteconnpool.cpp
|
||||
qgsspatialitefeatureiterator.cpp
|
||||
qgsspatialitesourceselect.cpp
|
||||
qgsspatialitetablemodel.cpp
|
||||
)
|
||||
|
||||
@ -19,20 +18,31 @@ SET(SPATIALITE_MOC_HDRS
|
||||
qgsspatialiteprovider.h
|
||||
qgsspatialiteconnpool.h
|
||||
qgsspatialitedataitems.h
|
||||
qgsspatialitesourceselect.h
|
||||
qgsspatialitetablemodel.h
|
||||
qgsspatialiteconnection.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(SPATIALITE_SRCS ${SPATIALITE_SRCS}
|
||||
qgsspatialitesourceselect.cpp
|
||||
)
|
||||
SET(SPATIALITE_MOC_HDRS ${SPATIALITE_MOC_HDRS}
|
||||
qgsspatialitesourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
|
||||
########################################################
|
||||
# Build
|
||||
|
||||
QT5_WRAP_CPP(SPATIALITE_MOC_SRCS ${SPATIALITE_MOC_HDRS})
|
||||
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/src/core
|
||||
${CMAKE_SOURCE_DIR}/src/core/expression
|
||||
@ -54,10 +64,15 @@ ADD_LIBRARY (spatialiteprovider MODULE ${SPATIALITE_SRCS} ${SPATIALITE_MOC_SRCS}
|
||||
|
||||
TARGET_LINK_LIBRARIES(spatialiteprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
${SPATIALITE_LIBRARY}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (spatialiteprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
# clang-tidy
|
||||
IF(CLANG_TIDY_EXE)
|
||||
SET_TARGET_PROPERTIES(
|
||||
|
@ -16,7 +16,10 @@
|
||||
|
||||
#include "qgsspatialiteprovider.h"
|
||||
#include "qgsspatialiteconnection.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsspatialitesourceselect.h"
|
||||
#endif
|
||||
|
||||
#include "qgslogger.h"
|
||||
#include "qgsmimedatautils.h"
|
||||
@ -26,6 +29,7 @@
|
||||
#include "qgssettings.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
QGISEXTERN bool deleteLayer( const QString &dbPath, const QString &tableName, QString &errCause );
|
||||
@ -36,6 +40,7 @@ QgsSLLayerItem::QgsSLLayerItem( QgsDataItem *parent, QString name, QString path,
|
||||
setState( Populated ); // no children are expected
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsSLLayerItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -67,6 +72,7 @@ void QgsSLLayerItem::deleteLayer()
|
||||
mParent->refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------
|
||||
|
||||
@ -158,6 +164,7 @@ bool QgsSLConnectionItem::equal( const QgsDataItem *other )
|
||||
return o && mPath == o->mPath && mName == o->mName;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsSLConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -188,6 +195,7 @@ void QgsSLConnectionItem::deleteConnection()
|
||||
// the parent should be updated
|
||||
mParent->refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool QgsSLConnectionItem::handleDrop( const QMimeData *data, Qt::DropAction )
|
||||
{
|
||||
@ -286,6 +294,7 @@ QVector<QgsDataItem *> QgsSLRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsSLRootItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -320,6 +329,7 @@ void QgsSLRootItem::newConnection()
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN bool createDb( const QString &dbPath, QString &errCause );
|
||||
|
||||
@ -350,11 +360,13 @@ void QgsSLRootItem::createDatabase()
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN QgsSpatiaLiteSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
// TODO: this should be somewhere else
|
||||
return new QgsSpatiaLiteSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN int dataCapabilities()
|
||||
{
|
||||
|
@ -23,10 +23,14 @@ class QgsSLLayerItem : public QgsLayerItem
|
||||
public:
|
||||
QgsSLLayerItem( QgsDataItem *parent, QString name, QString path, QString uri, LayerType layerType );
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void deleteLayer();
|
||||
#endif
|
||||
};
|
||||
|
||||
class QgsSLConnectionItem : public QgsDataCollectionItem
|
||||
@ -38,14 +42,18 @@ class QgsSLConnectionItem : public QgsDataCollectionItem
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
virtual bool acceptDrop() override { return true; }
|
||||
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) override;
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
QString mDbPath;
|
||||
@ -59,13 +67,16 @@ class QgsSLRootItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QWidget *paramWidget() override;
|
||||
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
void newConnection();
|
||||
#endif
|
||||
void createDatabase();
|
||||
};
|
||||
|
||||
|
@ -4,29 +4,35 @@
|
||||
|
||||
QT5_ADD_RESOURCES(QGIS_VLAYER_SQL_FUNCTIONS_RCC sqlfunctionslist.qrc)
|
||||
|
||||
QT5_WRAP_CPP(vlayer_provider_MOC_SRCS
|
||||
SET(vlayer_provider_MOC_HDRS
|
||||
qgsvirtuallayerprovider.h
|
||||
qgsslottofunction.h
|
||||
qgsvirtuallayersourceselect.h
|
||||
qgsembeddedlayerselectdialog.h
|
||||
)
|
||||
|
||||
QT5_WRAP_UI(vlayer_provider_UI_H qgsvirtuallayersourceselectbase.ui qgsembeddedlayerselect.ui)
|
||||
|
||||
SET(QGIS_VLAYER_PROVIDER_SRCS
|
||||
${vlayer_provider_MOC_SRCS}
|
||||
${vlayer_provider_UI_H}
|
||||
${QGIS_VLAYER_SQL_FUNCTIONS_RCC}
|
||||
qgsvirtuallayerprovider.cpp
|
||||
qgsvirtuallayerfeatureiterator.cpp
|
||||
qgsvirtuallayerblob.cpp
|
||||
qgsvirtuallayersqlitemodule.cpp
|
||||
qgsvirtuallayersqlitehelper.cpp
|
||||
qgsvirtuallayerqueryparser.cpp
|
||||
qgsvirtuallayersourceselect.cpp
|
||||
qgsembeddedlayerselectdialog.cpp
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(QGIS_VLAYER_PROVIDER_SRCS ${QGIS_VLAYER_PROVIDER_SRCS}
|
||||
qgsvirtuallayersourceselect.cpp
|
||||
qgsembeddedlayerselectdialog.cpp
|
||||
)
|
||||
SET(vlayer_provider_MOC_HDRS ${vlayer_provider_MOC_HDRS}
|
||||
qgsvirtuallayersourceselect.h
|
||||
qgsembeddedlayerselectdialog.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
QT5_WRAP_UI(vlayer_provider_UI_H qgsvirtuallayersourceselectbase.ui qgsembeddedlayerselect.ui)
|
||||
|
||||
QT5_WRAP_CPP(vlayer_provider_MOC_SRCS ${vlayer_provider_MOC_HDRS})
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/src/core
|
||||
${CMAKE_SOURCE_DIR}/src/core/auth
|
||||
@ -48,23 +54,36 @@ INCLUDE_DIRECTORIES(SYSTEM
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
${SPATIALITE_INCLUDE_DIR}
|
||||
${GEOS_INCLUDE_DIR}
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
${QCA_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
ADD_LIBRARY(virtuallayerprovider MODULE
|
||||
${QGIS_VLAYER_PROVIDER_SRCS}
|
||||
${vlayer_provider_MOC_SRCS}
|
||||
${vlayer_provider_UI_H}
|
||||
${QGIS_VLAYER_SQL_FUNCTIONS_RCC}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES( virtuallayerprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTGUI_LIBRARY}
|
||||
${SQLITE3_LIBRARY}
|
||||
${SPATIALITE_LIBRARY}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (virtuallayerprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
INSTALL(TARGETS virtuallayerprovider
|
||||
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
|
||||
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
|
||||
|
@ -3,17 +3,24 @@ SET (WCS_SRCS
|
||||
../gdal/qgsgdalproviderbase.cpp
|
||||
qgswcsprovider.cpp
|
||||
qgswcscapabilities.cpp
|
||||
qgswcssourceselect.cpp
|
||||
qgswcsdataitems.cpp
|
||||
)
|
||||
|
||||
SET (WCS_MOC_HDRS
|
||||
qgswcsprovider.h
|
||||
qgswcscapabilities.h
|
||||
qgswcssourceselect.h
|
||||
qgswcsdataitems.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(WCS_SRCS ${WCS_SRCS}
|
||||
qgswcssourceselect.cpp
|
||||
)
|
||||
SET(WCS_MOC_HDRS ${WCS_MOC_HDRS}
|
||||
qgswcssourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
QT5_WRAP_CPP (WCS_MOC_SRCS ${WCS_MOC_HDRS})
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
@ -42,9 +49,14 @@ ADD_LIBRARY(wcsprovider MODULE ${WCS_SRCS} ${WCS_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(wcsprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (wcsprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
INSTALL (TARGETS wcsprovider
|
||||
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
|
||||
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
|
||||
|
@ -17,9 +17,12 @@
|
||||
#include "qgswcsprovider.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsdatasourceuri.h"
|
||||
#include "qgswcssourceselect.h"
|
||||
#include "qgsowsconnection.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgswcssourceselect.h"
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#endif
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QSettings>
|
||||
@ -82,6 +85,7 @@ bool QgsWCSConnectionItem::equal( const QgsDataItem *other )
|
||||
return ( mPath == o->mPath && mName == o->mName );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsWCSConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -114,6 +118,7 @@ void QgsWCSConnectionItem::deleteConnection()
|
||||
// the parent should be updated
|
||||
mParent->refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -240,6 +245,7 @@ QVector<QgsDataItem *>QgsWCSRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsWCSRootItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -273,6 +279,7 @@ void QgsWCSRootItem::newConnection()
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@ -304,8 +311,9 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN QgsWCSSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsWCSSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -29,14 +29,18 @@ class QgsWCSConnectionItem : public QgsDataCollectionItem
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
QgsWcsCapabilities mWcsCapabilities;
|
||||
QVector<QgsWcsCoverageSummary> mLayerProperties;
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QString mUri;
|
||||
@ -69,14 +73,16 @@ class QgsWCSRootItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
|
||||
virtual QWidget *paramWidget() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // QGSWCSDATAITEMS_H
|
||||
|
@ -7,7 +7,6 @@ SET(WFS_SRCS
|
||||
qgswfscapabilities.cpp
|
||||
qgswfsdataitems.cpp
|
||||
qgswfsfeatureiterator.cpp
|
||||
qgswfssourceselect.cpp
|
||||
qgswfsrequest.cpp
|
||||
qgswfsconnection.cpp
|
||||
qgswfsdatasourceuri.cpp
|
||||
@ -23,7 +22,6 @@ SET (WFS_MOC_HDRS
|
||||
qgswfsdataitems.h
|
||||
qgswfsprovider.h
|
||||
qgswfsfeatureiterator.h
|
||||
qgswfssourceselect.h
|
||||
qgswfsrequest.h
|
||||
qgswfsdescribefeaturetype.h
|
||||
qgswfstransactionrequest.h
|
||||
@ -31,6 +29,15 @@ SET (WFS_MOC_HDRS
|
||||
qgswfsutils.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(WFS_SRCS ${WFS_SRCS}
|
||||
qgswfssourceselect.cpp
|
||||
)
|
||||
SET(WFS_MOC_HDRS ${WFS_MOC_HDRS}
|
||||
qgswfssourceselect.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
########################################################
|
||||
# Build
|
||||
|
||||
@ -53,21 +60,30 @@ INCLUDE_DIRECTORIES (
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${GEOS_INCLUDE_DIR}
|
||||
${EXPAT_INCLUDE_DIR}
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
${QCA_INCLUDE_DIR}
|
||||
${QTKEYCHAIN_INCLUDE_DIR}
|
||||
${GDAL_INCLUDE_DIR} # needed by qgsvectorfilewriter.h
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
${QSCINTILLA_INCLUDE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
ADD_LIBRARY (wfsprovider MODULE ${WFS_SRCS} ${WFS_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES (wfsprovider
|
||||
${EXPAT_LIBRARY}
|
||||
qgis_core
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (wfsprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
########################################################
|
||||
# Install
|
||||
|
@ -14,15 +14,18 @@
|
||||
***************************************************************************/
|
||||
#include "qgsdataprovider.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#include "qgswfsconstants.h"
|
||||
#include "qgswfsconnection.h"
|
||||
#include "qgswfscapabilities.h"
|
||||
#include "qgswfsdataitems.h"
|
||||
#include "qgswfssourceselect.h"
|
||||
#include "qgswfsdatasourceuri.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#include "qgswfssourceselect.h"
|
||||
#endif
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QEventLoop>
|
||||
|
||||
@ -87,6 +90,7 @@ QVector<QgsDataItem *> QgsWfsConnectionItem::createChildren()
|
||||
return layers;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsWfsConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -120,7 +124,7 @@ void QgsWfsConnectionItem::deleteConnection()
|
||||
// the parent should be updated
|
||||
mParent->refresh();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//////
|
||||
@ -152,6 +156,7 @@ QVector<QgsDataItem *> QgsWfsRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsWfsRootItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -185,13 +190,16 @@ void QgsWfsRootItem::newConnection()
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN QgsWFSSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||
{
|
||||
return new QgsWFSSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
#endif
|
||||
|
||||
QGISEXTERN int dataCapabilities()
|
||||
{
|
||||
|
@ -28,13 +28,16 @@ class QgsWfsRootItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
|
||||
virtual QWidget *paramWidget() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
class QgsWfsConnection;
|
||||
@ -49,11 +52,15 @@ class QgsWfsConnectionItem : public QgsDataCollectionItem
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
//virtual bool equal( const QgsDataItem *other );
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QString mUri;
|
||||
|
@ -4,26 +4,33 @@ FIND_PACKAGE(Qt5XmlPatterns REQUIRED)
|
||||
SET (WMS_SRCS
|
||||
qgswmscapabilities.cpp
|
||||
qgswmsprovider.cpp
|
||||
qgswmssourceselect.cpp
|
||||
qgswmsconnection.cpp
|
||||
qgswmsdataitems.cpp
|
||||
qgstilecache.cpp
|
||||
qgstilescalewidget.cpp
|
||||
qgswmtsdimensions.cpp
|
||||
qgsxyzconnection.cpp
|
||||
qgsxyzconnectiondialog.cpp
|
||||
)
|
||||
SET (WMS_MOC_HDRS
|
||||
qgswmscapabilities.h
|
||||
qgswmsprovider.h
|
||||
qgswmssourceselect.h
|
||||
qgswmsconnection.h
|
||||
qgswmsdataitems.h
|
||||
qgstilescalewidget.h
|
||||
qgswmtsdimensions.h
|
||||
qgsxyzconnectiondialog.h
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
SET(WMS_SRCS ${WMS_SRCS}
|
||||
qgswmssourceselect.cpp
|
||||
qgstilescalewidget.cpp
|
||||
qgswmtsdimensions.cpp
|
||||
qgsxyzconnectiondialog.cpp
|
||||
)
|
||||
SET(WMS_MOC_HDRS ${WMS_MOC_HDRS}
|
||||
qgswmssourceselect.h
|
||||
qgstilescalewidget.h
|
||||
qgswmtsdimensions.h
|
||||
qgsxyzconnectiondialog.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
QT5_WRAP_CPP (WMS_MOC_SRCS ${WMS_MOC_HDRS})
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
@ -53,11 +60,16 @@ ADD_LIBRARY(wmsprovider MODULE ${WMS_SRCS} ${WMS_MOC_SRCS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(wmsprovider
|
||||
qgis_core
|
||||
qgis_gui
|
||||
${QT_QTSCRIPT_LIBRARY}
|
||||
${GDAL_LIBRARY} # for OGR_G_CreateGeometryFromJson()
|
||||
)
|
||||
|
||||
IF (WITH_GUI)
|
||||
TARGET_LINK_LIBRARIES (wmsprovider
|
||||
qgis_gui
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
TARGET_LINK_LIBRARIES(wmsprovider_a
|
||||
qgis_core
|
||||
${QT_QTSCRIPT_LIBRARY}
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "../providers/wms/qgswmsprovider.h"
|
||||
#include "qgis.h" // GEO_EPSG_CRS_ID
|
||||
#include "qgsdatasourceuri.h"
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#include "qgsproject.h"
|
||||
#include "qgsproviderregistry.h"
|
||||
#include "qgswmsconnection.h"
|
||||
|
@ -20,11 +20,14 @@
|
||||
#include "qgsdatasourceuri.h"
|
||||
#include "qgswmscapabilities.h"
|
||||
#include "qgswmsconnection.h"
|
||||
#include "qgsxyzconnection.h"
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
#include "qgswmssourceselect.h"
|
||||
#include "qgsnewhttpconnection.h"
|
||||
#include "qgstilescalewidget.h"
|
||||
#include "qgsxyzconnection.h"
|
||||
#include "qgsxyzconnectiondialog.h"
|
||||
#endif
|
||||
|
||||
#include <QInputDialog>
|
||||
|
||||
@ -215,6 +218,7 @@ bool QgsWMSConnectionItem::equal( const QgsDataItem *other )
|
||||
return ( mPath == o->mPath && mName == o->mName );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsWMSConnectionItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -247,6 +251,7 @@ void QgsWMSConnectionItem::deleteConnection()
|
||||
// the parent should be updated
|
||||
mParent->refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -397,6 +402,7 @@ QVector<QgsDataItem *> QgsWMSRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsWMSRootItem::actions()
|
||||
{
|
||||
QList<QAction *> lst;
|
||||
@ -430,10 +436,12 @@ void QgsWMSRootItem::newConnection()
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QGISEXTERN void registerGui( QMainWindow *mainWindow )
|
||||
{
|
||||
QgsTileScaleWidget::showTileScale( mainWindow );
|
||||
@ -443,7 +451,7 @@ QGISEXTERN QgsWMSSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl
|
||||
{
|
||||
return new QgsWMSSourceSelect( parent, fl, widgetMode );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
QgsDataItem *QgsWmsDataItemProvider::createDataItem( const QString &path, QgsDataItem *parentItem )
|
||||
{
|
||||
@ -497,6 +505,7 @@ QVector<QgsDataItem *> QgsXyzTileRootItem::createChildren()
|
||||
return connections;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsXyzTileRootItem::actions()
|
||||
{
|
||||
QAction *actionNew = new QAction( tr( "New Connection..." ), this );
|
||||
@ -514,6 +523,7 @@ void QgsXyzTileRootItem::newConnection()
|
||||
|
||||
refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -525,6 +535,7 @@ QgsXyzLayerItem::QgsXyzLayerItem( QgsDataItem *parent, QString name, QString pat
|
||||
setState( Populated );
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
QList<QAction *> QgsXyzLayerItem::actions()
|
||||
{
|
||||
QList<QAction *> lst = QgsLayerItem::actions();
|
||||
@ -559,3 +570,4 @@ void QgsXyzLayerItem::deleteConnection()
|
||||
|
||||
mParent->refresh();
|
||||
}
|
||||
#endif
|
||||
|
@ -32,11 +32,15 @@ class QgsWMSConnectionItem : public QgsDataCollectionItem
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
virtual bool equal( const QgsDataItem *other ) override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
#endif
|
||||
virtual void deleteLater() override;
|
||||
|
||||
private:
|
||||
@ -96,14 +100,16 @@ class QgsWMSRootItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
|
||||
virtual QWidget *paramWidget() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void connectionsChanged();
|
||||
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -128,10 +134,14 @@ class QgsXyzTileRootItem : public QgsDataCollectionItem
|
||||
|
||||
QVector<QgsDataItem *> createChildren() override;
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
#ifdef HAVE_GUI
|
||||
void newConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
//! Item implementation for XYZ tile layers
|
||||
@ -141,11 +151,15 @@ class QgsXyzLayerItem : public QgsLayerItem
|
||||
public:
|
||||
QgsXyzLayerItem( QgsDataItem *parent, QString name, QString path, const QString &encodedUri );
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
virtual QList<QAction *> actions() override;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#ifdef HAVE_GUI
|
||||
void editConnection();
|
||||
void deleteConnection();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,7 +30,9 @@ IF (ENABLE_TESTS)
|
||||
ENDIF (APPLE)
|
||||
|
||||
ADD_SUBDIRECTORY(core)
|
||||
ADD_SUBDIRECTORY(gui)
|
||||
IF (WITH_GUI)
|
||||
ADD_SUBDIRECTORY(gui)
|
||||
ENDIF (WITH_GUI)
|
||||
ADD_SUBDIRECTORY(analysis)
|
||||
ADD_SUBDIRECTORY(providers)
|
||||
IF (WITH_DESKTOP)
|
||||
|
Loading…
x
Reference in New Issue
Block a user