introduce MainWindow rideSelected signal

...and use it to update the various tabs when a ride is selected.
This commit is contained in:
Sean Rhea
2009-12-10 12:13:47 -08:00
parent 4c7311e152
commit 2db45dc0c5
14 changed files with 84 additions and 83 deletions

View File

@@ -133,24 +133,18 @@ WeeklySummaryWindow::WeeklySummaryWindow(bool useMetricUnits,
setLayout(glayout);
connect(mainWindow, SIGNAL(zonesChanged()), this, SLOT(zonesChanged()));
connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(refresh()));
connect(mainWindow, SIGNAL(zonesChanged()), this, SLOT(refresh()));
}
void
WeeklySummaryWindow::zonesChanged()
{
generateWeeklySummary(mainWindow->currentRideItem(),
mainWindow->allRideItems(),
mainWindow->zones());
}
void
WeeklySummaryWindow::generateWeeklySummary(const RideItem *ride,
const QTreeWidgetItem *allRides,
const Zones *zones)
WeeklySummaryWindow::refresh()
{
const RideItem *ride = mainWindow->rideItem();
if (!ride)
return;
const QTreeWidgetItem *allRides = mainWindow->allRideItems();
const Zones *zones = mainWindow->zones();
QDate wstart = ride->dateTime.date();
wstart = wstart.addDays(Qt::Monday - wstart.dayOfWeek());
assert(wstart.dayOfWeek() == Qt::Monday);