diff options
author | David Boddie <dboddie@trolltech.com> | 2009-04-29 16:21:22 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-04-29 16:21:22 (GMT) |
commit | b467246eb63ec649ad2348ac9b6886ee20dfc033 (patch) | |
tree | fec30c5af0fbabedffaa9abbf576dfa349e2cb22 /examples/statemachine | |
parent | c07b3bd9c3c2d7195dfa52547961647a963c8d41 (diff) | |
parent | bfc92cacbeeb2d1a5ca39e31ccdb94f9674bd547 (diff) | |
download | Qt-b467246eb63ec649ad2348ac9b6886ee20dfc033.zip Qt-b467246eb63ec649ad2348ac9b6886ee20dfc033.tar.gz Qt-b467246eb63ec649ad2348ac9b6886ee20dfc033.tar.bz2 |
Merge branch 'kinetic-animations' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-animations
Diffstat (limited to 'examples/statemachine')
-rw-r--r-- | examples/statemachine/errorstate/mainwindow.cpp | 16 | ||||
-rw-r--r-- | examples/statemachine/errorstate/mainwindow.h | 1 |
2 files changed, 7 insertions, 10 deletions
diff --git a/examples/statemachine/errorstate/mainwindow.cpp b/examples/statemachine/errorstate/mainwindow.cpp index f5edf60..e04ca94 100644 --- a/examples/statemachine/errorstate/mainwindow.cpp +++ b/examples/statemachine/errorstate/mainwindow.cpp @@ -110,44 +110,41 @@ void MainWindow::init() QAction *quitAction = menuBar()->addAction("&Quit"); connect(addTankAction, SIGNAL(triggered()), this, SLOT(addTank())); - connect(stopGameAction, SIGNAL(triggered()), this, SIGNAL(gameOver())); connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); m_machine = new QStateMachine(this); m_machine->setGlobalRestorePolicy(QStateMachine::RestoreProperties); - QState *stoppedState = new QState(m_machine->rootState()); + QState *stoppedState = new QState(m_machine->rootState()); stoppedState->setObjectName("stoppedState"); - stoppedState->assignProperty(runGameAction, "enabled", true); stoppedState->assignProperty(stopGameAction, "enabled", false); stoppedState->assignProperty(this, "started", false); m_machine->setInitialState(stoppedState); QState *spawnsAvailable = new QState(stoppedState); - spawnsAvailable->assignProperty(addTankAction, "enabled", true); spawnsAvailable->setObjectName("spawnsAvailable"); + spawnsAvailable->assignProperty(addTankAction, "enabled", true); QState *noSpawnsAvailable = new QState(stoppedState); + noSpawnsAvailable->setObjectName("noSpawnsAvailable"); noSpawnsAvailable->assignProperty(addTankAction, "enabled", false); spawnsAvailable->addTransition(this, SIGNAL(mapFull()), noSpawnsAvailable); QHistoryState *hs = new QHistoryState(stoppedState); - hs->setObjectName("hs"); hs->setDefaultState(spawnsAvailable); stoppedState->setInitialState(hs); - m_runningState = new QState(QState::ParallelGroup, m_machine->rootState()); + m_runningState = new QState(QState::ParallelStates, m_machine->rootState()); + m_runningState->setObjectName("runningState"); m_runningState->assignProperty(addTankAction, "enabled", false); m_runningState->assignProperty(runGameAction, "enabled", false); m_runningState->assignProperty(stopGameAction, "enabled", true); stoppedState->addTransition(runGameAction, SIGNAL(triggered()), m_runningState); - m_runningState->addTransition(this, SIGNAL(gameOver()), stoppedState); - - m_machine->start(); + m_runningState->addTransition(stopGameAction, SIGNAL(triggered()), stoppedState); QTimer *timer = new QTimer(this); timer->setInterval(100); @@ -155,6 +152,7 @@ void MainWindow::init() connect(m_runningState, SIGNAL(entered()), timer, SLOT(start())); connect(m_runningState, SIGNAL(exited()), timer, SLOT(stop())); + m_machine->start(); m_time.start(); } diff --git a/examples/statemachine/errorstate/mainwindow.h b/examples/statemachine/errorstate/mainwindow.h index 33122eb..622dabe 100644 --- a/examples/statemachine/errorstate/mainwindow.h +++ b/examples/statemachine/errorstate/mainwindow.h @@ -25,7 +25,6 @@ public slots: void runStep(); signals: - void gameOver(); void mapFull(); private: |