From a3fa6e861cfba2ba28df2ba17bbf6b1f2691dd7a Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Fri, 26 Aug 2011 19:22:04 +0100 Subject: [PATCH] Plot Cosmetics Update Update to a number of plots to align with the flatter, less cluttered chart style used elsewhere (Ride, Histogram, CP et al). Changes made are purely cosmetic and apply to: * Aerolab * HrPw * Realtime, ErgFile * Weekly Summary --- src/Aerolab.cpp | 1 + src/ErgFilePlot.cpp | 1 + src/ErgFilePlot.h | 1 + src/HrPwPlot.cpp | 2 ++ src/RealtimePlot.cpp | 16 ++++++++++++++++ src/RealtimePlot.h | 1 + src/SmallPlot.cpp | 4 +++- src/WeeklySummaryWindow.cpp | 18 ++++++++++++++---- 8 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/Aerolab.cpp b/src/Aerolab.cpp index 2879f6b0c..4cedd777b 100644 --- a/src/Aerolab.cpp +++ b/src/Aerolab.cpp @@ -243,6 +243,7 @@ Aerolab::Aerolab( insertLegend(new QwtLegend(), QwtPlot::BottomLegend); setCanvasBackground(Qt::white); + canvas()->setFrameStyle(QFrame::NoFrame); setXTitle(); setAxisTitle(yLeft, "Elevation (m)"); diff --git a/src/ErgFilePlot.cpp b/src/ErgFilePlot.cpp index a20b0c838..a21d047f9 100644 --- a/src/ErgFilePlot.cpp +++ b/src/ErgFilePlot.cpp @@ -44,6 +44,7 @@ ErgFilePlot::ErgFilePlot(QList *data) //insertLegend(new QwtLegend(), QwtPlot::BottomLegend); setCanvasBackground(Qt::white); + canvas()->setFrameStyle(QFrame::NoFrame); courseData = data; // what we plot Now = 0; // where we are diff --git a/src/ErgFilePlot.h b/src/ErgFilePlot.h index 2fba7da9e..79fbb8a93 100644 --- a/src/ErgFilePlot.h +++ b/src/ErgFilePlot.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/src/HrPwPlot.cpp b/src/HrPwPlot.cpp index c11827984..cf99b7692 100644 --- a/src/HrPwPlot.cpp +++ b/src/HrPwPlot.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,7 @@ HrPwPlot::HrPwPlot(MainWindow *mainWindow, HrPwWindow *hrPwWindow) : unit(settings.value(GC_UNIT)) { setCanvasBackground(Qt::white); + canvas()->setFrameStyle(QFrame::NoFrame); setXTitle(); // Power (Watts) // Linear Regression Curve diff --git a/src/RealtimePlot.cpp b/src/RealtimePlot.cpp index f6edb1a95..22ecbdd70 100644 --- a/src/RealtimePlot.cpp +++ b/src/RealtimePlot.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "RealtimePlot.h" #include "Colors.h" @@ -151,9 +152,24 @@ RealtimePlot::RealtimePlot() : pwrCurve(NULL) // lodCurve->setData(lodData); // lodCurve->attach(this); // lodCurve->setYAxis(QwtPlot::yLeft); + canvas()->setFrameStyle(QFrame::NoFrame); configChanged(); // set colors } +void +RealtimePlot::setAxisTitle(int axis, QString label) +{ + // setup the default fonts + QFont stGiles; // hoho - Chart Font St. Giles ... ok you have to be British to get this joke + stGiles.fromString(appsettings->value(this, GC_FONT_CHARTLABELS, QFont().toString()).toString()); + stGiles.setPointSize(appsettings->value(NULL, GC_FONT_CHARTLABELS_SIZE, 8).toInt()); + + QwtText title(label); + title.setFont(stGiles); + QwtPlot::setAxisFont(axis, stGiles); + QwtPlot::setAxisTitle(axis, title); +} + void RealtimePlot::configChanged() { diff --git a/src/RealtimePlot.h b/src/RealtimePlot.h index 629e78761..d10caa2bc 100644 --- a/src/RealtimePlot.h +++ b/src/RealtimePlot.h @@ -167,6 +167,7 @@ class RealtimePlot : public QwtPlot #endif public: + void setAxisTitle(int axis, QString label); Realtime30PwrData pwr30Data; RealtimePwrData pwrData; RealtimeSpdData spdData; diff --git a/src/SmallPlot.cpp b/src/SmallPlot.cpp index 9effa7010..f6517c574 100644 --- a/src/SmallPlot.cpp +++ b/src/SmallPlot.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,8 @@ static double inline max(double a, double b) { if (a > b) return a; else return SmallPlot::SmallPlot(QWidget *parent) : QwtPlot(parent), d_mrk(NULL), smooth(30) { - setCanvasBackground(GColor(CRIDEPLOTBACKGROUND)); + setCanvasBackground(GColor(CPLOTBACKGROUND)); + canvas()->setFrameStyle(QFrame::NoFrame); setXTitle(); diff --git a/src/WeeklySummaryWindow.cpp b/src/WeeklySummaryWindow.cpp index 51c859a27..59e9e4a6b 100644 --- a/src/WeeklySummaryWindow.cpp +++ b/src/WeeklySummaryWindow.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -51,6 +52,8 @@ WeeklySummaryWindow::WeeklySummaryWindow(bool useMetricUnits, weeklyPlot->setAxisFont(QwtPlot::xBottom, weeklyPlotAxisFont); weeklyPlot->setAxisFont(QwtPlot::yLeft, weeklyPlotAxisFont); weeklyPlot->setAxisFont(QwtPlot::yRight, weeklyPlotAxisFont); + weeklyPlot->canvas()->setFrameStyle(QFrame::NoFrame); + weeklyPlot->setCanvasBackground(Qt::white); weeklyDistCurve = new QwtPlotCurve(); weeklyDistCurve->setStyle(QwtPlotCurve::Steps); @@ -79,6 +82,8 @@ WeeklySummaryWindow::WeeklySummaryWindow(bool useMetricUnits, weeklyBSPlot->setAxisFont(QwtPlot::xBottom, weeklyPlotAxisFont); weeklyBSPlot->setAxisFont(QwtPlot::yLeft, weeklyPlotAxisFont); weeklyBSPlot->setAxisFont(QwtPlot::yRight, weeklyPlotAxisFont); + weeklyBSPlot->canvas()->setFrameStyle(QFrame::NoFrame); + weeklyBSPlot->setCanvasBackground(Qt::white); weeklyBSCurve = new QwtPlotCurve(); weeklyBSCurve->setStyle(QwtPlotCurve::Steps); @@ -121,6 +126,11 @@ WeeklySummaryWindow::WeeklySummaryWindow(bool useMetricUnits, weeklySummary = new QTextEdit; weeklySummary->setReadOnly(true); + weeklySummary->setStyleSheet("QTextEdit { border: 0px}"); + + QFont defaultFont; // mainwindow sets up the defaults.. we need to apply + defaultFont.setPointSize(defaultFont.pointSize()-2); + weeklySummary->setFont(defaultFont); glayout->addWidget(weeklySummary,0,0,1,-1); // row, col, rowspan, colspan. -1 == fill to edge glayout->addWidget(weeklyPlot,1,0); @@ -275,8 +285,8 @@ WeeklySummaryWindow::refresh() QString summary; summary = tr( "
" - "

Week of %1 through %2

" - "

Summary

" + "

Week of %1 through %2

" + "

Summary

" "

" "" "" @@ -312,13 +322,13 @@ WeeklySummaryWindow::refresh() .arg(weeklyRI, 0, 'f', 3); if (zone_range >= 0) { - summary += tr( "
Total time riding:
" "

Power Zones

"); + summary += tr( "" "

Power Zones

"); summary += mainWindow->zones()->summarize(zone_range, time_in_zone); } else { summary += "No zones configured - zone summary not available."; } if (hrzone_range >= 0) { - summary += tr( "" "

Heart Rate Zones

"); + summary += tr( "" "

Heart Rate Zones

"); summary += mainWindow->hrZones()->summarize(hrzone_range, time_in_hrzone); } }