From c9aec66dcfda5b1186c4dc4a9d04a3ef91e44712 Mon Sep 17 00:00:00 2001 From: Sean Rhea Date: Sun, 13 Dec 2009 09:59:55 -0500 Subject: [PATCH] remove global mainwindow pointer from AllPlotWindow.cpp Also remove ugly const cast by introducing MainWindow::mutableIntervalItems. --- src/AllPlotWindow.cpp | 6 +++--- src/MainWindow.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index 204dd5951..93fd9cb68 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -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(); } } } diff --git a/src/MainWindow.h b/src/MainWindow.h index 0065eceb1..b520f177b 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -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);