summaryrefslogtreecommitdiff
path: root/noncore
authoreric <eric>2003-02-21 10:39:29 (UTC)
committer eric <eric>2003-02-21 10:39:29 (UTC)
commit2d77abb5ff37abf61e04657431d7e0e1f5138d94 (patch) (unidiff)
treec78d34380cb9e1722f41c56cda0bbbea394e2a1a /noncore
parentd25a16d1fd34374e4d2815dec4d11b25b2049432 (diff)
downloadopie-2d77abb5ff37abf61e04657431d7e0e1f5138d94.zip
opie-2d77abb5ff37abf61e04657431d7e0e1f5138d94.tar.gz
opie-2d77abb5ff37abf61e04657431d7e0e1f5138d94.tar.bz2
- Improve look 'n feel.
- fix a bug in '=' operation.
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/euroconv/calcdisplay.cpp50
-rw-r--r--noncore/tools/euroconv/calcdisplay.h38
-rw-r--r--noncore/tools/euroconv/calckeypad.cpp48
-rw-r--r--noncore/tools/euroconv/calckeypad.h2
-rw-r--r--noncore/tools/euroconv/currency.h4
5 files changed, 109 insertions, 33 deletions
diff --git a/noncore/tools/euroconv/calcdisplay.cpp b/noncore/tools/euroconv/calcdisplay.cpp
index 06e5158..1659858 100644
--- a/noncore/tools/euroconv/calcdisplay.cpp
+++ b/noncore/tools/euroconv/calcdisplay.cpp
@@ -17,2 +17,3 @@
17#include <qvbox.h> 17#include <qvbox.h>
18#include <qpixmap.h>
18 19
@@ -26,2 +27,6 @@ LCDDisplay::LCDDisplay( QWidget *parent, const char *name )
26 27
28
29this->setMargin(5);
30this->setSpacing(5);
31
27// Create display 32// Create display
@@ -29,4 +34,11 @@ QVBox *vbxlayout = new QVBox (this);
29 34
30grpbxTop = new QVGroupBox(vbxlayout, "grpbxTop"); 35/*************** Top LCD ***********************/
36grpbxTop = new QHGroupBox(vbxlayout, "grpbxTop");
37grpbxStyle = grpbxTop->frameStyle();
38grpbxTop->setMaximumHeight(48);
39
31cbbxTop = new QComboBox(grpbxTop, "cbbxTop"); 40cbbxTop = new QComboBox(grpbxTop, "cbbxTop");
41cbbxTop->setMaximumWidth(50);
42cbbxTop->insertStrList(aCurrency);
43
32lcdTop = new QLCDNumber(10, grpbxTop, "lcdTop"); 44lcdTop = new QLCDNumber(10, grpbxTop, "lcdTop");
@@ -35,6 +47,13 @@ lcdTop->setSmallDecimalPoint(true);
35lcdTop->setSegmentStyle(QLCDNumber::Flat); 47lcdTop->setSegmentStyle(QLCDNumber::Flat);
36cbbxTop->insertStrList(aCurrency);
37 48
38grpbxBottom = new QVGroupBox(vbxlayout, "grpbxBottom"); 49/************** Bottom LCD ************************/
50grpbxBottom = new QHGroupBox(vbxlayout, "grpbxBottom");
51grpbxBottom->setMaximumHeight(46);
52grpbxBottom->setFrameStyle(0);
53grpbxBottom->setFrameShadow(QFrame::MShadow);
54
39cbbxBottom = new QComboBox(grpbxBottom, "cbbxBottom"); 55cbbxBottom = new QComboBox(grpbxBottom, "cbbxBottom");
56cbbxBottom->setMaximumWidth(50);
57cbbxBottom->insertStrList(aCurrency);
58
40lcdBottom = new QLCDNumber(10, grpbxBottom, "lcdBottom"); 59lcdBottom = new QLCDNumber(10, grpbxBottom, "lcdBottom");
@@ -43,3 +62,2 @@ lcdBottom->setSmallDecimalPoint(true);
43lcdBottom->setSegmentStyle(QLCDNumber::Flat); 62lcdBottom->setSegmentStyle(QLCDNumber::Flat);
44cbbxBottom->insertStrList(aCurrency);
45 63
@@ -49,5 +67,6 @@ connect(cbbxBottom, SIGNAL(activated(int)), this, SLOT(cbbxChange()));
49 67
50btnSwap = new QPushButton("S",this, "swap"); 68btnSwap = new QPushButton(this, "swap");
51btnSwap->setMaximumSize(20,50); 69QPixmap imgSwap((const char**) swap_xpm);
52btnSwap->setMinimumSize(20,50); 70btnSwap->setPixmap(imgSwap);
71btnSwap->setFixedSize(20,40);
53// set signal 72// set signal
@@ -58,4 +77,2 @@ iCurrentLCD = 0;
58 77
59//setValue(123.456);
60
61} 78}
@@ -115,4 +132,8 @@ double dCurrentValue;
115if(!iCurrentLCD){ 132if(!iCurrentLCD){
133 // iCurrentLCD = 0, lcdTop has current focus and is going to loose
134 // it
116 dCurrentValue = lcdTop->value(); 135 dCurrentValue = lcdTop->value();
117 iCurrentLCD = 1; 136 iCurrentLCD = 1;
137 grpbxTop->setFrameStyle(0);
138 grpbxBottom->setFrameStyle(grpbxStyle);
118}else{ 139}else{
@@ -120,2 +141,4 @@ if(!iCurrentLCD){
120 iCurrentLCD = 0; 141 iCurrentLCD = 0;
142 grpbxTop->setFrameStyle(grpbxStyle);
143 grpbxBottom->setFrameStyle(0);
121} 144}
@@ -132,4 +155,2 @@ double dCurrentValue;
132 155
133printf("combo changes...\n");
134
135// get current value 156// get current value
@@ -163,2 +184,5 @@ switch (iIndex){
163 break; 184 break;
185
186 default:
187 return 0;
164}//switch (iIndex) 188}//switch (iIndex)
@@ -187,2 +211,6 @@ switch (iIndex){
187}//switch (iIndex) 211}//switch (iIndex)
212
213// we shouldn't come here
214return 0;
215
188}// fct x2Euro 216}// fct x2Euro
diff --git a/noncore/tools/euroconv/calcdisplay.h b/noncore/tools/euroconv/calcdisplay.h
index 17ce8f4..d1902cf 100644
--- a/noncore/tools/euroconv/calcdisplay.h
+++ b/noncore/tools/euroconv/calcdisplay.h
@@ -20,3 +20,3 @@
20#include <qlcdnumber.h> 20#include <qlcdnumber.h>
21#include <qvgroupbox.h> 21#include <qhgroupbox.h>
22#include <qpushbutton.h> 22#include <qpushbutton.h>
@@ -24,2 +24,32 @@
24 24
25
26/* XPM */
27static char *swap_xpm[] = {
28/* width height num_colors chars_per_pixel */
29" 13 18 2 1",
30/* colors */
31". c None",
32"# c #000000",
33/* pixels */
34"..#######....",
35"..#####......",
36"..######.....",
37"..#...###....",
38"........##...",
39".........##..",
40"..........##.",
41"...........##",
42"...........##",
43"...........##",
44"...........##",
45"..........##.",
46".........##..",
47"........##...",
48"..#...###....",
49"..######.....",
50"..#####......",
51"..#######....",
52};
53
54
25class LCDDisplay : public QHBox{ 55class LCDDisplay : public QHBox{
@@ -38,3 +68,5 @@ public slots:
38private: 68private:
39 QVGroupBox *grpbxTop; 69 int grpbxStyle;
70
71 QHGroupBox *grpbxTop;
40 QComboBox *cbbxTop; 72 QComboBox *cbbxTop;
@@ -42,3 +74,3 @@ private:
42 74
43 QVGroupBox *grpbxBottom; 75 QHGroupBox *grpbxBottom;
44 QComboBox *cbbxBottom; 76 QComboBox *cbbxBottom;
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
@@ -23,2 +23,4 @@ KeyPad::KeyPad(LCDDisplay *lcd, QWidget *parent, const char *name )
23 23
24int i;
25QButton *btnButton;
24 26
@@ -72,2 +74,8 @@ grpbtnDigits->insert(btn9, 9);
72 74
75// set appearance of buttons
76for(i=0; i<10; i++){
77 btnButton = grpbtnDigits->find(i);
78 btnButton->setFixedSize(30,30);
79}
80
73// Operator key 81// Operator key
@@ -79,2 +87,13 @@ grpbtnOperators->insert(btnDivide,4);
79grpbtnOperators->insert(btnEqual,5); 87grpbtnOperators->insert(btnEqual,5);
88// set appearance of buttons
89for(i=1; i<6; i++){
90 btnButton = grpbtnOperators->find(i);
91 btnButton->setFixedSize(30,30);
92}
93btnClear->setFixedSize(30,30);
94btnClear->setPalette(QPalette( QColor(255, 99, 71) ) );
95btnDot->setFixedSize(30,30);
96btnPercent->setFixedSize(30,30);
97btnF1->setFixedSize(30,30);
98btnAbout->setFixedSize(30,30);
80 99
@@ -137,18 +156,11 @@ if(iPreviousOperator){
137} 156}
138if(i == 5){
139 // key '=' pressed
140 dPreviousValue = 0;
141 iPreviousOperator = 0;
142 // We don't want to add digits
143 iLenCurrent = 100;
144}else{
145 dPreviousValue = dCurrent;
146 iPreviousOperator = i;
147 // reset LCD for next digit
148 dCurrent = 0;
149 iLenCurrent = 1;
150 bIsDec = false;
151 dDecCurrent = 0;
152}
153 157
158dPreviousValue = dCurrent;
159iPreviousOperator = i;
160
161// reset LCD for next digit
162dCurrent = 0;
163iLenCurrent = 1;
164bIsDec = false;
165dDecCurrent = 0;
154} 166}
@@ -189,3 +201,7 @@ QMessageBox::about( this, "About Euroconv",
189 "Written by Eric Santonacci for Opie\n" 201 "Written by Eric Santonacci for Opie\n"
190 "http://opie.handhelds.org\n" ); 202 "http://opie.handhelds.org\n\n"
203 "Version 0.2\n\n"
204 "Any comment or feedback to:\n"
205 "Eric.Santonacci@talc.fr\n");
206
191} 207}
diff --git a/noncore/tools/euroconv/calckeypad.h b/noncore/tools/euroconv/calckeypad.h
index 42e7eb3..aac3f41 100644
--- a/noncore/tools/euroconv/calckeypad.h
+++ b/noncore/tools/euroconv/calckeypad.h
@@ -73,3 +73,3 @@ private:
73 73
74 74 void setAppearance(void);
75 75
diff --git a/noncore/tools/euroconv/currency.h b/noncore/tools/euroconv/currency.h
index 90f5b57..d9ee75c 100644
--- a/noncore/tools/euroconv/currency.h
+++ b/noncore/tools/euroconv/currency.h
@@ -17,4 +17,4 @@
17#define FF 6.55957 // French Francs 17#define FF 6.55957 // French Francs
18#define DM 1.96 // Deutch Mark 18#define DM 1.9594 // Deutch Mark
19 19
20static const char* aCurrency[] = { "Euro", "French Frs", "DM", 0 }; 20static const char* aCurrency[] = { "Euro", "FF", "DM", 0 };