comparison widgets/TipDialog.cpp @ 706:97ea68f62c1f imaf_enc

Merge from default branch
author Chris Cannam
date Thu, 05 Dec 2013 09:47:02 +0000
parents 1a0dfcbffaf1
children 4a578a360011
comparison
equal deleted inserted replaced
678:26c5f7fd4807 706:97ea68f62c1f
144 144
145 void 145 void
146 TipDialog::showTip() 146 TipDialog::showTip()
147 { 147 {
148 if (m_tipNumber < int(m_tips.size())) { 148 if (m_tipNumber < int(m_tips.size())) {
149 std::cerr << "Tip " << m_tipNumber << " is: " << m_tips[m_tipNumber] << std::endl; 149 cerr << "Tip " << m_tipNumber << " is: " << m_tips[m_tipNumber] << endl;
150 m_label->setText(m_tips[m_tipNumber]); 150 m_label->setText(m_tips[m_tipNumber]);
151 } else { 151 } else {
152 accept(); 152 accept();
153 } 153 }
154 154
194 QString caption = attributes.value("caption"); 194 QString caption = attributes.value("caption");
195 SVDEBUG << "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 cerr << "WARNING: TipFileParser: nested <tip> elements" << endl;
200 } 200 }
201 m_inTip = true; 201 m_inTip = true;
202 } else if (name == "text") { 202 } else if (name == "text") {
203 if (m_inTip) { 203 if (m_inTip) {
204 m_inText = true; 204 m_inText = true;
205 std::cerr << "TipFileParser: adding new tip" << std::endl; 205 cerr << "TipFileParser: adding new tip" << endl;
206 m_dialog->m_tips.push_back(""); 206 m_dialog->m_tips.push_back("");
207 } else { 207 } else {
208 std::cerr << "WARNING: TipFileParser: <text> outside <tip> element" << std::endl; 208 cerr << "WARNING: TipFileParser: <text> outside <tip> element" << endl;
209 } 209 }
210 } else if (name == "html") { 210 } else if (name == "html") {
211 if (m_inTip) { 211 if (m_inTip) {
212 m_inHtml = true; 212 m_inHtml = true;
213 std::cerr << "TipFileParser: adding new tip" << std::endl; 213 cerr << "TipFileParser: adding new tip" << endl;
214 m_dialog->m_tips.push_back(""); 214 m_dialog->m_tips.push_back("");
215 } else { 215 } else {
216 std::cerr << "WARNING: TipFileParser: <html> outside <tip> element" << std::endl; 216 cerr << "WARNING: TipFileParser: <html> outside <tip> element" << endl;
217 } 217 }
218 } else if (m_inHtml) { 218 } else if (m_inHtml) {
219 m_dialog->m_tips[m_dialog->m_tips.size()-1] += "<" + qName; 219 m_dialog->m_tips[m_dialog->m_tips.size()-1] += "<" + qName;
220 for (int i = 0; i < attributes.count(); ++i) { 220 for (int i = 0; i < attributes.count(); ++i) {
221 m_dialog->m_tips[m_dialog->m_tips.size()-1] += 221 m_dialog->m_tips[m_dialog->m_tips.size()-1] +=
234 { 234 {
235 QString name = qName.toLower(); 235 QString name = qName.toLower();
236 236
237 if (name == "text") { 237 if (name == "text") {
238 if (!m_inText) { 238 if (!m_inText) {
239 std::cerr << "WARNING: TipFileParser: </text> without <text>" << std::endl; 239 cerr << "WARNING: TipFileParser: </text> without <text>" << endl;
240 } 240 }
241 m_inText = false; 241 m_inText = false;
242 } else if (name == "html") { 242 } else if (name == "html") {
243 if (!m_inHtml) { 243 if (!m_inHtml) {
244 std::cerr << "WARNING: TipFileParser: </html> without <html>" << std::endl; 244 cerr << "WARNING: TipFileParser: </html> without <html>" << endl;
245 } 245 }
246 m_inHtml = false; 246 m_inHtml = false;
247 } else if (name == "tip") { 247 } else if (name == "tip") {
248 if (m_inText) { 248 if (m_inText) {
249 std::cerr << "WARNING: TipFileParser: <text> without </text>" << std::endl; 249 cerr << "WARNING: TipFileParser: <text> without </text>" << endl;
250 } else if (m_inHtml) { 250 } else if (m_inHtml) {
251 std::cerr << "WARNING: TipFileParser: <html> without </html>" << std::endl; 251 cerr << "WARNING: TipFileParser: <html> without </html>" << endl;
252 } else if (!m_inTip) { 252 } else if (!m_inTip) {
253 std::cerr << "WARNING: TipFileParser: </tip> without <tip>" << std::endl; 253 cerr << "WARNING: TipFileParser: </tip> without <tip>" << endl;
254 } 254 }
255 m_inTip = false; 255 m_inTip = false;
256 } else if (m_inHtml) { 256 } else if (m_inHtml) {
257 m_dialog->m_tips[m_dialog->m_tips.size()-1] += "</" + qName + ">"; 257 m_dialog->m_tips[m_dialog->m_tips.size()-1] += "</" + qName + ">";
258 } 258 }
278 QString errorString = 278 QString errorString =
279 QString("ERROR: TipFileParser: %1 at line %2, column %3") 279 QString("ERROR: TipFileParser: %1 at line %2, column %3")
280 .arg(exception.message()) 280 .arg(exception.message())
281 .arg(exception.lineNumber()) 281 .arg(exception.lineNumber())
282 .arg(exception.columnNumber()); 282 .arg(exception.columnNumber());
283 std::cerr << errorString << std::endl; 283 cerr << errorString << endl;
284 return QXmlDefaultHandler::error(exception); 284 return QXmlDefaultHandler::error(exception);
285 } 285 }
286 286
287 bool 287 bool
288 TipDialog::TipFileParser::fatalError(const QXmlParseException &exception) 288 TipDialog::TipFileParser::fatalError(const QXmlParseException &exception)
290 QString errorString = 290 QString errorString =
291 QString("FATAL ERROR: TipFileParser: %1 at line %2, column %3") 291 QString("FATAL ERROR: TipFileParser: %1 at line %2, column %3")
292 .arg(exception.message()) 292 .arg(exception.message())
293 .arg(exception.lineNumber()) 293 .arg(exception.lineNumber())
294 .arg(exception.columnNumber()); 294 .arg(exception.columnNumber());
295 std::cerr << errorString << std::endl; 295 cerr << errorString << endl;
296 return QXmlDefaultHandler::fatalError(exception); 296 return QXmlDefaultHandler::fatalError(exception);
297 } 297 }