diff --git a/kstars/fitsviewer/fitslabel.cpp b/kstars/fitsviewer/fitslabel.cpp --- a/kstars/fitsviewer/fitslabel.cpp +++ b/kstars/fitsviewer/fitslabel.cpp @@ -279,6 +279,10 @@ pmenu->removeAction(action); if (action->text().left(12) == "Attach Label") pmenu->removeAction(action); + if (action->text().left(4) == "GOTO") + pmenu->removeAction(action); + if (action->text().left(4) == "SYNC") + pmenu->removeAction(action); } pmenu->popup(e->globalPos()); KStars::Instance()->map()->setClickedObject(object); diff --git a/kstars/kspopupmenu.cpp b/kstars/kspopupmenu.cpp --- a/kstars/kspopupmenu.cpp +++ b/kstars/kspopupmenu.cpp @@ -276,7 +276,7 @@ addSeparator(); //Insert item for centering on object - addAction(i18n("Center && Track"), ks->map(), SLOT(slotCenter())); + addAction(i18n("Center && Track in Skymap"), ks->map(), SLOT(slotCenter())); //Insert item for measuring distances //FIXME: add key shortcut to menu items properly! addAction(i18n("Angular Distance To... ["), ks->map(), SLOT(slotBeginAngularDistance())); @@ -341,7 +341,41 @@ } //Insert item for centering on object - addAction(i18n("Center && Track"), map, SLOT(slotCenter())); + addAction(i18n("Center && Track in Skymap"), map, SLOT(slotCenter())); + +#ifdef HAVE_INDI + if (INDIListener::Instance()->size() != 0) + { + foreach (ISD::GDInterface *gd, INDIListener::Instance()->getDevices()) + { + if(gd->getBaseDevice() == nullptr) + continue; + + if(gd->getType() == KSTARS_TELESCOPE) + { + ISD::GDInterface *telescope = INDIListener::Instance()->getDevice(gd->getDeviceName()); + if(telescope) + { + addAction(i18nc("GOTO - %1", "GOTO - %1").arg(gd->getDeviceName()), this, [this, gd, telescope] { + ISD::GDSetCommand *cmd = new ISD::GDSetCommand(INDI_SWITCH, "ON_COORD_SET", "TRACK", ISS_ON, this); + gd->setProperty(cmd); + telescope->runCommand(INDI_SEND_COORDS); + });; + addAction(i18nc("SYNC - %1", "SYNC - %1").arg(gd->getDeviceName()), this, [this, gd, telescope] { + if (KMessageBox::warningYesNo( + nullptr, i18n("Are you sure you want to Sync your Telescope on this position?"), + i18n("Sync Scope?")) == KMessageBox::Yes) + { + ISD::GDSetCommand *cmd = new ISD::GDSetCommand(INDI_SWITCH, "ON_COORD_SET", "SYNC", ISS_ON, this); + gd->setProperty(cmd); + telescope->runCommand(INDI_SEND_COORDS); + } + });; + } + } + } + } +#endif if (showFlags) { @@ -543,6 +577,9 @@ if (INDIListener::Instance()->size() == 0) return; + QMenu *INDIProperties= new QMenu(i18n("INDI Properties")); + addMenu(INDIProperties); + foreach (ISD::GDInterface *gd, INDIListener::Instance()->getDevices()) { INDI::BaseDevice *bd = gd->getBaseDevice(); @@ -569,7 +606,7 @@ if (menuDevice == nullptr) { menuDevice = new QMenu(gd->getDeviceName()); - addMenu(menuDevice); + INDIProperties->addMenu(menuDevice); } QAction *a = menuDevice->addAction(svp->sp[i].label); @@ -586,7 +623,7 @@ if (telescope) { - connect(a, &QAction::triggered, this, [this, telescope] { telescope->runCommand(INDI_SEND_COORDS); });; + connect(a, &QAction::triggered, this, [telescope] { telescope->runCommand(INDI_SEND_COORDS); });; } } }