summaryrefslogtreecommitdiff
path: root/dev-python/qtstatemachine/files
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/qtstatemachine/files')
-rw-r--r--dev-python/qtstatemachine/files/qstatemachines_add_CMake_support.patch_003154
-rw-r--r--dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_00282
-rw-r--r--dev-python/qtstatemachine/files/qstatemachines_fix_history.patch_001155
3 files changed, 391 insertions, 0 deletions
diff --git a/dev-python/qtstatemachine/files/qstatemachines_add_CMake_support.patch_003 b/dev-python/qtstatemachine/files/qstatemachines_add_CMake_support.patch_003
new file mode 100644
index 00000000..d21e0126
--- /dev/null
+++ b/dev-python/qtstatemachine/files/qstatemachines_add_CMake_support.patch_003
@@ -0,0 +1,154 @@
+--- /dev/null 2009-07-25 12:29:44.706468311 +0200
++++ CMakeLists.txt 2009-07-27 17:39:53.000000000 +0200
+@@ -0,0 +1,151 @@
++cmake_minimum_required(VERSION 2.6)
++project(QtStateMachines)
++
++# Setup Cmake
++set(CMAKE_MODULE_PATH
++ ${PyQtStateMachines_SOURCE_DIR}/cmake/Modules
++ )
++
++# Setup Qt4
++find_package(Qt4 REQUIRED)
++set(QT_USE_QTDBUS 1)
++set(QT_USE_QTGUI 1)
++set(QT_USE_QTSHARED 1)
++set(QT_USE_QTSCRIPT 1)
++include(${QT_USE_FILE})
++
++add_definitions(-DQT_STATEMACHINE_SOLUTION -DQT_NO_ANIMATION -DQT_SCRIPT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED)
++
++include_directories(
++ ${CMAKE_CURRENT_SOURCE_DIR}
++ ${CMAKE_SOURCE_DIR}/src
++ ${QT_INCLUDE_DIR}
++ ${QT_QT_INCLUDE_DIR}
++ ${QT_QTCORE_INCLUDE_DIR}
++ ${CMAKE_CURRENT_BINARY_DIR}/src
++ ${CMAKE_CURRENT_BINARY_DIR}
++ )
++
++link_directories(${CMAKE_CURRENT_SOURCE_DIR})
++
++set(QtStateMachines_SOURCES
++ src/qabstractstate.cpp
++ src/qabstracttransition.cpp
++ src/qactionstate.cpp
++ src/qeventtransition.cpp
++ src/qfinalstate.cpp
++ src/qguistatemachine.cpp
++ src/qhistorystate.cpp
++ src/qscriptedstatemachine.cpp
++ src/qsignaltransition.cpp
++ src/qssmguiinvokers.cpp
++ src/qstateaction.cpp
++ src/qstate.cpp
++ src/qstatefinishedtransition.cpp
++ src/qstatemachine.cpp
++ src/qtransition.cpp
++)
++
++
++set(QtStateMachines_HEADERS
++ src/qabstractstate.h
++ src/qabstracttransition.h
++ src/qactionstate.h
++ src/qeventtransition.h
++ src/qfinalstate.h
++ src/qhistorystate.h
++ src/qscriptedstatemachine.h
++ src/qsignalevent.h
++ src/qsignaltransition.h
++ src/qstateaction.h
++ src/qstatefinishedevent.h
++ src/qstatefinishedtransition.h
++ src/qstate.h
++ src/qstatemachine.h
++ src/qtransition.h
++ src/qtstatemachineglobal.h
++)
++
++MACRO(QT4_AUTOMOC_MY)
++ QT4_GET_MOC_FLAGS(_moc_INCS)
++
++ SET(_matching_FILES )
++ FOREACH (_current_FILE ${ARGN})
++
++ GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
++ # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
++ # This is required to make uic work correctly:
++ # we need to add generated .cpp files to the sources (to compile them),
++ # but we cannot let automoc handle them, as the .cpp files don't exist yet when
++ # cmake is run for the very first time on them -> however the .cpp files might
++ # exist at a later run. at that time we need to skip them, so that we don't add two
++ # different rules for the same moc file
++ GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
++
++ IF ( NOT _skip AND EXISTS ${_abs_FILE} )
++
++ FILE(READ ${_abs_FILE} _contents)
++
++ GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
++
++ STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]"
++ _match
++ "${_contents}")
++ IF(_match)
++ FOREACH (_current_MOC_INC ${_match})
++ STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
++ GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
++ IF(EXISTS ${_abs_PATH}/${_basename}.hpp)
++ SET(_header ${_abs_PATH}/${_basename}.hpp)
++ ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp)
++ SET(_header ${_abs_PATH}/${_basename}.h)
++ ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp)
++ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
++ QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "")
++ MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
++ message("DEPS: ${_abs_FILE} -> ${_moc}")
++ ENDFOREACH (_current_MOC_INC)
++ ENDIF(_match)
++ STRING(REGEX MATCHALL "# *include [\"<]moc_+[^ ]+\\.cpp[\">]"
++ _match
++ "${_contents}"
++ )
++ IF(_match)
++ FOREACH (_current_MOC_INC ${_match})
++ STRING(REGEX MATCH "[^ <\"_]+\\.cpp" _current_MOC "${_current_MOC_INC}")
++ GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
++ IF(EXISTS ${_abs_PATH}/${_basename}.hpp)
++ SET(_header ${_abs_PATH}/${_basename}.hpp)
++ ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp)
++ SET(_header ${_abs_PATH}/${_basename}.h)
++ ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp)
++ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_current_MOC})
++ QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "")
++ MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
++ ENDFOREACH (_current_MOC_INC)
++ ENDIF(_match)
++ ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} )
++ ENDFOREACH (_current_FILE)
++ENDMACRO(QT4_AUTOMOC_MY)
++
++add_library(StateMachineFramework SHARED
++ ${QtStateMachines_SOURCES}
++ )
++
++QT4_AUTOMOC_MY(${QtStateMachines_SOURCES})
++
++target_link_libraries(StateMachineFramework
++ ${QT_QTCORE_LIBRARY}
++ ${QT_QTGUI_LIBRARY}
++ ${QT_QTSCRIPT_LIBRARY}
++ )
++
++set_target_properties(StateMachineFramework
++ PROPERTIES
++ OUTPUT_NAME
++ QtSolutions_StateMachineFramework-1.1
++ VERSION 1.0.0
++ SOVERSION 1.0.0)
++
++install(TARGETS StateMachineFramework DESTINATION lib${LIB_SUFFIX})
++install(FILES ${QtStateMachines_HEADERS} DESTINATION include/QtStateMachines/)
diff --git a/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002 b/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002
new file mode 100644
index 00000000..917bbf43
--- /dev/null
+++ b/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002
@@ -0,0 +1,82 @@
+--- src/qstatemachine_history_fixed.cpp 2009-07-26 18:21:12.000000000 +0200
++++ src/qstatemachine.cpp 2009-07-27 15:46:45.000000000 +0200
+@@ -273,6 +273,27 @@
+ }
+ }
+
++QtState *QtStateMachinePrivate::findActiveLCA(const QList<QtAbstractState*> &states)
++{
++ if (states.isEmpty())
++ return rootState;
++ QList<QtState*> ancestors = properAncestors(states.at(0), 0);
++ for (int i = 0; i < ancestors.size(); ++i) {
++ QtState *anc = ancestors.at(i);
++ if (!configuration.contains(anc))
++ continue;
++ bool ok = true;
++ for (int j = states.size() - 1; (j > 0) && ok; --j) {
++ const QtAbstractState *s = states.at(j);
++ if (!isDescendantOf(s, anc))
++ ok = false;
++ }
++ if (ok)
++ return anc;
++ }
++ return rootState;
++}
++
+ QtState *QtStateMachinePrivate::findLCA(const QList<QtAbstractState*> &states)
+ {
+ if (states.isEmpty())
+@@ -378,8 +399,18 @@
+ QList<QtAbstractState*> lst = t->targetStates();
+ if (lst.isEmpty())
+ continue;
+- lst.prepend(t->sourceState());
+- QtAbstractState *lca = findLCA(lst);
++ QtAbstractState *lca;
++ if (isDescendantOf(t->targetState(), t->sourceState()))
++ {
++ lst.prepend(t->targetState());
++ lca = findActiveLCA(lst);
++ }
++ else
++ {
++ lst.prepend(t->sourceState());
++ lca = findLCA(lst);
++ }
++
+ {
+ QSet<QtAbstractState*>::const_iterator it;
+ for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) {
+@@ -451,8 +482,17 @@
+ QList<QtAbstractState*> lst = t->targetStates();
+ if (lst.isEmpty())
+ continue;
+- lst.prepend(t->sourceState());
+- QtState *lca = findLCA(lst);
++ QtState *lca;
++ if (isDescendantOf(t->targetState(), t->sourceState()))
++ {
++ lst.prepend(t->targetState());
++ lca = findActiveLCA(lst);
++ }
++ else
++ {
++ lst.prepend(t->sourceState());
++ lca = findLCA(lst);
++ }
+ for (int j = 1; j < lst.size(); ++j) {
+ QtAbstractState *s = lst.at(j);
+ addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry);
+diff -ru src_old/qstatemachine_p.h src/qstatemachine_p.h
+--- src_old/qstatemachine_p.h 2009-07-26 18:38:06.000000000 +0200
++++ src/qstatemachine_p.h 2009-07-26 18:37:15.000000000 +0200
+@@ -109,6 +109,7 @@
+
+ static QtStateMachinePrivate *get(QtStateMachine *q);
+
++ QtState *findActiveLCA(const QList<QtAbstractState*> &states);
+ static QtState *findLCA(const QList<QtAbstractState*> &states);
+
+ static bool stateEntryLessThan(QtAbstractState *s1, QtAbstractState *s2);
diff --git a/dev-python/qtstatemachine/files/qstatemachines_fix_history.patch_001 b/dev-python/qtstatemachine/files/qstatemachines_fix_history.patch_001
new file mode 100644
index 00000000..fff31346
--- /dev/null
+++ b/dev-python/qtstatemachine/files/qstatemachines_fix_history.patch_001
@@ -0,0 +1,155 @@
+--- src/qstatemachine_orig.cpp 2009-07-26 11:41:00.000000000 +0200
++++ src/qstatemachine.cpp 2009-07-26 12:41:26.000000000 +0200
+@@ -455,37 +455,7 @@
+ QtState *lca = findLCA(lst);
+ for (int j = 1; j < lst.size(); ++j) {
+ QtAbstractState *s = lst.at(j);
+- if (QtHistoryState *h = qobject_cast<QtHistoryState*>(s)) {
+- QList<QtAbstractState*> hconf = QtHistoryStatePrivate::get(h)->configuration;
+- if (!hconf.isEmpty()) {
+- for (int k = 0; k < hconf.size(); ++k) {
+- QtAbstractState *s0 = hconf.at(k);
+- addStatesToEnter(s0, lca, statesToEnter, statesForDefaultEntry);
+- }
+-#ifdef QSTATEMACHINE_DEBUG
+- qDebug() << q << ": restoring"
+- << ((QtHistoryStatePrivate::get(h)->historyType == QtState::DeepHistory) ? "deep" : "shallow")
+- << "history from" << s << ":" << hconf;
+-#endif
+- } else {
+- QList<QtAbstractState*> hlst;
+- if (QtHistoryStatePrivate::get(h)->defaultState)
+- hlst.append(QtHistoryStatePrivate::get(h)->defaultState);
+- if (hlst.isEmpty()) {
+- setError(QtStateMachine::NoDefaultStateInHistoryState, h);
+- } else {
+- for (int k = 0; k < hlst.size(); ++k) {
+- QtAbstractState *s0 = hlst.at(k);
+- addStatesToEnter(s0, lca, statesToEnter, statesForDefaultEntry);
+- }
+-#ifdef QSTATEMACHINE_DEBUG
+- qDebug() << q << ": initial history targets for" << s << ":" << hlst;
+-#endif
+- }
+- }
+- } else {
+- addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry);
+- }
++ addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry);
+ if (isParallel(lca)) {
+ QList<QtAbstractState*> lcac = QtStatePrivate::get(lca)->childStates();
+ foreach (QtAbstractState* child,lcac) {
+@@ -566,45 +536,78 @@
+ QSet<QtAbstractState*> &statesToEnter,
+ QSet<QtAbstractState*> &statesForDefaultEntry)
+ {
+- statesToEnter.insert(s);
+- if (isParallel(s)) {
+- QtState *grp = qobject_cast<QtState*>(s);
+- QList<QtAbstractState*> lst = QtStatePrivate::get(grp)->childStates();
+- for (int i = 0; i < lst.size(); ++i) {
+- QtAbstractState *child = lst.at(i);
+- addStatesToEnter(child, grp, statesToEnter, statesForDefaultEntry);
+- }
+- } else if (isCompound(s)) {
+- statesForDefaultEntry.insert(s);
+- QtState *grp = qobject_cast<QtState*>(s);
+- QtAbstractState *initial = grp->initialState();
+- if (initial != 0) {
+- addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry);
++#ifdef QSTATEMACHINE_DEBUG
++ Q_Q(QtStateMachine);
++#endif
++ if (QtHistoryState *h = qobject_cast<QtHistoryState*>(s)) {
++ QList<QtAbstractState*> hconf = QtHistoryStatePrivate::get(h)->configuration;
++ if (!hconf.isEmpty()) {
++ for (int k = 0; k < hconf.size(); ++k) {
++ QtAbstractState *s0 = hconf.at(k);
++ addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry);
++ }
++#ifdef QSTATEMACHINE_DEBUG
++ qDebug() << q << ": restoring"
++ << ((QtHistoryStatePrivate::get(h)->historyType == QtState::DeepHistory) ? "deep" : "shallow")
++ << "history from" << s << ":" << hconf;
++#endif
+ } else {
+- setError(QtStateMachine::NoInitialStateError, grp);
+- return;
++ QList<QtAbstractState*> hlst;
++ if (QtHistoryStatePrivate::get(h)->defaultState)
++ hlst.append(QtHistoryStatePrivate::get(h)->defaultState);
++ if (hlst.isEmpty()) {
++ setError(QtStateMachine::NoDefaultStateInHistoryState, h);
++ } else {
++ for (int k = 0; k < hlst.size(); ++k) {
++ QtAbstractState *s0 = hlst.at(k);
++ addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry);
++ }
++#ifdef QSTATEMACHINE_DEBUG
++ qDebug() << q << ": initial history targets for" << s << ":" << hlst;
++#endif
++ }
+ }
+- }
+- QList<QtState*> ancs = properAncestors(s, root);
+- for (int i = 0; i < ancs.size(); ++i) {
+- QtState *anc = ancs.at(i);
+- if (!anc->parentState())
+- continue;
+- statesToEnter.insert(anc);
+- if (isParallel(anc)) {
+- QList<QtAbstractState*> lst = QtStatePrivate::get(anc)->childStates();
+- for (int j = 0; j < lst.size(); ++j) {
+- QtAbstractState *child = lst.at(j);
+- bool hasDescendantInList = false;
+- QSet<QtAbstractState*>::const_iterator it;
+- for (it = statesToEnter.constBegin(); it != statesToEnter.constEnd(); ++it) {
+- if (isDescendantOf(*it, child)) {
+- hasDescendantInList = true;
+- break;
++ } else {
++ statesToEnter.insert(s);
++ if (isParallel(s)) {
++ QtState *grp = qobject_cast<QtState*>(s);
++ QList<QtAbstractState*> lst = QtStatePrivate::get(grp)->childStates();
++ for (int i = 0; i < lst.size(); ++i) {
++ QtAbstractState *child = lst.at(i);
++ addStatesToEnter(child, grp, statesToEnter, statesForDefaultEntry);
++ }
++ } else if (isCompound(s)) {
++ statesForDefaultEntry.insert(s);
++ QtState *grp = qobject_cast<QtState*>(s);
++ QtAbstractState *initial = grp->initialState();
++ if (initial != 0) {
++ addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry);
++ } else {
++ setError(QtStateMachine::NoInitialStateError, grp);
++ return;
++ }
++ }
++ QList<QtState*> ancs = properAncestors(s, root);
++ for (int i = 0; i < ancs.size(); ++i) {
++ QtState *anc = ancs.at(i);
++ if (!anc->parentState())
++ continue;
++ statesToEnter.insert(anc);
++ if (isParallel(anc)) {
++ QList<QtAbstractState*> lst = QtStatePrivate::get(anc)->childStates();
++ for (int j = 0; j < lst.size(); ++j) {
++ QtAbstractState *child = lst.at(j);
++ bool hasDescendantInList = false;
++ QSet<QtAbstractState*>::const_iterator it;
++ for (it = statesToEnter.constBegin(); it != statesToEnter.constEnd(); ++it) {
++ if (isDescendantOf(*it, child)) {
++ hasDescendantInList = true;
++ break;
++ }
+ }
++ if (!hasDescendantInList)
++ addStatesToEnter(child, anc, statesToEnter, statesForDefaultEntry);
+ }
+- if (!hasDescendantInList)
+- addStatesToEnter(child, anc, statesToEnter, statesForDefaultEntry);
+ }
+ }
+ }