Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/observatory/observatory.h
- This file was added.
1 | /* Ekos Observatory Module | ||||
---|---|---|---|---|---|
2 | Copyright (C) Wolfgang Reissenberger <sterne-jaeger@t-online.de> | ||||
3 | | ||||
4 | This application is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2 of the License, or (at your option) any later version. | ||||
8 | */ | ||||
9 | | ||||
10 | #pragma once | ||||
11 | | ||||
12 | #include "ui_observatory.h" | ||||
13 | #include "observatorymodel.h" | ||||
14 | #include "observatorydomemodel.h" | ||||
15 | #include "observatoryweathermodel.h" | ||||
16 | #include "indiweather.h" | ||||
17 | | ||||
18 | #include <QWidget> | ||||
19 | #include <QObject> | ||||
20 | #include "klocalizedstring.h" | ||||
21 | | ||||
22 | | ||||
23 | namespace Ekos | ||||
24 | { | ||||
25 | | ||||
26 | class Observatory : public QWidget, public Ui::Observatory | ||||
27 | { | ||||
28 | Q_OBJECT | ||||
29 | Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Observatory") | ||||
30 | Q_PROPERTY(QStringList logText READ logText NOTIFY newLog) | ||||
31 | | ||||
32 | public: | ||||
33 | Observatory(); | ||||
34 | ObservatoryDomeModel *getDomeModel() { return mObservatoryModel->getDomeModel(); } | ||||
35 | ObservatoryWeatherModel *getWeatherModel() { return mObservatoryModel->getWeatherModel(); } | ||||
36 | | ||||
37 | // Logging | ||||
38 | QStringList logText() { return m_LogText; } | ||||
39 | QString getLogText() { return m_LogText.join("\n"); } | ||||
40 | | ||||
41 | signals: | ||||
42 | Q_SCRIPTABLE void newLog(const QString &text); | ||||
43 | | ||||
44 | /** | ||||
45 | * @brief Signal a new observatory status | ||||
46 | */ | ||||
47 | Q_SCRIPTABLE void newStatus(bool isReady); | ||||
48 | | ||||
49 | private: | ||||
50 | ObservatoryModel *mObservatoryModel = nullptr; | ||||
51 | | ||||
52 | void setDomeModel(ObservatoryDomeModel *model); | ||||
53 | void setWeatherModel(ObservatoryWeatherModel *model); | ||||
54 | | ||||
55 | // Logging | ||||
56 | QStringList m_LogText; | ||||
57 | void appendLogText(const QString &); | ||||
58 | void clearLog(); | ||||
59 | | ||||
60 | // timer for refreshing the observatory status | ||||
61 | QTimer weatherStatusTimer; | ||||
62 | | ||||
63 | // reacting on weather changes | ||||
64 | void setWarningActions(WeatherActions actions); | ||||
65 | void setAlertActions(WeatherActions actions); | ||||
66 | | ||||
67 | private slots: | ||||
68 | // observatory status handling | ||||
69 | void setObseratoryStatusControl(ObservatoryStatusControl control); | ||||
70 | void statusControlSettingsChanged(); | ||||
71 | | ||||
72 | void initWeather(); | ||||
73 | void shutdownWeather(); | ||||
74 | void setWeatherStatus(ISD::Weather::Status status); | ||||
75 | | ||||
76 | | ||||
77 | // reacting on weather changes | ||||
78 | void weatherWarningSettingsChanged(); | ||||
79 | void weatherAlertSettingsChanged(); | ||||
80 | | ||||
81 | // reacting on observatory status changes | ||||
82 | void observatoryStatusChanged(bool ready); | ||||
83 | | ||||
84 | void initDome(); | ||||
85 | void shutdownDome(); | ||||
86 | | ||||
87 | void setDomeStatus(ISD::Dome::Status status); | ||||
88 | void setShutterStatus(ISD::Dome::ShutterStatus status); | ||||
89 | }; | ||||
90 | } |