7#include "buildfilteroffsets.h"
8#include <kstars_debug.h>
10#include "indi_debug.h"
11#include "kstarsdata.h"
13#include "ekos/focus/focus.h"
14#include "ekos/manager.h"
16#include "auxiliary/kspaths.h"
17#include "auxiliary/ksmessagebox.h"
18#include "ekos/auxiliary/tabledelegate.h"
21#include <QSqlTableModel>
22#include <QSqlDatabase>
25#include <basedevice.h>
40 connect(buttonBox, SIGNAL(accepted()),
this, SLOT(
close()));
41 connect(buttonBox, SIGNAL(rejected()),
this, SLOT(
close()));
45 kcfg_FlatSyncFocus->setChecked(Options::flatSyncFocus());
48 Options::setFlatSyncFocus(kcfg_FlatSyncFocus->isChecked());
52 m_FilterChangeTimeout.setSingleShot(
true);
53 m_FilterChangeTimeout.setInterval(30000);
59 noEditDelegate =
new NotEditableDelegate(m_FilterView);
60 m_FilterView->setItemDelegateForColumn(FM_LABEL, noEditDelegate);
63 exposureDelegate =
new DoubleDelegate(m_FilterView, 0.001, 3600, 1);
64 m_FilterView->setItemDelegateForColumn(FM_EXPOSURE, exposureDelegate);
67 offsetDelegate =
new IntegerDelegate(m_FilterView, -10000, 10000, 1);
68 m_FilterView->setItemDelegateForColumn(FM_OFFSET, offsetDelegate);
71 useAutoFocusDelegate =
new ToggleDelegate(m_FilterView);
72 m_FilterView->setItemDelegateForColumn(FM_AUTO_FOCUS, useAutoFocusDelegate);
75 lockDelegate =
new ComboDelegate(m_FilterView);
76 m_FilterView->setItemDelegateForColumn(FM_LOCK_FILTER, lockDelegate);
77 lockDelegate->setValues(getLockDelegates());
81 lastAFSolutionDelegate =
new IntegerDelegate(m_FilterView, 0, 1000000, 1);
82 m_FilterView->setItemDelegateForColumn(FM_LAST_AF_SOLUTION, lastAFSolutionDelegate);
85 lastAFTempDelegate =
new DoubleDelegate(m_FilterView, -60.0, 60.0, 1.0);
86 m_FilterView->setItemDelegateForColumn(FM_LAST_AF_TEMP, lastAFTempDelegate);
89 lastAFAltDelegate =
new DoubleDelegate(m_FilterView, 0.0, 90.0, 1.0);
90 m_FilterView->setItemDelegateForColumn(FM_LAST_AF_ALT, lastAFAltDelegate);
93 ticksPerTempDelegate =
new DoubleDelegate(m_FilterView, -10000.0, 10000.0, 1.0);
94 m_FilterView->setItemDelegateForColumn(FM_TICKS_PER_TEMP, ticksPerTempDelegate);
97 ticksPerAltDelegate =
new DoubleDelegate(m_FilterView, -10000.0, 10000.0, 1.0);
98 m_FilterView->setItemDelegateForColumn(FM_TICKS_PER_ALT, ticksPerAltDelegate);
101 wavelengthDelegate =
new IntegerDelegate(m_FilterView, 200, 1000, 50);
102 m_FilterView->setItemDelegateForColumn(FM_WAVELENGTH, wavelengthDelegate);
105void FilterManager::createFilterModel()
110 m_FilterView->setModel(m_FilterModel);
111 m_FilterModel->setTable(
"filter");
122 m_FilterModel->setHeaderData(FM_AUTO_FOCUS,
Qt::Horizontal,
i18n(
"Start Auto Focus when filter is activated"),
126 m_FilterModel->setHeaderData(FM_LOCK_FILTER,
Qt::Horizontal,
i18n(
"Lock specific filter when running Auto Focus"),
131 i18n(
"Last AF solution. Updated automatically by the autofocus process."),
Qt::ToolTipRole);
132 m_FilterModel->setHeaderData(FM_LAST_AF_SOLUTION,
Qt::Horizontal,
i18n(
"Last AF Solution"));
135 i18n(
"The temperature of the last AF solution. Updated automatically by the autofocus process."),
Qt::ToolTipRole);
136 m_FilterModel->setHeaderData(FM_LAST_AF_TEMP,
Qt::Horizontal,
i18n(
"Last AF Temp (°C)"));
139 i18n(
"The altitude of the last AF solution. Updated automatically by the autofocus process."),
Qt::ToolTipRole);
140 m_FilterModel->setHeaderData(FM_LAST_AF_ALT,
Qt::Horizontal,
i18n(
"Last AF Alt (°Alt)"));
143 i18n(
"The number of ticks per °C increase in temperature. +ve for outward focuser movement"),
Qt::ToolTipRole);
147 i18n(
"The number of ticks per degree increase in altitude. +ve for outward focuser movement"),
Qt::ToolTipRole);
159 if (topLeft.
column() == FM_EXPOSURE)
160 emit exposureChanged(m_FilterModel->data(topLeft).toDouble());
161 else if (topLeft.
column() == FM_LOCK_FILTER)
165 QString lock = m_FilterModel->
data(m_FilterModel->index(topLeft.
row(), topLeft.
column())).toString();
166 QString filter = m_FilterModel->data(m_FilterModel->index(topLeft.
row(), FM_LABEL)).toString();
167 bool alreadyALock =
false;
168 for (
int i = 0; i < m_ActiveFilters.count(); i++)
170 if (m_ActiveFilters[i]->lockedFilter() == filter)
176 if (alreadyALock || (lock == filter))
178 m_FilterModel->setData(m_FilterModel->index(topLeft.
row(), topLeft.
column()), NULL_FILTER);
181 lockDelegate->setValues(getLockDelegates());
183 else if (topLeft.
column() == FM_TICKS_PER_TEMP)
184 emit ticksPerTempChanged();
185 else if (topLeft.
column() == FM_TICKS_PER_ALT)
186 emit ticksPerAltChanged();
187 else if (topLeft.
column() == FM_WAVELENGTH)
188 emit wavelengthChanged();
192void FilterManager::refreshFilterModel()
194 if (m_FilterWheel ==
nullptr || m_currentFilterLabels.empty())
198 if (m_FilterModel ==
nullptr)
201 QString vendor(m_FilterWheel->getDeviceName());
202 m_FilterModel->setFilter(
QString(
"vendor='%1'").arg(vendor));
203 m_FilterModel->select();
205 m_FilterView->hideColumn(0);
206 m_FilterView->hideColumn(1);
207 m_FilterView->hideColumn(2);
208 m_FilterView->hideColumn(3);
212 if (m_FilterModel->rowCount() > 0 && m_FilterModel->rowCount() != m_currentFilterLabels.count())
214 for (
int i = 0; i < m_FilterModel->rowCount(); i++)
215 m_FilterModel->removeRow(i);
217 m_FilterModel->select();
221 if (m_FilterModel->rowCount() == 0)
223 filterProperties *fp =
new filterProperties(vendor,
"",
"",
"");
224 for (
QString &filter : m_currentFilterLabels)
230 m_FilterModel->select();
235 for (
int i = 0; i < m_FilterModel->rowCount(); ++i)
237 QModelIndex index = m_FilterModel->index(i, FM_LABEL);
238 if (m_FilterModel->data(index).toString() != m_currentFilterLabels[i])
240 m_FilterModel->setData(index, m_currentFilterLabels[i]);
245 lockDelegate->setValues(getLockDelegates());
251void FilterManager::resizeDialog()
255 int width = m_FilterView->horizontalHeader()->length() + 50;
256 int height =
label->height() + m_FilterView->verticalHeader()->
length() + label_2->height() + buttonBox->height() + 100;
257 this->resize(width, height);
265 for (
int i = 0; i < m_ActiveFilters.count(); i++)
267 if (m_ActiveFilters[i]->lockedFilter() == NULL_FILTER)
268 lockDelegates.
append(m_ActiveFilters[i]->color());
270 return lockDelegates;
273void FilterManager::reloadFilters()
275 qDeleteAll(m_ActiveFilters);
276 currentFilter =
nullptr;
277 targetFilter =
nullptr;
278 m_ActiveFilters.clear();
279 operationQueue.clear();
281 filterProperties *fp =
new filterProperties(
"",
"",
"",
"");
283 for (
int i = 0; i < m_FilterModel->rowCount(); ++i)
295 fp->useAutoFocus = record.
value(
"UseAutoFocus").
toInt() == 1;
296 fp->absFocusPos = record.
value(
"AbsoluteFocusPosition").
toInt();
297 fp->focusTemperature = record.
value(
"FocusTemperature").
toDouble();
298 fp->focusAltitude = record.
value(
"FocusAltitude").
toDouble();
299 fp->focusTicksPerTemp = record.
value(
"FocusTicksPerTemp").
toDouble();
300 fp->focusTicksPerAlt = record.
value(
"FocusTicksPerAlt").
toDouble();
301 fp->wavelength = record.
value(
"Wavelength").
toInt();
303 m_ActiveFilters.append(o);
307void FilterManager::setFilterWheel(ISD::FilterWheel *filter)
310 if (m_FilterWheel == filter && m_FilterNameProperty && m_FilterPositionProperty)
312 else if (m_FilterWheel)
313 m_FilterWheel->disconnect(
this);
317 m_FilterNameProperty =
nullptr;
318 m_FilterPositionProperty =
nullptr;
319 m_FilterConfirmSet =
nullptr;
324 connect(m_FilterWheel, &ISD::ConcreteDevice::propertyUpdated,
this, &FilterManager::updateProperty);
325 connect(m_FilterWheel, &ISD::ConcreteDevice::Disconnected,
this, &FilterManager::processDisconnect);
327 refreshFilterProperties();
330void FilterManager::refreshFilterProperties()
332 if (m_FilterNameProperty && m_FilterPositionProperty)
334 if (m_FilterConfirmSet ==
nullptr)
335 m_FilterConfirmSet = m_FilterWheel->getSwitch(
"CONFIRM_FILTER_SET");
338 if (m_currentFilterLabels.count() == m_FilterNameProperty->ntp)
342 filterNameLabel->setText(m_FilterWheel->getDeviceName());
344 m_currentFilterLabels.clear();
346 m_FilterNameProperty = m_FilterWheel->getText(
"FILTER_NAME");
347 m_FilterPositionProperty = m_FilterWheel->getNumber(
"FILTER_SLOT");
348 m_FilterConfirmSet = m_FilterWheel->getSwitch(
"CONFIRM_FILTER_SET");
350 refreshFilterLabels();
351 refreshFilterPosition();
353 if (m_currentFilterPosition >= 1 && m_currentFilterPosition <= m_ActiveFilters.count())
354 lastFilterOffset = m_ActiveFilters[m_currentFilterPosition - 1]->offset();
357QStringList FilterManager::getFilterLabels(
bool forceRefresh)
359 if ((!m_currentFilterLabels.empty() && forceRefresh ==
false) || !m_FilterNameProperty || !m_FilterPositionProperty)
360 return m_currentFilterLabels;
364 for (
int i = 0; i < m_FilterPositionProperty->np[0].max; i++)
366 if (m_FilterNameProperty !=
nullptr && (i < m_FilterNameProperty->ntp))
367 filterList.
append(m_FilterNameProperty->tp[i].text);
373int FilterManager::getFilterPosition(
bool forceRefresh)
375 if (forceRefresh ==
false || m_FilterPositionProperty ==
nullptr)
376 return m_currentFilterPosition;
378 return static_cast<int>(m_FilterPositionProperty->np[0].value);
381void FilterManager::refreshFilterLabels()
383 QList filters = getFilterLabels(
true);
385 if (filters != m_currentFilterLabels)
387 m_currentFilterLabels = filters;
388 refreshFilterModel();
390 emit labelsChanged(filters);
393 refreshFilterPosition();
397void FilterManager::refreshFilterPosition()
400 int pos = getFilterPosition(
true);
401 if (pos != m_currentFilterPosition)
403 m_currentFilterPosition = pos;
404 emit positionChanged(pos);
408bool FilterManager::setFilterPosition(uint8_t position, FilterPolicy policy)
411 if (position > m_ActiveFilters.count())
415 currentFilter = m_ActiveFilters[m_currentFilterPosition - 1];
416 targetFilter = m_ActiveFilters[position - 1];
418 if (currentFilter == targetFilter)
424 buildOperationQueue(FILTER_CHANGE);
426 executeOperationQueue();
432void FilterManager::updateProperty(INDI::Property prop)
434 if (m_FilterWheel ==
nullptr || m_FilterWheel->getDeviceName() != prop.getDeviceName())
437 if (prop.isNameMatch(
"FILTER_NAME"))
439 auto tvp = prop.getText();
440 m_FilterNameProperty = tvp;
442 refreshFilterLabels();
444 else if (prop.isNameMatch(
"FILTER_SLOT"))
446 m_FilterChangeTimeout.stop();
448 auto nvp = prop.getNumber();
451 if (state == FILTER_CHANGE && nvp->s == IPS_ALERT)
457 if (nvp->s != IPS_OK)
460 m_FilterPositionProperty = nvp;
461 refreshFilterPosition();
463 if (state == FILTER_CHANGE)
464 executeOperationQueue();
466 else if (state == FILTER_IDLE && m_ActiveFilters.count() >= m_currentFilterPosition)
467 lastFilterOffset = m_ActiveFilters[m_currentFilterPosition - 1]->offset();
472void FilterManager::processDisconnect()
474 m_currentFilterLabels.clear();
475 m_currentFilterPosition = -1;
476 m_FilterNameProperty =
nullptr;
477 m_FilterPositionProperty =
nullptr;
480void FilterManager::buildOperationQueue(FilterState operation)
482 operationQueue.clear();
483 m_useTargetFilter =
false;
489 if ( (m_Policy & CHANGE_POLICY) && targetFilter != currentFilter)
490 m_useTargetFilter =
true;
492 if (m_useTargetFilter)
494 operationQueue.enqueue(FILTER_CHANGE);
495 if (m_FocusReady && (m_Policy & OFFSET_POLICY))
496 operationQueue.enqueue(FILTER_OFFSET);
500 lastFilterOffset = targetFilter->offset();
501 currentFilter = targetFilter;
506 if (m_FocusReady && (m_Policy & AUTOFOCUS_POLICY) && targetFilter->useAutoFocus())
507 operationQueue.enqueue(FILTER_AUTOFOCUS);
516bool FilterManager::executeOperationQueue()
518 if (operationQueue.isEmpty())
521 emit newStatus(state);
526 FilterState nextOperation = operationQueue.dequeue();
528 bool actionRequired =
true;
530 switch (nextOperation)
534 m_FilterChangeTimeout.stop();
536 if (m_ConfirmationPending)
539 state = FILTER_CHANGE;
540 if (m_useTargetFilter)
541 targetFilterPosition = m_ActiveFilters.indexOf(targetFilter) + 1;
542 m_FilterWheel->setPosition(targetFilterPosition);
544 emit newStatus(state);
546 if (m_FilterConfirmSet)
551 m_ConfirmationPending =
false;
552 m_FilterWheel->confirmFilter();
557 m_ConfirmationPending =
false;
560 m_ConfirmationPending =
true;
562 KSMessageBox::Instance()->questionYesNo(
i18n(
"Set filter to %1. Is filter set?", targetFilter->color()),
563 i18n(
"Confirm Filter"));
566 else m_FilterChangeTimeout.start();
572 state = FILTER_OFFSET;
573 if (m_useTargetFilter)
575 targetFilterOffset = targetFilter->offset() - lastFilterOffset;
576 lastFilterOffset = targetFilter->offset();
577 currentFilter = targetFilter;
578 m_useTargetFilter =
false;
580 if (targetFilterOffset == 0)
581 actionRequired =
false;
584 emit newFocusOffset(targetFilterOffset,
false);
585 emit newStatus(state);
590 case FILTER_AUTOFOCUS:
591 state = FILTER_AUTOFOCUS;
592 qCDebug(KSTARS) <<
"FilterManager.cpp is triggering autofocus.";
593 emit newStatus(state);
594 emit runAutoFocus(AutofocusReason::FOCUS_FILTER,
"");
606 return executeOperationQueue();
609bool FilterManager::executeOneOperation(FilterState operation)
611 bool actionRequired =
false;
619 return actionRequired;
622void FilterManager::setFocusOffsetComplete()
624 if (state == FILTER_OFFSET)
625 executeOperationQueue();
628double FilterManager::getFilterExposure(
const QString &name)
const
630 auto filterDetails = getFilterByName(name);
632 return filterDetails->exposure();
638bool FilterManager::setFilterExposure(
int index,
double exposure)
640 if (m_currentFilterLabels.empty())
643 QString color = m_currentFilterLabels[index];
644 for (
int i = 0; i < m_ActiveFilters.count(); i++)
646 if (color == m_ActiveFilters[i]->color())
648 m_FilterModel->setData(m_FilterModel->index(i, FM_EXPOSURE), exposure);
649 m_FilterModel->submitAll();
650 refreshFilterModel();
658int FilterManager::getFilterOffset(
const QString &name)
const
660 int offset = INVALID_VALUE;
661 auto filterDetails = getFilterByName(name);
663 offset = filterDetails->offset();
668bool FilterManager::setFilterOffset(
QString color,
int offset)
670 if (m_currentFilterLabels.empty())
673 for (
int i = 0; i < m_ActiveFilters.count(); i++)
675 if (color == m_ActiveFilters[i]->color())
677 m_FilterModel->setData(m_FilterModel->index(i, FM_OFFSET), offset);
678 m_FilterModel->submitAll();
679 refreshFilterModel();
687bool FilterManager::getFilterAbsoluteFocusDetails(
const QString &name,
int &focusPos,
double &focusTemp,
688 double &focusAlt)
const
690 auto filterDetails = getFilterByName(name);
693 focusPos = filterDetails->absoluteFocusPosition();
694 focusTemp = filterDetails->focusTemperature();
695 focusAlt = filterDetails->focusAltitude();
702bool FilterManager::setFilterAbsoluteFocusDetails(
int index,
int focusPos,
double focusTemp,
double focusAlt)
704 if (index < 0 || index >= m_currentFilterLabels.count())
707 QString color = m_currentFilterLabels[index];
708 for (
int i = 0; i < m_ActiveFilters.count(); i++)
710 if (color == m_ActiveFilters[i]->color())
712 m_FilterModel->setData(m_FilterModel->index(i, FM_LAST_AF_SOLUTION), focusPos);
713 m_FilterModel->setData(m_FilterModel->index(i, FM_LAST_AF_TEMP), focusTemp);
714 m_FilterModel->setData(m_FilterModel->index(i, FM_LAST_AF_ALT), focusAlt);
715 m_FilterModel->submitAll();
716 refreshFilterModel();
726 auto filterDetails = getFilterByName(name);
728 return filterDetails->lockedFilter();
734bool FilterManager::setFilterLock(
int index,
QString name)
736 if (m_currentFilterLabels.empty())
739 QString color = m_currentFilterLabels[index];
740 for (
int i = 0; i < m_ActiveFilters.count(); i++)
742 if (color == m_ActiveFilters[i]->color())
744 m_FilterModel->setData(m_FilterModel->index(i, FM_LOCK_FILTER), name);
745 m_FilterModel->submitAll();
746 refreshFilterModel();
754int FilterManager::getFilterWavelength(
const QString &name)
const
756 auto filterDetails = getFilterByName(name);
758 return filterDetails->wavelength();
764double FilterManager::getFilterTicksPerTemp(
const QString &name)
const
766 auto filterDetails = getFilterByName(name);
768 return filterDetails->focusTicksPerTemp();
774double FilterManager::getFilterTicksPerAlt(
const QString &name)
const
776 auto filterDetails = getFilterByName(name);
778 return filterDetails->focusTicksPerAlt();
786 if (m_currentFilterLabels.empty() ||
787 m_currentFilterPosition < 1 ||
788 m_currentFilterPosition > m_currentFilterLabels.count())
793 color = m_currentFilterLabels[m_currentFilterPosition - 1];
795 auto pos = std::find_if(m_ActiveFilters.begin(), m_ActiveFilters.end(), [color](
OAL::Filter * oneFilter)
797 return (oneFilter->color() == color);
800 if (pos != m_ActiveFilters.end())
808 if (m_FilterWheel && (m_FilterWheel->getDeviceName() == device->getDeviceName()))
810 m_FilterNameProperty =
nullptr;
811 m_FilterPositionProperty =
nullptr;
812 m_FilterWheel =
nullptr;
813 m_currentFilterLabels.clear();
814 m_currentFilterPosition = 0;
815 qDeleteAll(m_ActiveFilters);
816 m_ActiveFilters.clear();
817 delete(m_FilterModel);
818 m_FilterModel =
nullptr;
822void FilterManager::setFocusStatus(Ekos::FocusState focusState)
824 if (state == FILTER_AUTOFOCUS)
829 executeOperationQueue();
840 emit runAutoFocus(AutofocusReason::FOCUS_FILTER,
"");
850bool FilterManager::syncAbsoluteFocusPosition(
int index)
852 if (m_FocusReady ==
false)
854 qCWarning(KSTARS_INDI) << __FUNCTION__ <<
"No Focuser detected.";
857 else if (index < 0 || index > m_ActiveFilters.count())
862 qCWarning(KSTARS_INDI) << __FUNCTION__ <<
"index" << index <<
"is out of bounds.";
868 auto absFocusPos = m_ActiveFilters[index]->absoluteFocusPosition();
870 if (m_FocusAbsPosition == absFocusPos || absFocusPos <= 0)
872 m_FocusAbsPositionPending =
false;
875 else if (m_FocusAbsPositionPending ==
false)
877 m_FocusAbsPositionPending =
true;
878 emit newFocusOffset(absFocusPos,
true);
884bool FilterManager::setFilterNames(
const QStringList &newLabels)
886 if (m_FilterWheel ==
nullptr || m_currentFilterLabels.empty())
889 m_FilterWheel->setLabels(newLabels);
900 for (
int i = 0; i < m_FilterModel->rowCount(); ++i)
905 {
"label", m_FilterModel->data(m_FilterModel->index(i, FM_LABEL)).toString()},
906 {
"exposure", m_FilterModel->data(m_FilterModel->index(i, FM_EXPOSURE)).toDouble()},
907 {
"offset", m_FilterModel->data(m_FilterModel->index(i, FM_OFFSET)).toInt()},
908 {
"autofocus", m_FilterModel->data(m_FilterModel->index(i, FM_AUTO_FOCUS)).toBool()},
909 {
"lock", m_FilterModel->data(m_FilterModel->index(i, FM_LOCK_FILTER)).toString()},
910 {
"lastafsolution", m_FilterModel->data(m_FilterModel->index(i, FM_LAST_AF_SOLUTION)).toInt()},
911 {
"lastaftemp", m_FilterModel->data(m_FilterModel->index(i, FM_LAST_AF_TEMP)).toDouble()},
912 {
"lastafalt", m_FilterModel->data(m_FilterModel->index(i, FM_LAST_AF_ALT)).toDouble()},
913 {
"tickspertemp", m_FilterModel->data(m_FilterModel->index(i, FM_TICKS_PER_TEMP)).toDouble()},
914 {
"ticksperalt", m_FilterModel->data(m_FilterModel->index(i, FM_TICKS_PER_ALT)).toDouble()},
915 {
"wavelength", m_FilterModel->data(m_FilterModel->index(i, FM_WAVELENGTH)).toInt()},
918 filters.
append(oneFilter);
923 {
"device", m_FilterWheel->getDeviceName()},
931void FilterManager::setFilterData(
const QJsonObject &settings)
936 if (settings[
"device"].
toString() != m_FilterWheel->getDeviceName())
939 QJsonArray filters = settings[
"filters"].toArray();
942 for (
auto oneFilterRef : filters)
945 int row = oneFilter[
"index"].toInt();
947 labels[row] = oneFilter[
"label"].toString();
948 m_FilterModel->setData(m_FilterModel->index(row, FM_LABEL), oneFilter[
"label"].toString());
949 m_FilterModel->setData(m_FilterModel->index(row, FM_EXPOSURE), oneFilter[
"exposure"].toDouble());
950 m_FilterModel->setData(m_FilterModel->index(row, FM_OFFSET), oneFilter[
"offset"].toInt());
951 m_FilterModel->setData(m_FilterModel->index(row, FM_AUTO_FOCUS), oneFilter[
"autofocus"].toBool());
952 m_FilterModel->setData(m_FilterModel->index(row, FM_LOCK_FILTER), oneFilter[
"lock"].toString());
953 m_FilterModel->setData(m_FilterModel->index(row, FM_LAST_AF_SOLUTION), oneFilter[
"lastafsolution"].toInt());
954 m_FilterModel->setData(m_FilterModel->index(row, FM_LAST_AF_TEMP), oneFilter[
"lastaftemp"].toDouble());
955 m_FilterModel->setData(m_FilterModel->index(row, FM_LAST_AF_ALT), oneFilter[
"lastafalt"].toDouble());
956 m_FilterModel->setData(m_FilterModel->index(row, FM_TICKS_PER_TEMP), oneFilter[
"tickspertemp"].toDouble());
957 m_FilterModel->setData(m_FilterModel->index(row, FM_TICKS_PER_ALT), oneFilter[
"ticksperalt"].toDouble());
958 m_FilterModel->setData(m_FilterModel->index(row, FM_WAVELENGTH), oneFilter[
"wavelength"].toInt());
961 m_FilterModel->submitAll();
962 setFilterNames(labels);
964 refreshFilterModel();
967void FilterManager::buildFilterOffsets()
971 Ekos::Manager::Instance()->getFilterManager(m_FilterWheel->getDeviceName(), filterManager);
972 BuildFilterOffsets bfo(filterManager);
975void FilterManager::signalRunAutoFocus(AutofocusReason autofocusReason,
const QString &reasonInfo)
978 emit runAutoFocus(autofocusReason, reasonInfo);
981void FilterManager::autoFocusComplete(FocusState completionState,
int currentPosition,
double currentTemperature,
985 emit autoFocusDone(completionState, currentPosition, currentTemperature, currentAlt);
988void FilterManager::signalAbortAutoFocus()
991 emit abortAutoFocus();
994void FilterManager::checkFilterChangeTimeout()
996 if (state == FILTER_CHANGE)
998 qCWarning(KSTARS) <<
"FilterManager.cpp filter change timed out.";
bool AddFilter(const filterProperties *fp)
Add a new filter to the database.
Information of user filters.
QString i18n(const char *text, const TYPE &arg...)
char * toString(const EngineQuery &query)
Ekos is an advanced Astrophotography tool for Linux.
QString name(StandardAction id)
QString label(StandardShortcut id)
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles)
void append(const QJsonValue &value)
void append(QList< T > &&value)
bool disconnect(const QMetaObject::Connection &connection)
QSqlDatabase database(const QString &connectionName, bool open)
QVariant value(const QString &name) const const
bool isEmpty() const const
qsizetype length() const const
QFuture< void > filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
double toDouble(bool *ok) const const
int toInt(bool *ok) const const
QString toString() const const