9#include "ui_observatory.h"
11#include "indi/indidome.h"
12#include "indi/indiweather.h"
16#include <KLocalizedString>
21struct ObservatoryStatusControl
23 bool useDome, useShutter, useWeather;
28 bool parkDome, closeShutter, stopScheduler;
33class Observatory :
public QWidget,
public Ui::Observatory
36 Q_CLASSINFO(
"D-Bus Interface",
"org.kde.kstars.Ekos.Observatory")
37 Q_PROPERTY(QStringList logText READ logText NOTIFY newLog)
38 Q_PROPERTY(ISD::Weather::Status status READ status NOTIFY newStatus)
43 bool setDome(ISD::Dome *device);
44 bool addWeatherSource(ISD::Weather *device);
46 ISD::Weather::Status status()
48 return m_WeatherStatus;
58 return m_LogText.join(
"\n");
67 ObservatoryStatusControl statusControl()
69 return m_StatusControl;
71 void setStatusControl(ObservatoryStatusControl control);
72 void removeDevice(
const QSharedPointer<ISD::GenericDevice> &deviceRemoved);
73 void setWeatherSource(
const QString &name);
77 Q_SCRIPTABLE
void newLog(
const QString &text);
78 Q_SCRIPTABLE
void newWeatherData(
const QJsonArray &data);
79 Q_SCRIPTABLE
void newStatus(ISD::Weather::Status status);
83 void enableMotionControl(
bool enabled);
86 void enableAutoSync(
bool enabled);
87 void showAutoSync(
bool enabled);
90 QStringList m_LogText;
91 void appendLogText(
const QString &);
94 QTimer weatherStatusTimer;
97 void setWarningActions(WeatherActions
actions);
98 void setAlertActions(WeatherActions
actions);
101 void toggleButtons(QPushButton *buttonPressed, QString titlePressed, QPushButton *buttonCounterpart,
102 QString titleCounterpart);
103 void activateButton(QPushButton *button, QString title);
104 void buttonPressed(QPushButton *button, QString title);
107 QGridLayout* sensorDataBoxLayout;
109 std::map<QString, QPair<QAbstractButton*, QLineEdit*>*> sensorDataWidgets = {};
111 std::map<QString, QVector<QCPGraphData>*> sensorGraphData = {};
114 std::map<QString, int> sensorRanges = {};
117 QString selectedSensorID;
120 QButtonGroup *sensorDataNamesGroup {
nullptr};
122 ISD::Weather::Status m_WeatherStatus { ISD::Weather::WEATHER_IDLE };
125 void initWeatherActions(
bool enabled);
127 void initSensorGraphs();
128 void updateSensorData(
const QJsonArray &data);
129 void updateSensorGraph(
const QString &sensor_label, QDateTime now,
double value);
132 QJsonArray m_WeatherData;
137 void setWarningActionsActive(
bool active);
141 void setAlertActionsActive(
bool active);
146 bool autoScaleValues()
148 return m_autoScaleValues;
150 void setAutoScaleValues(
bool show);
155 void statusControlSettingsChanged();
158 void enableWeather(
bool enable);
159 void clearSensorDataHistory();
160 void shutdownWeather();
161 void setWeatherStatus(ISD::Weather::Status status);
164 void mouseOverLine(QMouseEvent *
event);
165 void refreshSensorGraph();
167 void execute(WeatherActions
actions);
170 void weatherWarningSettingsChanged();
171 void weatherAlertSettingsChanged();
174 void selectedSensorChanged(QString
id);
177 void observatoryStatusChanged(
bool ready);
178 void domeAzimuthChanged(
double position);
182 void setDomeStatus(ISD::Dome::Status status);
183 void setDomeParkStatus(ISD::ParkStatus status);
184 void setShutterStatus(ISD::Dome::ShutterStatus status);
189 WeatherActions getWarningActions()
191 return m_WarningActions;
193 QString getWarningActionsStatus();
194 bool getWarningActionsActive()
196 return warningActionsActive;
202 WeatherActions getAlertActions()
204 return m_AlertActions;
206 QString getAlertActionsStatus();
207 bool getAlertActionsActive()
209 return alertActionsActive;
213 ISD::Dome *m_Dome {
nullptr};
214 ISD::Weather *m_WeatherSource {
nullptr};
215 QList<ISD::Weather *> m_WeatherSources;
217 ObservatoryStatusControl m_StatusControl;
219 QTimer warningTimer, alertTimer;
220 struct WeatherActions m_WarningActions, m_AlertActions;
221 bool warningActionsActive, alertActionsActive, m_autoScaleValues;
222 void startAlertTimer();
223 void startWarningTimer();
Ekos is an advanced Astrophotography tool for Linux.
virtual bool event(QEvent *e)