File indexing completed on 2024-05-12 03:44:32

0001 /*
0002     SPDX-FileCopyrightText: 2023 Joseph McGee <joseph.mcgee@sbcglobal.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #ifndef EXPOSURECALCULATORDIALOG_H
0010 #define EXPOSURECALCULATORDIALOG_H
0011 
0012 #include <QDialog>
0013 #include "optimalsubexposurecalculator.h"
0014 
0015 QT_BEGIN_NAMESPACE
0016 namespace Ui
0017 {
0018 class ExposureCalculatorDialog;
0019 }
0020 QT_END_NAMESPACE
0021 
0022 class ExposureCalculatorDialog : public QDialog
0023 {
0024         Q_OBJECT
0025 
0026     public:
0027         // ExposureCalculatorDialog(QWidget *parent = nullptr);
0028         ExposureCalculatorDialog(QWidget *parent = nullptr,
0029                                  double aPreferredSkyQualityValue = 20.0,
0030                                  double aPreferredFocalRatioValue = 5.0,
0031                                  const QString &aPreferredCameraId = "");
0032 
0033         ~ExposureCalculatorDialog();
0034 
0035     public slots:
0036         void applyInitialInputs();  // This method is acting as a "fill-in" for initiating the calculator with data from KStars ekos/indi
0037         void handleUserAdjustment();  // Change to gain, does not change exposure envelope, but does require recalculation of shot
0038         void handleStackCalculation();
0039 
0040     private slots:
0041         void on_downloadCameraB_clicked();
0042 
0043     private:
0044         Ui::ExposureCalculatorDialog *ui;
0045 
0046         OptimalExposure::OptimalSubExposureCalculator *anOptimalSubExposureCalculator;
0047         OptimalExposure::ImagingCameraData *anImagingCameraData;
0048 
0049         void initializeSubExposureCalculator(double aNoiseTolerance,  double aSkyQualityValue, double aFocalRatioValue,
0050                                              double aFilterCompensationValue, QString aSelectedImagingCamera);
0051         void calculateSubExposure(double aNoiseTolerance, double aSkyQualityValue, double aFocalRatioValue,
0052                                   double aFilterCompensationValue, int aSelectedReadMode, int aSelectedGainValue);
0053 
0054         int getGainSelection(OptimalExposure::GainSelectionType aGainSelectionType);
0055         QColor makeASkyQualityColor(double anSQMValue);
0056 
0057         double aPreferredSkyQualityValue;
0058         double aPreferredFocalRatioValue;
0059         QString aPreferredCameraId;
0060 
0061         void refreshCameraSelector(Ui::ExposureCalculatorDialog *ui, QStringList availableCameraFileNames,
0062                                    const QString aPreferredCameraId);
0063 
0064         void hideGainSelectionWidgets();
0065         void showGainSelectionFixedWidgets();
0066         void showGainSelectionNormalWidgets();
0067         void showGainSelectionISODiscreteWidgets();
0068 
0069 
0070 };
0071 #endif // EXPOSURECALCULATORDIALOG_H