Skip to content

Commit d403efc

Browse files
committed
v0.4.0
**[v0.4.0]** - [update] Updated to Qt 5.7. - [update] Updated QMapControl to version 0.9.7.9. - [update] Updated QCustomPlot to version 1.3.2. - [new] The diagram's x axis now show elapsed time instead of absoulte time. - [fix] Corrected timezone problem in NMEA and GPX parser.
1 parent 41019b7 commit d403efc

37 files changed

Lines changed: 1476 additions & 725 deletions

GPXLab.doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = GPXLab
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = v0.3.0
41+
PROJECT_NUMBER = v0.4.0
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

GPXLab/GPXLab.pro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ QT += core gui network
33
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
44
greaterThan(QT_MAJOR_VERSION, 4): cache()
55

6+
ORGANISATION = BourgeoisLab
67
TARGET = GPXLab
7-
VERSION = 0.3.0.0
8+
VERSION = 0.4.0.0
89
TEMPLATE = app
910

11+
DEFINES += ORGANISATION=\\\"$$ORGANISATION\\\" TARGET=\\\"$$TARGET\\\" VERSION=\\\"$$VERSION\\\"
12+
1013
win32:RC_ICONS += gpxlab.ico
1114

1215
MOC_DIR = tmp

GPXLab/commands/pointeditcommand.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void PointEditCommand::redo()
7979
if (dValue)
8080
{
8181
// temporary copy old values
82-
double tmpValue[numProperties];
82+
double *tmpValue = new double[numProperties];
8383
for (i = 0; i < numProperties; ++i)
8484
tmpValue[i] = gpxmw->getTrackPointPropertyAsDouble(trkpt, property[i]);
8585

@@ -89,11 +89,13 @@ void PointEditCommand::redo()
8989
// store old values
9090
for (i = 0; i < numProperties; ++i)
9191
dValue[i] = tmpValue[i];
92+
93+
delete[] tmpValue;
9294
}
9395
else
9496
{
9597
// temporary copy old values
96-
QString tmpValue[numProperties];
98+
QString *tmpValue = new QString[numProperties];
9799
for (i = 0; i < numProperties; ++i)
98100
tmpValue[i] = gpxmw->getTrackPointPropertyAsString(trkpt, property[i]);
99101

@@ -103,6 +105,8 @@ void PointEditCommand::redo()
103105
// store old values
104106
for (i = 0; i < numProperties; ++i)
105107
sValue[i] = tmpValue[i];
108+
109+
delete[] tmpValue;
106110
}
107111
}
108112
}

GPXLab/commands/pointeditcommand.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
* @brief Edit point property command
3434
*
3535
* @author Frederic Bourgeois <bourgeoislab@gmail.com>
36-
* @version 1.1
37-
* @date 4 Jan 2015
36+
* @version 1.2
37+
* @date 9 Jul 2016
3838
*/
3939
class PointEditCommand : public QUndoCommand
4040
{

GPXLab/dialogs/dialog_about.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Dialog_about::Dialog_about(QWidget *parent) :
2525
{
2626
ui->setupUi(this);
2727

28-
ui->labelMain->setText(GPXLab::appName + " " + GPXLab::appVersion);
29-
ui->labelCopyright->setText("© 2014 - 2015 " + GPXLab::organisationName);
28+
ui->labelMain->setText(GPXLab::appName + " v" + GPXLab::appVersion);
29+
ui->labelCopyright->setText("© 2014 - 2016 " + GPXLab::organisationName);
3030
ui->labelLinkHomepage->setOpenExternalLinks(true);
3131
ui->labelLinkSourceCode->setOpenExternalLinks(true);
3232
ui->labelLinkRelease->setOpenExternalLinks(true);

GPXLab/dialogs/dialog_about.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class Dialog_about;
3636
* @brief About dialogue
3737
*
3838
* @author Frederic Bourgeois <bourgeoislab@gmail.com>
39-
* @version 1.2
40-
* @date 4 Feb 2015
39+
* @version 1.3
40+
* @date 9 Jul 2016
4141
*/
4242
class Dialog_about : public QDialog
4343
{

GPXLab/dialogs/dialog_srtm.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ Dialog_srtm::Dialog_srtm(const GPX_wrapper *gpxmw, QWidget *parent) :
3939

4040
// add original curve
4141
ui->widgetPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
42-
ui->widgetPlot->xAxis->setDateTimeFormat("d.M.yyyy\nH:mm:ss");
42+
ui->widgetPlot->xAxis->setDateTimeFormat("H:mm");
43+
ui->widgetPlot->xAxis->setDateTimeSpec(Qt::UTC);
4344
ui->widgetPlot->yAxis->setLabel("Altitude [m]");
4445
ui->widgetPlot->addGraph();
4546
ui->widgetPlot->addGraph();

GPXLab/dialogs/dialog_srtm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class Dialog_srtm;
4242
* @see GPX_model and SRTM
4343
*
4444
* @author Frederic Bourgeois <bourgeoislab@gmail.com>
45-
* @version 1.2
46-
* @date 4 Jan 2015
45+
* @version 1.3
46+
* @date 15 Feb 2015
4747
*/
4848
class Dialog_srtm : public QDialog
4949
{

GPXLab/gpx_model/gpxfile.cpp

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@ static int gExtensionPrevState = PARSING_NONE;
5959
static int gExtensionLevelDepth = 0;
6060
static bool gExtensionDoubleOpen = false;
6161

62+
static void SYS_setenv(const char *name, const char *value)
63+
{
64+
#ifdef WIN32
65+
char str[128];
66+
sprintf(str, "%s=%s", name, value);
67+
putenv(str);
68+
#else
69+
setenv(name, value, 1);
70+
#endif
71+
}
72+
73+
static void SYS_unsetenv(const char *name)
74+
{
75+
#ifdef WIN32
76+
char str[128];
77+
sprintf(str, "%s=", name);
78+
putenv(str);
79+
#else
80+
unsetenv(name);
81+
#endif
82+
}
83+
6284
static int getChar(void* ptr)
6385
{
6486
return ((ifstream*)((T_uXml*)ptr)->fp)->get();
@@ -74,7 +96,7 @@ static time_t strToTime(const string str)
7496
timeinfo.tm_min = atoi(str.substr(14, 2).c_str());
7597
timeinfo.tm_sec = atoi(str.substr(17, 2).c_str());
7698
timeinfo.tm_isdst = 0;
77-
return mktime(&timeinfo) - timezone;
99+
return mktime(&timeinfo);
78100
}
79101

80102
static int strToMilliseconds(const string str)
@@ -721,6 +743,8 @@ static void closeTag(void* pXml, char* pTag)
721743

722744
GPX_model::retCode_e GPXFile::load(ifstream* fp, GPX_model* gpxm, bool overwriteMetadata)
723745
{
746+
int ret;
747+
char *tz;
724748
T_uXml uXML;
725749

726750
UXML_init(&uXML);
@@ -739,9 +763,23 @@ GPX_model::retCode_e GPXFile::load(ifstream* fp, GPX_model* gpxm, bool overwrite
739763
gOverwriteMetadata = overwriteMetadata;
740764
gExtensionVector = NULL;
741765

742-
if (UXML_parseFile(&uXML) != 0)
743-
return GPX_model::GPXM_ERR_FAILED;
766+
// set timezone temporary to UTC
767+
tz = getenv("TZ");
768+
SYS_setenv("TZ", "UTC");
769+
tzset();
770+
771+
// parse file
772+
ret = UXML_parseFile(&uXML);
744773

774+
// change back timezone
775+
if (tz)
776+
SYS_setenv("TZ", tz);
777+
else
778+
SYS_unsetenv("TZ");
779+
tzset();
780+
781+
if (ret != 0)
782+
return GPX_model::GPXM_ERR_FAILED;
745783
return GPX_model::GPXM_OK;
746784
}
747785

@@ -1004,7 +1042,7 @@ GPX_model::retCode_e GPXFile::save(ofstream* fp, const GPX_model* gpxm)
10041042
writeLink(fp, 2, &*link);
10051043
writeLineIndent(fp, 2);
10061044
writeStr(fp, "<number>", false);
1007-
sprintf(gBuffer, "%d", trk->metadata.number);
1045+
sprintf(gBuffer, "%zu", trk->metadata.number);
10081046
writeStr(fp, gBuffer, false);
10091047
writeStr(fp, "</number>");
10101048
if (!trk->metadata.type.empty())

GPXLab/gpx_model/gpxfile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ using namespace std;
4040
* @see http://www.topografix.com/gpx.asp
4141
*
4242
* @author Frederic Bourgeois <bourgeoislab@gmail.com>
43-
* @version 1.2
44-
* @date 4 Jan 2015
43+
* @version 1.3
44+
* @date 9 Jul 2016
4545
*/
4646
namespace GPXFile
4747
{

0 commit comments

Comments
 (0)