Enable GoldenCheetah JSON files as Workouts and VideoSync

Any other activity file format GC supports can be imported,
conditioned using Fix Elevation, Fix GPS, etc. and exported
to GoldenCheetah .json format to be used for simulated rides
with synchronized video and position tracking.
Complements #3469, Fixes #3376
This commit is contained in:
Ale Martinez
2020-06-21 13:17:00 -03:00
parent 225cf0c9d5
commit 0e1bec38aa
3 changed files with 8 additions and 41 deletions

View File

@@ -42,18 +42,7 @@ static bool setSupported()
::supported << ".zwo";
::supported << ".gpx";
::supported << ".tts";
// Additional supportable ridefile types. Uncomment to enable.
//::supported << ".bin";
//::supported << ".bin2";
//::supported << ".fit";
//::supported << ".fitlog";
//::supported << ".hrm";
//::supported << ".pwx";
//::supported << ".srd";
//::supported << ".srm";
//::supported << ".tcx";
//::supported << ".wko";
::supported << ".json";
return true;
}
@@ -67,7 +56,7 @@ bool ErgFile::isWorkout(QString name)
return false;
}
ErgFile::ErgFile(QString filename, int mode, Context *context) :
filename(filename), mode(mode), context(context), StrictGradient(true)
filename(filename), mode(mode), StrictGradient(true), context(context)
{
if (context->athlete->zones(false)) {
int zonerange = context->athlete->zones(false)->whichRange(QDateTime::currentDateTime().date());
@@ -76,7 +65,7 @@ ErgFile::ErgFile(QString filename, int mode, Context *context) :
reload();
}
ErgFile::ErgFile(Context *context) : mode(0), context(context), StrictGradient(true)
ErgFile::ErgFile(Context *context) : mode(0), StrictGradient(true), context(context)
{
if (context->athlete->zones(false)) {
int zonerange = context->athlete->zones(false)->whichRange(QDateTime::currentDateTime().date());
@@ -123,7 +112,7 @@ void ErgFile::reload()
// All file endings that can be loaded as ergfile from rideFileFactory.
// Actual permitted file types are controlled by ::supported list at
// top of this file.
QRegExp fact(".+[.](gpx|bin|bin2|fit|fitlog|hrm|pwx|srd|srm|tcx|wko)$", Qt::CaseInsensitive);
QRegExp fact(".+[.](gpx|json)$", Qt::CaseInsensitive);
// which parser to call? NOTE: we should look at moving to an ergfile factory
// like we do with ride files if we end up with lots of different formats
@@ -714,17 +703,8 @@ void ErgFile::parseComputrainer(QString p)
// and which contains gps data, altitude or slope.
//
// File types supported:
// .bin Joule GPS File
// .bin2 Joule GPS File
// .fit Garmin FIT
// .fitlog Sporttracks FITLOG
// .gpx GPS Track
// .hrm Polar Precision
// .pwx TrainingPeaks PWX
// .srd Polar SRD
// .srm SRM Powercontrol
// .tcx Garmin TCX
// .wko TrainingPeaks WKO
// .json GoldenCheetah JSON
void ErgFile::parseFromRideFileFactory()
{
// Initialise

View File

@@ -261,7 +261,7 @@ LibrarySearchDialog::LibrarySearchDialog(Context *context) : context(context)
findWorkouts->setChecked(true);
findMedia = new QCheckBox(tr("Video files (.mp4, .avi etc)"), this);
findMedia->setChecked(true);
findVideoSyncs = new QCheckBox(tr("VideoSync files (.rlv)"), this);
findVideoSyncs = new QCheckBox(tr("VideoSync files (.rlv, .tts etc)"), this);
findVideoSyncs->setChecked(true);
addPath = new QPushButton("+", this);
removePath = new QPushButton("-", this);

View File

@@ -30,20 +30,7 @@ static bool setSupported()
{
::supported << ".rlv";
::supported << ".tts";
// Additional file types that are supportable as videosync file.
// Uncomment to enable.
//::supported << ".gpx";
//::supported << ".bin";
//::supported << ".bin2";
//::supported << ".fit";
//::supported << ".fitlog";
//::supported << ".hrm";
//::supported << ".pwx";
//::supported << ".srd";
//::supported << ".srm";
//::supported << ".tcx";
//::supported << ".wko";
::supported << ".json";
return true;
}
@@ -70,7 +57,7 @@ VideoSyncFile::VideoSyncFile(Context *context) : context(context)
void VideoSyncFile::reload()
{
// These types are enabled using ::supported list at top of this file.
QRegExp fact(".+[.](gpx|bin|bin2|fit|fit|fitlog|hrm|pwx|srd|srm|tcx|wko)$", Qt::CaseInsensitive);
QRegExp fact(".+[.](gpx|json)$", Qt::CaseInsensitive);
// which parser to call?
if (filename.endsWith(".rlv", Qt::CaseInsensitive)) parseRLV();