Mercurial > hg > svcore
comparison data/model/TextModel.h @ 302:726b32522e3f
* Phase 1 of an image layer.
author | Chris Cannam |
---|---|
date | Thu, 04 Oct 2007 16:34:11 +0000 |
parents | 7b96b3bd4bae |
children | 70a232b1f12a |
comparison
equal
deleted
inserted
replaced
301:73537d900d4b | 302:726b32522e3f |
---|---|
15 | 15 |
16 #ifndef _TEXT_MODEL_H_ | 16 #ifndef _TEXT_MODEL_H_ |
17 #define _TEXT_MODEL_H_ | 17 #define _TEXT_MODEL_H_ |
18 | 18 |
19 #include "SparseModel.h" | 19 #include "SparseModel.h" |
20 #include "base/XmlExportable.h" | |
20 #include "base/RealTime.h" | 21 #include "base/RealTime.h" |
21 | 22 |
22 /** | 23 /** |
23 * Text point type for use in a SparseModel. This represents a piece | 24 * Text point type for use in a SparseModel. This represents a piece |
24 * of text at a given time and y-value in the [0,1) range (indicative | 25 * of text at a given time and y-value in the [0,1) range (indicative |
25 * of height on the window). Intended for casual textual annotations. | 26 * of height on the window). Intended for casual textual annotations. |
26 */ | 27 */ |
27 | 28 |
28 struct TextPoint | 29 struct TextPoint : public XmlExportable |
29 { | 30 { |
30 public: | 31 public: |
31 TextPoint(long _frame) : frame(_frame), height(0.0f) { } | 32 TextPoint(long _frame) : frame(_frame), height(0.0f) { } |
32 TextPoint(long _frame, float _height, QString _label) : | 33 TextPoint(long _frame, float _height, QString _label) : |
33 frame(_frame), height(_height), label(_label) { } | 34 frame(_frame), height(_height), label(_label) { } |
40 | 41 |
41 QString toXmlString(QString indent = "", | 42 QString toXmlString(QString indent = "", |
42 QString extraAttributes = "") const | 43 QString extraAttributes = "") const |
43 { | 44 { |
44 return QString("%1<point frame=\"%2\" height=\"%3\" label=\"%4\" %5/>\n") | 45 return QString("%1<point frame=\"%2\" height=\"%3\" label=\"%4\" %5/>\n") |
45 .arg(indent).arg(frame).arg(height).arg(label).arg(extraAttributes); | 46 .arg(indent).arg(frame).arg(height) |
47 .arg(encodeEntities(label)).arg(extraAttributes); | |
46 } | 48 } |
47 | 49 |
48 QString toDelimitedDataString(QString delimiter, size_t sampleRate) const | 50 QString toDelimitedDataString(QString delimiter, size_t sampleRate) const |
49 { | 51 { |
50 QStringList list; | 52 QStringList list; |