Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Review fixes
  • Loading branch information
nyalldawson committed Jul 16, 2018
1 parent 8f2c01d commit 8b77d9e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/app/layout/qgsreportsectionmodel.cpp
Expand Up @@ -2,7 +2,7 @@
qgsreportsectionmodel.cpp
---------------------
begin : December 2017
copyright : (C) 2017 by Nyall Dawso
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
Expand Down
17 changes: 12 additions & 5 deletions src/gui/processing/qgsprocessingtoolboxmodel.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
QgsProcessingToolboxModel.cpp
qgsprocessingtoolboxmodel.cpp
-------------------------------
begin : May 2018
copyright : (C) 2018 by Nyall Dawson
Expand Down Expand Up @@ -75,15 +75,19 @@ void QgsProcessingToolboxModelNode::deleteChildren()
//

QgsProcessingToolboxModelProviderNode::QgsProcessingToolboxModelProviderNode( QgsProcessingProvider *provider )
: mProviderId( provider->id() )
, mProvider( provider )
: mProvider( provider )
{}

QgsProcessingProvider *QgsProcessingToolboxModelProviderNode::provider()
{
return mProvider;
}

QString QgsProcessingToolboxModelProviderNode::providerId() const
{
return mProvider ? mProvider->id() : QString();
}

//
// QgsProcessingToolboxModelGroupNode
//
Expand Down Expand Up @@ -227,8 +231,8 @@ void QgsProcessingToolboxModel::providerAdded( const QString &id )
}
else
{
//native providers use top level groups - that's too hard for us to
//work out exactly what's going to change, so just reset the model
// native providers use top level groups - that's too hard for us to
// work out exactly what's going to change, so just reset the model
beginResetModel();
addProvider( provider );
endResetModel();
Expand Down Expand Up @@ -283,6 +287,9 @@ QModelIndex QgsProcessingToolboxModel::node2index( QgsProcessingToolboxModelNode

void QgsProcessingToolboxModel::addProvider( QgsProcessingProvider *provider )
{
if ( !provider )
return;

connect( provider, &QgsProcessingProvider::algorithmsLoaded, this, &QgsProcessingToolboxModel::rebuild, Qt::UniqueConnection );

QgsProcessingToolboxModelNode *parentNode = nullptr;
Expand Down
27 changes: 13 additions & 14 deletions src/gui/processing/qgsprocessingtoolboxmodel.h
@@ -1,6 +1,6 @@
/***************************************************************************
qgsprocessingalgorithmmodel.h
-----------------------------
qgsprocessingtoolboxmodel.h
---------------------------
begin : May 2018
copyright : (C) 2018 by Nyall Dawson
email : nyall dot dawson at gmail dot com
Expand All @@ -13,8 +13,8 @@
* *
***************************************************************************/

#ifndef QGSPROCESSINGALGORITHMMODEL_H
#define QGSPROCESSINGALGORITHMMODEL_H
#ifndef QGSPROCESSINGTOOLBOXMODEL_H
#define QGSPROCESSINGTOOLBOXMODEL_H

#include "qgis.h"
#include "qgis_gui.h"
Expand All @@ -31,7 +31,7 @@ class QgsProcessingRecentAlgorithmLog;
///@cond PRIVATE

/**
* Abstract base class for nodes contained within a QgsProcessingToolboxModel.
* \brief Abstract base class for nodes contained within a QgsProcessingToolboxModel.
* \warning Not part of stable API and may change in future QGIS releases.
* \ingroup gui
* \since QGIS 3.4
Expand Down Expand Up @@ -127,7 +127,7 @@ class GUI_EXPORT QgsProcessingToolboxModelNode : public QObject
};

/**
* Processing toolbox model node corresponding to the recent algorithms group
* \brief Processing toolbox model node corresponding to the recent algorithms group
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
Expand All @@ -148,7 +148,7 @@ class GUI_EXPORT QgsProcessingToolboxModelRecentNode : public QgsProcessingToolb
};

/**
* Processing toolbox model node corresponding to a Processing provider.
* \brief Processing toolbox model node corresponding to a Processing provider.
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
Expand All @@ -175,17 +175,16 @@ class GUI_EXPORT QgsProcessingToolboxModelProviderNode : public QgsProcessingToo
/**
* Returns the provider ID.
*/
QString providerId() const { return mProviderId; }
QString providerId() const;

private:

QString mProviderId;
QgsProcessingProvider *mProvider = nullptr;

};

/**
* Processing toolbox model node corresponding to a group of algorithms.
* \brief Processing toolbox model node corresponding to a group of algorithms.
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
Expand Down Expand Up @@ -224,7 +223,7 @@ class GUI_EXPORT QgsProcessingToolboxModelGroupNode : public QgsProcessingToolbo
};

/**
* Processing toolbox model node corresponding to an algorithm.
* \brief Processing toolbox model node corresponding to an algorithm.
* \ingroup gui
* \warning Not part of stable API and may change in future QGIS releases.
* \since QGIS 3.4
Expand Down Expand Up @@ -257,7 +256,7 @@ class GUI_EXPORT QgsProcessingToolboxModelAlgorithmNode : public QgsProcessingTo
///@endcond

/**
* A model for providers and algorithms shown within the Processing toolbox.
* \brief A model for providers and algorithms shown within the Processing toolbox.
*
* See QgsProcessingToolboxProxyModel for a sorted, filterable version
* of this model.
Expand Down Expand Up @@ -400,7 +399,7 @@ class GUI_EXPORT QgsProcessingToolboxModel : public QAbstractItemModel


/**
* A sort/filter proxy model for providers and algorithms shown within the Processing toolbox,
* \brief A sort/filter proxy model for providers and algorithms shown within the Processing toolbox,
* which automatically sorts the toolbox in a logical fashion and supports filtering
* the results.
*
Expand Down Expand Up @@ -483,4 +482,4 @@ class GUI_EXPORT QgsProcessingToolboxProxyModel: public QSortFilterProxyModel
};


#endif // QGSPROCESSINGALGORITHMMODEL_H
#endif // QGSPROCESSINGTOOLBOXMODEL_H
8 changes: 4 additions & 4 deletions tests/src/gui/testqgsprocessingmodel.cpp
@@ -1,8 +1,8 @@
/***************************************************************************
testqgsprocessing.cpp
---------------------
begin : January 2017
copyright : (C) 2017 by Nyall Dawson
testqgsprocessingmodel.cpp
--------------------------
begin : July 2018
copyright : (C) 2018 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/

Expand Down

0 comments on commit 8b77d9e

Please sign in to comment.