summaryrefslogtreecommitdiff
path: root/noncore/tools/calc2
Side-by-side diff
Diffstat (limited to 'noncore/tools/calc2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/calc2/binary/binary.pro28
-rw-r--r--noncore/tools/calc2/binary/binaryfactory.cpp2
-rw-r--r--noncore/tools/calc2/binary/binaryfactory.h4
-rw-r--r--noncore/tools/calc2/binary/binaryimpl.cpp2
-rw-r--r--noncore/tools/calc2/binary/binaryimpl.h2
-rw-r--r--noncore/tools/calc2/calc.cpp1
-rw-r--r--noncore/tools/calc2/simple/simple.pro22
-rw-r--r--noncore/tools/calc2/simple/simplefactory.cpp2
-rw-r--r--noncore/tools/calc2/simple/simplefactory.h4
-rw-r--r--noncore/tools/calc2/simple/simpleimpl.cpp2
-rw-r--r--noncore/tools/calc2/simple/simpleimpl.h4
11 files changed, 34 insertions, 39 deletions
diff --git a/noncore/tools/calc2/binary/binary.pro b/noncore/tools/calc2/binary/binary.pro
index 1348d00..9cbb0ff 100644
--- a/noncore/tools/calc2/binary/binary.pro
+++ b/noncore/tools/calc2/binary/binary.pro
@@ -1,17 +1,15 @@
-#TEMPLATE = lib
-#CONFIG -= moc
-#CONFIG += qt
-## Input
-#INTERFACES += binary.ui
-#HEADERS = binaryimpl.h \
-# binaryfactory.h
-#SOURCES = binaryimpl.cpp \
-# binaryfactory.cpp
-#INCLUDEPATH += $(OPIEDIR)/include \
-# $(OPIEDIR)/calc2
-#DEPENDPATH += $(OPIEDIR)/include
-#DESTDIR = $(OPIEDIR)/plugins/calculator
-#TARGET = binary
-#
+TEMPLATE = lib
+CONFIG += qt
+INTERFACES += binary.ui
+HEADERS = binaryimpl.h \
+ binaryfactory.h
+SOURCES = binaryimpl.cpp \
+ binaryfactory.cpp
+INCLUDEPATH += $(OPIEDIR)/include \
+ $(OPIEDIR)/calc2
+DEPENDPATH += $(OPIEDIR)/include
+DESTDIR = $(OPIEDIR)/plugins/calculator
+TARGET = binary
+
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/tools/calc2/binary/binaryfactory.cpp b/noncore/tools/calc2/binary/binaryfactory.cpp
index 110334f..bccc9ca 100644
--- a/noncore/tools/calc2/binary/binaryfactory.cpp
+++ b/noncore/tools/calc2/binary/binaryfactory.cpp
@@ -1,51 +1,51 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "binaryfactory.h"
#include "binaryimpl.h"
-#include <engine.h>
+#include "../engine.h"
QWidget *BinaryInterface::getPlugin ( Engine *e, QWidget *parent ) {
if ( !input )
input = new FormBinaryImpl ( e, parent );
return input;
}
#ifndef QT_NO_COMPONENT
QRESULT BinaryInterface::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
{
*iface = 0;
if ( uuid == IID_QUnknown )
*iface = this;
else if ( uuid == IID_Calc )
*iface = this;
if ( *iface )
(*iface)->addRef();
return QS_OK;
}
Q_EXPORT_INTERFACE()
{
Q_CREATE_INSTANCE( BinaryInterface )
}
#endif
diff --git a/noncore/tools/calc2/binary/binaryfactory.h b/noncore/tools/calc2/binary/binaryfactory.h
index e015384..237a926 100644
--- a/noncore/tools/calc2/binary/binaryfactory.h
+++ b/noncore/tools/calc2/binary/binaryfactory.h
@@ -1,46 +1,46 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef BINARYIMPL_H
#define BINARYIMPL_H
#include "binaryimpl.h"
-#include <plugininterface.h>
-#include <engine.h>
+#include "../plugininterface.h"
+#include "../engine.h"
class BinaryInterface : public CalcInterface
{
public:
BinaryInterface(){input = 0;};
virtual ~BinaryInterface(){};
#ifndef QT_NO_COMPONENT
QRESULT queryInterface( const QUuid&, QUnknownInterface** );
Q_REFCOUNT
#endif
QWidget *getPlugin( Engine *, QWidget *parent );
private:
FormBinaryImpl *input;
ulong ref;
};
#endif
diff --git a/noncore/tools/calc2/binary/binaryimpl.cpp b/noncore/tools/calc2/binary/binaryimpl.cpp
index ffc56ad..ecbf232 100644
--- a/noncore/tools/calc2/binary/binaryimpl.cpp
+++ b/noncore/tools/calc2/binary/binaryimpl.cpp
@@ -1,70 +1,70 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "binaryimpl.h"
-#include <instruction.h>
+#include "../instruction.h"
class iXOR : public Instruction {
public:
iXOR():Instruction(){};
~iXOR(){};
Data eval(Data num) {
Data result;
result.i = num.i ^ acc.i;
return result;
};
};
class iAND : public Instruction {
public:
iAND():Instruction(){};
~iAND(){};
Data eval(Data num) {
Data result;
result.i = num.i & acc.i;
return result;
};
};
class iNOT : public Instruction {
public:
iNOT():Instruction(){};
~iNOT(){};
Data eval(Data num) {
Data result;
result.i = ~ num.i;
return result;
};
};
class iOR : public Instruction {
public:
iOR():Instruction(){};
~iOR(){};
Data eval(Data num) {
Data result;
result.i = num.i | acc.i;
return result;
};
};
class iLSH : public Instruction {
public:
iLSH():Instruction(){};
~iLSH(){};
Data eval(Data num) {
Data result;
result.i = num.i << 1;
diff --git a/noncore/tools/calc2/binary/binaryimpl.h b/noncore/tools/calc2/binary/binaryimpl.h
index bf9e3a7..7bf123a 100644
--- a/noncore/tools/calc2/binary/binaryimpl.h
+++ b/noncore/tools/calc2/binary/binaryimpl.h
@@ -1,50 +1,50 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef FORMBINARYINPUTIMPL
#define FORMBINARYINPUTIMPL
#include "binary.h"
-#include <engine.h>
+#include "../engine.h"
class FormBinaryImpl : public FormBinary {
Q_OBJECT
public:
FormBinaryImpl(Engine *e,QWidget *p) : FormBinary (p,"Binary") {
engine = e;
engine->setRepresentation(rBin);
};
~FormBinaryImpl(){};
private:
Engine *engine;
private slots:
void val0Clicked();
void val1Clicked();
void XORClicked();
void ANDClicked();
void NOTClicked();
void ORClicked();
void LSHClicked();
void RSHClicked();
};
#endif
diff --git a/noncore/tools/calc2/calc.cpp b/noncore/tools/calc2/calc.cpp
index c7656bf..8c50c2c 100644
--- a/noncore/tools/calc2/calc.cpp
+++ b/noncore/tools/calc2/calc.cpp
@@ -23,82 +23,81 @@
#include <qdir.h>
#include <qwidgetstack.h>
#include "calc.h"
#include "plugininterface.h"
calc::calc (QWidget * p, const char *n):QWidget (p, n)
{
setCaption (tr ("Calculator"));
// widgets
LCD = new QLCDNumber (this);
LCD->setMaximumSize (QSize (240, 30));
LCD->setNumDigits(12);
LCD->setSegmentStyle(QLCDNumber::Filled);
pluginWidgetStack = new QWidgetStack (this);
// layout widgets
calculatorLayout = new QVBoxLayout (this);
calculatorLayout->addWidget (LCD);
calculatorLayout->addWidget (pluginWidgetStack);
// no formatting of display for now
connect (&engine, SIGNAL(display(double)), LCD, SLOT(display(double)));
connect (&engine, SIGNAL(display(const QString&)), LCD, SLOT(display(const QString&)));
connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode()));
connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode()));
connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode()));
connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode()));
#ifndef NO_PLUGINS
// load plugins
QValueList < Plugin >::Iterator mit;
for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) {
(*mit).interface->release ();
(*mit).library->unload ();
delete (*mit).library;
}
pluginList.clear ();
QString path = QPEApplication::qpeDir() + "plugins/calculator";
QDir dir (path, "lib*.so");
QStringList list = dir.entryList ();
QStringList::Iterator it;
for (it = list.begin (); it != list.end (); ++it) {
CalcInterface *iface = 0;
QLibrary *lib = new QLibrary (path + "/" + *it);
-
Plugin plugin;
plugin.pluginWidget = 0;
if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) ==
QS_OK) {
plugin.library = lib;
plugin.interface = iface;
plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack);
if (plugin.pluginWidget)
pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count());
pluginList.append (plugin);
} else {
delete lib;
}
}
setMode (1);
#else
// load simple interface
#endif
}
calc::~calc ()
{
#ifndef NO_PLUGINS
QValueList < Plugin >::Iterator mit;
for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) {
(*mit).interface->release ();
(*mit).library->unload ();
delete (*mit).library;
}
#endif
}
diff --git a/noncore/tools/calc2/simple/simple.pro b/noncore/tools/calc2/simple/simple.pro
index 2312f99..dde5e7d 100644
--- a/noncore/tools/calc2/simple/simple.pro
+++ b/noncore/tools/calc2/simple/simple.pro
@@ -1,14 +1,12 @@
-#TEMPLATE = lib
-#CONFIG -= moc
-#CONFIG += qt
-## Input
-#INTERFACES += simple.ui
-#HEADERS = simpleimpl.h simplefactory.h stdinstructions.h
-#SOURCES = simpleimpl.cpp simplefactory.cpp
-#INCLUDEPATH += $(OPIEDIR)/include \
-# $(OPIEDIR)/calc2
-#DEPENDPATH += $(OPIEDIR)/include
-#DESTDIR = $(OPIEDIR)/plugins/calculator
-#
+TEMPLATE = lib
+CONFIG += qt
+INTERFACES += simple.ui
+HEADERS = simpleimpl.h simplefactory.h stdinstructions.h
+SOURCES = simpleimpl.cpp simplefactory.cpp
+INCLUDEPATH += $(OPIEDIR)/include \
+ $(OPIEDIR)/calc2
+DEPENDPATH += $(OPIEDIR)/include
+DESTDIR = $(OPIEDIR)/plugins/calculator
+
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/tools/calc2/simple/simplefactory.cpp b/noncore/tools/calc2/simple/simplefactory.cpp
index 515418f..52b090b 100644
--- a/noncore/tools/calc2/simple/simplefactory.cpp
+++ b/noncore/tools/calc2/simple/simplefactory.cpp
@@ -1,51 +1,51 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "simplefactory.h"
#include "simpleimpl.h"
-#include <engine.h>
+#include "../engine.h"
QWidget *SimpleInterface::getPlugin ( Engine *e, QWidget *parent ) {
if ( !input )
input = new FormSimpleImpl ( e, parent );
return input;
}
#ifndef QT_NO_COMPONENT
QRESULT SimpleInterface::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
{
*iface = 0;
if ( uuid == IID_QUnknown )
*iface = this;
else if ( uuid == IID_Calc )
*iface = this;
if ( *iface )
(*iface)->addRef();
return QS_OK;
}
Q_EXPORT_INTERFACE()
{
Q_CREATE_INSTANCE( SimpleInterface )
}
#endif
diff --git a/noncore/tools/calc2/simple/simplefactory.h b/noncore/tools/calc2/simple/simplefactory.h
index e1022fd..460c2b9 100644
--- a/noncore/tools/calc2/simple/simplefactory.h
+++ b/noncore/tools/calc2/simple/simplefactory.h
@@ -1,46 +1,46 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef BINARYIMPL_H
#define BINARYIMPL_H
#include "simpleimpl.h"
-#include <plugininterface.h>
-#include <engine.h>
+#include "../plugininterface.h"
+#include "../engine.h"
class SimpleInterface : public CalcInterface
{
public:
SimpleInterface(){input = 0;};
virtual ~SimpleInterface(){};
#ifndef QT_NO_COMPONENT
QRESULT queryInterface( const QUuid&, QUnknownInterface** );
Q_REFCOUNT
#endif
QWidget *getPlugin( Engine *, QWidget *parent );
private:
FormSimpleImpl *input;
ulong ref;
};
#endif
diff --git a/noncore/tools/calc2/simple/simpleimpl.cpp b/noncore/tools/calc2/simple/simpleimpl.cpp
index f71f000..447cbdf 100644
--- a/noncore/tools/calc2/simple/simpleimpl.cpp
+++ b/noncore/tools/calc2/simple/simpleimpl.cpp
@@ -1,73 +1,73 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qpushbutton.h>
#include <qlcdnumber.h>
#include "simpleimpl.h"
-#include <stdinstructions.h>
+#include "../stdinstructions.h"
void FormSimpleImpl::CEClicked() {
engine->hardReset();
}
void FormSimpleImpl::MCClicked() {
engine->memClear();
}
void FormSimpleImpl::MRClicked() {
engine->memRecall();
}
void FormSimpleImpl::MPlusClicked() {
engine->memSave();
}
void FormSimpleImpl::evalClicked() {
engine->eval();
}
void FormSimpleImpl::addClicked ()
{
engine->pushInstruction (new iAdd ());
}
void FormSimpleImpl::subClicked ()
{
engine->pushInstruction (new iSub ());
}
void FormSimpleImpl::mulClicked ()
{
engine->pushInstruction (new iMul ());
}
void FormSimpleImpl::divClicked ()
{
engine->pushInstruction (new iDiv ());
}
void FormSimpleImpl::decimalClicked ()
{
engine->pushValue ('.');
}
void FormSimpleImpl::val1Clicked ()
{
diff --git a/noncore/tools/calc2/simple/simpleimpl.h b/noncore/tools/calc2/simple/simpleimpl.h
index a2db154..b7b83e2 100644
--- a/noncore/tools/calc2/simple/simpleimpl.h
+++ b/noncore/tools/calc2/simple/simpleimpl.h
@@ -1,65 +1,65 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef STANDARDIMPL_H
#define STANDARDIMPL_H
#include <qpe/qmath.h>
#include <qlcdnumber.h>
#include "simple.h"
-#include "engine.h"
-#include "instruction.h"
+#include "../engine.h"
+#include "../instruction.h"
class FormSimpleImpl:public FormSimple {
Q_OBJECT
public:
FormSimpleImpl (Engine *e, QWidget * parent = 0, const char *name = 0)
:FormSimple (parent, name) {engine = e;engine->setRepresentation(rDouble);};
~FormSimpleImpl () { };
private:
Engine *engine;
private slots:
void MPlusClicked();
void MCClicked();
void MRClicked();
void CEClicked();
void evalClicked();
void addClicked ();
void decimalClicked ();
void divClicked ();
void mulClicked ();
void subClicked ();
void val0Clicked ();
void val1Clicked ();
void val2Clicked ();
void val3Clicked ();
void val4Clicked ();
void val5Clicked ();
void val6Clicked ();
void val7Clicked ();
void val8Clicked ();
void val9Clicked ();
};
#endif