mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Added "enable pause detection" setting
This commit is contained in:
parent
36bf66b984
commit
7e690bdbfb
@ -2594,6 +2594,7 @@ void GUI::writeSettings()
|
||||
WRITE(cadenceFilter, _options.cadenceFilter);
|
||||
WRITE(powerFilter, _options.powerFilter);
|
||||
WRITE(outlierEliminate, _options.outlierEliminate);
|
||||
WRITE(detectPauses, _options.detectPauses);
|
||||
WRITE(automaticPause, _options.automaticPause);
|
||||
WRITE(pauseSpeed, _options.pauseSpeed);
|
||||
WRITE(pauseInterval, _options.pauseInterval);
|
||||
@ -2901,6 +2902,7 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs,
|
||||
_options.powerFilter = READ(powerFilter).toInt();
|
||||
_options.outlierEliminate = READ(outlierEliminate).toBool();
|
||||
_options.pauseSpeed = READ(pauseSpeed).toFloat();
|
||||
_options.detectPauses = READ(detectPauses).toBool();
|
||||
_options.automaticPause = READ(automaticPause).toBool();
|
||||
_options.pauseInterval = READ(pauseInterval).toInt();
|
||||
_options.useReportedSpeed = READ(useReportedSpeed).toBool();
|
||||
@ -2993,6 +2995,7 @@ void GUI::loadOptions()
|
||||
Track::setCadenceFilter(_options.cadenceFilter);
|
||||
Track::setPowerFilter(_options.powerFilter);
|
||||
Track::setOutlierElimination(_options.outlierEliminate);
|
||||
Track::detectPauses(_options.detectPauses);
|
||||
Track::setAutomaticPause(_options.automaticPause);
|
||||
Track::setPauseSpeed(_options.pauseSpeed);
|
||||
Track::setPauseInterval(_options.pauseInterval);
|
||||
@ -3121,6 +3124,7 @@ void GUI::updateOptions(const Options &options)
|
||||
SET_TRACK_OPTION(cadenceFilter, setCadenceFilter);
|
||||
SET_TRACK_OPTION(powerFilter, setPowerFilter);
|
||||
SET_TRACK_OPTION(outlierEliminate, setOutlierElimination);
|
||||
SET_TRACK_OPTION(detectPauses, detectPauses);
|
||||
SET_TRACK_OPTION(automaticPause, setAutomaticPause);
|
||||
SET_TRACK_OPTION(pauseSpeed, setPauseSpeed);
|
||||
SET_TRACK_OPTION(pauseInterval, setPauseInterval);
|
||||
|
@ -53,6 +53,14 @@ void OptionsDialog::automaticPauseDetectionSet(bool set)
|
||||
_pauseSpeed->setEnabled(!set);
|
||||
}
|
||||
|
||||
void OptionsDialog::pauseDetectionSet(bool set)
|
||||
{
|
||||
_automaticPause->setEnabled(set);
|
||||
_manualPause->setEnabled(set);
|
||||
_pauseInterval->setEnabled(set && _manualPause->isChecked());
|
||||
_pauseSpeed->setEnabled(set && _manualPause->isChecked());
|
||||
}
|
||||
|
||||
QWidget *OptionsDialog::createMapPage()
|
||||
{
|
||||
ProjectionList outputProjections(GCS::WGS84List() + Conversion::list());
|
||||
@ -377,6 +385,9 @@ QWidget *OptionsDialog::createDataPage()
|
||||
filterTab->setLayout(filterTabLayout);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
_detectPauses = new QCheckBox(tr("Detect pauses"));
|
||||
_detectPauses->setChecked(_options.detectPauses);
|
||||
|
||||
_automaticPause = new QRadioButton(tr("Automatic"));
|
||||
_manualPause = new QRadioButton(tr("Custom"));
|
||||
if (_options.automaticPause)
|
||||
@ -405,6 +416,10 @@ QWidget *OptionsDialog::createDataPage()
|
||||
_pauseInterval->setValue(_options.pauseInterval);
|
||||
_pauseInterval->setEnabled(_manualPause->isChecked());
|
||||
|
||||
pauseDetectionSet(_options.detectPauses);
|
||||
|
||||
connect(_detectPauses, &QCheckBox::toggled, this,
|
||||
&OptionsDialog::pauseDetectionSet);
|
||||
connect(_automaticPause, &QRadioButton::toggled, this,
|
||||
&OptionsDialog::automaticPauseDetectionSet);
|
||||
|
||||
@ -516,19 +531,17 @@ QWidget *OptionsDialog::createDataPage()
|
||||
|
||||
|
||||
QHBoxLayout *pauseTypeLayout = new QHBoxLayout();
|
||||
#ifdef Q_OS_MAC
|
||||
pauseTypeLayout->addStretch();
|
||||
#endif
|
||||
pauseTypeLayout->addWidget(_automaticPause);
|
||||
pauseTypeLayout->addWidget(_manualPause);
|
||||
pauseTypeLayout->addStretch();
|
||||
|
||||
QFormLayout *pauseValuesLayout = new QFormLayout();
|
||||
pauseValuesLayout->addRow(tr("Detection:"), pauseTypeLayout);
|
||||
pauseValuesLayout->addRow(tr("Minimal speed:"), _pauseSpeed);
|
||||
pauseValuesLayout->addRow(tr("Minimal duration:"), _pauseInterval);
|
||||
|
||||
QVBoxLayout *pauseLayout = new QVBoxLayout();
|
||||
pauseLayout->addLayout(pauseTypeLayout);
|
||||
pauseLayout->addWidget(_detectPauses);
|
||||
pauseLayout->addLayout(pauseValuesLayout);
|
||||
|
||||
QWidget *pauseTab = new QWidget();
|
||||
@ -960,6 +973,7 @@ void OptionsDialog::accept()
|
||||
_options.cadenceFilter = _cadenceFilter->value();
|
||||
_options.powerFilter = _powerFilter->value();
|
||||
_options.outlierEliminate = _outlierEliminate->isChecked();
|
||||
_options.detectPauses = _detectPauses->isChecked();
|
||||
_options.automaticPause = _automaticPause->isChecked();
|
||||
qreal pauseSpeed = (_units == Imperial)
|
||||
? _pauseSpeed->value() / MS2MIH : (_units == Nautical)
|
||||
|
@ -56,6 +56,7 @@ struct Options {
|
||||
int cadenceFilter;
|
||||
int powerFilter;
|
||||
bool outlierEliminate;
|
||||
bool detectPauses;
|
||||
bool automaticPause;
|
||||
qreal pauseSpeed;
|
||||
int pauseInterval;
|
||||
@ -113,6 +114,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void automaticPauseDetectionSet(bool set);
|
||||
void pauseDetectionSet(bool set);
|
||||
|
||||
private:
|
||||
QWidget *createMapPage();
|
||||
@ -164,6 +166,7 @@ private:
|
||||
QCheckBox *_outlierEliminate;
|
||||
QRadioButton *_automaticPause;
|
||||
QRadioButton *_manualPause;
|
||||
QCheckBox *_detectPauses;
|
||||
QDoubleSpinBox *_pauseSpeed;
|
||||
QSpinBox *_pauseInterval;
|
||||
QRadioButton *_computedSpeed;
|
||||
|
@ -230,6 +230,7 @@ SETTING(heartRateFilter, "heartrateFilter", 3 );
|
||||
SETTING(cadenceFilter, "cadenceFilter", 3 );
|
||||
SETTING(powerFilter, "powerFilter", 3 );
|
||||
SETTING(outlierEliminate, "outlierEliminate", true );
|
||||
SETTING(detectPauses, "detectPauses", true );
|
||||
SETTING(automaticPause, "automaticPause", true );
|
||||
SETTING(pauseSpeed, "pauseSpeed", 0.5 );
|
||||
SETTING(pauseInterval, "pauseInterval", 10 );
|
||||
|
@ -182,6 +182,7 @@ public:
|
||||
static const Setting cadenceFilter;
|
||||
static const Setting powerFilter;
|
||||
static const Setting outlierEliminate;
|
||||
static const Setting detectPauses;
|
||||
static const Setting automaticPause;
|
||||
static const Setting pauseSpeed;
|
||||
static const Setting pauseInterval;
|
||||
|
@ -8,6 +8,7 @@ int Track::_heartRateWindow = 3;
|
||||
int Track::_cadenceWindow = 3;
|
||||
int Track::_powerWindow = 3;
|
||||
|
||||
bool Track::_detectPauses = true;
|
||||
bool Track::_automaticPause = true;
|
||||
qreal Track::_pauseSpeed = 0.5;
|
||||
int Track::_pauseInterval = 10;
|
||||
@ -181,7 +182,7 @@ Track::Track(const TrackData &data) : _pause(0)
|
||||
if (!hasTime)
|
||||
continue;
|
||||
|
||||
|
||||
if (_detectPauses) {
|
||||
// get stop-points + pause duration
|
||||
int pauseInterval;
|
||||
qreal pauseSpeed;
|
||||
@ -209,6 +210,7 @@ Track::Track(const TrackData &data) : _pause(0)
|
||||
la = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!_outlierEliminate)
|
||||
continue;
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
static void setHeartRateFilter(int window) {_heartRateWindow = window;}
|
||||
static void setCadenceFilter(int window) {_cadenceWindow = window;}
|
||||
static void setPowerFilter(int window) {_powerWindow = window;}
|
||||
static void detectPauses(bool detect) {_detectPauses = detect;}
|
||||
static void setAutomaticPause(bool set) {_automaticPause = set;}
|
||||
static void setPauseSpeed(qreal speed) {_pauseSpeed = speed;}
|
||||
static void setPauseInterval(int interval) {_pauseInterval = interval;}
|
||||
@ -84,6 +85,7 @@ private:
|
||||
static int _heartRateWindow;
|
||||
static int _cadenceWindow;
|
||||
static int _powerWindow;
|
||||
static bool _detectPauses;
|
||||
static bool _automaticPause;
|
||||
static qreal _pauseSpeed;
|
||||
static int _pauseInterval;
|
||||
|
Loading…
Reference in New Issue
Block a user