author | eric <eric> | 2003-02-25 13:37:30 (UTC) |
---|---|---|
committer | eric <eric> | 2003-02-25 13:37:30 (UTC) |
commit | af4a36adc86052db4ab6855830cb7c5cc9e2d008 (patch) (unidiff) | |
tree | 6c1e4c51ce9663b8256f56aa0c98ab1eaab72d07 | |
parent | e21765875b06f8e76bdd6cfce120a68beaf48e41 (diff) | |
download | opie-af4a36adc86052db4ab6855830cb7c5cc9e2d008.zip opie-af4a36adc86052db4ab6855830cb7c5cc9e2d008.tar.gz opie-af4a36adc86052db4ab6855830cb7c5cc9e2d008.tar.bz2 |
- add more currency support
-rw-r--r-- | noncore/tools/euroconv/calcdisplay.cpp | 40 | ||||
-rw-r--r-- | noncore/tools/euroconv/currency.h | 10 |
2 files changed, 43 insertions, 7 deletions
diff --git a/noncore/tools/euroconv/calcdisplay.cpp b/noncore/tools/euroconv/calcdisplay.cpp index 1659858..898de81 100644 --- a/noncore/tools/euroconv/calcdisplay.cpp +++ b/noncore/tools/euroconv/calcdisplay.cpp | |||
@@ -147,70 +147,102 @@ setValue(dCurrentValue); | |||
147 | } | 147 | } |
148 | 148 | ||
149 | /*********************************************************************** | 149 | /*********************************************************************** |
150 | * SLOT: Currency change | 150 | * SLOT: Currency change |
151 | **********************************************************************/ | 151 | **********************************************************************/ |
152 | void LCDDisplay::cbbxChange(void){ | 152 | void LCDDisplay::cbbxChange(void){ |
153 | 153 | ||
154 | double dCurrentValue; | 154 | double dCurrentValue; |
155 | 155 | ||
156 | // get current value | 156 | // get current value |
157 | if(!iCurrentLCD){ | 157 | if(!iCurrentLCD){ |
158 | dCurrentValue = lcdTop->value(); | 158 | dCurrentValue = lcdTop->value(); |
159 | }else{ | 159 | }else{ |
160 | dCurrentValue = lcdBottom->value(); | 160 | dCurrentValue = lcdBottom->value(); |
161 | } | 161 | } |
162 | 162 | ||
163 | setValue(dCurrentValue); | 163 | setValue(dCurrentValue); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | /*********************************************************************** | 167 | /*********************************************************************** |
168 | * Euro2x converts dValue from Euro to the currency which combo box | 168 | * Euro2x converts dValue from Euro to the currency which combo box |
169 | * index is provided in iIndex. | 169 | * index is provided in iIndex. |
170 | **********************************************************************/ | 170 | **********************************************************************/ |
171 | double LCDDisplay::Euro2x(int iIndex, double dValue){ | 171 | double LCDDisplay::Euro2x(int iIndex, double dValue){ |
172 | 172 | ||
173 | switch (iIndex){ | 173 | switch (iIndex){ |
174 | case 0: // Euro | 174 | case 0: // Euro |
175 | return(dValue); | 175 | return(dValue); |
176 | break; | 176 | break; |
177 | 177 | ||
178 | case 1: // FF: French Francs | 178 | case 1: // FF: French Francs |
179 | return(dValue*FF); | 179 | return(dValue*FRF); |
180 | break; | 180 | break; |
181 | 181 | ||
182 | case 2: // DM: Deutch Mark | 182 | case 2: // DM: Deutch Mark |
183 | return(dValue*DM); | 183 | return(dValue*DEM); |
184 | break; | ||
185 | |||
186 | case 3: // BEL Belgium Francs | ||
187 | return(dValue*BEF); | ||
188 | break; | ||
189 | |||
190 | case 4: // ITL Itialian Lire | ||
191 | return(dValue*ITL); | ||
192 | break; | ||
193 | |||
194 | case 5: // LUF Luxemburg | ||
195 | return(dValue*LUF); | ||
196 | break; | ||
197 | |||
198 | case 6: // IEP Irish Pound | ||
199 | return(dValue*IEP); | ||
184 | break; | 200 | break; |
185 | 201 | ||
186 | default: | 202 | default: |
187 | return 0; | 203 | return 0; |
188 | }//switch (iIndex) | 204 | }//switch (iIndex) |
189 | }// fct Eur2x | 205 | }// fct Eur2x |
190 | 206 | ||
191 | 207 | ||
192 | 208 | ||
193 | /*********************************************************************** | 209 | /*********************************************************************** |
194 | * x2Euro converts dValue to Euro from the currency which combo box | 210 | * x2Euro converts dValue to Euro from the currency which combo box |
195 | * index is provided in iIndex. | 211 | * index is provided in iIndex. |
196 | **********************************************************************/ | 212 | **********************************************************************/ |
197 | double LCDDisplay::x2Euro(int iIndex, double dValue){ | 213 | double LCDDisplay::x2Euro(int iIndex, double dValue){ |
198 | 214 | ||
199 | switch (iIndex){ | 215 | switch (iIndex){ |
200 | case 0: // Euro | 216 | case 0: // Euro |
201 | return(dValue); | 217 | return(dValue); |
202 | break; | 218 | break; |
203 | 219 | ||
204 | case 1: // FF: French Francs | 220 | case 1: // FF: French Francs |
205 | return(dValue/FF); | 221 | return(dValue/FRF); |
206 | break; | 222 | break; |
207 | 223 | ||
208 | case 2: // DM: Deutch Mark | 224 | case 2: // DM: Deutch Mark |
209 | return(dValue/DM); | 225 | return(dValue/DEM); |
226 | break; | ||
227 | |||
228 | case 3: // BEL Belgium Francs | ||
229 | return(dValue/BEF); | ||
230 | break; | ||
231 | |||
232 | case 4: // ITL Itialian Lire | ||
233 | return(dValue/ITL); | ||
234 | break; | ||
235 | |||
236 | case 5: // LUF Luxemburg | ||
237 | return(dValue/LUF); | ||
238 | break; | ||
239 | |||
240 | case 6: // IEP Irish Pound | ||
241 | return(dValue/IEP); | ||
210 | break; | 242 | break; |
211 | }//switch (iIndex) | 243 | }//switch (iIndex) |
212 | 244 | ||
213 | // we shouldn't come here | 245 | // we shouldn't come here |
214 | return 0; | 246 | return 0; |
215 | 247 | ||
216 | }// fct x2Euro | 248 | }// fct x2Euro |
diff --git a/noncore/tools/euroconv/currency.h b/noncore/tools/euroconv/currency.h index d9ee75c..6ca4d09 100644 --- a/noncore/tools/euroconv/currency.h +++ b/noncore/tools/euroconv/currency.h | |||
@@ -1,20 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | * | 2 | * |
3 | * File: currency.h | 3 | * File: currency.h |
4 | * | 4 | * |
5 | * Description: define constant for currency compare Euro | 5 | * Description: define constant for currency compare Euro |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * Authors: Eric Santonacci <Eric.Santonacci@talc.fr> | 8 | * Authors: Eric Santonacci <Eric.Santonacci@talc.fr> |
9 | * | 9 | * |
10 | * | 10 | * |
11 | * $Id$ | 11 | * $Id$ |
12 | * | 12 | * |
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | 14 | ||
15 | // 1 Euro equal.... | 15 | // 1 Euro equal.... |
16 | #define EURO 1 // Euro | 16 | #define EURO 1 // Euro |
17 | #define FF 6.55957 // French Francs | 17 | #define FRF 6.55957 // French Francs |
18 | #define DM 1.9594 // Deutch Mark | 18 | #define DEM 1.9594 // Deutch Mark |
19 | #define BEF 40.3399 // Belgium Francs | ||
20 | #define ITL 1936.27 // Italian Lire | ||
21 | #define LUF 40.3399 // Luxemburg | ||
22 | #define IEP 0.787564 // Irish Pound | ||
19 | 23 | ||
20 | static const char* aCurrency[] = { "Euro", "FF", "DM", 0 }; | 24 | static const char* aCurrency[] = { "Euro", "FRF", "DEM", "BEF", "ITL", "LUF", "IEP", 0 }; |