summaryrefslogtreecommitdiff
path: root/noncore/tools
authorkergoth <kergoth>2002-02-08 18:07:57 (UTC)
committer kergoth <kergoth>2002-02-08 18:07:57 (UTC)
commitd5714ac7fe62676ee1a63be2f965cb567ef7ae3e (patch) (side-by-side diff)
treea9518ba91ba235733e00fbe6926f0ae7e29e8350 /noncore/tools
parentacae430926d1b5a8877e0d92cfc7abef749c8f1a (diff)
downloadopie-d5714ac7fe62676ee1a63be2f965cb567ef7ae3e.zip
opie-d5714ac7fe62676ee1a63be2f965cb567ef7ae3e.tar.gz
opie-d5714ac7fe62676ee1a63be2f965cb567ef7ae3e.tar.bz2
Merged in Charles-Edouard Ruault's calculator patch to add temp conversion.
Diffstat (limited to 'noncore/tools') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/calculator/calculatorimpl.cpp24
-rw-r--r--noncore/tools/calculator/calculatorimpl.h2
2 files changed, 21 insertions, 5 deletions
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;