remove server search URL from settings

remove server search tab from OWS dialog
This commit is contained in:
Alexander Bruy 2020-04-24 14:25:03 +03:00 committed by Nyall Dawson
parent b8c3b0e71f
commit 81911c1afc
7 changed files with 29 additions and 216 deletions

View File

@ -154,13 +154,10 @@ Returns a textual description for the authority id
void addWmsListRow( const QDomElement &item, int row );
virtual void enableLayersForCrs( QTreeWidgetItem *item );
%Docstring
layer name derived from latest layer selection (updated as long it's not edited manually)
%End
void addWmsListItem( const QDomElement &el, int row, int column );
virtual void enableLayersForCrs( QTreeWidgetItem *item );
QString selectedFormat();
%Docstring

View File

@ -403,9 +403,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mSettings->setValue( QStringLiteral( "clear_auth_cache_on_errors" ), checked, QgsSettings::Section::Auth );
} );
//wms search server
leWmsSearch->setText( mSettings->value( QStringLiteral( "/qgis/WMSSearchUrl" ), "http://geopole.org/wms/search?search=%1&type=rss" ).toString() );
// set the attribute table default filter
cmbAttrTableBehavior->clear();
cmbAttrTableBehavior->addItem( tr( "Show all features" ), QgsAttributeTableFilterModel::ShowAll );
@ -1472,9 +1469,6 @@ void QgsOptions::saveOptions()
QgisApp::instance()->namUpdate();
//wms search url
mSettings->setValue( QStringLiteral( "/qgis/WMSSearchUrl" ), leWmsSearch->text() );
//general settings
mSettings->setValue( QStringLiteral( "/Map/searchRadiusMM" ), spinBoxIdentifyValue->value() );
mSettings->setValue( QStringLiteral( "/Map/highlight/color" ), mIdentifyHighlightColorButton->color().name() );

View File

@ -71,8 +71,6 @@ QgsOWSSourceSelect::QgsOWSSourceSelect( const QString &service, QWidget *parent,
connect( mLayersTreeWidget, &QTreeWidget::itemSelectionChanged, this, &QgsOWSSourceSelect::mLayersTreeWidget_itemSelectionChanged );
connect( mConnectionsComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsOWSSourceSelect::mConnectionsComboBox_activated );
connect( mAddDefaultButton, &QPushButton::clicked, this, &QgsOWSSourceSelect::mAddDefaultButton_clicked );
connect( mSearchButton, &QPushButton::clicked, this, &QgsOWSSourceSelect::mSearchButton_clicked );
connect( mSearchTableWidget, &QTableWidget::itemSelectionChanged, this, &QgsOWSSourceSelect::mSearchTableWidget_itemSelectionChanged );
connect( mTilesetsTableWidget, &QTableWidget::itemClicked, this, &QgsOWSSourceSelect::mTilesetsTableWidget_itemClicked );
connect( mLayerUpButton, &QPushButton::clicked, this, &QgsOWSSourceSelect::mLayerUpButton_clicked );
connect( mLayerDownButton, &QPushButton::clicked, this, &QgsOWSSourceSelect::mLayerDownButton_clicked );
@ -634,97 +632,6 @@ void QgsOWSSourceSelect::addDefaultServers()
"need to set the proxy settings in the QGIS options dialog." ) + "</p>" );
}
void QgsOWSSourceSelect::addWmsListRow( const QDomElement &item, int row )
{
QDomElement title = item.firstChildElement( QStringLiteral( "title" ) );
addWmsListItem( title, row, 0 );
QDomElement description = item.firstChildElement( QStringLiteral( "description" ) );
addWmsListItem( description, row, 1 );
QDomElement link = item.firstChildElement( QStringLiteral( "link" ) );
addWmsListItem( link, row, 2 );
}
void QgsOWSSourceSelect::addWmsListItem( const QDomElement &el, int row, int column )
{
if ( !el.isNull() )
{
QTableWidgetItem *tableItem = new QTableWidgetItem( el.text() );
// TODO: add linebreaks to long tooltips?
tableItem->setToolTip( el.text() );
mSearchTableWidget->setItem( row, column, tableItem );
}
}
void QgsOWSSourceSelect::mSearchButton_clicked()
{
// clear results
mSearchTableWidget->clearContents();
mSearchTableWidget->setRowCount( 0 );
// disable Add WMS button
mSearchAddButton->setEnabled( false );
QApplication::setOverrideCursor( Qt::WaitCursor );
QgsSettings settings;
// geopole.org (geopole.ch) 25.4.2012 : 503 Service Unavailable, archive: Recently added 20 Jul 2011
QString mySearchUrl = settings.value( QStringLiteral( "qgis/WMSSearchUrl" ), "http://geopole.org/wms/search?search=%1&type=rss" ).toString();
QUrl url( mySearchUrl.arg( mSearchTermLineEdit->text() ) );
QgsDebugMsg( url.toString() );
QNetworkReply *r = QgsNetworkAccessManager::instance()->get( QNetworkRequest( url ) );
connect( r, &QNetworkReply::finished, this, &QgsOWSSourceSelect::searchFinished );
}
void QgsOWSSourceSelect::searchFinished()
{
QApplication::restoreOverrideCursor();
QNetworkReply *r = qobject_cast<QNetworkReply *>( sender() );
if ( !r )
return;
if ( r->error() == QNetworkReply::NoError )
{
// parse results
QDomDocument doc( QStringLiteral( "RSS" ) );
QByteArray res = r->readAll();
QString error;
int line, column;
if ( doc.setContent( res, &error, &line, &column ) )
{
QDomNodeList list = doc.elementsByTagName( QStringLiteral( "item" ) );
mSearchTableWidget->setRowCount( list.size() );
for ( int i = 0; i < list.size(); i++ )
{
if ( list.item( i ).isElement() )
{
QDomElement item = list.item( i ).toElement();
addWmsListRow( item, i );
}
}
mSearchTableWidget->resizeColumnsToContents();
}
else
{
QgsDebugMsg( QStringLiteral( "setContent failed" ) );
showStatusMessage( tr( "parse error at row %1, column %2: %3" ).arg( line ).arg( column ).arg( error ) );
}
}
else
{
showStatusMessage( tr( "network error: %1" ).arg( r->error() ) );
}
r->deleteLater();
}
void QgsOWSSourceSelect::mSearchTableWidget_itemSelectionChanged()
{
mSearchAddButton->setEnabled( mSearchTableWidget->currentRow() != -1 );
}
void QgsOWSSourceSelect::mLayerUpButton_clicked()
{
QList<QTreeWidgetItem *> selectionList = mLayerOrderTreeWidget->selectedItems();

View File

@ -156,9 +156,6 @@ class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, protec
QMap<QString, QString> mCrsNames;
void addWmsListRow( const QDomElement &item, int row );
void addWmsListItem( const QDomElement &el, int row, int column );
virtual void enableLayersForCrs( QTreeWidgetItem *item );
//! Returns currently selected format
@ -204,8 +201,6 @@ class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, protec
*/
void mConnectButton_clicked();
void searchFinished();
//! Opens the Spatial Reference System dialog.
void mChangeCRSButton_clicked();
@ -233,8 +228,6 @@ class GUI_EXPORT QgsOWSSourceSelect : public QgsAbstractDataSourceWidget, protec
QMap<QString, QString> mMimeLabelMap;
private slots:
void mSearchButton_clicked();
void mSearchTableWidget_itemSelectionChanged();
void mTilesetsTableWidget_itemClicked( QTableWidgetItem *item );
void mLayerUpButton_clicked();
void mLayerDownButton_clicked();

View File

@ -36,7 +36,6 @@ QgsWCSSourceSelect::QgsWCSSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs
mLayersTab->layout()->removeWidget( mWMSGroupBox );
mTabWidget->removeTab( mTabWidget->indexOf( mLayerOrderTab ) );
mTabWidget->removeTab( mTabWidget->indexOf( mTilesetsTab ) );
mTabWidget->removeTab( mTabWidget->indexOf( mSearchTab ) );
mAddDefaultButton->hide();
mLayersTreeWidget->setSelectionMode( QAbstractItemView::SingleSelection );

View File

@ -332,7 +332,7 @@
<item>
<widget class="QStackedWidget" name="mOptionsStackedWidget">
<property name="currentIndex">
<number>0</number>
<number>13</number>
</property>
<widget class="QWidget" name="mOptionsPageGeneral">
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -360,9 +360,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-339</y>
<width>833</width>
<height>1003</height>
<y>0</y>
<width>843</width>
<height>917</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
@ -606,7 +606,7 @@
</widget>
</item>
<item>
<widget class="QFontComboBox" name="mFontFamilyComboBox" />
<widget class="QFontComboBox" name="mFontFamilyComboBox"/>
</item>
<item>
<widget class="QLabel" name="label_20">
@ -1118,8 +1118,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>539</width>
<height>1114</height>
<width>541</width>
<height>1072</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_22">
@ -1654,8 +1654,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>555</width>
<height>501</height>
<width>552</width>
<height>509</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
@ -1867,8 +1867,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>530</width>
<height>678</height>
<width>499</width>
<height>615</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_27">
@ -2173,8 +2173,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>695</width>
<height>1139</height>
<width>674</width>
<height>1057</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">
@ -2959,8 +2959,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>529</width>
<height>309</height>
<width>501</width>
<height>293</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_25">
@ -3270,8 +3270,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>606</width>
<height>741</height>
<width>604</width>
<height>671</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_30">
@ -3775,8 +3775,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>181</width>
<height>318</height>
<width>157</width>
<height>265</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_46">
@ -3943,8 +3943,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>570</width>
<height>827</height>
<width>543</width>
<height>801</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_31">
@ -4552,8 +4552,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>572</height>
<width>480</width>
<height>538</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_39">
@ -4821,8 +4821,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<height>367</height>
<width>412</width>
<height>372</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
@ -4990,8 +4990,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<rect>
<x>0</x>
<y>0</y>
<width>633</width>
<height>750</height>
<width>857</width>
<height>682</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
@ -5001,20 +5001,6 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<string>General</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_34">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>WMS search address</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leWmsSearch"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
@ -5492,7 +5478,7 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Noto Sans'; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
@ -5868,7 +5854,6 @@ p, li { white-space: pre-wrap; }
<tabstop>lstGdalDrivers</tabstop>
<tabstop>mAuthConfigsGrpBx</tabstop>
<tabstop>mOptionsScrollArea_10</tabstop>
<tabstop>leWmsSearch</tabstop>
<tabstop>mNetworkTimeoutSpinBox</tabstop>
<tabstop>mDefaultCapabilitiesExpirySpinBox</tabstop>
<tabstop>mDefaultTileExpirySpinBox</tabstop>

View File

@ -530,64 +530,6 @@ Always network: always load from network and do not check if the cache has a val
</item>
</layout>
</widget>
<widget class="QWidget" name="mSearchTab">
<attribute name="title">
<string>Server Search</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="mSearchTermLineEdit"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="mSearchButton">
<property name="text">
<string>Search</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTableWidget" name="mSearchTableWidget">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="cornerButtonEnabled">
<bool>false</bool>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>URL</string>
</property>
</column>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="mSearchAddButton">
<property name="text">
<string>Add Selected Row to WMS List</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -616,10 +558,6 @@ Always network: always load from network and do not check if the cache has a val
<tabstop>mLayerDownButton</tabstop>
<tabstop>mLayerOrderTreeWidget</tabstop>
<tabstop>mTilesetsTableWidget</tabstop>
<tabstop>mSearchTermLineEdit</tabstop>
<tabstop>mSearchButton</tabstop>
<tabstop>mSearchTableWidget</tabstop>
<tabstop>mSearchAddButton</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>