Kstars

kspopupmenu.cpp
1 /*
2  SPDX-FileCopyrightText: 2001 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "kspopupmenu.h"
8 
9 #include "config-kstars.h"
10 
11 #include "kstars.h"
12 #include "kstarsdata.h"
13 #include "skymap.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"
28 
29 #ifdef HAVE_INDI
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>
40 #endif
41 
42 #include <KLocalizedString>
43 
44 #include <QWidgetAction>
45 
46 namespace
47 {
48 // Convert magnitude to string representation for QLabel
49 QString magToStr(double m)
50 {
51  if (m > -30 && m < 90)
52  return QString("%1<sup>m</sup>").arg(m, 0, 'f', 2);
53  else
54  return QString();
55 }
56 
57 // Return object name
58 QString getObjectName(SkyObject *obj)
59 {
60  // FIXME: make logic less convoluted.
61  if (obj->longname() != obj->name()) // Object has proper name
62  {
63  return obj->translatedLongName() + ", " + obj->translatedName();
64  }
65  else
66  {
67  if (!obj->translatedName2().isEmpty())
68  return obj->translatedName() + ", " + obj->translatedName2();
69  else
70  return obj->translatedName();
71  }
72 }
73 
74 // String representation for rise/set time of object. If object
75 // doesn't rise/set returns descriptive string.
76 //
77 // Second parameter choose between raise and set. 'true' for
78 // raise, 'false' for set.
79 QString riseSetTimeLabel(SkyObject *o, bool isRaise)
80 {
81  KStarsData *data = KStarsData::Instance();
82  QTime t = o->riseSetTime(data->ut(), data->geo(), isRaise);
83  if (t.isValid())
84  {
85  //We can round to the nearest minute by simply adding 30 seconds to the time.
87  return isRaise ? i18n("Rise time: %1", time) :
88  i18nc("the time at which an object falls below the horizon",
89  "Set time: %1", time);
90  }
91  if (o->alt().Degrees() > 0)
92  return isRaise ? i18n("No rise time: Circumpolar") :
93  i18n("No set time: Circumpolar");
94  else
95  return isRaise ? i18n("No rise time: Never rises") :
96  i18n("No set time: Never rises");
97 }
98 
99 // String representation for transit time for object
100 QString transitTimeLabel(SkyObject *o)
101 {
102  KStarsData *data = KStarsData::Instance();
103  QTime t = o->transitTime(data->ut(), data->geo());
104  if (t.isValid())
105  //We can round to the nearest minute by simply adding 30 seconds to the time.
106  return i18n("Transit time: %1",
108  else
109  return "--:--";
110 }
111 } // namespace
112 
114  : QMenu(KStars::Instance()), m_CurrentFlagIdx(-1), m_EditActionMapping(nullptr),
115  m_DeleteActionMapping(nullptr)
116 {
117 }
118 
120 {
121  if (m_EditActionMapping)
122  {
123  delete m_EditActionMapping;
124  }
125 
126  if (m_DeleteActionMapping)
127  {
128  delete m_DeleteActionMapping;
129  }
130 }
131 
133 {
134  KStars *ks = KStars::Instance();
135  SkyObject o(SkyObject::TYPE_UNKNOWN, nullObj->ra(), nullObj->dec());
136  o.setAlt(nullObj->alt());
137  o.setAz(nullObj->az());
138  initPopupMenu(&o, i18n("Empty sky"), QString(), QString(), false, false);
139  addAction(i18nc("Sloan Digital Sky Survey", "Show SDSS Image"), ks->map(),
140  SLOT(slotSDSS()));
141  addAction(i18nc("Digitized Sky Survey", "Show DSS Image"), ks->map(),
142  SLOT(slotDSS()));
143 }
144 
145 void KSPopupMenu::slotEditFlag()
146 {
147  if (m_CurrentFlagIdx != -1)
148  {
149  KStars::Instance()->map()->slotEditFlag(m_CurrentFlagIdx);
150  }
151 }
152 
153 void KSPopupMenu::slotDeleteFlag()
154 {
155  if (m_CurrentFlagIdx != -1)
156  {
157  KStars::Instance()->map()->slotDeleteFlag(m_CurrentFlagIdx);
158  }
159 }
160 
161 void KSPopupMenu::slotEditFlag(QAction *action)
162 {
163  int idx = m_EditActionMapping->value(action, -1);
164 
165  if (idx == -1)
166  {
167  return;
168  }
169 
170  else
171  {
172  KStars::Instance()->map()->slotEditFlag(idx);
173  }
174 }
175 
176 void KSPopupMenu::slotDeleteFlag(QAction *action)
177 {
178  int idx = m_DeleteActionMapping->value(action, -1);
179 
180  if (idx == -1)
181  {
182  return;
183  }
184 
185  else
186  {
188  }
189 }
190 
192 {
193  KStars *ks = KStars::Instance();
194  //Add name, rise/set time, center/track, and detail-window items
195  QString name;
196  if (star->name() != "star")
197  {
198  name = star->translatedLongName();
199  }
200  else
201  {
202  if (star->getHDIndex())
203  {
204  name = QString("HD%1").arg(QString::number(star->getHDIndex()));
205  }
206  else
207  {
208  // FIXME: this should be some catalog name too
209  name = "Star";
210  }
211  }
212  initPopupMenu(star, name, i18n("star"),
213  i18n("%1<sup>m</sup>, %2", star->mag(), star->sptype()));
214  //If the star is named, add custom items to popup menu based on object's ImageList and InfoList
215  if (star->name() != "star")
216  {
217  addLinksToMenu(star);
218  }
219  else
220  {
221  addAction(i18nc("Sloan Digital Sky Survey", "Show SDSS Image"), ks->map(),
222  SLOT(slotSDSS()));
223  addAction(i18nc("Digitized Sky Survey", "Show DSS Image"), ks->map(),
224  SLOT(slotDSS()));
225  }
226 }
227 
229 {
230  QString name = getObjectName(obj);
231  QString typeName = obj->typeName();
232 
233  QString info = QString("%1<br>Catalog: %2")
234  .arg(magToStr(obj->mag()))
235  .arg(obj->getCatalog().name);
236 
237  if (obj->a() > 0)
238  {
239  float a = obj->a();
240  float b = obj->b() > 0 ? obj->b() : obj->a(); // Assume circular if a != 0 but b == 0
241  info += QString("<br>%1′×%2′").arg(a).arg(b);
242  }
243 
244  initPopupMenu(obj, name, typeName, info);
245  addLinksToMenu(obj);
246 }
247 
249 {
250  QString info = magToStr(p->mag());
251  QString type = i18n("Solar system object");
252  initPopupMenu(p, p->translatedName(), type, info);
253  addLinksToMenu(p, false); //don't offer DSS images for planets
254 }
255 
256 void KSPopupMenu::createMoonMenu(KSMoon *moon)
257 {
258  QString info = QString("%1, %2").arg(magToStr(moon->mag()), moon->phaseName());
259  initPopupMenu(moon, moon->translatedName(), QString(), info);
260  addLinksToMenu(moon, false); //don't offer DSS images for planets
261 }
262 
264 {
265  KStars *ks = KStars::Instance();
266  QString velocity, altitude, range;
267  velocity.setNum(satellite->velocity());
268  altitude.setNum(satellite->altitude());
269  range.setNum(satellite->range());
270 
271  clear();
272 
273  addFancyLabel(satellite->name());
274  addFancyLabel(satellite->id());
275  addFancyLabel(i18n("satellite"));
276  addFancyLabel(KStarsData::Instance()
277  ->skyComposite()
278  ->constellationBoundary()
279  ->constellationName(satellite));
280 
281  addSeparator();
282 
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);
286 
287  addSeparator();
288 
289  //Insert item for centering on object
290  addAction(QIcon::fromTheme("snap-nodes-center"), i18n("Center && Track"), ks->map(),
291  SLOT(slotCenter()));
292  //Insert item for measuring distances
293  //FIXME: add key shortcut to menu items properly!
294  addAction(QIcon::fromTheme("kruler-east"),
295  i18n("Angular Distance To... ["), ks->map(),
296  SLOT(slotBeginAngularDistance()));
297  addAction(QIcon::fromTheme("show-path-outline"),
298  i18n("Starhop from here to... "), ks->map(),
299  SLOT(slotBeginStarHop()));
300  addAction(QIcon::fromTheme("edit-copy"), i18n("Copy TLE to Clipboard"), ks->map(),
301  SLOT(slotCopyTLE()));
302 
303  //Insert "Add/Remove Label" item
304  if (ks->map()->isObjectLabeled(satellite))
305  addAction(QIcon::fromTheme("list-remove"), i18n("Remove Label"), ks->map(),
306  SLOT(slotRemoveObjectLabel()));
307  else
308  addAction(QIcon::fromTheme("label"), i18n("Attach Label"), ks->map(),
309  SLOT(slotAddObjectLabel()));
310 
311  addSeparator();
312  addINDI();
313 }
314 
316 {
317  QString name = supernova->name();
318  float mag = supernova->mag();
319  float z = supernova->getRedShift();
320  QString type = supernova->getType();
321 
322  QString info;
323 
324  if (mag < 99)
325  info += QString("%1<sup>m</sup> ").arg(mag);
326  info += type;
327  if (z < 99)
328  info += QString(" z: %1").arg(QString::number(z, 'f', 2));
329 
330  initPopupMenu(supernova, name, i18n("supernova"), info);
331 }
332 
333 void KSPopupMenu::initPopupMenu(SkyObject *obj, const QString &name, const QString &type,
334  QString info, bool showDetails, bool showObsList,
335  bool showFlags)
336 {
337  KStarsData *data = KStarsData::Instance();
338  SkyMap *map = SkyMap::Instance();
339 
340  clear();
341  bool showLabel = (name != i18n("star") && !name.isEmpty());
342  QString Name = name;
343 
344  if (Name.isEmpty())
345  Name = i18n("Empty sky");
346 
347  addFancyLabel(Name);
348  addFancyLabel(type);
349  addFancyLabel(info);
350  addFancyLabel(KStarsData::Instance()
351  ->skyComposite()
352  ->constellationBoundary()
353  ->constellationName(obj));
354 
355  //Insert Rise/Set/Transit labels
356  SkyObject *o = obj->clone();
357  addSeparator();
358  addFancyLabel(riseSetTimeLabel(o, true), -2);
359  addFancyLabel(riseSetTimeLabel(o, false), -2);
360  addFancyLabel(transitTimeLabel(o), -2);
361  addSeparator();
362  delete o;
363 
364  // Show 'Select this object' item when in object pointing mode and when obj is not empty sky
365  if (map->isInObjectPointingMode() && obj->type() != 21)
366  {
367  addAction(i18n("Select this object"), map, SLOT(slotObjectSelected()));
368  }
369 
370  //Insert item for centering on object
371  addAction(QIcon::fromTheme("snap-nodes-center"), i18n("Center && Track"), map,
372  SLOT(slotCenter()));
373 
374  if (showFlags)
375  {
376  //Insert actions for flag operations
377  initFlagActions(obj);
378  }
379 
380  //Insert item for measuring distances
381  //FIXME: add key shortcut to menu items properly!
382  addAction(QIcon::fromTheme("kruler-east"),
383  i18n("Angular Distance To... ["), map,
384  SLOT(slotBeginAngularDistance()));
385  addAction(QIcon::fromTheme("show-path-outline"),
386  i18n("Starhop from here to... "), map, SLOT(slotBeginStarHop()));
387 
388  //Insert item for Showing details dialog
389  if (showDetails)
390  addAction(QIcon::fromTheme("view-list-details"),
391  i18nc("Show Detailed Information Dialog", "Details"), map,
392  SLOT(slotDetail()));
393 
394  addAction(QIcon::fromTheme("edit-copy"), i18n("Copy Coordinates"), map,
395  SLOT(slotCopyCoordinates()));
396 
397  //Insert "Add/Remove Label" item
398  if (showLabel)
399  {
400  if (map->isObjectLabeled(obj))
401  {
402  addAction(QIcon::fromTheme("list-remove"), i18n("Remove Label"), map,
403  SLOT(slotRemoveObjectLabel()));
404  }
405  else
406  {
407  addAction(QIcon::fromTheme("label"), i18n("Attach Label"), map,
408  SLOT(slotAddObjectLabel()));
409  }
410  }
411  // Should show observing list
412  if (showObsList)
413  {
414  if (data->observingList()->contains(obj))
415  addAction(QIcon::fromTheme("list-remove"),
416  i18n("Remove From Observing WishList"), data->observingList(),
417  SLOT(slotRemoveObject()));
418  else
419  addAction(QIcon::fromTheme("bookmarks"), i18n("Add to Observing WishList"),
420  data->observingList(), SLOT(slotAddObject()));
421  }
422  // Should we show trail actions
423  TrailObject *t = dynamic_cast<TrailObject *>(obj);
424  if (t)
425  {
426  if (t->hasTrail())
427  addAction(i18n("Remove Trail"), map, SLOT(slotRemovePlanetTrail()));
428  else
429  addAction(i18n("Add Trail"), map, SLOT(slotAddPlanetTrail()));
430  }
431 
432  addAction(QIcon::fromTheme("redeyes"), i18n("Simulate Eyepiece View"), map,
433  SLOT(slotEyepieceView()));
434 
435  addSeparator();
436  if (obj->isSolarSystem() &&
437  obj->type() !=
438  SkyObject::
439  COMET) // FIXME: We now have asteroids -- so should this not be isMajorPlanet() || Pluto?
440  {
441  addAction(i18n("View in XPlanet"), map, SLOT(slotStartXplanetViewer()));
442  }
443  addSeparator();
444  addINDI();
445 
446  addAction(QIcon::fromTheme("view-list-details"), i18n("View in What's Interesting"),
447  this, SLOT(slotViewInWI()));
448 }
449 
450 void KSPopupMenu::initFlagActions(SkyObject *obj)
451 {
452  KStars *ks = KStars::Instance();
453 
454  QList<int> flags = ks->data()->skyComposite()->flags()->getFlagsNearPix(obj, 5);
455 
456  if (flags.isEmpty())
457  {
458  // There is no flag around clicked SkyObject
459  addAction(QIcon::fromTheme("flag"), i18n("Add Flag..."), ks->map(),
460  SLOT(slotAddFlag()));
461  }
462 
463  else if (flags.size() == 1)
464  {
465  // There is only one flag around clicked SkyObject
466  addAction(QIcon::fromTheme("document-edit"), i18n("Edit Flag"), this,
467  SLOT(slotEditFlag()));
468  addAction(QIcon::fromTheme("delete"), i18n("Delete Flag"), this,
469  SLOT(slotDeleteFlag()));
470 
471  m_CurrentFlagIdx = flags.first();
472  }
473 
474  else
475  {
476  // There are more than one flags around clicked SkyObject - we need to create submenus
477  QMenu *editMenu = new QMenu(i18n("Edit Flag..."), KStars::Instance());
478  editMenu->setIcon(QIcon::fromTheme("document-edit"));
479  QMenu *deleteMenu = new QMenu(i18n("Delete Flag..."), KStars::Instance());
480  deleteMenu->setIcon(QIcon::fromTheme("delete"));
481 
482  connect(editMenu, SIGNAL(triggered(QAction *)), this,
483  SLOT(slotEditFlag(QAction *)));
484  connect(deleteMenu, SIGNAL(triggered(QAction *)), this,
485  SLOT(slotDeleteFlag(QAction *)));
486 
487  if (m_EditActionMapping)
488  {
489  delete m_EditActionMapping;
490  }
491 
492  if (m_DeleteActionMapping)
493  {
494  delete m_DeleteActionMapping;
495  }
496 
497  m_EditActionMapping = new QHash<QAction *, int>;
498  m_DeleteActionMapping = new QHash<QAction *, int>;
499 
500  foreach (int idx, flags)
501  {
502  QIcon flagIcon(
503  QPixmap::fromImage(ks->data()->skyComposite()->flags()->image(idx)));
504 
505  QString flagLabel = ks->data()->skyComposite()->flags()->label(idx);
506  if (flagLabel.size() > 35)
507  {
508  flagLabel = flagLabel.left(35);
509  flagLabel.append("...");
510  }
511 
512  QAction *editAction = new QAction(flagIcon, flagLabel, ks);
513  editAction->setIconVisibleInMenu(true);
514  editMenu->addAction(editAction);
515  m_EditActionMapping->insert(editAction, idx);
516 
517  QAction *deleteAction = new QAction(flagIcon, flagLabel, ks);
518  deleteAction->setIconVisibleInMenu(true);
519  deleteMenu->addAction(deleteAction);
520  m_DeleteActionMapping->insert(deleteAction, idx);
521  }
522 
523  addMenu(editMenu);
524  addMenu(deleteMenu);
525  }
526 }
527 
528 void KSPopupMenu::addLinksToMenu(SkyObject *obj, bool showDSS)
529 {
530  KStars *ks = KStars::Instance();
531 
532  const auto &user_data = KStarsData::Instance()->getUserData(obj->name());
533  const auto &image_list = user_data.images();
534  const auto &website_list = user_data.websites();
535  for (const auto &res : std::list <
536  std::tuple<QString, SkyObjectUserdata::LinkList, SkyObjectUserdata::Type >>
537 {
538  { i18n("Image Resources"), image_list, SkyObjectUserdata::Type::image },
539  { i18n("Web Links"), website_list, SkyObjectUserdata::Type::website }
540  })
541  {
542  const auto &title = std::get<0>(res);
543  const auto &list = std::get<1>(res);
544  const auto &type = std::get<2>(res);
545 
546  if (!list.empty())
547  {
548  QMenu *LinkSubMenu = new QMenu();
549  LinkSubMenu->setTitle(title);
550  for (const auto &entry : list)
551  {
552  QString t = QString(entry.title);
553  QAction *action;
554  if (type == SkyObjectUserdata::Type::website)
555  action = LinkSubMenu->addAction(
556  i18nc("Image/info menu item (should be translated)",
557  t.toLocal8Bit()),
558  ks->map(), SLOT(slotInfo()));
559  else
560  action = LinkSubMenu->addAction(
561  i18nc("Image/info menu item (should be translated)",
562  t.toLocal8Bit()),
563  ks->map(), SLOT(slotImage()));
564 
565  action->setData(entry.url);
566  }
567  addMenu(LinkSubMenu);
568  }
569  }
570 
571  // Look for a custom object
572  {
573  auto *object = dynamic_cast<CatalogObject *>(obj);
574  if (object)
575  {
576  CatalogsDB::DBManager manager{ CatalogsDB::dso_db_path() };
577 
578  if (object->getCatalog().mut &&
579  manager.get_object(object->getObjectId()).first)
580  {
581  addAction(i18n("Remove From Local Catalog"), ks->map(),
582  SLOT(slotRemoveCustomObject()));
583  }
584  }
585  }
586 
587  if (showDSS)
588  {
589  addAction(i18nc("Sloan Digital Sky Survey", "Show SDSS Image"), ks->map(),
590  SLOT(slotSDSS()));
591  addAction(i18nc("Digitized Sky Survey", "Show DSS Image"), ks->map(),
592  SLOT(slotDSS()));
593  }
594 
595  if (showDSS)
596  addSeparator();
597 }
598 
599 void KSPopupMenu::addINDI()
600 {
601 #ifdef HAVE_INDI
602  if (INDIListener::Instance()->size() == 0)
603  return;
604 
605  for (auto &oneDevice : INDIListener::devices())
606  {
607  if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
608  continue;
609 
610 
611  auto mount = oneDevice->getMount();
612  if (!mount)
613  continue;
614 
615  QMenu *mountMenu = new QMenu(mount->getDeviceName());
616  mountMenu->setIcon(QIcon::fromTheme("kstars"));
617  addMenu(mountMenu);
618 
619  if (mount->canGoto() || mount->canSync())
620  {
621  if (mount->canGoto())
622  {
623  QAction *a = mountMenu->addAction(QIcon::fromTheme("object-rotate-right"),
624  i18nc("Move mount to target", "Goto"));
625  a->setEnabled(!mount->isParked());
627  [mount] { mount->Slew(SkyMap::Instance()->clickedPoint()); });
628  }
629  if (mount->canSync())
630  {
631  QAction *a =
632  mountMenu->addAction(QIcon::fromTheme("media-record"),
633  i18nc("Synchronize mount to target", "Sync"));
634  a->setEnabled(!mount->isParked());
636  [mount] { mount->Sync(SkyMap::Instance()->clickedPoint()); });
637  }
638 
639  mountMenu->addSeparator();
640  }
641 
642  if (mount->canAbort())
643  {
644  QAction *a =
645  mountMenu->addAction(QIcon::fromTheme("process-stop"), i18n("Abort"));
646  a->setEnabled(!mount->isParked());
647  connect(a, &QAction::triggered, [mount] { mount->abort(); });
648  mountMenu->addSeparator();
649  }
650 
651  if (mount->canPark())
652  {
653  QAction *park =
654  mountMenu->addAction(QIcon::fromTheme("flag-red"), i18n("Park"));
655  park->setEnabled(!mount->isParked());
656  connect(park, &QAction::triggered, [mount] { mount->park(); });
657 
658  QAction *unpark =
659  mountMenu->addAction(QIcon::fromTheme("flag-green"), i18n("UnPark"));
660  unpark->setEnabled(mount->isParked());
661  connect(unpark, &QAction::triggered, [mount] { mount->unpark(); });
662 
663  mountMenu->addSeparator();
664  }
665 
666  const SkyObject *clickedObject = KStars::Instance()->map()->clickedObject();
667  if (clickedObject && clickedObject->type() == SkyObject::SATELLITE &&
668  (mount->canTrackSatellite()))
669  {
670  const Satellite *sat = dynamic_cast<const Satellite *>(clickedObject);
671  const KStarsDateTime currentTime = KStarsData::Instance()->ut();
672  const KStarsDateTime currentTimePlusOne = currentTime.addSecs(60);
673  QAction *a =
674  mountMenu->addAction(QIcon::fromTheme("arrow"), i18n("Track satellite"));
675  a->setEnabled(!mount->isParked());
677  [mount, sat, currentTime, currentTimePlusOne]
678  {
679  mount->setSatelliteTLEandTrack(sat->tle(), currentTime,
680  currentTimePlusOne);
681  });
682  mountMenu->addSeparator();
683  }
684 
685  if (mount->canCustomPark())
686  {
687  QAction *a = mountMenu->addAction(QIcon::fromTheme("go-jump-declaration"),
688  i18n("Goto && Set As Parking Position"));
689  a->setEnabled(!mount->isParked());
691  [mount] { mount->setCustomParking(); });
692  }
693 
694  QAction *a =
695  mountMenu->addAction(QIcon::fromTheme("edit-find"), i18n("Find Telescope"));
697  [mount] { mount->find(); });
698  }
699 #endif
700 }
701 
702 void KSPopupMenu::addFancyLabel(const QString &name, int deltaFontSize)
703 {
704  if (name.isEmpty())
705  return;
706  QLabel *label = new QLabel("<b>" + name + "</b>", this);
707  label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
708  if (deltaFontSize != 0)
709  {
710  QFont font = label->font();
711  font.setPointSize(font.pointSize() + deltaFontSize);
712  label->setFont(font);
713  }
714  QWidgetAction *act = new QWidgetAction(this);
715  act->setDefaultWidget(label);
716  addAction(act);
717 }
718 
719 void KSPopupMenu::slotViewInWI()
720 {
721  if (!KStars::Instance()->map()->clickedObject())
722  return;
723  if (!KStars::Instance()->isWIVisible())
725  KStars::Instance()->wiView()->inspectSkyObject(
726  KStars::Instance()->map()->clickedObject());
727 }
void triggered(QAction *action)
T & first()
const dms & alt() const
Definition: skypoint.h:281
void setIconVisibleInMenu(bool visible)
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
AlignHCenter
const T value(const Key &key) const const
void createSupernovaMenu(Supernova *supernova)
Create a popup menu for a supernova.
void setAlt(dms alt)
Sets Alt, the Altitude.
Definition: skypoint.h:194
QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags)
QString id() const
Definition: satellite.cpp:1333
QString number(int n, int base)
QString translatedLongName() const
Definition: skyobject.h:169
QString name(void) const override
If star is unnamed return "star" otherwise return the name.
Definition: starobject.h:130
int size() const const
double altitude() const
Definition: satellite.cpp:1323
QImage image(int index)
Get image.
void createEmptyMenu(SkyPoint *nullObj)
Create a popup menu for empty sky.
QString getType() const
Definition: supernova.h:48
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
QString phaseName() const
Definition: ksmoon.cpp:288
void slotToggleWIView()
action slot: toggle What's Interesting window
QIcon fromTheme(const QString &name)
virtual QString name(void) const
Definition: skyobject.h:145
SkyObject * clickedObject() const
Retrieve the object nearest to a mouse click event.
Definition: skymap.h:244
QAction * addSeparator()
QString translatedName() const
Definition: skyobject.h:148
float mag() const
Definition: skyobject.h:206
SkyMap * map() const
Definition: kstars.h:140
bool isObjectLabeled(SkyObject *o)
Definition: skymap.cpp:830
QTime addSecs(int s) const const
Manages the catalog database and provides an interface to provide an interface to query and modify th...
Definition: catalogsdb.h:181
bool isValid() const const
float getRedShift() const
Definition: supernova.h:57
const SkyObjectUserdata::Data & getUserData(const QString &name)
Get a reference to the user data of an object with the name name.
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString translatedName2() const
Definition: skyobject.h:159
void slotEditFlag(int flagIdx)
Open Flag Manager window with selected flag focused and ready to edit.
Definition: skymap.cpp:788
Provides necessary information about the Moon. A subclass of SkyObject that provides information need...
Definition: ksmoon.h:25
KStarsDateTime addSecs(double s) const
QHash::iterator insert(const Key &key, const T &value)
void setDefaultWidget(QWidget *widget)
double velocity() const
Definition: satellite.cpp:1318
void addLinksToMenu(SkyObject *obj, bool showDSS=true)
Add an item to the popup menu for each of the URL links associated with this object.
int getHDIndex() const
Definition: starobject.h:248
virtual SkyObject * clone() const
Create copy of object.
Definition: skyobject.cpp:50
static KStars * Instance()
Definition: kstars.h:122
QAction * addAction(const QString &text)
int type(void) const
Definition: skyobject.h:188
float a() const
KIOCORE_EXPORT SimpleJob * mount(bool ro, const QByteArray &fstype, const QString &dev, const QString &point, JobFlags flags=DefaultFlags)
bool empty() const const
int size() const const
void createCatalogObjectMenu(CatalogObject *obj)
Create a popup menu for a deep-sky catalog object.
QMenu(QWidget *parent)
QString i18n(const char *text, const TYPE &arg...)
QString & setNum(short n, int base)
const CachingDms & dec() const
Definition: skypoint.h:269
~KSPopupMenu() override
Destructor (empty)
subclass of SkyObject specialized for stars.
Definition: starobject.h:32
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.
Definition: skyobject.cpp:93
provides a SkyObject with an attachable Trail
Definition: trailobject.h:21
bool isEmpty() const const
GeoLocation * geo()
Definition: kstarsdata.h:229
QAction * addMenu(QMenu *menu)
double range() const
Definition: satellite.cpp:1328
QString sptype(void) const
Returns entire spectral type string.
Definition: starobject.cpp:549
QString toString(qlonglong i) const const
bool isEmpty() const const
This is the main window for KStars. In addition to the GUI elements, the class contains the program c...
Definition: kstars.h:89
void slotDeleteFlag(int flagIdx)
Delete selected flag.
Definition: skymap.cpp:797
QString tle() const
Definition: satellite.cpp:1338
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:165
QString name
The catalog mame.
Definition: catalogsdb.h:45
void setData(const QVariant &userData)
QString label(StandardShortcut id)
const KStarsDateTime & ut() const
Definition: kstarsdata.h:156
static QString typeName(const int t)
Definition: skyobject.cpp:338
void triggered(bool checked)
float b() const
void setAz(dms az)
Sets Az, the Azimuth.
Definition: skypoint.h:230
const CachingDms & ra() const
Definition: skypoint.h:263
void setEnabled(bool)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QList< int > getFlagsNearPix(SkyPoint *point, int pixelRadius)
Get list of flag indexes near specified SkyPoint with radius specified in pixels.
QString left(int n) const const
const double & Degrees() const
Definition: dms.h:141
QString label(int index)
Get label.
bool hasTrail() const
Definition: trailobject.h:36
Canvas widget for displaying the sky bitmap; also handles user interaction events.
Definition: skymap.h:53
const char * name(StandardAction id)
bool isSolarSystem() const
Definition: skyobject.h:217
QString i18nc(const char *context, const char *text, const TYPE &arg...)
virtual QString longname(void) const
Definition: skyobject.h:164
QTime transitTime(const KStarsDateTime &dt, const GeoLocation *geo) const
The same iteration technique described in riseSetTime() is used here.
Definition: skyobject.cpp:239
void clear()
KStarsData * data() const
Definition: kstars.h:134
QByteArray toLocal8Bit() const const
void createStarMenu(StarObject *star)
Create a popup menu for a star.
KSPopupMenu()
Default constructor.
QFuture< void > map(Sequence &sequence, MapFunctor function)
A simple container object to hold the minimum information for a Deep Sky Object to be drawn on the sk...
Definition: catalogobject.h:40
Information about an object in the sky.
Definition: skyobject.h:41
QString & append(QChar ch)
void createSatelliteMenu(Satellite *satellite)
Create a popup menu for a satellite.
void createPlanetMenu(SkyObject *p)
Create a popup menu for a solar system body.
const CatalogsDB::Catalog getCatalog() const
Get information about the catalog that this objects stems from.
char * toString(const EngineQuery &query)
void setIcon(const QIcon &icon)
const dms & az() const
Definition: skypoint.h:275
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Jun 9 2023 04:02:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.