[qt] Show more data about planets in infopanel

pull/3/head
Hleb Valoshka 2019-05-06 14:49:31 +03:00
parent 11897032d4
commit 2aa162f0bb
2 changed files with 27 additions and 9 deletions

View File

@ -185,8 +185,12 @@ void InfoPanel::buildSolarSystemBodyPage(const Body* body,
t, t,
orbitalPeriod * 1.0e-6, orbitalPeriod * 1.0e-6,
&elements); &elements);
if (orbitalPeriod < 2.0)
if (orbitalPeriod < 365.25 * 2.0) {
orbitalPeriod *= 24.0;
units = _("hours");
}
else if (orbitalPeriod < 365.25 * 2.0)
{ {
units = _("days"); units = _("days");
} }
@ -196,8 +200,24 @@ void InfoPanel::buildSolarSystemBodyPage(const Body* body,
orbitalPeriod /= 365.25; orbitalPeriod /= 365.25;
} }
if (body->getRings() != nullptr)
stream << _("<b>Has rings</b>") << "<br>\n";
if (body->getAtmosphere() != nullptr)
stream << _("<b>Has atmosphere</b>") << "<br>\n";
// Start and end dates
double startTime = 0.0;
double endTime = 0.0;
body->getLifespan(startTime, endTime);
if (startTime > -1.0e9)
stream << "<br>" << QString(_("<b>Start:</b> %1")).arg(astro::TDBtoUTC(startTime).toCStr()) << "<br>\n";
if (endTime < 1.0e9)
stream << "<br>" << QString(_("<b>End:</b> %1")).arg(astro::TDBtoUTC(endTime).toCStr()) << "<br>\n";
stream << "<br><big><b>" << QString(_("Orbit information")) << "</b></big><br>\n"; stream << "<br><big><b>" << QString(_("Orbit information")) << "</b></big><br>\n";
stream << QString(_("Osculating elements for %1")).arg(QString::fromUtf8(astro::TDBtoUTC(t).toCStr())) << "<br>\n"; stream << QString(_("Osculating elements for %1")).arg(astro::TDBtoUTC(t).toCStr()) << "<br>\n";
stream << "<br>\n"; stream << "<br>\n";
// stream << "<i>[ Orbit reference plane info goes here ]</i><br>\n"; // stream << "<i>[ Orbit reference plane info goes here ]</i><br>\n";
stream << QString(_("<b>Period:</b> %L1 %2")).arg(orbitalPeriod).arg(units) << "<br>\n"; stream << QString(_("<b>Period:</b> %L1 %2")).arg(orbitalPeriod).arg(units) << "<br>\n";

View File

@ -73,9 +73,8 @@ SelectionPopup::SelectionPopup(const Selection& sel,
if (startTime > -1.0e9) if (startTime > -1.0e9)
{ {
ostringstream startDateStr; QString startDateStr = QString(_("Start: %1")).arg(astro::TDBtoUTC(startTime).toCStr());
startDateStr << "Start: " << astro::TDBtoUTC(startTime); QAction* startDateAct = new QAction(startDateStr, this);
QAction* startDateAct = new QAction(startDateStr.str().c_str(), this);
connect(startDateAct, SIGNAL(triggered()), connect(startDateAct, SIGNAL(triggered()),
this, SLOT(slotGotoStartDate())); this, SLOT(slotGotoStartDate()));
addAction(startDateAct); addAction(startDateAct);
@ -83,9 +82,8 @@ SelectionPopup::SelectionPopup(const Selection& sel,
if (endTime < 1.0e9) if (endTime < 1.0e9)
{ {
ostringstream endDateStr; QString endDateStr = QString(_("End: %1")).arg(astro::TDBtoUTC(endTime).toCStr());
endDateStr << "End: " << astro::TDBtoUTC(endTime); QAction* endDateAct = new QAction(endDateStr, this);
QAction* endDateAct = new QAction(endDateStr.str().c_str(), this);
connect(endDateAct, SIGNAL(triggered()), connect(endDateAct, SIGNAL(triggered()),
this, SLOT(slotGotoEndDate())); this, SLOT(slotGotoEndDate()));
addAction(endDateAct); addAction(endDateAct);