Replace std::cout and std::cerr with qDebug and qWarning.
This commit is contained in:
+49
-53
@@ -21,7 +21,7 @@
|
||||
#include "Db.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <iostream>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "Config.h"
|
||||
#include "StrUtil.h"
|
||||
@@ -77,7 +77,7 @@ namespace libglabels
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug( "Duplicate paper ID: \"%s\".", qPrintable(paper->id()) );
|
||||
qWarning() << "Duplicate paper ID: " << paper->id();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace libglabels
|
||||
{
|
||||
if ( name.isNull() || name.isEmpty() )
|
||||
{
|
||||
qDebug( "NULL paper name." );
|
||||
qWarning() << "NULL paper name.";
|
||||
return mPapers.first();
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown paper name: \"%s\".", qPrintable(name) );
|
||||
qWarning() << "Unknown paper name: " << name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace libglabels
|
||||
{
|
||||
if ( id.isNull() || id.isEmpty() )
|
||||
{
|
||||
qDebug( "NULL paper ID." );
|
||||
qWarning() << "NULL paper ID.";
|
||||
return mPapers.first();
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown paper ID: \"%s\".", qPrintable(id) );
|
||||
qWarning() << "Unknown paper ID: " << id;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown paper name: \"%s\".", qPrintable(name) );
|
||||
qWarning() << "Unknown paper name: " << name;
|
||||
return mEmpty;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown paper id: \"%s\".", qPrintable(id) );
|
||||
qWarning() << "Unknown paper id: " << id;
|
||||
return mEmpty;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace libglabels
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug( "Duplicate category ID: \"%s\".", qPrintable(category->id()) );
|
||||
qWarning() << "Duplicate category ID: " << category->id();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace libglabels
|
||||
{
|
||||
if ( name.isNull() || name.isEmpty() )
|
||||
{
|
||||
qDebug( "NULL category name." );
|
||||
qWarning() << "NULL category name.";
|
||||
return mCategories.first();
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown category name: \"%s\".", qPrintable(name) );
|
||||
qWarning() << "Unknown category name: \"%s\"." << name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace libglabels
|
||||
{
|
||||
if ( id.isNull() || id.isEmpty() )
|
||||
{
|
||||
qDebug( "NULL category ID." );
|
||||
qDebug() << "NULL category ID.";
|
||||
return mCategories.first();
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown category ID: \"%s\".", qPrintable(id) );
|
||||
qWarning() << "Unknown category ID: " << id;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown category name: \"%s\".", qPrintable(name) );
|
||||
qWarning() << "Unknown category name: " << name;
|
||||
return mEmpty;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown category id: \"%s\".", qPrintable(id) );
|
||||
qWarning() << "Unknown category id: " << id;
|
||||
return mEmpty;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace libglabels
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug( "Duplicate vendor name: \"%s\".", qPrintable(vendor->name()) );
|
||||
qWarning() << "Duplicate vendor name: " << vendor->name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace libglabels
|
||||
{
|
||||
if ( name.isNull() || name.isEmpty() )
|
||||
{
|
||||
qDebug( "NULL vendor name." );
|
||||
qWarning() << "NULL vendor name.";
|
||||
return mVendors.first();
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown vendor name: \"%s\".", qPrintable(name) );
|
||||
qWarning() << "Unknown vendor name: " << name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown vendor name: \"%s\".", qPrintable(name) );
|
||||
qWarning() << "Unknown vendor name: " << name;
|
||||
return mEmpty;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ namespace libglabels
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug( "Duplicate template name: \"%s\".", qPrintable(tmplate->name()) );
|
||||
qWarning() << "Duplicate template name: " << tmplate->name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ namespace libglabels
|
||||
{
|
||||
if ( name.isNull() || name.isEmpty() )
|
||||
{
|
||||
qDebug( "NULL template name." );
|
||||
qWarning() << "NULL template name.";
|
||||
return mTemplates.first();
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown template name: \"%s\".", qPrintable(name) );
|
||||
qWarning() << "Unknown template name: " << name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ namespace libglabels
|
||||
{
|
||||
if ( brand.isNull() || brand.isEmpty() || part.isNull() || part.isEmpty() )
|
||||
{
|
||||
qDebug( "NULL template brand and/or part." );
|
||||
qWarning() << "NULL template brand and/or part.";
|
||||
return mTemplates.first();
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ namespace libglabels
|
||||
}
|
||||
}
|
||||
|
||||
qDebug( "Unknown template brand, part: \"%s\", \"%s\".", qPrintable(brand), qPrintable(part) );
|
||||
qWarning() << "Unknown template brand, part: " << brand << ", " << part;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ namespace libglabels
|
||||
const Template *tmplate1 = lookupTemplateFromName( name );
|
||||
if ( tmplate1 == NULL )
|
||||
{
|
||||
qDebug( "Unknown template name: \"%s\".", qPrintable(name) );
|
||||
qWarning() << "Unknown template name: " << name;
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -465,69 +465,65 @@ namespace libglabels
|
||||
|
||||
void Db::printKnownPapers()
|
||||
{
|
||||
std::cout << "KNOWN PAPERS:" << std::endl;
|
||||
qDebug() << "KNOWN PAPERS:";
|
||||
|
||||
foreach ( Paper *paper, mPapers )
|
||||
{
|
||||
std::cout << "paper "
|
||||
<< "id='" << qPrintable(paper->id()) << "', "
|
||||
<< "name='" << qPrintable(paper->name()) << "', "
|
||||
<< "width=" << paper->width() << "pts, "
|
||||
<< "height=" << paper->height() << "pts, "
|
||||
<< "pwg_size=" << qPrintable(paper->pwgSize())
|
||||
<< std::endl;
|
||||
qDebug() << "paper "
|
||||
<< "id=" << paper->id() << ", "
|
||||
<< "name=" << paper->name() << ", "
|
||||
<< "width=" << paper->width() << "pts, "
|
||||
<< "height=" << paper->height() << "pts, "
|
||||
<< "pwg_size=" << paper->pwgSize();
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
qDebug();
|
||||
}
|
||||
|
||||
|
||||
void Db::printKnownCategories()
|
||||
{
|
||||
std::cout << "KNOWN CATEGORIES:" << std::endl;
|
||||
qDebug() << "KNOWN CATEGORIES:";
|
||||
|
||||
foreach ( Category *category, mCategories )
|
||||
{
|
||||
std::cout << "category "
|
||||
<< "id='" << category->id().toStdString() << "', "
|
||||
<< "name='" << category->name().toStdString() << "', "
|
||||
<< std::endl;
|
||||
qDebug() << "category "
|
||||
<< "id=" << category->id() << ", "
|
||||
<< "name=" << category->name();
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
qDebug();
|
||||
}
|
||||
|
||||
|
||||
void Db::printKnownVendors()
|
||||
{
|
||||
std::cout << "KNOWN VENDORS:" << std::endl;
|
||||
qDebug() << "KNOWN VENDORS:";
|
||||
|
||||
foreach ( Vendor *vendor, mVendors )
|
||||
{
|
||||
std::cout << "vendor "
|
||||
<< "name='" << vendor->name().toStdString() << "', "
|
||||
<< "url='" << vendor->url().toStdString() << "'"
|
||||
<< std::endl;
|
||||
qDebug() << "vendor "
|
||||
<< "name='" << vendor->name() << ", "
|
||||
<< "url='" << vendor->url();
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
qDebug();
|
||||
}
|
||||
|
||||
|
||||
void Db::printKnownTemplates()
|
||||
{
|
||||
std::cout << "KNOWN TEMPLATES:" << std::endl;
|
||||
qDebug() << "KNOWN TEMPLATES:";
|
||||
|
||||
foreach ( Template *tmplate, mTemplates )
|
||||
{
|
||||
std::cout << "template "
|
||||
<< "brand='" << tmplate->brand().toStdString() << "', "
|
||||
<< "part='" << tmplate->part().toStdString() << "', "
|
||||
<< "description='" << tmplate->description().toStdString() << "'"
|
||||
<< std::endl;
|
||||
qDebug() << "template "
|
||||
<< "brand=" << tmplate->brand() << ", "
|
||||
<< "part=" << tmplate->part() << ", "
|
||||
<< "description=" << tmplate->description();
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
qDebug();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "Template.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "Db.h"
|
||||
|
||||
@@ -109,10 +109,9 @@ namespace libglabels
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error: cannot create equivalent template for "
|
||||
<< qPrintable(brand) << ", " << qPrintable(equivPart)
|
||||
<< ". Forward references not supported."
|
||||
<< std::endl;
|
||||
qWarning() << "Error: cannot create equivalent template for "
|
||||
<< brand << ", " << equivPart
|
||||
<< ". Forward references not supported.";
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QFile>
|
||||
#include <QDomDocument>
|
||||
#include <QDomNode>
|
||||
#include <iostream>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "Category.h"
|
||||
#include "XmlUtil.h"
|
||||
@@ -39,9 +39,8 @@ namespace libglabels
|
||||
|
||||
if ( !file.open( QFile::ReadOnly | QFile::Text) )
|
||||
{
|
||||
std::cerr << "Error: Cannot read file " << qPrintable(fileName)
|
||||
<< ": " << qPrintable(file.errorString())
|
||||
<< std::endl;
|
||||
qWarning() << "Error: Cannot read file " << fileName
|
||||
<< ": " << file.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,17 +52,16 @@ namespace libglabels
|
||||
|
||||
if ( !doc.setContent( &file, false, &errorString, &errorLine, &errorColumn ) )
|
||||
{
|
||||
std::cerr << "Error: Parse error at line " << errorLine
|
||||
<< "column " << errorColumn
|
||||
<< ": " << qPrintable(errorString)
|
||||
<< std::endl;
|
||||
qWarning() << "Error: Parse error at line " << errorLine
|
||||
<< "column " << errorColumn
|
||||
<< ": " << errorString;
|
||||
return false;
|
||||
}
|
||||
|
||||
QDomElement root = doc.documentElement();
|
||||
if ( root.tagName() != "Glabels-categories" )
|
||||
{
|
||||
std::cerr << "Error: Not a Glabels-categories file" << std::endl;
|
||||
qWarning() << "Error: Not a Glabels-categories file.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,9 +80,9 @@ namespace libglabels
|
||||
}
|
||||
else if ( !child.isComment() )
|
||||
{
|
||||
std::cerr << "Warning: bad element: " << qPrintable(child.toElement().tagName())
|
||||
<< ", Ignored"
|
||||
<< std::endl;
|
||||
qWarning() << "Warning: bad element: "
|
||||
<< child.toElement().tagName()
|
||||
<< ", Ignored.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QFile>
|
||||
#include <QDomDocument>
|
||||
#include <QDomNode>
|
||||
#include <iostream>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "Paper.h"
|
||||
#include "XmlUtil.h"
|
||||
@@ -39,9 +39,8 @@ namespace libglabels
|
||||
|
||||
if ( !file.open( QFile::ReadOnly | QFile::Text) )
|
||||
{
|
||||
std::cerr << "Error: Cannot read file " << qPrintable(fileName)
|
||||
<< ": " << qPrintable(file.errorString())
|
||||
<< std::endl;
|
||||
qWarning() << "Error: Cannot read file " << fileName
|
||||
<< ": " << file.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,17 +52,16 @@ namespace libglabels
|
||||
|
||||
if ( !doc.setContent( &file, false, &errorString, &errorLine, &errorColumn ) )
|
||||
{
|
||||
std::cerr << "Error: Parse error at line " << errorLine
|
||||
<< "column " << errorColumn
|
||||
<< ": " << qPrintable(errorString)
|
||||
<< std::endl;
|
||||
qWarning() << "Error: Parse error at line " << errorLine
|
||||
<< "column " << errorColumn
|
||||
<< ": " << errorString;
|
||||
return false;
|
||||
}
|
||||
|
||||
QDomElement root = doc.documentElement();
|
||||
if ( root.tagName() != "Glabels-paper-sizes" )
|
||||
{
|
||||
std::cerr << "Error: Not a Glabels-paper-sizes file" << std::endl;
|
||||
qWarning() << "Error: Not a Glabels-paper-sizes file.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,9 +80,9 @@ namespace libglabels
|
||||
}
|
||||
else if ( !child.isComment() )
|
||||
{
|
||||
std::cerr << "Warning: bad element: " << qPrintable(child.toElement().tagName())
|
||||
<< ", Ignored"
|
||||
<< std::endl;
|
||||
qWarning() << "Warning: bad element: "
|
||||
<< child.toElement().tagName()
|
||||
<< ", Ignored.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QFile>
|
||||
#include <QDomDocument>
|
||||
#include <QDomNode>
|
||||
#include <iostream>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "Template.h"
|
||||
#include "XmlUtil.h"
|
||||
@@ -45,9 +45,8 @@ namespace libglabels
|
||||
|
||||
if ( !file.open( QFile::ReadOnly | QFile::Text) )
|
||||
{
|
||||
std::cerr << "Error: Cannot read file " << qPrintable(fileName)
|
||||
<< ": " << qPrintable(file.errorString())
|
||||
<< std::endl;
|
||||
qWarning() << "Error: Cannot read file " << fileName
|
||||
<< ": " << file.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,17 +58,16 @@ namespace libglabels
|
||||
|
||||
if ( !doc.setContent( &file, false, &errorString, &errorLine, &errorColumn ) )
|
||||
{
|
||||
std::cerr << "Error: Parse error at line " << errorLine
|
||||
<< "column " << errorColumn
|
||||
<< ": " << qPrintable(errorString)
|
||||
<< std::endl;
|
||||
qWarning() << "Error: Parse error at line " << errorLine
|
||||
<< "column " << errorColumn
|
||||
<< ": " << errorString;
|
||||
return false;
|
||||
}
|
||||
|
||||
QDomElement root = doc.documentElement();
|
||||
if ( root.tagName() != "Glabels-templates" )
|
||||
{
|
||||
std::cerr << "Error: Not a Glabels-templates file" << std::endl;
|
||||
qWarning() << "Error: Not a Glabels-templates file";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,14 +89,14 @@ namespace libglabels
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Warning: could not create template, Ignored." << std::endl;
|
||||
qWarning() << "Warning: could not create template, Ignored.";
|
||||
}
|
||||
}
|
||||
else if ( !child.isComment() )
|
||||
{
|
||||
std::cerr << "Warning: bad element: " << qPrintable(child.toElement().tagName())
|
||||
<< ", Ignored"
|
||||
<< std::endl;
|
||||
qWarning() << "Warning: bad element: "
|
||||
<< child.toElement().tagName()
|
||||
<< ", Ignored.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +119,7 @@ namespace libglabels
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error: missing name or brand/part attributes." << std::endl;
|
||||
qWarning() << "Error: missing name or brand/part attributes.";
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -142,9 +140,9 @@ namespace libglabels
|
||||
}
|
||||
else if ( !child.isComment() )
|
||||
{
|
||||
std::cerr << "Warning: bad element: " << qPrintable(child.toElement().tagName())
|
||||
<< ", Ignored"
|
||||
<< std::endl;
|
||||
qWarning() << "Warning: bad element: "
|
||||
<< child.toElement().tagName()
|
||||
<< ", Ignored.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +156,7 @@ namespace libglabels
|
||||
const Paper *paper = Db::lookupPaperFromId( paperId );
|
||||
if ( paper == NULL )
|
||||
{
|
||||
std::cerr << "Error: unknown paper ID: " << qPrintable( paperId ) << std::endl;
|
||||
qWarning() << "Error: unknown paper ID: " << paperId;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -197,9 +195,9 @@ namespace libglabels
|
||||
}
|
||||
else if ( !child.isComment() )
|
||||
{
|
||||
std::cerr << "Warning: bad element: " << qPrintable(child.toElement().tagName())
|
||||
<< ", Ignored"
|
||||
<< std::endl;
|
||||
qWarning() << "Warning: bad element: "
|
||||
<< child.toElement().tagName()
|
||||
<< ", Ignored.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,9 +331,9 @@ namespace libglabels
|
||||
}
|
||||
else if ( !child.isComment() )
|
||||
{
|
||||
std::cerr << "Warning: bad element: " << qPrintable(child.toElement().tagName())
|
||||
<< ", Ignored"
|
||||
<< std::endl;
|
||||
qWarning() << "Warning: bad element: "
|
||||
<< child.toElement().tagName()
|
||||
<< ", Ignored.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-21
@@ -21,7 +21,7 @@
|
||||
#include "XmlUtil.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <iostream>
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
namespace libglabels
|
||||
@@ -50,10 +50,9 @@ namespace libglabels
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
std::cerr << "Error: bad double value in attribute "
|
||||
<< qPrintable( node.tagName() ) << ":" << qPrintable( name )
|
||||
<< " : '" << qPrintable( valueString ) << "'"
|
||||
<< std:: endl;
|
||||
qWarning() << "Error: bad double value in attribute "
|
||||
<< node.tagName() << ":" << name
|
||||
<< " : " << valueString;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
@@ -89,10 +88,9 @@ namespace libglabels
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "Error: bad boolean value in attribute "
|
||||
<< qPrintable( node.tagName() ) << ":" << qPrintable( name )
|
||||
<< " : '" << qPrintable( valueString ) << "'"
|
||||
<< std:: endl;
|
||||
qWarning() << "Error: bad boolean value in attribute "
|
||||
<< node.tagName() << ":" << name
|
||||
<< " : " << valueString;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
@@ -112,10 +110,9 @@ namespace libglabels
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
std::cerr << "Error: bad integer value in attribute "
|
||||
<< qPrintable( node.tagName() ) << ":" << qPrintable( name )
|
||||
<< " : '" << qPrintable( valueString ) << "'"
|
||||
<< std:: endl;
|
||||
qWarning() << "Error: bad integer value in attribute "
|
||||
<< node.tagName() << ":" << name
|
||||
<< " : " << valueString;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
@@ -139,10 +136,9 @@ namespace libglabels
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
std::cerr << "Error: bad unsigned integer value in attribute "
|
||||
<< qPrintable( node.tagName() ) << ":" << qPrintable( name )
|
||||
<< " : '" << qPrintable( valueString ) << "'"
|
||||
<< std:: endl;
|
||||
qWarning() << "Error: bad unsigned integer value in attribute "
|
||||
<< node.tagName() << ":" << name
|
||||
<< " : " << valueString;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
@@ -184,10 +180,9 @@ namespace libglabels
|
||||
|
||||
if ( !Units::isIdValid( unitsString ) )
|
||||
{
|
||||
std::cerr << "Error: bad length value in attribute "
|
||||
<< qPrintable( node.tagName() ) << ":" << qPrintable( name )
|
||||
<< " : '" << qPrintable( valueString ) << "'"
|
||||
<< std:: endl;
|
||||
qWarning() << "Error: bad length value in attribute "
|
||||
<< node.tagName() << ":" << name
|
||||
<< " : " << valueString;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QFile>
|
||||
#include <QDomDocument>
|
||||
#include <QDomNode>
|
||||
#include <iostream>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "Vendor.h"
|
||||
#include "XmlUtil.h"
|
||||
@@ -39,9 +39,8 @@ namespace libglabels
|
||||
|
||||
if ( !file.open( QFile::ReadOnly | QFile::Text) )
|
||||
{
|
||||
std::cerr << "Error: Cannot read file " << qPrintable(fileName)
|
||||
<< ": " << qPrintable(file.errorString())
|
||||
<< std::endl;
|
||||
qWarning() << "Error: Cannot read file " << fileName
|
||||
<< ": " << file.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,17 +52,16 @@ namespace libglabels
|
||||
|
||||
if ( !doc.setContent( &file, false, &errorString, &errorLine, &errorColumn ) )
|
||||
{
|
||||
std::cerr << "Error: Parse error at line " << errorLine
|
||||
<< "column " << errorColumn
|
||||
<< ": " << qPrintable(errorString)
|
||||
<< std::endl;
|
||||
qWarning() << "Error: Parse error at line " << errorLine
|
||||
<< "column " << errorColumn
|
||||
<< ": " << errorString;
|
||||
return false;
|
||||
}
|
||||
|
||||
QDomElement root = doc.documentElement();
|
||||
if ( root.tagName() != "Glabels-vendors" )
|
||||
{
|
||||
std::cerr << "Error: Not a Glabels-vendors file" << std::endl;
|
||||
qWarning() << "Error: Not a Glabels-vendors file.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,9 +80,9 @@ namespace libglabels
|
||||
}
|
||||
else if ( !child.isComment() )
|
||||
{
|
||||
std::cerr << "Warning: bad element: " << qPrintable(child.toElement().tagName())
|
||||
<< ", Ignored"
|
||||
<< std::endl;
|
||||
qWarning() << "Warning: bad element: "
|
||||
<< child.toElement().tagName()
|
||||
<< ", Ignored.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user