Skip to content
Permalink
Browse files

use title as default name for WMTS layers (implements #8984)

  • Loading branch information
jef-n committed Nov 5, 2013
1 parent 45fea7b commit 4f937ae667b31a4bc067c3c85ae5868077610c43
Showing with 34 additions and 20 deletions.
  1. +0 −1 src/providers/wms/qgswmsprovider.cpp
  2. +16 −5 src/providers/wms/qgswmssourceselect.cpp
  3. +18 −14 src/ui/qgswmssourceselectbase.ui
@@ -1132,7 +1132,6 @@ void QgsWmsProvider::tileReplyFinished()
int tileReqNo = reply->request().attribute( static_cast<QNetworkRequest::Attribute>( TileReqNo ) ).toInt();
int tileNo = reply->request().attribute( static_cast<QNetworkRequest::Attribute>( TileIndex ) ).toInt();
QRectF r = reply->request().attribute( static_cast<QNetworkRequest::Attribute>( TileRect ) ).toRectF();
int retry = reply->request().attribute( static_cast<QNetworkRequest::Attribute>( TileRetry ) ).toInt();

#if QT_VERSION >= 0x40500
QgsDebugMsg( QString( "tile reply %1 (%2) tile:%3(retry %4) rect:%5,%6 %7,%8) fromcache:%9 error:%10 url:%11" )
@@ -387,6 +387,7 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
item->setData( Qt::UserRole + 2, style.identifier );
item->setData( Qt::UserRole + 3, setLink.tileMatrixSet );
item->setData( Qt::UserRole + 4, tileMatrixSets[ setLink.tileMatrixSet ].crs );
item->setData( Qt::UserRole + 5, l.title );

lstTilesets->setItem( row, 0, item );
lstTilesets->setItem( row, 1, new QTableWidgetItem( format ) );
@@ -571,7 +572,6 @@ void QgsWMSSourceSelect::addClicked()
emit addRasterLayer( uri.encodedUri(),
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
"wms" );

}

void QgsWMSSourceSelect::enableLayersForCrs( QTreeWidgetItem *item )
@@ -950,10 +950,21 @@ void QgsWMSSourceSelect::updateButtons()
{
if ( mAddButton->isEnabled() )
{
QStringList layers, styles;
collectSelectedLayers( layers, styles );
mLastLayerName = layers.join( "/" );
leLayerName->setText( mLastLayerName );
if ( !lstTilesets->selectedItems().isEmpty() )
{
QTableWidgetItem *item = lstTilesets->selectedItems().first();
mLastLayerName = item->data( Qt::UserRole + 5 ).toString();
if ( mLastLayerName.isEmpty() )
mLastLayerName = item->data( Qt::UserRole + 0 ).toString();
leLayerName->setText( mLastLayerName );
}
else
{
QStringList layers, styles;
collectSelectedLayers( layers, styles );
mLastLayerName = layers.join( "/" );
leLayerName->setText( mLastLayerName );
}
}
else
{
@@ -24,7 +24,7 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
@@ -207,19 +207,6 @@
<string>Options</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Layer name</string>
</property>
<property name="buddy">
<cstring>leLayerName</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="leLayerName"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="labelCoordRefSys">
<property name="text">
@@ -451,6 +438,23 @@
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Layer name</string>
</property>
<property name="buddy">
<cstring>leLayerName</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leLayerName"/>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>

0 comments on commit 4f937ae

Please sign in to comment.
You can’t perform that action at this time.