7#include "kspopupmenu.h"
9#include "config-kstars.h"
12#include "kstarsdata.h"
14#include "skyobjects/skyobject.h"
15#include "skyobjects/starobject.h"
16#include "skyobjects/trailobject.h"
17#include "skyobjects/catalogobject.h"
18#include "skyobjects/ksmoon.h"
19#include "skyobjects/satellite.h"
20#include "skyobjects/supernova.h"
21#include "skycomponents/constellationboundarylines.h"
22#include "skycomponents/flagcomponent.h"
23#include "skycomponents/skymapcomposite.h"
24#include "skyobjectuserdata.h"
25#include "tools/whatsinteresting/wiview.h"
26#include "catalogsdb.h"
27#include "observinglist.h"
30#include "indi/indilistener.h"
31#include "indi/guimanager.h"
32#include "indi/driverinfo.h"
33#include "indi/indistd.h"
34#include "indi/indidevice.h"
35#include "indi/indigroup.h"
36#include "indi/indiproperty.h"
37#include "indi/indielement.h"
38#include "indi/indimount.h"
39#include <basedevice.h>
42#include <KLocalizedString>
44#include <QWidgetAction>
51 if (
m > -30 &&
m < 90)
88 i18nc(
"the time at which an object falls below the horizon",
89 "Set time: %1", time);
91 if (o->
alt().Degrees() > 0)
92 return isRaise ?
i18n(
"No rise time: Circumpolar") :
93 i18n(
"No set time: Circumpolar");
95 return isRaise ?
i18n(
"No rise time: Never rises") :
96 i18n(
"No set time: Never rises");
106 return i18n(
"Transit time: %1",
121 if (m_EditActionMapping)
123 delete m_EditActionMapping;
126 if (m_DeleteActionMapping)
128 delete m_DeleteActionMapping;
145void KSPopupMenu::slotEditFlag()
147 if (m_CurrentFlagIdx != -1)
153void KSPopupMenu::slotDeleteFlag()
155 if (m_CurrentFlagIdx != -1)
161void KSPopupMenu::slotEditFlag(
QAction *action)
163 int idx = m_EditActionMapping->
value(action, -1);
176void KSPopupMenu::slotDeleteFlag(
QAction *action)
178 int idx = m_DeleteActionMapping->
value(action, -1);
196 if (star->
name() !=
"star")
212 initPopupMenu(star, name,
i18n(
"star"),
215 if (star->
name() !=
"star")
230 QString name = getObjectName(obj);
240 float b = obj->
b() > 0 ? obj->
b() : obj->
a();
244 initPopupMenu(obj, name, typeName, info);
256void KSPopupMenu::createMoonMenu(
KSMoon *moon)
266 QString velocity, altitude, range;
275 addFancyLabel(
i18n(
"satellite"));
276 addFancyLabel(KStarsData::Instance()
278 ->constellationBoundary()
283 addFancyLabel(
i18n(
"Velocity: %1 km/s", velocity), -2);
284 addFancyLabel(
i18n(
"Altitude: %1 km", altitude), -2);
285 addFancyLabel(
i18n(
"Range: %1 km", range), -2);
295 i18n(
"Angular Distance To... ["),
ks->map(),
296 SLOT(slotBeginAngularDistance()));
298 i18n(
"Starhop from here to... "),
ks->map(),
299 SLOT(slotBeginStarHop()));
301 SLOT(slotCopyTLE()));
306 SLOT(slotRemoveObjectLabel()));
309 SLOT(slotAddObjectLabel()));
338 SkyMap *map = SkyMap::Instance();
341 bool showLabel = (name !=
i18n(
"star") && !name.
isEmpty());
345 Name =
i18n(
"Empty sky");
350 addFancyLabel(KStarsData::Instance()
352 ->constellationBoundary()
353 ->constellationName(obj));
365 if (map->isInObjectPointingMode() && obj->
type() != 21)
377 initFlagActions(obj);
383 i18n(
"Angular Distance To... ["), map,
384 SLOT(slotBeginAngularDistance()));
386 i18n(
"Starhop from here to... "), map,
SLOT(slotBeginStarHop()));
391 i18nc(
"Show Detailed Information Dialog",
"Details"), map,
395 SLOT(slotCopyCoordinates()));
400 if (
map->isObjectLabeled(obj))
403 SLOT(slotRemoveObjectLabel()));
408 SLOT(slotAddObjectLabel()));
414 if (data->observingList()->
contains(obj))
416 i18n(
"Remove From Observing WishList"), data->observingList(),
417 SLOT(slotRemoveObject()));
420 data->observingList(),
SLOT(slotAddObject()));
433 SLOT(slotEyepieceView()));
447 this,
SLOT(slotViewInWI()));
450void KSPopupMenu::initFlagActions(
SkyObject *obj)
454 QList<int> flags =
ks->data()->skyComposite()->flags()->getFlagsNearPix(obj, 5);
460 SLOT(slotAddFlag()));
463 else if (flags.size() == 1)
467 SLOT(slotEditFlag()));
469 SLOT(slotDeleteFlag()));
471 m_CurrentFlagIdx = flags.first();
487 if (m_EditActionMapping)
489 delete m_EditActionMapping;
492 if (m_DeleteActionMapping)
494 delete m_DeleteActionMapping;
500 foreach (
int idx, flags)
532 const auto &
user_data = KStarsData::Instance()->getUserData(obj->
name());
535 for (
const auto &
res : std::list <
536 std::tuple<QString, SkyObjectUserdata::LinkList, SkyObjectUserdata::Type >>
538 {
i18n(
"Image Resources"),
image_list, SkyObjectUserdata::Type::image },
542 const auto &
title = std::get<0>(
res);
543 const auto &list = std::get<1>(
res);
544 const auto &type = std::get<2>(
res);
550 for (
const auto &entry : list)
554 if (type == SkyObjectUserdata::Type::website)
556 i18nc(
"Image/info menu item (should be translated)",
558 ks->map(),
SLOT(slotInfo()));
561 i18nc(
"Image/info menu item (should be translated)",
563 ks->map(),
SLOT(slotImage()));
578 if (object->getCatalog().mut &&
579 manager.get_object(object->getObjectId()).first)
582 SLOT(slotRemoveCustomObject()));
599void KSPopupMenu::addINDI()
602 if (INDIListener::Instance()->
size() == 0)
607 if (!(
oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
619 if (mount->canGoto() || mount->canSync())
621 if (mount->canGoto())
624 i18nc(
"Move mount to target",
"Goto"));
627 [mount] { mount->Slew(SkyMap::Instance()->clickedPoint()); });
629 if (
mount->canSync())
633 i18nc(
"Synchronize mount to target",
"Sync"));
636 [mount] {
mount->Sync(SkyMap::Instance()->clickedPoint()); });
642 if (
mount->canAbort())
651 if (
mount->canPark())
660 unpark->setEnabled(
mount->isParked());
667 if (clickedObject && clickedObject->
type() == SkyObject::SATELLITE &&
668 (
mount->canTrackSatellite()))
679 mount->setSatelliteTLEandTrack(sat->
tle(), currentTime,
685 if (
mount->canCustomPark())
688 i18n(
"Goto && Set As Parking Position"));
691 [mount] {
mount->setCustomParking(); });
697 [mount] {
mount->find(); });
715 act->setDefaultWidget(label);
719void KSPopupMenu::slotViewInWI()
A simple container object to hold the minimum information for a Deep Sky Object to be drawn on the sk...
const CatalogsDB::Catalog getCatalog() const
Get information about the catalog that this objects stems from.
Manages the catalog database and provides an interface to provide an interface to query and modify th...
INDIListener is responsible for creating ISD::GDInterface generic devices as new devices arrive from ...
Provides necessary information about the Moon.
QString phaseName() const
KStarsData is the backbone of KStars.
const KStarsDateTime & ut() const
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
KStarsDateTime addSecs(double s) const
This is the main window for KStars.
static KStars * Instance()
bool contains(const SkyObject *o, bool session=false)
Represents an artificial satellites.
This is the canvas on which the sky is painted.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
virtual SkyObject * clone() const
Create copy of object.
QString translatedName() const
virtual QString name(void) const
QString translatedName2() const
QString translatedLongName() const
bool isSolarSystem() const
virtual QString longname(void) const
QTime transitTime(const KStarsDateTime &dt, const GeoLocation *geo) const
The same iteration technique described in riseSetTime() is used here.
QTime riseSetTime(const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact=true) const
Determine the time at which the point will rise or set.
static QString typeName(const int t)
The sky coordinates of a point in the sky.
void setAlt(dms alt)
Sets Alt, the Altitude.
void setAz(dms az)
Sets Az, the Azimuth.
This is a subclass of SkyObject.
QString name(void) const override
If star is unnamed return "star" otherwise return the name.
QString sptype(void) const
Returns entire spectral type string.
Represents the supernova object.
provides a SkyObject with an attachable Trail
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
char * toString(const EngineQuery &query)
KIOCORE_EXPORT SimpleJob * mount(bool ro, const QByteArray &fstype, const QString &dev, const QString &point, JobFlags flags=DefaultFlags)
QString label(StandardShortcut id)
QString name(StandardShortcut id)
void setData(const QVariant &data)
void triggered(bool checked)
iterator insert(const Key &key, const T &value)
T value(const Key &key) const const
QIcon fromTheme(const QString &name)
QString toString(QDate date, FormatType format) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QPixmap fromImage(QImage &&image, Qt::ImageConversionFlags flags)
QString arg(Args &&... args) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
QString & setNum(double n, char format, int precision)
QByteArray toLocal8Bit() const const
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
QTime addSecs(int s) const const
bool isValid(int h, int m, int s, int ms)