33 changes: 32 additions & 1 deletion src/Python/SIP/sipgoldencheetahBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,36 @@ static PyObject *meth_Bindings_seasonPeaks(PyObject *sipSelf, PyObject *sipArgs,
}


extern "C" {static PyObject *meth_Bindings_intervalType(PyObject *, PyObject *, PyObject *);}
static PyObject *meth_Bindings_intervalType(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
PyObject *sipParseErr = NULL;

{
int a0 = 1;
const ::Bindings *sipCpp;

static const char *sipKwdList[] = {
sipName_type,
};

if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, NULL, "B|i", &sipSelf, sipType_Bindings, &sipCpp, &a0))
{
::QString*sipRes;

sipRes = new ::QString(sipCpp->intervalType(a0));

return sipConvertFromNewType(sipRes,sipType_QString,NULL);
}
}

/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_Bindings, sipName_intervalType, NULL);

return NULL;
}


extern "C" {static PyObject *meth_Bindings_seasonIntervals(PyObject *, PyObject *, PyObject *);}
static PyObject *meth_Bindings_seasonIntervals(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
Expand Down Expand Up @@ -1453,6 +1483,7 @@ static PyMethodDef methods_Bindings[] = {
{SIP_MLNAME_CAST(sipName_deleteActivitySample), (PyCFunction)meth_Bindings_deleteActivitySample, METH_VARARGS|METH_KEYWORDS, NULL},
{SIP_MLNAME_CAST(sipName_deleteSeries), (PyCFunction)meth_Bindings_deleteSeries, METH_VARARGS|METH_KEYWORDS, NULL},
{SIP_MLNAME_CAST(sipName_hasTag), (PyCFunction)meth_Bindings_hasTag, METH_VARARGS|METH_KEYWORDS, NULL},
{SIP_MLNAME_CAST(sipName_intervalType), (PyCFunction)meth_Bindings_intervalType, METH_VARARGS|METH_KEYWORDS, NULL},
{SIP_MLNAME_CAST(sipName_metrics), (PyCFunction)meth_Bindings_metrics, METH_VARARGS|METH_KEYWORDS, NULL},
{SIP_MLNAME_CAST(sipName_postProcess), (PyCFunction)meth_Bindings_postProcess, METH_VARARGS|METH_KEYWORDS, NULL},
{SIP_MLNAME_CAST(sipName_result), (PyCFunction)meth_Bindings_result, METH_VARARGS|METH_KEYWORDS, NULL},
Expand Down Expand Up @@ -1491,7 +1522,7 @@ sipClassTypeDef sipTypeDef_goldencheetah_Bindings = {
{
sipNameNr_Bindings,
{0, 0, 1},
38, methods_Bindings,
39, methods_Bindings,
0, 0,
0, 0,
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
Expand Down
1 change: 1 addition & 0 deletions src/Python/SIP/sipgoldencheetahcmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const char sipStrings_goldencheetah[] = {
's', 'e', 'r', 'i', 'e', 's', 'P', 'r', 'e', 's', 'e', 'n', 't', 0,
'g', 'o', 'l', 'd', 'e', 'n', 'c', 'h', 'e', 'e', 't', 'a', 'h', 0,
'd', 'e', 'l', 'e', 't', 'e', 'S', 'e', 'r', 'i', 'e', 's', 0,
'i', 'n', 't', 'e', 'r', 'v', 'a', 'l', 'T', 'y', 'p', 'e', 0,
'a', 'c', 't', 'i', 'v', 'i', 't', 'y', 'W', 'b', 'a', 'l', 0,
'a', 't', 'h', 'l', 'e', 't', 'e', 'Z', 'o', 'n', 'e', 's', 0,
'c', 'o', 'n', 'f', 'i', 'g', 'C', 'h', 'a', 'r', 't', 0,
Expand Down
23 changes: 23 additions & 0 deletions src/R/RTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ RTool::RTool()
{ "GC.size", (DL_FUNC) &RTool::windowSize, 0,0 },
{ "GC.athlete", (DL_FUNC) &RTool::athlete, 0,0 },
{ "GC.athlete.zones", (DL_FUNC) &RTool::zones, 0,0 },
{ "GC.intervalType", (DL_FUNC) &RTool::intervalType, 0,0 },
{ "GC.activities", (DL_FUNC) &RTool::activities, 0,0 },
{ "GC.activity", (DL_FUNC) &RTool::activity, 0,0 },
{ "GC.activity.metrics", (DL_FUNC) &RTool::activityMetrics, 0,0 },
Expand Down Expand Up @@ -151,6 +152,7 @@ RTool::RTool()
{ "GC.size", (DL_FUNC) &RTool::windowSize, 0,0,0 },
{ "GC.athlete", (DL_FUNC) &RTool::athlete, 0,0,0 },
{ "GC.athlete.zones", (DL_FUNC) &RTool::zones, 0,0,0 },
{ "GC.intervalType", (DL_FUNC) &RTool::intervalType, 0,0,0 },
{ "GC.activities", (DL_FUNC) &RTool::activities, 0,0,0 },
{ "GC.activity", (DL_FUNC) &RTool::activity, 0,0,0 },
{ "GC.activity.metrics", (DL_FUNC) &RTool::activityMetrics, 0,0,0 },
Expand Down Expand Up @@ -181,6 +183,9 @@ RTool::RTool()
{ "GC.athlete", (DL_FUNC) &RTool::athlete, 0 },
{ "GC.athlete.zones", (DL_FUNC) &RTool::zones, 2 },

// intervals
{ "GC.intervalType", (DL_FUNC) &RTool::intervalType, 1 },

// if activity is passed compare=TRUE it returns a list of rides
// currently in the compare pane if compare is enabled or
// just a 1 item list with the current ride
Expand Down Expand Up @@ -280,6 +285,9 @@ RTool::RTool()
"GC.athlete <- function() { .Call(\"GC.athlete\") }\n"
"GC.athlete.zones <- function(date=0, sport=\"\") { .Call(\"GC.athlete.zones\", date, sport) }\n"

// intervals
"GC.intervalType <- function(type=1) { .Call(\"GC.intervalType\", type) }\n"

// activity
"GC.activities <- function(filter=\"\") { .Call(\"GC.activities\", filter) }\n"
"GC.activity <- function(activity=0, compare=FALSE, split=0, join=\"repeat\") { .Call(\"GC.activity\", activity, compare, split, join) }\n"
Expand Down Expand Up @@ -1890,6 +1898,21 @@ RTool::seasonIntervals(SEXP pTypes, SEXP pCompare)
return Rf_allocVector(INTSXP, 0);
}

SEXP
RTool::intervalType(SEXP type)
{
type = Rf_coerceVector(type, INTSXP);
QString typeDesc = RideFileInterval::typeDescription(static_cast<RideFileInterval::IntervalType>(INTEGER(type)[0]));

SEXP ans;

PROTECT(ans=Rf_allocVector(STRSXP, 1));
SET_STRING_ELT(ans, 0, Rf_mkChar(typeDesc.toLatin1().constData()));
UNPROTECT(1);

return ans;
}

SEXP
RTool::activityIntervals(SEXP pTypes, SEXP datetime)
{
Expand Down
3 changes: 3 additions & 0 deletions src/R/RTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class RTool {
static SEXP athlete();
static SEXP zones(SEXP date, SEXP sport);

// intervals
static SEXP intervalType(SEXP type);

// activities
static SEXP activities(SEXP filter);
static SEXP activity(SEXP datetime, SEXP compare, SEXP split, SEXP join);
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/translations/gc_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27199,7 +27199,7 @@ Do you want to continue?</source>
<message>
<location filename="../../FileIO/RideFile.cpp" line="599"/>
<source>ALL</source>
<translation>TODOS</translation>
<translation>TODO</translation>
</message>
<message>
<location filename="../../FileIO/RideFile.cpp" line="600"/>
Expand Down