Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize solar eclipse file name #3721

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/gui/AstroCalcDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4225,7 +4225,7 @@ void AstroCalcDialog::generateKML(const EclipseMapData& data, const QString& dat
using EclipseType = EclipseMapData::EclipseType;

stream << "<?xml version='1.0' encoding='UTF-8'?>\n<kml xmlns='http://www.opengis.net/kml/2.2'>\n<Document>" << '\n';
stream << "<name>"+q_("Solar Eclipse")+dateString+"</name>\n<description>"+q_("Created by Stellarium")+"</description>\n";
stream << "<name>"+q_("Solar Eclipse")+" "+dateString+"</name>\n<description>"+q_("Created by Stellarium")+"</description>\n";
stream << "<Style id='Hybrid'>\n<LineStyle>\n<color>" << toKMLColorString(hybridEclipseColor) << "</color>\n<width>1</width>\n</LineStyle>\n";
stream << "<PolyStyle>\n<color>" << toKMLColorString(hybridEclipseColor) << "</color>\n</PolyStyle>\n</Style>\n";
stream << "<Style id='Total'>\n<LineStyle>\n<color>" << toKMLColorString(totalEclipseColor) << "</color>\n<width>1</width>\n</LineStyle>\n";
Expand Down Expand Up @@ -5043,18 +5043,16 @@ void AstroCalcDialog::saveSolarEclipseMap()
// Find exact time of minimum distance between axis of lunar shadow cone to the center of Earth
const double JDMid = getJDofMinimumDistance(eclipseJD);

int year, month, day;
StelUtils::getDateFromJulianDay(JDMid, &year, &month, &day);

core->setUseTopocentricCoordinates(savedTopocentric);
core->update(0);

// Use year-month-day in the file name
const auto eclipseDateStr = QString("-%1-%2-%3").arg(year).arg(month,2,10,QChar('0')).arg(day,2,10,QChar('0'));
const auto eclipseDateStr = localeMgr->getPrintableDateLocal(JDMid);
const auto fileBaseName = q_("Solar Eclipse") + " " + eclipseDateStr;
QString selectedFilter("(*.kml)");
QString filePath = QFileDialog::getSaveFileName(&StelMainView::getInstance(),
q_("Save map as..."),
QDir::homePath() + "/solareclipse"+eclipseDateStr+".kml",
QDir::homePath() + "/"+fileBaseName+".kml",
q_("KML map (*.kml);;PNG equirectangular map (*.png)"),
&selectedFilter);
if (filePath.isEmpty()) return;
Expand Down
Loading