Kstars

indiproperty.h
1/*
2 SPDX-FileCopyrightText: 2003 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5
6
7*/
8
9#pragma once
10
11#include "indicommon.h"
12#include <indiproperty.h>
13
14#include <QWidget>
15
16#include <memory>
17
18namespace INDI
19{
20class Property;
21}
22
23class INDI_G;
24class INDI_E;
25
26class QAbstractButton;
27class QButtonGroup;
28class QCheckBox;
29class QComboBox;
30class QHBoxLayout;
31class QPushButton;
32class QSpacerItem;
33class QVBoxLayout;
34
35class KLed;
37
38/**
39 * @class INDI_P
40 * INDI_P represents a single INDI property (Switch, Text, Number, Light, or BLOB). It handles building the GUI and updating the property status and/or value as new data
41 * arrive from INDI Serve. It also sends any changes in the property value back to INDI server via the ClientManager.
42 *
43 * @author Jasem Mutlaq
44 */
45class INDI_P : public QWidget
46{
48 public:
49 INDI_P(INDI_G *ipg, INDI::Property prop);
50
51 /* Draw state LED */
52 void updateStateLED();
53
54 /* Update menu gui */
55 void updateMenuGUI();
56
57 void initGUI();
58
59 void buildSwitchGUI();
60 void buildMenuGUI();
61 void buildTextGUI();
62 void buildNumberGUI();
63 void buildLightGUI();
64 void buildBLOBGUI();
65
66 /** Setup the 'set' button in the property */
67 void setupSetButton(const QString &caption);
68
69 /**
70 * @brief newTime Display dialog to set UTC date and time to the driver.
71 */
72 void newTime();
73
74 PGui getGUIType() const
75 {
76 return guiType;
77 }
78
79 INDI_G *getGroup() const
80 {
81 return pg;
82 }
83
84 const QString &getName() const
85 {
86 return name;
87 }
88
89 void addWidget(QWidget *w);
90 void addLayout(QHBoxLayout *layout);
91
92 INDI_E *getElement(const QString &elementName) const;
93
94 QList<INDI_E *> getElements() const
95 {
96 return elementList;
97 }
98 bool isRegistered() const;
99 const INDI::Property getProperty() const
100 {
101 return dataProp;
102 }
103
104 public slots:
105 void processSetButton();
106 void newSwitch(QAbstractButton *button);
107 void newSwitch(int index);
108 void newSwitch(const QString &name);
109 void resetSwitch();
110
111 void sendBlob();
112 void sendSwitch();
113 void sendText();
114
115 void setBLOBOption(int state);
116
117 private:
118 /// Parent group
119 INDI_G *pg { nullptr };
120 INDI::Property dataProp;
121 QCheckBox *enableBLOBC { nullptr };
122 /// Label widget
123 KSqueezedTextLabel* labelW { nullptr };
124 /// Set button
125 QPushButton* setB { nullptr };
126 /// Status LED
127 KLed* ledStatus { nullptr };
128 /// GUI type
129 PGui guiType;
130 /// Horizontal spacer
131 QSpacerItem *horSpacer { nullptr };
132 /// Horizontal container
133 QHBoxLayout *PHBox { nullptr };
134 /// Vertical container
135 QVBoxLayout *PVBox { nullptr };
136 /// Group button for radio and check boxes (Elements)
137 QButtonGroup *groupB { nullptr };
138 /// Combo box for menu
139 QComboBox* menuC { nullptr };
140 QString name;
141 /// List of elements
142 QList<INDI_E *> elementList;
143};
INDI_E represents an INDI GUI element (Number, Text, Switch, Light, or BLOB) within an INDI property.
Definition indielement.h:42
INDI_G represents a collection of INDI properties that share a common group.
Definition indigroup.h:31
INDI_P represents a single INDI property (Switch, Text, Number, Light, or BLOB).
void newTime()
newTime Display dialog to set UTC date and time to the driver.
void setupSetButton(const QString &caption)
Setup the 'set' button in the property.
Q_OBJECTQ_OBJECT
QLayout * layout() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.