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,9 +7018,9 @@ becomes smarter about measurement units it might be a good idea to change this.
7018 7018
 
7019 7019
 |QLCDNumber| is capable of displaying more than just numbers, so the call to
7020 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 7025
 @<TemperatureDisplay Implementation@>=
7026 7026
 void TemperatureDisplay::setValue(Measurement temperature)
@@ -7058,6 +7058,9 @@ void TemperatureDisplay::setValue(Measurement temperature)
7058 7058
 				arg(number.setNum(temperature.toRankine().temperature(), 'f',
7059 7059
 				                  2)));
7060 7060
 			break;
7061
+		case Units::Unitless:
7062
+			display(QString("%1").arg(number.setNum(temperature.temperature(), 'f', 0)));
7063
+			break;
7061 7064
 		default:
7062 7065
 			switch(temperature.scale())
7063 7066
 			{
@@ -7077,6 +7080,9 @@ void TemperatureDisplay::setValue(Measurement temperature)
7077 7080
 					display(QString("%1'r").
7078 7081
 						arg(number.setNum(temperature.temperature(), 'f', 2)));
7079 7082
 					break;
7083
+				case Units::Unitless:
7084
+					display(QString("%1").arg(number.setNum(temperature.temperature(), 'f', 0)));
7085
+					break;
7080 7086
 			}
7081 7087
 			break;
7082 7088
 	}
@@ -7244,7 +7250,7 @@ void MeasurementTimeOffset::newMeasurement(Measurement measure)@t\2\2@>@/
7244 7250
 		}
7245 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 7254
 			emit measurement(rel);
7249 7255
 		}
7250 7256
 	}
@@ -7268,7 +7274,7 @@ if(newTime.hour() > 0)
7268 7274
 {
7269 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 7278
 emit measurement(rel);
7273 7279
 
7274 7280
 @ The rest of the code handles updating and reporting the reference time.

Loading…
Cancel
Save