summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-03 08:35:37 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-03 08:40:30 (GMT)
commitacd156649b1083aeeb400fe8fdbbf4e55ada4bed (patch)
treee74b2486cacc4b318b5c0533360ab03e1923a11d /src/corelib/statemachine
parent45005c68c6effa41108ef55cd10a84f5977f79a0 (diff)
downloadQt-acd156649b1083aeeb400fe8fdbbf4e55ada4bed.zip
Qt-acd156649b1083aeeb400fe8fdbbf4e55ada4bed.tar.gz
Qt-acd156649b1083aeeb400fe8fdbbf4e55ada4bed.tar.bz2
remove constructors that are not useful
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.
Diffstat (limited to 'src/corelib/statemachine')
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp22
-rw-r--r--src/corelib/statemachine/qabstracttransition.h3
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp30
-rw-r--r--src/corelib/statemachine/qeventtransition.h5
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp15
-rw-r--r--src/corelib/statemachine/qsignaltransition.h3
-rw-r--r--src/corelib/statemachine/qstate.cpp6
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp6
8 files changed, 8 insertions, 82 deletions
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index 0004d3e..3248dcf 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -153,34 +153,12 @@ QAbstractTransition::QAbstractTransition(QState *sourceState)
}
/*!
- Constructs a new QAbstractTransition object with the given \a targets and \a
- sourceState.
-*/
-QAbstractTransition::QAbstractTransition(const QList<QAbstractState*> &targets,
- QState *sourceState)
- : QObject(*new QAbstractTransitionPrivate, sourceState)
-{
- setTargetStates(targets);
-}
-
-/*!
- \internal
-*/
-QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd,
- QState *parent)
- : QObject(dd, parent)
-{
-}
-
-/*!
\internal
*/
QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd,
- const QList<QAbstractState*> &targets,
QState *parent)
: QObject(dd, parent)
{
- setTargetStates(targets);
}
/*!
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index 9ba1f11..8ff3a6e 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -72,7 +72,6 @@ class Q_CORE_EXPORT QAbstractTransition : public QObject
Q_PROPERTY(QList<QAbstractState*> targetStates READ targetStates WRITE setTargetStates)
public:
QAbstractTransition(QState *sourceState = 0);
- QAbstractTransition(const QList<QAbstractState*> &targets, QState *sourceState = 0);
virtual ~QAbstractTransition();
QState *sourceState() const;
@@ -104,8 +103,6 @@ protected:
protected:
QAbstractTransition(QAbstractTransitionPrivate &dd, QState *parent);
- QAbstractTransition(QAbstractTransitionPrivate &dd,
- const QList<QAbstractState*> &targets, QState *parent);
private:
Q_DISABLE_COPY(QAbstractTransition)
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index 3933981..813c960 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -153,22 +153,6 @@ QEventTransition::QEventTransition(QObject *object, QEvent::Type type,
}
/*!
- Constructs a new QEventTransition object associated with events of the given
- \a type for the given \a object. The transition has the given \a targets and
- \a sourceState.
-*/
-QEventTransition::QEventTransition(QObject *object, QEvent::Type type,
- const QList<QAbstractState*> &targets,
- QState *sourceState)
- : QAbstractTransition(*new QEventTransitionPrivate, targets, sourceState)
-{
- Q_D(QEventTransition);
- d->registered = false;
- d->object = object;
- d->eventType = type;
-}
-
-/*!
\internal
*/
QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QState *parent)
@@ -190,20 +174,6 @@ QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QObject *object,
}
/*!
- \internal
-*/
-QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QObject *object,
- QEvent::Type type, const QList<QAbstractState*> &targets,
- QState *parent)
- : QAbstractTransition(dd, targets, parent)
-{
- Q_D(QEventTransition);
- d->registered = false;
- d->object = object;
- d->eventType = type;
-}
-
-/*!
Destroys this QObject event transition.
*/
QEventTransition::~QEventTransition()
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index b05ffef..0ebca19 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -62,8 +62,6 @@ class Q_CORE_EXPORT QEventTransition : public QAbstractTransition
public:
QEventTransition(QState *sourceState = 0);
QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = 0);
- QEventTransition(QObject *object, QEvent::Type type,
- const QList<QAbstractState*> &targets, QState *sourceState = 0);
~QEventTransition();
QObject *eventObject() const;
@@ -82,9 +80,6 @@ protected:
QEventTransition(QEventTransitionPrivate &dd, QState *parent);
QEventTransition(QEventTransitionPrivate &dd, QObject *object,
QEvent::Type type, QState *parent);
- QEventTransition(QEventTransitionPrivate &dd, QObject *object,
- QEvent::Type type, const QList<QAbstractState*> &targets,
- QState *parent);
private:
Q_DISABLE_COPY(QEventTransition)
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index 389e513..7814699 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -159,21 +159,6 @@ QSignalTransition::QSignalTransition(QObject *sender, const char *signal,
}
/*!
- Constructs a new signal transition associated with the given \a signal of
- the given \a sender. The transition has the given \a targets and \a
- sourceState.
-*/
-QSignalTransition::QSignalTransition(QObject *sender, const char *signal,
- const QList<QAbstractState*> &targets,
- QState *sourceState)
- : QAbstractTransition(*new QSignalTransitionPrivate, targets, sourceState)
-{
- Q_D(QSignalTransition);
- d->sender = sender;
- d->signal = signal;
-}
-
-/*!
Destroys this signal transition.
*/
QSignalTransition::~QSignalTransition()
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index 69060ae..415751e 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -62,9 +62,6 @@ public:
QSignalTransition(QState *sourceState = 0);
QSignalTransition(QObject *sender, const char *signal,
QState *sourceState = 0);
- QSignalTransition(QObject *sender, const char *signal,
- const QList<QAbstractState*> &targets,
- QState *sourceState = 0);
~QSignalTransition();
QObject *senderObject() const;
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 2042288..09d0be0 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -339,7 +339,8 @@ QSignalTransition *QState::addTransition(QObject *sender, const char *signal,
return 0;
}
}
- QSignalTransition *trans = new QSignalTransition(sender, signal, QList<QAbstractState*>() << target);
+ QSignalTransition *trans = new QSignalTransition(sender, signal);
+ trans->setTargetState(target);
addTransition(trans);
return trans;
}
@@ -351,7 +352,8 @@ class UnconditionalTransition : public QAbstractTransition
{
public:
UnconditionalTransition(QAbstractState *target)
- : QAbstractTransition(QList<QAbstractState*>() << target) {}
+ : QAbstractTransition()
+ { setTargetState(target); }
protected:
void onTransition(QEvent *) {}
bool eventTest(QEvent *) { return true; }
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 5aa5917..9cb1d4d 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1139,7 +1139,8 @@ class InitialTransition : public QAbstractTransition
{
public:
InitialTransition(QAbstractState *target)
- : QAbstractTransition(QList<QAbstractState*>() << target) {}
+ : QAbstractTransition()
+ { setTargetState(target); }
protected:
virtual bool eventTest(QEvent *) { return true; }
virtual void onTransition(QEvent *) {}
@@ -1306,7 +1307,8 @@ class GoToStateTransition : public QAbstractTransition
{
public:
GoToStateTransition(QAbstractState *target)
- : QAbstractTransition(QList<QAbstractState*>() << target) {}
+ : QAbstractTransition()
+ { setTargetState(target); }
protected:
void onTransition(QEvent *) { deleteLater(); }
bool eventTest(QEvent *) { return true; }