From b53be32172db9fa9f4e82c885c4e262070445026 Mon Sep 17 00:00:00 2001 From: Sean Rhea Date: Sun, 27 Sep 2009 21:05:49 -0400 Subject: [PATCH] less public variables in AllPlot Also clean up includes and pre-declared classes. --- src/AllPlot.h | 37 +++++++++++++++++-------------------- src/MainWindow.cpp | 19 +++++++++---------- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/src/AllPlot.h b/src/AllPlot.h index e8b83ac6a..02783dee3 100644 --- a/src/AllPlot.h +++ b/src/AllPlot.h @@ -21,15 +21,11 @@ #include #include -#include -class QPen; class QwtPlotCurve; class QwtPlotGrid; class QwtPlotMarker; class RideItem; -class RideFile; -class AllPlot; class AllPlotBackground; class AllPlotZoneLabel; @@ -37,22 +33,8 @@ class AllPlot : public QwtPlot { Q_OBJECT - private: - - AllPlotBackground *bg; - QSettings *settings; - QVariant unit; - public: - QwtPlotCurve *wattsCurve; - QwtPlotCurve *hrCurve; - QwtPlotCurve *speedCurve; - QwtPlotCurve *cadCurve; - QwtPlotCurve *altCurve; - QVector d_mrk; - QList zoneLabels; - AllPlot(QWidget *parent); int smoothing() const { return smooth; } @@ -64,8 +46,6 @@ class AllPlot : public QwtPlot void setData(RideItem *_rideItem); - RideItem *rideItem; - public slots: void showPower(int state); @@ -79,6 +59,23 @@ class AllPlot : public QwtPlot protected: + friend class ::AllPlotBackground; + friend class ::AllPlotZoneLabel; + + AllPlotBackground *bg; + QSettings *settings; + QVariant unit; + + QwtPlotCurve *wattsCurve; + QwtPlotCurve *hrCurve; + QwtPlotCurve *speedCurve; + QwtPlotCurve *cadCurve; + QwtPlotCurve *altCurve; + QVector d_mrk; + QList zoneLabels; + + RideItem *rideItem; + QwtPlotGrid *grid; QVector hrArray; diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 660c1e7eb..8880a11cc 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1788,12 +1788,11 @@ void MainWindow::setAllPlotWidgets(RideItem *ride) showSpeed->setEnabled(dataPresent->kph); showCad->setEnabled(dataPresent->cad); showAlt->setEnabled(dataPresent->alt); - allPlot->showPower(showPower->currentIndex()); - allPlot->wattsCurve->setVisible(dataPresent->watts && (showPower->currentIndex() < 2)); - allPlot->hrCurve->setVisible(dataPresent->hr && showHr->isChecked()); - allPlot->speedCurve->setVisible(dataPresent->kph && showSpeed->isChecked()); - allPlot->cadCurve->setVisible(dataPresent->cad && showCad->isChecked()); - allPlot->altCurve->setVisible(dataPresent->alt && showAlt->isChecked()); + allPlot->showPower(dataPresent->watts ? showPower->currentIndex() : 2); + allPlot->showHr(dataPresent->hr ? showHr->checkState() : Qt::Unchecked); + allPlot->showSpeed(dataPresent->kph ? showSpeed->checkState() : Qt::Unchecked); + allPlot->showCad(dataPresent->cad ? showCad->checkState() : Qt::Unchecked); + allPlot->showAlt(dataPresent->alt ? showAlt->checkState() : Qt::Unchecked); } else { showPower->setEnabled(false); @@ -1802,10 +1801,10 @@ void MainWindow::setAllPlotWidgets(RideItem *ride) showCad->setEnabled(false); showAlt->setEnabled(false); allPlot->showPower(false); - allPlot->wattsCurve->setVisible(false); - allPlot->hrCurve->setVisible(false); - allPlot->speedCurve->setVisible(false); - allPlot->cadCurve->setVisible(false); + allPlot->showHr(false); + allPlot->showSpeed(false); + allPlot->showCad(false); + allPlot->showAlt(false); } }