diff --git a/kstars/data/icons/breeze/default/im-user.svg b/kstars/data/icons/breeze/default/im-user.svg new file mode 100644 index 0000000000000000000000000000000000000000..ecee9917ad538d253d78b990223a0deb5b22218e --- /dev/null +++ b/kstars/data/icons/breeze/default/im-user.svg @@ -0,0 +1,14 @@ + + + + + + diff --git a/kstars/data/kstars.qrc b/kstars/data/kstars.qrc index 559b1650dd4a9530db5ff4451570c24e667b0c2d..a36eba9d9cfcda1fa19b7f728645322fd148aa6d 100644 --- a/kstars/data/kstars.qrc +++ b/kstars/data/kstars.qrc @@ -136,6 +136,7 @@ icons/AlignSuccess.svg icons/AlignWarning.svg icons/breeze/default/draw-cuboid.svg + icons/breeze/default/im-user.svg kstars.knsrc diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp index 287f993e8d7f594875415bd44165b5ff3f90bb5d..31df779b137947ed07ca3518e9301d97ed859d4e 100644 --- a/kstars/ekos/capture/capture.cpp +++ b/kstars/ekos/capture/capture.cpp @@ -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 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 << "" << endl; outstream << "" << endl; + if (observerName.isEmpty() == false) + outstream << "" << observerName << "" << endl; outstream << "" << guideDeviation->value() << "" << endl; outstream << "" << HFRPixels->value() << "" << endl; outstream << "" << meridianHours->value() << "" << endl; @@ -4205,4 +4229,58 @@ void Capture::setMountStatus(ISD::Telescope::TelescopeStatus newState) } } +void Capture::showObserverDialog() +{ + QList 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 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); +} + } diff --git a/kstars/ekos/capture/capture.h b/kstars/ekos/capture/capture.h index 98effbc9021ec31b0e25d5e502572cb88f447ce4..ae00a9ef8017180f5c6fbc3778aea55d4d5e6149 100644 --- a/kstars/ekos/capture/capture.h +++ b/kstars/ekos/capture/capture.h @@ -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; diff --git a/kstars/ekos/capture/capture.ui b/kstars/ekos/capture/capture.ui index cc888337888fb0b741ff56e1758b3a90fc26d93b..15d4aa45b2dc1a73ad54d430c1447ce84a1f6eea 100644 --- a/kstars/ekos/capture/capture.ui +++ b/kstars/ekos/capture/capture.ui @@ -6,7 +6,7 @@ 0 0 - 590 + 623 519 @@ -236,58 +236,55 @@ 3 - - - - Image Transfer Format - - - - FITS - - - - - Native - - - - - - + + - + 0 0 - - - - - - Set the exposure time in seconds for individual images, if applicable + + + 0 + 0 + - - + + + 16777215 + 16777215 + + + + Reset CCD frame & size values to default values - Exposure: + Reset + + + + 16 + 16 + - - + + - + 0 0 + + 3600 + - - + + @@ -295,12 +292,12 @@ - Filter: + Frame: - - + + @@ -308,57 +305,57 @@ - H: + Type: - - + + 0 0 + + + + - Vertical binning - - - 1 + - - 10 + + - - 1 + + Size: - - + + - + 0 0 - - - - - - Delay in seconds between consecutive images + + 3 - - + + 0.001000000000000 - - Delay: + + 3600.000000000000000 + + + 1.000000000000000 - - + + @@ -366,11 +363,11 @@ - Y: + H: - + @@ -380,55 +377,75 @@ - - + + 0 0 - - 3 + + Horizontal binning - 0.001000000000000 + 1 - 3600.000000000000000 + 10 - 1.000000000000000 + 1 - - + + - Horizontal and Vertical binning + - Binning: + V: - - + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + - Number of images to capture + Delay in seconds between consecutive images - Count: + Delay: - + @@ -441,8 +458,11 @@ - - + + + + false + 0 @@ -450,137 +470,127 @@ - Horizontal binning + ISO settings - - 1 + + + + + + ISO: - - 10 + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - 1 + + + + + + Number of images to capture + + + + + + Count: - - - - - 0 - 0 - + + + + Format: - - 3600 + + + + + + Image Transfer Format + + + FITS + + + + + Native + + - - + + 0 0 - - - - - - + + 1 - - + + 999 - - H: + + 1 - - + + - + Set the exposure time in seconds for individual images, if applicable - Frame: + Exposure: - - + + 0 0 - - 99 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - + + - Reset CCD frame & size values to default values + - - Reset + + - - - 16 - 16 - + + Y: - - + + - + Horizontal and Vertical binning - Size: - - - - - - - Format: + Binning: - - + + @@ -588,44 +598,34 @@ - X: + H: - - + + 0 0 - - 1 - - - 999 - - - 1 - - - - - - + Vertical binning - - + + 1 - - V: + + 10 + + + 1 - - + + @@ -633,37 +633,37 @@ - Type: + Filter: - - - - false - + + - + 0 0 - - ISO settings + + 99 - - - - ISO: + + + + - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + X: - + false @@ -734,6 +734,87 @@ 3 + + + + When storing images on remote devices, specify the directory where captured images are saved to. + + + Remote: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + /home/pi + + + + + + + Post-capture script to be executed after an image is captured. The capture sequence is resumed when the script is executed successfully. + + + Script: + + + + + + + + + + + 0 + 0 + + + + + Client + + + + + Local + + + + + Both + + + + + + + + Local directory to save sequence images + + + + + + Directory: + + + + + + + Target + + + @@ -753,10 +834,19 @@ - - - - Target + + + + <p>Select how captured images are uploaded:</p> +<ol> +<li><strong>Client</strong>: Captured images are only uploaded to Ekos.</li> +<li><strong>Local</strong>: Captured images are only saved locally on the remote computer.</li> +<li><strong>Both</strong>: Captured images are saved on remote device <b>and</b> uploaded to Ekos.</li> +</ol> +<p>When selecting <i>Local</i> or <i>Both</i>, you must specify the remote directory where the remote images are saved to. By default, all captured images are uploaded to Ekos. + + + Upload: @@ -800,35 +890,6 @@ - - - - Post-capture script to be executed after an image is captured. The capture sequence is resumed when the script is executed successfully. - - - Script: - - - - - - - - - - Local directory to save sequence images - - - - - - Directory: - - - - - - @@ -854,69 +915,8 @@ - - - - <p>Select how captured images are uploaded:</p> -<ol> -<li><strong>Client</strong>: Captured images are only uploaded to Ekos.</li> -<li><strong>Local</strong>: Captured images are only saved locally on the remote computer.</li> -<li><strong>Both</strong>: Captured images are saved on remote device <b>and</b> uploaded to Ekos.</li> -</ol> -<p>When selecting <i>Local</i> or <i>Both</i>, you must specify the remote directory where the remote images are saved to. By default, all captured images are uploaded to Ekos. - - - Upload: - - - - - - - - 0 - 0 - - - - - Client - - - - - Local - - - - - Both - - - - - - - - When storing images on remote devices, specify the directory where captured images are saved to. - - - Remote: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - /home/pi - - + + @@ -1275,6 +1275,28 @@ + + + + + 32 + 32 + + + + + 32 + 32 + + + + Select Observer + + + + + + @@ -1840,8 +1862,6 @@ - optionsGroup - CCDFWGroup CCDCaptureCombo @@ -1854,7 +1874,6 @@ FilterPosCombo countIN delayIN - frameTypeCombo frameXIN frameYIN resetFrameB diff --git a/kstars/indi/indiccd.cpp b/kstars/indi/indiccd.cpp index e33cc588dab35eda546232e61a8bf21e4b2d63c6..40429ad02b34c2b393f1b7677f97039c71a1fac0 100644 --- a/kstars/indi/indiccd.cpp +++ b/kstars/indi/indiccd.cpp @@ -2322,4 +2322,28 @@ bool CCD::stopRecording() return true; } +bool CCD::setFITSHeader(const QMap &values) +{ + ITextVectorProperty *tvp = baseDevice->getText("FITS_HEADER"); + if (tvp == NULL) + return false; + + QMapIterator i(values); + + while (i.hasNext()) + { + i.next(); + + IText *headerT = IUFindText(tvp, i.key().toLatin1().data()); + if (headerT == NULL) + continue; + IUSaveText(headerT, i.value().toLatin1().data()); + } + + clientManager->sendNewText(tvp); + + return true; +} + + } diff --git a/kstars/indi/indiccd.h b/kstars/indi/indiccd.h index 4d1be77a9450eddeb39abf2974a091135abccab4..ae3fca25ecdbb50aed928a850036c2ce17da2d4f 100644 --- a/kstars/indi/indiccd.h +++ b/kstars/indi/indiccd.h @@ -199,6 +199,9 @@ public: TelescopeType getTelescopeType() { return telescopeType; } bool setTelescopeType(TelescopeType type); + // Update FITS Header + bool setFITSHeader(const QMap & values); + FITSViewer *getViewer() { return fv;} CCDChip * getChip(CCDChip::ChipType cType); void setFITSDir(const QString &dir) { fitsDir = dir;} diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg index 8609c04b7475693386ab36a63079e4154abc4b6d..f27a27c354aefbf78fa2898e9001cec48605ba02 100644 --- a/kstars/kstars.kcfg +++ b/kstars/kstars.kcfg @@ -1384,6 +1384,9 @@ + + + If guide deviation exceeds this limit, the exposure will be automatically aborted and only resumed when the deviation is within this limit. diff --git a/kstars/oal/observeradd.ui b/kstars/oal/observeradd.ui index 000e005e2f482915c0a14353db6ac42dc2885246..26901ca28184efc995b28e064bf776e7e8611d7b 100644 --- a/kstars/oal/observeradd.ui +++ b/kstars/oal/observeradd.ui @@ -6,8 +6,8 @@ 0 0 - 489 - 182 + 455 + 190 @@ -25,7 +25,22 @@ Manage Observers - + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + @@ -144,6 +159,12 @@ 0 + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows +