1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Added file changes missing in last commit...

This commit is contained in:
Martin Tůma 2016-10-25 19:46:44 +02:00
parent b99def1b30
commit 6cc22afcdc
6 changed files with 72 additions and 52 deletions

View File

@ -59,7 +59,8 @@ HEADERS += src/config.h \
src/coordinates.h \
src/tile.h \
src/rd.h \
src/wgs84.h
src/wgs84.h \
src/kmlparser.h
SOURCES += src/main.cpp \
src/gui.cpp \
src/poi.cpp \
@ -101,7 +102,8 @@ SOURCES += src/main.cpp \
src/gpxparser.cpp \
src/tcxparser.cpp \
src/csvparser.cpp \
src/coordinates.cpp
src/coordinates.cpp \
src/kmlparser.cpp
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts
macx {

View File

@ -151,7 +151,7 @@
<translation>Otevřít soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="683"/>
<location filename="../src/gui.cpp" line="684"/>
<source>Open POI file</source>
<translation>Otevřít POI soubor</translation>
</message>
@ -363,19 +363,31 @@
<translation>Předchozí mapa</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="604"/>
<location filename="../src/gui.cpp" line="603"/>
<location filename="../src/gui.cpp" line="685"/>
<source>All supported files (*.gpx *.tcx *.kml *.csv)</source>
<translation>Všechny podporované soubory (*.gpx *.tcx *.kml *.csv) </translation>
</message>
<message>
<location filename="../src/gui.cpp" line="604"/>
<location filename="../src/gui.cpp" line="686"/>
<source>GPX files (*.gpx)</source>
<translation>Soubory GPX (*.gpx)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="604"/>
<location filename="../src/gui.cpp" line="686"/>
<location filename="../src/gui.cpp" line="687"/>
<source>TCX files (*.tcx)</source>
<translation>Soubory TCX (*.tcx)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="671"/>
<location filename="../src/gui.cpp" line="605"/>
<location filename="../src/gui.cpp" line="687"/>
<source>KML files (*.kml)</source>
<translation>Soubory KML (*.kml)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="672"/>
<source>Error loading data file:
%1</source>
<translation>Datový soubor nelze otevřít:
@ -383,34 +395,34 @@
</message>
<message>
<location filename="../src/gui.cpp" line="605"/>
<location filename="../src/gui.cpp" line="685"/>
<location filename="../src/gui.cpp" line="686"/>
<source>CSV files (*.csv)</source>
<translation>Soubory CSV (*.csv)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="605"/>
<location filename="../src/gui.cpp" line="686"/>
<location filename="../src/gui.cpp" line="606"/>
<location filename="../src/gui.cpp" line="688"/>
<source>All files (*)</source>
<translation>Všechny soubory (*)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="772"/>
<location filename="../src/gui.cpp" line="775"/>
<location filename="../src/gui.cpp" line="774"/>
<location filename="../src/gui.cpp" line="777"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="784"/>
<location filename="../src/gui.cpp" line="786"/>
<source>Routes</source>
<translation>Trasy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="972"/>
<location filename="../src/gui.cpp" line="974"/>
<source>No GPX files loaded</source>
<translation>Nejsou načteny žádné GPX soubory</translation>
</message>
<message numerus="yes">
<location filename="../src/gui.cpp" line="976"/>
<location filename="../src/gui.cpp" line="978"/>
<source>%1 files</source>
<translation>
<numerusform>%1 soubor</numerusform>
@ -439,7 +451,7 @@
<translation>Exportovat do PDF...</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="786"/>
<location filename="../src/gui.cpp" line="788"/>
<source>Waypoints</source>
<translation>Navigační body</translation>
</message>
@ -484,19 +496,13 @@
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="603"/>
<location filename="../src/gui.cpp" line="684"/>
<source>All supported files (*.gpx *.tcx *.csv)</source>
<translation>Všechny podporované soubory (*.gpx *.tcx *.csv)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="674"/>
<location filename="../src/gui.cpp" line="703"/>
<location filename="../src/gui.cpp" line="675"/>
<location filename="../src/gui.cpp" line="705"/>
<source>Line: %1</source>
<translation>Řádka: %1</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="782"/>
<location filename="../src/gui.cpp" line="784"/>
<source>Tracks</source>
<translation>Cesty</translation>
</message>
@ -523,24 +529,24 @@
</message>
<message>
<location filename="../src/gui.cpp" line="325"/>
<location filename="../src/gui.cpp" line="789"/>
<location filename="../src/gui.cpp" line="791"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="332"/>
<location filename="../src/gui.cpp" line="791"/>
<location filename="../src/gui.cpp" line="793"/>
<source>Time</source>
<translation>Čas</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="676"/>
<location filename="../src/gui.cpp" line="704"/>
<location filename="../src/gui.cpp" line="677"/>
<location filename="../src/gui.cpp" line="706"/>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="700"/>
<location filename="../src/gui.cpp" line="702"/>
<source>Error loading POI file:
%1</source>
<translation>Soubor POI nelze otevřít:
@ -648,7 +654,7 @@
<context>
<name>RouteItem</name>
<message>
<location filename="../src/routeitem.cpp" line="15"/>
<location filename="../src/routeitem.cpp" line="14"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
@ -656,22 +662,22 @@
<context>
<name>ScaleItem</name>
<message>
<location filename="../src/scaleitem.cpp" line="84"/>
<location filename="../src/scaleitem.cpp" line="90"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/scaleitem.cpp" line="85"/>
<location filename="../src/scaleitem.cpp" line="91"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/scaleitem.cpp" line="87"/>
<location filename="../src/scaleitem.cpp" line="93"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../src/scaleitem.cpp" line="88"/>
<location filename="../src/scaleitem.cpp" line="94"/>
<source>m</source>
<translation>m</translation>
</message>
@ -742,17 +748,17 @@
<context>
<name>TrackItem</name>
<message>
<location filename="../src/trackitem.cpp" line="14"/>
<location filename="../src/trackitem.cpp" line="13"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/trackitem.cpp" line="17"/>
<location filename="../src/trackitem.cpp" line="16"/>
<source>Time</source>
<translation>Čas</translation>
</message>
<message>
<location filename="../src/trackitem.cpp" line="19"/>
<location filename="../src/trackitem.cpp" line="18"/>
<source>Date</source>
<translation>Datum</translation>
</message>
@ -760,27 +766,27 @@
<context>
<name>WaypointItem</name>
<message>
<location filename="../src/waypointitem.cpp" line="18"/>
<location filename="../src/waypointitem.cpp" line="17"/>
<source>Name</source>
<translation>Název</translation>
</message>
<message>
<location filename="../src/waypointitem.cpp" line="19"/>
<location filename="../src/waypointitem.cpp" line="18"/>
<source>Coordinates</source>
<translation>Souřadnice</translation>
</message>
<message>
<location filename="../src/waypointitem.cpp" line="22"/>
<location filename="../src/waypointitem.cpp" line="21"/>
<source>Elevation</source>
<translation>Výška</translation>
</message>
<message>
<location filename="../src/waypointitem.cpp" line="25"/>
<location filename="../src/waypointitem.cpp" line="24"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../src/waypointitem.cpp" line="28"/>
<location filename="../src/waypointitem.cpp" line="27"/>
<source>Description</source>
<translation>Popis</translation>
</message>

View File

@ -2,7 +2,7 @@
bool CSVParser::loadFile(QIODevice *device)
{
bool ret;
bool res;
int ln = 1;
_errorLine = 0;
@ -17,14 +17,14 @@ bool CSVParser::loadFile(QIODevice *device)
return false;
}
qreal lat = list[0].trimmed().toDouble(&ret);
if (!ret) {
qreal lat = list[0].trimmed().toDouble(&res);
if (!res || (lat < -90.0 || lat > 90.0)) {
_errorString = "Invalid latitude.";
_errorLine = ln;
return false;
}
qreal lon = list[1].trimmed().toDouble(&ret);
if (!ret) {
qreal lon = list[1].trimmed().toDouble(&res);
if (!res || (lon < -180.0 || lon > 180.0)) {
_errorString = "Invalid longitude.";
_errorLine = ln;
return false;

View File

@ -3,6 +3,7 @@
#include "gpxparser.h"
#include "tcxparser.h"
#include "csvparser.h"
#include "kmlparser.h"
#include "data.h"
@ -10,6 +11,7 @@ Data::Data() : _errorLine(0)
{
_parsers << new GPXParser(_track_data, _route_data, _waypoint_data);
_parsers << new TCXParser(_track_data, _route_data, _waypoint_data);
_parsers << new KMLParser(_track_data, _route_data, _waypoint_data);
_parsers << new CSVParser(_track_data, _route_data, _waypoint_data);
}

View File

@ -81,12 +81,20 @@ Coordinates GPXParser::coordinates(const QXmlStreamAttributes &attr)
bool res;
qreal lon, lat;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
lon = attr.value("lon").toString().toDouble(&res);
#else // QT_VERSION < 5
lon = attr.value("lon").toDouble(&res);
#endif // QT_VERSION < 5
if (!res || (lon < -180.0 || lon > 180.0)) {
_reader.raiseError("Invalid longitude.");
return Coordinates();
}
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
lat = attr.value("lat").toString().toDouble(&res);
#else // QT_VERSION < 5
lat = attr.value("lat").toDouble(&res);
#endif // QT_VERSION < 5
if (!res || (lat < -90.0 || lat > 90.0)) {
_reader.raiseError("Invalid latitude.");
return Coordinates();

View File

@ -107,7 +107,7 @@ GUI::~GUI()
void GUI::createBrowser()
{
QStringList filter;
filter << "*.gpx" << "*.tcx" << "*.csv";
filter << "*.gpx" << "*.tcx" << "*.kml" << "*.csv";
_browser = new FileBrowser(this);
_browser->setFilter(filter);
}
@ -600,9 +600,10 @@ void GUI::dataSources()
void GUI::openFile()
{
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open file"),
QString(), tr("All supported files (*.gpx *.tcx *.csv)") + ";;"
QString(), tr("All supported files (*.gpx *.tcx *.kml *.csv)") + ";;"
+ tr("GPX files (*.gpx)") + ";;" + tr("TCX files (*.tcx)") + ";;"
+ tr("CSV files (*.csv)") + ";;" + tr("All files (*)"));
+ tr("CSV files (*.csv)") + ";;" + tr("KML files (*.kml)") + ";;"
+ tr("All files (*)"));
QStringList list = files;
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
@ -681,9 +682,10 @@ bool GUI::loadFile(const QString &fileName)
void GUI::openPOIFile()
{
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open POI file"),
QString(), tr("All supported files (*.gpx *.tcx *.csv)") + ";;"
QString(), tr("All supported files (*.gpx *.tcx *.kml *.csv)") + ";;"
+ tr("GPX files (*.gpx)") + ";;" + tr("CSV files (*.csv)") + ";;"
+ tr("TCX files (*.tcx)") + ";;" + tr("All files (*)"));
+ tr("TCX files (*.tcx)") + ";;" + tr("KML files (*.kml)") + ";;"
+ tr("All files (*)"));
QStringList list = files;
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)