Skip to content

Commit

Permalink
Renamed QgsSourceSelectDialog to QgsArcGisServiceSourceSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jul 18, 2017
1 parent bc516cf commit 7bb797f
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 61 deletions.
2 changes: 1 addition & 1 deletion python/gui/gui_auto.sip
Expand Up @@ -158,7 +158,7 @@
%Include qgsoptionswidgetfactory.sip
%Include qgsorderbydialog.sip
%Include qgsowssourceselect.sip
%Include qgssourceselectdialog.sip
%Include qgsarcgisservicesourceselect.sip
%Include qgspanelwidget.sip
%Include qgspanelwidgetstack.sip
%Include qgspasswordlineedit.sip
Expand Down
86 changes: 86 additions & 0 deletions python/gui/qgsarcgisservicesourceselect.sip
@@ -0,0 +1,86 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsarcgisservicesourceselect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsArcGisServiceSourceSelect : QDialog, protected Ui::QgsArcGisServiceSourceSelectBase
{
%Docstring
Generic class listing layers available from a remote service.
%End

%TypeHeaderCode
#include "qgsarcgisservicesourceselect.h"
%End
public:
enum ServiceType { MapService, FeatureService };

QgsArcGisServiceSourceSelect( const QString &serviceName, ServiceType serviceType, QWidget *parent, Qt::WindowFlags fl );
%Docstring
Constructor
%End

~QgsArcGisServiceSourceSelect();
void setCurrentExtentAndCrs( const QgsRectangle &canvasExtent, const QgsCoordinateReferenceSystem &canvasCrs );
%Docstring
Sets the current extent and CRS. Used to select an appropriate CRS and possibly to retrieve data only in the current extent
%End

signals:
void addLayer( QString uri, QString typeName );
%Docstring
Emitted when a layer is added from the dialog
%End
void connectionsChanged();
%Docstring
Emitted when the connections for the service were changed
%End

protected:

virtual bool connectToService( const QgsOwsConnection &connection ) = 0;
%Docstring
To be implemented in the child class. Called when a new connection is initiated.
:rtype: bool
%End
virtual void buildQuery( const QgsOwsConnection &, const QModelIndex & );
%Docstring
May be implemented in child classes for services which support customized queries.
%End
virtual QString getLayerURI( const QgsOwsConnection &connection,
const QString &layerTitle,
const QString &layerName,
const QString &crs = QString(),
const QString &filter = QString(),
const QgsRectangle &bBox = QgsRectangle() ) const = 0;
%Docstring
To be implemented in the child class. Constructs an URI for the specified service layer.
:rtype: str
%End
void populateImageEncodings( const QStringList &availableEncodings );
%Docstring
Updates the UI for the list of available image encodings from the specified list.
%End
QString getSelectedImageEncoding() const;
%Docstring
Returns the selected image encoding.
:rtype: str
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsarcgisservicesourceselect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -247,7 +247,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#include "qgsshortcutsmanager.h"
#include "qgssinglebandgrayrenderer.h"
#include "qgssnappingwidget.h"
#include "qgssourceselectdialog.h"
#include "qgsarcgisservicesourceselect.h"
#include "qgsstatisticalsummarydockwidget.h"
#include "qgsstatusbar.h"
#include "qgsstatusbarcoordinateswidget.h"
Expand Down
10 changes: 5 additions & 5 deletions src/gui/CMakeLists.txt
Expand Up @@ -302,7 +302,7 @@ SET(QGIS_GUI_SRCS
qgsoptionsdialogbase.cpp
qgsorderbydialog.cpp
qgsowssourceselect.cpp
qgssourceselectdialog.cpp
qgsarcgisservicesourceselect.cpp
qgspanelwidget.cpp
qgspanelwidgetstack.cpp
qgspasswordlineedit.cpp
Expand Down Expand Up @@ -458,7 +458,7 @@ SET(QGIS_GUI_MOC_HDRS
qgsoptionswidgetfactory.h
qgsorderbydialog.h
qgsowssourceselect.h
qgssourceselectdialog.h
qgsarcgisservicesourceselect.h
qgspanelwidget.h
qgspanelwidgetstack.h
qgspasswordlineedit.h
Expand Down Expand Up @@ -499,11 +499,11 @@ SET(QGIS_GUI_MOC_HDRS
qgsvariableeditorwidget.h
qgsfiledownloader.h
qgsdatasourcemanagerdialog.h
qgssourceselect.h

ogr/qgsopenvectorlayerdialog.h
ogr/qgsnewogrconnection.h
ogr/qgsvectorlayersaveasdialog.h
qgssourceselect.h

raster/qgsmultibandcolorrendererwidget.h
raster/qgspalettedrendererwidget.h
Expand Down Expand Up @@ -706,14 +706,13 @@ SET(QGIS_GUI_HDRS
qgsvertexmarker.h
qgsfiledownloader.h
qgsdatasourcemanagerdialog.h
qgssourceselect.h

ogr/qgsopenvectorlayerdialog.h
ogr/qgsogrhelperfunctions.h
ogr/qgsnewogrconnection.h
ogr/qgsvectorlayersaveasdialog.h

qgssourceselect.h

attributetable/qgsfeaturemodel.h

auth/qgsauthauthoritieseditor.h
Expand Down Expand Up @@ -801,6 +800,7 @@ SET(QGIS_GUI_UI_HDRS
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsmessagelogviewer.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsmessageviewer.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsowssourceselectbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsarcgisservicesourceselectbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsprojectionselectorbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsquerybuilderbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgssqlcomposerdialogbase.h
Expand Down
@@ -1,5 +1,5 @@
/***************************************************************************
qgssourceselectdialog.cpp
qgsarcgisservicesourceselect.cpp
-------------------------
begin : Nov 26, 2015
copyright : (C) 2015 by Sandro Mani
Expand All @@ -15,7 +15,7 @@
* *
***************************************************************************/

#include "qgssourceselectdialog.h"
#include "qgsarcgisservicesourceselect.h"
#include "qgsowsconnection.h"
#include "qgsnewhttpconnection.h"
#include "qgsprojectionselectiondialog.h"
Expand Down Expand Up @@ -49,7 +49,7 @@ class QgsSourceSelectItemDelegate : public QItemDelegate
};


QgsSourceSelectDialog::QgsSourceSelectDialog( const QString &serviceName, ServiceType serviceType, QWidget *parent, Qt::WindowFlags fl )
QgsArcGisServiceSourceSelect::QgsArcGisServiceSourceSelect( const QString &serviceName, ServiceType serviceType, QWidget *parent, Qt::WindowFlags fl )
: QDialog( parent, fl ),
mServiceName( serviceName ),
mServiceType( serviceType ),
Expand All @@ -61,22 +61,22 @@ QgsSourceSelectDialog::QgsSourceSelectDialog( const QString &serviceName, Servic

mAddButton = buttonBox->addButton( tr( "&Add" ), QDialogButtonBox::ActionRole );
mAddButton->setEnabled( false );
connect( mAddButton, &QAbstractButton::clicked, this, &QgsSourceSelectDialog::addButtonClicked );
connect( mAddButton, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::addButtonClicked );

if ( mServiceType == FeatureService )
{
mBuildQueryButton = buttonBox->addButton( tr( "&Build query" ), QDialogButtonBox::ActionRole );
mBuildQueryButton->setDisabled( true );
connect( mBuildQueryButton, &QAbstractButton::clicked, this, &QgsSourceSelectDialog::buildQueryButtonClicked );
connect( mBuildQueryButton, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::buildQueryButtonClicked );
}

connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
connect( btnNew, &QAbstractButton::clicked, this, &QgsSourceSelectDialog::addEntryToServerList );
connect( btnEdit, &QAbstractButton::clicked, this, &QgsSourceSelectDialog::modifyEntryOfServerList );
connect( btnDelete, &QAbstractButton::clicked, this, &QgsSourceSelectDialog::deleteEntryOfServerList );
connect( btnConnect, &QAbstractButton::clicked, this, &QgsSourceSelectDialog::connectToServer );
connect( btnChangeSpatialRefSys, &QAbstractButton::clicked, this, &QgsSourceSelectDialog::changeCrs );
connect( lineFilter, &QLineEdit::textChanged, this, &QgsSourceSelectDialog::filterChanged );
connect( btnNew, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::addEntryToServerList );
connect( btnEdit, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::modifyEntryOfServerList );
connect( btnDelete, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::deleteEntryOfServerList );
connect( btnConnect, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::connectToServer );
connect( btnChangeSpatialRefSys, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::changeCrs );
connect( lineFilter, &QLineEdit::textChanged, this, &QgsArcGisServiceSourceSelect::filterChanged );
populateConnectionList();
mProjectionSelector = new QgsProjectionSelectionDialog( this );
mProjectionSelector->setMessage( QString() );
Expand Down Expand Up @@ -108,11 +108,11 @@ QgsSourceSelectDialog::QgsSourceSelectDialog( const QString &serviceName, Servic
mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive );
treeView->setModel( mModelProxy );

connect( treeView, &QAbstractItemView::doubleClicked, this, &QgsSourceSelectDialog::treeWidgetItemDoubleClicked );
connect( treeView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &QgsSourceSelectDialog::treeWidgetCurrentRowChanged );
connect( treeView, &QAbstractItemView::doubleClicked, this, &QgsArcGisServiceSourceSelect::treeWidgetItemDoubleClicked );
connect( treeView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &QgsArcGisServiceSourceSelect::treeWidgetCurrentRowChanged );
}

QgsSourceSelectDialog::~QgsSourceSelectDialog()
QgsArcGisServiceSourceSelect::~QgsArcGisServiceSourceSelect()
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Windows/SourceSelectDialog/geometry" ), saveGeometry() );
Expand All @@ -123,13 +123,13 @@ QgsSourceSelectDialog::~QgsSourceSelectDialog()
delete mModelProxy;
}

void QgsSourceSelectDialog::setCurrentExtentAndCrs( const QgsRectangle &canvasExtent, const QgsCoordinateReferenceSystem &canvasCrs )
void QgsArcGisServiceSourceSelect::setCurrentExtentAndCrs( const QgsRectangle &canvasExtent, const QgsCoordinateReferenceSystem &canvasCrs )
{
mCanvasExtent = canvasExtent;
mCanvasCrs = canvasCrs;
}

void QgsSourceSelectDialog::populateImageEncodings( const QStringList &availableEncodings )
void QgsArcGisServiceSourceSelect::populateImageEncodings( const QStringList &availableEncodings )
{
QLayoutItem *item = nullptr;
while ( ( item = gbImageEncoding->layout()->takeAt( 0 ) ) != nullptr )
Expand Down Expand Up @@ -162,12 +162,12 @@ void QgsSourceSelectDialog::populateImageEncodings( const QStringList &available
}
}

QString QgsSourceSelectDialog::getSelectedImageEncoding() const
QString QgsArcGisServiceSourceSelect::getSelectedImageEncoding() const
{
return mImageEncodingGroup ? mImageEncodingGroup->checkedButton()->text() : QString();
}

void QgsSourceSelectDialog::populateConnectionList()
void QgsArcGisServiceSourceSelect::populateConnectionList()
{
QStringList conns = QgsOwsConnection::connectionList( mServiceName );
cmbConnections->clear();
Expand All @@ -190,7 +190,7 @@ void QgsSourceSelectDialog::populateConnectionList()
}
}

QString QgsSourceSelectDialog::getPreferredCrs( const QSet<QString> &crsSet ) const
QString QgsArcGisServiceSourceSelect::getPreferredCrs( const QSet<QString> &crsSet ) const
{
if ( crsSet.size() < 1 )
{
Expand Down Expand Up @@ -221,7 +221,7 @@ QString QgsSourceSelectDialog::getPreferredCrs( const QSet<QString> &crsSet ) co
return *( crsSet.constBegin() );
}

void QgsSourceSelectDialog::addEntryToServerList()
void QgsArcGisServiceSourceSelect::addEntryToServerList()
{

QgsNewHttpConnection nc( 0, QStringLiteral( "qgis/connections-%1/" ).arg( mServiceName.toLower() ) );
Expand All @@ -234,7 +234,7 @@ void QgsSourceSelectDialog::addEntryToServerList()
}
}

void QgsSourceSelectDialog::modifyEntryOfServerList()
void QgsArcGisServiceSourceSelect::modifyEntryOfServerList()
{
QgsNewHttpConnection nc( 0, QStringLiteral( "qgis/connections-%1/" ).arg( mServiceName.toLower() ), cmbConnections->currentText() );
nc.setWindowTitle( tr( "Modify %1 connection" ).arg( mServiceName ) );
Expand All @@ -246,7 +246,7 @@ void QgsSourceSelectDialog::modifyEntryOfServerList()
}
}

void QgsSourceSelectDialog::deleteEntryOfServerList()
void QgsArcGisServiceSourceSelect::deleteEntryOfServerList()
{
QString msg = tr( "Are you sure you want to remove the %1 connection and all associated settings?" )
.arg( cmbConnections->currentText() );
Expand All @@ -264,7 +264,7 @@ void QgsSourceSelectDialog::deleteEntryOfServerList()
}
}

void QgsSourceSelectDialog::connectToServer()
void QgsArcGisServiceSourceSelect::connectToServer()
{
bool haveLayers = false;
btnConnect->setEnabled( false );
Expand Down Expand Up @@ -308,7 +308,7 @@ void QgsSourceSelectDialog::connectToServer()
btnChangeSpatialRefSys->setEnabled( haveLayers );
}

void QgsSourceSelectDialog::addButtonClicked()
void QgsArcGisServiceSourceSelect::addButtonClicked()
{
if ( treeView->selectionModel()->selectedRows().isEmpty() )
{
Expand Down Expand Up @@ -368,7 +368,7 @@ void QgsSourceSelectDialog::addButtonClicked()
accept();
}

void QgsSourceSelectDialog::changeCrs()
void QgsArcGisServiceSourceSelect::changeCrs()
{
if ( mProjectionSelector->exec() )
{
Expand All @@ -377,7 +377,7 @@ void QgsSourceSelectDialog::changeCrs()
}
}

void QgsSourceSelectDialog::changeCrsFilter()
void QgsArcGisServiceSourceSelect::changeCrsFilter()
{
QgsDebugMsg( "changeCRSFilter called" );
//evaluate currently selected typename and set the CRS filter in mProjectionSelector
Expand Down Expand Up @@ -411,20 +411,20 @@ void QgsSourceSelectDialog::changeCrsFilter()
}
}

void QgsSourceSelectDialog::on_cmbConnections_activated( int index )
void QgsArcGisServiceSourceSelect::on_cmbConnections_activated( int index )
{
Q_UNUSED( index );
QgsOwsConnection::setSelectedConnection( mServiceName, cmbConnections->currentText() );
}

void QgsSourceSelectDialog::treeWidgetItemDoubleClicked( const QModelIndex &index )
void QgsArcGisServiceSourceSelect::treeWidgetItemDoubleClicked( const QModelIndex &index )
{
QgsDebugMsg( "double-click called" );
QgsOwsConnection connection( mServiceName, cmbConnections->currentText() );
buildQuery( connection, index );
}

void QgsSourceSelectDialog::treeWidgetCurrentRowChanged( const QModelIndex &current, const QModelIndex &previous )
void QgsArcGisServiceSourceSelect::treeWidgetCurrentRowChanged( const QModelIndex &current, const QModelIndex &previous )
{
Q_UNUSED( previous )
QgsDebugMsg( "treeWidget_currentRowChanged called" );
Expand All @@ -436,14 +436,14 @@ void QgsSourceSelectDialog::treeWidgetCurrentRowChanged( const QModelIndex &curr
mAddButton->setEnabled( current.isValid() );
}

void QgsSourceSelectDialog::buildQueryButtonClicked()
void QgsArcGisServiceSourceSelect::buildQueryButtonClicked()
{
QgsDebugMsg( "mBuildQueryButton click called" );
QgsOwsConnection connection( mServiceName, cmbConnections->currentText() );
buildQuery( connection, treeView->selectionModel()->currentIndex() );
}

void QgsSourceSelectDialog::filterChanged( const QString &text )
void QgsArcGisServiceSourceSelect::filterChanged( const QString &text )
{
QgsDebugMsg( "FeatureType filter changed to :" + text );
QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax( QRegExp::RegExp );
Expand All @@ -465,7 +465,7 @@ QSize QgsSourceSelectItemDelegate::sizeHint( const QStyleOptionViewItem &option,
return size;
}

void QgsSourceSelectDialog::on_buttonBox_helpRequested() const
void QgsArcGisServiceSourceSelect::on_buttonBox_helpRequested() const
{
QgsContextHelp::run( metaObject()->className() );
}

0 comments on commit 7bb797f

Please sign in to comment.