From 15318cad33835e4e2dc620d033e43cd930676cdd Mon Sep 17 00:00:00 2001 From: kergoth Date: Fri, 25 Jan 2002 22:14:26 +0000 Subject: Initial revision --- (limited to 'noncore/tools/calc2/simple') diff --git a/noncore/tools/calc2/simple/README b/noncore/tools/calc2/simple/README new file mode 100644 index 0000000..37acb64 --- a/dev/null +++ b/noncore/tools/calc2/simple/README @@ -0,0 +1 @@ +A simple interface with no operator precedence. diff --git a/noncore/tools/calc2/simple/simple.pro b/noncore/tools/calc2/simple/simple.pro new file mode 100644 index 0000000..92378a6 --- a/dev/null +++ b/noncore/tools/calc2/simple/simple.pro @@ -0,0 +1,14 @@ +TEMPLATE = lib +CONFIG -= moc +CONFIG += qt release + +# Input +INTERFACES += simple.ui +HEADERS = simpleimpl.h simplefactory.h stdinstructions.h +SOURCES = simpleimpl.cpp simplefactory.cpp + +INCLUDEPATH += $(QPEDIR)/include \ + $(QPEDIR)/calc2 +DEPENDPATH += $(QPEDIR)/include + +DESTDIR = $(QPEDIR)/plugins/calculator diff --git a/noncore/tools/calc2/simple/simple.ui b/noncore/tools/calc2/simple/simple.ui new file mode 100644 index 0000000..af12905 --- a/dev/null +++ b/noncore/tools/calc2/simple/simple.ui @@ -0,0 +1,704 @@ + +FormSimple + + QWidget + + name + FormSimple + + + geometry + + 73 + 0 + 240 + 320 + + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 240 + 320 + + + + baseSize + + 240 + 240 + + + + caption + Simple + + + + margin + 0 + + + spacing + 0 + + + QPushButton + + name + PBEval + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 160 + 80 + + + + text + = + + + + QPushButton + + name + PB5 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 5 + + + + QPushButton + + name + PBDecimal + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + . + + + + QPushButton + + name + PB3 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 3 + + + + QPushButton + + name + PB2 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 2 + + + + QPushButton + + name + PB4 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 4 + + + + QPushButton + + name + PB6 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 6 + + + + QPushButton + + name + PBMul + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + * + + + + QPushButton + + name + PBSub + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + - + + + + QPushButton + + name + PBAdd + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + + + + + + QPushButton + + name + PB9 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 9 + + + + QPushButton + + name + PB7 + + + enabled + true + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 7 + + + + QPushButton + + name + PB1 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 1 + + + + QPushButton + + name + PB0 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 160 + 80 + + + + text + 0 + + + + QPushButton + + name + PBDiv + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + / + + + autoRepeat + true + + + + QPushButton + + name + PB8 + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + 8 + + + + QPushButton + + name + PBMPlus + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + M+ + + + + QPushButton + + name + PBCE + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + CE + + + + QPushButton + + name + PBMC + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + MC + + + + QPushButton + + name + PBMR + + + sizePolicy + + 4 + 4 + + + + maximumSize + + 80 + 80 + + + + text + MR + + + + + + + PB0 + clicked() + FormSimple + val0Clicked() + + + PB1 + clicked() + FormSimple + val1Clicked() + + + PB2 + clicked() + FormSimple + val2Clicked() + + + PB3 + clicked() + FormSimple + val3Clicked() + + + PB4 + clicked() + FormSimple + val4Clicked() + + + PB5 + clicked() + FormSimple + val5Clicked() + + + PB6 + clicked() + FormSimple + val6Clicked() + + + PB7 + clicked() + FormSimple + val7Clicked() + + + PB8 + clicked() + FormSimple + val8Clicked() + + + PB9 + clicked() + FormSimple + val9Clicked() + + + PBSub + clicked() + FormSimple + subClicked() + + + PBMul + clicked() + FormSimple + mulClicked() + + + PBDiv + clicked() + FormSimple + divClicked() + + + PBDecimal + clicked() + FormSimple + decimalClicked() + + + PBEval + clicked() + FormSimple + evalClicked() + + + PBMC + clicked() + FormSimple + MCClicked() + + + PBMPlus + clicked() + FormSimple + MPlusClicked() + + + PBMR + clicked() + FormSimple + MRClicked() + + + PBAdd + clicked() + FormSimple + addClicked() + + + PBCE + clicked() + FormSimple + CEClicked() + + CEClicked() + MCClicked() + MPlusClicked() + MRClicked() + addClicked() + decimalClicked() + divClicked() + evalClicked() + mulClicked() + subClicked() + val0Clicked() + val1Clicked() + val2Clicked() + val3Clicked() + val4Clicked() + val5Clicked() + val6Clicked() + val7Clicked() + val8Clicked() + val9Clicked() + + diff --git a/noncore/tools/calc2/simple/simplefactory.cpp b/noncore/tools/calc2/simple/simplefactory.cpp new file mode 100644 index 0000000..515418f --- a/dev/null +++ b/noncore/tools/calc2/simple/simplefactory.cpp @@ -0,0 +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 + +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 new file mode 100644 index 0000000..e1022fd --- a/dev/null +++ b/noncore/tools/calc2/simple/simplefactory.h @@ -0,0 +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 +#include + +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 new file mode 100644 index 0000000..f71f000 --- a/dev/null +++ b/noncore/tools/calc2/simple/simpleimpl.cpp @@ -0,0 +1,120 @@ +/********************************************************************** +** 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 +#include + +#include "simpleimpl.h" +#include + +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 () +{ + engine->pushValue ('1'); +} + +void FormSimpleImpl::val2Clicked () +{ + engine->pushValue ('2'); +} + +void FormSimpleImpl::val3Clicked () +{ + engine->pushValue ('3'); +} + +void FormSimpleImpl::val4Clicked () +{ + engine->pushValue ('4'); +} + +void FormSimpleImpl::val5Clicked () +{ + engine->pushValue ('5'); +} + +void FormSimpleImpl::val6Clicked () +{ + engine->pushValue ('6'); +} + +void FormSimpleImpl::val7Clicked () +{ + engine->pushValue ('7'); +} + +void FormSimpleImpl::val8Clicked () +{ + engine->pushValue ('8'); +} + +void FormSimpleImpl::val9Clicked () +{ + engine->pushValue ('9'); +} + +void FormSimpleImpl::val0Clicked () +{ + engine->pushValue ('0'); +} diff --git a/noncore/tools/calc2/simple/simpleimpl.h b/noncore/tools/calc2/simple/simpleimpl.h new file mode 100644 index 0000000..a2db154 --- a/dev/null +++ b/noncore/tools/calc2/simple/simpleimpl.h @@ -0,0 +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 +#include + +#include "simple.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 -- cgit v0.9.0.2