Merge branch 'master' of github.com:/srhea/GoldenCheetah

This commit is contained in:
Mark Liversedge
2011-08-05 14:54:37 +01:00
5 changed files with 29 additions and 3 deletions

View File

@@ -174,6 +174,7 @@ void ConfigDialog::save_Clicked()
settings->setValue(GC_ALLRIDES_ASCENDING, configPage->allRidesAscending->checkState());
settings->setValue(GC_GARMIN_SMARTRECORD, configPage->garminSmartRecord->checkState());
settings->setValue(GC_GARMIN_HWMARK, configPage->garminHWMarkedit->text());
settings->setValue(GC_MAP_INTERVAL, configPage->mapIntervaledit->text());
settings->setValue(GC_CRANKLENGTH, configPage->crankLengthCombo->currentText());
settings->setValue(GC_BIKESCOREDAYS, configPage->BSdaysEdit->text());
settings->setValue(GC_BIKESCOREMODE, configPage->bsModeCombo->currentText());

View File

@@ -347,13 +347,16 @@ string GoogleMapControl::CreatePolyLine()
{
std::vector<RideFilePoint> intervalPoints;
ostringstream oss;
int intervalTime = 30; // 30 seconds
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
QVariant intervalTime = settings->value(GC_MAP_INTERVAL).toInt();
if (intervalTime.isNull() || intervalTime.toInt() == 0)
intervalTime.setValue(30);
BOOST_FOREACH(RideFilePoint rfp, rideData)
{
intervalPoints.push_back(rfp);
if((intervalPoints.back().secs - intervalPoints.front().secs) >
intervalTime)
intervalTime.toInt())
{
// find the avg power and color code it and create a polyline...
AvgPower avgPower = for_each(intervalPoints.begin(),
@@ -377,6 +380,10 @@ void GoogleMapControl::CreateSubPolyLine(const std::vector<RideFilePoint> &point
std::ostringstream &oss,
int avgPower)
{
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
QVariant intervalTime = settings->value(GC_MAP_INTERVAL);
if (intervalTime.isNull() || intervalTime.toInt() == 0)
intervalTime.setValue(30);
oss.precision(6);
QColor color = GetColor(avgPower);
QString colorstr = color.name();
@@ -393,7 +400,7 @@ void GoogleMapControl::CreateSubPolyLine(const std::vector<RideFilePoint> &point
oss << "],\"" << colorstr.toStdString() << "\",4);" << endl;
oss << "GEvent.addListener(polyline, 'mouseover', function() {" << endl
<< "var tooltip_text = '30s Power: " << avgPower << "';" << endl
<< "var tooltip_text = '" << intervalTime.toInt() << "s Power: " << avgPower << "';" << endl
<< "var ss={'weight':8};" << endl
<< "this.setStrokeStyle(ss);" << endl
<< "this.overlay = new MapTooltip(this,tooltip_text);" << endl

View File

@@ -149,6 +149,18 @@ ConfigurationPage::ConfigurationPage(MainWindow *main) : main(main)
garminLayout->addWidget(garminHWMarkedit,1,1);
garminLayout->addWidget(garminHWLabel2,1,2);
// Map interval period
QVariant mapInterval = settings->value(GC_MAP_INTERVAL);
if (mapInterval.isNull() || mapInterval.toInt() == 0)
mapInterval.setValue(30); // by default its 30 sec
QGridLayout *mapIntervalLayout = new QGridLayout;
QLabel *mapIntervalLabel1 = new QLabel(tr("Map interval period"));
QLabel *mapIntervalLabel2 = new QLabel(tr(" secs."));
mapIntervaledit = new QLineEdit(mapInterval.toString(),this);
mapIntervaledit->setInputMask("009");
mapIntervalLayout->addWidget(mapIntervalLabel1,1,0);
mapIntervalLayout->addWidget(mapIntervaledit,1,1);
mapIntervalLayout->addWidget(mapIntervalLabel2,1,2);
warningLabel = new QLabel(tr("Requires Restart To Take Effect"));
@@ -214,6 +226,7 @@ ConfigurationPage::ConfigurationPage(MainWindow *main) : main(main)
configLayout->addWidget(allRidesAscending);
configLayout->addLayout(garminLayout);
//SmartRecord);
configLayout->addLayout(mapIntervalLayout);
configLayout->addLayout(crankLengthLayout);
configLayout->addLayout(bsDaysLayout);
configLayout->addLayout(bsModeLayout);

View File

@@ -56,6 +56,7 @@ class ConfigurationPage : public QWidget
QCheckBox *allRidesAscending;
QCheckBox *garminSmartRecord;
QLineEdit *garminHWMarkedit;
QLineEdit *mapIntervaledit;
QLineEdit *BSdaysEdit;
QComboBox *bsModeCombo;
QLineEdit *workoutDirectory;
@@ -85,6 +86,7 @@ class ConfigurationPage : public QWidget
QGridLayout *bsDaysLayout;
QHBoxLayout *bsModeLayout;
QGridLayout *garminLayout;
QGridLayout *mapIntervalLayout;
};
class CyclistPage : public QWidget

View File

@@ -101,6 +101,9 @@
#define GC_GARMIN_SMARTRECORD "garminSmartRecord"
#define GC_GARMIN_HWMARK "garminHWMark"
// Map Interval period
#define GC_MAP_INTERVAL "mapInterval"
#include <QSettings>
#include <boost/shared_ptr.hpp>