Kstars

indielement.h
1/*
2 SPDX-FileCopyrightText: 2003 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5
6 2004-01-15 INDI element is the most basic unit of the INDI KStars client.
7*/
8
9#pragma once
10
11#include "indicommon.h"
12
13#include <indiproperty.h>
14
15#include <QDialog>
16#include <QHBoxLayout>
17
18/* Forward declaration */
19class QLineEdit;
20class QDoubleSpinBox;
21class QPushButton;
22
23class QHBoxLayout;
24class QSpacerItem;
25class QCheckBox;
26class QButtonGroup;
27class QSlider;
28
29class KLed;
31
32class INDI_P;
33
34/**
35 * @class INDI_E
36 * INDI_E represents an INDI GUI element (Number, Text, Switch, Light, or BLOB) within an INDI property.
37 * It is the most basic GUI representation of property elements.
38 *
39 * @author Jasem Mutlaq
40 */
41class INDI_E : public QWidget
42{
44 public:
45 INDI_E(INDI_P *gProp, INDI::Property dProp);
46
47 const QString &getLabel()
48 {
49 return label;
50 }
51 const QString &getName()
52 {
53 return name;
54 }
55
56 QString getWriteField();
57 QString getReadField();
58
59 void buildSwitch(QButtonGroup *groupB, ISwitch *sw);
60 void buildMenuItem(ISwitch *sw);
61 void buildText(IText *itp);
62 void buildNumber(INumber *inp);
63 void buildLight(ILight *ilp);
64 void buildBLOB(IBLOB *ibp);
65
66 // Updates GUI from data in INDI properties
67 void syncSwitch();
68 void syncText();
69 void syncNumber();
70 void syncLight();
71
72 // Save GUI data in INDI properties
73 void updateTP();
74 void updateNP();
75
76 void setText(const QString &newText);
77 void setValue(double value);
78
79 void setMin();
80 void setMax();
81
82 void setupElementLabel();
83 void setupElementRead(int length);
84 void setupElementWrite(int length);
85 void setupElementScale(int length);
86 void setupBrowseButton();
87
88 bool getBLOBDirty()
89 {
90 return blobDirty;
91 }
92 void setBLOBDirty(bool isDirty)
93 {
94 blobDirty = isDirty;
95 }
96
97 public slots:
98 void spinChanged(double value);
99 void sliderChanged(int value);
100 void browseBlob();
101
102 private:
103 /// Name
104 QString name;
105 /// Label is the name by default, unless specified
106 QString label;
107 /// Parent GUI property
108 INDI_P *guiProp { nullptr };
109 /// Parent DATA property
110 INDI::Property dataProp;
111 /// Horizontal layout
112 QHBoxLayout *EHBox { nullptr };
113 /// Label widget
114 KSqueezedTextLabel *label_w { nullptr };
115 /// Read field widget
116 QLineEdit *read_w { nullptr };
117 /// Write field widget
118 QLineEdit *write_w { nullptr };
119 /// Light led widget
120 KLed *led_w { nullptr };
121 /// Spinbox widget
122 QDoubleSpinBox *spin_w { nullptr };
123 /// Slider widget
124 QSlider *slider_w { nullptr };
125 /// Push button widget
126 QPushButton *push_w { nullptr };
127 /// Browse button widget
128 QPushButton *browse_w { nullptr };
129 /// Check box widget
130 QCheckBox *check_w { nullptr };
131 /// Horizontal spacer widget
132 QSpacerItem *hSpacer { nullptr };
133
134 ISwitch *sp { nullptr };
135 INumber *np { nullptr };
136 IText *tp { nullptr };
137 ILight *lp { nullptr };
138 IBLOB *bp { nullptr };
139
140 bool blobDirty { false };
141 /// Current text
142 QString text;
143};
INDI_E represents an INDI GUI element (Number, Text, Switch, Light, or BLOB) within an INDI property.
Definition indielement.h:42
INDI_P represents a single INDI property (Switch, Text, Number, Light, or BLOB).
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.