Skip to content

Commit

Permalink
[FEATURE] Add style/history tab to style dock
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed May 10, 2016
1 parent 948c1f0 commit ca914f1
Show file tree
Hide file tree
Showing 54 changed files with 4,025 additions and 3,744 deletions.
18 changes: 18 additions & 0 deletions python/core/qgsmaplayer.sip
Expand Up @@ -458,6 +458,13 @@ class QgsMapLayer : QObject
*/
virtual bool readSymbology( const QDomNode& node, QString& errorMessage ) = 0;

/** Read the style for the current layer from the Dom node supplied.
* @param node node that will contain the style definition for this layer.
* @param errorMessage reference to string that will be updated with any error messages
* @return true in case of success.
*/
virtual bool readStyle( const QDomNode& node, QString& errorMessage ) = 0;

/** Write the symbology for the layer into the docment provided.
* @param node the node that will have the style element added to it.
* @param doc the document that will have the QDomNode added.
Expand All @@ -466,9 +473,20 @@ class QgsMapLayer : QObject
*/
virtual bool writeSymbology( QDomNode &node, QDomDocument& doc, QString& errorMessage ) const = 0;

/** Write just the style information for the layer into the document
* @param node the node that will have the style element added to it.
* @param doc the document that will have the QDomNode added.
* @param errorMessage reference to string that will be updated with any error messages
* @return true in case of success.
*/
virtual bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const = 0;

/** Return pointer to layer's undo stack */
QUndoStack *undoStack();

/** Return pointer to layer's style undo stack */
QUndoStack *undoStackStyles();

/* Layer legendUrl information */
void setLegendUrl( const QString& legendUrl );
QString legendUrl() const;
Expand Down
15 changes: 15 additions & 0 deletions python/core/qgsvectorlayer.sip
Expand Up @@ -493,6 +493,13 @@ class QgsVectorLayer : QgsMapLayer
*/
bool readSymbology( const QDomNode& node, QString& errorMessage );

/** Read the style for the current layer from the Dom node supplied.
* @param node node that will contain the style definition for this layer.
* @param errorMessage reference to string that will be updated with any error messages
* @return true in case of success.
*/
bool readStyle( const QDomNode& node, QString& errorMessage );

/** Write the symbology for the layer into the docment provided.
* @param node the node that will have the style element added to it.
* @param doc the document that will have the QDomNode added.
Expand All @@ -501,6 +508,14 @@ class QgsVectorLayer : QgsMapLayer
*/
bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;

/** Write just the style information for the layer into the document
* @param node the node that will have the style element added to it.
* @param doc the document that will have the QDomNode added.
* @param errorMessage reference to string that will be updated with any error messages
* @return true in case of success.
*/
bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;

bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
bool readSld( const QDomNode& node, QString& errorMessage );

Expand Down
7 changes: 6 additions & 1 deletion python/core/raster/qgsrasterlayer.sip
Expand Up @@ -234,14 +234,19 @@ class QgsRasterLayer : QgsMapLayer
/** \brief Read the symbology for the current layer from the Dom node supplied */
bool readSymbology( const QDomNode& node, QString& errorMessage );

/** \brief Read the style information for the current layer from the Dom node supplied */
bool readStyle(const QDomNode &node, QString &errorMessage);

/** \brief Reads layer specific state from project file Dom node */
bool readXml( const QDomNode& layer_node );

/** \brief Write the symbology for the layer into the docment provided */
bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessage ) const;

/** \brief Write the style for the layer into the docment provided */
bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage) const;

/** \brief Write layer specific state to project file Dom node */
bool writeXml( QDomNode & layer_node, QDomDocument & doc );

};

19 changes: 19 additions & 0 deletions python/gui/symbology-ng/qgsrendererv2propertiesdialog.sip
Expand Up @@ -23,14 +23,33 @@ class QgsRendererV2PropertiesDialog : QDialog
*/
void layerVariablesChanged();

/**
* Emmited when something on the widget has changed.
* All widgets will fire this event to notify of an internal change.
*/
void widgetChanged();

public slots:
//! called when user changes renderer type
void rendererChanged();

//! Apply the changes from the dialog to the layer.
void apply();

//! Apply and accept the changes for the dialog.
void onOK();

protected:
/**
* Connect the given slot to the value changed event for the set of widgets
* Each widget is checked for type and the common type of signal is connected
* to the slot.
*
* @param widgets The list of widgets to check.
* @param slot The slot to connect to the signals.
*/
void connectValueChanged( QList<QWidget *> widgets, const char *slot );


//! Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );
Expand Down
6 changes: 6 additions & 0 deletions python/gui/symbology-ng/qgsrendererv2widget.sip
Expand Up @@ -47,6 +47,12 @@ class QgsRendererV2Widget : QWidget
*/
void layerVariablesChanged();

/**
* Emmited when something on the widget has changed.
* All widgets will fire this event to notify of an internal change.
*/
void widgetChanged();

protected:
/** Subclasses may provide the capability of changing multiple symbols at once by implementing the following two methods
and by connecting the slot contextMenuViewCategories(const QPoint&)*/
Expand Down
15 changes: 9 additions & 6 deletions src/app/qgisapp.cpp
Expand Up @@ -678,6 +678,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
mUndoWidget = new QgsUndoWidget( nullptr, mMapCanvas );
mUndoWidget->setObjectName( "Undo" );

mUndoDock = new QDockWidget( tr( "Undo/Redo Panel" ), nullptr );
mUndoDock->setWidget( mUndoWidget );

// Advanced Digitizing dock
mAdvancedDigitizingDockWidget = new QgsAdvancedDigitizingDockWidget( mMapCanvas, this );
mAdvancedDigitizingDockWidget->setObjectName( "AdvancedDigitizingTools" );
Expand Down Expand Up @@ -721,8 +724,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
// initialize the plugin manager
mPluginManager = new QgsPluginManager( this, restorePlugins );

addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget );
mUndoWidget->hide();
addDockWidget( Qt::LeftDockWidgetArea, mUndoDock );
mUndoDock->hide();

mMapStylingDock = new QDockWidget( this );
mMapStylingDock->setWindowTitle( tr( "Map Styling" ) );
Expand Down Expand Up @@ -10001,7 +10004,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionCopyStyle->setEnabled( false );
mActionPasteStyle->setEnabled( false );

mUndoWidget->dockContents()->setEnabled( false );
mUndoDock->widget()->setEnabled( false );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
mActionSimplifyFeature->setEnabled( false );
Expand Down Expand Up @@ -10103,7 +10106,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionToggleEditing->setEnabled( canSupportEditing && !vlayer->readOnly() );
mActionToggleEditing->setChecked( canSupportEditing && isEditable );
mActionSaveLayerEdits->setEnabled( canSupportEditing && isEditable && vlayer->isModified() );
mUndoWidget->dockContents()->setEnabled( canSupportEditing && isEditable );
mUndoDock->widget()->setEnabled( canSupportEditing && isEditable );
mActionUndo->setEnabled( canSupportEditing );
mActionRedo->setEnabled( canSupportEditing );

Expand Down Expand Up @@ -10209,7 +10212,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
}
else
{
mUndoWidget->dockContents()->setEnabled( false );
mUndoDock->widget()->setEnabled( false );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
}
Expand Down Expand Up @@ -10262,7 +10265,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionToggleEditing->setEnabled( false );
mActionToggleEditing->setChecked( false );
mActionSaveLayerEdits->setEnabled( false );
mUndoWidget->dockContents()->setEnabled( false );
mUndoDock->widget()->setEnabled( false );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
mActionSaveLayerDefinition->setEnabled( true );
Expand Down
1 change: 1 addition & 0 deletions src/app/qgisapp.h
Expand Up @@ -1687,6 +1687,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
static QgisApp *smInstance;

QgsUndoWidget *mUndoWidget;
QDockWidget *mUndoDock;

QgsBrowserDockWidget *mBrowserWidget;
QgsBrowserDockWidget *mBrowserWidget2;
Expand Down

0 comments on commit ca914f1

Please sign in to comment.