author | kergoth <kergoth> | 2002-02-08 18:07:57 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-02-08 18:07:57 (UTC) |
commit | d5714ac7fe62676ee1a63be2f965cb567ef7ae3e (patch) (side-by-side diff) | |
tree | a9518ba91ba235733e00fbe6926f0ae7e29e8350 /noncore | |
parent | acae430926d1b5a8877e0d92cfc7abef749c8f1a (diff) | |
download | opie-d5714ac7fe62676ee1a63be2f965cb567ef7ae3e.zip opie-d5714ac7fe62676ee1a63be2f965cb567ef7ae3e.tar.gz opie-d5714ac7fe62676ee1a63be2f965cb567ef7ae3e.tar.bz2 |
Merged in Charles-Edouard Ruault's calculator patch to add temp conversion.
-rw-r--r-- | noncore/tools/calculator/calculatorimpl.cpp | 24 | ||||
-rw-r--r-- | noncore/tools/calculator/calculatorimpl.h | 2 |
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 @@ -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; } } 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 @@ -123,8 +123,10 @@ private: QStringList faces, captions; // an array of doubles holding the conversion ratios double* entry_list; + double* preoffset_list; + double* postoffset_list; QPixmap xtopowerofy; QPixmap ythrootofx; QPixmap oneoverx; |