Skip to content
Permalink
Browse files

Rename QgsLayerStylingPanelFactory to QgsMapLayerConfigWidgetFactory

- Move QgsMapLayerPropertiesFactory into single factory object for
  dock and properties
  • Loading branch information
NathanW2 committed Jul 6, 2016
1 parent 38e65c3 commit fdf16e3c92e19a3563f2974aeab2fff04741561f
Showing with 243 additions and 455 deletions.
  1. +2 −3 python/gui/gui.sip
  2. +2 −8 python/gui/qgisinterface.sip
  3. +29 −0 python/gui/qgsmaplayerconfigwidget.sip
  4. +48 −0 python/gui/qgsmaplayerconfigwidgetfactory.sip
  5. +0 −34 python/gui/qgsmaplayerpropertiesfactory.sip
  6. +1 −1 python/gui/qgsmaplayerstylemanagerwidget.sip
  7. +0 −86 python/gui/qgsmapstylepanel.sip
  8. +0 −22 python/gui/qgsvectorlayerpropertiespage.sip
  9. +1 −1 python/gui/raster/qgsrendererrasterpropertieswidget.sip
  10. +8 −18 src/app/qgisapp.cpp
  11. +4 −12 src/app/qgisapp.h
  12. +2 −12 src/app/qgisappinterface.cpp
  13. +2 −8 src/app/qgisappinterface.h
  14. +1 −1 src/app/qgslabelingwidget.cpp
  15. +2 −2 src/app/qgslabelingwidget.h
  16. +13 −11 src/app/qgslayerstylingwidget.cpp
  17. +11 −11 src/app/qgslayerstylingwidget.h
  18. +9 −6 src/app/qgsvectorlayerproperties.cpp
  19. +4 −4 src/app/qgsvectorlayerproperties.h
  20. +4 −6 src/gui/CMakeLists.txt
  21. +3 −10 src/gui/qgisinterface.h
  22. +2 −12 src/gui/{qgsmapstylepanel.cpp → qgsmaplayerconfigwidget.cpp}
  23. +4 −51 src/gui/{qgsmapstylepanel.h → qgsmaplayerconfigwidget.h}
  24. +10 −4 src/gui/{qgsmaplayerpropertiesfactory.cpp → qgsmaplayerconfigwidgetfactory.cpp}
  25. +68 −0 src/gui/qgsmaplayerconfigwidgetfactory.h
  26. +0 −54 src/gui/qgsmaplayerpropertiesfactory.h
  27. +2 −2 src/gui/qgsmaplayerstylemanagerwidget.cpp
  28. +2 −2 src/gui/qgsmaplayerstylemanagerwidget.h
  29. +0 −22 src/gui/qgsvectorlayerpropertiespage.cpp
  30. +0 −43 src/gui/qgsvectorlayerpropertiespage.h
  31. +1 −1 src/gui/raster/qgsrasterhistogramwidget.cpp
  32. +2 −2 src/gui/raster/qgsrasterhistogramwidget.h
  33. +1 −1 src/gui/raster/qgsrastertransparencywidget.cpp
  34. +2 −2 src/gui/raster/qgsrastertransparencywidget.h
  35. +1 −1 src/gui/raster/qgsrendererrasterpropertieswidget.cpp
  36. +2 −2 src/gui/raster/qgsrendererrasterpropertieswidget.h
@@ -105,7 +105,8 @@
%Include qgsmaplayeractionregistry.sip
%Include qgsmaplayercombobox.sip
%Include qgsmaplayermodel.sip
%Include qgsmaplayerpropertiesfactory.sip
%Include qgsmaplayerconfigwidget.sip
%Include qgsmaplayerconfigwidgetfactory.sip
%Include qgsmaplayerproxymodel.sip
%Include qgsmapmouseevent.sip
%Include qgsmapoverviewcanvas.sip
@@ -120,7 +121,6 @@
%Include qgsmaptoolpan.sip
%Include qgsmaptooltouch.sip
%Include qgsmaptoolzoom.sip
%Include qgsmapstylepanel.sip
%Include qgsmaplayerstylemanagerwidget.sip
%Include qgsmessagebar.sip
%Include qgsmessagebaritem.sip
@@ -164,7 +164,6 @@
%Include qgsunitselectionwidget.sip
%Include qgsuserinputdockwidget.sip
%Include qgsvariableeditorwidget.sip
%Include qgsvectorlayerpropertiespage.sip
%Include qgsvectorlayertools.sip
%Include qgsvertexmarker.sip

@@ -284,19 +284,13 @@ class QgisInterface : QObject
* @note Ownership of the factory is not transferred, and the factory must
* be unregistered when plugin is unloaded.
* @see unregisterMapLayerPropertiesFactory() */
virtual void registerMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory ) = 0;
virtual void registerMapLayerConfigWidgetFactory( QgsMapLayerConfigWidgetFactory* factory ) = 0;

/** Unregister a previously registered tab in the vector layer properties dialog.
* @note added in QGIS 2.16
* @see registerMapLayerPropertiesFactory()
*/
virtual void unregisterMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory ) = 0;

/** Register a new tab in the layer properties dialog */
virtual void registerMapStylePanelFactory( QgsLayerStylingPanelFactory* factory ) = 0;

/** Unregister a previously registered tab in the layer properties dialog */
virtual void unregisterMapStylePanelFactory( QgsLayerStylingPanelFactory* factory ) = 0;
virtual void unregisterMapLayerConfigWidgetFactory( QgsMapLayerConfigWidgetFactory* factory ) = 0;

// @todo is this deprecated in favour of QgsContextHelp?
/** Open a url in the users browser. By default the QGIS doc directory is used
@@ -0,0 +1,29 @@
/** \ingroup gui
* \class QgsMapLayerConfigWidget
* \class A panel widget that can be shown in the map style dock
* \note added in QGIS 2.16
*/
class QgsMapLayerConfigWidget : public QgsPanelWidget
{
%TypeHeaderCode
#include <qgsmaplayerconfigwidget.h>
%End
public:
/**
* @brief A panel widget that can be shown in the map style dock
* @param layer The layer active in the dock.
* @param canvas The canvas object.
* @param parent The parent of the widget.
* @note The widget is created each time the panel is selected in the dock.
* Keep the loading light as possible for speed in the UI.
*/
QgsMapLayerConfigWidget(QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget *parent = 0);

public slots:

/**
* @brief Called when changes to the layer need to be made.
* Will be called when live update is enabled.
*/
virtual void apply() = 0;
};
@@ -0,0 +1,48 @@
/** \ingroup gui
* \class QgsMapLayerConfigWidgetFactory
* \note added in QGIS 2.16
* Factory class for creating custom map layer property pages
*/
class QgsMapLayerConfigWidgetFactory
{
%TypeHeaderCode
#include <qgsmaplayerconfigwidgetfactory.h>
%End

public:
/** Constructor */
QgsMapLayerConfigWidgetFactory();

/** Destructor */
virtual ~QgsMapLayerConfigWidgetFactory();

/**
* @brief The icon that will be shown in the UI for the panel.
* @return A QIcon for the panel icon.
*/
virtual QIcon icon() const;

/**
* @brief The title of the panel.
* @note This may or may not be shown to the user.
* @return Title of the panel
*/
virtual QString title() const;

/**
* @brief Check if the layer is supported for this widget.
* @return True if this layer is supported for this widget
*/
virtual bool supportsLayer( QgsMapLayer *layer ) const;

/**
* @brief Factory fucntion to create the widget on demand as needed by the dock.
* @note This function is called each time the panel is selected. Keep it light for better UX.
* @param layer The active layer in the dock.
* @param canvas The map canvas.
* @param dockWidget True of the widget will be shown a dock style widget.
* @param parent The parent of the widget.
* @return A new QgsMapStylePanel which is shown in the map style dock.
*/
virtual QgsMapLayerConfigWidget* createWidget( QgsMapLayer* layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget* parent /TransferThis/ = 0) const = 0 /Factory/;
};

This file was deleted.

@@ -2,7 +2,7 @@
* @brief The QgsMapLayerStyleManagerWidget class which is used to visually manage
* the layer styles.
*/
class QgsMapLayerStyleManagerWidget : QgsLayerStylingPanel
class QgsMapLayerStyleManagerWidget : QgsMapLayerConfigWidget
{
%TypeHeaderCode
#include "qgsmaplayerstylemanagerwidget.h"

This file was deleted.

This file was deleted.

@@ -1,4 +1,4 @@
class QgsRendererRasterPropertiesWidget : QgsLayerStylingPanel
class QgsRendererRasterPropertiesWidget : QgsMapLayerConfigWidget
{
%TypeHeaderCode
#include <qgsrendererrasterpropertieswidget.h>
@@ -776,7 +776,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
mMapStylingDock = new QgsDockWidget( this );
mMapStylingDock->setWindowTitle( tr( "Layer Styling" ) );
mMapStylingDock->setObjectName( "LayerStyling" );
mMapStyleWidget = new QgsLayerStylingWidget( mMapCanvas, mMapStylePanelFactories );
mMapStyleWidget = new QgsLayerStylingWidget( mMapCanvas, mMapLayerPanelFactories );
mMapStylingDock->setWidget( mMapStyleWidget );
connect( mMapStyleWidget, SIGNAL( styleChanged( QgsMapLayer* ) ), this, SLOT( updateLabelToolButtons() ) );
connect( mMapStylingDock, SIGNAL( visibilityChanged( bool ) ), mActionStyleDock, SLOT( setChecked( bool ) ) );
@@ -9123,28 +9123,18 @@ void QgisApp::openURL( QString url, bool useQgisDocDirectory )
#endif
}

void QgisApp::registerMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory )
void QgisApp::registerMapLayerPropertiesFactory( QgsMapLayerConfigWidgetFactory* factory )
{
mMapLayerPropertiesFactories << factory;
}

void QgisApp::unregisterMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory )
{
mMapLayerPropertiesFactories.removeAll( factory );
}

void QgisApp::registerMapStylePanelFactory( QgsLayerStylingPanelFactory *factory )
{
mMapStylePanelFactories << factory;
mMapLayerPanelFactories << factory;
if ( mMapStyleWidget )
mMapStyleWidget->setPageFactories( mMapStylePanelFactories );
mMapStyleWidget->setPageFactories( mMapLayerPanelFactories );
}

void QgisApp::unregisterMapStylePanelFactory( QgsLayerStylingPanelFactory *factory )
void QgisApp::unregisterMapLayerPropertiesFactory( QgsMapLayerConfigWidgetFactory* factory )
{
mMapStylePanelFactories.removeAll( factory );
mMapLayerPanelFactories.removeAll( factory );
if ( mMapStyleWidget )
mMapStyleWidget->setPageFactories( mMapStylePanelFactories );
mMapStyleWidget->setPageFactories( mMapLayerPanelFactories );
}

/** Get a pointer to the currently selected map layer */
@@ -11367,7 +11357,7 @@ void QgisApp::showLayerProperties( QgsMapLayer *ml )
#else
QgsVectorLayerProperties *vlp = new QgsVectorLayerProperties( vlayer, this );
#endif
Q_FOREACH ( QgsMapLayerPropertiesFactory* factory, mMapLayerPropertiesFactories )
Q_FOREACH ( QgsMapLayerConfigWidgetFactory* factory, mMapLayerPanelFactories )
{
vlp->addPropertiesPageFactory( factory );
}
@@ -57,8 +57,7 @@ class QgsLayerTreeMapCanvasBridge;
class QgsLayerTreeView;
class QgsMapCanvas;
class QgsMapLayer;
class QgsMapLayerPropertiesFactory;
class QgsLayerStylingPanelFactory;
class QgsMapLayerConfigWidgetFactory;
class QgsMapTip;
class QgsMapTool;
class QgsMapToolAdvancedDigitizing;
@@ -508,16 +507,10 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void parseVersionInfo( QNetworkReply* reply, int& latestVersion, QStringList& versionInfo );

/** Register a new tab in the layer properties dialog */
void registerMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory );
void registerMapLayerPropertiesFactory( QgsMapLayerConfigWidgetFactory* factory );

/** Unregister a previously registered tab in the layer properties dialog */
void unregisterMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory );

/** Register a new tab in the layer properties dialog */
void registerMapStylePanelFactory( QgsLayerStylingPanelFactory* factory );

/** Unregister a previously registered tab in the layer properties dialog */
void unregisterMapStylePanelFactory( QgsLayerStylingPanelFactory* factory );
void unregisterMapLayerPropertiesFactory( QgsMapLayerConfigWidgetFactory* factory );

public slots:
void layerTreeViewDoubleClicked( const QModelIndex& index );
@@ -1779,8 +1772,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

QgsSnappingUtils* mSnappingUtils;

QList<QgsMapLayerPropertiesFactory*> mMapLayerPropertiesFactories;
QList<QgsLayerStylingPanelFactory*> mMapStylePanelFactories;
QList<QgsMapLayerConfigWidgetFactory*> mMapLayerPanelFactories;

QDateTime mProjectLastModified;

2 comments on commit fdf16e3

@jef-n

This comment has been minimized.

Copy link
Member

@jef-n jef-n replied Jul 6, 2016

Breaks the globe plugin - what does it fix?

@NathanW2

This comment has been minimized.

Copy link
Member Author

@NathanW2 NathanW2 replied Jul 6, 2016

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