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
@@ -18,6 +18,11 @@
**
**********************************************************************/
+/*
+ * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com>
+ * Added support for Temperature conversions.
+ */
+
#include "calculatorimpl.h"
#include <qpe/resource.h>
@@ -134,7 +139,8 @@ 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();
myfile.open( IO_Translate | IO_ReadOnly );
QTextStream ts2(&myfile);
@@ -153,6 +159,12 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
line2 = ts2.readLine();
line2.remove(0,6);
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++;
}
}
@@ -220,16 +232,18 @@ void CalculatorImpl::do_convert(int button) {
button < changeable_func_button_count ) {
if ( last_conversion > -1 ) {
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;
LCD->display( acc );
} else {
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 );
acc = 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
@@ -124,6 +124,8 @@ private:
// an array of doubles holding the conversion ratios
double* entry_list;
+ double* preoffset_list;
+ double* postoffset_list;
QPixmap xtopowerofy;
QPixmap ythrootofx;