diff --git a/src/Athlete.cpp b/src/Athlete.cpp index 6da3e438e..eec552a1e 100644 --- a/src/Athlete.cpp +++ b/src/Athlete.cpp @@ -145,6 +145,9 @@ Athlete::Athlete(Context *context, const QDir &homeDir) // seconds step of the upgrade - now everything of configuration needed should be in place in Context v3.upgradeLate(context); + // Routes + routes = new Routes(context, home->config()); + // get withings in if there is a cache QFile withingsJSON(QString("%1/withings.json").arg(context->athlete->home->cache().canonicalPath())); if (withingsJSON.exists() && withingsJSON.open(QFile::ReadOnly)) { diff --git a/src/RideItem.cpp b/src/RideItem.cpp index 0002509f2..11f8f5114 100644 --- a/src/RideItem.cpp +++ b/src/RideItem.cpp @@ -696,37 +696,41 @@ RideItem::updateIntervals() } } - - // TODO Search ROUTE, PEAK, HILL, ... //Search routes - /*context->athlete->routes->searchRoutesInRide(this->ride()); + //context->athlete->routes->searchRoutesInRide(f); // Search + //qDebug() << "find ROUTES "<< fileName; + Routes* routes = context->athlete->routes; if (routes->routes.count()>0) { for (int n=0;nroutes.count();n++) { RouteSegment* route = &routes->routes[n]; + //qDebug() << "find route "<< route->getName() << n; + for (int j=0;jgetRides().count();j++) { RouteRide _ride = route->getRides()[j]; QDateTime rideStartDate = route->getRides()[j].startTime; QString rideSegmentName = route->getRides()[j].filename; - if (this->ride()->startTime() == rideStartDate) { - qDebug() << "find ride "<< fileName <<" for " <startTime() == rideStartDate) { + //qDebug() << "find ride "<< fileName <<" for " <getName(), _ride.start, _ride.stop, 0, 0, j, IntervalItem::Route); - - //interval->name = route->getName(); - //interval->color = color; - - ride()->addInterval(RideFileInterval::ROUTE, _ride.start, _ride.stop, route->getName()); + // create a new interval item + IntervalItem *intervalItem = new IntervalItem(f, route->getName(), + _ride.start, _ride.stop, + f->timeToDistance(_ride.start), + f->timeToDistance(_ride.stop), + count++, // sequence defaults to count + RideFileInterval::ROUTE); + intervalItem->rideItem_ = this; // XXX will go when we refactor and be passed instead of ridefile + intervalItem->refresh(); // XXX will get called in constructore when refactor + intervals_ << intervalItem; } } } - }*/ + } } QList RideItem::intervalsSelected()