Mercurial > hg > svgui
comparison widgets/TipDialog.cpp @ 587:4806715f7a19
Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author | Chris Cannam |
---|---|
date | Tue, 14 Jun 2011 15:27:05 +0100 |
parents | f4960f8ce798 |
children | d632a1e87018 |
comparison
equal
deleted
inserted
replaced
586:1ae54a29e59e | 587:4806715f7a19 |
---|---|
112 } | 112 } |
113 | 113 |
114 void | 114 void |
115 TipDialog::readTips() | 115 TipDialog::readTips() |
116 { | 116 { |
117 DEBUG << "TipDialog::readTips" << endl; | 117 SVDEBUG << "TipDialog::readTips" << endl; |
118 | 118 |
119 QString language = QLocale::system().name(); | 119 QString language = QLocale::system().name(); |
120 QString filename = QString(":i18n/tips_%1.xml").arg(language); | 120 QString filename = QString(":i18n/tips_%1.xml").arg(language); |
121 | 121 |
122 if (!QFileInfo(filename).exists()) { | 122 if (!QFileInfo(filename).exists()) { |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 QFile file(filename); | 135 QFile file(filename); |
136 | 136 |
137 DEBUG << "TipDialog::readTips from " << filename << endl; | 137 SVDEBUG << "TipDialog::readTips from " << filename << endl; |
138 | 138 |
139 QXmlInputSource source(&file); | 139 QXmlInputSource source(&file); |
140 | 140 |
141 TipFileParser parser(this); | 141 TipFileParser parser(this); |
142 parser.parse(source); | 142 parser.parse(source); |
186 const QString &qName, | 186 const QString &qName, |
187 const QXmlAttributes &attributes) | 187 const QXmlAttributes &attributes) |
188 { | 188 { |
189 QString name = qName.toLower(); | 189 QString name = qName.toLower(); |
190 | 190 |
191 DEBUG << "TipFileParser::startElement(" << name << ")" << endl; | 191 SVDEBUG << "TipFileParser::startElement(" << name << ")" << endl; |
192 | 192 |
193 if (name == "tips") { | 193 if (name == "tips") { |
194 QString caption = attributes.value("caption"); | 194 QString caption = attributes.value("caption"); |
195 DEBUG << "TipFileParser::caption = " << caption << endl; | 195 SVDEBUG << "TipFileParser::caption = " << caption << endl; |
196 if (caption != "") m_dialog->m_caption = caption; | 196 if (caption != "") m_dialog->m_caption = caption; |
197 } else if (name == "tip") { | 197 } else if (name == "tip") { |
198 if (m_inTip) { | 198 if (m_inTip) { |
199 std::cerr << "WARNING: TipFileParser: nested <tip> elements" << std::endl; | 199 std::cerr << "WARNING: TipFileParser: nested <tip> elements" << std::endl; |
200 } | 200 } |
222 " " + attributes.qName(i) + "=\"" + attributes.value(i) + "\""; | 222 " " + attributes.qName(i) + "=\"" + attributes.value(i) + "\""; |
223 } | 223 } |
224 m_dialog->m_tips[m_dialog->m_tips.size()-1] += ">"; | 224 m_dialog->m_tips[m_dialog->m_tips.size()-1] += ">"; |
225 } | 225 } |
226 | 226 |
227 DEBUG << "TipFileParser::startElement done" << endl; | 227 SVDEBUG << "TipFileParser::startElement done" << endl; |
228 return true; | 228 return true; |
229 } | 229 } |
230 | 230 |
231 bool | 231 bool |
232 TipDialog::TipFileParser::endElement(const QString &, const QString &, | 232 TipDialog::TipFileParser::endElement(const QString &, const QString &, |
261 } | 261 } |
262 | 262 |
263 bool | 263 bool |
264 TipDialog::TipFileParser::characters(const QString &text) | 264 TipDialog::TipFileParser::characters(const QString &text) |
265 { | 265 { |
266 DEBUG << "TipFileParser::characters(" << text << ")" << endl; | 266 SVDEBUG << "TipFileParser::characters(" << text << ")" << endl; |
267 | 267 |
268 if (m_inText || m_inHtml) { | 268 if (m_inText || m_inHtml) { |
269 m_dialog->m_tips[m_dialog->m_tips.size()-1] += text; | 269 m_dialog->m_tips[m_dialog->m_tips.size()-1] += text; |
270 } | 270 } |
271 | 271 |