summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/euroconv/calcdisplay.cpp28
-rw-r--r--noncore/tools/euroconv/calcdisplay.h28
-rw-r--r--noncore/tools/euroconv/main.cpp2
3 files changed, 29 insertions, 29 deletions
diff --git a/noncore/tools/euroconv/calcdisplay.cpp b/noncore/tools/euroconv/calcdisplay.cpp
index e5a49e6..8f3de22 100644
--- a/noncore/tools/euroconv/calcdisplay.cpp
+++ b/noncore/tools/euroconv/calcdisplay.cpp
@@ -1,118 +1,146 @@
/****************************************************************************
*
* File: calcdisplay.cpp
*
* Description:
*
*
* Authors: Eric Santonacci <Eric.Santonacci@talc.fr>
*
* Requirements: Qt
*
* $Id$
*
***************************************************************************/
#include <stdio.h>
#include <qvbox.h>
#include <qpixmap.h>
#include "currency.h"
#include "calcdisplay.h"
+/* XPM */
+static char *swap_xpm[] = {
+/* width height num_colors chars_per_pixel */
+" 13 18 2 1",
+/* colors */
+". c None",
+"# c #000000",
+/* pixels */
+"..#######....",
+"..#####......",
+"..######.....",
+"..#...###....",
+"........##...",
+".........##..",
+"..........##.",
+"...........##",
+"...........##",
+"...........##",
+"...........##",
+"..........##.",
+".........##..",
+"........##...",
+"..#...###....",
+"..######.....",
+"..#####......",
+"..#######....",
+};
+
LCDDisplay::LCDDisplay( QWidget *parent, const char *name )
: QHBox( parent, name ){
this->setMargin(5);
this->setSpacing(5);
// Create display
QVBox *vbxlayout = new QVBox (this);
/*************** Top LCD ***********************/
grpbxTop = new QHGroupBox(vbxlayout, "grpbxTop");
grpbxStyle = grpbxTop->frameStyle();
grpbxTop->setMaximumHeight(48);
cbbxTop = new QComboBox(grpbxTop, "cbbxTop");
cbbxTop->setMaximumWidth(50);
cbbxTop->insertStrList(aCurrency);
lcdTop = new QLCDNumber(10, grpbxTop, "lcdTop");
lcdTop->setMode( QLCDNumber::DEC );
lcdTop->setSmallDecimalPoint(false);
lcdTop->setSegmentStyle(QLCDNumber::Flat);
/************** Bottom LCD ************************/
grpbxBottom = new QHGroupBox(vbxlayout, "grpbxBottom");
grpbxBottom->setMaximumHeight(46);
grpbxBottom->setFrameStyle(0);
grpbxBottom->setFrameShadow(QFrame::MShadow);
cbbxBottom = new QComboBox(grpbxBottom, "cbbxBottom");
cbbxBottom->setMaximumWidth(50);
cbbxBottom->insertStrList(aCurrency);
lcdBottom = new QLCDNumber(10, grpbxBottom, "lcdBottom");
lcdBottom->setMode( QLCDNumber::DEC );
lcdBottom->setSmallDecimalPoint(false);
lcdBottom->setSegmentStyle(QLCDNumber::Flat);
// set combo box signals
connect(cbbxTop, SIGNAL(activated(int)), this, SLOT(cbbxChange()));
connect(cbbxBottom, SIGNAL(activated(int)), this, SLOT(cbbxChange()));
btnSwap = new QPushButton(this, "swap");
QPixmap imgSwap((const char**) swap_xpm);
btnSwap->setPixmap(imgSwap);
btnSwap->setFixedSize(20,40);
// set signal
connect(btnSwap, SIGNAL(clicked()), this, SLOT(swapLCD()));
// set default LCD to top
iCurrentLCD = 0;
}
/***********************************************************************
* SLOT: Display value in the correct LCD
**********************************************************************/
void LCDDisplay::setValue(double dSrcValue){
double dDstValue=0;
int iSrcIndex;
int iDstIndex;
// get item index of the focused
if(!iCurrentLCD){
iSrcIndex = cbbxTop->currentItem();
iDstIndex = cbbxBottom->currentItem();
}else{
iSrcIndex = cbbxBottom->currentItem();
iDstIndex = cbbxTop->currentItem();
}
if(iSrcIndex == iDstIndex)
dDstValue = dSrcValue;
else{
if(iSrcIndex){
// we are NOT in Euro as iDstIndex <> 0
// Convert to Euro
dDstValue = x2Euro(iSrcIndex, dSrcValue);
dDstValue = Euro2x(iDstIndex, dDstValue);
}else
// We are in Euro
dDstValue = Euro2x(iDstIndex, dSrcValue);
}
if(!iCurrentLCD){
lcdTop->display(dSrcValue);
lcdBottom->display(dDstValue);
}else{
lcdBottom->display(dSrcValue);
diff --git a/noncore/tools/euroconv/calcdisplay.h b/noncore/tools/euroconv/calcdisplay.h
index d1902cf..a48ab77 100644
--- a/noncore/tools/euroconv/calcdisplay.h
+++ b/noncore/tools/euroconv/calcdisplay.h
@@ -1,89 +1,61 @@
/****************************************************************************
*
* File: calcdisplay.h
*
* Description: Header file for the class LCDDisplay
*
*
* Authors: Eric Santonacci <Eric.Santonacci@talc.fr>
*
* Requirements: Qt
*
* $Id$
*
*
***************************************************************************/
#ifndef CALCDISPLAY_H
#define CALCDISPLAY_H
#include <qhbox.h>
#include <qlcdnumber.h>
#include <qhgroupbox.h>
#include <qpushbutton.h>
#include <qcombobox.h>
-/* XPM */
-static char *swap_xpm[] = {
-/* width height num_colors chars_per_pixel */
-" 13 18 2 1",
-/* colors */
-". c None",
-"# c #000000",
-/* pixels */
-"..#######....",
-"..#####......",
-"..######.....",
-"..#...###....",
-"........##...",
-".........##..",
-"..........##.",
-"...........##",
-"...........##",
-"...........##",
-"...........##",
-"..........##.",
-".........##..",
-"........##...",
-"..#...###....",
-"..######.....",
-"..#####......",
-"..#######....",
-};
-
class LCDDisplay : public QHBox{
Q_OBJECT
public:
LCDDisplay( QWidget *parent=0, const char *name=0 );
public slots:
void setValue(double);
void swapLCD(void);
void cbbxChange(void);
//signals:
// void valueChanged( int );
private:
int grpbxStyle;
QHGroupBox *grpbxTop;
QComboBox *cbbxTop;
QLCDNumber *lcdTop;
QHGroupBox *grpbxBottom;
QComboBox *cbbxBottom;
QLCDNumber *lcdBottom;
QPushButton *btnSwap;
int iCurrentLCD; // 0=top, 1=bottom
double Euro2x(int iIndex, double dValue);
double x2Euro(int iIndex, double dValue);
};
#endif // CALCDISPLAY_H
diff --git a/noncore/tools/euroconv/main.cpp b/noncore/tools/euroconv/main.cpp
index dd4ff1d..8b417fe 100644
--- a/noncore/tools/euroconv/main.cpp
+++ b/noncore/tools/euroconv/main.cpp
@@ -1,39 +1,39 @@
/****************************************************************************
*
* File: main.cpp
*
* Description: main file for OPIE Euroconv aapp
*
*
* Authors: Eric Santonacci <Eric.Santonacci@talc.fr>
*
* Requirements: Qt
*
*
***************************************************************************/
#include <qpe/qpeapplication.h>
#include <qvbox.h>
#include "calcdisplay.h"
#include "calckeypad.h"
#include <opie2/oapplicationfactory.h>
struct Layout : QVBox{
static QString appName() { return QString::fromLatin1("euroconv"); }
Layout(QWidget *p, const char* n, WFlags)
:QVBox(0,"fond" )
{
LCDDisplay *lcd = new LCDDisplay(this, "lcd");
- KeyPad *num = new KeyPad(lcd, this, "keypad");
+ (void)new KeyPad(lcd, this, "keypad");
setCaption( QObject::tr("Euroconv") );
};
};
using namespace Opie::Core;
OPIE_EXPORT_APP( OApplicationFactory<Layout> )