Skip to content

Commit

Permalink
use title as default name for WMTS layers (implements #8984)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Nov 5, 2013
1 parent 45fea7b commit 4f937ae
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -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" )
Expand Down
21 changes: 16 additions & 5 deletions src/providers/wms/qgswmssourceselect.cpp
Expand Up @@ -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 ) );
Expand Down Expand Up @@ -571,7 +572,6 @@ void QgsWMSSourceSelect::addClicked()
emit addRasterLayer( uri.encodedUri(),
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
"wms" );

}

void QgsWMSSourceSelect::enableLayersForCrs( QTreeWidgetItem *item )
Expand Down Expand Up @@ -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
{
Expand Down
32 changes: 18 additions & 14 deletions src/ui/qgswmssourceselectbase.ui
Expand Up @@ -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>
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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"/>
Expand Down

0 comments on commit 4f937ae

Please sign in to comment.