Kstars

kspopupmenu.h
1/*
2 SPDX-FileCopyrightText: 2001 Jason Harris <jharris@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QMenu>
10#include <QHash>
11
12class QAction;
13
14class DeepSkyObject;
15class CatalogObject;
16class KSMoon;
17class Satellite;
18class SkyObject;
19class SkyPoint;
20class StarObject;
21class Supernova;
22
23/**
24 * @class KSPopupMenu
25 * The KStars Popup Menu. The menu is sensitive to the
26 * object type of the object which was clicked to invoke the menu.
27 * Items in the menu include name and type data; rise/transit/set times;
28 * actions such as Center, Details, Telescope actions, and Label;
29 * and Image and Information URL links.
30 *
31 * @author Jason Harris
32 * @version 1.0
33 */
34class KSPopupMenu : public QMenu
35{
37 public:
38 /** Default constructor*/
40
41 /** Destructor (empty)*/
42 ~KSPopupMenu() override;
43
44 /**
45 * Add an item to the popup menu for each of the URL links associated with
46 * this object. URL links appear in two categories: images and information pages.
47 * For some objects, a link to Digitized Sky Survey images will automatically be added
48 * in addition to the object's normal image links. Also, for some objects, an
49 * "Add link..." item will be included, which allows the user to add their own custom
50 * URLs for this object.
51 * @param obj pointer to the skyobject which the menu describes
52 * @param showDSS if true, include DSS Image links
53 */
54 void addLinksToMenu(SkyObject *obj, bool showDSS = true);
55
56 /**
57 * @short Create a popup menu for a star.
58 *
59 * Stars get the following labels: a primary name and/or a genetive name,
60 * a spectral type, an object type ("star"), and rise/transit/set times.
61 * Stars get a "Center & Track" item, an Angular Distance item, and a
62 * "Detailed Info" item. Named stars get an "Attach Label" item and an
63 * "Add Link..." item, and may have image/info links; all stars get DSS
64 * image links. Stars do not get an "Add Trail" item.
65 * @param star pointer to the star which the menu describes
66 */
67 void createStarMenu(StarObject *star);
68
69 /**
70 * @short Create a popup menu for a deep-sky catalog object.
71 *
72 * DSOs get the following labels:
73 * a common name and/or a catalog name, an object type, and rise/transit/set
74 * times. DSOs get a "Center & Track" item, an Angular Distance item, an
75 * "Attach Label" item, and a "Detailed Info" item.
76 * They may have image/info links, and also get the DSS Image links and the
77 * "Add Link..." item. They do not get an "Add Trail" item.
78 * @param obj pointer to the object which the menu describes
79 */
81
82 /**
83 * @short Create a popup menu for a solar system body.
84 *
85 * Solar System bodies get a name label, a type label ("solar system object"),
86 * and rise/set/transit time labels. They also get Center&Track,
87 * Angular Distance, Detailed Info, Attach Label, and Add Trail items.
88 * They can have image/info links, and also get the "Add Link..." item.
89 * @note despite the name "createPlanetMenu", this function is used for
90 * comets and asteroids as well.
91 * @param p the solar system object which the menu describes.
92 */
94
95 void createMoonMenu(KSMoon *moon);
96
97 /**
98 * @short Create a popup menu for a satellite.
99 * @param satellite the satellite which the menu describes.
100 */
101 void createSatelliteMenu(Satellite *satellite);
102
103 /**
104 * @short Create a popup menu for a supernova
105 * @param supernova the supernova which the menu describes.
106 */
107 void createSupernovaMenu(Supernova *supernova);
108
109 /**
110 * @short Create a popup menu for empty sky.
111 *
112 * The popup menu when right-clicking on nothing is still useful.
113 * Instead of a name label, it shows "Empty Sky". The rise/set/transit
114 * times of the clicked point on the sky are also shown. You also get
115 * the Center & Track and Angular Distance items, and the DSS image links.
116 * @param nullObj pointer to point on the sky
117 */
118 void createEmptyMenu(SkyPoint *nullObj);
119
120 private slots:
121 void slotEditFlag();
122 void slotDeleteFlag();
123 void slotEditFlag(QAction *action);
124 void slotDeleteFlag(QAction *action);
125 void slotViewInWI();
126
127 private:
128 /**
129 * Initialize the popup menus. Adds name and type labels, and possibly
130 * Rise/Set/Transit labels, Center/Track item, and Show Details item.
131 * @short initialize the right-click popup menu
132 * @param obj pointer to the skyobject which the menu describes
133 * @param name The object name
134 * @param type a string identifying the object type
135 * @param type short information about object
136 * @param showDetails if true, the Show-Details item is added
137 * @param showObsList if true, the Add to List/Remove from List item is added.
138 */
139 void initPopupMenu(SkyObject *obj, const QString &name, const QString &type, QString info, bool showDetails = true,
140 bool showObsList = true, bool showFlags = true);
141
142 void initFlagActions(SkyObject *obj);
143
144 /**
145 * Add a submenu for INDI controls (Slew, Track, Sync, etc).
146 * @return true if a valid INDI menu was added.
147 */
148 void addINDI();
149
150 /**
151 * Add fancy label to menu.
152 * @param name is content of the label
153 * @param deltaFontSize is change in font size from default
154 */
155 void addFancyLabel(const QString &name, int deltaFontSize = 0);
156
157 int m_CurrentFlagIdx { 0 };
158 QHash<QAction *, int> *m_EditActionMapping { nullptr };
159 QHash<QAction *, int> *m_DeleteActionMapping { nullptr };
160};
A simple container object to hold the minimum information for a Deep Sky Object to be drawn on the sk...
Provides necessary information about the Moon.
Definition ksmoon.h:26
The KStars Popup Menu.
Definition kspopupmenu.h:35
void createPlanetMenu(SkyObject *p)
Create a popup menu for a solar system body.
void createCatalogObjectMenu(CatalogObject *obj)
Create a popup menu for a deep-sky catalog object.
void createEmptyMenu(SkyPoint *nullObj)
Create a popup menu for empty sky.
void createSupernovaMenu(Supernova *supernova)
Create a popup menu for a supernova.
void createSatelliteMenu(Satellite *satellite)
Create a popup menu for a satellite.
void addLinksToMenu(SkyObject *obj, bool showDSS=true)
Add an item to the popup menu for each of the URL links associated with this object.
~KSPopupMenu() override
Destructor (empty)
void createStarMenu(StarObject *star)
Create a popup menu for a star.
KSPopupMenu()
Default constructor.
Represents an artificial satellites.
Definition satellite.h:23
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
The sky coordinates of a point in the sky.
Definition skypoint.h:45
This is a subclass of SkyObject.
Definition starobject.h:33
Represents the supernova object.
Definition supernova.h:34
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:52 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.