changeset 446:aa190a6a2625

* More SelectableLabel and TransformFinder tweaking
author Chris Cannam
date Mon, 29 Sep 2008 15:06:43 +0000
parents 55cff2c6e4a0
children 804601e50fd5
files transform/TransformFactory.cpp transform/TransformFactory.h
diffstat 2 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/transform/TransformFactory.cpp	Thu Sep 25 12:44:23 2008 +0000
+++ b/transform/TransformFactory.cpp	Mon Sep 29 15:06:43 2008 +0000
@@ -24,6 +24,8 @@
 #include "vamp-sdk/PluginHostAdapter.h"
 #include "vamp-sdk/hostext/PluginWrapper.h"
 
+#include "base/XmlExportable.h"
+
 #include <iostream>
 #include <set>
 
@@ -892,16 +894,16 @@
         if (end == len) match.score += 1;
 
         if (start > prevEnd + 14) {
-//            cerr << "start = " << start << ", prevEnd = " <<prevEnd << ", length = " << len << ", text = " << text.toStdString() << endl;
             QString s = text.right((len - start) + 10);
-//            cerr << "s = " << s.toStdString() << endl;
-            s = s.left(10) + "<b>" + s.left(klen + 10).right(klen) + "</b>";
-//            cerr << "s = " << s.toStdString() << endl;
+            s = XmlExportable::encodeEntities(s.left(10)) + "<b>" +
+                XmlExportable::encodeEntities(s.left(klen + 10).right(klen))
+                + "</b>";
             fragment += tr("...%1").arg(s);
-//            cerr << "fragment = " << fragment.toStdString() << endl;
         } else {
             QString s = text.right(len - prevEnd);
-            s = s.left(start - prevEnd) + "<b>" + s.left(end - prevEnd).right(klen) + "</b>";
+            s = XmlExportable::encodeEntities(s.left(start - prevEnd)) + "<b>" +
+                XmlExportable::encodeEntities(s.left(end - prevEnd).right(klen))
+                + "</b>";
             fragment += s;
         }
 
@@ -910,7 +912,8 @@
 
     if (prevEnd > 0 && prevEnd < len) {
         int n = len - prevEnd;
-        fragment += text.right(n).left(n < 8 ? n : 8);
+        fragment +=
+            XmlExportable::encodeEntities(text.right(n).left(n < 8 ? n : 8));
     }
 
     if (fragment != "") {
--- a/transform/TransformFactory.h	Thu Sep 25 12:44:23 2008 +0000
+++ b/transform/TransformFactory.h	Mon Sep 29 15:06:43 2008 +0000
@@ -53,7 +53,7 @@
         Match(const Match &m) :
             transform(m.transform), score(m.score), fragments(m.fragments) { }
 
-        bool operator<(const Match &m) const;
+        bool operator<(const Match &m) const; // sort by score first
     };
 
     typedef std::map<TransformId, Match> SearchResults;