Browse Source

ZeroEmitter no longer strips extra data

Neal Wilson 11 years ago
parent
commit
6136f42bb0
1 changed files with 6 additions and 8 deletions
  1. 6
    8
      src/typica.w

+ 6
- 8
src/typica.w View File

7470
 {@t\1@>@/
7470
 {@t\1@>@/
7471
 	Q_OBJECT@;
7471
 	Q_OBJECT@;
7472
 	Q_PROPERTY(int column READ column WRITE setColumn)
7472
 	Q_PROPERTY(int column READ column WRITE setColumn)
7473
+	Measurement cache;
7473
 	int col;
7474
 	int col;
7474
-	double temp;
7475
-	Units::Unit scale;
7476
 	public:@/
7475
 	public:@/
7477
 		ZeroEmitter(int tempcolumn = 1);
7476
 		ZeroEmitter(int tempcolumn = 1);
7478
 		int column();
7477
 		int column();
7488
 @ The implementation of the class is trivial.
7487
 @ The implementation of the class is trivial.
7489
 
7488
 
7490
 @<ZeroEmitter Implementation@>=
7489
 @<ZeroEmitter Implementation@>=
7491
-ZeroEmitter::ZeroEmitter(int tempcolumn) : QObject(NULL), col(tempcolumn),
7492
-	temp(0)@;
7490
+ZeroEmitter::ZeroEmitter(int tempcolumn) : QObject(NULL), col(tempcolumn)@;
7493
 {
7491
 {
7494
 	/* Nothing has to be done here. */
7492
 	/* Nothing has to be done here. */
7495
 }
7493
 }
7501
 
7499
 
7502
 double ZeroEmitter::lastTemperature()
7500
 double ZeroEmitter::lastTemperature()
7503
 {
7501
 {
7504
-	return temp;
7502
+	return cache.temperature();
7505
 }
7503
 }
7506
 
7504
 
7507
 void ZeroEmitter::newMeasurement(Measurement measure)
7505
 void ZeroEmitter::newMeasurement(Measurement measure)
7508
 {
7506
 {
7509
-	temp = measure.temperature();
7510
-	scale = measure.scale();
7507
+	cache = measure;
7511
 }
7508
 }
7512
 
7509
 
7513
 void ZeroEmitter::setColumn(int column)
7510
 void ZeroEmitter::setColumn(int column)
7517
 
7514
 
7518
 void ZeroEmitter::emitZero()
7515
 void ZeroEmitter::emitZero()
7519
 {
7516
 {
7520
-	emit measurement(Measurement(temp, QTime(0, 0, 0, 0), scale), col);
7517
+	cache.setTime(QTime(0, 0, 0, 0));
7518
+	emit measurement(cache, col);
7521
 }
7519
 }
7522
 
7520
 
7523
 @ Making this class available to scripts requires only two functions.
7521
 @ Making this class available to scripts requires only two functions.

Loading…
Cancel
Save