Merge branch 'release_3.0.0dev' of github.com:/srhea/GoldenCheetah into release_3.0.0dev

This commit is contained in:
Mark Liversedge
2011-04-17 22:09:27 +01:00
7 changed files with 80 additions and 14 deletions

View File

@@ -494,6 +494,8 @@ AllPlotWindow::rideSelected()
{
RideItem *ride = myRideItem;
if (ride == NULL) current = NULL;
// ignore if not active
if (!amVisible()) {
stale = true;
@@ -501,7 +503,10 @@ AllPlotWindow::rideSelected()
}
// ignore if null, or manual / empty
if (!ride || !ride->ride() || !ride->ride()->dataPoints().count()) return;
if (!ride || !ride->ride() || !ride->ride()->dataPoints().count()) {
current = NULL;
return;
}
// we already plotted it!
if (ride == current && stale == false) return;
@@ -519,8 +524,18 @@ AllPlotWindow::rideSelected()
// setup the charts to reflect current ride selection
fullPlot->setDataFromRide(ride);
allPlot->setDataFromPlot(fullPlot, ride->ride()->timeIndex(spanSlider->lowerValue()),
ride->ride()->timeIndex(spanSlider->upperValue()));
// Fixup supplied by Josef Gebel
int startidx, stopidx;
if ( fullPlot->bydist == true ) {
startidx = ride->ride()->distanceIndex( ( double ) spanSlider->lowerValue() / 1000.0 );
stopidx = ride->ride()->distanceIndex( ( double ) spanSlider->upperValue() / 1000.0 );
} else {
startidx = ride->ride()->timeIndex( spanSlider->lowerValue() );
stopidx = ride->ride()->timeIndex( spanSlider->upperValue() );
}
allPlot->setDataFromPlot( fullPlot, startidx, stopidx );
// redraw all the plots, they will check
// to see if they are currently visible
@@ -995,6 +1010,8 @@ AllPlotWindow::hideSelection()
void
AllPlotWindow::setShowPower(int value)
{
if (!current) return;
// we only show the power shading on the
// allPlot / stack plots, not on the fullPlot
allPlot->showPower(value);
@@ -1017,6 +1034,8 @@ AllPlotWindow::setShowPower(int value)
void
AllPlotWindow::setShowHr(int value)
{
if (!current) return;
allPlot->showHr(value);
foreach (AllPlot *plot, allPlots)
plot->showHr(value);
@@ -1025,6 +1044,8 @@ AllPlotWindow::setShowHr(int value)
void
AllPlotWindow::setShowSpeed(int value)
{
if (!current) return;
allPlot->showSpeed(value);
foreach (AllPlot *plot, allPlots)
plot->showSpeed(value);
@@ -1033,6 +1054,8 @@ AllPlotWindow::setShowSpeed(int value)
void
AllPlotWindow::setShowCad(int value)
{
if (!current) return;
allPlot->showCad(value);
foreach (AllPlot *plot, allPlots)
plot->showCad(value);
@@ -1041,6 +1064,8 @@ AllPlotWindow::setShowCad(int value)
void
AllPlotWindow::setShowAlt(int value)
{
if (!current) return;
allPlot->showAlt(value);
foreach (AllPlot *plot, allPlots)
plot->showAlt(value);
@@ -1049,6 +1074,8 @@ AllPlotWindow::setShowAlt(int value)
void
AllPlotWindow::setShowGrid(int value)
{
if (!current) return;
allPlot->showGrid(value);
foreach (AllPlot *plot, allPlots)
plot->showGrid(value);
@@ -1057,6 +1084,8 @@ AllPlotWindow::setShowGrid(int value)
void
AllPlotWindow::setByDistance(int value)
{
if (!current) return;
fullPlot->setByDistance(value);
allPlot->setByDistance(value);
@@ -1072,6 +1101,8 @@ AllPlotWindow::setByDistance(int value)
void
AllPlotWindow::setSmoothing(int value)
{
if (!current) return;
// recalculate etc
fullPlot->setSmoothing(value);
@@ -1087,6 +1118,8 @@ AllPlotWindow::setSmoothing(int value)
void
AllPlotWindow::resetStackedDatas()
{
if (!current) return;
int _stackWidth = stackWidth;
if (allPlot->bydist)
_stackWidth = stackWidth/3;
@@ -1154,6 +1187,8 @@ AllPlotWindow::setStackZoomUp()
void
AllPlotWindow::setStackZoomDown()
{
if (!current) return;
if (stackWidth>4) {
stackWidth = floor(stackWidth / 1.25);

View File

@@ -308,7 +308,9 @@ struct BinFileReaderState
deviceInfo += QString("Resistance Unit Id %1\n").arg(value);
break;
case FORMAT_ID__WORKOUT_ID :
rideFile->setTag("Workout Code", QString(value));
// Commented out since value is numeric and in no way
// represents a Workout Code.
//rideFile->setTag("Workout Code", QString(value));
break;
case FORMAT_ID__USER_WEIGHT :
unused_format_identifiers_for_record_types[def.format_identifier].insert(field.id);

View File

@@ -34,6 +34,9 @@ IntervalSummaryWindow::~IntervalSummaryWindow() {
void IntervalSummaryWindow::intervalSelected()
{
// if no ride available don't bother
if (mainWindow->currentRideItem() == NULL || mainWindow->currentRide() == NULL) return;
QString html;
if (mainWindow->allIntervalItems() != NULL) {
for (int i=0; i<mainWindow->allIntervalItems()->childCount(); i++) {

View File

@@ -893,9 +893,16 @@ MainWindow::removeCurrentRide()
}
// notify AFTER deleted!
item->freeMemory();
rideDeleted(item);
delete item;
// any left?
if (allRides->childCount() == 0) {
ride = NULL;
rideTreeWidgetSelectionChanged(); // notifies children
}
// added djconnel: remove old cpi file, then update bests which are associated with the file
criticalPowerWindow->deleteCpiFile(strOldFileName);

View File

@@ -728,7 +728,10 @@ PowerHist::recalc()
// zone scale draw
if (selected == wattsZone && rideItem && rideItem->zones) {
setAxisScaleDraw(QwtPlot::xBottom, new ZoneScaleDraw(rideItem->zones, rideItem->zoneRange()));
setAxisScale(QwtPlot::xBottom, -0.99, rideItem->zones->numZones(rideItem->zoneRange()), 1);
if (rideItem->zoneRange() >= 0)
setAxisScale(QwtPlot::xBottom, -0.99, rideItem->zones->numZones(rideItem->zoneRange()), 1);
else
setAxisScale(QwtPlot::xBottom, -0.99, 0, 1);
}
// hr scale draw
@@ -736,7 +739,11 @@ PowerHist::recalc()
if (selected == hrZone && rideItem && mainWindow->hrZones() &&
(hrRange=mainWindow->hrZones()->whichRange(rideItem->dateTime.date())) != -1) {
setAxisScaleDraw(QwtPlot::xBottom, new HrZoneScaleDraw(mainWindow->hrZones(), hrRange));
setAxisScale(QwtPlot::xBottom, -0.99, mainWindow->hrZones()->numZones(hrRange), 1);
if (hrRange >= 0)
setAxisScale(QwtPlot::xBottom, -0.99, mainWindow->hrZones()->numZones(hrRange), 1);
else
setAxisScale(QwtPlot::xBottom, -0.99, 0, 1);
}
setAxisMaxMinor(QwtPlot::xBottom, 0);

View File

@@ -281,11 +281,11 @@ RideEditor::find()
// look for a value in a range and allow user to next/previous across
//RideEditorFindDialog finder(this, table);
//finder.exec();
FindDialog *finder = new FindDialog(this);
//FindDialog *finder = new FindDialog(this);
// clear when a new ride is selected
connect(main, SIGNAL(rideSelected()), finder, SLOT(clear()));
finder->show();
//connect(main, SIGNAL(rideSelected()), finder, SLOT(clear()));
//finder->show();
}
void
@@ -1084,6 +1084,11 @@ RideEditor::rideSelected()
RideItem *current = myRideItem;
if (!current || !current->ride()) {
model->setRide(NULL);
if (data) {
delete data;
data = NULL;
}
findTool->rideSelected();
return;
}
@@ -1605,6 +1610,8 @@ FindDialog::typeChanged(int index)
void
FindDialog::find()
{
if (rideEditor->data == NULL) return;
// are we looking anywhere?
bool search = false;
foreach (QCheckBox *c, channels) if (c->isChecked()) search = true;
@@ -1746,10 +1753,11 @@ FindDialog::dataChanged()
void
FindDialog::clear()
{
rideEditor->data->found.clear();
clearResultsTable();
rideEditor->model->forceRedraw();
if (rideEditor->data) {
rideEditor->data->found.clear();
clearResultsTable();
rideEditor->model->forceRedraw();
}
}
void

View File

@@ -57,6 +57,9 @@ RideFileTableModel::deleted()
{
// we don't need to disconnect since they're free'd up by QT
ride = NULL;
beginResetModel();
endResetModel();
dataChanged(createIndex(0,0), createIndex(90,999999));
}
void
@@ -274,7 +277,8 @@ void
RideFileTableModel::forceRedraw()
{
// tell the view to redraw everything
dataChanged(createIndex(0,0), createIndex(headingsType.count(), ride->dataPoints().count()));
if (ride)
dataChanged(createIndex(0,0), createIndex(headingsType.count(), ride->dataPoints().count()));
}
//