Files
GoldenCheetah/src/RideCalendar.h
Sean Rhea e76247a25b remove ride map from RideCalendar
I think the previous implementation could have referenced already-deleted
RideItem objects during calls to Split Ride.

This commit removes the calendar's own map of RideItems, and instead
uses the list of rides in MainWindow::allRideItems.  Because I use
binary search on that list, this implementation should be just as fast
as the old one.  But because I don't hang on to any RideItem pointers
beyond a single call to RideCalendar::paintCell, it shouldn't be
vulnerable to referencing already-deleted RideItem objects.
2010-01-04 09:00:43 -05:00

29 lines
545 B
C++

#ifndef EVENT_CALENDAR_WIDGET_H
#define EVENT_CALENDAR_WIDGET_H
#include <QCalendarWidget>
#include <QMultiMap>
#include "RideItem.h"
class MainWindow;
class RideCalendar : public QCalendarWidget
{
Q_OBJECT
public:
RideCalendar(MainWindow *parent);
QSize sizeHint() const;
void setHome(const QDir&);
void addWorkoutCode(QString, QColor);
protected:
void paintCell(QPainter *, const QRect &, const QDate &) const;
private:
QMap<QString, QColor> workoutCodes;
QDir home;
MainWindow *mainWindow;
};
#endif