summaryrefslogtreecommitdiffstats
path: root/examples/statemachine
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-05-12 14:16:35 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-05-12 14:16:35 (GMT)
commit4ece5c8923e559643f79833146d02a3976021f63 (patch)
tree89a9e34f9e75f14cb4521476c2738283fdbc0684 /examples/statemachine
parente863e3195e90db89c29603508e6857a5cc874ca4 (diff)
downloadQt-4ece5c8923e559643f79833146d02a3976021f63.zip
Qt-4ece5c8923e559643f79833146d02a3976021f63.tar.gz
Qt-4ece5c8923e559643f79833146d02a3976021f63.tar.bz2
kill some simplistic/overlapping/under-developed examples
Diffstat (limited to 'examples/statemachine')
-rw-r--r--examples/statemachine/clockticking/clockticking.pro10
-rw-r--r--examples/statemachine/clockticking/main.cpp123
-rw-r--r--examples/statemachine/composition/composition.pro7
-rw-r--r--examples/statemachine/composition/main.cpp104
-rw-r--r--examples/statemachine/helloworld/helloworld.pro10
-rw-r--r--examples/statemachine/helloworld/main.cpp78
-rw-r--r--examples/statemachine/pauseandresume/main.cpp102
-rw-r--r--examples/statemachine/pauseandresume/pauseandresume.pro7
-rw-r--r--examples/statemachine/statemachine.pro4
9 files changed, 0 insertions, 445 deletions
diff --git a/examples/statemachine/clockticking/clockticking.pro b/examples/statemachine/clockticking/clockticking.pro
deleted file mode 100644
index bff9cb8..0000000
--- a/examples/statemachine/clockticking/clockticking.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT = core
-TEMPLATE = app
-TARGET =
-win32: CONFIG += console
-mac:CONFIG -= app_bundle
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/statemachine/clockticking/main.cpp b/examples/statemachine/clockticking/main.cpp
deleted file mode 100644
index ea8e692..0000000
--- a/examples/statemachine/clockticking/main.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include <stdio.h>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qabstracttransition.h>
-#endif
-
-class ClockEvent : public QEvent
-{
-public:
- ClockEvent() : QEvent(QEvent::Type(QEvent::User+2))
- {}
-};
-
-class ClockState : public QState
-{
-public:
- ClockState(QState *parent)
- : QState(parent) {}
-
-protected:
- virtual void onEntry(QEvent *)
- {
- fprintf(stdout, "ClockState entered; posting the initial tick\n");
- machine()->postEvent(new ClockEvent());
- }
-};
-
-class ClockTransition : public QAbstractTransition
-{
-public:
- ClockTransition() {}
-
-protected:
- virtual bool eventTest(QEvent *e) const {
- return (e->type() == QEvent::User+2);
- }
- virtual void onTransition(QEvent *)
- {
- fprintf(stdout, "ClockTransition triggered; posting another tick with a delay of 1 second\n");
- machine()->postEvent(new ClockEvent(), 1000);
- }
-};
-
-class ClockListener : public QAbstractTransition
-{
-public:
- ClockListener() {}
-
-protected:
- virtual bool eventTest(QEvent *e) const {
- return (e->type() == QEvent::User+2);
- }
- virtual void onTransition(QEvent *)
- {
- fprintf(stdout, "ClockListener heard a tick!\n");
- }
-};
-
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
-
- QStateMachine machine;
- QState *group = new QState(QState::ParallelStates);
- group->setObjectName("group");
-
- ClockState *clock = new ClockState(group);
- clock->setObjectName("clock");
- clock->addTransition(new ClockTransition());
-
- QState *listener = new QState(group);
- listener->setObjectName("listener");
- listener->addTransition(new ClockListener());
-
- machine.addState(group);
- machine.setInitialState(group);
- machine.start();
-
- return app.exec();
-}
diff --git a/examples/statemachine/composition/composition.pro b/examples/statemachine/composition/composition.pro
deleted file mode 100644
index 6a976cb..0000000
--- a/examples/statemachine/composition/composition.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/statemachine/composition/main.cpp b/examples/statemachine/composition/main.cpp
deleted file mode 100644
index 0afff66..0000000
--- a/examples/statemachine/composition/main.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qfinalstate.h>
-#endif
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- QLabel label;
- label.setAlignment(Qt::AlignCenter);
-
- QStateMachine machine;
-
- QState *s1 = new QState();
- s1->setObjectName("s1");
- s1->assignProperty(&label, "text", "In S1, hang on...");
- s1->assignProperty(&label, "geometry", QRect(100, 100, 200, 100));
-
- QState *s1_timer = new QState(s1);
- s1_timer->setObjectName("s1_timer");
- QTimer t1;
- t1.setInterval(2000);
- QObject::connect(s1_timer, SIGNAL(entered()), &t1, SLOT(start()));
- QFinalState *s1_done = new QFinalState(s1);
- s1_done->setObjectName("s1_done");
- s1_timer->addTransition(&t1, SIGNAL(timeout()), s1_done);
- s1->setInitialState(s1_timer);
-
- QState *s2 = new QState();
- s2->setObjectName("s2");
- s2->assignProperty(&label, "text", "In S2, I'm gonna quit on you...");
- s2->assignProperty(&label, "geometry", QRect(300, 300, 300, 100));
-// s2->invokeMethodOnEntry(&label, "setNum", QList<QVariant>() << 123);
-// s2->invokeMethodOnEntry(&label, "showMaximized");
-
- QState *s2_timer = new QState(s2);
- s2_timer->setObjectName("s2_timer");
- QTimer t2;
- t2.setInterval(2000);
- QObject::connect(s2_timer, SIGNAL(entered()), &t2, SLOT(start()));
- QFinalState *s2_done = new QFinalState(s2);
- s2_done->setObjectName("s2_done");
- s2_timer->addTransition(&t2, SIGNAL(timeout()), s2_done);
- s2->setInitialState(s2_timer);
-
- s1->addTransition(s1, SIGNAL(finished()), s2);
-
- QFinalState *s3 = new QFinalState();
- s3->setObjectName("s3");
- s2->addTransition(s2, SIGNAL(finished()), s3);
-
- machine.addState(s1);
- machine.addState(s2);
- machine.addState(s3);
- machine.setInitialState(s1);
- QObject::connect(&machine, SIGNAL(finished()), &app, SLOT(quit()));
- machine.start();
-
- label.show();
- return app.exec();
-}
diff --git a/examples/statemachine/helloworld/helloworld.pro b/examples/statemachine/helloworld/helloworld.pro
deleted file mode 100644
index ac79117..0000000
--- a/examples/statemachine/helloworld/helloworld.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = app
-TARGET =
-QT = core
-win32: CONFIG += console
-mac:CONFIG -= app_bundle
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/statemachine/helloworld/main.cpp b/examples/statemachine/helloworld/main.cpp
deleted file mode 100644
index fbe34b5..0000000
--- a/examples/statemachine/helloworld/main.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qfinalstate.h>
-#endif
-
-class S0 : public QState
-{
-public:
- S0(QState *parent = 0)
- : QState(parent) {}
-
- virtual void onEntry(QEvent *)
- {
- fprintf(stdout, "Hello world!\n");
- }
-};
-
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
-
- QStateMachine machine;
- QState *s0 = new S0();
- QFinalState *s1 = new QFinalState();
- s0->addTransition(s1);
-
- machine.addState(s0);
- machine.addState(s1);
- machine.setInitialState(s0);
-
- QObject::connect(&machine, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
- machine.start();
-
- return app.exec();
-}
diff --git a/examples/statemachine/pauseandresume/main.cpp b/examples/statemachine/pauseandresume/main.cpp
deleted file mode 100644
index 5bacb41..0000000
--- a/examples/statemachine/pauseandresume/main.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qfinalstate.h>
-#include <qhistorystate.h>
-#endif
-
-class Window : public QWidget
-{
-public:
- Window(QWidget *parent = 0)
- : QWidget(parent)
- {
- QPushButton *pb = new QPushButton("Go");
- QPushButton *pauseButton = new QPushButton("Pause");
- QPushButton *quitButton = new QPushButton("Quit");
- QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->addWidget(pb);
- vbox->addWidget(pauseButton);
- vbox->addWidget(quitButton);
-
- QStateMachine *machine = new QStateMachine(this);
-
- QState *process = new QState(machine->rootState());
- process->setObjectName("process");
-
- QState *s1 = new QState(process);
- s1->setObjectName("s1");
- QState *s2 = new QState(process);
- s2->setObjectName("s2");
- s1->addTransition(pb, SIGNAL(clicked()), s2);
- s2->addTransition(pb, SIGNAL(clicked()), s1);
-
- QHistoryState *h = new QHistoryState(process);
- h->setDefaultState(s1);
-
- QState *interrupted = new QState(machine->rootState());
- interrupted->setObjectName("interrupted");
- QFinalState *terminated = new QFinalState(machine->rootState());
- terminated->setObjectName("terminated");
- interrupted->addTransition(pauseButton, SIGNAL(clicked()), h);
- interrupted->addTransition(quitButton, SIGNAL(clicked()), terminated);
-
- process->addTransition(pauseButton, SIGNAL(clicked()), interrupted);
- process->addTransition(quitButton, SIGNAL(clicked()), terminated);
-
- process->setInitialState(s1);
- machine->setInitialState(process);
- QObject::connect(machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
- machine->start();
- }
-};
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- Window win;
- win.show();
- return app.exec();
-}
diff --git a/examples/statemachine/pauseandresume/pauseandresume.pro b/examples/statemachine/pauseandresume/pauseandresume.pro
deleted file mode 100644
index 6a976cb..0000000
--- a/examples/statemachine/pauseandresume/pauseandresume.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/statemachine/statemachine.pro b/examples/statemachine/statemachine.pro
index ba32c12..ea3e7a8 100644
--- a/examples/statemachine/statemachine.pro
+++ b/examples/statemachine/statemachine.pro
@@ -1,11 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = \
- clockticking \
- composition \
eventtransitions \
factorial \
- helloworld \
- pauseandresume \
pingpong \
trafficlight \
twowaybutton