Fix train chart refreshing

.. when config changes
This commit is contained in:
Mark Liversedge
2015-01-23 16:22:54 +00:00
parent 07a6af5904
commit 6e414a4774
5 changed files with 25 additions and 4 deletions

View File

@@ -603,6 +603,7 @@ void DialWindow::seriesChanged()
.arg(background.name())
.arg(foreground.name());
valueLabel->setStyleSheet(sh);
repaint();
}
void

View File

@@ -212,7 +212,7 @@ QRectF RealtimehhbData::boundingRect() const
//void RealtimeLodData::addData(double v) { lodData[lodCur++] = v; if (lodCur==50) lodCur=0; }
RealtimePlot::RealtimePlot() :
RealtimePlot::RealtimePlot(Context *context) :
pwrCurve(NULL),
showPowerState(Qt::Checked),
showPow30sState(Qt::Checked),
@@ -224,7 +224,8 @@ RealtimePlot::RealtimePlot() :
showHHbState(Qt::Checked),
showtHbState(Qt::Checked),
showSmO2State(Qt::Checked),
smooth(0)
smooth(0),
context(context)
{
//insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
pwr30Data = new Realtime30PwrData;
@@ -360,6 +361,10 @@ RealtimePlot::RealtimePlot() :
// lodCurve->attach(this);
// lodCurve->setYAxis(QwtPlot::yLeft);
static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame);
connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32)));
// set to current config
configChanged(CONFIG_APPEARANCE); // set colors
}
@@ -422,6 +427,8 @@ RealtimePlot::configChanged(qint32)
QPen thbpen = QPen(GColor(CTHB));
thbpen.setWidth(width);
thbCurve->setPen(thbpen);
replot();
}
void

View File

@@ -30,6 +30,7 @@
#include <qwt_scale_div.h>
#include <qwt_scale_widget.h>
#include "Settings.h"
#include "Context.h"
#define MAXSAMPLES 300
@@ -294,7 +295,7 @@ class RealtimePlot : public QwtPlot
RealtimehhbData *hhbData;
Realtimesmo2Data *smo2Data;
RealtimePlot();
RealtimePlot(Context *context);
int smooth;
public slots:
@@ -310,6 +311,9 @@ class RealtimePlot : public QwtPlot
void showtHb(int state);
void showSmO2(int state);
void setSmoothing(int value);
private:
Context *context;
};

View File

@@ -92,7 +92,7 @@ RealtimePlotWindow::RealtimePlotWindow(Context *context) :
cl->addStretch();
QVBoxLayout *layout = new QVBoxLayout(this);
rtPlot = new RealtimePlot();
rtPlot = new RealtimePlot(context);
layout->addWidget(rtPlot);
// common controls
@@ -111,6 +111,7 @@ RealtimePlotWindow::RealtimePlotWindow(Context *context) :
// get updates..
connect(context, SIGNAL(telemetryUpdate(RealtimeData)), this, SLOT(telemetryUpdate(RealtimeData)));
connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32)));
// lets initialise all the smoothing variables
hrtot = hrindex = cadtot = cadindex = spdtot = spdindex = alttot = altindex = powtot = powindex = 0;
@@ -124,6 +125,13 @@ RealtimePlotWindow::RealtimePlotWindow(Context *context) :
telemetryUpdate(RealtimeData());
}
void
RealtimePlotWindow::configChanged(qint32)
{
setProperty("color", GColor(CTRAINPLOTBACKGROUND));
repaint();
}
void
RealtimePlotWindow::start()
{

View File

@@ -74,6 +74,7 @@ class RealtimePlotWindow : public GcWindow
// trap signals
void telemetryUpdate(RealtimeData rtData); // got new data
void configChanged(qint32);
void start();
void stop();
void pause();