7#include "darklibrary.h"
10#include "ekos/manager.h"
11#include "ekos/capture/capture.h"
12#include "ekos/capture/sequencejob.h"
13#include "ekos/auxiliary/opticaltrainmanager.h"
14#include "ekos/auxiliary/profilesettings.h"
15#include "ekos/auxiliary/opticaltrainsettings.h"
18#include "kstarsdata.h"
19#include "fitsviewer/fitsdata.h"
20#include "fitsviewer/fitsview.h"
22#include <QDesktopServices>
24#include <QSqlTableModel>
31DarkLibrary *DarkLibrary::_DarkLibrary =
nullptr;
33DarkLibrary *DarkLibrary::Instance()
35 if (_DarkLibrary ==
nullptr)
36 _DarkLibrary =
new DarkLibrary(Manager::Instance());
46 m_StatusLabel =
new QLabel(
i18n(
"Idle"),
this);
47 m_FileLabel =
new QLabel(
this);
50 m_StatusBar->insertPermanentWidget(0, m_StatusLabel);
51 m_StatusBar->insertPermanentWidget(1, m_FileLabel, 1);
52 mainLayout->addWidget(m_StatusBar);
59 m_DebounceTimer.setInterval(500);
60 m_DebounceTimer.setSingleShot(
true);
70 loadIndexInView(index.
row());
77 if (selectionModel->hasSelection())
79 auto index = selectionModel->currentIndex().row();
90 if (m_DarkFrameFutureWatcher.result())
92 m_DarkView->loadData(m_CurrentDarkFrame);
93 loadCurrentMasterDefectMap();
94 populateMasterMetedata();
97 m_FileLabel->setText(
i18n(
"Failed to load %1: %2", m_MasterDarkFrameFilename, m_CurrentDarkFrame->getLastError()));
104 DarkLibrary::loadCurrentMasterDark(m_Camera->getDeviceName(), index);
114 countDarkTotalTime();
119 countDarkTotalTime();
125 countDarkTotalTime();
129#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
131 this, [
this](
int,
bool)
134 this, [
this](
int,
bool)
137 countDarkTotalTime();
143 KStarsData::Instance()->userdb()->GetAllDarkFrames(m_DarkFramesDatabaseList);
149 m_DarkView->setDefectMapEnabled(index == 1 && m_CurrentDefectMap);
155 if (m_CurrentDefectMap)
156 m_CurrentDefectMap->setProperty(
"HotEnabled", toggled);
160 if (m_CurrentDefectMap)
161 m_CurrentDefectMap->setProperty(
"ColdEnabled", toggled);
165 if (m_CurrentDefectMap)
169 m_CurrentDefectMap->filterPixels();
170 emit newFrame(m_DarkView);
175 if (m_CurrentDefectMap)
179 m_CurrentDefectMap->setProperty(
"HotPixelAggressiveness", 75);
180 m_CurrentDefectMap->setProperty(
"ColdPixelAggressiveness", 75);
181 m_CurrentDefectMap->filterPixels();
188 m_RememberFITSViewer = Options::useFITSViewer();
189 m_RememberSummaryView = Options::useSummaryPreview();
192 loadGlobalSettings();
196 setupOpticalTrainManager();
199DarkLibrary::~DarkLibrary()
206void DarkLibrary::refreshFromDB()
208 KStarsData::Instance()->userdb()->GetAllDarkFrames(m_DarkFramesDatabaseList);
217 for (
auto &map : m_DarkFramesDatabaseList)
220 if (map[
"ccd"].toString() == m_TargetChip->getCCD()->getDeviceName() &&
221 map[
"chip"].toInt() ==
static_cast<int>(m_TargetChip->getType()))
224 int gain = getGain();
225 if (gain >= 0 && map[
"gain"].toInt() != gain)
230 if (m_TargetChip->getISOValue(
isoValue) && map[
"iso"].toString() !=
isoValue)
235 m_TargetChip->getBinning(&
binX, &
binY);
238 if (map[
"binX"].toInt() !=
binX || map[
"binY"].toInt() !=
binY)
242 if (m_TargetChip->getCCD()->hasCoolerControl())
244 double temperature = 0;
245 m_TargetChip->getCCD()->getTemperature(&temperature);
265 if (m_TargetChip->getCCD()->hasCooler())
267 double temperature = 0;
268 m_TargetChip->getCCD()->getTemperature(&temperature);
269 double diffMap = std::fabs(temperature - map[
"temperature"].toDouble());
280 double diffMap = std::fabs(map[
"duration"].toDouble() - duration);
291 int64_t
diffMap = map[
"timestamp"].toDateTime().secsTo(
now);
309 emit i18n(
"Using available dark frame with %1 seconds exposure. Please take a dark frame with %1 seconds exposure for more accurate results.",
319 emit i18n(
"Dark frame %s is expired. Please create new master dark.", filename);
323 if (m_CachedDarkFrames.contains(filename))
325 darkData = m_CachedDarkFrames[filename];
330 auto memoryMB = KSUtils::getAvailableRAM() / 1e6;
332 m_CachedDarkFrames.clear();
335 if (cacheDarkFrameFromFile(filename))
337 darkData = m_CachedDarkFrames[filename];
342 emit newLog(
i18n(
"Removing bad dark frame file %1", filename));
343 m_CachedDarkFrames.remove(filename);
345 KStarsData::Instance()->userdb()->DeleteDarkFrame(filename);
356 for (
auto &map : m_DarkFramesDatabaseList)
358 if (map[
"defectmap"].toString().isEmpty())
362 if (map[
"ccd"].toString() == m_TargetChip->getCCD()->getDeviceName() &&
363 map[
"chip"].toInt() ==
static_cast<int>(m_TargetChip->getType()))
366 m_TargetChip->getBinning(&
binX, &
binY);
369 if (map[
"binX"].toInt() ==
binX && map[
"binY"].toInt() ==
binY)
384 if (m_TargetChip->getCCD()->hasCooler())
386 double temperature = 0;
387 m_TargetChip->getCCD()->getTemperature(&temperature);
388 double diffMap = std::fabs(temperature - map[
"temperature"].toDouble());
398 double diffMap = std::fabs(map[
"duration"].toDouble() - duration);
446bool DarkLibrary::cacheDefectMapFromFile(
const QString &key,
const QString &filename)
449 oneMap.reset(
new DefectMap());
451 if (
oneMap->load(filename))
454 m_CachedDefectMaps[key] =
oneMap;
458 emit newLog(
i18n(
"Failed to load defect map file %1", filename));
465bool DarkLibrary::cacheDarkFrameFromFile(
const QString &filename)
471 rc.waitForFinished();
474 m_CachedDarkFrames[filename] = data;
478 emit newLog(
i18n(
"Failed to load dark frame file %1", filename));
490 if (job->getStatus() == JOB_IDLE)
493 if (job->getCompleted() == job->getCoreProperty(SequenceJob::SJ_Count).toInt())
497 {
"camera", m_Camera->getDeviceName()},
498 {
"chip", m_TargetChip->getType()},
499 {
"binx", job->getCoreProperty(SequenceJob::SJ_Binning).toPoint().x()},
500 {
"biny", job->getCoreProperty(SequenceJob::SJ_Binning).toPoint().y()},
501 {
"duration", job->getCoreProperty(SequenceJob::SJ_Exposure).toDouble()}
506 bool success = m_Camera->getTemperature(&value);
508 metadata[
"temperature"] = value;
510 success = m_Camera->hasGain() && m_Camera->getGain(&value);
512 metadata[
"gain"] = value;
515 success = m_TargetChip->getISOValue(
isoValue);
519 metadata[
"count"] = job->getCoreProperty(SequenceJob::SJ_Count).toInt();
520 generateMasterFrame(m_CurrentDarkFrame, metadata);
521 reloadDarksFromDatabase();
522 populateMasterMetedata();
529void DarkLibrary::updateProperty(INDI::Property
prop)
534 auto bp =
prop.getBLOB()->at(0);
536 if (!m_CurrentDarkFrame->loadFromBuffer(buffer, bp->getFormat()))
538 m_FileLabel->setText(
i18n(
"Failed to process dark data."));
542 if (!m_DarkView->loadData(m_CurrentDarkFrame))
544 m_FileLabel->setText(
i18n(
"Failed to load dark data."));
548 uint32_t
totalElements = m_CurrentDarkFrame->channels() * m_CurrentDarkFrame->samplesPerChannel();
552 aggregate(m_CurrentDarkFrame);
560void DarkLibrary::Release()
562 delete (_DarkLibrary);
563 _DarkLibrary =
nullptr;
576 Options::setUseFITSViewer(m_RememberFITSViewer);
577 Options::setUseSummaryPreview(m_RememberSummaryView);
580 m_JobsGenerated =
false;
581 m_CaptureModule->clearSequenceQueue();
582 m_CaptureModule->setAllSettings(m_CaptureModuleSettings);
589void DarkLibrary::setCompleted()
592 stopB->setEnabled(
false);
594 Options::setUseFITSViewer(m_RememberFITSViewer);
595 Options::setUseSummaryPreview(m_RememberSummaryView);
598 m_JobsGenerated =
false;
599 m_CaptureModule->clearSequenceQueue();
600 m_CaptureModule->setAllSettings(m_CaptureModuleSettings);
603 m_Camera->disconnect(
this);
604 m_CaptureModule->disconnect(
this);
610void DarkLibrary::clearExpired()
612 if (darkFramesModel->rowCount() == 0)
623 darkframe.setFilter(
"ccd LIKE \'" + m_Camera->getDeviceName() +
"\' AND timestamp < \'" +
expiredDate.toString(
629 for (
int i = 0; i <
darkframe.rowCount(); ++i)
643 Ekos::DarkLibrary::Instance()->refreshFromDB();
645 reloadDarksFromDatabase();
651void DarkLibrary::clearBuffers()
653 m_CurrentDarkFrame.clear();
656 m_DarkView->clearData();
657 m_CurrentDefectMap.clear();
663void DarkLibrary::clearAll()
665 if (darkFramesModel->rowCount() == 0)
669 i18n(
"Are you sure you want to delete all dark frames images and data?")) ==
674 for (
int i = 0; i < darkFramesModel->rowCount(); ++i)
676 QString oneFile = darkFramesModel->record(i).value(
"filename").toString();
678 QString defectMap = darkFramesModel->record(i).value(
"defectmap").toString();
681 darkFramesModel->removeRow(i);
685 darkFramesModel->submitAll();
689 reloadDarksFromDatabase();
695void DarkLibrary::clearRow(
int index)
700 QSqlRecord record = darkFramesModel->record(index);
707 KStarsData::Instance()->userdb()->DeleteDarkFrame(filename);
709 reloadDarksFromDatabase();
715void DarkLibrary::openDarksFolder()
725void DarkLibrary::refreshDefectMastersList(
const QString &camera)
727 if (darkFramesModel->rowCount() == 0)
733 for (
int i = 0; i < darkFramesModel->rowCount(); ++i)
735 QSqlRecord record = darkFramesModel->record(i);
737 if (record.
value(
"ccd") != camera)
753 if (temperature > INVALID_VALUE)
772void DarkLibrary::reloadDarksFromDatabase()
776 const QString camera = m_Camera->getDeviceName();
778 delete (darkFramesModel);
782 darkFramesModel->setTable(
"darkframe");
783 darkFramesModel->setFilter(
QString(
"ccd='%1'").arg(camera));
784 darkFramesModel->select();
787 sortFilter->setSourceModel(darkFramesModel);
788 sortFilter->sort (0);
797 if (darkFramesModel->rowCount() == 0 && m_CurrentDarkFrame)
803 refreshDefectMastersList(camera);
804 loadCurrentMasterDark(camera);
813 if (darkFramesModel->rowCount() == 0)
823 if (record.
value(
"ccd") != camera)
826 m_MasterDarkFrameFilename = record.
value(
"filename").
toString();
828 if (m_MasterDarkFrameFilename.isEmpty() || !
QFileInfo::exists(m_MasterDarkFrameFilename))
835 if (m_CurrentDarkFrame->filename() != m_MasterDarkFrameFilename)
836 m_DarkFrameFutureWatcher.setFuture(m_CurrentDarkFrame->loadFromFile(m_MasterDarkFrameFilename));
839 loadCurrentMasterDefectMap();
845void DarkLibrary::loadCurrentMasterDefectMap()
848 if (m_CachedDefectMaps.contains(m_MasterDarkFrameFilename))
850 if (m_CurrentDefectMap != m_CachedDefectMaps.value(m_MasterDarkFrameFilename))
852 m_CurrentDefectMap = m_CachedDefectMaps.value(m_MasterDarkFrameFilename);
853 m_DarkView->setDefectMap(m_CurrentDefectMap);
854 m_CurrentDefectMap->setDarkData(m_CurrentDarkFrame);
860 m_CurrentDefectMap.reset(
new DefectMap());
861 connect(m_CurrentDefectMap.data(), &DefectMap::pixelsUpdated,
this, [
this](uint32_t
hot, uint32_t
cold)
863 hotPixelsCount->setValue(hot);
864 coldPixelsCount->setValue(cold);
865 aggresivenessHotSlider->setValue(m_CurrentDefectMap->property(
"HotPixelAggressiveness").toInt());
866 aggresivenessColdSlider->setValue(m_CurrentDefectMap->property(
"ColdPixelAggressiveness").toInt());
869 if (!m_DefectMapFilename.isEmpty())
870 cacheDefectMapFromFile(m_MasterDarkFrameFilename, m_DefectMapFilename);
872 m_DarkView->setDefectMap(m_CurrentDefectMap);
873 m_CurrentDefectMap->setDarkData(m_CurrentDarkFrame);
880void DarkLibrary::populateMasterMetedata()
882 if (m_CurrentDarkFrame.isNull())
887 if (m_CurrentDarkFrame->getRecordValue(
"DATE-OBS", value))
890 if (m_CurrentDarkFrame->getRecordValue(
"CCD-TEMP", value) && value.
toDouble() < 100)
893 if (m_CurrentDarkFrame->getRecordValue(
"EXPTIME", value))
897 double median = m_CurrentDarkFrame->getAverageMedian();
903 double mean = m_CurrentDarkFrame->getAverageMean();
908 double stddev = m_CurrentDarkFrame->getAverageStdDev();
919void DarkLibrary::loadIndexInView(
int row)
921 QSqlRecord record = darkFramesModel->record(row);
924 if (m_DarkView->imageData().isNull() || m_DarkView->imageData()->filename() != filename)
925 m_DarkView->loadFile(filename);
933 if (m_Camera == device)
937 m_Camera->disconnect(
this);
963 if (m_Camera && m_Camera->getDeviceName() == device->getDeviceName())
965 m_Camera->disconnect(
this);
973void DarkLibrary::checkCamera()
978 auto device = m_Camera->getDeviceName();
980 m_TargetChip =
nullptr;
983 if (device.contains(
"Guider"))
985 m_UseGuideHead =
true;
986 m_TargetChip = m_Camera->getChip(ISD::CameraChip::GUIDE_CCD);
989 if (m_TargetChip ==
nullptr)
991 m_UseGuideHead =
false;
992 m_TargetChip = m_Camera->getChip(ISD::CameraChip::PRIMARY_CCD);
997 if (!m_TargetChip || !m_TargetChip->getCCD() || m_TargetChip->isCapturing())
1000 if (m_Camera->hasCoolerControl())
1010 double temperature = 0;
1012 if (m_Camera->getTemperature(&temperature))
1042 captureISOS->setCurrentIndex(m_TargetChip->getISOIndex());
1047 if (m_Camera->hasGain())
1050 m_Camera->getGainMinMaxStep(&min, &max, &step);
1053 GainSpinSpecialValue = min - step;
1058 m_Camera->getGain(&value);
1074 countDarkTotalTime();
1081void DarkLibrary::countDarkTotalTime()
1113void DarkLibrary::generateDarkJobs()
1116 m_CaptureModule->clearSequenceQueue();
1118 if (m_JobsGenerated ==
false)
1120 m_JobsGenerated =
true;
1121 m_CaptureModuleSettings = m_CaptureModule->getAllSettings();
1134 m_CaptureModule->setForceTemperature(
true);
1139 m_CaptureModule->setForceTemperature(
false);
1170 QVariantMap settings;
1174 settings[
"captureBinHN"] =
oneBin;
1175 settings[
"captureFormatS"] =
"Dark";
1180 settings[
"captureISOS"] =
captureISOS->currentText();
1182 settings[
"fileDirectoryT"] =
QString(prefix +
QString(
"sequence_%1").arg(sequence));
1183 settings[
"captureCountN"] =
countSpin->value();
1185 m_CaptureModule->setAllSettings(settings);
1186 m_CaptureModule->createJob();
1195void DarkLibrary::execute()
1197 m_DarkImagesCounter = 0;
1204 Options::setUseFITSViewer(
false);
1205 Options::setUseSummaryPreview(
false);
1206 startB->setEnabled(
false);
1207 stopB->setEnabled(
true);
1208 m_DarkView->reset();
1209 m_StatusLabel->setText(
i18n(
"In progress..."));
1210 m_CaptureModule->start();
1217void DarkLibrary::stop()
1219 m_CaptureModule->abort();
1221 m_DarkView->reset();
1227void DarkLibrary::initView()
1232 m_DarkView->createFloatingToolBar();
1234 vlayout->addWidget(m_DarkView.get());
1236 connect(m_DarkView.get(), &DarkView::loaded,
this, [
this]()
1238 emit newImage(m_DarkView->imageData());
1247 switch (data->dataType())
1289template <
typename T>
1292 T
const *
darkBuffer =
reinterpret_cast<T
const*
>(data->getImageBuffer());
1293 for (uint32_t i = 0; i < m_DarkMasterBuffer.size(); i++)
1302 switch (data->dataType())
1340 emit newImage(data);
1342 m_DarkMasterBuffer.assign(m_DarkMasterBuffer.size(), 0);
1352 T *
writableBuffer =
reinterpret_cast<T *
>(data->getWritableImageBuffer());
1353 const uint32_t count = metadata[
"count"].toInt();
1355 for (uint32_t i = 0; i < m_DarkMasterBuffer.size(); i++)
1362 data->calculateStats(
true);
1363 if (!data->saveImage(path))
1365 m_FileLabel->setText(
i18n(
"Failed to save master frame: %1", data->getLastError()));
1369 auto memoryMB = KSUtils::getAvailableRAM() / 1e6;
1371 cacheDarkFrameFromFile(data->filename());
1374 map[
"ccd"] = metadata[
"camera"].toString();
1375 map[
"chip"] = metadata[
"chip"].toInt();
1376 map[
"binX"] = metadata[
"binx"].toInt();
1377 map[
"binY"] = metadata[
"biny"].toInt();
1378 map[
"temperature"] = metadata[
"temperature"].toDouble(INVALID_VALUE);
1379 map[
"gain"] = metadata[
"gain"].toInt(-1);
1380 map[
"iso"] = metadata[
"iso"].toString();
1381 map[
"duration"] = metadata[
"duration"].toDouble();
1385 m_DarkFramesDatabaseList.
append(map);
1386 m_FileLabel->setText(
i18n(
"Master Dark saved to %1", path));
1387 KStarsData::Instance()->userdb()->AddDarkFrame(map);
1393void DarkLibrary::setCaptureModule(Capture *instance)
1395 m_CaptureModule = instance;
1401void DarkLibrary::setCaptureState(CaptureState state)
1407 m_StatusLabel->setText(
i18n(
"Capture aborted."));
1411 m_StatusLabel->setText(
i18n(
"Capture completed."));
1421void DarkLibrary::saveDefectMap()
1423 if (!m_CurrentDarkFrame)
1426 QString filename = m_CurrentDefectMap->filename();
1427 bool newFile =
false;
1436 if (m_CurrentDefectMap->save(filename, m_Camera->getDeviceName()))
1438 m_FileLabel->setText(
i18n(
"Defect map saved to %1", filename));
1442 auto currentMap = std::find_if(m_DarkFramesDatabaseList.begin(),
1443 m_DarkFramesDatabaseList.end(), [&](
const QVariantMap &
oneMap)
1445 return oneMap[
"filename"].toString() == m_CurrentDarkFrame->filename();
1448 if (
currentMap != m_DarkFramesDatabaseList.end())
1450 (*currentMap)[
"defectmap"] = filename;
1452 KStarsData::Instance()->userdb()->UpdateDarkFrame(*
currentMap);
1458 m_FileLabel->setText(
i18n(
"Failed to save defect map to %1", filename));
1465void DarkLibrary::start()
1474void DarkLibrary::setCameraPresets(
const QJsonObject &settings)
1476 const auto opticalTrain = settings[
"optical_train"].toString();
1483 reloadDarksFromDatabase();
1496 {
"fileName", m_FileLabel->text()}
1508 for(
int i = 0; i < darkFramesModel->rowCount(); i++)
1510 QSqlRecord record = darkFramesModel->record(i);
1525 {
"temperature", temperature},
1526 {
"duaration", duration},
1543void DarkLibrary::setDefectPixels(
const QJsonObject &payload)
1545 const auto hotSpin = payload[
"hotSpin"].toInt();
1546 const auto coldSpin = payload[
"coldSpin"].toInt();
1547 const auto hotEnabled = payload[
"hotEnabled"].toBool(
hotPixelsEnabled->isChecked());
1548 const auto coldEnabled = payload[
"coldEnabled"].toBool(
coldPixelsEnabled->isChecked());
1556 m_DarkView->ZoomDefault();
1558 setDefectMapEnabled(
true);
1565void DarkLibrary::setDefectMapEnabled(
bool enabled)
1567 m_DarkView->setDefectMapEnabled(enabled);
1573double DarkLibrary::getGain()
1579 auto gain = m_Camera->getProperty(
"CCD_GAIN");
1581 return gain.getNumber()->at(0)->value;
1584 auto controls = m_Camera->getProperty(
"CCD_CONTROLS");
1587 auto oneGain = controls.getNumber()->findWidgetByName(
"Gain");
1598void DarkLibrary::setupOpticalTrainManager()
1600 connect(OpticalTrainManager::Instance(), &OpticalTrainManager::updated,
this, &DarkLibrary::refreshOpticalTrain);
1607 ProfileSettings::Instance()->setOneSetting(ProfileSettings::DarkLibraryOpticalTrain,
1609 refreshOpticalTrain();
1610 emit trainChanged();
1617void DarkLibrary::refreshOpticalTrain()
1622 trainB->setEnabled(
true);
1624 QVariant trainID = ProfileSettings::Instance()->getOneSetting(ProfileSettings::DarkLibraryOpticalTrain);
1628 auto id = trainID.
toUInt();
1631 if (OpticalTrainManager::Instance()->exists(
id) ==
false)
1633 emit newLog(
i18n(
"Optical train doesn't exist for id %1",
id));
1637 auto name = OpticalTrainManager::Instance()->name(
id);
1641 auto camera = OpticalTrainManager::Instance()->getCamera(name);
1644 auto scope = OpticalTrainManager::Instance()->getScope(name);
1650 OpticalTrainSettings::Instance()->setOpticalTrainID(
id);
1651 auto settings = OpticalTrainSettings::Instance()->getOneSetting(OpticalTrainSettings::DarkLibrary);
1652 if (settings.isValid())
1655 if (map != m_Settings)
1656 setAllSettings(map);
1659 m_Settings = m_GlobalSettings;
1668void DarkLibrary::loadGlobalSettings()
1673 QVariantMap settings;
1677 if (
oneWidget->objectName() ==
"opticalTrainCombo")
1681 value = Options::self()->property(key.
toLatin1());
1685 settings[key] = value;
1693 value = Options::self()->property(key.
toLatin1());
1697 settings[key] = value;
1705 value = Options::self()->property(key.
toLatin1());
1709 settings[key] = value;
1717 value = Options::self()->property(key.
toLatin1());
1721 settings[key] = value;
1725 m_GlobalSettings = m_Settings = settings;
1732void DarkLibrary::connectSettings()
1761void DarkLibrary::disconnectSettings()
1788QVariantMap DarkLibrary::getAllSettings()
const
1790 QVariantMap settings;
1814void DarkLibrary::setAllSettings(
const QVariantMap &settings)
1818 disconnectSettings();
1820 for (
auto &name : settings.keys())
1826 syncControl(settings, name, comboBox);
1834 syncControl(settings, name, doubleSpinBox);
1842 syncControl(settings, name,
spinBox);
1850 syncControl(settings, name,
checkbox);
1864 for (
auto &key : settings.keys())
1866 auto value = settings[key];
1868 Options::self()->setProperty(key.
toLatin1(), value);
1870 m_Settings[key] = value;
1871 m_GlobalSettings[key] = value;
1874 emit settingsUpdated(getAllSettings());
1877 OpticalTrainSettings::Instance()->setOpticalTrainID(OpticalTrainManager::Instance()->
id(
opticalTrainCombo->currentText()));
1878 OpticalTrainSettings::Instance()->setOneSetting(OpticalTrainSettings::DarkLibrary, m_Settings);
1887bool DarkLibrary::syncControl(
const QVariantMap &settings,
const QString &key,
QWidget * widget)
1898 const int value = settings[key].toInt(&ok);
1901 pSB->setValue(value);
1907 const double value = settings[key].toDouble(&ok);
1910 pDSB->setValue(value);
1916 const bool value = settings[key].toBool();
1917 if (value !=
pCB->isChecked())
1924 const QString value = settings[key].toString();
1930 const bool value = settings[key].toBool();
1942void DarkLibrary::syncSettings()
1955 key =
dsb->objectName();
1956 value =
dsb->value();
1962 value = sb->
value();
1971 key =
cbox->objectName();
1972 value =
cbox->currentText();
1976 key =
cradio->objectName();
1981 Options::self()->setProperty(key.
toLatin1(), value);
1982 m_Settings[key] = value;
1983 m_GlobalSettings[key] = value;
1985 m_DebounceTimer.start();
1991void DarkLibrary::settleSettings()
1993 emit settingsUpdated(getAllSettings());
1994 Options::self()->save();
1996 OpticalTrainSettings::Instance()->setOpticalTrainID(OpticalTrainManager::Instance()->
id(
opticalTrainCombo->currentText()));
1997 OpticalTrainSettings::Instance()->setOneSetting(OpticalTrainSettings::DarkLibrary, m_Settings);
CameraChip class controls a particular chip in camera.
Camera class controls an INDI Camera device.
static KStars * Instance()
Sequence Job is a container for the details required to capture a series of images.
QString i18n(const char *text, const TYPE &arg...)
Ekos is an advanced Astrophotography tool for Linux.
QString path(const QString &relativePath)
QString name(StandardShortcut id)
void doubleClicked(const QModelIndex &index)
void valueChanged(int value)
QByteArray fromRawData(const char *data, qsizetype size)
void activated(int index)
void currentIndexChanged(int index)
QDateTime addDays(qint64 ndays) const const
QDateTime currentDateTime()
qint64 currentSecsSinceEpoch()
QString toString(QStringView format, QCalendar cal) const const
bool openUrl(const QUrl &url)
QString filePath(const QString &fileName) const const
bool exists() const const
void append(const QJsonValue &value)
QVariantMap toVariantMap() const const
QSqlDatabase database(const QString &connectionName, bool open)
QVariant value(const QString &name) const const
QString & append(QChar ch)
QString arg(Args &&... args) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
QByteArray toLatin1() const const
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
QUrl fromLocalFile(const QString &localFile)
bool isValid() const const
bool toBool() const const
double toDouble(bool *ok) const const
int toInt(bool *ok) const const
QString toString() const const
uint toUInt(bool *ok) const const