From d5714ac7fe62676ee1a63be2f965cb567ef7ae3e Mon Sep 17 00:00:00 2001 From: kergoth Date: Fri, 08 Feb 2002 18:07:57 +0000 Subject: Merged in Charles-Edouard Ruault's calculator patch to add temp conversion. --- (limited to 'noncore/tools') 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 + * Added support for Temperature conversions. + */ + #include "calculatorimpl.h" #include @@ -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; -- cgit v0.9.0.2