From 7d8e7d253334e97b8cdd02b938fbdbb931a19bd3 Mon Sep 17 00:00:00 2001
From: Josh Siegle <jsiegle@mit.edu>
Date: Sun, 22 Sep 2013 10:44:33 +0200
Subject: [PATCH] Add parameter saving to RecordControlEditor

---
 .../Editors/RecordControlEditor.cpp           | 30 ++++++++++++++++++-
 .../Processors/Editors/RecordControlEditor.h  |  2 ++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/Source/Processors/Editors/RecordControlEditor.cpp b/Source/Processors/Editors/RecordControlEditor.cpp
index 56aab0471..8ce09d5b9 100644
--- a/Source/Processors/Editors/RecordControlEditor.cpp
+++ b/Source/Processors/Editors/RecordControlEditor.cpp
@@ -62,7 +62,7 @@ RecordControlEditor::RecordControlEditor(GenericProcessor* parentNode, bool useD
 
 RecordControlEditor::~RecordControlEditor()
 {
-    //deleteAllChildren();
+    
 }
 
 void RecordControlEditor::comboBoxChanged(ComboBox* comboBox)
@@ -96,4 +96,32 @@ void RecordControlEditor::updateSettings()
         availableChans->addItem(channelName,i+1);
     }
 
+}
+
+void RecordControlEditor::saveEditorParameters(XmlElement* xml)
+{
+    
+    XmlElement* info = xml->createNewChildElement("PARAMETERS");
+    
+    info->setAttribute("Type", "RecordControlEditor");
+    info->setAttribute("Channel",availableChans->getSelectedId());
+    info->setAttribute("FileSaveOption",newFileToggleButton->getToggleState());
+    
+}
+
+void RecordControlEditor::loadEditorParameters(XmlElement* xml)
+{
+     
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        
+        if (xmlNode->hasTagName("PARAMETERS"))
+        {
+        
+            newFileToggleButton->setToggleState(xmlNode->getBoolAttribute("FileSaveOption"), true);
+            availableChans->setSelectedId(xmlNode->getIntAttribute("Channel"));
+            
+        }
+
+    }
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/RecordControlEditor.h b/Source/Processors/Editors/RecordControlEditor.h
index 011ec844c..4fcc99a6a 100644
--- a/Source/Processors/Editors/RecordControlEditor.h
+++ b/Source/Processors/Editors/RecordControlEditor.h
@@ -44,6 +44,8 @@ public:
     void comboBoxChanged(ComboBox* comboBox);
     void updateSettings();
     void buttonEvent(Button* button);
+    void loadEditorParameters(XmlElement*);
+    void saveEditorParameters(XmlElement*);
 
 private:
     ScopedPointer<ComboBox> availableChans;
-- 
GitLab