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.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp
index 163b4da..dead03d 100644
--- a/noncore/tools/calculator/calculatorimpl.cpp
+++ b/noncore/tools/calculator/calculatorimpl.cpp
@@ -127,193 +127,193 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
QObject::tr("Volume");
QObject::tr("acres");
QObject::tr("°C");
QObject::tr("carats");
QObject::tr("cm");
QObject::tr("cu cm");
QObject::tr("cu ft");
QObject::tr("cu in");
QObject::tr("°F");
QObject::tr("fl oz (US)");
QObject::tr("ft");
QObject::tr("g");
QObject::tr("gal (US)");
QObject::tr("hectares");
QObject::tr("in");
QObject::tr("kg");
QObject::tr("km");
QObject::tr("l");
QObject::tr("lb");
QObject::tr("Lg tons");
QObject::tr("m");
QObject::tr("mg");
QObject::tr("mi");
QObject::tr("ml");
QObject::tr("mm");
QObject::tr("naut. mi");
QObject::tr("oz");
QObject::tr("points");
QObject::tr("pt");
QObject::tr("qt");
QObject::tr("sq cm");
QObject::tr("sq ft");
QObject::tr("sq in");
QObject::tr("sq km");
QObject::tr("sq m");
QObject::tr("sq mi");
QObject::tr("sq mm");
QObject::tr("sq yd");
QObject::tr("st");
QObject::tr("St tons");
QObject::tr("tblspoon");
QObject::tr("teaspoons");
QObject::tr("tonnes");
QObject::tr("yd");
//bgr_command.insert( PushButtonFunction);
bgr_command.insert( PushButtonMPlus);
bgr_command.insert( PushButtonMR);
bgr_command.insert( PushButtonMC);
bgr_command.insert( PushButtonCE);
connect( &bgr_command, SIGNAL(clicked(int) ), this, SLOT(command_buttons(int)));
bgr_digits.insert(PushButton0);
bgr_digits.insert(PushButton1);
bgr_digits.insert(PushButton2);
bgr_digits.insert(PushButton3);
bgr_digits.insert(PushButton4);
bgr_digits.insert(PushButton5);
bgr_digits.insert(PushButton6);
bgr_digits.insert(PushButton7);
bgr_digits.insert(PushButton8);
bgr_digits.insert(PushButton9);
connect( &bgr_digits, SIGNAL(clicked(int) ), this, SLOT(enterNumber(int)));
bgr_std.insert(PushButtonEquals);
bgr_std.insert(PushButtonDecimal);
bgr_std.insert(PushButtonAdd);
bgr_std.insert(PushButtonMinus);
bgr_std.insert(PushButtonDivide);
bgr_std.insert(PushButtonTimes);
connect( &bgr_std, SIGNAL(clicked(int) ), this, SLOT(std_buttons(int)));
// change the / to a proper division signal
PushButtonDivide->setText(QChar(0xF7));
func_buttons[0] = PushButtonF1;
func_buttons[1] = PushButtonF2;
func_buttons[2] = PushButtonF3;
func_buttons[3] = PushButtonF4;
func_buttons[4] = PushButtonF5;
func_buttons[5] = PushButtonF6;
func_buttons[6] = PushButtonF7;
func_buttons[7] = PushButtonF8;
func_buttons[8] = PushButtonF9;
func_buttons[9] = PushButtonF10;
func_buttons[10] = PushButtonF11;
func_buttons[11] = PushButtonF12;
for ( int x = 0 ; x < func_button_count ; x++ ) {
QPushButton* tmpbutton = func_buttons[x];
faces << tmpbutton->text();
bgr_function.insert(tmpbutton);
}
connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(do_convert(int) ) );
- connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(std_funcs (int) ) );
+ connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(std_funcs(int) ) );
connect(ComboBoxFunction, SIGNAL(activated(int) ), this, SLOT(function_button(int) ) );
captions.append(tr("Standard"));
ComboBoxFunction->insertItem(captions.last());
// now add in the conversion modes
// when the menu gets done, these should be in a submenu
QString tmp = QPEApplication::qpeDir();
tmp += "etc/unit_conversion.dat";
QFile myfile(tmp);
if ( !myfile.open( IO_Translate | IO_ReadOnly ) ) {
qDebug("Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp);
// disable the f button if no conv file available
ComboBoxFunction->setEnabled(FALSE);
}
else {
QString line, line2;
QTextStream ts(&myfile);
// first pass, see how many conversion types there are in order to allocate for them
while ( ! ts.eof() ) {
line = ts.readLine();
if ( line.contains ("STARTTYPE" ) )
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);
// second pass, read in values
int x = 0;
while ( ! ts2.eof() ) {
line = ts2.readLine();
if ( line.contains("STARTTYPE") ) {
captions << tr( line.remove(0,10) );
ComboBoxFunction->insertItem(captions.last());
while ( !line.contains("ENDTYPE") ) {
line = ts2.readLine();
if ( line.contains("NAME") ) {
faces << tr( 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++;
}
}
}
}
}
myfile.close();
clear();
max_mode = pre_conv_modes_count + conversion_mode_count + post_conv_modes_count - 1;
display_pixmap_faces();
qApp->installEventFilter( this );
}
bool CalculatorImpl::eventFilter( QObject *o, QEvent *e )
{
if ( e->type() == QEvent::KeyPress && state != sError ) {
QKeyEvent *k = (QKeyEvent*)e;
if ( k->key() >= Key_0 && k->key() <= Key_9 ) {
enterNumber( k->key() - Key_0 );
return true;
} else {
switch ( k->key() ) {
case Key_Equal:
std_buttons(0);
return true;
case Key_Period:
std_buttons(1);
return true;
case Key_Plus:
std_buttons(2);
return true;
case Key_Minus:
std_buttons(3);
return true;
case Key_Slash:
std_buttons(4);
return true;
case Key_Asterisk:
std_buttons(5);
return true;
case Key_Percent: