summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--etc/unit_conversion.dat211
-rw-r--r--noncore/tools/calculator/calculatorimpl.cpp24
-rw-r--r--noncore/tools/calculator/calculatorimpl.h2
3 files changed, 232 insertions, 5 deletions
diff --git a/etc/unit_conversion.dat b/etc/unit_conversion.dat
index 5ae312e..c19adf1 100644
--- a/etc/unit_conversion.dat
+++ b/etc/unit_conversion.dat
@@ -25,2 +25,5 @@ NAME mg
RATIO 1000
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -28,2 +31,5 @@ NAME g
RATIO 1
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -31,2 +37,5 @@ NAME kg
RATIO 0.001
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -34,2 +43,5 @@ NAME tonnes
RATIO 1e-06
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -37,2 +49,5 @@ NAME carats
RATIO 5
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -40,2 +55,5 @@ NAME oz
RATIO 0.03527336860670194
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -43,2 +61,5 @@ NAME lb
RATIO 0.002204585537918871
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -46,2 +67,5 @@ NAME st
RATIO 0.0001574703955656337
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -49,2 +73,5 @@ NAME St tons
RATIO 1.102292768959636e-06
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -52,2 +79,5 @@ NAME Lg tons
RATIO 9.841899722852103e-07
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -55,2 +85,5 @@ NAME
RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -58,2 +91,5 @@ NAME
RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -68,2 +104,5 @@ NAME mm
RATIO 1000
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -71,2 +110,5 @@ NAME cm
RATIO 100
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -74,2 +116,5 @@ NAME m
RATIO 1
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -77,2 +122,5 @@ NAME km
RATIO 0.001
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -80,2 +128,5 @@ NAME points
RATIO 2834.64566929134
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -83,2 +134,5 @@ NAME in
RATIO 39.3700787401575
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -86,2 +140,5 @@ NAME ft
RATIO 3.280839895013123
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -89,2 +146,5 @@ NAME yd
RATIO 1.093613298337708
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -92,2 +152,5 @@ NAME mi
RATIO 0.0006213711922373339
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -95,2 +158,5 @@ NAME naut. mi
RATIO 0.0005399568034557236
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -98,2 +164,5 @@ NAME
RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -101,2 +170,5 @@ NAME
RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -111,2 +183,5 @@ NAME sq mm
RATIO 1000000
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -114,2 +189,5 @@ NAME sq cm
RATIO 10000
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -117,2 +195,5 @@ NAME sq m
RATIO 1
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -120,2 +201,5 @@ NAME sq km
RATIO 1e-06
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -123,2 +207,5 @@ NAME hectares
RATIO 0.0001
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -126,2 +213,5 @@ NAME sq in
RATIO 1550.0031000062
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -129,2 +219,5 @@ NAME sq ft
RATIO 10.7639104167097
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -132,2 +225,5 @@ NAME sq yd
RATIO 1.19599004630108
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -135,2 +231,5 @@ NAME sq mi
RATIO 0.000000386102158542446
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -138,2 +237,5 @@ NAME acres
RATIO 0.0002471053814671653
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -141,2 +243,5 @@ NAME
RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -144,2 +249,5 @@ NAME
RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -147,2 +255,66 @@ ENDTYPE
+STARTTYPE Temperatures
+STND °C
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME °C
+RATIO 1.0
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME °F
+RATIO 1.8
+PREOFF -32.0
+POSTOFF +32.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+NAME
+RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
+ENDTYPE
@@ -154,2 +326,5 @@ NAME cu cm
RATIO 1000
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -157,2 +332,5 @@ NAME ml
RATIO 1000
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -160,2 +338,5 @@ NAME l
RATIO 1
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -163,2 +344,5 @@ NAME tblspoon
RATIO 67.6280454036859
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -166,2 +350,5 @@ NAME teaspoons
RATIO 202.884136211058
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -169,2 +356,5 @@ NAME cu in
RATIO 61.0237440947323
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -172,2 +362,5 @@ NAME cu ft
RATIO 0.0353146667214886
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -175,2 +368,5 @@ NAME pt
RATIO 2.11337641886519
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -178,2 +374,5 @@ NAME qt
RATIO 1.05668820943259
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -181,2 +380,5 @@ NAME gal (US)
RATIO 0.264172052358148
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -184,2 +386,5 @@ NAME
RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -187,2 +392,5 @@ NAME
RATIO 1.
+PREOFF 0.0
+POSTOFF 0.0
+
@@ -194,2 +402,5 @@ NAME fl oz (US)
RATIO 33.8140227018429
+PREOFF 0.0
+POSTOFF 0.0
+
diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp
index 2f7d7ce..1b93c7f 100644
--- a/noncore/tools/calculator/calculatorimpl.cpp
+++ b/noncore/tools/calculator/calculatorimpl.cpp
@@ -20,2 +20,7 @@
+/*
+ * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com>
+ * Added support for Temperature conversions.
+ */
+
#include "calculatorimpl.h"
@@ -136,3 +141,4 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
entry_list = new double[conversion_mode_count*func_button_count];
-
+ preoffset_list = new double[conversion_mode_count*func_button_count];
+ postoffset_list = new double[conversion_mode_count*func_button_count];
myfile.close();
@@ -155,2 +161,8 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
entry_list[x] = line2.toDouble();
+ line2 = ts2.readLine();
+ line2.remove(0,7);
+ preoffset_list[x] = line2.toDouble();
+ line2 = ts2.readLine();
+ line2.remove(0,8);
+ postoffset_list[x] = line2.toDouble();
x++;
@@ -222,5 +234,6 @@ void CalculatorImpl::do_convert(int button) {
if( state == sNewNumber ){
- acc = num
+ acc = (num+ preoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion])
/ (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion])
- * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button]) ;
+ * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button])
+ +postoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + button];
num = acc;
@@ -229,5 +242,6 @@ void CalculatorImpl::do_convert(int button) {
state = sNewNumber;
- num = num
+ num = (num+ preoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion])
/ (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion])
- * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button]) ;
+ * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button])
+ + postoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + button];;
LCD->display( num );
diff --git a/noncore/tools/calculator/calculatorimpl.h b/noncore/tools/calculator/calculatorimpl.h
index bfb726f..f0180c9 100644
--- a/noncore/tools/calculator/calculatorimpl.h
+++ b/noncore/tools/calculator/calculatorimpl.h
@@ -126,2 +126,4 @@ private:
double* entry_list;
+ double* preoffset_list;
+ double* postoffset_list;