comparison plugin/PluginXml.cpp @ 81:f277a171749d

* Pull out temporary directory management into its own class * Make sure playback plugins get a default sample path in their original play parameters configuration * Save play parameters to .sv file (we aren't reloading yet though)
author Chris Cannam
date Tue, 25 Apr 2006 22:14:43 +0000
parents 163f3428bbe0
children c30728d5625c
comparison
equal deleted inserted replaced
80:8739096929dd 81:f277a171749d
34 } 34 }
35 35
36 PluginXml::~PluginXml() { } 36 PluginXml::~PluginXml() { }
37 37
38 QString 38 QString
39 PluginXml::encodeConfigurationChars(QString text)
40 {
41 QString rv(text);
42 rv.replace(";", "[[SEMICOLON]]");
43 rv.replace("=", "[[EQUALS]]");
44 return rv;
45 }
46
47 QString
48 PluginXml::decodeConfigurationChars(QString text)
49 {
50 QString rv(text);
51 rv.replace("[[SEMICOLON]]", ";");
52 rv.replace("[[EQUALS]]", "=");
53 return rv;
54 }
55
56 QString
39 PluginXml::toXmlString(QString indent, QString extraAttributes) const 57 PluginXml::toXmlString(QString indent, QString extraAttributes) const
40 { 58 {
41 QString s; 59 QString s;
42 s += indent; 60 s += indent;
43 61
72 QString config; 90 QString config;
73 for (std::map<std::string, std::string>::iterator i = configurePairs.begin(); 91 for (std::map<std::string, std::string>::iterator i = configurePairs.begin();
74 i != configurePairs.end(); ++i) { 92 i != configurePairs.end(); ++i) {
75 QString key = i->first.c_str(); 93 QString key = i->first.c_str();
76 QString value = i->second.c_str(); 94 QString value = i->second.c_str();
77 key.replace(";", "[[SEMICOLON]]"); 95 key = encodeConfigurationChars(key);
78 key.replace("=", "[[EQUALS]]"); 96 value = encodeConfigurationChars(value);
79 value.replace(";", "[[SEMICOLON]]");
80 value.replace("=", "[[EQUALS]]");
81 if (config != "") config += ";"; 97 if (config != "") config += ";";
82 config += QString("%1=%2").arg(key).arg(value); 98 config += QString("%1=%2").arg(key).arg(value);
83 } 99 }
84 if (config != "") { 100 if (config != "") {
85 s += QString("configuration=\"%1\" ") 101 s += QString("configuration=\"%1\" ")
126 if (kv.count() < 2) { 142 if (kv.count() < 2) {
127 std::cerr << "WARNING: PluginXml::setParameters: Malformed configure pair string: \"" << i->toStdString() << "\"" << std::endl; 143 std::cerr << "WARNING: PluginXml::setParameters: Malformed configure pair string: \"" << i->toStdString() << "\"" << std::endl;
128 continue; 144 continue;
129 } 145 }
130 QString key(kv[0]), value(kv[1]); 146 QString key(kv[0]), value(kv[1]);
131 key.replace("[[SEMICOLON]]", ";"); 147 key = decodeConfigurationChars(key);
132 key.replace("[[EQUALS]]", ";"); 148 value = decodeConfigurationChars(value);
133 value.replace("[[SEMICOLON]]", ";");
134 value.replace("[[SEMICOLON]]", ";");
135 rtpi->configure(key.toStdString(), value.toStdString()); 149 rtpi->configure(key.toStdString(), value.toStdString());
136 } 150 }
137 } 151 }
138 } 152 }
139 153