7#include "sequenceeditor.h"
10#include "ekos/auxiliary/opticaltrainsettings.h"
11#include <kstars_debug.h>
15#define KEY_FILTERS "filtersList"
16#define KEY_FORMATS "formatsList"
17#define KEY_ISOS "isoList"
18#define KEY_INDEX "isoIndex"
19#define KEY_H "captureFrameHN"
20#define KEY_W "captureFrameWN"
21#define KEY_GAIN_KWD "ccdGainKeyword"
22#define KEY_OFFSET_KWD "ccdOffsetKeyword"
23#define KEY_TEMPERATURE "ccdTemperatures"
24#define KEY_TIMESTAMP "timestamp"
33 if (items.
size() == 0)
36 for (
int index = 0; index < combo->
count(); index++)
37 existingItems << combo->
itemText(index);
39 for (
const auto &item : items)
40 if (existingItems.
indexOf(item) == -1)
56 m_camera.reset(
new Camera(
true));
58 sequenceEditorLayout->insertWidget(1, m_camera.get());
60void SequenceEditor::showEvent(
QShowEvent* event)
64 m_camera->onStandAloneShow(event);
67void SequenceEditor::initStandAlone()
70 mainCam->processGrid->setVisible(
false);
71 mainCam->loadSaveBox->setVisible(
true);
72 mainCam->loadSaveBox->setEnabled(
true);
73 mainCam->horizontalSpacer_SQ2->changeSize(0, 0);
77 mainCam->opticalTrainCombo, mainCam->trainB, mainCam->restartCameraB, mainCam->clearConfigurationB, mainCam->resetFrameB, mainCam->opticalTrainLabel,
78 mainCam->coolerOnB, mainCam->coolerOffB, mainCam->setTemperatureB, mainCam->temperatureRegulationB, mainCam->temperatureOUT,
79 mainCam->previewB, mainCam->loopB, mainCam->liveVideoB, mainCam->startB, mainCam->pauseB,
80 mainCam->previewLabel, mainCam->loopLabel, mainCam->videoLabel,
81 mainCam->resetB, mainCam->queueLoadB, mainCam->queueSaveB, mainCam->queueSaveAsB,
82 mainCam->darkB, mainCam->darkLibraryB, mainCam->darksLibraryLabel, mainCam->exposureCalcB, mainCam->exposureCalculationLabel,
83 mainCam->filterManagerB
85 for (
auto &widget : unusedWidgets)
87 widget->setEnabled(
false);
88 widget->setVisible(
false);
92void SequenceEditor::onStandAloneShow()
94 OpticalTrainSettings::Instance()->setOpticalTrainID(Options::captureTrainID());
95 auto settings = OpticalTrainSettings::Instance()->getOneSetting(OpticalTrainSettings::Capture);
96 m_Settings = settings.toJsonObject().toVariantMap();
101 QString comment =
i18n(
"<b><font color=\"red\">Please run the Capture tab connected to INDI with your desired "
102 "camera/filterbank at least once before using the Sequence Editor. </font></b><p>");
104 if (m_Settings.contains(KEY_TIMESTAMP) && m_Settings[KEY_TIMESTAMP].toString().size() > 0)
105 comment =
i18n(
"<b>Using camera and filterwheel attributes from Capture session started at %1.</b>"
106 "<p>If you wish to use other cameras/filterbanks, please edit the sequence "
107 "using the Capture tab.<br>It is not recommended to overwrite a sequence file currently running, "
108 "please rename it instead.</p><p>", m_Settings[KEY_TIMESTAMP].
toString());
109 sequenceEditorComment->setVisible(
true);
110 sequenceEditorComment->setEnabled(
true);
111 sequenceEditorComment->setStyleSheet(
"{color: #C0BBFE}");
112 sequenceEditorComment->setText(comment);
115 m_camera->loadSaveBox->setEnabled(
true);
116 m_camera->loadSaveBox->setVisible(
true);
118 &Camera::saveSequenceQueueAs);
120 static_cast<void(Camera::*)()
>(&Camera::loadSequenceQueue));
122 m_camera->FilterPosCombo->clear();
123 if (m_Settings.contains(KEY_FILTERS))
124 addToCombo(m_camera->FilterPosCombo, m_Settings[KEY_FILTERS].toStringList());
126 if (m_camera->FilterPosCombo->count() > 0)
128 m_camera->filterEditB->setEnabled(
true);
129 m_camera->filterManagerB->setEnabled(
true);
132 m_camera->captureGainN->setEnabled(
true);
133 m_camera->captureGainN->setSpecialValueText(
i18n(
"--"));
135 m_camera->captureOffsetN->setEnabled(
true);
136 m_camera->captureOffsetN->setSpecialValueText(
i18n(
"--"));
140 const QStringList frameTypes = {
"Light",
"Dark",
"Bias",
"Flat"};
141 m_camera->captureTypeS->
clear();
142 m_camera->captureTypeS->addItems(frameTypes);
146 const QStringList frameEncodings = {
"FITS",
"Native",
"XISF"};
147 m_camera->captureEncodingS->
clear();
148 m_camera->captureEncodingS->addItems(frameEncodings);
150 if (m_Settings.contains(KEY_FORMATS))
152 m_camera->captureFormatS->clear();
153 addToCombo(m_camera->captureFormatS, m_Settings[KEY_FORMATS].toStringList());
156 m_camera->cameraTemperatureN->setEnabled(
true);
157 m_camera->cameraTemperatureN->setReadOnly(
false);
158 m_camera->cameraTemperatureN->setSingleStep(1);
159 m_camera->cameraTemperatureS->setEnabled(
true);
161 double minTemp = -50, maxTemp = 50;
162 if (m_Settings.contains(KEY_TEMPERATURE))
164 QStringList temperatureList = m_Settings[KEY_TEMPERATURE].toStringList();
165 if (temperatureList.
size() > 1)
167 minTemp = temperatureList[0].toDouble();
168 maxTemp = temperatureList[1].toDouble();
171 m_camera->cameraTemperatureN->setMinimum(minTemp);
172 m_camera->cameraTemperatureN->setMaximum(maxTemp);
177 if (m_Settings.contains(KEY_ISOS))
179 QStringList isoList = m_Settings[KEY_ISOS].toStringList();
180 m_camera->captureISOS->
clear();
181 if (isoList.
size() > 0)
183 m_camera->captureISOS->addItems(isoList);
184 if (m_Settings.contains(KEY_INDEX))
185 m_camera->captureISOS->setCurrentIndex(m_Settings[KEY_INDEX].
toString().toInt());
187 m_camera->captureISOS->setCurrentIndex(0);
188 m_camera->captureISOS->blockSignals(
false);
189 m_camera->captureISOS->setEnabled(
true);
194 m_camera->captureISOS->blockSignals(
true);
195 m_camera->captureISOS->clear();
196 m_camera->captureISOS->setEnabled(
false);
201 constexpr int maxFrame = 20000;
202 m_camera->captureFrameXN->setMaximum(
static_cast<int>(maxFrame));
203 m_camera->captureFrameYN->setMaximum(
static_cast<int>(maxFrame));
204 m_camera->captureFrameWN->setMaximum(
static_cast<int>(maxFrame));
205 m_camera->captureFrameHN->setMaximum(
static_cast<int>(maxFrame));
207 if (m_Settings.contains(KEY_H))
208 m_camera->captureFrameHN->setValue(m_Settings[KEY_H].toUInt());
210 if (m_Settings.contains(KEY_W))
211 m_camera->captureFrameWN->setValue(m_Settings[KEY_W].toUInt());
QString i18n(const char *text, const TYPE &arg...)
char * toString(const EngineQuery &query)
Ekos is an advanced Astrophotography tool for Linux.
void addItem(const QIcon &icon, const QString &text, const QVariant &userData)
QString itemText(int index) const const
qsizetype size() const const
qsizetype indexOf(const QRegularExpression &re, qsizetype from) const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)