annotate base/XmlExportable.cpp @ 3:581f67f370f3
* Beginnings of session save code
* Add spline curve mode to time value layer
author |
Chris Cannam |
date |
Thu, 12 Jan 2006 17:19:08 +0000 |
parents |
|
children |
149bb02a41ba |
rev |
line source |
Chris@3
|
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@3
|
2
|
Chris@3
|
3 /*
|
Chris@3
|
4 A waveform viewer and audio annotation editor.
|
Chris@3
|
5 Chris Cannam, Queen Mary University of London, 2005-2006
|
Chris@3
|
6
|
Chris@3
|
7 This is experimental software. Not for distribution.
|
Chris@3
|
8 */
|
Chris@3
|
9
|
Chris@3
|
10 #include "XmlExportable.h"
|
Chris@3
|
11
|
Chris@3
|
12 QString
|
Chris@3
|
13 XmlExportable::encodeEntities(QString s)
|
Chris@3
|
14 {
|
Chris@3
|
15 s
|
Chris@3
|
16 .replace("&", "&")
|
Chris@3
|
17 .replace("<", "<")
|
Chris@3
|
18 .replace(">", ">")
|
Chris@3
|
19 .replace("\"", """)
|
Chris@3
|
20 .replace("'", "'");
|
Chris@3
|
21
|
Chris@3
|
22 return s;
|
Chris@3
|
23 }
|
Chris@3
|
24
|
Chris@3
|
25 QString
|
Chris@3
|
26 XmlExportable::encodeColour(QColor c)
|
Chris@3
|
27 {
|
Chris@3
|
28 QString r, g, b;
|
Chris@3
|
29
|
Chris@3
|
30 r.setNum(c.red(), 16);
|
Chris@3
|
31 if (c.red() < 16) r = "0" + r;
|
Chris@3
|
32
|
Chris@3
|
33 g.setNum(c.green(), 16);
|
Chris@3
|
34 if (c.green() < 16) g = "0" + g;
|
Chris@3
|
35
|
Chris@3
|
36 b.setNum(c.blue(), 16);
|
Chris@3
|
37 if (c.blue() < 16) b = "0" + b;
|
Chris@3
|
38
|
Chris@3
|
39 return "#" + r + g + b;
|
Chris@3
|
40 }
|
Chris@3
|
41
|