mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Refresh CP curve when rides added/deleted
This patch forces a refresh of the CP curve plot (if it is visible) when rides are added or deleted. Fixes #400.
This commit is contained in:
@@ -101,12 +101,23 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent) :
|
||||
|
||||
// redraw on config change -- this seems the simplest approach
|
||||
connect(mainWindow, SIGNAL(configChanged()), this, SLOT(rideSelected()));
|
||||
connect(mainWindow, SIGNAL(rideAdded(RideItem*)), this, SLOT(newRideAdded(RideItem*)));
|
||||
connect(mainWindow, SIGNAL(rideDeleted(RideItem*)), this, SLOT(newRideAdded(RideItem*)));
|
||||
}
|
||||
|
||||
void
|
||||
CriticalPowerWindow::newRideAdded()
|
||||
CriticalPowerWindow::newRideAdded(RideItem *here)
|
||||
{
|
||||
// XXX
|
||||
Season season = seasons.at(cComboSeason->currentIndex());
|
||||
|
||||
// Refresh global curve if a ride is added during those dates
|
||||
if ((here->dateTime.date() >= season.getStart() || season.getStart() == QDate())
|
||||
&& (here->dateTime.date() <= season.getEnd() || season.getEnd() == QDate()))
|
||||
cpintPlot->changeSeason(season.getStart(), season.getEnd());
|
||||
|
||||
// if visible make the changes visible
|
||||
// rideSelected is easiest way
|
||||
if (amVisible()) rideSelected();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -41,7 +41,6 @@ class CriticalPowerWindow : public GcWindow
|
||||
|
||||
CriticalPowerWindow(const QDir &home, MainWindow *parent);
|
||||
|
||||
void newRideAdded();
|
||||
void deleteCpiFile(QString filename);
|
||||
|
||||
// set/get properties
|
||||
@@ -56,6 +55,7 @@ class CriticalPowerWindow : public GcWindow
|
||||
}
|
||||
|
||||
protected slots:
|
||||
void newRideAdded(RideItem*);
|
||||
void cpintTimeValueEntered();
|
||||
void cpintSetCPButtonClicked();
|
||||
void pickerMoved(const QPoint &pos);
|
||||
|
||||
Reference in New Issue
Block a user