|
37 | 37 | #include "qgsexpressionbuilderdialog.h"
|
38 | 38 | #include "qgsgenericprojectionselector.h"
|
39 | 39 | #include "qgsproject.h"
|
40 |
| -#include "qgsvisibilitygroups.h" |
| 40 | +#include "qgsvisibilitypresets.h" |
41 | 41 | #include <QColorDialog>
|
42 | 42 | #include <QFontDialog>
|
43 | 43 | #include <QMessageBox>
|
@@ -113,12 +113,11 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
|
113 | 113 | toggleFrameControls( false, false, false );
|
114 | 114 |
|
115 | 115 | QMenu* m = new QMenu( this );
|
116 |
| - m->addAction( "No groups" )->setEnabled( false ); |
117 |
| - mLayerListFromGroupButton->setMenu( m ); |
118 |
| - mLayerListFromGroupButton->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.png" ) ); |
119 |
| - mLayerListFromGroupButton->setToolTip( tr( "Set layer list from a visibility group" ) ); |
| 116 | + mLayerListFromPresetButton->setMenu( m ); |
| 117 | + mLayerListFromPresetButton->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.png" ) ); |
| 118 | + mLayerListFromPresetButton->setToolTip( tr( "Set layer list from a visibility preset" ) ); |
120 | 119 |
|
121 |
| - connect( m, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowVisibilityGroupsMenu() ) ); |
| 120 | + connect( m, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowVisibilityPresetsMenu() ) ); |
122 | 121 |
|
123 | 122 | if ( composerMap )
|
124 | 123 | {
|
@@ -259,42 +258,42 @@ void QgsComposerMapWidget::compositionAtlasToggled( bool atlasEnabled )
|
259 | 258 | }
|
260 | 259 | }
|
261 | 260 |
|
262 |
| -void QgsComposerMapWidget::aboutToShowVisibilityGroupsMenu() |
| 261 | +void QgsComposerMapWidget::aboutToShowVisibilityPresetsMenu() |
263 | 262 | {
|
264 | 263 | QMenu* menu = qobject_cast<QMenu*>( sender() );
|
265 | 264 | if ( !menu )
|
266 | 265 | return;
|
267 | 266 |
|
268 |
| - QgsVisibilityGroups::GroupRecord rec = QgsVisibilityGroups::instance()->currentStateFromLayerList( mComposerMap->layerSet() ); |
| 267 | + QgsVisibilityPresets::PresetRecord rec = QgsVisibilityPresets::instance()->currentStateFromLayerList( mComposerMap->layerSet() ); |
269 | 268 |
|
270 | 269 | menu->clear();
|
271 |
| - foreach ( QString groupName, QgsVisibilityGroups::instance()->groups() ) |
| 270 | + foreach ( QString presetName, QgsVisibilityPresets::instance()->presets() ) |
272 | 271 | {
|
273 |
| - QAction* a = menu->addAction( groupName, this, SLOT( visibilityGroupSelected() ) ); |
| 272 | + QAction* a = menu->addAction( presetName, this, SLOT( visibilityPresetSelected() ) ); |
274 | 273 | a->setCheckable( true );
|
275 |
| - if ( rec == QgsVisibilityGroups::instance()->groupState( groupName ) ) |
| 274 | + if ( rec == QgsVisibilityPresets::instance()->presetState( presetName ) ) |
276 | 275 | a->setChecked( true );
|
277 | 276 | }
|
278 | 277 |
|
279 | 278 | if ( menu->actions().isEmpty() )
|
280 |
| - menu->addAction( tr( "No groups defined" ) )->setEnabled( false ); |
| 279 | + menu->addAction( tr( "No presets defined" ) )->setEnabled( false ); |
281 | 280 | }
|
282 | 281 |
|
283 |
| -void QgsComposerMapWidget::visibilityGroupSelected() |
| 282 | +void QgsComposerMapWidget::visibilityPresetSelected() |
284 | 283 | {
|
285 | 284 | QAction* action = qobject_cast<QAction*>( sender() );
|
286 | 285 | if ( !action )
|
287 | 286 | return;
|
288 | 287 |
|
289 |
| - QStringList lst = QgsVisibilityGroups::instance()->groupVisibleLayers( action->text() ); |
| 288 | + QStringList lst = QgsVisibilityPresets::instance()->presetVisibleLayers( action->text() ); |
290 | 289 | if ( mComposerMap )
|
291 | 290 | {
|
292 | 291 | mKeepLayerListCheckBox->setChecked( true );
|
293 | 292 | mComposerMap->setLayerSet( lst );
|
294 | 293 |
|
295 | 294 | // also apply legend node check states
|
296 | 295 | foreach ( QString layerID, lst )
|
297 |
| - QgsVisibilityGroups::instance()->applyGroupCheckedLegendNodesToLayer( action->text(), layerID ); |
| 296 | + QgsVisibilityPresets::instance()->applyPresetCheckedLegendNodesToLayer( action->text(), layerID ); |
298 | 297 |
|
299 | 298 | mComposerMap->cache();
|
300 | 299 | mComposerMap->update();
|
|
0 commit comments