Skip to content

Commit

Permalink
[needs-docs] Remove option to capitalize layer names, and make it alw…
Browse files Browse the repository at this point in the history
…ays on

Doing this removes some work from our users - giving layers
a nicely generated name by default
  • Loading branch information
nyalldawson committed Nov 14, 2017
1 parent 6f55e50 commit 6e31fcc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 48 deletions.
17 changes: 2 additions & 15 deletions src/app/qgisapp.cpp
Expand Up @@ -9941,15 +9941,7 @@ QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const Q

freezeCanvases();

// Let render() do its own cursor management
// QApplication::setOverrideCursor(Qt::WaitCursor);

QString baseName = name;
QgsSettings settings;
if ( settings.value( QStringLiteral( "qgis/capitalizeLayerName" ), QVariant( false ) ).toBool() )
{
baseName = QgsMapLayer::formatLayerName( baseName );
}
QString baseName = QgsMapLayer::formatLayerName( name );

/* Eliminate the need to instantiate the layer based on provider type.
The caller is responsible for cobbling together the needed information to
Expand Down Expand Up @@ -11857,12 +11849,7 @@ QgsRasterLayer *QgisApp::addRasterLayerPrivate(
freezeCanvases();
}

QString baseName = name;
QgsSettings settings;
if ( settings.value( QStringLiteral( "qgis/capitalizeLayerName" ), QVariant( false ) ).toBool() )
{
baseName = QgsMapLayer::formatLayerName( baseName );
}
QString baseName = QgsMapLayer::formatLayerName( name );

QgsDebugMsg( "Creating new raster layer using " + uri
+ " with baseName of " + baseName );
Expand Down
10 changes: 0 additions & 10 deletions src/app/qgsoptions.cpp
Expand Up @@ -746,8 +746,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
pbnMeasureColor->setContext( QStringLiteral( "gui" ) );
pbnMeasureColor->setDefaultColor( QColor( 222, 155, 67 ) );

capitalizeCheckBox->setChecked( mSettings->value( QStringLiteral( "/qgis/capitalizeLayerName" ), QVariant( false ) ).toBool() );

int projOpen = mSettings->value( QStringLiteral( "/qgis/projOpenAtLaunch" ), 0 ).toInt();
mProjectOnLaunchCmbBx->setCurrentIndex( projOpen );
mProjectOnLaunchLineEdit->setText( mSettings->value( QStringLiteral( "/qgis/projOpenAtLaunchPath" ) ).toString() );
Expand Down Expand Up @@ -1299,8 +1297,6 @@ void QgsOptions::saveOptions()

mSettings->setValue( QStringLiteral( "/qgis/map_update_interval" ), spinMapUpdateInterval->value() );
mSettings->setValue( QStringLiteral( "/qgis/legendDoubleClickAction" ), cmbLegendDoubleClickAction->currentIndex() );
bool legendLayersCapitalize = mSettings->value( QStringLiteral( "/qgis/capitalizeLayerName" ), false ).toBool();
mSettings->setValue( QStringLiteral( "/qgis/capitalizeLayerName" ), capitalizeCheckBox->isChecked() );

// Default simplify drawing configuration
QgsVectorSimplifyMethod::SimplifyHints simplifyHints = QgsVectorSimplifyMethod::NoSimplification;
Expand Down Expand Up @@ -1552,12 +1548,6 @@ void QgsOptions::saveOptions()
if ( mLoadedGdalDriverList )
saveGdalDriverList();

// refresh legend if any legend item's state is to be changed
if ( legendLayersCapitalize != capitalizeCheckBox->isChecked() )
{
// TODO[MD] QgisApp::instance()->legend()->updateLegendItemStyles();
}

// refresh symbology for any legend items, only if needed
if ( showLegendClassifiers != cbxLegendClassifiers->isChecked()
|| createRasterLegendIcons != cbxCreateRasterLegendIcons->isChecked() )
Expand Down
32 changes: 9 additions & 23 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -2991,34 +2991,14 @@
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="cbxCreateRasterLegendIcons">
<property name="text">
<string>Create raster icons (may be slow)</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<layout class="QGridLayout" name="gridLayout_3" columnminimumwidth="0,1,0">
<item row="1" column="1" colspan="2">
<widget class="QCheckBox" name="cbxLegendClassifiers">
<property name="text">
<string>Display classification attribute names</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="capitalizeCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Capitalize layer names</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_53">
<property name="sizePolicy">
Expand Down Expand Up @@ -3048,6 +3028,13 @@
</property>
</spacer>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="cbxCreateRasterLegendIcons">
<property name="text">
<string>Create raster icons (may be slow)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -5538,7 +5525,6 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
<tabstop>pbnCanvasColor</tabstop>
<tabstop>mLegendGrpBx</tabstop>
<tabstop>cmbLegendDoubleClickAction</tabstop>
<tabstop>capitalizeCheckBox</tabstop>
<tabstop>cbxLegendClassifiers</tabstop>
<tabstop>cbxCreateRasterLegendIcons</tabstop>
<tabstop>mLegendGraphicResolutionSpinBox</tabstop>
Expand Down

0 comments on commit 6e31fcc

Please sign in to comment.