[dasher: 5/61] DasherInterface->Done was not really stopping dasher.



commit c8871d2b539dfc40a38ccb9ac9e15735ac52a292
Author: Ada Majorek <amajorek google com>
Date:   Sat Mar 5 12:54:07 2016 -0800

    DasherInterface->Done was not really stopping dasher.
    
    fixes https://github.com/ipomoena/dasher/issues/90

 Src/DasherCore/ControlManager.cpp |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index 1d051c6..e3a750e 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -274,6 +274,15 @@ public:
   }
 };
 
+// TODO Duplicated logic, here and in DefaultFilter. Refactor. 
+class Stop: public CControlBase::Action {
+public:
+  void happen(CControlBase::CContNode *pNode) {
+    pNode->mgr()->GetDasherInterface()->Done();
+    pNode->mgr()->GetDasherInterface()->GetActiveInputMethod()->pause();
+  }
+};
+
 class Pause : public CControlBase::Action{
 public:
   void happen(CControlBase::CContNode *pNode) {
@@ -342,10 +351,9 @@ CControlManager::CControlManager(CSettingsUser *pCreateFrom, CNodeCreationManage
   m_pSpeech = new SpeechHeader(pInterface);
   m_pCopy = new CopyHeader(pInterface);
   SetRootTemplate(new NodeTemplate("",8)); //default NodeTemplate does nothing
-  GetRootTemplate()->successors.push_back(NULL);
 
   // Key in actions map is name plus arguments in alphabetical order.
-  m_actions["stop"] = new MethodAction<CDasherInterfaceBase>(pInterface, &CDasherInterfaceBase::Done);
+  m_actions["stop"] = new Stop();
   m_actions["pause"] = new Pause();
   if (pInterface->SupportsSpeech()) {
     m_actions["speak what=all"] = new TextDistanceAction(m_pSpeech, EDIT_FILE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]