Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/capture/capture.cpp
Show First 20 Lines • Show All 310 Lines • ▼ Show 20 Line(s) | 51 | { | |||
---|---|---|---|---|---|
311 | }); | 311 | }); | ||
312 | 312 | | |||
313 | customPropertiesDialog.reset(new CustomProperties()); | 313 | customPropertiesDialog.reset(new CustomProperties()); | ||
314 | connect(customValuesB, &QPushButton::clicked, [&]() | 314 | connect(customValuesB, &QPushButton::clicked, [&]() | ||
315 | { | 315 | { | ||
316 | customPropertiesDialog.get()->show(); | 316 | customPropertiesDialog.get()->show(); | ||
317 | customPropertiesDialog.get()->raise(); | 317 | customPropertiesDialog.get()->raise(); | ||
318 | }); | 318 | }); | ||
319 | connect(customPropertiesDialog.get(), &CustomProperties::valueChanged, [&]() | ||||
320 | { | ||||
321 | const double newGain = getGain(); | ||||
322 | if (newGain != -1) GainSpin->setValue(newGain); | ||||
323 | }); | ||||
319 | 324 | | |||
320 | flatFieldSource = static_cast<FlatFieldSource>(Options::calibrationFlatSourceIndex()); | 325 | flatFieldSource = static_cast<FlatFieldSource>(Options::calibrationFlatSourceIndex()); | ||
321 | flatFieldDuration = static_cast<FlatFieldDuration>(Options::calibrationFlatDurationIndex()); | 326 | flatFieldDuration = static_cast<FlatFieldDuration>(Options::calibrationFlatDurationIndex()); | ||
322 | wallCoord.setAz(Options::calibrationWallAz()); | 327 | wallCoord.setAz(Options::calibrationWallAz()); | ||
323 | wallCoord.setAlt(Options::calibrationWallAlt()); | 328 | wallCoord.setAlt(Options::calibrationWallAlt()); | ||
324 | targetADU = Options::calibrationADUValue(); | 329 | targetADU = Options::calibrationADUValue(); | ||
325 | targetADUTolerance = Options::calibrationADUValueTolerance(); | 330 | targetADUTolerance = Options::calibrationADUValueTolerance(); | ||
326 | 331 | | |||
▲ Show 20 Lines • Show All 556 Lines • ▼ Show 20 Line(s) | 884 | { | |||
883 | if (currentCCD->hasGain()) | 888 | if (currentCCD->hasGain()) | ||
884 | { | 889 | { | ||
885 | ISOLabel->setText(QString("%1:").arg(i18nc("Camera Gain", "Gain"))); | 890 | ISOLabel->setText(QString("%1:").arg(i18nc("Camera Gain", "Gain"))); | ||
886 | ISOLabel->show(); | 891 | ISOLabel->show(); | ||
887 | 892 | | |||
888 | GainSpin = new QDoubleSpinBox(CCDFWGroup); | 893 | GainSpin = new QDoubleSpinBox(CCDFWGroup); | ||
889 | double min, max, step, value, targetCustomGain; | 894 | double min, max, step, value, targetCustomGain; | ||
890 | currentCCD->getGainMinMaxStep(&min, &max, &step); | 895 | currentCCD->getGainMinMaxStep(&min, &max, &step); | ||
891 | GainSpin->setRange(min, max); | 896 | | ||
897 | // Allow the possibility of no gain value at all. | ||||
898 | GainSpinSpecialValue = min-step; | ||||
899 | GainSpin->setRange(GainSpinSpecialValue, max); | ||||
900 | GainSpin->setSpecialValueText(i18n("--")); | ||||
yurchor: Shouldn't this be 'i18n("--")' instead of 'tr("--"))'? | |||||
901 | | ||||
892 | GainSpin->setSingleStep(step); | 902 | GainSpin->setSingleStep(step); | ||
893 | currentCCD->getGain(&value); | 903 | currentCCD->getGain(&value); | ||
894 | 904 | | |||
895 | targetCustomGain = getGain(); | 905 | targetCustomGain = getGain(); | ||
896 | 906 | | |||
897 | // Set the custom gain if we have one | 907 | // Set the custom gain if we have one | ||
898 | // otherwise just put the current ccd actual gain value | 908 | // otherwise it will not have an effect. | ||
899 | if (targetCustomGain > 0) | 909 | if (targetCustomGain > 0) | ||
900 | GainSpin->setValue(targetCustomGain); | 910 | GainSpin->setValue(targetCustomGain); | ||
901 | else | 911 | else | ||
902 | GainSpin->setValue(value); | 912 | GainSpin->setValue(GainSpinSpecialValue); | ||
903 | 913 | | |||
904 | GainSpin->setReadOnly(currentCCD->getGainPermission() == IP_RO); | 914 | GainSpin->setReadOnly(currentCCD->getGainPermission() == IP_RO); | ||
905 | 915 | | |||
906 | connect(GainSpin, &QDoubleSpinBox::editingFinished, [this]() | 916 | connect(GainSpin, &QDoubleSpinBox::editingFinished, [this]() | ||
907 | { | 917 | { | ||
918 | if (GainSpin->value() != GainSpinSpecialValue) | ||||
908 | setGain(GainSpin->value()); | 919 | setGain(GainSpin->value()); | ||
909 | }); | 920 | }); | ||
910 | 921 | | |||
911 | gridLayout->addWidget(GainSpin, 4, 5, 1, 2); | 922 | gridLayout->addWidget(GainSpin, 4, 5, 1, 2); | ||
912 | } | 923 | } | ||
913 | } | 924 | } | ||
914 | else | 925 | else | ||
915 | { | 926 | { | ||
▲ Show 20 Lines • Show All 1408 Lines • ▼ Show 20 Line(s) | 2301 | { | |||
2324 | { | 2335 | { | ||
2325 | qWarning() << "Job is nullptr!" << endl; | 2336 | qWarning() << "Job is nullptr!" << endl; | ||
2326 | return false; | 2337 | return false; | ||
2327 | } | 2338 | } | ||
2328 | 2339 | | |||
2329 | if (ISOCombo) | 2340 | if (ISOCombo) | ||
2330 | job->setISOIndex(ISOCombo->currentIndex()); | 2341 | job->setISOIndex(ISOCombo->currentIndex()); | ||
2331 | 2342 | | |||
2343 | if (getGain() != -1) job->setGain(getGain()); | ||||
2344 | | ||||
2332 | job->setTransforFormat(static_cast<ISD::CCD::TransferFormat>(transferFormatCombo->currentIndex())); | 2345 | job->setTransforFormat(static_cast<ISD::CCD::TransferFormat>(transferFormatCombo->currentIndex())); | ||
2333 | 2346 | | |||
2334 | job->setPreview(preview); | 2347 | job->setPreview(preview); | ||
2335 | 2348 | | |||
2336 | if (temperatureIN->isEnabled()) | 2349 | if (temperatureIN->isEnabled()) | ||
2337 | { | 2350 | { | ||
2338 | double currentTemperature; | 2351 | double currentTemperature; | ||
2339 | currentCCD->getTemperature(¤tTemperature); | 2352 | currentCCD->getTemperature(¤tTemperature); | ||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | |||||
2466 | exp->setTextAlignment(Qt::AlignHCenter); | 2479 | exp->setTextAlignment(Qt::AlignHCenter); | ||
2467 | exp->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); | 2480 | exp->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); | ||
2468 | jsonJob.insert("Exp", exp->text()); | 2481 | jsonJob.insert("Exp", exp->text()); | ||
2469 | 2482 | | |||
2470 | QTableWidgetItem * iso = m_JobUnderEdit ? queueTable->item(currentRow, 5) : new QTableWidgetItem(); | 2483 | QTableWidgetItem * iso = m_JobUnderEdit ? queueTable->item(currentRow, 5) : new QTableWidgetItem(); | ||
2471 | if (ISOCombo && ISOCombo->currentIndex() != -1) | 2484 | if (ISOCombo && ISOCombo->currentIndex() != -1) | ||
2472 | { | 2485 | { | ||
2473 | iso->setText(ISOCombo->currentText()); | 2486 | iso->setText(ISOCombo->currentText()); | ||
2474 | jsonJob.insert("ISO", iso->text()); | 2487 | jsonJob.insert("ISO/Gain", iso->text()); | ||
2488 | } | ||||
2489 | else if (GainSpin && GainSpin->value() != -1 && | ||||
2490 | GainSpin->value() != GainSpinSpecialValue) | ||||
2491 | { | ||||
2492 | iso->setText(GainSpin->cleanText()); | ||||
2493 | jsonJob.insert("ISO/Gain", iso->text()); | ||||
2475 | } | 2494 | } | ||
2476 | else | 2495 | else | ||
2477 | { | 2496 | { | ||
2478 | iso->setText("--"); | 2497 | iso->setText("--"); | ||
2479 | jsonJob.insert("ISO", "--"); | 2498 | jsonJob.insert("ISO/Gain", "--"); | ||
2480 | } | 2499 | } | ||
2481 | iso->setTextAlignment(Qt::AlignHCenter); | 2500 | iso->setTextAlignment(Qt::AlignHCenter); | ||
2482 | iso->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); | 2501 | iso->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); | ||
2483 | 2502 | | |||
2484 | QTableWidgetItem * count = m_JobUnderEdit ? queueTable->item(currentRow, 6) : new QTableWidgetItem(); | 2503 | QTableWidgetItem * count = m_JobUnderEdit ? queueTable->item(currentRow, 6) : new QTableWidgetItem(); | ||
2485 | job->setCountCell(count); | 2504 | job->setCountCell(count); | ||
2486 | jsonJob.insert("Count", count->text()); | 2505 | jsonJob.insert("Count", count->text()); | ||
2487 | 2506 | | |||
▲ Show 20 Lines • Show All 1298 Lines • ▼ Show 20 Line(s) | 3803 | { | |||
3786 | numbers[name] = cLocale.toDouble(pcdataXMLEle(oneNumber)); | 3805 | numbers[name] = cLocale.toDouble(pcdataXMLEle(oneNumber)); | ||
3787 | } | 3806 | } | ||
3788 | 3807 | | |||
3789 | const char * name = findXMLAttValu(subEP, "name"); | 3808 | const char * name = findXMLAttValu(subEP, "name"); | ||
3790 | propertyMap[name] = numbers; | 3809 | propertyMap[name] = numbers; | ||
3791 | } | 3810 | } | ||
3792 | 3811 | | |||
3793 | customPropertiesDialog->setCustomProperties(propertyMap); | 3812 | customPropertiesDialog->setCustomProperties(propertyMap); | ||
3813 | const double gain = getGain(); | ||||
3814 | if (gain != -1) GainSpin->setValue(gain); | ||||
3794 | } | 3815 | } | ||
3795 | else if (!strcmp(tagXMLEle(ep), "Calibration")) | 3816 | else if (!strcmp(tagXMLEle(ep), "Calibration")) | ||
3796 | { | 3817 | { | ||
3797 | subEP = findXMLEle(ep, "FlatSource"); | 3818 | subEP = findXMLEle(ep, "FlatSource"); | ||
3798 | if (subEP) | 3819 | if (subEP) | ||
3799 | { | 3820 | { | ||
3800 | XMLEle * typeEP = findXMLEle(subEP, "Type"); | 3821 | XMLEle * typeEP = findXMLEle(subEP, "Type"); | ||
3801 | if (typeEP) | 3822 | if (typeEP) | ||
▲ Show 20 Lines • Show All 360 Lines • ▼ Show 20 Line(s) | 4144 | { | |||
4162 | preMountPark = job->isPreMountPark(); | 4183 | preMountPark = job->isPreMountPark(); | ||
4163 | preDomePark = job->isPreDomePark(); | 4184 | preDomePark = job->isPreDomePark(); | ||
4164 | 4185 | | |||
4165 | // Custom Properties | 4186 | // Custom Properties | ||
4166 | customPropertiesDialog->setCustomProperties(job->getCustomProperties()); | 4187 | customPropertiesDialog->setCustomProperties(job->getCustomProperties()); | ||
4167 | 4188 | | |||
4168 | if (ISOCombo) | 4189 | if (ISOCombo) | ||
4169 | ISOCombo->setCurrentIndex(job->getISOIndex()); | 4190 | ISOCombo->setCurrentIndex(job->getISOIndex()); | ||
4170 | if (GainSpin) | 4191 | | ||
4171 | { | | |||
4172 | double value = getGain(); | 4192 | double value = getGain(); | ||
4173 | if (value > 0) | 4193 | if (value != -1) | ||
4174 | GainSpin->setValue(value); | 4194 | GainSpin->setValue(value); | ||
4175 | } | 4195 | else GainSpin->setValue(GainSpinSpecialValue); | ||
4176 | 4196 | | |||
4177 | transferFormatCombo->setCurrentIndex(job->getTransforFormat()); | 4197 | transferFormatCombo->setCurrentIndex(job->getTransforFormat()); | ||
4178 | 4198 | | |||
4179 | if (job->getTargetRotation() != Ekos::INVALID_VALUE) | 4199 | if (job->getTargetRotation() != Ekos::INVALID_VALUE) | ||
4180 | { | 4200 | { | ||
4181 | rotatorSettings->setRotationEnforced(true); | 4201 | rotatorSettings->setRotationEnforced(true); | ||
4182 | rotatorSettings->setTargetRotationPA(job->getTargetRotation()); | 4202 | rotatorSettings->setTargetRotationPA(job->getTargetRotation()); | ||
4183 | } | 4203 | } | ||
4184 | else | 4204 | else | ||
4185 | rotatorSettings->setRotationEnforced(false); | 4205 | rotatorSettings->setRotationEnforced(false); | ||
4186 | 4206 | | |||
4187 | emit settingsUpdated(getSettings()); | 4207 | emit settingsUpdated(getSettings()); | ||
4188 | } | 4208 | } | ||
4189 | 4209 | | |||
4190 | QJsonObject Capture::getSettings() | 4210 | QJsonObject Capture::getSettings() | ||
4191 | { | 4211 | { | ||
4192 | QJsonObject settings; | 4212 | QJsonObject settings; | ||
4193 | 4213 | | |||
4194 | // Try to get settings value | 4214 | // Try to get settings value | ||
4195 | // if not found, fallback to camera value | 4215 | // if not found, fallback to camera value | ||
4196 | double gain = -1; | 4216 | double gain = -1; | ||
4197 | if (GainSpin) | 4217 | if (GainSpin && GainSpin->value() != GainSpinSpecialValue) | ||
4198 | gain = GainSpin->value(); | 4218 | gain = GainSpin->value(); | ||
4199 | else if (currentCCD && currentCCD->hasGain()) | 4219 | else if (currentCCD && currentCCD->hasGain()) | ||
4200 | currentCCD->getGain(&gain); | 4220 | currentCCD->getGain(&gain); | ||
4201 | 4221 | | |||
4202 | int iso = -1; | 4222 | int iso = -1; | ||
4203 | if (ISOCombo) | 4223 | if (ISOCombo) | ||
4204 | iso = ISOCombo->currentIndex(); | 4224 | iso = ISOCombo->currentIndex(); | ||
4205 | else if (currentCCD) | 4225 | else if (currentCCD) | ||
▲ Show 20 Lines • Show All 2379 Lines • ▼ Show 20 Line(s) | 6602 | { | |||
6585 | customProps["CCD_CONTROLS"] = ccdGain; | 6605 | customProps["CCD_CONTROLS"] = ccdGain; | ||
6586 | } | 6606 | } | ||
6587 | 6607 | | |||
6588 | customPropertiesDialog->setCustomProperties(customProps); | 6608 | customPropertiesDialog->setCustomProperties(customProps); | ||
6589 | } | 6609 | } | ||
6590 | 6610 | | |||
6591 | double Capture::getGain() | 6611 | double Capture::getGain() | ||
6592 | { | 6612 | { | ||
6613 | if (!GainSpin) return -1; | ||||
6614 | | ||||
6593 | QMap<QString, QMap<QString, double> > customProps = customPropertiesDialog->getCustomProperties(); | 6615 | QMap<QString, QMap<QString, double> > customProps = customPropertiesDialog->getCustomProperties(); | ||
6594 | 6616 | | |||
6595 | // Gain is manifested in two forms | 6617 | // Gain is manifested in two forms | ||
6596 | // Property CCD_GAIN and | 6618 | // Property CCD_GAIN and | ||
6597 | // Part of CCD_CONTROLS properties. | 6619 | // Part of CCD_CONTROLS properties. | ||
6598 | // Therefore, we have to find what the currently camera supports first. | 6620 | // Therefore, we have to find what the currently camera supports first. | ||
6599 | if (currentCCD->getProperty("CCD_GAIN")) | 6621 | if (currentCCD->getProperty("CCD_GAIN")) | ||
6600 | { | 6622 | { | ||
Show All 11 Lines |
Shouldn't this be 'i18n("--")' instead of 'tr("--"))'?