aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/statemachine
diff options
context:
space:
mode:
authorKevin Funk <kevin.funk@kdab.com>2014-10-09 16:05:33 +0200
committerBrett Stottlemyer <bstottle@ford.com>2014-10-21 02:13:33 +0200
commitf830c109d09d835551c1325c4904fc9a490b3754 (patch)
tree6bb3c09cb44ed0a5446749701ac4281831a62967 /src/imports/statemachine
parent5871f3e829f1f48995b5d6c03f7ad31fcda386e5 (diff)
qmlstatemachine: Rename StateBase to State
As discussed with Brett Stottlmyer and Alan Alpert. Add a section about the implications when importing both QtQml.StateMachine and QtQuick in one single QML file. Change-Id: I8755f4b578e2a6ff4c2377c7a8a0b996ba9b7129 Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/imports/statemachine')
-rw-r--r--src/imports/statemachine/finalstate.cpp6
-rw-r--r--src/imports/statemachine/plugin.cpp8
-rw-r--r--src/imports/statemachine/plugins.qmltypes6
-rw-r--r--src/imports/statemachine/state.cpp (renamed from src/imports/statemachine/statebase.cpp)30
-rw-r--r--src/imports/statemachine/state.h (renamed from src/imports/statemachine/statebase.h)6
-rw-r--r--src/imports/statemachine/statemachine.cpp16
-rw-r--r--src/imports/statemachine/statemachine.pro4
7 files changed, 38 insertions, 38 deletions
diff --git a/src/imports/statemachine/finalstate.cpp b/src/imports/statemachine/finalstate.cpp
index 73e85a1abd..9b3c05e294 100644
--- a/src/imports/statemachine/finalstate.cpp
+++ b/src/imports/statemachine/finalstate.cpp
@@ -59,9 +59,9 @@ QQmlListProperty<QObject> FinalState::children()
A final state is used to communicate that (part of) a StateMachine has
finished its work. When a final top-level state is entered, the state
- machine's \l{StateBase::finished}{finished}() signal is emitted. In
+ machine's \l{State::finished}{finished}() signal is emitted. In
general, when a final substate (a child of a State) is entered, the parent
- state's \l{StateBase::finished}{finished}() signal is emitted. FinalState
+ state's \l{State::finished}{finished}() signal is emitted. FinalState
is part of \l{The Declarative State Machine Framework}.
To use a final state, you create a FinalState object and add a transition
@@ -73,5 +73,5 @@ QQmlListProperty<QObject> FinalState::children()
\clearfloat
- \sa StateMachine, StateBase
+ \sa StateMachine, State
*/
diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp
index 678a4de199..a1ebe06a80 100644
--- a/src/imports/statemachine/plugin.cpp
+++ b/src/imports/statemachine/plugin.cpp
@@ -33,7 +33,7 @@
#include "finalstate.h"
#include "signaltransition.h"
-#include "statebase.h"
+#include "state.h"
#include "statemachine.h"
#include "timeouttransition.h"
@@ -51,12 +51,12 @@ class QtQmlStateMachinePlugin : public QQmlExtensionPlugin
public:
void registerTypes(const char *uri)
{
- qmlRegisterType<StateBase>(uri, 1, 0, "StateBase");
+ qmlRegisterType<State>(uri, 1, 0, "State");
qmlRegisterType<StateMachine>(uri, 1, 0, "StateMachine");
qmlRegisterType<QHistoryState>(uri, 1, 0, "HistoryState");
qmlRegisterType<FinalState>(uri, 1, 0, "FinalState");
- qmlRegisterUncreatableType<QState>(uri, 1, 0, "QState", "Don't use this, use StateBase instead");
- qmlRegisterUncreatableType<QAbstractState>(uri, 1, 0, "QAbstractState", "Don't use this, use StateBase instead");
+ qmlRegisterUncreatableType<QState>(uri, 1, 0, "QState", "Don't use this, use State instead");
+ qmlRegisterUncreatableType<QAbstractState>(uri, 1, 0, "QAbstractState", "Don't use this, use State instead");
qmlRegisterUncreatableType<QSignalTransition>(uri, 1, 0, "QSignalTransition", "Don't use this, use SignalTransition instead");
qmlRegisterType<SignalTransition>(uri, 1, 0, "SignalTransition");
qmlRegisterType<TimeoutTransition>(uri, 1, 0, "TimeoutTransition");
diff --git a/src/imports/statemachine/plugins.qmltypes b/src/imports/statemachine/plugins.qmltypes
index a53d68f8e8..db5897bb0f 100644
--- a/src/imports/statemachine/plugins.qmltypes
+++ b/src/imports/statemachine/plugins.qmltypes
@@ -130,16 +130,16 @@ Module {
exports: ["QtQml.StateMachine/SignalTransition 1.0"]
exportMetaObjectRevisions: [0]
Property { name: "signal"; type: "QJSValue" }
- Property { name: "guard"; type: "bool" }
+ Property { name: "guard"; type: "QQmlScriptString" }
Signal { name: "invokeYourself" }
Signal { name: "qmlSignalChanged" }
Method { name: "invoke" }
}
Component {
- name: "StateBase"
+ name: "State"
defaultProperty: "children"
prototype: "QState"
- exports: ["QtQml.StateMachine/StateBase 1.0"]
+ exports: ["QtQml.StateMachine/State 1.0"]
exportMetaObjectRevisions: [0]
Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
}
diff --git a/src/imports/statemachine/statebase.cpp b/src/imports/statemachine/state.cpp
index d33e294369..56ecd015f5 100644
--- a/src/imports/statemachine/statebase.cpp
+++ b/src/imports/statemachine/state.cpp
@@ -31,18 +31,18 @@
**
****************************************************************************/
-#include "statebase.h"
+#include "state.h"
#include <QQmlContext>
#include <QQmlEngine>
#include <QQmlInfo>
-StateBase::StateBase(QState *parent)
+State::State(QState *parent)
: QState(parent)
{
}
-void StateBase::componentComplete()
+void State::componentComplete()
{
if (this->machine() == NULL) {
static bool once = false;
@@ -53,7 +53,7 @@ void StateBase::componentComplete()
}
}
-QQmlListProperty<QObject> StateBase::children()
+QQmlListProperty<QObject> State::children()
{
return QQmlListProperty<QObject>(this, &m_children, m_children.append, m_children.count, m_children.at, m_children.clear);
}
@@ -68,10 +68,10 @@ QQmlListProperty<QObject> StateBase::children()
\brief The QAbstractState type is the base type of States of a StateMachine.
- Do not use QAbstractState directly; use StateBase, FinalState or
+ Do not use QAbstractState directly; use State, FinalState or
StateMachine instead.
- \sa StateMachine, StateBase
+ \sa StateMachine, State
*/
/*!
@@ -105,7 +105,7 @@ QQmlListProperty<QObject> StateBase::children()
*/
/*!
- \qmltype StateBase
+ \qmltype State
\inqmlmodule QtQml.StateMachine
\inherits QAbstractState
\ingroup statemachine-qmltypes
@@ -114,8 +114,8 @@ QQmlListProperty<QObject> StateBase::children()
\brief Provides a general-purpose state for StateMachine.
- StateBase objects can have child states as well as transitions to other
- states. StateBase is part of \l{The Declarative State Machine Framework}.
+ State objects can have child states as well as transitions to other
+ states. State is part of \l{The Declarative State Machine Framework}.
\section1 States with Child States
@@ -125,7 +125,7 @@ QQmlListProperty<QObject> StateBase::children()
and the state machine needs to know which child state to enter when the
parent state is the target of a transition.
- The state emits the StateBase::finished() signal when a final child state
+ The state emits the State::finished() signal when a final child state
(FinalState) is entered.
The errorState sets the state's error state. The error state is the state
@@ -142,7 +142,7 @@ QQmlListProperty<QObject> StateBase::children()
*/
/*!
- \qmlproperty enumeration StateBase::childMode
+ \qmlproperty enumeration State::childMode
\brief The child mode of this state
@@ -156,19 +156,19 @@ QQmlListProperty<QObject> StateBase::children()
*/
/*!
- \qmlproperty QAbstractState StateBase::errorState
+ \qmlproperty QAbstractState State::errorState
\brief The error state of this state.
*/
/*!
- \qmlproperty QAbstractState StateBase::initialState
+ \qmlproperty QAbstractState State::initialState
\brief The initial state of this state (one of its child states).
*/
/*!
- \qmlsignal StateBase::finished()
+ \qmlsignal State::finished()
This signal is emitted when a final child state of this state is entered.
@@ -204,7 +204,7 @@ QQmlListProperty<QObject> StateBase::children()
By default, a history state is shallow, meaning that it will not remember
nested states. This can be configured through the historyType property.
- \sa StateMachine, StateBase
+ \sa StateMachine, State
*/
/*!
diff --git a/src/imports/statemachine/statebase.h b/src/imports/statemachine/state.h
index 38fb8f6d57..af8783e90d 100644
--- a/src/imports/statemachine/statebase.h
+++ b/src/imports/statemachine/state.h
@@ -42,7 +42,7 @@
QT_BEGIN_NAMESPACE
-class StateBase : public QState, public QQmlParserStatus
+class State : public QState, public QQmlParserStatus
{
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
@@ -50,7 +50,7 @@ class StateBase : public QState, public QQmlParserStatus
Q_CLASSINFO("DefaultProperty", "children")
public:
- explicit StateBase(QState *parent = 0);
+ explicit State(QState *parent = 0);
void classBegin() {}
void componentComplete();
@@ -61,7 +61,7 @@ Q_SIGNALS:
void childrenChanged();
private:
- ChildrenPrivate<StateBase> m_children;
+ ChildrenPrivate<State> m_children;
};
QT_END_NAMESPACE
diff --git a/src/imports/statemachine/statemachine.cpp b/src/imports/statemachine/statemachine.cpp
index c65901a175..7b9ebdb88b 100644
--- a/src/imports/statemachine/statemachine.cpp
+++ b/src/imports/statemachine/statemachine.cpp
@@ -80,7 +80,7 @@ QQmlListProperty<QObject> StateMachine::children()
/*!
\qmltype StateMachine
\inqmlmodule QtQml.StateMachine
- \inherits StateBase
+ \inherits State
\ingroup statemachine-qmltypes
\since 5.4
@@ -97,7 +97,7 @@ QQmlListProperty<QObject> StateMachine::children()
algorithm. The framework's \l{The Declarative State Machine Framework}{overview}
gives several state graphs and the code to build them.
- Before the machine can be started, the \l{StateBase::initialState}{initialState}
+ Before the machine can be started, the \l{State::initialState}{initialState}
must be set. The initial state is the state that the
machine enters when started. You can then set running property to true
or start() the state machine. The started signal is emitted when the
@@ -116,7 +116,7 @@ QQmlListProperty<QObject> StateMachine::children()
\snippet qml/statemachine/simplestatemachine.qml document
If an error is encountered, the machine will look for an
- \l{StateBase::errorState}{errorState}, and if one is available, it will
+ \l{State::errorState}{errorState}, and if one is available, it will
enter this state. After the error state is entered, the type of the error
can be retrieved with error(). The execution of the state graph will not
stop when the error state is entered. If no error state applies to the
@@ -125,7 +125,7 @@ QQmlListProperty<QObject> StateMachine::children()
\clearfloat
- \sa QAbstractState, StateBase, SignalTransition, TimeoutTransition, HistoryState {The Declarative State Machine Framework}
+ \sa QAbstractState, State, SignalTransition, TimeoutTransition, HistoryState {The Declarative State Machine Framework}
*/
/*!
@@ -181,18 +181,18 @@ QQmlListProperty<QObject> StateMachine::children()
the main application event loop started with QCoreApplication::exec() or
QApplication::exec().
- \sa started, StateBase::finished, stop(), StateBase::initialState, running
+ \sa started, State::finished, stop(), State::initialState, running
*/
/*!
\qmlsignal StateMachine::started()
This signal is emitted when the state machine has entered its initial state
- (StateBase::initialState).
+ (State::initialState).
The corresponding handler is \c onStarted.
- \sa running, start(), StateBase::finished
+ \sa running, start(), State::finished
*/
/*!
@@ -211,5 +211,5 @@ QQmlListProperty<QObject> StateMachine::children()
The corresponding handler is \c onStopped.
- \sa running, stop(), StateBase::finished
+ \sa running, stop(), State::finished
*/
diff --git a/src/imports/statemachine/statemachine.pro b/src/imports/statemachine/statemachine.pro
index 4cc7089a32..9bb88074e9 100644
--- a/src/imports/statemachine/statemachine.pro
+++ b/src/imports/statemachine/statemachine.pro
@@ -8,7 +8,7 @@ QT = core-private qml-private
SOURCES = \
$$PWD/finalstate.cpp \
$$PWD/signaltransition.cpp \
- $$PWD/statebase.cpp \
+ $$PWD/state.cpp \
$$PWD/statemachine.cpp \
$$PWD/timeouttransition.cpp \
$$PWD/plugin.cpp
@@ -17,7 +17,7 @@ HEADERS = \
$$PWD/childrenprivate.h \
$$PWD/finalstate.h \
$$PWD/signaltransition.h \
- $$PWD/statebase.h \
+ $$PWD/state.h \
$$PWD/statemachine.h \
$$PWD/timeouttransition.h