Mercurial > hg > svcore
comparison transform/TransformFactory.cpp @ 446:aa190a6a2625
* More SelectableLabel and TransformFinder tweaking
author | Chris Cannam |
---|---|
date | Mon, 29 Sep 2008 15:06:43 +0000 (2008-09-29) |
parents | 14521503f196 |
children | 804601e50fd5 |
comparison
equal
deleted
inserted
replaced
445:55cff2c6e4a0 | 446:aa190a6a2625 |
---|---|
21 #include "plugin/PluginXml.h" | 21 #include "plugin/PluginXml.h" |
22 | 22 |
23 #include "vamp-sdk/Plugin.h" | 23 #include "vamp-sdk/Plugin.h" |
24 #include "vamp-sdk/PluginHostAdapter.h" | 24 #include "vamp-sdk/PluginHostAdapter.h" |
25 #include "vamp-sdk/hostext/PluginWrapper.h" | 25 #include "vamp-sdk/hostext/PluginWrapper.h" |
26 | |
27 #include "base/XmlExportable.h" | |
26 | 28 |
27 #include <iostream> | 29 #include <iostream> |
28 #include <set> | 30 #include <set> |
29 | 31 |
30 #include <QRegExp> | 32 #include <QRegExp> |
890 | 892 |
891 if (start == 0) match.score += 1; | 893 if (start == 0) match.score += 1; |
892 if (end == len) match.score += 1; | 894 if (end == len) match.score += 1; |
893 | 895 |
894 if (start > prevEnd + 14) { | 896 if (start > prevEnd + 14) { |
895 // cerr << "start = " << start << ", prevEnd = " <<prevEnd << ", length = " << len << ", text = " << text.toStdString() << endl; | |
896 QString s = text.right((len - start) + 10); | 897 QString s = text.right((len - start) + 10); |
897 // cerr << "s = " << s.toStdString() << endl; | 898 s = XmlExportable::encodeEntities(s.left(10)) + "<b>" + |
898 s = s.left(10) + "<b>" + s.left(klen + 10).right(klen) + "</b>"; | 899 XmlExportable::encodeEntities(s.left(klen + 10).right(klen)) |
899 // cerr << "s = " << s.toStdString() << endl; | 900 + "</b>"; |
900 fragment += tr("...%1").arg(s); | 901 fragment += tr("...%1").arg(s); |
901 // cerr << "fragment = " << fragment.toStdString() << endl; | |
902 } else { | 902 } else { |
903 QString s = text.right(len - prevEnd); | 903 QString s = text.right(len - prevEnd); |
904 s = s.left(start - prevEnd) + "<b>" + s.left(end - prevEnd).right(klen) + "</b>"; | 904 s = XmlExportable::encodeEntities(s.left(start - prevEnd)) + "<b>" + |
905 XmlExportable::encodeEntities(s.left(end - prevEnd).right(klen)) | |
906 + "</b>"; | |
905 fragment += s; | 907 fragment += s; |
906 } | 908 } |
907 | 909 |
908 prevEnd = end; | 910 prevEnd = end; |
909 } | 911 } |
910 | 912 |
911 if (prevEnd > 0 && prevEnd < len) { | 913 if (prevEnd > 0 && prevEnd < len) { |
912 int n = len - prevEnd; | 914 int n = len - prevEnd; |
913 fragment += text.right(n).left(n < 8 ? n : 8); | 915 fragment += |
916 XmlExportable::encodeEntities(text.right(n).left(n < 8 ? n : 8)); | |
914 } | 917 } |
915 | 918 |
916 if (fragment != "") { | 919 if (fragment != "") { |
917 match.fragments[textType] = fragment; | 920 match.fragments[textType] = fragment; |
918 } | 921 } |