comparison 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
comparison
equal deleted inserted replaced
2:d86891498eef 3:581f67f370f3
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 A waveform viewer and audio annotation editor.
5 Chris Cannam, Queen Mary University of London, 2005-2006
6
7 This is experimental software. Not for distribution.
8 */
9
10 #include "XmlExportable.h"
11
12 QString
13 XmlExportable::encodeEntities(QString s)
14 {
15 s
16 .replace("&", "&")
17 .replace("<", "&lt;")
18 .replace(">", "&gt;")
19 .replace("\"", "&quot;")
20 .replace("'", "&apos;");
21
22 return s;
23 }
24
25 QString
26 XmlExportable::encodeColour(QColor c)
27 {
28 QString r, g, b;
29
30 r.setNum(c.red(), 16);
31 if (c.red() < 16) r = "0" + r;
32
33 g.setNum(c.green(), 16);
34 if (c.green() < 16) g = "0" + g;
35
36 b.setNum(c.blue(), 16);
37 if (c.blue() < 16) b = "0" + b;
38
39 return "#" + r + g + b;
40 }
41