Kstars

opticaltrainsettings.h
1/*
2 SPDX-FileCopyrightText: 2022 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QJsonArray>
10#include <QObject>
11#include <QVariantMap>
12
13namespace Ekos
14{
15
16/**
17 * @brief The OpticalTrainSettings class
18 *
19 * General-purpose class to encapsulate OpticalTrain-specific settings in the database.
20 *
21 * The settings are stored as QVariant Map. Each element in the array should have the following format.
22 * {
23 * "id1": payload1,
24 * "id2", payload2,
25 * ...
26 * }
27 *
28 * 1. The ID is a unique number from the Settings enum.
29 * 2. The Payload is QVariant.
30 *
31 * @author Jasem Mutlaq
32 * @version 1.0
33 */
34class OpticalTrainSettings : public QObject
35{
37
38 public:
39
40 static OpticalTrainSettings *Instance();
41 static void release();
42
43 // Settings
44 typedef enum
45 {
46 Capture,
47 Focus,
48 Mount,
49 Align,
50 Guide,
51 Observatory,
52 Scheduler,
53 Analyze,
54 DarkLibrary
55 } Settings;
56
57 /**
58 * @brief setOpticalTrainID This must be called before calling any settings functions below.
59 * @param id ID of optical train
60 */
61 void setOpticalTrainID(uint32_t id);
62
63 void setOneSetting(Settings id, const QVariant &value);
64 QVariant getOneSetting(Settings id);
65 void initSettings();
66 void setSettings(const QVariantMap &settings);
67 const QVariantMap &getSettings() const
68 {
69 return m_Settings;
70 }
71
72 signals:
73 void updated();
74
75 private:
76
77 OpticalTrainSettings(QObject *parent = nullptr);
78 static OpticalTrainSettings *m_Instance;
79
80 uint32_t m_TrainID {0};
81 QVariantMap m_Settings;
82};
83
84}
void setOpticalTrainID(uint32_t id)
setOpticalTrainID This must be called before calling any settings functions below.
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:54:27 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.