From 81f0fcdf5de319bb1b0f3fea3eb0406401f15612 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Tue, 27 Sep 2011 21:18:16 +0100 Subject: [PATCH] Notes in WKO file format v1 For some reason the code for setting notes in v1 WKO files was commented out, this patch reinstates notes for this version, but will not get Workout Code since it is not available in this file format. Also removed a duplicate switch statement where sport was being set twice for some reason. --- src/WkoRideFile.cpp | 48 +++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/src/WkoRideFile.cpp b/src/WkoRideFile.cpp index 98cb090f0..cfed01d95 100644 --- a/src/WkoRideFile.cpp +++ b/src/WkoRideFile.cpp @@ -582,6 +582,7 @@ WkoParser::parseHeaderData(WKO_UCHAR *fb) sport = 0x02; // only bike was supported in files this old } + switch (sport) { case 0x01 : results->setTag("Sport", "Swim") ; break; case 0x02 : results->setTag("Sport", "Bike") ; break; @@ -599,6 +600,11 @@ WkoParser::parseHeaderData(WKO_UCHAR *fb) } + QString notesTag; + notesTag = results->getTag("Sport", "Bike"); // we just set it, so default is meaningless. + notesTag += "\n"; + + if (version != 1) { //!!! Version 1 beta support // workout code and duration not in v1 files @@ -634,28 +640,6 @@ WkoParser::parseHeaderData(WKO_UCHAR *fb) results->setStartTime(datetime); } - QString notesTag; - - // Sport type - switch (sport) { - - case 0x01 : notesTag += "Swim " ; break; - case 0x02 : notesTag += "Bike " ; break; - case 0x03 : notesTag += "Run " ; break; - case 0x04 : notesTag += "Brick " ; break; - case 0x05 : notesTag += "Cross Train " ; break; - case 0x06 : notesTag += "Race " ; break; - case 0x07 : notesTag += "Day Off " ; break; - case 0x08 : notesTag += "Mountain Bike " ; break; - case 0x09 : notesTag += "Strength " ; break; - case 0x0B : notesTag += "XC Ski " ; break; - case 0x0C : notesTag += "Rowing " ; break; - default : - case 0x64 : notesTag += "Other"; break; - - } - notesTag += "\n"; - QString scode, sgoal, snote; if (version != 1) { @@ -663,18 +647,18 @@ WkoParser::parseHeaderData(WKO_UCHAR *fb) dotext(code, &txtbuf[0]); scode = (const char *)&txtbuf[0]; notesTag += scode; notesTag += "\n"; - - dotext(goal, &txtbuf[0]); - sgoal = (const char *)&txtbuf[0]; - notesTag += "WORKOUT GOAL"; notesTag += "\n"; - notesTag += sgoal; notesTag += "\n"; - - dotext(notes, &txtbuf[0]); - snote = (const char *)&txtbuf[0]; - notesTag += "WORKOUT NOTES"; notesTag += "\n"; - notesTag += snote; notesTag += "\n"; } + dotext(goal, &txtbuf[0]); + sgoal = (const char *)&txtbuf[0]; + notesTag += "WORKOUT GOAL"; notesTag += "\n"; + notesTag += sgoal; notesTag += "\n"; + + dotext(notes, &txtbuf[0]); + snote = (const char *)&txtbuf[0]; + notesTag += "WORKOUT NOTES"; notesTag += "\n"; + notesTag += snote; notesTag += "\n"; + results->setTag("Notes", notesTag); if (version != 1) {