Skip to content

Commit

Permalink
DasherInterface->Done was not really stopping dasher.
Browse files Browse the repository at this point in the history
fixes #90
  • Loading branch information
ipomoena committed Mar 5, 2016
1 parent ba39d7e commit c8871d2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Src/DasherCore/ControlManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ class TextDistanceAction : public CControlBase::Action {
}
};

// 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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c8871d2

Please sign in to comment.