summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-28 06:16:12 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-28 06:16:12 (GMT)
commitac085a82d59a55054fc5b2919d27bfb805b4d2ae (patch)
tree300e947215e2c0457cf492640ae1eb3ca707c41c
parent1de2e0523bd8479f9941ae770cece003d28e5449 (diff)
More progress on guide and calibration options
-rw-r--r--kstars/CMakeLists.txt2
-rw-r--r--kstars/ekos/guide/guide.cpp5
-rw-r--r--kstars/ekos/guide/guide.h2
-rw-r--r--kstars/ekos/guide/guide.ui45
-rw-r--r--kstars/ekos/guide/opscalibration.ui29
-rw-r--r--kstars/ekos/guide/opsguide.cpp108
-rw-r--r--kstars/ekos/guide/opsguide.h53
-rw-r--r--kstars/ekos/guide/opsguide.ui111
-rw-r--r--kstars/kstars.kcfg4
9 files changed, 311 insertions, 48 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 1f028e5..eba43b5 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -135,6 +135,7 @@ if (INDI_FOUND)
# Guide
ekos/guide/guide.ui
ekos/guide/opscalibration.ui
+ ekos/guide/opsguide.ui
#TODO remove from GIT
#ekos/guide/guider.ui
#ekos/guide/rcalibration.ui
@@ -180,6 +181,7 @@ if (INDI_FOUND)
ekos/guide/guideinterface.cpp
ekos/guide/scroll_graph.cpp
ekos/guide/opscalibration.cpp
+ ekos/guide/opsguide.cpp
# Internal Guide
ekos/guide/internalguide/common.cpp
ekos/guide/internalguide/gmath.cpp
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index 63a097b..15b1cad 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -20,6 +20,7 @@
#include "Options.h"
#include "opscalibration.h"
+#include "opsguide.h"
#include "internalguide/internalguider.h"
#include "scroll_graph.h"
@@ -161,7 +162,9 @@ Guide::Guide() : QWidget()
KConfigDialog* dialog = new KConfigDialog(this, "guidesettings", Options::self());
opsCalibration = new OpsCalibration(dynamic_cast<InternalGuider*>(guider));
dialog->addPage(opsCalibration, i18n("Calibration Settings"));
- connect(calibrationOptionsB, SIGNAL(clicked()), dialog, SLOT(show()));
+ opsGuide = new OpsGuide(dynamic_cast<InternalGuider*>(guider));
+ dialog->addPage(opsGuide, i18n("Guide Settings"));
+ connect(guideOptionsB, SIGNAL(clicked()), dialog, SLOT(show()));
}
break;
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index ca484d1..9bd909d 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -36,6 +36,7 @@ namespace Ekos
class GuideInterface;
class OpsCalibration;
+class OpsGuide;
/**
*@class Guide
@@ -354,6 +355,7 @@ private:
// Options
OpsCalibration *opsCalibration;
+ OpsGuide *opsGuide;
};
diff --git a/kstars/ekos/guide/guide.ui b/kstars/ekos/guide/guide.ui
index a299488..13326b1 100644
--- a/kstars/ekos/guide/guide.ui
+++ b/kstars/ekos/guide/guide.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>702</width>
- <height>513</height>
+ <width>696</width>
+ <height>508</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -64,20 +64,23 @@
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QPushButton" name="calibrationOptionsB">
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="darkFrameCheck">
+ <property name="toolTip">
+ <string>Subtract dark frame. If no dark frame is available, a new dark frame shall be captured and saved for future use.</string>
+ </property>
<property name="text">
- <string>Options</string>
+ <string>Dark</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QPushButton" name="guideB">
- <property name="enabled">
- <bool>false</bool>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="subFrameCheck">
+ <property name="toolTip">
+ <string>Subframe the image around the guide star</string>
</property>
<property name="text">
- <string>Guide</string>
+ <string>Subframe</string>
</property>
</widget>
</item>
@@ -88,23 +91,23 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="darkFrameCheck">
- <property name="toolTip">
- <string>Subtract dark frame. If no dark frame is available, a new dark frame shall be captured and saved for future use.</string>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="guideB">
+ <property name="enabled">
+ <bool>false</bool>
</property>
<property name="text">
- <string>Dark</string>
+ <string>Guide</string>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="subFrameCheck">
- <property name="toolTip">
- <string>Subframe the image around the guide star</string>
+ <item row="3" column="0">
+ <widget class="QPushButton" name="stopB">
+ <property name="enabled">
+ <bool>false</bool>
</property>
<property name="text">
- <string>Subframe</string>
+ <string>Stop</string>
</property>
</widget>
</item>
@@ -604,7 +607,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>462</width>
+ <width>458</width>
<height>238</height>
</rect>
</property>
diff --git a/kstars/ekos/guide/opscalibration.ui b/kstars/ekos/guide/opscalibration.ui
index 94e3a8b..d29d886 100644
--- a/kstars/ekos/guide/opscalibration.ui
+++ b/kstars/ekos/guide/opscalibration.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>298</width>
- <height>163</height>
+ <height>168</height>
</rect>
</property>
<property name="windowTitle">
@@ -19,9 +19,9 @@
<property name="title">
<string>Settings</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QFormLayout" name="formLayout">
+ <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="l_29">
<property name="text">
@@ -46,7 +46,7 @@
</widget>
</item>
<item row="1" column="0">
- <widget class="QCheckBox" name="kcfg_EnableAutoMode">
+ <widget class="QCheckBox" name="kcfg_AutoModeEnabled">
<property name="text">
<string>Auto mode</string>
</property>
@@ -56,7 +56,7 @@
</widget>
</item>
<item row="1" column="1">
- <widget class="QSpinBox" name="spinBox_DriftTime">
+ <widget class="QSpinBox" name="kcfg_AutoModeIterations">
<property name="minimum">
<number>3</number>
</property>
@@ -71,7 +71,7 @@
</layout>
</item>
<item>
- <widget class="QCheckBox" name="kcfg_EnableTwoAxis">
+ <widget class="QCheckBox" name="kcfg_TwoAxisEnabled">
<property name="text">
<string>Two axis</string>
</property>
@@ -81,7 +81,7 @@
</widget>
</item>
<item>
- <widget class="QCheckBox" name="kcfg_EnableAutoStar">
+ <widget class="QCheckBox" name="kcfg_AutoStarEnabled">
<property name="toolTip">
<string>Automatically select the calibration star.</string>
</property>
@@ -94,7 +94,7 @@
</widget>
</item>
<item>
- <widget class="QCheckBox" name="autoSquareSizeCheck">
+ <widget class="QCheckBox" name="kcfg_AutoSquareSizeEnabled">
<property name="enabled">
<bool>false</bool>
</property>
@@ -106,6 +106,19 @@
</property>
</widget>
</item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
</item>
diff --git a/kstars/ekos/guide/opsguide.cpp b/kstars/ekos/guide/opsguide.cpp
new file mode 100644
index 0000000..8d3eecf
--- /dev/null
+++ b/kstars/ekos/guide/opsguide.cpp
@@ -0,0 +1,108 @@
+/* INDI Options
+ Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ */
+
+#include <QPushButton>
+#include <QFileDialog>
+#include <QCheckBox>
+#include <QStringList>
+#include <QComboBox>
+
+#include <KConfigDialog>
+
+#include "Options.h"
+#include "opsguide.h"
+#include "guide.h"
+#include "kstars.h"
+
+#include "internalguide/internalguider.h"
+
+namespace Ekos
+{
+
+OpsGuide::OpsGuide(InternalGuider *guiderObject) : QFrame( KStars::Instance() )
+{
+ setupUi(this);
+
+ guider = guiderObject;
+
+ //Get a pointer to the KConfigDialog
+ m_ConfigDialog = KConfigDialog::exists( "guidesettings" );
+
+ connect( m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL( clicked() ), SLOT( slotApply() ) );
+ connect( m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL( clicked() ), SLOT( slotApply() ) );
+ connect( m_ConfigDialog->button(QDialogButtonBox::Cancel), SIGNAL( clicked() ), SLOT( slotCancel() ) );
+
+ guiderTypeButtonGroup->setId(internalGuideR, Guide::GUIDE_INTERNAL);
+ guiderTypeButtonGroup->setId(PHD2GuideR, Guide::GUIDE_PHD2);
+ guiderTypeButtonGroup->setId(LinGuiderR, Guide::GUIDE_LINGUIDER);
+
+ connect(guiderTypeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotLoadSettings(int)));
+}
+
+OpsGuide::~OpsGuide() {}
+
+void OpsGuide::showEvent(QShowEvent *)
+{
+ slotLoadSettings(Options::guiderType());
+}
+
+void OpsGuide::slotLoadSettings(int guiderType)
+{
+ switch (guiderType)
+ {
+ case Guide::GUIDE_INTERNAL:
+ internalGuideR->setChecked(true);
+ externalHost->clear();
+ externalPort->clear();
+ externalHost->setEnabled(false);
+ externalPort->setEnabled(false);
+ break;
+
+ case Guide::GUIDE_PHD2:
+ PHD2GuideR->setChecked(true);
+ externalHost->setEnabled(true);
+ externalPort->setEnabled(true);
+ externalHost->setText(Options::pHD2Host());
+ externalPort->setText(QString::number(Options::pHD2Port()));
+ break;
+
+ case Guide::GUIDE_LINGUIDER:
+ LinGuiderR->setChecked(true);
+ externalHost->setEnabled(true);
+ externalPort->setEnabled(true);
+ externalHost->setText(Options::lINGuiderHost());
+ externalPort->setText(QString::number(Options::lINGuiderPort()));
+ break;
+ }
+}
+
+void OpsGuide::slotApply()
+{
+ switch (guiderTypeButtonGroup->checkedId())
+ {
+ case Guide::GUIDE_INTERNAL:
+ Options::setGuiderType(Guide::GUIDE_INTERNAL);
+ break;
+
+ case Guide::GUIDE_PHD2:
+ Options::setGuiderType(Guide::GUIDE_INTERNAL);
+ Options::setPHD2Host(externalHost->text());
+ Options::setPHD2Port(externalPort->text().toInt());
+ break;
+
+ case Guide::GUIDE_LINGUIDER:
+ Options::setGuiderType(Guide::GUIDE_INTERNAL);
+ Options::setLINGuiderHost(externalHost->text());
+ Options::setLINGuiderPort(externalPort->text().toInt());
+ break;
+ }
+}
+
+}
diff --git a/kstars/ekos/guide/opsguide.h b/kstars/ekos/guide/opsguide.h
new file mode 100644
index 0000000..c1f7164
--- /dev/null
+++ b/kstars/ekos/guide/opsguide.h
@@ -0,0 +1,53 @@
+/* Ekos Options
+ Copyright (C) 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef OpsGuide_H_
+#define OpsGuide_H_
+
+#include "ui_opsguide.h"
+
+class KConfigDialog;
+
+namespace Ekos
+{
+
+class InternalGuider;
+
+/**
+ * @class OpsGuide
+ *
+ * Enables the user to set guide options
+ *
+ * @author Jasem Mutlaq
+ */
+class OpsGuide : public QFrame, public Ui::OpsGuide
+{
+ Q_OBJECT
+
+public:
+ explicit OpsGuide(InternalGuider *guiderObject);
+ ~OpsGuide();
+
+protected:
+ void showEvent(QShowEvent *);
+
+private slots:
+
+ void slotApply();
+ void slotLoadSettings(int guiderType);
+
+private:
+ KConfigDialog *m_ConfigDialog;
+ InternalGuider *guider;
+};
+
+}
+
+#endif
+
diff --git a/kstars/ekos/guide/opsguide.ui b/kstars/ekos/guide/opsguide.ui
index 6e45580..35dc8a0 100644
--- a/kstars/ekos/guide/opsguide.ui
+++ b/kstars/ekos/guide/opsguide.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>269</width>
- <height>210</height>
+ <height>207</height>
</rect>
</property>
<property name="windowTitle">
@@ -33,6 +33,9 @@
<property name="checked">
<bool>true</bool>
</property>
+ <attribute name="buttonGroup">
+ <string notr="true">guiderTypeButtonGroup</string>
+ </attribute>
</widget>
</item>
<item>
@@ -46,6 +49,9 @@
<property name="checked">
<bool>false</bool>
</property>
+ <attribute name="buttonGroup">
+ <string notr="true">guiderTypeButtonGroup</string>
+ </attribute>
</widget>
</item>
<item>
@@ -53,6 +59,9 @@
<property name="text">
<string>lin_guider</string>
</property>
+ <attribute name="buttonGroup">
+ <string notr="true">guiderTypeButtonGroup</string>
+ </attribute>
</widget>
</item>
<item>
@@ -98,6 +107,9 @@
</item>
<item>
<widget class="QLineEdit" name="externalPort">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string/>
</property>
@@ -113,19 +125,21 @@
<property name="title">
<string>Settings</string>
</property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="l_19">
- <property name="text">
- <string>Algorithm</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="comboBox_ThresholdAlg"/>
- </item>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="leftMargin">
+ <number>4</number>
+ </property>
+ <property name="topMargin">
+ <number>3</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>3</number>
+ </property>
<item row="1" column="0">
- <widget class="QCheckBox" name="kcfg_EnableDither">
+ <widget class="QCheckBox" name="kcfg_DitherEnabled">
<property name="toolTip">
<string>Subframe the image around the guide star</string>
</property>
@@ -134,6 +148,42 @@
</property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="kcfg_RapidGuideEnabled">
+ <property name="text">
+ <string>Rapid Guide</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="kcfg_GuideAlgorithm">
+ <item>
+ <property name="text">
+ <string>Smart</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fast</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Auto Threshold</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>No Threshold</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string/>
+ </property>
+ </item>
+ </widget>
+ </item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@@ -161,18 +211,47 @@
</item>
</layout>
</item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="kcfg_EnableRapidGuide">
+ <item row="0" column="0">
+ <widget class="QLabel" name="l_19">
<property name="text">
- <string>Rapid Guide</string>
+ <string>Algorithm</string>
</property>
</widget>
</item>
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
</item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
<resources/>
<connections/>
+ <buttongroups>
+ <buttongroup name="guiderTypeButtonGroup"/>
+ </buttongroups>
</ui>
diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg
index 189dec2..d33e42e 100644
--- a/kstars/kstars.kcfg
+++ b/kstars/kstars.kcfg
@@ -1599,7 +1599,7 @@ sky map.</whatsthis>
</entry>
<entry name="LINGuiderPort" type="UInt">
<label>Lin_guider Event Monitoring Port</label>
- <default>59000</default>
+ <default>5656</default>
</entry>
<entry name="CalibrationPulseDuration" type="UInt">
<label>Pulse duration in milliseconds used for guiding pulses during calibration stage.</label>
@@ -1608,7 +1608,7 @@ sky map.</whatsthis>
<entry name="GuideSquareSizeIndex" type="UInt">
<label>Guide square size index (0 to 4) corresponding to pixel sizes (8 to 128).</label>
<default>1</default>
- </entry>
+ </entry>
<entry name="AutoModeEnabled" type="Bool">
<label>Automatically calibrate selected axes.</label>
<default>true</default>