From c795ec353444b682e0927e07859b95f0e88ea139 Mon Sep 17 00:00:00 2001 From: Robert Brock Date: Thu, 25 Feb 2016 14:34:45 +0000 Subject: QInputSequence removed sequential As per API review If a sequence of keys is not correct, then it simply isn't correct Change-Id: I9c4f7217373fdef4f52717d5c627587284bd596f Reviewed-by: Sean Harmer Reviewed-by: Paul Lemire --- src/input/backend/inputsequence.cpp | 15 +----------- src/input/backend/inputsequence_p.h | 2 -- src/input/frontend/qinputsequence.cpp | 44 ----------------------------------- src/input/frontend/qinputsequence.h | 4 ---- 4 files changed, 1 insertion(+), 64 deletions(-) diff --git a/src/input/backend/inputsequence.cpp b/src/input/backend/inputsequence.cpp index 3dfd2c9e0..3cd93251b 100644 --- a/src/input/backend/inputsequence.cpp +++ b/src/input/backend/inputsequence.cpp @@ -55,7 +55,6 @@ InputSequence::InputSequence() , m_inputsToTrigger() , m_timeout(0) , m_buttonInterval(0) - , m_sequential(true) , m_startTime(0) , m_lastInputTime(0) , m_enabled(false) @@ -68,7 +67,6 @@ void InputSequence::updateFromPeer(Qt3DCore::QNode *peer) m_enabled = input->isEnabled(); m_timeout = input->timeout(); m_buttonInterval = input->buttonInterval(); - m_sequential = input->sequential(); Q_FOREACH (QAbstractActionInput *i, input->inputs()) m_inputs.push_back(i->id()); } @@ -81,7 +79,6 @@ void InputSequence::cleanup() m_startTime = 0; m_lastInputTime = 0; m_lastInputId = Qt3DCore::QNodeId(); - m_sequential = true; m_inputs.clear(); m_inputsToTrigger.clear(); } @@ -101,15 +98,7 @@ void InputSequence::reset() bool InputSequence::actionTriggered(Qt3DCore::QNodeId input, const qint64 currentTime) { - // If we are running the root of a sequence and input is not the first element of the sequence - // reset and return false - if (m_sequential && (!m_inputs.empty() && m_inputsToTrigger.first() != input)) { - if (!(input == m_lastInputId && ((currentTime - m_lastInputTime) < 200))) - reset(); - return false; - } - - // Otherwise save the last input + // Save the last input m_lastInputId = input; // Return false if we've spent too much time in between two sequences if ((m_lastInputTime != 0) && ((currentTime - m_lastInputTime) > m_buttonInterval)) { @@ -140,8 +129,6 @@ void InputSequence::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) m_timeout = propertyChange->value().toInt(); } else if (propertyChange->propertyName() == QByteArrayLiteral("buttonInterval")) { m_buttonInterval = propertyChange->value().toInt(); - } else if (propertyChange->propertyName() == QByteArrayLiteral("sequential")) { - m_sequential = propertyChange->value().toBool(); } } else if (e->type() == Qt3DCore::NodeAdded) { if (propertyChange->propertyName() == QByteArrayLiteral("input")) { diff --git a/src/input/backend/inputsequence_p.h b/src/input/backend/inputsequence_p.h index af102e50b..2d1b6966e 100644 --- a/src/input/backend/inputsequence_p.h +++ b/src/input/backend/inputsequence_p.h @@ -72,7 +72,6 @@ public: inline int buttonInterval() const { return m_buttonInterval; } inline qint64 startTime() const { return m_startTime; } void setStartTime(qint64 time); - inline bool isSequential() const { return m_sequential; } inline bool isEnabled() const { return m_enabled; } bool sequenceTriggered() const; void reset(); @@ -84,7 +83,6 @@ private: QVector m_inputsToTrigger; int m_timeout; int m_buttonInterval; - bool m_sequential; qint64 m_startTime; qint64 m_lastInputTime; Qt3DCore::QNodeId m_lastInputId; diff --git a/src/input/frontend/qinputsequence.cpp b/src/input/frontend/qinputsequence.cpp index 505742acd..72c209b81 100644 --- a/src/input/frontend/qinputsequence.cpp +++ b/src/input/frontend/qinputsequence.cpp @@ -56,12 +56,10 @@ public: : Qt3DInput::QAbstractAggregateActionInputPrivate() , m_timeout(0) , m_buttonInterval(0) - , m_sequential(true) {} int m_timeout; int m_buttonInterval; - bool m_sequential; }; /*! @@ -178,35 +176,6 @@ int QInputSequence::buttonInterval() const return d->m_buttonInterval; } -/*! - \fn QInputSequence::sequentialChanged() - - This signal is emitted when the sequential property of the input sequence is changed. -*/ - -/*! - \qmlproperty bool Qt3D.Input::InputSequence::sequential - - If the QAbstractActionInput's in the input sequence must triggered in order. -*/ - -/*! - \qmlsignal Qt3D.Input::InputSequence::sequentialChanged() - - This signal is emitted when the sequential property of the input sequence is changed. - - The corresponding handeler is \c onSequentialChanged -*/ - -/*! - Returns true if the QAbstractActionInput's in the input sequence must triggered in order. - */ -bool QInputSequence::sequential() const -{ - Q_D(const QInputSequence); - return d->m_sequential; -} - /*! Set the time in which all QAbstractActionInput's in the input sequence must triggered within. The time is in milliseconds @@ -233,25 +202,12 @@ void QInputSequence::setButtonInterval(int buttonInterval) } } -/*! - Set if the QAbstractActionInput's in the input sequence must triggered in order. - */ -void QInputSequence::setSequential(bool sequential) -{ - Q_D(QInputSequence); - if (d->m_sequential != sequential) { - d->m_sequential = sequential; - emit sequentialChanged(sequential); - } -} - void QInputSequence::copy(const Qt3DCore::QNode *ref) { QAbstractAggregateActionInput::copy(ref); const QInputSequence *input = static_cast(ref); d_func()->m_timeout = input->d_func()->m_timeout; d_func()->m_buttonInterval = input->d_func()->m_buttonInterval; - d_func()->m_sequential = input->d_func()->m_sequential; } } // Qt3DInput diff --git a/src/input/frontend/qinputsequence.h b/src/input/frontend/qinputsequence.h index 1baa713bf..c8b25e238 100644 --- a/src/input/frontend/qinputsequence.h +++ b/src/input/frontend/qinputsequence.h @@ -56,7 +56,6 @@ class QT3DINPUTSHARED_EXPORT QInputSequence : public Qt3DInput::QAbstractAggrega Q_OBJECT Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged) Q_PROPERTY(int buttonInterval READ buttonInterval WRITE setButtonInterval NOTIFY buttonIntervalChanged) - Q_PROPERTY(bool sequential READ sequential WRITE setSequential NOTIFY sequentialChanged) public: explicit QInputSequence(Qt3DCore::QNode *parent = Q_NULLPTR); @@ -64,17 +63,14 @@ public: int timeout() const; int buttonInterval() const; - bool sequential() const; public Q_SLOTS: void setTimeout(int timeout); void setButtonInterval(int buttonInterval); - void setSequential(bool sequential); Q_SIGNALS: void timeoutChanged(int timeout); void buttonIntervalChanged(int buttonInterval); - void sequentialChanged(bool sequential); protected: void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE; -- cgit v1.2.3