File indexing completed on 2024-04-28 15:09:13

0001 /*
0002     SPDX-FileCopyrightText: 2017 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003     SPDX-FileCopyrightText: 2017 Robert Lancaster <rlancaste@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "ui_stellarsolverprofileeditor.h"
0011 #include "parameters.h"
0012 #include "stellarsolverprofile.h"
0013 
0014 
0015 #include <QWidget>
0016 #include <QDir>
0017 
0018 class KConfigDialog;
0019 
0020 namespace Ekos
0021 {
0022 class Align;
0023 
0024 class StellarSolverProfileEditor : public QWidget, public Ui::StellarSolverProfileEditor
0025 {
0026         Q_OBJECT
0027 
0028     public:
0029         void setProfileGroup(ProfileGroup group);
0030 
0031         explicit StellarSolverProfileEditor(QWidget *parent, ProfileGroup group, KConfigDialog *dialog);
0032         virtual ~StellarSolverProfileEditor() override = default;
0033 
0034         //These functions handle the settings for the Sextractors and Solvers
0035         SSolver::Parameters getSettingsFromUI();
0036         void sendSettingsToUI(SSolver::Parameters a);
0037 
0038         //These functions save and load the settings of the program.
0039         void openSingleProfile();
0040         void saveSingleProfile();
0041         void copySingleProfile();
0042         void loadProfiles();
0043         void saveProfiles();
0044         void loadOptionsProfile();
0045         void loadOptionsProfileIgnoreOldSettings(int index);
0046         void saveBackupProfiles();
0047         void openBackupProfiles();
0048         QList<SSolver::Parameters> getDefaultProfiles();
0049         void loadDefaultProfiles();
0050 
0051         void connectOptionsProfileComboBox();
0052         void disconnectOptionsProfileComboBox();
0053     public slots:
0054         void loadProfile(const QString &profile);
0055     signals:
0056         void optionsProfilesUpdated();
0057     protected:
0058 
0059     private slots:
0060 
0061         void slotApply();
0062 
0063 
0064     private:
0065         QString savedOptionsProfiles;
0066         int openOptionsProfileNum = 0;
0067         void settingJustChanged();
0068         QString dirPath = QDir::homePath();
0069         QList<SSolver::Parameters> optionsList;
0070         bool optionsAreSaved = true;
0071         KConfigDialog *m_ConfigDialog { nullptr };
0072 
0073         ProfileGroup selectedProfileGroup = AlignProfiles;
0074 };
0075 }