summaryrefslogtreecommitdiff
path: root/noncore/tools/calculator
Unidiff
Diffstat (limited to 'noncore/tools/calculator') (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 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21/*
22 * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com>
23 * Added support for Temperature conversions.
24 */
25
21#include "calculatorimpl.h" 26#include "calculatorimpl.h"
22 27
23#include <qpe/resource.h> 28#include <qpe/resource.h>
@@ -134,7 +139,8 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
134 } 139 }
135 140
136 entry_list = new double[conversion_mode_count*func_button_count]; 141 entry_list = new double[conversion_mode_count*func_button_count];
137 142 preoffset_list = new double[conversion_mode_count*func_button_count];
143 postoffset_list = new double[conversion_mode_count*func_button_count];
138 myfile.close(); 144 myfile.close();
139 myfile.open( IO_Translate | IO_ReadOnly ); 145 myfile.open( IO_Translate | IO_ReadOnly );
140 QTextStream ts2(&myfile); 146 QTextStream ts2(&myfile);
@@ -153,6 +159,12 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
153 line2 = ts2.readLine(); 159 line2 = ts2.readLine();
154 line2.remove(0,6); 160 line2.remove(0,6);
155 entry_list[x] = line2.toDouble(); 161 entry_list[x] = line2.toDouble();
162 line2 = ts2.readLine();
163 line2.remove(0,7);
164 preoffset_list[x] = line2.toDouble();
165 line2 = ts2.readLine();
166 line2.remove(0,8);
167 postoffset_list[x] = line2.toDouble();
156 x++; 168 x++;
157 } 169 }
158 } 170 }
@@ -220,16 +232,18 @@ void CalculatorImpl::do_convert(int button) {
220 button < changeable_func_button_count ) { 232 button < changeable_func_button_count ) {
221 if ( last_conversion > -1 ) { 233 if ( last_conversion > -1 ) {
222 if( state == sNewNumber ){ 234 if( state == sNewNumber ){
223 acc = num 235 acc = (num+ preoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion])
224 / (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion]) 236 / (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion])
225 * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button]) ; 237 * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button])
238 +postoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + button];
226 num = acc; 239 num = acc;
227 LCD->display( acc ); 240 LCD->display( acc );
228 } else { 241 } else {
229 state = sNewNumber; 242 state = sNewNumber;
230 num = num 243 num = (num+ preoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion])
231 / (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion]) 244 / (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion])
232 * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button]) ; 245 * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button])
246 + postoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + button];;
233 LCD->display( num ); 247 LCD->display( num );
234 acc = num; 248 acc = num;
235 } 249 }
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:
124 124
125 // an array of doubles holding the conversion ratios 125 // an array of doubles holding the conversion ratios
126 double* entry_list; 126 double* entry_list;
127 double* preoffset_list;
128 double* postoffset_list;
127 129
128 QPixmap xtopowerofy; 130 QPixmap xtopowerofy;
129 QPixmap ythrootofx; 131 QPixmap ythrootofx;