Bug 112412 - State of Matter: Temperature doesn't match the temperatures
Summary: State of Matter: Temperature doesn't match the temperatures
Status: RESOLVED FIXED
Alias: None
Product: kalzium
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Kalzium Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-11 13:29 UTC by Carsten Niehaus
Modified: 2005-09-11 16:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Niehaus 2005-09-11 13:29:17 UTC
Version:           1.4.2 (using KDE KDE 3.4.2)
Installed from:    Compiled From Sources
Compiler:          4.0.1 
OS:                Linux

The temperaturesetting in the SOM is working. But in the text below the slider the values are always displayed as Kelvin.

Make Kalzium use Celsius:

- The slider and the QDoubleSpinbox display for example 768°C
- The Informatindialog will display all temparatures in Kelvin but pretents they are °C. This mean, it for example tells you 1022°C but in fact it is 1022K
- The text below the slider shows the values also as Kelvin but is displaying °C as temperture (just like in the information dialog)

Therefore I guess there is a bug in the value-conversion as the strings are always corret and only the value itself is wrong.
Comment 1 Pino Toscano 2005-09-11 16:22:47 UTC
SVN commit 459585 by pino:

Fix the display of a temperature.
CCBUG: 112412


 M  +6 -7      element.cpp  


--- branches/KDE/3.5/kdeedu/kalzium/src/element.cpp #459584:459585
@@ -147,23 +147,22 @@
 			v = i18n( "Value unknown" );
 		else
 		{
-			int newvalue = (int)TempUnit::convert( val, Prefs::temperature(), (int)TempUnit::Kelvin );
-			QString value = QString::number( newvalue );
+			double newvalue = TempUnit::convert( val, (int)TempUnit::Kelvin, Prefs::temperature() );
 			switch (Prefs::temperature()) {
 				case 0: //Kelvin
-					v = i18n( "%1 is the temperature in Kelvin", "%1 K" ).arg( QString::number( val ) );
+					v = i18n( "%1 is the temperature in Kelvin", "%1 K" ).arg( newvalue );
 					break;
 				case 1://Kelvin to Celsius
-					v = i18n( "%1 is the temperature in Celsius", "%1 %2C" ).arg( val ).arg(  "\xB0" );
+					v = i18n( "%1 is the temperature in Celsius", "%1 %2C" ).arg( newvalue ).arg(  "\xB0" );
 					break;
 				case 2: // Kelvin to Fahrenheit
-					v = i18n( "%1 is the temperature in Fahrenheit", "%1 %2F" ).arg( val ).arg(  "\xB0" );
+					v = i18n( "%1 is the temperature in Fahrenheit", "%1 %2F" ).arg( newvalue ).arg(  "\xB0" );
 					break;
 				case 3: // Kelvin to Rankine
-					v = i18n( "%1 is the temperature in Rankine", "%1 %2Ra" ).arg( val ).arg(  "\xB0" );
+					v = i18n( "%1 is the temperature in Rankine", "%1 %2Ra" ).arg( newvalue ).arg(  "\xB0" );
 					break;
 				case 4: // Kelvin to Reamur
-					v = i18n( "%1 is the temperature in Reamur", "%1 %2R" ).arg( val ).arg(  "\xB0" );
+					v = i18n( "%1 is the temperature in Reamur", "%1 %2R" ).arg( newvalue ).arg(  "\xB0" );
 					break;
 			}
 		}
Comment 2 Pino Toscano 2005-09-11 16:32:34 UTC
SVN commit 459590 by pino:

Forwardport: fix the display of a temperature.
BUG: 112412


 M  +6 -7      element.cpp  


--- trunk/KDE/kdeedu/kalzium/src/element.cpp #459589:459590
@@ -147,23 +147,22 @@
 			v = i18n( "Value unknown" );
 		else
 		{
-			int newvalue = (int)TempUnit::convert( val, Prefs::temperature(), (int)TempUnit::Kelvin );
-			QString value = QString::number( newvalue );
+			double newvalue = TempUnit::convert( val, (int)TempUnit::Kelvin, Prefs::temperature() );
 			switch (Prefs::temperature()) {
 				case 0: //Kelvin
-					v = i18n( "%1 is the temperature in Kelvin", "%1 K" ).arg( QString::number( val ) );
+					v = i18n( "%1 is the temperature in Kelvin", "%1 K" ).arg( newvalue );
 					break;
 				case 1://Kelvin to Celsius
-					v = i18n( "%1 is the temperature in Celsius", "%1 %2C" ).arg( val ).arg(  "\xB0" );
+					v = i18n( "%1 is the temperature in Celsius", "%1 %2C" ).arg( newvalue ).arg(  "\xB0" );
 					break;
 				case 2: // Kelvin to Fahrenheit
-					v = i18n( "%1 is the temperature in Fahrenheit", "%1 %2F" ).arg( val ).arg(  "\xB0" );
+					v = i18n( "%1 is the temperature in Fahrenheit", "%1 %2F" ).arg( newvalue ).arg(  "\xB0" );
 					break;
 				case 3: // Kelvin to Rankine
-					v = i18n( "%1 is the temperature in Rankine", "%1 %2Ra" ).arg( val ).arg(  "\xB0" );
+					v = i18n( "%1 is the temperature in Rankine", "%1 %2Ra" ).arg( newvalue ).arg(  "\xB0" );
 					break;
 				case 4: // Kelvin to Reamur
-					v = i18n( "%1 is the temperature in Reamur", "%1 %2R" ).arg( val ).arg(  "\xB0" );
+					v = i18n( "%1 is the temperature in Reamur", "%1 %2R" ).arg( newvalue ).arg(  "\xB0" );
 					break;
 			}
 		}