Browse Source

Preserve unit through MeasurementTimeOffset

Neal Wilson 11 years ago
parent
commit
a1770da1b5
1 changed files with 11 additions and 5 deletions
  1. 11
    5
      src/typica.w

+ 11
- 5
src/typica.w View File

7018
 
7018
 
7019
 |QLCDNumber| is capable of displaying more than just numbers, so the call to
7019
 |QLCDNumber| is capable of displaying more than just numbers, so the call to
7020
 display takes a string which in this case consists of the temperature to the
7020
 display takes a string which in this case consists of the temperature to the
7021
-$1\over100$th of a degree and might be followed by ' which will be converted to
7022
-$^\circ$ and the letter F, C, or r to indicate the unit. This class should be
7023
-mofified to allow a user specified precision.
7021
+$1\over100$th of a degree and might be followed by '@q'@> which will be
7022
+converted to $^\circ$ and the letter F, C, or r to indicate the unit. This
7023
+class should be mofified to allow a user specified precision.
7024
 
7024
 
7025
 @<TemperatureDisplay Implementation@>=
7025
 @<TemperatureDisplay Implementation@>=
7026
 void TemperatureDisplay::setValue(Measurement temperature)
7026
 void TemperatureDisplay::setValue(Measurement temperature)
7058
 				arg(number.setNum(temperature.toRankine().temperature(), 'f',
7058
 				arg(number.setNum(temperature.toRankine().temperature(), 'f',
7059
 				                  2)));
7059
 				                  2)));
7060
 			break;
7060
 			break;
7061
+		case Units::Unitless:
7062
+			display(QString("%1").arg(number.setNum(temperature.temperature(), 'f', 0)));
7063
+			break;
7061
 		default:
7064
 		default:
7062
 			switch(temperature.scale())
7065
 			switch(temperature.scale())
7063
 			{
7066
 			{
7077
 					display(QString("%1'r").
7080
 					display(QString("%1'r").
7078
 						arg(number.setNum(temperature.temperature(), 'f', 2)));
7081
 						arg(number.setNum(temperature.temperature(), 'f', 2)));
7079
 					break;
7082
 					break;
7083
+				case Units::Unitless:
7084
+					display(QString("%1").arg(number.setNum(temperature.temperature(), 'f', 0)));
7085
+					break;
7080
 			}
7086
 			}
7081
 			break;
7087
 			break;
7082
 	}
7088
 	}
7244
 		}
7250
 		}
7245
 		else@/
7251
 		else@/
7246
 		{
7252
 		{
7247
-			Measurement rel(measure.temperature(), QTime(0, 0, 0, 0));
7253
+			Measurement rel(measure.temperature(), QTime(0, 0, 0, 0), measure.scale());
7248
 			emit measurement(rel);
7254
 			emit measurement(rel);
7249
 		}
7255
 		}
7250
 	}
7256
 	}
7268
 {
7274
 {
7269
 	newTime.setHMS(0, newTime.minute(), newTime.second(), newTime.msec());
7275
 	newTime.setHMS(0, newTime.minute(), newTime.second(), newTime.msec());
7270
 }
7276
 }
7271
-Measurement rel(measure.temperature(), newTime);
7277
+Measurement rel(measure.temperature(), newTime, measure.scale());
7272
 emit measurement(rel);
7278
 emit measurement(rel);
7273
 
7279
 
7274
 @ The rest of the code handles updating and reporting the reference time.
7280
 @ The rest of the code handles updating and reporting the reference time.

Loading…
Cancel
Save