浏览代码

ZeroEmitter no longer strips extra data

Neal Wilson 11 年前
父节点
当前提交
6136f42bb0
共有 1 个文件被更改,包括 6 次插入8 次删除
  1. 6
    8
      src/typica.w

+ 6
- 8
src/typica.w 查看文件

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

正在加载...
取消
保存