remove global mainwindow pointer from AllPlotWindow.cpp

Also remove ugly const cast by introducing MainWindow::mutableIntervalItems.
This commit is contained in:
Sean Rhea
2009-12-13 09:59:55 -05:00
parent 01e1c22640
commit c9aec66dcf
2 changed files with 4 additions and 3 deletions

View File

@@ -324,7 +324,7 @@ AllPlotWindow::setEndSelection(double xValue, bool newInterval, QString name)
RideFile tmpRide = RideFile();
QTreeWidgetItem *which = mainwindow->rideItem();
QTreeWidgetItem *which = mainWindow->rideItem();
RideItem *ride = (RideItem*)which;
double distance1 = -1;
@@ -393,7 +393,7 @@ AllPlotWindow::setEndSelection(double xValue, bool newInterval, QString name)
if (newInterval) {
QTreeWidgetItem *allIntervals = (QTreeWidgetItem *)mainwindow->allIntervalItems();
QTreeWidgetItem *allIntervals = mainWindow->mutableIntervalItems();
int count = allIntervals->childCount();
// are we adjusting an existing interval? - if so delete it and readd it
@@ -406,7 +406,7 @@ AllPlotWindow::setEndSelection(double xValue, bool newInterval, QString name)
allIntervals->addChild(last);
// now update the RideFileIntervals and all the plots etc
mainwindow->updateRideFileIntervals();
mainWindow->updateRideFileIntervals();
}
}
}

View File

@@ -55,6 +55,7 @@ class MainWindow : public QMainWindow
const RideItem *currentRideItem() { return ride; }
const QTreeWidgetItem *allRideItems() { return allRides; }
const QTreeWidgetItem *allIntervalItems() { return allIntervals; }
QTreeWidgetItem *mutableIntervalItems() { return allIntervals; }
void getBSFactors(float &timeBS, float &distanceBS);
QDir home;
void setCriticalPower(int cp);