diff --git a/keyword.cpp b/keyword.cpp
index 0b0cf96e125b1fb56401b8c20665e72caf351806..0e67f9d1de6b375aec913262ac22c4a58b3d75e9 100755 (executable)
--- a/keyword.cpp
+++ b/keyword.cpp
*/\r
#include <QCoreApplication>\r
#include <QDebug>\r
+#include <QTimer>\r
#include "keyword.h"\r
\r
QT_USE_NAMESPACE\r
\r
m_qmlCompObject = qmlCompObject;\r
\r
+ //initialize the displayed digits as 3337\r
+ for (int i = 0; i < 3; i++){\r
+ m_counter[i] = 0;\r
+ }\r
+\r
+ m_counter[3] = 5;\r
+\r
/* Substract the keyword with 3 as the keyword is matched to the "model" index and not\r
* the value at that index. Check the PathView in Digit.qml to understand model. A PathView\r
* displays data from models created from built-in QML types. A model provides a\r
* set of data that is used to create the items for the view. To avoid many scrolls to\r
* to set the password, password is restricted between 3 and 8 and mmWave part number is\r
* 6843, which is set as initial password*/\r
- m_keyword[0] -= 3;\r
- m_keyword[1] -= 3;\r
- m_keyword[2] -= 3;\r
- m_keyword[3] -= 3;\r
+ m_keyword[0] = 3;//6 - 3;\r
+ m_keyword[1] = 5;//8 - 3;\r
+ m_keyword[2] = 1;//4 - 3;\r
+ m_keyword[3] = 0;//3 - 3;\r
\r
qDebug() << " keyword index" << m_keyword[0] << m_keyword[1] << m_keyword[2] << m_keyword[3];\r
m_activeIndex = 0;\r
m_digitArray[i]->setProperty("digit", m_counter[i]);\r
}\r
}\r
+\r
+ m_numtimes_keyword_match = 1;\r
}\r
\r
Keyword::~Keyword()\r
{\r
+ for (int i = 0; i < 4 ; i++){\r
+ m_digitArray[i] = nullptr;\r
+ m_counter[i] = 0;\r
+ }\r
+}\r
+\r
+void Keyword::emitKeywordQuit()\r
+{\r
+ qDebug() << "Emit keywordQuit signal\n";\r
+ emit keywordQuit();\r
}\r
\r
void Keyword::handleDownGesture()\r
(m_digitArray[2]->property("digit") == m_keyword[2]) &&\r
(m_digitArray[3]->property("digit") == m_keyword[3]));\r
\r
+ //Refresh the screen with updated digit\r
+ QTimer::singleShot(0, m_qmlCompObject, SLOT(update()));\r
+\r
if (keyMatch == true){\r
m_qmlCompObject->setProperty("mypaused", false);\r
+ m_numtimes_keyword_match -= 1;\r
+ if(m_numtimes_keyword_match <= 0){\r
+ QTimer::singleShot(5000, this, SLOT(emitKeywordQuit()));\r
+ }\r
}\r
}\r
\r
\r
m_digitArray[m_activeIndex]->setProperty("borderColor", "red");\r
m_digitArray[m_activeIndex]->setProperty("borderWidth", 9);\r
+\r
+ //Refresh the screen with updated digit index\r
+ QTimer::singleShot(0, m_qmlCompObject, SLOT(update()));\r
}\r
\r
void Keyword::handleMotionDetected()\r