Skip to content
Permalink
Browse files

Rename visibility presets to map themes

Because it is not only more descriptive for what it does but also
sounds more interesting.

[needs-docs]
  • Loading branch information
m-kuhn committed Jul 22, 2016
1 parent 1da60c5 commit 3e33e686c14dc863e55c923f748add4a6d19b6c0
@@ -64,6 +64,18 @@ QGis::UnitType parameters have been updated to take QgsUnitTypes::DistanceUnit i
corresponding counterparts in QgsUnitTypes should be used instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsProject QgsProject

<ul>
<li>visibilityPresetCollection() has been renamed to mapThemeCollection()</li>
</ul>

\subsection qgis_api_break_3_0_QgsVisibilityPresetCollection QgsVisibilityPresetCollection

<ul>
<li>Has been renamed to QgsMapThemeCollection</li>
</ul>

\subsection qgis_api_break_3_0_QgsAuthConfigUriEdit QgsAuthConfigUriEdit

<ul>
@@ -157,7 +157,7 @@
%Include qgsvectorlayerfeatureiterator.sip
%Include qgsvirtuallayerdefinition.sip
%Include qgsvirtuallayerdefinitionutils.sip
%Include qgsvisibilitypresetcollection.sip
%Include qgsmapthemecollection.sip
%Include qgsxmlutils.sip

%Include auth/qgsauthcertutils.sip
@@ -1,15 +1,15 @@
/**
\class QgsVisibilityPresetCollection
\class QgsMapThemeCollection
\ingroup core
\brief Container class that allows storage of visibility presets consisting of visible
map layers and layer styles.
\note added in QGIS 2.12
*/

class QgsVisibilityPresetCollection : QObject
class QgsMapThemeCollection : QObject
{
%TypeHeaderCode
#include <qgsvisibilitypresetcollection.h>
#include <qgsmapthemecollection.h>
%End
public:

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

bool operator==( const QgsVisibilityPresetCollection::PresetRecord& other ) const;
bool operator!=( const QgsVisibilityPresetCollection::PresetRecord& other ) const;
bool operator==( const QgsMapThemeCollection::PresetRecord& other ) const;
bool operator!=( const QgsMapThemeCollection::PresetRecord& other ) const;

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

QgsVisibilityPresetCollection();
QgsMapThemeCollection();

/** Returns whether a preset with a matching name exists.
* @param name name of preset to check
@@ -273,7 +273,7 @@ class QgsProject : QObject
/** Returns pointer to the project's visibility preset collection.
* @note added in QGIS 2.12
*/
QgsVisibilityPresetCollection* visibilityPresetCollection();
QgsMapThemeCollection* mapThemeCollection();

/**
* Set a list of layers which should not be taken into account on map identification
@@ -121,7 +121,7 @@ SET(QGIS_APP_SRCS
qgstipgui.cpp
qgstipfactory.cpp
qgsvectorlayerproperties.cpp
qgsvisibilitypresets.cpp
qgsmapthemes.cpp
qgshandlebadlayers.cpp
qgsmaptooladdcircularstring.cpp
qgsmaptoolcircularstringcurvepoint.cpp
@@ -296,7 +296,7 @@ SET (QGIS_APP_MOC_HDRS
qgstipfactory.h
qgsundowidget.h
qgsvectorlayerproperties.h
qgsvisibilitypresets.h
qgsmapthemes.h
qgshandlebadlayers.h

composer/qgsattributeselectiondialog.h
@@ -37,8 +37,8 @@
#include "qgsexpressionbuilderdialog.h"
#include "qgsgenericprojectionselector.h"
#include "qgsproject.h"
#include "qgsvisibilitypresetcollection.h"
#include "qgsvisibilitypresets.h"
#include "qgsmapthemecollection.h"
#include "qgsmapthemes.h"
#include "qgisgui.h"

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

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

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

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

QString presetName = action->text();
QStringList lst = QgsVisibilityPresets::instance()->orderedPresetVisibleLayers( presetName );
QStringList lst = QgsMapThemes::instance()->orderedPresetVisibleLayers( presetName );
if ( mComposerMap )
{
mKeepLayerListCheckBox->setChecked( true );
mComposerMap->setLayerSet( lst );

mKeepLayerStylesCheckBox->setChecked( true );

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

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

// select the previously selected item again
@@ -100,7 +100,7 @@ typedef SInt32 SRefCon;
#include "qgsrectangle.h"
#include "qgslogger.h"
#include "qgsdxfexport.h"
#include "qgsvisibilitypresets.h"
#include "qgsmapthemes.h"
#include "qgsmaplayerregistry.h"
#include "qgsvectorlayer.h"

@@ -134,7 +134,7 @@ void usage( std::string const & appName )
<< "\t[--dxf-symbology-mode none|symbollayer|feature]\tsymbology mode for dxf output\n"
<< "\t[--dxf-scale-denom scale]\tscale for dxf output\n"
<< "\t[--dxf-encoding encoding]\tencoding to use for dxf output\n"
<< "\t[--dxf-preset visiblity-preset]\tlayer visibility preset to use for dxf output\n"
<< "\t[--dxf-preset visiblity-preset]\tlayer map theme to use for dxf output\n"
<< "\t[--help]\t\tthis text\n"
<< "\t[--]\t\ttreat all following arguments as FILEs\n\n"
<< " FILE:\n"
@@ -1187,7 +1187,7 @@ int main( int argc, char *argv[] )
QList< QPair<QgsVectorLayer *, int > > layers;
if ( !dxfPreset.isEmpty() )
{
Q_FOREACH ( const QString& layer, QgsProject::instance()->visibilityPresetCollection()->presetVisibleLayers( dxfPreset ) )
Q_FOREACH ( const QString& layer, QgsProject::instance()->mapThemeCollection()->presetVisibleLayers( dxfPreset ) )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( QgsMapLayerRegistry::instance()->mapLayer( layer ) );
if ( !vl )
@@ -231,7 +231,7 @@
#include "qgsvectorfilewriter.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerproperties.h"
#include "qgsvisibilitypresets.h"
#include "qgsmapthemes.h"
#include "qgsmessagelogviewer.h"
#include "qgsdataitem.h"
#include "qgsmaplayeractionregistry.h"
@@ -3002,10 +3002,10 @@ void QgisApp::initLayerTreeView()
// visibility groups tool button
QToolButton* btnVisibilityPresets = new QToolButton;
btnVisibilityPresets->setAutoRaise( true );
btnVisibilityPresets->setToolTip( tr( "Manage Layer Visibility" ) );
btnVisibilityPresets->setToolTip( tr( "Manage Map Themes" ) );
btnVisibilityPresets->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.svg" ) );
btnVisibilityPresets->setPopupMode( QToolButton::InstantPopup );
btnVisibilityPresets->setMenu( QgsVisibilityPresets::instance()->menu() );
btnVisibilityPresets->setMenu( QgsMapThemes::instance()->menu() );

// filter legend action
mActionFilterLegend = new QAction( tr( "Filter Legend By Map Content" ), this );
@@ -26,7 +26,7 @@
#include "qgsfieldcombobox.h"
#include "qgisapp.h"
#include "qgslayertreemapcanvasbridge.h"
#include "qgsvisibilitypresetcollection.h"
#include "qgsmapthemecollection.h"
#include "qgsmapcanvas.h"

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

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

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

13 comments on commit 3e33e68

@SrNetoChan

This comment has been minimized.

Copy link
Member

@SrNetoChan SrNetoChan replied Jan 26, 2017

@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

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Jan 27, 2017

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

This comment has been minimized.

Copy link
Member

@SrNetoChan SrNetoChan replied Jan 27, 2017

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

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Jan 27, 2017

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

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Jan 27, 2017

Compositions is going to change to layouts in future :)

@SrNetoChan

This comment has been minimized.

Copy link
Member

@SrNetoChan SrNetoChan replied Jan 27, 2017

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

This comment has been minimized.

Copy link
Member

@3nids 3nids replied Jan 27, 2017

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

@DelazJ

This comment has been minimized.

Copy link
Contributor

@DelazJ DelazJ replied Dec 17, 2017

@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

This comment has been minimized.

Copy link
Member

@3nids 3nids replied Dec 18, 2017

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

@haubourg

This comment has been minimized.

Copy link
Contributor

@haubourg haubourg replied Dec 18, 2017

"Styles de carte?"

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Dec 18, 2017

Thème de carte?

@haubourg

This comment has been minimized.

Copy link
Contributor

@haubourg haubourg replied Dec 18, 2017

+1 for "Thème de carte"

@Gustry

This comment has been minimized.

Copy link
Contributor

@Gustry Gustry replied Dec 18, 2017

Quite difficult ...

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

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