Index: doc/commands.docbook =================================================================== --- doc/commands.docbook +++ doc/commands.docbook @@ -546,9 +546,86 @@ + +&Shift;&Meta;I + + + +Opens INDI control window to setup and start telescope equipment. + + + + + + +&Shift;&Meta;A + + + +Abort any motion of a connected telescope via INDI. + + + + + + +&Shift;&Meta;S + + + +Slew a connected telescope via INDI to the mouse pointer. + + + + + + +&Shift;&Meta;T + + + +Track a target under the mouse pointer with a connected telescope via INDI. + + + + + + +&Shift;&Meta;Y + + + +Sync a connected telescope via INDI to the mouse pointer. + + + + + + +&Shift;&Meta;P + + + +Park a connected telescope via INDI. + + + + + + +&Shift;&Meta;U + + + +Unpark a connected telescope via INDI. + + + + + -&Ctrl;K +&Shift;&Meta;K Tools Ekos Index: kstars/kstars.h =================================================================== --- kstars/kstars.h +++ kstars/kstars.h @@ -574,11 +574,28 @@ /** 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. */ Index: kstars/kstarsactions.cpp =================================================================== --- kstars/kstarsactions.cpp +++ kstars/kstarsactions.cpp @@ -726,6 +726,132 @@ #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(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(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(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(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(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(gd); + + if (telescope != nullptr && telescope->isConnected() && telescope->canPark()) + { + telescope->UnPark(); + return; + } + } +#endif +} + void KStars::slotGeoLocator() { QPointer locationdialog = new LocationDialog(this); Index: kstars/kstarsinit.cpp =================================================================== --- kstars/kstarsinit.cpp +++ kstars/kstarsinit.cpp @@ -401,8 +401,8 @@ 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 @@ 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 @@ << 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 } Index: kstars/skymap.h =================================================================== --- kstars/skymap.h +++ kstars/skymap.h @@ -196,6 +196,13 @@ */ 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. */