[kstars] /: Support all telescope actions with keyboard shortcuts
Csaba Kertesz
null at kde.org
Fri Aug 18 22:26:17 UTC 2017
Git commit 18eafe7bdbc4e5aadc363e3d55f8aeb93495f929 by Csaba Kertesz.
Committed on 18/08/2017 at 14:53.
Pushed by ckertesz into branch 'master'.
Support all telescope actions with keyboard shortcuts
M +78 -1 doc/commands.docbook
M +19 -2 kstars/kstars.h
M +126 -0 kstars/kstarsactions.cpp
M +19 -4 kstars/kstarsinit.cpp
M +7 -0 kstars/skymap.h
https://commits.kde.org/kstars/18eafe7bdbc4e5aadc363e3d55f8aeb93495f929
diff --git a/doc/commands.docbook b/doc/commands.docbook
index dbb9d9faf..ed2d4b78a 100644
--- a/doc/commands.docbook
+++ b/doc/commands.docbook
@@ -545,10 +545,87 @@ current simulation date.
</listitem>
</varlistentry>
+<varlistentry>
+<term>
+<keycombo action="simul">&Shift;&Meta;<keycap>I</keycap></keycombo>
+</term>
+<listitem>
+<para>
+Opens INDI control window to setup and start telescope equipment.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<keycombo action="simul">&Shift;&Meta;<keycap>A</keycap></keycombo>
+</term>
+<listitem>
+<para>
+Abort any motion of a connected telescope via INDI.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<keycombo action="simul">&Shift;&Meta;<keycap>S</keycap></keycombo>
+</term>
+<listitem>
+<para>
+Slew a connected telescope via INDI to the mouse pointer.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<keycombo action="simul">&Shift;&Meta;<keycap>T</keycap></keycombo>
+</term>
+<listitem>
+<para>
+Track a target under the mouse pointer with a connected telescope via INDI.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<keycombo action="simul">&Shift;&Meta;<keycap>Y</keycap></keycombo>
+</term>
+<listitem>
+<para>
+Sync a connected telescope via INDI to the mouse pointer.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<keycombo action="simul">&Shift;&Meta;<keycap>P</keycap></keycombo>
+</term>
+<listitem>
+<para>
+Park a connected telescope via INDI.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<keycombo action="simul">&Shift;&Meta;<keycap>U</keycap></keycombo>
+</term>
+<listitem>
+<para>
+Unpark a connected telescope via INDI.
+</para>
+</listitem>
+</varlistentry>
+
<varlistentry>
<term><menuchoice>
<shortcut>
-<keycombo action="simul">&Ctrl;<keycap>K</keycap></keycombo>
+<keycombo action="simul">&Shift;&Meta;<keycap>K</keycap></keycombo>
</shortcut>
<guimenu>Tools</guimenu>
<guimenuitem>Ekos</guimenuitem>
diff --git a/kstars/kstars.h b/kstars/kstars.h
index d239440b7..9eef9eda3 100644
--- a/kstars/kstars.h
+++ b/kstars/kstars.h
@@ -574,11 +574,28 @@ class KStars : public KXmlGuiWindow
/** action slot: open Ekos panel */
void slotEkos();
+ /** action slot: Track with the telescope (INDI) */
+ void slotINDITelescopeTrack();
+
+ /** action slot: Slew with the telescope (INDI) */
+ void slotINDITelescopeSlew();
+
+ /** action slot: Sync the telescope (INDI) */
+ void slotINDITelescopeSync();
+
+ /** action slot: Abort any telescope motion (INDI) */
+ void slotINDITelescopeAbort();
+
+ /** action slot: Park the telescope (INDI) */
+ void slotINDITelescopePark();
+
+ /** action slot: Unpark the telescope (INDI) */
+ void slotINDITelescopeUnpark();
+
/** action slot: open dialog for setting the view options */
void slotViewOps();
- /** finish setting up after the kstarsData has finished
- */
+ /** finish setting up after the kstarsData has finished */
void datainitFinished();
/** Open FITS image. */
diff --git a/kstars/kstarsactions.cpp b/kstars/kstarsactions.cpp
index b4978963f..0583025bd 100644
--- a/kstars/kstarsactions.cpp
+++ b/kstars/kstarsactions.cpp
@@ -726,6 +726,132 @@ void KStars::slotEkos()
#endif
}
+void KStars::slotINDITelescopeTrack()
+{
+#ifdef HAVE_INDI
+ if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
+ return;
+
+ for (auto *gd : INDIListener::Instance()->getDevices())
+ {
+ ISD::Telescope* telescope = dynamic_cast<ISD::Telescope*>(gd);
+
+ if (telescope != nullptr && telescope->isConnected())
+ {
+ ISD::GDSetCommand SlewCMD(INDI_SWITCH, "ON_COORD_SET", "TRACK", ISS_ON, this);
+
+ gd->setProperty(&SlewCMD);
+
+ gd->runCommand(INDI_SEND_COORDS, m_SkyMap->mousePoint());
+ return;
+ }
+ }
+#endif
+}
+
+void KStars::slotINDITelescopeSlew()
+{
+#ifdef HAVE_INDI
+ if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
+ return;
+
+ for (auto *gd : INDIListener::Instance()->getDevices())
+ {
+ ISD::Telescope* telescope = dynamic_cast<ISD::Telescope*>(gd);
+
+ if (telescope != nullptr && telescope->isConnected())
+ {
+ ISD::GDSetCommand SlewCMD(INDI_SWITCH, "ON_COORD_SET", "SLEW", ISS_ON, this);
+
+ gd->setProperty(&SlewCMD);
+
+ gd->runCommand(INDI_SEND_COORDS, m_SkyMap->mousePoint());
+ return;
+ }
+ }
+#endif
+}
+
+void KStars::slotINDITelescopeSync()
+{
+#ifdef HAVE_INDI
+ if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
+ return;
+
+ for (auto *gd : INDIListener::Instance()->getDevices())
+ {
+ ISD::Telescope* telescope = dynamic_cast<ISD::Telescope*>(gd);
+
+ if (telescope != nullptr && telescope->isConnected() && telescope->canSync())
+ {
+ ISD::GDSetCommand SlewCMD(INDI_SWITCH, "ON_COORD_SET", "SYNC", ISS_ON, this);
+
+ gd->setProperty(&SlewCMD);
+
+ gd->runCommand(INDI_SEND_COORDS, m_SkyMap->mousePoint());
+ return;
+ }
+ }
+#endif
+}
+
+void KStars::slotINDITelescopeAbort()
+{
+#ifdef HAVE_INDI
+ if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
+ return;
+
+ for (auto *gd : INDIListener::Instance()->getDevices())
+ {
+ ISD::Telescope* telescope = dynamic_cast<ISD::Telescope*>(gd);
+
+ if (telescope != nullptr && telescope->isConnected())
+ {
+ telescope->Abort();
+ return;
+ }
+ }
+#endif
+}
+
+void KStars::slotINDITelescopePark()
+{
+#ifdef HAVE_INDI
+ if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
+ return;
+
+ for (auto *gd : INDIListener::Instance()->getDevices())
+ {
+ ISD::Telescope* telescope = dynamic_cast<ISD::Telescope*>(gd);
+
+ if (telescope != nullptr && telescope->isConnected() && telescope->canPark())
+ {
+ telescope->Park();
+ return;
+ }
+ }
+#endif
+}
+
+void KStars::slotINDITelescopeUnpark()
+{
+#ifdef HAVE_INDI
+ if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
+ return;
+
+ for (auto *gd : INDIListener::Instance()->getDevices())
+ {
+ ISD::Telescope* telescope = dynamic_cast<ISD::Telescope*>(gd);
+
+ if (telescope != nullptr && telescope->isConnected() && telescope->canPark())
+ {
+ telescope->UnPark();
+ return;
+ }
+ }
+#endif
+}
+
void KStars::slotGeoLocator()
{
QPointer<LocationDialog> locationdialog = new LocationDialog(this);
diff --git a/kstars/kstarsinit.cpp b/kstars/kstarsinit.cpp
index 974c616a2..d139920af 100644
--- a/kstars/kstarsinit.cpp
+++ b/kstars/kstarsinit.cpp
@@ -401,8 +401,8 @@ void KStars::initActions()
actionCollection()->addAction("skycalendar", this, SLOT(slotCalendar())) << i18n("Sky Calendar");
#ifdef HAVE_INDI
- ka = actionCollection()->addAction("ekos", this, SLOT(slotEkos())) << i18n("Ekos") <<
- QKeySequence(Qt::CTRL + Qt::Key_K);
+ ka = actionCollection()->addAction("ekos", this, SLOT(slotEkos()))
+ << i18n("Ekos") << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_K);
ka->setShortcutContext(Qt::ApplicationShortcut);
#endif
@@ -451,10 +451,10 @@ void KStars::initActions()
actionCollection()->addAction("device_manager", this, SLOT(slotINDIDriver()))
<< i18n("Device Manager...")
<< QIcon::fromTheme("network-server", QIcon(":/icons/breeze/default/network-server.svg"))
- << QKeySequence(Qt::CTRL + Qt::Key_D);
+ << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_D);
ka = actionCollection()->addAction("indi_cpl", this, SLOT(slotINDIPanel()))
<< i18n("INDI Control Panel...")
- << QKeySequence(Qt::CTRL + Qt::Key_I);
+ << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_I);
ka->setShortcutContext(Qt::ApplicationShortcut);
ka->setEnabled(false);
#else
@@ -565,6 +565,21 @@ void KStars::initActions()
<< QIcon::fromTheme("center_telescope", QIcon(":/icons/center_telescope.svg"))
<< ToolTip(i18n("Toggle Lock Telescope Center"));
ka->setEnabled(false);
+
+ ka = actionCollection()->addAction("telescope_track", this, SLOT(slotINDITelescopeTrack()))
+ << i18n("Track with the telescope (INDI)") << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_T);
+ ka = actionCollection()->addAction("telescope_slew", this, SLOT(slotINDITelescopeSlew()))
+ << i18n("Slew with the telescope (INDI)") << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_S);
+ ka = actionCollection()->addAction("telescope_sync", this, SLOT(slotINDITelescopeSync()))
+ << i18n("Sync with the telescope (INDI)") << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_Y);
+ ka = actionCollection()->addAction("telescope_abort", this, SLOT(slotINDITelescopeAbort()))
+ << i18n("Abort any telescope motion (INDI)") << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_A);
+ ka->setShortcutContext(Qt::ApplicationShortcut);
+ ka = actionCollection()->addAction("telescope_park", this, SLOT(slotINDITelescopePark()))
+ << i18n("Park the telescope (INDI)") << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_P);
+ ka = actionCollection()->addAction("telescope_unpark", this, SLOT(slotINDITelescopeUnpark()))
+ << i18n("Unpark the telescope (INDI)") << QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_U);
+ ka->setShortcutContext(Qt::ApplicationShortcut);
#endif
}
diff --git a/kstars/skymap.h b/kstars/skymap.h
index 3b5033db2..4fbed8459 100644
--- a/kstars/skymap.h
+++ b/kstars/skymap.h
@@ -196,6 +196,13 @@ class SkyMap : public QGraphicsView
*/
SkyPoint *clickedPoint() { return &ClickedPoint; }
+ /**
+ * @short Retrieve the mouse pointer position.
+ *
+ * @return The sky coordinates where the mouse pointer is over.
+ */
+ SkyPoint *mousePoint() { return &m_MousePoint; }
+
/** @short Set the ClickedPoint to the skypoint given as an argument.
*@param f pointer to the new ClickedPoint.
*/
More information about the kde-doc-english
mailing list