From 2aa162f0bb0bcd0d92eabd35b51512938d883525 Mon Sep 17 00:00:00 2001 From: Hleb Valoshka <375gnu@gmail.com> Date: Mon, 6 May 2019 14:49:31 +0300 Subject: [PATCH] [qt] Show more data about planets in infopanel --- src/celestia/qt/qtinfopanel.cpp | 26 +++++++++++++++++++++++--- src/celestia/qt/qtselectionpopup.cpp | 10 ++++------ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/celestia/qt/qtinfopanel.cpp b/src/celestia/qt/qtinfopanel.cpp index d7bc9548..e74438e3 100644 --- a/src/celestia/qt/qtinfopanel.cpp +++ b/src/celestia/qt/qtinfopanel.cpp @@ -185,8 +185,12 @@ void InfoPanel::buildSolarSystemBodyPage(const Body* body, t, orbitalPeriod * 1.0e-6, &elements); - - if (orbitalPeriod < 365.25 * 2.0) + if (orbitalPeriod < 2.0) + { + orbitalPeriod *= 24.0; + units = _("hours"); + } + else if (orbitalPeriod < 365.25 * 2.0) { units = _("days"); } @@ -196,8 +200,24 @@ void InfoPanel::buildSolarSystemBodyPage(const Body* body, orbitalPeriod /= 365.25; } + if (body->getRings() != nullptr) + stream << _("Has rings") << "
\n"; + if (body->getAtmosphere() != nullptr) + stream << _("Has atmosphere") << "
\n"; + + // Start and end dates + double startTime = 0.0; + double endTime = 0.0; + body->getLifespan(startTime, endTime); + + if (startTime > -1.0e9) + stream << "
" << QString(_("Start: %1")).arg(astro::TDBtoUTC(startTime).toCStr()) << "
\n"; + + if (endTime < 1.0e9) + stream << "
" << QString(_("End: %1")).arg(astro::TDBtoUTC(endTime).toCStr()) << "
\n"; + stream << "
" << QString(_("Orbit information")) << "
\n"; - stream << QString(_("Osculating elements for %1")).arg(QString::fromUtf8(astro::TDBtoUTC(t).toCStr())) << "
\n"; + stream << QString(_("Osculating elements for %1")).arg(astro::TDBtoUTC(t).toCStr()) << "
\n"; stream << "
\n"; // stream << "[ Orbit reference plane info goes here ]
\n"; stream << QString(_("Period: %L1 %2")).arg(orbitalPeriod).arg(units) << "
\n"; diff --git a/src/celestia/qt/qtselectionpopup.cpp b/src/celestia/qt/qtselectionpopup.cpp index b7599800..50760aa5 100644 --- a/src/celestia/qt/qtselectionpopup.cpp +++ b/src/celestia/qt/qtselectionpopup.cpp @@ -73,9 +73,8 @@ SelectionPopup::SelectionPopup(const Selection& sel, if (startTime > -1.0e9) { - ostringstream startDateStr; - startDateStr << "Start: " << astro::TDBtoUTC(startTime); - QAction* startDateAct = new QAction(startDateStr.str().c_str(), this); + QString startDateStr = QString(_("Start: %1")).arg(astro::TDBtoUTC(startTime).toCStr()); + QAction* startDateAct = new QAction(startDateStr, this); connect(startDateAct, SIGNAL(triggered()), this, SLOT(slotGotoStartDate())); addAction(startDateAct); @@ -83,9 +82,8 @@ SelectionPopup::SelectionPopup(const Selection& sel, if (endTime < 1.0e9) { - ostringstream endDateStr; - endDateStr << "End: " << astro::TDBtoUTC(endTime); - QAction* endDateAct = new QAction(endDateStr.str().c_str(), this); + QString endDateStr = QString(_("End: %1")).arg(astro::TDBtoUTC(endTime).toCStr()); + QAction* endDateAct = new QAction(endDateStr, this); connect(endDateAct, SIGNAL(triggered()), this, SLOT(slotGotoEndDate())); addAction(endDateAct);