summaryrefslogtreecommitdiff
path: root/noncore/tools/euroconv/calckeypad.cpp
Side-by-side diff
Diffstat (limited to 'noncore/tools/euroconv/calckeypad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/euroconv/calckeypad.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/noncore/tools/euroconv/calckeypad.cpp b/noncore/tools/euroconv/calckeypad.cpp
index 4156570..f1d61c0 100644
--- a/noncore/tools/euroconv/calckeypad.cpp
+++ b/noncore/tools/euroconv/calckeypad.cpp
@@ -18,12 +18,14 @@
#include "calckeypad.h"
KeyPad::KeyPad(LCDDisplay *lcd, QWidget *parent, const char *name )
: QGrid(5, parent, name){
+int i;
+QButton *btnButton;
// save lcd at init
display = lcd;
// Init variable
dCurrent = 0;
iLenCurrent = 1;
@@ -67,19 +69,36 @@ grpbtnDigits->insert(btn4, 4);
grpbtnDigits->insert(btn5, 5);
grpbtnDigits->insert(btn6, 6);
grpbtnDigits->insert(btn7, 7);
grpbtnDigits->insert(btn8, 8);
grpbtnDigits->insert(btn9, 9);
+// set appearance of buttons
+for(i=0; i<10; i++){
+ btnButton = grpbtnDigits->find(i);
+ btnButton->setFixedSize(30,30);
+}
+
// Operator key
grpbtnOperators = new QButtonGroup(0, "operator");
grpbtnOperators->insert(btnPlus, 1);
grpbtnOperators->insert(btnMinus,2);
grpbtnOperators->insert(btnMultiply,3);
grpbtnOperators->insert(btnDivide,4);
grpbtnOperators->insert(btnEqual,5);
+// set appearance of buttons
+for(i=1; i<6; i++){
+ btnButton = grpbtnOperators->find(i);
+ btnButton->setFixedSize(30,30);
+}
+btnClear->setFixedSize(30,30);
+btnClear->setPalette(QPalette( QColor(255, 99, 71) ) );
+btnDot->setFixedSize(30,30);
+btnPercent->setFixedSize(30,30);
+btnF1->setFixedSize(30,30);
+btnAbout->setFixedSize(30,30);
// SIGNALS AND SLOTS
connect(grpbtnDigits, SIGNAL(clicked(int) ), this, SLOT(enterDigits(int)));
connect(grpbtnOperators, SIGNAL(clicked(int)), this, SLOT(operatorPressed(int)));
connect(btnClear, SIGNAL(clicked()), this, SLOT(clearLCD()));
@@ -132,28 +151,21 @@ if(iPreviousOperator){
dCurrent = dPreviousValue / dCurrent;
break;
}
display->setValue(dCurrent);
}
-if(i == 5){
- // key '=' pressed
- dPreviousValue = 0;
- iPreviousOperator = 0;
- // We don't want to add digits
- iLenCurrent = 100;
-}else{
- dPreviousValue = dCurrent;
- iPreviousOperator = i;
- // reset LCD for next digit
- dCurrent = 0;
- iLenCurrent = 1;
- bIsDec = false;
- dDecCurrent = 0;
-}
+dPreviousValue = dCurrent;
+iPreviousOperator = i;
+
+// reset LCD for next digit
+dCurrent = 0;
+iLenCurrent = 1;
+bIsDec = false;
+dDecCurrent = 0;
}
/***********************************************************************
* SLOT: clearLCD CE/C has been pressed
**********************************************************************/
void KeyPad::clearLCD(void){
@@ -184,8 +196,12 @@ void KeyPad::aboutDialog(void){
QMessageBox::about( this, "About Euroconv",
"Euroconv is an Euro converter\n\n"
"Copyright 2003 TALC Informatique.\n"
"Under GPL license\n\n"
"Written by Eric Santonacci for Opie\n"
- "http://opie.handhelds.org\n" );
+ "http://opie.handhelds.org\n\n"
+ "Version 0.2\n\n"
+ "Any comment or feedback to:\n"
+ "Eric.Santonacci@talc.fr\n");
+
}