summaryrefslogtreecommitdiff
path: root/noncore/tools/calculator/calculatorimpl.cpp
Side-by-side diff
Diffstat (limited to 'noncore/tools/calculator/calculatorimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/calculator/calculatorimpl.cpp24
1 files changed, 19 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
@@ -17,8 +17,13 @@
** not clear to you.
**
**********************************************************************/
+/*
+ * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com>
+ * Added support for Temperature conversions.
+ */
+
#include "calculatorimpl.h"
#include <qpe/resource.h>
#include <qpe/qmath.h>
@@ -133,9 +138,10 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
conversion_mode_count++;
}
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);
@@ -152,8 +158,14 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
faces << line.remove(0,5);
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++;
}
}
}
@@ -219,18 +231,20 @@ void CalculatorImpl::do_convert(int button) {
if ( current_mode >= pre_conv_modes_count && current_mode <= (max_mode - post_conv_modes_count) &&
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;
}
}