Skip to content

Commit 3e33e68

Browse files
committedAug 1, 2016
Rename visibility presets to map themes
Because it is not only more descriptive for what it does but also sounds more interesting. [needs-docs]
1 parent 1da60c5 commit 3e33e68

25 files changed

+154
-141
lines changed
 

‎doc/api_break.dox

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ QGis::UnitType parameters have been updated to take QgsUnitTypes::DistanceUnit i
6464
corresponding counterparts in QgsUnitTypes should be used instead.</li>
6565
</ul>
6666

67+
\subsection qgis_api_break_3_0_QgsProject QgsProject
68+
69+
<ul>
70+
<li>visibilityPresetCollection() has been renamed to mapThemeCollection()</li>
71+
</ul>
72+
73+
\subsection qgis_api_break_3_0_QgsVisibilityPresetCollection QgsVisibilityPresetCollection
74+
75+
<ul>
76+
<li>Has been renamed to QgsMapThemeCollection</li>
77+
</ul>
78+
6779
\subsection qgis_api_break_3_0_QgsAuthConfigUriEdit QgsAuthConfigUriEdit
6880

6981
<ul>

‎python/core/core.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
%Include qgsvectorlayerfeatureiterator.sip
158158
%Include qgsvirtuallayerdefinition.sip
159159
%Include qgsvirtuallayerdefinitionutils.sip
160-
%Include qgsvisibilitypresetcollection.sip
160+
%Include qgsmapthemecollection.sip
161161
%Include qgsxmlutils.sip
162162

163163
%Include auth/qgsauthcertutils.sip

‎python/core/qgsvisibilitypresetcollection.sip renamed to ‎python/core/qgsmapthemecollection.sip

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/**
2-
\class QgsVisibilityPresetCollection
2+
\class QgsMapThemeCollection
33
\ingroup core
44
\brief Container class that allows storage of visibility presets consisting of visible
55
map layers and layer styles.
66
\note added in QGIS 2.12
77
*/
88

9-
class QgsVisibilityPresetCollection : QObject
9+
class QgsMapThemeCollection : QObject
1010
{
1111
%TypeHeaderCode
12-
#include <qgsvisibilitypresetcollection.h>
12+
#include <qgsmapthemecollection.h>
1313
%End
1414
public:
1515

@@ -19,8 +19,8 @@ class QgsVisibilityPresetCollection : QObject
1919
{
2020
public:
2121

22-
bool operator==( const QgsVisibilityPresetCollection::PresetRecord& other ) const;
23-
bool operator!=( const QgsVisibilityPresetCollection::PresetRecord& other ) const;
22+
bool operator==( const QgsMapThemeCollection::PresetRecord& other ) const;
23+
bool operator!=( const QgsMapThemeCollection::PresetRecord& other ) const;
2424

2525
//! Ordered list of layers that are visible
2626
QStringList mVisibleLayerIDs;
@@ -32,7 +32,7 @@ class QgsVisibilityPresetCollection : QObject
3232
QMap<QString, QString> mPerLayerCurrentStyle;
3333
};
3434

35-
QgsVisibilityPresetCollection();
35+
QgsMapThemeCollection();
3636

3737
/** Returns whether a preset with a matching name exists.
3838
* @param name name of preset to check

‎python/core/qgsproject.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class QgsProject : QObject
273273
/** Returns pointer to the project's visibility preset collection.
274274
* @note added in QGIS 2.12
275275
*/
276-
QgsVisibilityPresetCollection* visibilityPresetCollection();
276+
QgsMapThemeCollection* mapThemeCollection();
277277

278278
/**
279279
* Set a list of layers which should not be taken into account on map identification

‎src/app/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ SET(QGIS_APP_SRCS
121121
qgstipgui.cpp
122122
qgstipfactory.cpp
123123
qgsvectorlayerproperties.cpp
124-
qgsvisibilitypresets.cpp
124+
qgsmapthemes.cpp
125125
qgshandlebadlayers.cpp
126126
qgsmaptooladdcircularstring.cpp
127127
qgsmaptoolcircularstringcurvepoint.cpp
@@ -296,7 +296,7 @@ SET (QGIS_APP_MOC_HDRS
296296
qgstipfactory.h
297297
qgsundowidget.h
298298
qgsvectorlayerproperties.h
299-
qgsvisibilitypresets.h
299+
qgsmapthemes.h
300300
qgshandlebadlayers.h
301301

302302
composer/qgsattributeselectiondialog.h

‎src/app/composer/qgscomposermapwidget.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
#include "qgsexpressionbuilderdialog.h"
3838
#include "qgsgenericprojectionselector.h"
3939
#include "qgsproject.h"
40-
#include "qgsvisibilitypresetcollection.h"
41-
#include "qgsvisibilitypresets.h"
40+
#include "qgsmapthemecollection.h"
41+
#include "qgsmapthemes.h"
4242
#include "qgisgui.h"
4343

4444
#include <QMessageBox>
@@ -128,15 +128,15 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap )
128128
// follow preset combo
129129
mFollowVisibilityPresetCombo->setModel( new QStringListModel( mFollowVisibilityPresetCombo ) );
130130
connect( mFollowVisibilityPresetCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( followVisibilityPresetSelected( int ) ) );
131-
connect( QgsProject::instance()->visibilityPresetCollection(), SIGNAL( presetsChanged() ),
131+
connect( QgsProject::instance()->mapThemeCollection(), SIGNAL( presetsChanged() ),
132132
this, SLOT( onPresetsChanged() ) );
133133
onPresetsChanged();
134134

135135
// keep layers from preset button
136136
QMenu* menuKeepLayers = new QMenu( this );
137137
mLayerListFromPresetButton->setMenu( menuKeepLayers );
138138
mLayerListFromPresetButton->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.png" ) );
139-
mLayerListFromPresetButton->setToolTip( tr( "Set layer list from a visibility preset" ) );
139+
mLayerListFromPresetButton->setToolTip( tr( "Set layer list from a map theme" ) );
140140
connect( menuKeepLayers, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowKeepLayersVisibilityPresetsMenu() ) );
141141

142142
if ( composerMap )
@@ -318,7 +318,7 @@ void QgsComposerMapWidget::aboutToShowKeepLayersVisibilityPresetsMenu()
318318
return;
319319

320320
menu->clear();
321-
Q_FOREACH ( const QString& presetName, QgsProject::instance()->visibilityPresetCollection()->presets() )
321+
Q_FOREACH ( const QString& presetName, QgsProject::instance()->mapThemeCollection()->presets() )
322322
{
323323
menu->addAction( presetName, this, SLOT( keepLayersVisibilityPresetSelected() ) );
324324
}
@@ -358,15 +358,15 @@ void QgsComposerMapWidget::keepLayersVisibilityPresetSelected()
358358
return;
359359

360360
QString presetName = action->text();
361-
QStringList lst = QgsVisibilityPresets::instance()->orderedPresetVisibleLayers( presetName );
361+
QStringList lst = QgsMapThemes::instance()->orderedPresetVisibleLayers( presetName );
362362
if ( mComposerMap )
363363
{
364364
mKeepLayerListCheckBox->setChecked( true );
365365
mComposerMap->setLayerSet( lst );
366366

367367
mKeepLayerStylesCheckBox->setChecked( true );
368368

369-
mComposerMap->setLayerStyleOverrides( QgsProject::instance()->visibilityPresetCollection()->presetStyleOverrides( presetName ) );
369+
mComposerMap->setLayerStyleOverrides( QgsProject::instance()->mapThemeCollection()->presetStyleOverrides( presetName ) );
370370

371371
mComposerMap->cache();
372372
mComposerMap->update();
@@ -379,7 +379,7 @@ void QgsComposerMapWidget::onPresetsChanged()
379379
{
380380
QStringList lst;
381381
lst.append( tr( "(none)" ) );
382-
lst += QgsProject::instance()->visibilityPresetCollection()->presets();
382+
lst += QgsProject::instance()->mapThemeCollection()->presets();
383383
model->setStringList( lst );
384384

385385
// select the previously selected item again

‎src/app/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ typedef SInt32 SRefCon;
100100
#include "qgsrectangle.h"
101101
#include "qgslogger.h"
102102
#include "qgsdxfexport.h"
103-
#include "qgsvisibilitypresets.h"
103+
#include "qgsmapthemes.h"
104104
#include "qgsmaplayerregistry.h"
105105
#include "qgsvectorlayer.h"
106106

@@ -134,7 +134,7 @@ void usage( std::string const & appName )
134134
<< "\t[--dxf-symbology-mode none|symbollayer|feature]\tsymbology mode for dxf output\n"
135135
<< "\t[--dxf-scale-denom scale]\tscale for dxf output\n"
136136
<< "\t[--dxf-encoding encoding]\tencoding to use for dxf output\n"
137-
<< "\t[--dxf-preset visiblity-preset]\tlayer visibility preset to use for dxf output\n"
137+
<< "\t[--dxf-preset visiblity-preset]\tlayer map theme to use for dxf output\n"
138138
<< "\t[--help]\t\tthis text\n"
139139
<< "\t[--]\t\ttreat all following arguments as FILEs\n\n"
140140
<< " FILE:\n"
@@ -1187,7 +1187,7 @@ int main( int argc, char *argv[] )
11871187
QList< QPair<QgsVectorLayer *, int > > layers;
11881188
if ( !dxfPreset.isEmpty() )
11891189
{
1190-
Q_FOREACH ( const QString& layer, QgsProject::instance()->visibilityPresetCollection()->presetVisibleLayers( dxfPreset ) )
1190+
Q_FOREACH ( const QString& layer, QgsProject::instance()->mapThemeCollection()->presetVisibleLayers( dxfPreset ) )
11911191
{
11921192
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( QgsMapLayerRegistry::instance()->mapLayer( layer ) );
11931193
if ( !vl )

‎src/app/qgisapp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
#include "qgsvectorfilewriter.h"
232232
#include "qgsvectorlayer.h"
233233
#include "qgsvectorlayerproperties.h"
234-
#include "qgsvisibilitypresets.h"
234+
#include "qgsmapthemes.h"
235235
#include "qgsmessagelogviewer.h"
236236
#include "qgsdataitem.h"
237237
#include "qgsmaplayeractionregistry.h"
@@ -3002,10 +3002,10 @@ void QgisApp::initLayerTreeView()
30023002
// visibility groups tool button
30033003
QToolButton* btnVisibilityPresets = new QToolButton;
30043004
btnVisibilityPresets->setAutoRaise( true );
3005-
btnVisibilityPresets->setToolTip( tr( "Manage Layer Visibility" ) );
3005+
btnVisibilityPresets->setToolTip( tr( "Manage Map Themes" ) );
30063006
btnVisibilityPresets->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.svg" ) );
30073007
btnVisibilityPresets->setPopupMode( QToolButton::InstantPopup );
3008-
btnVisibilityPresets->setMenu( QgsVisibilityPresets::instance()->menu() );
3008+
btnVisibilityPresets->setMenu( QgsMapThemes::instance()->menu() );
30093009

30103010
// filter legend action
30113011
mActionFilterLegend = new QAction( tr( "Filter Legend By Map Content" ), this );

‎src/app/qgsdxfexportdialog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "qgsfieldcombobox.h"
2727
#include "qgisapp.h"
2828
#include "qgslayertreemapcanvasbridge.h"
29-
#include "qgsvisibilitypresetcollection.h"
29+
#include "qgsmapthemecollection.h"
3030
#include "qgsmapcanvas.h"
3131

3232
#include <QFileDialog>
@@ -344,7 +344,7 @@ void QgsVectorLayerAndAttributeModel::applyVisibilityPreset( const QString &name
344344
}
345345
else
346346
{
347-
visibleLayers = QgsProject::instance()->visibilityPresetCollection()->presetVisibleLayers( name ).toSet();
347+
visibleLayers = QgsProject::instance()->mapThemeCollection()->presetVisibleLayers( name ).toSet();
348348
}
349349

350350
if ( visibleLayers.isEmpty() )
@@ -450,7 +450,7 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f )
450450
mLayerTitleAsName->setChecked( QgsProject::instance()->readEntry( "dxf", "/lastDxfLayerTitleAsName", s.value( "qgis/lastDxfLayerTitleAsName", "false" ).toString() ) != "false" );
451451
mMapExtentCheckBox->setChecked( QgsProject::instance()->readEntry( "dxf", "/lastDxfMapRectangle", s.value( "qgis/lastDxfMapRectangle", "false" ).toString() ) != "false" );
452452

453-
QStringList ids = QgsProject::instance()->visibilityPresetCollection()->presets();
453+
QStringList ids = QgsProject::instance()->mapThemeCollection()->presets();
454454
ids.prepend( "" );
455455
mVisibilityPresets->addItems( ids );
456456
mVisibilityPresets->setCurrentIndex( mVisibilityPresets->findText( QgsProject::instance()->readEntry( "dxf", "/lastVisibilityPreset", "" ) ) );

13 commit comments

Comments
 (13)

SrNetoChan commented on Jan 26, 2017

@SrNetoChan
Member

@m-kuhn I have just noticed this change. Although I think "visibility presets" were never very intuitive, I'm not sure map theme is any better.

For "map theme" I would imagine it like the colors and fonts used in map composer. Can't really imagine this as what gathers information of layers visibility and style.

How about "layers set"?

PS: Sorry this is a really old commit for me to comment.

m-kuhn commented on Jan 27, 2017

@m-kuhn
MemberAuthor

Layer set to me sounds to have the same lack of reference to styling as visibility preset.

I have discussed this with @nyalldawson and among other ideas like map topic, we decided on map theme. I'm sure there is something distinct but suitable to refer to compositions.

SrNetoChan commented on Jan 27, 2017

@SrNetoChan
Member

Oh!! Now I understand where you are going with this change. I was pretty sure that you haven't decided that without discussing it with others, but I got too late to the discussion.

Searching for synonyms for "composition", the best I could get was "combination". But not sure about it...

So "Map themes" will be. Sorry for all the noise.

m-kuhn commented on Jan 27, 2017

@m-kuhn
MemberAuthor

Maybe we can stick to composition?

Nothing to be sorry about, really. It's always good to have feedback on how terminology is perceived by different people! Thanks for the input!

nyalldawson commented on Jan 27, 2017

@nyalldawson
Collaborator

Compositions is going to change to layouts in future :)

SrNetoChan commented on Jan 27, 2017

@SrNetoChan
Member

Changing [print] composition to layout is a great call. In that case, "composition" IMHO is really the best candidate.

It will be a bit messy in the beginning. But, I guess people will get used to it.

3nids commented on Jan 27, 2017

@3nids
Member

From my non native english spelling point of view, map themes makes a lot of sense. I would vote to stick to it.

DelazJ commented on Dec 17, 2017

@DelazJ
Contributor

@3nids may I ask you how you'd translate this in French, please? I fail to find something suitable/concise and clear and given that it's still untranslated, i guess i might not be the only translator wondering... Thanks

3nids commented on Dec 18, 2017

@3nids
Member

hmmm, I don't have a very good candidate....
cartes thématiques?
jeu de rendu?

haubourg commented on Dec 18, 2017

@haubourg
Member

"Styles de carte?"

m-kuhn commented on Dec 18, 2017

@m-kuhn
MemberAuthor

Thème de carte?

Gustry commented on Dec 18, 2017

@Gustry
Contributor

Quite difficult ...

Set cartographique? (à la manière d'un "set de table")
Jeu de rendu aussi ?

haubourg commented on Dec 18, 2017

@haubourg
Member

+1 for "Thème de carte"

Please sign in to comment.