9#include "ui_opticaltrains.h"
11#include <indi/indifilterwheel.h>
12#include <indi/indifocuser.h>
15#include <QSqlDatabase>
21class NotEditableDelegate;
30class OpticalTrainManager :
public QDialog,
public Ui::OpticalTrain
33 Q_PROPERTY(QStringList trainNames READ getTrainNames)
37 static OpticalTrainManager *Instance();
38 static void release();
58 void setProfile(
const QSharedPointer<ProfileInfo> &profile);
59 void checkOpticalTrains();
61 bool exists(uint8_t
id)
const;
62 const QVariantMap getOpticalTrain(uint8_t
id)
const;
63 const QVariantMap getOpticalTrain(
const QString &name)
const;
64 const QList<QVariantMap> &getOpticalTrains()
const
66 return m_OpticalTrains;
68 const QStringList &getTrainNames()
const
73 void addOpticalTrain(
const QJsonObject &value);
81 bool selectOpticalTrain(QListWidgetItem *item);
89 QString findTrainContainingDevice(
const QString &name, Role role);
97 bool selectOpticalTrain(
const QString &name);
103 void openEditor(
const QString &name);
112 bool setOpticalTrainValue(
const QString &name,
const QString &field,
const QVariant &value);
118 void renameCurrentOpticalTrain(
const QString &name);
125 bool setOpticalTrain(
const QJsonObject &train);
132 bool removeOpticalTrain(
const QString &name);
135 void refreshTrains();
136 void refreshOpticalElements();
146 void syncActiveDevices();
155 bool getGenericDevice(
const QString &train, Role role, QSharedPointer<ISD::GenericDevice> &generic);
162 void syncActiveProperties(
const QVariantMap &train,
const QSharedPointer<ISD::GenericDevice> &device);
169 int id(
const QString &name)
const;
176 QString name(
int id)
const;
178 ISD::Mount *getMount(
const QString &name);
179 ISD::DustCap *getDustCap(
const QString &name);
180 ISD::LightBox *getLightBox(
const QString &name);
181 QJsonObject getScope(
const QString &name);
182 double getReducer(
const QString &name);
183 ISD::Rotator *getRotator(
const QString &name);
184 ISD::Focuser *getFocuser(
const QString &name);
185 ISD::FilterWheel *getFilterWheel(
const QString &name);
186 ISD::Camera *getCamera(
const QString &name);
187 ISD::Guider *getGuider(
const QString &name);
188 ISD::AdaptiveOptics *getAdaptiveOptics(
const QString &name);
192 void configurationRequested(
bool show);
196 QStringList getMissingDevices()
const;
204 void updateOpticalTrainValue(QComboBox *cb,
const QString &element);
210 void updateOpticalTrainValue(
double value,
const QString &element);
214 OpticalTrainManager();
215 static OpticalTrainManager *m_Instance;
221 void generateOpticalTrains();
229 QString addOpticalTrain(uint8_t index,
const QString &name);
231 void checkMissingDevices();
237 bool syncDelegatesToDevices();
244 QString uniqueTrainName(QString name);
246 QSharedPointer<ProfileInfo> m_Profile;
247 QList<QVariantMap> m_OpticalTrains;
248 QTimer m_CheckMissingDevicesTimer;
249 QTimer m_DelegateTimer;
250 QVariantMap *m_CurrentOpticalTrain =
nullptr;
253 bool m_Persistent =
false;
256 QSqlTableModel *m_OpticalTrainsModel = {
nullptr };
258 QStringList m_TrainNames;
260 QStringList m_MountNames;
261 QStringList m_DustCapNames;
262 QStringList m_LightBoxNames;
263 QStringList m_ScopeNames;
264 QStringList m_ReducerNames;
265 QStringList m_RotatorNames;
266 QStringList m_FocuserNames;
267 QStringList m_FilterWheelNames;
268 QStringList m_CameraNames;
269 QStringList m_GuiderNames;
Ekos is an advanced Astrophotography tool for Linux.