Mercurial > hg > easaier-soundaccess
comparison data/fileio/QueryConfigReader.cpp @ 227:59d84a8bb76c
compatibility with changes done for the web site:
- easaier servlet name changed
- new queryfield.xml ("range" attributes form)
author | lbajardsilogic |
---|---|
date | Wed, 27 Feb 2008 16:00:02 +0000 |
parents | 11e298cdb9e7 |
children |
comparison
equal
deleted
inserted
replaced
226:4a157a863e87 | 227:59d84a8bb76c |
---|---|
44 } | 44 } |
45 | 45 |
46 QueryConfigHandler::QueryConfigHandler(QueryModel * queryModel) : QXmlDefaultHandler(), | 46 QueryConfigHandler::QueryConfigHandler(QueryModel * queryModel) : QXmlDefaultHandler(), |
47 m_inTheme(false), | 47 m_inTheme(false), |
48 m_inFieldGroup(false), | 48 m_inFieldGroup(false), |
49 m_inBinding(false), | |
50 m_propertyName(""), | |
49 m_queryModel(queryModel) | 51 m_queryModel(queryModel) |
50 {} | 52 {} |
51 | 53 |
52 bool QueryConfigHandler::startElement(const QString &namespaceURI, const QString &localName, | 54 bool QueryConfigHandler::startElement(const QString &namespaceURI, const QString &localName, |
53 const QString &qName, const QXmlAttributes &attributes) | 55 const QString &qName, const QXmlAttributes &attributes) |
82 ok = true; | 84 ok = true; |
83 | 85 |
84 } else if (name == "field") { | 86 } else if (name == "field") { |
85 | 87 |
86 ok = true; | 88 ok = true; |
87 QString name = attributes.value("name"); | 89 m_propertyName = attributes.value("name"); |
88 QString label = attributes.value("label"); | 90 QString label = attributes.value("label"); |
89 QString type = attributes.value("xsi:type"); | 91 QString type = attributes.value("xsi:type"); |
90 QString range = attributes.value("range"); | 92 QString range = attributes.value("range"); |
91 QString unit = attributes.value("unit"); | 93 QString unit = attributes.value("unit"); |
92 QString comment = attributes.value("comment"); | 94 QString comment = attributes.value("comment"); |
93 m_queryModel->addProperty(name, label, type, range, unit, comment); | 95 m_queryModel->addProperty(m_propertyName, label, type, range, unit, comment); |
94 | 96 |
95 } | 97 } else if (name == "range") { |
98 | |
99 m_inBinding = true; | |
100 ok = true; | |
101 } | |
96 | 102 |
97 if (!ok) { | 103 if (!ok) { |
98 std::cerr << "WARNING: QueryConfigReader-XML: Failed to completely process element \"" | 104 std::cerr << "WARNING: QueryConfigReader-XML: Failed to completely process element \"" |
99 << name.toLocal8Bit().data() << "\"" << std::endl; | 105 << name.toLocal8Bit().data() << "\"" << std::endl; |
100 } | 106 } |
113 } | 119 } |
114 else if (name == "fieldgroup") | 120 else if (name == "fieldgroup") |
115 { | 121 { |
116 m_inFieldGroup = false; | 122 m_inFieldGroup = false; |
117 } | 123 } |
124 else if (name == "range") | |
125 { | |
126 m_inBinding = false; | |
127 } | |
118 | 128 |
119 return true; | 129 return true; |
120 } | 130 } |
121 | 131 |
122 bool QueryConfigHandler::characters(const QString &str) | 132 bool QueryConfigHandler::characters(const QString &str) |
123 { | 133 { |
124 bool ok = false; | 134 bool ok = false; |
135 | |
136 if (m_inBinding) | |
137 { | |
138 m_queryModel->addRange(m_propertyName, str); | |
139 } | |
125 | 140 |
126 return true; | 141 return true; |
127 } | 142 } |
128 | 143 |
129 bool QueryConfigHandler::error(const QXmlParseException &exception) | 144 bool QueryConfigHandler::error(const QXmlParseException &exception) |