1 /*
2     SPDX-FileCopyrightText: 2003 Jasem Mutlaq <mutlaqja@ikarustech.com>
3 
4     SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <indiproperty.h>
10 
11 #include <QString>
12 #include <QList>
13 #include <QScrollArea>
14 #include <QPointer>
15 
16 class INDI_P;
17 class INDI_D;
18 
19 class QFrame;
20 class QVBoxLayout;
21 class QSpacerItem;
22 class QScrollArea;
23 
24 /**
25  * @class INDI_G
26  * INDI_G represents a collection of INDI properties that share a common group. The group is usually represented in the GUI as a separate tab with the device tab.
27  *
28  * @author Jasem Mutlaq
29  */
30 class INDI_G: public QScrollArea
31 {
32     public:
33         INDI_G(INDI_D *idv, const QString &inName);
34 
35         bool addProperty(const INDI::Property newProperty);
36 
37         bool removeProperty(const QString &name);
38         INDI_P *getProperty(const QString &name) const;
getContainer()39         QFrame *getContainer() const
40         {
41             return m_PropertiesContainer;
42         }
getName()43         const QString &getName() const
44         {
45             return name;
46         }
47 
getDevice()48         INDI_D *getDevice() const
49         {
50             return dp;
51         }
52 
getProperties()53         QList<INDI_P *> getProperties() const
54         {
55             return m_PropertiesList;
56         }
57 
size()58         int size() const
59         {
60             return m_PropertiesList.count();
61         }
62 
63     private:
64         // Group name
65         QString name;
66         // Parent device
67         INDI_D *dp {nullptr};
68         // Properties container
69         QPointer<QFrame> m_PropertiesContainer;
70         // Properties layout
71         QPointer<QVBoxLayout> m_PropertiesLayout;
72         // Vertical spacer
73         QSpacerItem *m_VerticalSpacer {nullptr};
74         QList<INDI_P *> m_PropertiesList;
75         bool m_Dirty { false };
76 };
77