10 #include "modcalcgeodcoord.h"
11 #include "modcalcgalcoord.h"
12 #include "modcalcsidtime.h"
13 #include "modcalcapcoord.h"
14 #include "modcalcdaylength.h"
15 #include "modcalcaltaz.h"
16 #include "modcalcplanets.h"
17 #include "modcalceclipticcoords.h"
18 #include "modcalcangdist.h"
19 #include "modcalcvizequinox.h"
20 #include "modcalcvlsr.h"
21 #include "conjunctions.h"
22 #include "eclipsetool.h"
24 #include <QDialogButtonBox>
26 #include <QStackedWidget>
28 #include <QTreeWidget>
29 #include <QTreeWidgetItem>
39 "<H2>KStars Astrocalculator</H2>"
41 "The KStars Astrocalculator contains several <B>modules</b> "
42 "which perform a variety of astronomy-related calculations. "
43 "The modules are organized into several categories: "
45 "<LI><B>Time calculators: </B>"
46 "Convert between time systems, and predict the timing of celestial events</LI>"
47 "<LI><B>Coordinate converters: </B>"
48 "Convert between various coordinate systems</LI>"
49 "<LI><B>Solar system: </B>"
50 "Predict the position of any planet, from a given location on Earth at a given time</LI>"
54 "Section which includes algorithms for computing time ephemeris"
56 "<B>Julian Day:</B> Julian Day/Calendar conversion"
58 "<B>Sidereal Time:</B> Sidereal/Universal time conversion"
60 "<B>Almanac:</B> Rise/Set/Transit timing and position data "
61 "for the Sun and Moon"
63 "<B>Equinoxes & Solstices:</B> Equinoxes, Solstices and duration of the "
68 "Section with algorithms for the conversion of "
69 "different astronomical systems of coordinates"
71 "<B>Galactic:</B> Galactic/Equatorial coordinates conversion"
73 "<B>Apparent:</B> Computation of current equatorial coordinates"
76 "<B>Ecliptic:</B> Ecliptic/Equatorial coordinates conversion"
78 "<B>Horizontal:</B> Computation of azimuth and elevation for a "
79 "given source, time, and location on the Earth"
81 "<B>Angular Distance:</B> Computation of angular distance between "
82 "two objects whose positions are given in equatorial coordinates"
84 "<B>Geodetic Coords:</B> Geodetic/XYZ coordinate conversion"
86 "<B>LSR Velocity:</B> Computation of the heliocentric, geocentric "
87 "and topocentric radial velocity of a source from its LSR velocity"
91 "Section with algorithms regarding information "
92 "on solar system bodies coordinates and times"
94 "<B>Planets Coords:</B> Coordinates for the planets, moon and sun "
95 "at a given time and from a given position on Earth "
103 setLayout(mainLayout);
107 connect(buttonBox, SIGNAL(rejected()),
this, SLOT(reject()));
109 setWindowTitle(
i18nc(
"@title:window",
"Calculator"));
113 navigationPanel->setColumnCount(1);
114 navigationPanel->setHeaderLabels(
QStringList(
i18n(
"Calculator modules")));
115 navigationPanel->setSortingEnabled(
false);
118 navigationPanel->setMinimumWidth(200);
123 splashScreen->setReadOnly(
true);
127 splashScreen->setMinimumSize(640, 550);
128 acStack->addWidget(splashScreen);
141 QTreeWidgetItem *timeItem = addTreeTopItem(navigationPanel,
i18n(
"Time Calculators"), messageTime);
145 addTreeItem<modCalcJD>(timeItem,
i18n(
"Julian Day"));
146 addTreeItem<modCalcSidTime>(timeItem,
i18n(
"Sidereal Time"));
147 addTreeItem<modCalcDayLength>(timeItem,
i18n(
"Almanac"));
148 addTreeItem<modCalcEquinox>(timeItem,
i18n(
"Equinoxes & Solstices"));
152 QTreeWidgetItem *coordItem = addTreeTopItem(navigationPanel,
i18n(
"Coordinate Converters"), messageCoord);
153 addTreeItem<modCalcGalCoord>(coordItem,
i18n(
"Equatorial/Galactic"));
154 addTreeItem<modCalcApCoord>(coordItem,
i18n(
"Apparent Coordinates"));
155 addTreeItem<modCalcAltAz>(coordItem,
i18n(
"Horizontal Coordinates"));
156 addTreeItem<modCalcEclCoords>(coordItem,
i18n(
"Ecliptic Coordinates"));
157 addTreeItem<modCalcAngDist>(coordItem,
i18n(
"Angular Distance"));
158 addTreeItem<modCalcGeodCoord>(coordItem,
i18n(
"Geodetic Coordinates"));
159 addTreeItem<modCalcVlsr>(coordItem,
i18n(
"LSR Velocity"));
162 QTreeWidgetItem *solarItem = addTreeTopItem(navigationPanel,
i18n(
"Solar System"), messageSolar);
164 addTreeItem<modCalcPlanets>(solarItem,
i18n(
"Planets Coordinates"));
165 addTreeItem<ConjunctionsTool>(solarItem,
i18n(
"Conjunctions"));
166 addTreeItem<EclipseTool>(solarItem,
i18n(
"Eclipses"));
168 acStack->setCurrentWidget(splashScreen);
169 connect(navigationPanel, SIGNAL(itemClicked(
QTreeWidgetItem*,
int)),
this,
173 template <
typename T>
174 QWidget *AstroCalc::addToStack()
176 T *t =
new T(acStack);
181 template <
typename T>
185 dispatchTable.
insert(item, WidgetThunk(
this, &AstroCalc::addToStack<T>));
193 htmlTable.
insert(item, html);
203 if (iterHTML != htmlTable.
end())
205 splashScreen->
setHtml(*iterHTML);
211 if (iter != dispatchTable.
end())
219 return QSize(640, 430);
222 QWidget *AstroCalc::WidgetThunk::eval()
224 if (widget ==
nullptr)
227 widget = (calc->*func)();