Skip to content
Permalink
Browse files

Renamed visibility "groups" to "presets" to avoid confusion with ordi…

…nary groups

If you have a project file using this functionality, you may need to run a simple
replace of "visibility-group" to "visibility-preset"
  • Loading branch information
wonder-sk committed Sep 15, 2014
1 parent 48db9a2 commit f583a9eaece4d48043f6d9b5f2f1ebf9efed5b01
@@ -108,7 +108,7 @@ SET(QGIS_APP_SRCS
qgstipgui.cpp
qgstipfactory.cpp
qgsvectorlayerproperties.cpp
qgsvisibilitygroups.cpp
qgsvisibilitypresets.cpp
qgshandlebadlayers.cpp

composer/qgsattributeselectiondialog.cpp
@@ -247,7 +247,7 @@ SET (QGIS_APP_MOC_HDRS
qgstipfactory.h
qgsundowidget.h
qgsvectorlayerproperties.h
qgsvisibilitygroups.h
qgsvisibilitypresets.h
qgshandlebadlayers.h

composer/qgsattributeselectiondialog.h
@@ -37,7 +37,7 @@
#include "qgsexpressionbuilderdialog.h"
#include "qgsgenericprojectionselector.h"
#include "qgsproject.h"
#include "qgsvisibilitygroups.h"
#include "qgsvisibilitypresets.h"
#include <QColorDialog>
#include <QFontDialog>
#include <QMessageBox>
@@ -113,12 +113,11 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
toggleFrameControls( false, false, false );

QMenu* m = new QMenu( this );
m->addAction( "No groups" )->setEnabled( false );
mLayerListFromGroupButton->setMenu( m );
mLayerListFromGroupButton->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.png" ) );
mLayerListFromGroupButton->setToolTip( tr( "Set layer list from a visibility group" ) );
mLayerListFromPresetButton->setMenu( m );
mLayerListFromPresetButton->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.png" ) );
mLayerListFromPresetButton->setToolTip( tr( "Set layer list from a visibility preset" ) );

connect( m, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowVisibilityGroupsMenu() ) );
connect( m, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowVisibilityPresetsMenu() ) );

if ( composerMap )
{
@@ -259,42 +258,42 @@ void QgsComposerMapWidget::compositionAtlasToggled( bool atlasEnabled )
}
}

void QgsComposerMapWidget::aboutToShowVisibilityGroupsMenu()
void QgsComposerMapWidget::aboutToShowVisibilityPresetsMenu()
{
QMenu* menu = qobject_cast<QMenu*>( sender() );
if ( !menu )
return;

QgsVisibilityGroups::GroupRecord rec = QgsVisibilityGroups::instance()->currentStateFromLayerList( mComposerMap->layerSet() );
QgsVisibilityPresets::PresetRecord rec = QgsVisibilityPresets::instance()->currentStateFromLayerList( mComposerMap->layerSet() );

menu->clear();
foreach ( QString groupName, QgsVisibilityGroups::instance()->groups() )
foreach ( QString presetName, QgsVisibilityPresets::instance()->presets() )
{
QAction* a = menu->addAction( groupName, this, SLOT( visibilityGroupSelected() ) );
QAction* a = menu->addAction( presetName, this, SLOT( visibilityPresetSelected() ) );
a->setCheckable( true );
if ( rec == QgsVisibilityGroups::instance()->groupState( groupName ) )
if ( rec == QgsVisibilityPresets::instance()->presetState( presetName ) )
a->setChecked( true );
}

if ( menu->actions().isEmpty() )
menu->addAction( tr( "No groups defined" ) )->setEnabled( false );
menu->addAction( tr( "No presets defined" ) )->setEnabled( false );
}

void QgsComposerMapWidget::visibilityGroupSelected()
void QgsComposerMapWidget::visibilityPresetSelected()
{
QAction* action = qobject_cast<QAction*>( sender() );
if ( !action )
return;

QStringList lst = QgsVisibilityGroups::instance()->groupVisibleLayers( action->text() );
QStringList lst = QgsVisibilityPresets::instance()->presetVisibleLayers( action->text() );
if ( mComposerMap )
{
mKeepLayerListCheckBox->setChecked( true );
mComposerMap->setLayerSet( lst );

// also apply legend node check states
foreach ( QString layerID, lst )
QgsVisibilityGroups::instance()->applyGroupCheckedLegendNodesToLayer( action->text(), layerID );
QgsVisibilityPresets::instance()->applyPresetCheckedLegendNodesToLayer( action->text(), layerID );

mComposerMap->cache();
mComposerMap->update();
@@ -155,9 +155,9 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
/**Enables or disables the atlas controls when composer atlas is toggled on/off*/
void compositionAtlasToggled( bool atlasEnabled );

void aboutToShowVisibilityGroupsMenu();
void aboutToShowVisibilityPresetsMenu();

void visibilityGroupSelected();
void visibilityPresetSelected();

private:
QgsComposerMap* mComposerMap;
@@ -195,7 +195,7 @@
#include "qgsvectorfilewriter.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerproperties.h"
#include "qgsvisibilitygroups.h"
#include "qgsvisibilitypresets.h"
#include "qgsmessagelogviewer.h"
#include "qgsdataitem.h"
#include "qgsmaplayeractionregistry.h"
@@ -2326,12 +2326,12 @@ void QgisApp::initLayerTreeView()
connect( btnAddGroup, SIGNAL( clicked() ), mLayerTreeView->defaultActions(), SLOT( addGroup() ) );

// visibility groups tool button
QToolButton* btnVisibilityGroups = new QToolButton;
btnVisibilityGroups->setAutoRaise( true );
btnVisibilityGroups->setToolTip( tr( "Manage Layer Visibility" ) );
btnVisibilityGroups->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.png" ) );
btnVisibilityGroups->setPopupMode( QToolButton::InstantPopup );
btnVisibilityGroups->setMenu( QgsVisibilityGroups::instance()->menu() );
QToolButton* btnVisibilityPresets = new QToolButton;
btnVisibilityPresets->setAutoRaise( true );
btnVisibilityPresets->setToolTip( tr( "Manage Layer Visibility" ) );
btnVisibilityPresets->setIcon( QgsApplication::getThemeIcon( "/mActionShowAllLayers.png" ) );
btnVisibilityPresets->setPopupMode( QToolButton::InstantPopup );
btnVisibilityPresets->setMenu( QgsVisibilityPresets::instance()->menu() );

// expand / collapse tool buttons
QToolButton* btnExpandAll = new QToolButton;
@@ -2352,7 +2352,7 @@ void QgisApp::initLayerTreeView()
QHBoxLayout* toolbarLayout = new QHBoxLayout;
toolbarLayout->setContentsMargins( QMargins( 5, 0, 5, 0 ) );
toolbarLayout->addWidget( btnAddGroup );
toolbarLayout->addWidget( btnVisibilityGroups );
toolbarLayout->addWidget( btnVisibilityPresets );
toolbarLayout->addWidget( btnExpandAll );
toolbarLayout->addWidget( btnCollapseAll );
toolbarLayout->addWidget( btnRemoveItem );
@@ -3496,7 +3496,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
fileNewFromDefaultTemplate();
}

QgsVisibilityGroups::instance()->clear();
QgsVisibilityPresets::instance()->clear();

// set the initial map tool
#ifndef HAVE_TOUCH

This file was deleted.

0 comments on commit f583a9e

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