mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
remember chosen PM metric across restarts
This commit is contained in:
@@ -50,6 +50,13 @@ PerformanceManagerWindow::PerformanceManagerWindow(MainWindow *mainWindow) :
|
||||
metricCombo = new QComboBox(this);
|
||||
metricCombo->addItem(tr("Use BikeScore"), "skiba_bike_score");
|
||||
metricCombo->addItem(tr("Use DanielsPoints"), "daniels_points");
|
||||
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
|
||||
QString metricName =
|
||||
settings->value(GC_PERF_MAN_METRIC, "skiba_bike_score").toString();
|
||||
for (int i = 0; i < metricCombo->count(); ++i) {
|
||||
if (metricCombo->itemData(i).toString() == metricName)
|
||||
metricCombo->setCurrentIndex(i);
|
||||
}
|
||||
metric = metricCombo->itemData(metricCombo->currentIndex()).toString();
|
||||
PMPickerLayout->addWidget(metricCombo);
|
||||
|
||||
@@ -92,7 +99,7 @@ PerformanceManagerWindow::PerformanceManagerWindow(MainWindow *mainWindow) :
|
||||
connect(PMpicker, SIGNAL(moved(const QPoint &)),
|
||||
SLOT(PMpickerMoved(const QPoint &)));
|
||||
connect(metricCombo, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(replot()));
|
||||
this, SLOT(metricChanged()));
|
||||
connect(mainWindow, SIGNAL(configChanged()), this, SLOT(configChanged()));
|
||||
}
|
||||
|
||||
@@ -109,6 +116,14 @@ void PerformanceManagerWindow::configChanged()
|
||||
replot();
|
||||
}
|
||||
|
||||
void PerformanceManagerWindow::metricChanged()
|
||||
{
|
||||
QString newMetric = metricCombo->itemData(metricCombo->currentIndex()).toString();
|
||||
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
|
||||
settings->setValue(GC_PERF_MAN_METRIC, newMetric);
|
||||
replot();
|
||||
}
|
||||
|
||||
void PerformanceManagerWindow::setActive(bool value)
|
||||
{
|
||||
if (value)
|
||||
|
||||
@@ -53,6 +53,7 @@ class PerformanceManagerWindow : public QWidget
|
||||
void setPMSizeFromSlider();
|
||||
void replot();
|
||||
void configChanged();
|
||||
void metricChanged();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define GC_SETTINGS_CALENDAR_SIZES "mainwindow/calendarSizes"
|
||||
#define GC_SETTINGS_INTERVAL_METRICS "rideSummaryWindow/intervalMetrics"
|
||||
#define GC_RIDE_PLOT_SMOOTHING "ridePlot/Smoothing"
|
||||
#define GC_PERF_MAN_METRIC "performanceManager/metric"
|
||||
#define GC_SETTINGS_INTERVAL_METRICS_DEFAULT "workout_time,total_distance,total_work,average_power,skiba_xpower,max_power,average_hr,ninety_five_percent_hr,average_cad,average_speed"
|
||||
#define GC_DATETIME_FORMAT "ddd MMM dd, yyyy, hh:mm AP"
|
||||
#define GC_UNIT "unit"
|
||||
|
||||
Reference in New Issue
Block a user