1 /***************************************************************************
2   qgslayertreeviewembeddedindicator.h
3   --------------------------------------
4   Date                 : June 2018
5   Copyright            : (C) 2018 by Nyall Dawson
6   Email                : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  *                                                                         *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15 
16 #ifndef QGSLAYERTREEVIEWEMBEDDEDINDICATOR_H
17 #define QGSLAYERTREEVIEWEMBEDDEDINDICATOR_H
18 
19 #include "qgslayertreeviewindicator.h"
20 
21 #include <QSet>
22 #include <memory>
23 
24 class QgsLayerTreeNode;
25 class QgsLayerTreeView;
26 
27 //! Adds indicators showing whether layers are embedded.
28 class QgsLayerTreeViewEmbeddedIndicatorProvider : public QObject
29 {
30     Q_OBJECT
31   public:
32     explicit QgsLayerTreeViewEmbeddedIndicatorProvider( QgsLayerTreeView *view );
33 
34   private slots:
35     //! Connects to signals of layers newly added to the tree
36     void onAddedChildren( QgsLayerTreeNode *node, int indexFrom, int indexTo );
37 
38   private:
39     std::unique_ptr< QgsLayerTreeViewIndicator > newIndicator( const QString &project );
40     void addIndicatorForEmbeddedLayer( QgsLayerTreeNode *node );
41 
42   private:
43     QgsLayerTreeView *mLayerTreeView = nullptr;
44     QIcon mIcon;
45     QSet<QgsLayerTreeViewIndicator *> mIndicators;
46 };
47 
48 #endif // QGSLAYERTREEVIEWEMBEDDEDINDICATOR_H
49