summaryrefslogtreecommitdiff
path: root/noncore/tools/euroconv/calcdisplay.cpp
Unidiff
Diffstat (limited to 'noncore/tools/euroconv/calcdisplay.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/euroconv/calcdisplay.cpp50
1 files changed, 39 insertions, 11 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
@@ -15,6 +15,7 @@
15 15
16#include <stdio.h> 16#include <stdio.h>
17#include <qvbox.h> 17#include <qvbox.h>
18#include <qpixmap.h>
18 19
19#include "currency.h" 20#include "currency.h"
20#include "calcdisplay.h" 21#include "calcdisplay.h"
@@ -24,40 +25,56 @@ LCDDisplay::LCDDisplay( QWidget *parent, const char *name )
24 : QHBox( parent, name ){ 25 : QHBox( parent, name ){
25 26
26 27
28
29this->setMargin(5);
30this->setSpacing(5);
31
27// Create display 32// Create display
28QVBox *vbxlayout = new QVBox (this); 33QVBox *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");
33lcdTop->setMode( QLCDNumber::DEC ); 45lcdTop->setMode( QLCDNumber::DEC );
34lcdTop->setSmallDecimalPoint(true); 46lcdTop->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");
41lcdBottom->setMode( QLCDNumber::DEC ); 60lcdBottom->setMode( QLCDNumber::DEC );
42lcdBottom->setSmallDecimalPoint(true); 61lcdBottom->setSmallDecimalPoint(true);
43lcdBottom->setSegmentStyle(QLCDNumber::Flat); 62lcdBottom->setSegmentStyle(QLCDNumber::Flat);
44cbbxBottom->insertStrList(aCurrency);
45 63
46// set combo box signals 64// set combo box signals
47connect(cbbxTop, SIGNAL(activated(int)), this, SLOT(cbbxChange())); 65connect(cbbxTop, SIGNAL(activated(int)), this, SLOT(cbbxChange()));
48connect(cbbxBottom, SIGNAL(activated(int)), this, SLOT(cbbxChange())); 66connect(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
54connect(btnSwap, SIGNAL(clicked()), this, SLOT(swapLCD())); 73connect(btnSwap, SIGNAL(clicked()), this, SLOT(swapLCD()));
55 74
56// set default LCD to top 75// set default LCD to top
57iCurrentLCD = 0; 76iCurrentLCD = 0;
58 77
59//setValue(123.456);
60
61} 78}
62 79
63/*********************************************************************** 80/***********************************************************************
@@ -113,11 +130,17 @@ double dCurrentValue;
113 130
114// get current value 131// get current value
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{
119 dCurrentValue = lcdBottom->value(); 140 dCurrentValue = lcdBottom->value();
120 iCurrentLCD = 0; 141 iCurrentLCD = 0;
142 grpbxTop->setFrameStyle(grpbxStyle);
143 grpbxBottom->setFrameStyle(0);
121} 144}
122 145
123setValue(dCurrentValue); 146setValue(dCurrentValue);
@@ -130,8 +153,6 @@ void LCDDisplay::cbbxChange(void){
130 153
131double dCurrentValue; 154double dCurrentValue;
132 155
133printf("combo changes...\n");
134
135// get current value 156// get current value
136if(!iCurrentLCD){ 157if(!iCurrentLCD){
137 dCurrentValue = lcdTop->value(); 158 dCurrentValue = lcdTop->value();
@@ -161,6 +182,9 @@ switch (iIndex){
161 case 2: // DM: Deutch Mark 182 case 2: // DM: Deutch Mark
162 return(dValue*DM); 183 return(dValue*DM);
163 break; 184 break;
185
186 default:
187 return 0;
164}//switch (iIndex) 188}//switch (iIndex)
165}// fct Eur2x 189}// fct Eur2x
166 190
@@ -185,4 +209,8 @@ switch (iIndex){
185 return(dValue/DM); 209 return(dValue/DM);
186 break; 210 break;
187}//switch (iIndex) 211}//switch (iIndex)
212
213// we shouldn't come here
214return 0;
215
188}// fct x2Euro 216}// fct x2Euro