Commit ee946e36 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Add support for observers in capture module. Observer names are sent to INDI...

Add support for observers in capture module. Observer names are sent to INDI CCD driver where they are recorded in the FITS header. Furthermore, target name is also sent to the CCD driver to be recorded as OBJECT
parent 390c59f8
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#f2f2f2;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 11 3 A 3.9999902 4.0000296 0 0 0 7 7 A 3.9999902 4.0000296 0 0 0 11 11 A 3.9999902 4.0000296 0 0 0 15 7 A 3.9999902 4.0000296 0 0 0 11 3 z M 11 4 A 3 3.0000296 0 0 1 14 7 A 3 3.0000296 0 0 1 11 10 A 3 3.0000296 0 0 1 8 7 A 3 3.0000296 0 0 1 11 4 z M 11 12 A 7.9999504 8.0000296 0 0 0 3.0722656 19 L 4.0800781 19 A 6.9999604 7.0000296 0 0 1 11 13 A 6.9999604 7.0000296 0 0 1 17.921875 19 L 18.929688 19 A 7.9999504 8.0000296 0 0 0 11 12 z "
class="ColorScheme-Text"
/>
</svg>
......@@ -136,6 +136,7 @@
<file>icons/AlignSuccess.svg</file>
<file>icons/AlignWarning.svg</file>
<file>icons/breeze/default/draw-cuboid.svg</file>
<file>icons/breeze/default/im-user.svg</file>
</qresource>
<qresource prefix="/kconfig">
<file>kstars.knsrc</file>
......
......@@ -24,6 +24,7 @@
#include "oal/log.h"
#include "kstars.h"
#include "skymap.h"
#include "kstarsdata.h"
#include "capture.h"
......@@ -51,7 +52,7 @@
#define MF_RA_DIFF_LIMIT 4
#define MAX_CAPTURE_RETRIES 3
#define SQ_FORMAT_VERSION 1.5
#define SQ_FORMAT_VERSION 1.6
namespace Ekos
{
......@@ -225,6 +226,10 @@ Capture::Capture()
connect(uploadModeCombo, SIGNAL(activated(int)), this, SLOT(setDirty()));
connect(remoteDirIN, SIGNAL(editingFinished()), this, SLOT(setDirty()));
observerName = Options::defaultObserver();
observerB->setIcon(QIcon::fromTheme("im-user", QIcon(":/icons/breeze/default/im-user.svg") ));
observerB->setAttribute(Qt::WA_LayoutUsesWidgetRect);
connect(observerB, SIGNAL(clicked()), this, SLOT(showObserverDialog()));
// Post capture script
connect(&postCaptureScript, SIGNAL(finished(int)), this, SLOT(postScriptFinished(int)));
......@@ -2090,6 +2095,19 @@ void Capture::executeJob()
currentCCD->setNextSequenceID(nextSequenceID);
}
QMap<QString, QString> FITSHeader;
if (observerName.isEmpty() == false)
FITSHeader["FITS_OBSERVER"] = observerName;
if (targetName.isEmpty() == false)
FITSHeader["FITS_OBJECT"] = targetName;
else if (activeJob->getRawPrefix().isEmpty() == false)
{
FITSHeader["FITS_OBJECT"] = activeJob->getRawPrefix();
}
if (FITSHeader.count() > 0)
currentCCD->setFITSHeader(FITSHeader);
// Update button status
setBusy(true);
......@@ -2359,7 +2377,11 @@ bool Capture::loadSequenceQueue(const QString &fileURL)
for (ep = nextXMLEle(root, 1) ; ep != NULL ; ep = nextXMLEle(root, 0))
{
if (!strcmp(tagXMLEle(ep), "GuideDeviation"))
if (!strcmp(tagXMLEle(ep), "Observer"))
{
observerName = QString(pcdataXMLEle(ep));
}
else if (!strcmp(tagXMLEle(ep), "GuideDeviation"))
{
if (!strcmp(findXMLAttValu(ep, "enabled"), "true"))
{
......@@ -2690,6 +2712,8 @@ bool Capture::saveSequenceQueue(const QString &path)
outstream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
outstream << "<SequenceQueue version='" << SQ_FORMAT_VERSION << "'>" << endl;
if (observerName.isEmpty() == false)
outstream << "<Observer>" << observerName << "</Observer>" << endl;
outstream << "<GuideDeviation enabled='" << (guideDeviationCheck->isChecked() ? "true" : "false") << "'>" << guideDeviation->value() << "</GuideDeviation>" << endl;
outstream << "<Autofocus enabled='" << (autofocusCheck->isChecked() ? "true" : "false") << "'>" << HFRPixels->value() << "</Autofocus>" << endl;
outstream << "<MeridianFlip enabled='" << (meridianCheck->isChecked() ? "true" : "false") << "'>" << meridianHours->value() << "</MeridianFlip>" << endl;
......@@ -4205,4 +4229,58 @@ void Capture::setMountStatus(ISD::Telescope::TelescopeStatus newState)
}
}
void Capture::showObserverDialog()
{
QList<OAL::Observer *> m_observerList;
KStars::Instance()->data()->userdb()->GetAllObservers(m_observerList);
QStringList observers;
foreach( OAL::Observer *o, m_observerList )
observers << QString("%1 %2").arg(o->name()).arg(o->surname());
QDialog observersDialog(this);
observersDialog.setWindowTitle(i18n("Select Current Observer"));
QLabel label(i18n("Current Observer:"));
QComboBox observerCombo(&observersDialog);
observerCombo.addItems(observers);
observerCombo.setCurrentText(observerName);
observerCombo.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QPushButton manageObserver(&observersDialog);
manageObserver.setFixedSize(QSize(32,32));
manageObserver.setIcon(QIcon::fromTheme("document-edit", QIcon(":/icons/breeze/default/document-edit.svg")));
manageObserver.setAttribute(Qt::WA_LayoutUsesWidgetRect);
manageObserver.setToolTip(i18n("Manage Observers"));
connect(&manageObserver, &QPushButton::clicked, this, [&]()
{
ObserverAdd add;
add.exec();
QList<OAL::Observer *> m_observerList;
KStars::Instance()->data()->userdb()->GetAllObservers(m_observerList);
QStringList observers;
foreach( OAL::Observer *o, m_observerList )
observers << QString("%1 %2").arg(o->name()).arg(o->surname());
observerCombo.clear();
observerCombo.addItems(observers);
observerCombo.setCurrentText(observerName);
});
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(&label);
layout->addWidget(&observerCombo);
layout->addWidget(&manageObserver);
observersDialog.setLayout(layout);
observersDialog.exec();
observerName = observerCombo.currentText();
Options::setDefaultObserver(observerName);
}
}
......@@ -133,6 +133,12 @@ public:
*/
Q_SCRIPTABLE Q_NOREPLY void setTargetName(const QString &name) { targetName = name; }
/** DBUS interface function.
* Sets Observer name. Observer name is sent to INDI CCD driver to include it in the FITS header
* @param name Full name of observer
*/
Q_SCRIPTABLE Q_NOREPLY void setObservrName(const QString &name) { observerName = name; }
/** DBUS interface function.
* Enables or disables the maximum guiding deviation and sets its value.
* @param enable If true, enable the guiding deviation check, otherwise, disable it.
......@@ -450,6 +456,9 @@ private slots:
void toggleVideoStream(bool enable);
void setVideoStreamEnabled(bool enabled);
// Observer
void showObserverDialog();
signals:
void newLog();
void checkFocus(double);
......@@ -506,6 +515,7 @@ private:
bool useGuideHead;
QString targetName;
QString observerName;
SequenceJob *activeJob;
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>590</width>
<width>623</width>
<height>519</height>
</rect>
</property>
......@@ -236,58 +236,55 @@
<property name="spacing">
<number>3</number>
</property>
<item row="4" column="1" colspan="2">
<widget class="QComboBox" name="transferFormatCombo">
<property name="toolTip">
<string>Image Transfer Format</string>
</property>
<item>
<property name="text">
<string>FITS</string>
</property>
</item>
<item>
<property name="text">
<string>Native</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2">
<widget class="QSpinBox" name="frameXIN">
<item row="6" column="6">
<widget class="QPushButton" name="resetFrameB">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="exposureLabel_2">
<property name="toolTip">
<string>Set the exposure time in seconds for individual images, if applicable</string>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="whatsThis">
<string/>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Reset CCD frame &amp; size values to default values</string>
</property>
<property name="text">
<string>Exposure:</string>
<string>Reset</string>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="6" column="4" colspan="2">
<widget class="QSpinBox" name="frameHIN">
<item row="1" column="5" colspan="2">
<widget class="QSpinBox" name="delayIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>3600</number>
</property>
</widget>
</item>
<item row="0" column="3" colspan="2">
<widget class="QLabel" name="textLabel1_2_3">
<item row="6" column="0">
<widget class="QLabel" name="textLabel1_12">
<property name="toolTip">
<string/>
</property>
......@@ -295,12 +292,12 @@
<string/>
</property>
<property name="text">
<string>Filter:</string>
<string>Frame:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="textLabel1_10">
<item row="5" column="0">
<widget class="QLabel" name="textLabel1_17">
<property name="toolTip">
<string/>
</property>
......@@ -308,57 +305,57 @@
<string/>
</property>
<property name="text">
<string>H:</string>
<string>Type:</string>
</property>
</widget>
</item>
<item row="7" column="4" colspan="2">
<widget class="QSpinBox" name="binYIN">
<item row="0" column="5" colspan="2">
<widget class="QComboBox" name="FilterPosCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="textLabel1_19">
<property name="toolTip">
<string>Vertical binning</string>
</property>
<property name="minimum">
<number>1</number>
<string/>
</property>
<property name="maximum">
<number>10</number>
<property name="whatsThis">
<string/>
</property>
<property name="value">
<number>1</number>
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="5" column="4" colspan="2">
<widget class="QSpinBox" name="frameYIN">
<item row="0" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="exposureIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="3" colspan="2">
<widget class="QLabel" name="textLabel1_8">
<property name="toolTip">
<string>Delay in seconds between consecutive images</string>
<property name="decimals">
<number>3</number>
</property>
<property name="whatsThis">
<string/>
<property name="minimum">
<double>0.001000000000000</double>
</property>
<property name="text">
<string>Delay:</string>
<property name="maximum">
<double>3600.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="textLabel1_14">
<item row="7" column="3">
<widget class="QLabel" name="textLabel1_16">
<property name="toolTip">
<string/>
</property>
......@@ -366,11 +363,11 @@
<string/>
</property>
<property name="text">
<string>Y:</string>
<string>H:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<item row="5" column="1" colspan="2">
<widget class="QComboBox" name="frameTypeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
......@@ -380,55 +377,75 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="exposureIN">
<item row="8" column="2">
<widget class="QSpinBox" name="binXIN">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
<property name="toolTip">
<string>Horizontal binning</string>
</property>
<property name="minimum">
<double>0.001000000000000</double>
<number>1</number>
</property>
<property name="maximum">
<double>3600.000000000000000</double>
<number>10</number>
</property>
<property name="value">
<double>1.000000000000000</double>
<number>1</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="textLabel1_9">
<item row="8" column="3">
<widget class="QLabel" name="textLabel1_11">
<property name="toolTip">
<string>Horizontal and Vertical binning</string>
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Binning:</string>
<string>V:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_4">
<item row="6" column="4" colspan="2">
<widget class="QSpinBox" name="frameYIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QSpinBox" name="frameXIN">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="3" colspan="2">
<widget class="QLabel" name="textLabel1_8">
<property name="toolTip">
<string>Number of images to capture</string>
<string>Delay in seconds between consecutive images</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Count:</string>
<string>Delay:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QLabel" name="textLabel1_15">
<property name="toolTip">
<string/>
......@@ -441,8 +458,11 @@
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QSpinBox" name="binXIN">
<item row="3" column="5" colspan="2">
<widget class="QComboBox" name="ISOCombo">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -450,137 +470,127 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>Horizontal binning</string>
<string>ISO settings</string>
</property>
<property name="minimum">
<number>1</number>
</widget>
</item>
<item row="3" column="3" colspan="2">
<widget class="QLabel" name="ISOLabel">
<property name="text">
<string>ISO:</string>
</property>
<property name="maximum">
<number>10</number>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="value">
<number>1</number>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_4">
<property name="toolTip">
<string>Number of images to capture</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Count:</string>
</property>
</widget>
</item>
<item row="1" column="5" colspan="2">
<widget class="QSpinBox" name="delayIN">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Format:</string>
</property>
<property name="maximum">
<number>3600</number>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="transferFormatCombo">
<property name="toolTip">
<string>Image Transfer Format</string>
</property>
<item>
<property name="text">
<string>FITS</string>
</property>
</item>
<item>
<property name="text">
<string>Native</string>
</property>
</item>
</widget>
</item>
<item row="0" column="5" colspan="2">
<widget class="QComboBox" name="FilterPosCombo">
<item row="1" column="1" colspan="2">
<widget class="QSpinBox" name="countIN">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="textLabel1_16">
<property name="toolTip">
<string/>
<property name="minimum">
<number>1</number>
</property>
<property name="whatsThis">
<string/>
<property name="maximum">
<number>999</number>
</property>
<property name="text">
<string>H:</string>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="textLabel1_12">
<item row="0" column="0">
<widget class="QLabel" name="exposureLabel_2">
<property name="toolTip">
<string/>
<string>Set the exposure time in seconds for individual images, if applicable</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Frame:</string>
<string>Exposure:</string>
</property>
</widget>