Kstars

scriptbuilder.h
1/*
2 SPDX-FileCopyrightText: 2003 Jason Harris <kstars@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "scriptargwidgets.h"
10#include "ui_scriptbuilder.h"
11#include "ui_scriptnamedialog.h"
12#include "ui_optionstreeview.h"
13
14#include <QDialog>
15#include <QUrl>
16
17#include <memory>
18
19class QTreeWidget;
20class QTreeWidgetItem;
21class QTextStream;
22
23class ScriptFunction;
24
25class OptionsTreeViewWidget : public QFrame, public Ui::OptionsTreeView
26{
28 public:
29 explicit OptionsTreeViewWidget(QWidget *p);
30};
31
32class OptionsTreeView : public QDialog
33{
35 public:
36 explicit OptionsTreeView(QWidget *p);
37 virtual ~OptionsTreeView() override = default;
38
39 QTreeWidget *optionsList()
40 {
41 return otvw->OptionsList;
42 }
43 void resizeColumns();
44
45 private:
46 std::unique_ptr<OptionsTreeViewWidget> otvw;
47};
48
49class ScriptNameWidget : public QFrame, public Ui::ScriptNameDialog
50{
52 public:
53 explicit ScriptNameWidget(QWidget *p);
54};
55
56class ScriptNameDialog : public QDialog
57{
59 public:
60 explicit ScriptNameDialog(QWidget *p);
61 ~ScriptNameDialog() override;
62 QString scriptName() const
63 {
64 return snw->ScriptName->text();
65 }
66 QString authorName() const
67 {
68 return snw->AuthorName->text();
69 }
70
71 private slots:
72 void slotEnableOkButton();
73
74 private:
75 ScriptNameWidget *snw { nullptr };
76 QPushButton *okB { nullptr };
77};
78
79class ScriptBuilderUI : public QFrame, public Ui::ScriptBuilder
80{
82 public:
83 explicit ScriptBuilderUI(QWidget *p);
84};
85
86/**
87 * @class ScriptBuilder
88 * A GUI tool for building behavioral DBus scripts for KStars.
89 *
90 * @author Jason Harris
91 * @version 1.0
92 */
93class ScriptBuilder : public QDialog
94{
96 public:
97 explicit ScriptBuilder(QWidget *parent);
98 ~ScriptBuilder() override;
99
100 bool unsavedChanges() const
101 {
102 return UnsavedChanges;
103 }
104 void setUnsavedChanges(bool b = true);
105 void saveWarning();
106 void readScript(QTextStream &istream);
107 void writeScript(QTextStream &ostream);
108 bool parseFunction(const QString &fn_name, const QString &fn_args);
109
110 public slots:
111 void slotAddFunction();
112 void slotMoveFunctionUp();
113 void slotMoveFunctionDown();
114 void slotArgWidget();
115 void slotShowDoc();
116
117 void slotNew();
118 void slotOpen();
119 void slotSave();
120 void slotSaveAs();
121 void slotRunScript();
122 void slotClose();
123
124 void slotCopyFunction();
125 void slotRemoveFunction();
126
127 void slotFindCity();
128 void slotFindObject();
129 void slotShowOptions();
130 void slotLookToward();
131 void slotArgFindObject();
132 void slotRa();
133 void slotDec();
134 void slotAz();
135 void slotAlt();
136 void slotChangeDate();
137 void slotChangeTime();
138 void slotWaitFor();
139 void slotWaitForKey();
140 void slotTracking();
141 void slotViewOption();
142 void slotChangeCity();
143 void slotChangeProvince();
144 void slotChangeCountry();
145 void slotTimeScale();
146 void slotZoom();
147 void slotExportImage();
148 void slotPrintImage();
149 void slotChangeColor();
150 void slotChangeColorName();
151 void slotLoadColorScheme();
152
153#if 0
154 void slotINDIWaitCheck(bool toggleState);
155 void slotINDIFindObject();
156 void slotINDIStartDeviceName();
157 void slotINDIStartDeviceMode();
158 void slotINDISetDevice();
159 void slotINDIShutdown();
160 void slotINDISwitchDeviceConnection();
161 void slotINDISetPortDevicePort();
162 void slotINDISetTargetCoordDeviceRA();
163 void slotINDISetTargetCoordDeviceDEC();
164 void slotINDISetTargetNameTargetName();
165 void slotINDISetActionName();
166 void slotINDIWaitForActionName();
167 void slotINDISetFocusSpeed();
168 void slotINDIStartFocusDirection();
169 void slotINDISetFocusTimeout();
170 void slotINDISetGeoLocationDeviceLong();
171 void slotINDISetGeoLocationDeviceLat();
172 void slotINDIStartExposureTimeout();
173 void slotINDISetUTC();
174 void slotINDISetScopeAction();
175 void slotINDISetFrameType();
176 void slotINDISetCCDTemp();
177 void slotINDISetFilterNum();
178#endif
179
180 private:
181 void initViewOptions();
182 void warningMismatch(const QString &expected) const;
183
184 ScriptBuilderUI *sb { nullptr };
185
186 QList<ScriptFunction *> KStarsFunctionList;
187 QList<ScriptFunction *> SimClockFunctionList;
188
189#if 0
190 QList<ScriptFunction *> INDIFunctionList;
191#endif
192
193 QList<ScriptFunction *> ScriptList;
194
195 QWidget *argBlank { nullptr };
196 ArgLookToward *argLookToward { nullptr };
197 ArgFindObject *argFindObject { nullptr };
198 ArgSetRaDec *argSetRaDec { nullptr };
199 ArgSetAltAz *argSetAltAz { nullptr };
200 ArgSetLocalTime *argSetLocalTime { nullptr };
201 ArgWaitFor *argWaitFor { nullptr };
202 ArgWaitForKey *argWaitForKey { nullptr };
203 ArgSetTrack *argSetTracking { nullptr };
204 ArgChangeViewOption *argChangeViewOption { nullptr };
205 ArgSetGeoLocation *argSetGeoLocation { nullptr };
206 ArgTimeScale *argTimeScale { nullptr };
207 ArgZoom *argZoom { nullptr };
208 ArgExportImage *argExportImage { nullptr };
209 ArgPrintImage *argPrintImage { nullptr };
210 ArgSetColor *argSetColor { nullptr };
211 ArgLoadColorScheme *argLoadColorScheme { nullptr };
212
213#if 0
214 ArgStartINDI * argStartINDI;
215 ArgSetDeviceINDI * argSetDeviceINDI;
216 ArgShutdownINDI * argShutdownINDI;
217 ArgSwitchINDI * argSwitchINDI;
218 ArgSetPortINDI * argSetPortINDI;
219 ArgSetTargetCoordINDI * argSetTargetCoordINDI;
220 ArgSetTargetNameINDI * argSetTargetNameINDI;
221 ArgSetActionINDI * argSetActionINDI;
222 ArgSetActionINDI * argWaitForActionINDI;
223 ArgSetFocusSpeedINDI * argSetFocusSpeedINDI;
224 ArgStartFocusINDI * argStartFocusINDI;
225 ArgSetFocusTimeoutINDI * argSetFocusTimeoutINDI;
226 ArgSetGeoLocationINDI * argSetGeoLocationINDI;
227 ArgStartExposureINDI * argStartExposureINDI;
228 ArgSetUTCINDI * argSetUTCINDI;
229 ArgSetScopeActionINDI * argSetScopeActionINDI;
230 ArgSetFrameTypeINDI * argSetFrameTypeINDI;
231 ArgSetCCDTempINDI * argSetCCDTempINDI;
232 ArgSetFilterNumINDI * argSetFilterNumINDI;
233#endif
234
235 ScriptNameDialog *snd { nullptr };
236 OptionsTreeView *otv { nullptr };
237
238 QTreeWidgetItem *opsGUI { nullptr };
239 QTreeWidgetItem *opsToolbar { nullptr };
240 QTreeWidgetItem *opsShowObj { nullptr };
241 QTreeWidgetItem *opsShowOther { nullptr };
242 QTreeWidgetItem *opsCName { nullptr };
243 QTreeWidgetItem *opsHide { nullptr };
244 QTreeWidgetItem *opsSkymap { nullptr };
245 QTreeWidgetItem *opsLimit { nullptr };
246
247 bool UnsavedChanges { false };
248 bool checkForChanges { false };
249 QUrl currentFileURL;
250 QString currentDir;
251 QString currentScriptName, currentAuthor;
252};
A GUI tool for building behavioral DBus scripts for KStars.
Jason Harris.
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.