summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstatemachine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make QStateMachine event posting functions thread-safeKent Hansen2009-10-291-17/+72
| | | | | | | | By popular demand on the Qt Labs blog. This makes it possible to readily use QStateMachine with e.g. worker threads that post events to the machine. Reviewed-by: Eskil Abrahamsen Blomfeldt
* QStateMachine::event() should call QState::event()Kent Hansen2009-10-291-1/+1
| | | | | | Since QStateMachine inherits QState now. Reviewed-by: Eskil Abrahamsen Blomfeldt
* Add prefix to statemachine-specific event typesKent Hansen2009-10-021-2/+2
| | | | | | "Signal" and "Wrapped" is too generic; prefix with StateMachine. Reviewed-by: Eskil Abrahamsen Blomfeldt
* Make sure delayed events are cancelled when a state machine haltsKent Hansen2009-09-291-0/+20
| | | | | | | Otherwise the events might creep into the event loop if the state machine is restarted. Reviewed-by: Eskil Abrahamsen Blomfeldt
* Introduce state machine event priority, make it possible to cancel eventsKent Hansen2009-09-291-17/+81
| | | | | | | | | | | | The priority specifies whether the event should be posted to what the SCXML spec refers to as the "external" (NormalPriority) queue, or the "internal" (HighPriority) queue. Delayed events are now posted through a separate function, postDelayedEvent(). That function returns an id that can be passed to cancelDelayedEvent() to cancel it. Reviewed-by: Eskil Abrahamsen Blomfeldt
* Do synchronous processing of events in state machine if possibleKent Hansen2009-09-291-12/+34
| | | | | | | | Avoid delayed scheduling in the cases where there's no need to delay it (e.g. when the state machine intercepts a signal or event). Task-number: QTBUG-4491 Reviewed-by: Eskil Abrahamsen Blomfeldt
* Make QSignalEvent and QWrappedEvent inner classes of QStateMachineKent Hansen2009-09-281-25/+24
| | | | | | | | | Those two classes are specific to the state machine framework, but their names were so generic that we felt they were polluting the Q-namespace. They are now QStateMachine::SignalEvent and QStateMachine::WrappedEvent. Reviewed-by: Eskil Abrahamsen Blomfeldt
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* Doc: Added a note that a state machine requires a running event loop.David Boddie2009-09-071-31/+11
| | | | Reviewed-by: Trust Me
* Update tech preview license header for files that are new in 4.6.Jason McDonald2009-08-311-13/+13
| | | | Reviewed-by: Trust Me
* Q_ASSERT failure in QStateMachinePrivate::handleTransitionSignal.Gabriel de Dietrich2009-08-281-0/+7
| | | | | | | | | | | | | | The signal index actually emitted was different from the signal index registered. This was due to recent changes in the meta-object protocol, where new indexes are being created (cloned) for signals with default parameters. When registering the transition signal, we now look for the original (non cloned) signal index. The transition keeps track of the user-specified signal index, and sets it when calling onTransition. Reviewed-by: Kent Hansen Reviewed-by: Olivier Goffart Task-number: 260403
* Merge commit 'qt/master'Jason Barron2009-08-131-1/+2
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/samplebuffers/glwidget.cpp src/corelib/io/qfsfileengine_unix.cpp src/corelib/kernel/qobject.cpp src/corelib/tools/qsharedpointer.cpp src/gui/gui.pro tests/auto/qhttp/tst_qhttp.cpp tests/auto/qkeyevent/tst_qkeyevent.cpp
| * Update contact URL in license headers.Jason McDonald2009-08-121-1/+1
| | | | | | | | Reviewed-by: Trust Me
| * fix issues reported by CoverityKent Hansen2009-08-101-0/+1
| |
* | Merge commit 'qt/master-stable'Jason Barron2009-08-041-9/+95
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/openssl/openssl.pri demos/embedded/embedded.pro examples/itemviews/chart/chart.pro examples/network/network.pro examples/painting/painterpaths/painterpaths.pro examples/threads/mandelbrot/mandelbrot.pro qmake/project.cpp src/3rdparty/libtiff/libtiff/tif_config.h src/corelib/arch/arch.pri src/corelib/global/qglobal.cpp src/corelib/kernel/kernel.pri src/corelib/kernel/qcore_unix_p.h src/corelib/kernel/qobject.cpp src/corelib/thread/qthread_unix.cpp src/corelib/tools/qsharedpointer_impl.h src/corelib/tools/tools.pri src/gui/kernel/qaction.h src/gui/kernel/qapplication.cpp src/gui/painting/qregion.h src/gui/widgets/qlineedit.cpp src/gui/widgets/qlineedit_p.h src/network/socket/qnativesocketengine_unix.cpp tests/auto/qdir/tst_qdir.cpp tests/auto/qdiriterator/tst_qdiriterator.cpp tests/auto/qhttp/qhttp.pro tests/auto/qline/qline.pro tests/auto/qnetworkreply/tst_qnetworkreply.cpp tests/auto/qresourceengine/qresourceengine.pro tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qstring/qstring.pro tests/auto/qtcpsocket/qtcpsocket.pro tests/auto/qtcpsocket/tst_qtcpsocket.cpp
| * remove constructors that are not usefulKent Hansen2009-08-031-2/+4
| | | | | | | | | | | | | | The constructors that take a list of target states produce hard-to-read code, and they're rarely useful in practice since 99% of transitions take a single target state; so it's better to enforce that setTarget{State,States}() be used instead.
| * add private goToState() function to state machineKent Hansen2009-07-311-6/+90
| | | | | | | | Needed for Declarative UI integration.
| * remove const from QSignalEvent::sender*Kent Hansen2009-07-311-2/+2
| | | | | | | | | | QObject::sender() does not return const QObject*, so neither should this API; it just forces you to const_cast for no good reason.
* | Merge commit 'qt/master-stable'Jason Barron2009-07-271-169/+103
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.exe qmake/Makefile.unix qmake/generators/makefile.cpp src/corelib/global/qglobal.h src/corelib/kernel/kernel.pri src/corelib/kernel/qcoreevent.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/kernel/qaction.cpp src/gui/kernel/qaction.h src/gui/kernel/qaction_p.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget.h src/gui/kernel/qwidget_mac.mm src/gui/painting/qgraphicssystemfactory.cpp src/gui/styles/qwindowsstyle.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qabstractscrollarea_p.h src/network/access/qnetworkaccessdebugpipebackend.cpp src/network/socket/qlocalsocket_unix.cpp src/network/socket/qnativesocketengine_p.h src/network/socket/qnativesocketengine_unix.cpp src/openvg/qpaintengine_vg.cpp tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp tests/auto/qcssparser/qcssparser.pro tests/auto/qdir/tst_qdir.cpp tests/auto/qfile/tst_qfile.cpp tests/auto/qobject/tst_qobject.cpp tests/auto/qpathclipper/qpathclipper.pro tests/auto/qprocess/tst_qprocess.cpp tests/auto/qsettings/tst_qsettings.cpp tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qsqlquerymodel/qsqlquerymodel.pro tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro tests/auto/qsqltablemodel/qsqltablemodel.pro tests/auto/qsqlthread/qsqlthread.pro tests/auto/qwidget/tst_qwidget.cpp
| * make statemachine compile with QT_NO_PROPERTIESKent Hansen2009-07-231-0/+14
| |
| * Make QStateMachine inherit QStateKent Hansen2009-07-221-169/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the need for a "root state" in the machine; or rather, the machine _is_ the root state. User code can now pass in a QStateMachine directly to the QState constructor, instead of machine->rootState(). This also means we could get rid of the "proxying" from the machine to the root state for things like properties (initialState et al), finished() signal and auto-reparenting of states (the ChildAdded event hack). A fun little side-effect of this change is that it's now possible to embed state machines within state machines. We can't think of a good use case yet where you would rather embed a stand-alone state machine (with its own event processing etc.) rather than having just a regular nested state, but it's neat and it works. Reviewed-by: Eskil Abrahamsen Blomfeldt
| * Fix memory leak with wrapped eventsKent Hansen2009-07-211-0/+3
| | | | | | | | Reviewed-by: Eskil Abrahamsen Blomfeldt
* | Merge commit 'qt/master-stable' into 4.6-mergedJason Barron2009-06-301-70/+43
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .gitignore configure.exe src/corelib/concurrent/qtconcurrentthreadengine.h src/corelib/global/qnamespace.h src/gui/graphicsview/qgraphicssceneevent.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qapplication_p.h src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qwidget.h src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontdatabase.cpp src/network/access/qnetworkaccesshttpbackend.cpp tests/auto/network-settings.h tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro tests/auto/qvariant/tst_qvariant.cpp
| * Remove default error stateEskil Abrahamsen Blomfeldt2009-06-231-62/+30
| | | | | | | | | | | | | | | | | | Having an implicit default error state in the graph which the user has not added is unintuitive and ugly. Rather than have a default error state, we stop execution of the machine and print an error message when the machine has run-time errors. If a user wishes to prevent errors from stopping the machine, you can set one or more error states explicitly.
| * perform normalization of signatures for signal transitionsKent Hansen2009-06-221-4/+8
| | | | | | | | Make state->addTransition(foo, SIGNAL( bar( ) ), ...) work.
| * perform all property assignments of initial state that's nestedKent Hansen2009-06-171-2/+2
| | | | | | | | | | | | If the machine's initial state is nested, a set of states will be entered, and we need to do the property assignments of all of them.
| * bring back QAbstractTransition::triggered() signalKent Hansen2009-06-171-0/+1
| | | | | | | | | | | | It's been requested by several users. Since we have QAbstractState::{entered,exited}() signals, we should have this one as well.
| * Update license headers in files that are new in 4.6.Jason McDonald2009-06-171-2/+2
| | | | | | | | Reviewed-by: Trust Me
* | Manually fix bad merges and make sure everything compiles with 4.6.Harald Fernengel2009-06-291-1/+1
|/
* add QT_NO_STATEMACHINE define so state machine can be compiled outKent Hansen2009-06-041-0/+5
| | | | Reviewed-by: Thierry Bastian
* fix signal signature bug in debug outputKent Hansen2009-06-031-2/+2
| | | | | The signal code (first character of const char *signal) is stripped internally, so the debug output code should not skip any characters.
* fix qdoc warningKent Hansen2009-06-031-1/+1
| | | | No need to link to the class in its own doc page.
* QStateMachine: better way to get the sender signalIndexOlivier Goffart2009-05-281-18/+7
| | | | | | | | | | | | The QObject internals have changed, and the mutex that need to be locked to access the senders list is not the same anymore, and not accessible form qstatemachine.cpp But we do not need to loop over the senders list anyway because this is done in sender() We also do not need to lock in order to access the currentSender Reviewed-by: Eskil
* Use Qt::UniqueConnection instead of disconnect/connectOlivier Goffart2009-05-281-2/+1
| | | | | | | Also fix an issue in QTreeView where a signal could be connected several times Reviewed-by: Thierry
* Added QT_NO_ANIMATION to qfeaturesThierry Bastian2009-05-251-4/+9
| | | | | Now you can opt it out to save disk space (for embedded). Also tested it and fixed code in state machine.
* Fixed 'crazy' warnings about using a string instead of a characterThierry Bastian2009-05-251-12/+12
| | | | | | | Wherever I found that we were using a string instead of a single char I fixed the code. Reviewed-by: olivier
* Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into ↵Thierry Bastian2009-05-221-1/+1
| | | | | | | | | | | | | kinetic-animations Conflicts: src/corelib/kernel/kernel.pri src/corelib/kernel/qvariant_p.h src/corelib/tools/tools.pri src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsitem.h src/gui/graphicsview/qgraphicswidget.h src/gui/gui.pro
* Make QAbstractTransition::eventTest() non-constEskil Abrahamsen Blomfeldt2009-05-141-1/+1
| | | | | We decided to remove the const of the eventTest() since some transitions have dynamic conditions and need to update when eventTest() is called.
* correctly handle multiple event transitions for same (object,event)Kent Hansen2009-05-131-6/+13
| | | | | | The event filter was not removed at the right time. We now store the number of active event transitions for a particular (object,event) and only remove the filtering when the count drops to zero.
* Merge branch 'kinetic-animations' into kinetic-statemachineKent Hansen2009-05-131-55/+85
|\
| * Merge branch 'kinetic-animations' of git@scm.dev.nokia.troll.no:qt/kinetic ↵Geir Vattekar2009-05-131-14/+19
| |\ | | | | | | | | | into kinetic-animations
| * | Doc: Work on QStateMachine class descriptionGeir Vattekar2009-05-131-55/+85
| | | | | | | | | | | | Reviewed-by: Kent Hansen
* | | kill the QT_STATEMACHINE_SOLUTION defineKent Hansen2009-05-131-69/+7
| |/ |/| | | | | We won't release another Qt Solution, so the define is no longer needed.
* | correctly handle multiple signal transitions for same (object,signal)Kent Hansen2009-05-121-14/+19
|/ | | | | | The signal was not disconnected at the right time. We now store the number of active signal transitions for a particular (object,signal) and only disconnect when the count drops to zero.
* make sure connections and event filters are removed when state machine haltsKent Hansen2009-05-081-0/+16
|
* Make it impossible to have root state as source or target of transition or ↵Eskil Abrahamsen Blomfeldt2009-05-071-0/+2
| | | | | | | | | | | as error state Since the root state has no ancestors, it cannot be source or target in transitions since there will be no LCA for the transition, which is required for the algorithm of enterStates and exitStates. In SCXML the root state cannot be target or source of a transition. By the same logic, it cannot be an error state. The root state will always have a valid machine, since it's added to a machine immediately, which makes this code possible.
* add QStateMachine::isRunning()Kent Hansen2009-05-071-0/+11
|
* store top-level animation in dedicated variableKent Hansen2009-05-071-3/+4
| | | | The animation itself is used by subsequent code, so we mustn't change it.
* doc: Add documentation for NoCommonAncestorForTransitionError enumEskil Abrahamsen Blomfeldt2009-05-071-0/+5
|
* Rename NoDefaultStateInHistoryState -> NoDefaultStateInHistoryStateError for ↵Eskil Abrahamsen Blomfeldt2009-05-071-4/+4
| | | | | | consistency The other error values have Error in the name for namespacing purposes.