7#include "customproperties.h"
9CustomProperties::CustomProperties()
35void CustomProperties::syncProperties()
37 availablePropertiesList->clear();
50 <<
"CCD_EXPOSURE_ABORT"
54 <<
"GUIDER_EXPOSURE_ABORT"
55 <<
"GUIDER_FRAME_TYPE"
68 <<
"EQUATORIAL_EOD_COORD"
70 <<
"TELESCOPE_TIMED_GUIDE_NS"
71 <<
"TELESCOPE_TIMED_GUIDE_WE";
74 for (
auto &
property : *currentCCD->getProperties())
86 props <<
property.getLabel();
92 availablePropertiesList->addItems(props);
97 return customProperties;
102 customProperties = value;
105void CustomProperties::slotAdd()
107 if (availablePropertiesList->selectedItems().isEmpty() ==
false)
109 QString prop = availablePropertiesList->selectedItems().
first()->text();
111 jobPropertiesList->addItem(prop);
115void CustomProperties::slotRemove()
117 if (jobPropertiesList->selectedItems().isEmpty() ==
false)
119 QModelIndex i = jobPropertiesList->selectionModel()->currentIndex();
124void CustomProperties::slotClear()
126 jobPropertiesList->clear();
129void CustomProperties::slotApply()
131 if (currentCCD ==
nullptr)
135 for (
int i = 0; i < jobPropertiesList->count(); i++)
136 customProperties.
remove(jobPropertiesList->item(i)->text());
141 for (
int i = 0; i < jobPropertiesList->count(); i++)
143 auto label = jobPropertiesList->item(i)->text();
146 for(
auto &oneProperty : *currentCCD->getProperties())
149 if (label != oneProperty.getLabel())
155 switch (oneProperty.getType())
158 for (
const auto &oneSwitch : *oneProperty.getSwitch())
160 elements[oneSwitch.getName()] = oneSwitch.getState();
164 for (
const auto &oneText : *oneProperty.getText())
166 elements[oneText.getName()] = oneText.getText();
170 for (
const auto &oneNumber : *oneProperty.getNumber())
172 elements[oneNumber.getName()] = oneNumber.getValue();
180 newMap[oneProperty.getName()] = elements;
186 customProperties = newMap;
Camera class controls an INDI Camera device.
QString name(StandardAction id)
QString label(StandardShortcut id)
bool removeRow(int row, const QModelIndex &parent)
QIcon fromTheme(const QString &name)
size_type remove(const Key &key)
const QAbstractItemModel * model() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QVariant property(const char *name) const const
QString first(qsizetype n) const const
bool isEmpty() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
qsizetype removeDuplicates()
void sort(Qt::CaseSensitivity cs)