changeset 213:28525223b3c0 Dev_main

Added common interface to specification to handle global interface-specific functions such as checks for playback.
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Tue, 16 Jun 2015 15:44:02 +0100
parents 5d251b4aabd6
children 7c93a516b748
files core.js example_eval/project.xml
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Tue Jun 16 14:38:47 2015 +0100
+++ b/core.js	Tue Jun 16 15:44:02 2015 +0100
@@ -1201,6 +1201,7 @@
 	// Handles the decoding of the project specification XML into a simple JavaScript Object.
 	
 	this.interfaceType;
+	this.commonInterface;
 	this.projectReturn;
 	this.randomiseOrder;
 	this.collectMetrics;
@@ -1233,6 +1234,30 @@
 			}
 		}
 		
+		var commonInterfaceNode = setupNode.getElementsByTagName('interface');
+		if (commonInterfaceNode.length > 0) {
+			commonInterfaceNode = commonInterfaceNode[0];
+		} else {
+			commonInterfaceNode = undefined;
+		}
+		
+		this.commonInterface = new function() {
+			this.OptionNode = function(child) {
+				this.type = child.nodeName;
+				if (this.type == 'check') {
+					this.check = child.getAttribute('name');
+				}
+			}
+			this.options = [];
+			if (commonInterfaceNode != undefined) {
+				var child = commonInterfaceNode.firstElementChild;
+				while (child != undefined) {
+					this.options.push(new this.OptionNode(child));
+					child = child.nextElementSibling;
+				}
+			}
+		};
+		
 		var audioHolders = projectXML.getElementsByTagName('audioHolder');
 		for (var i=0; i<audioHolders.length; i++) {
 			this.audioHolders.push(new this.audioHolderNode(this,audioHolders[i]));
--- a/example_eval/project.xml	Tue Jun 16 14:38:47 2015 +0100
+++ b/example_eval/project.xml	Tue Jun 16 15:44:02 2015 +0100
@@ -34,6 +34,11 @@
 			<metricEnable>elementFlagMoved</metricEnable>
 			<metricEnable>elementListenTracker</metricEnable>
 		</Metric>
+		<interface>
+			<check name="fragmentFullPlayback"/>
+			<check name="fragmentMovement"/>
+			<check name="fragmentComments"/>
+		</interface>
 	</setup>
 	<audioHolder id='test-0' hostURL="example_eval/" sampleRate="44100" randomiseOrder='true' repeatCount='0' loop='true' elementComments='true'>
 		<interface>