diff --git a/glabels/File.cpp b/glabels/File.cpp index 320d65d..08e916d 100644 --- a/glabels/File.cpp +++ b/glabels/File.cpp @@ -26,8 +26,7 @@ #include "XmlLabel.h" #include #include - -#include +#include namespace glabels { @@ -92,7 +91,7 @@ namespace glabels } else { - std::cout << "ACTION: file->Save: " << window->model()->filename().toStdString() << std::endl; + qDebug() << "ACTION: file->Save: " << window->model()->filename(); return true; } } @@ -111,7 +110,7 @@ namespace glabels ); if ( !fileName.isEmpty() ) { - std::cout << "ACTION: file->SaveAs: " << fileName.toStdString() << std::endl; + qDebug() << "ACTION: file->SaveAs: " << fileName; return true; } @@ -124,7 +123,7 @@ namespace glabels /// void File::print( MainWindow *window ) { - std::cout << "ACTION: file->print" << std::endl; + qDebug() << "ACTION: file->print"; } diff --git a/glabels/MainWindow.cpp b/glabels/MainWindow.cpp index 35b045d..beb2699 100644 --- a/glabels/MainWindow.cpp +++ b/glabels/MainWindow.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "libglabels/Db.h" #include "View.h" @@ -97,6 +97,8 @@ namespace glabels { mModel = label; mView->setModel( mModel ); + + setDocVerbsEnabled( true ); } @@ -122,7 +124,7 @@ namespace glabels /// void MainWindow::closeEvent( QCloseEvent *event ) { - std::cout << "CLOSE EVENT" << std::endl; + qDebug() << "CLOSE EVENT"; writeSettings(); event->accept(); } @@ -780,7 +782,7 @@ namespace glabels /// void MainWindow::fileProperties() { - std::cout << "ACTION: file->Properties" << std::endl; + qDebug() << "ACTION: file->Properties"; } @@ -789,7 +791,7 @@ namespace glabels /// void MainWindow::fileTemplateDesigner() { - std::cout << "ACTION: file->Template Designer" << std::endl; + qDebug() << "ACTION: file->Template Designer"; } @@ -816,7 +818,7 @@ namespace glabels /// void MainWindow::editUndo() { - std::cout << "ACTION: edit->Undo" << std::endl; + qDebug() << "ACTION: edit->Undo"; } @@ -825,7 +827,7 @@ namespace glabels /// void MainWindow::editRedo() { - std::cout << "ACTION: edit->Redo" << std::endl; + qDebug() << "ACTION: edit->Redo"; } @@ -834,7 +836,7 @@ namespace glabels /// void MainWindow::editCut() { - std::cout << "ACTION: edit->Cut" << std::endl; + qDebug() << "ACTION: edit->Cut"; } @@ -843,7 +845,7 @@ namespace glabels /// void MainWindow::editCopy() { - std::cout << "ACTION: edit->Copy" << std::endl; + qDebug() << "ACTION: edit->Copy"; } @@ -852,7 +854,7 @@ namespace glabels /// void MainWindow::editPaste() { - std::cout << "ACTION: edit->Paste" << std::endl; + qDebug() << "ACTION: edit->Paste"; } @@ -861,7 +863,7 @@ namespace glabels /// void MainWindow::editDelete() { - std::cout << "ACTION: edit->Delete" << std::endl; + qDebug() << "ACTION: edit->Delete"; } @@ -870,7 +872,7 @@ namespace glabels /// void MainWindow::editSelectAll() { - std::cout << "ACTION: edit->Select All" << std::endl; + qDebug() << "ACTION: edit->Select All"; } @@ -879,7 +881,7 @@ namespace glabels /// void MainWindow::editUnSelectAll() { - std::cout << "ACTION: edit->Un-select All" << std::endl; + qDebug() << "ACTION: edit->Un-select All"; } @@ -888,7 +890,7 @@ namespace glabels /// void MainWindow::editPreferences() { - std::cout << "ACTION: edit->Preferences" << std::endl; + qDebug() << "ACTION: edit->Preferences"; } @@ -987,7 +989,7 @@ namespace glabels /// void MainWindow::objectsArrowMode() { - std::cout << "ACTION: objects->Select Mode" << std::endl; + qDebug() << "ACTION: objects->Select Mode"; } @@ -996,7 +998,7 @@ namespace glabels /// void MainWindow::objectsCreateText() { - std::cout << "ACTION: objects->Create->Text" << std::endl; + qDebug() << "ACTION: objects->Create->Text"; } @@ -1005,7 +1007,7 @@ namespace glabels /// void MainWindow::objectsCreateBox() { - std::cout << "ACTION: objects->Create->Box" << std::endl; + qDebug() << "ACTION: objects->Create->Box"; } @@ -1014,7 +1016,7 @@ namespace glabels /// void MainWindow::objectsCreateLine() { - std::cout << "ACTION: objects->Create->Line" << std::endl; + qDebug() << "ACTION: objects->Create->Line"; } @@ -1023,7 +1025,7 @@ namespace glabels /// void MainWindow::objectsCreateEllipse() { - std::cout << "ACTION: objects->Create->Ellipse" << std::endl; + qDebug() << "ACTION: objects->Create->Ellipse"; } @@ -1032,7 +1034,7 @@ namespace glabels /// void MainWindow::objectsCreateImage() { - std::cout << "ACTION: objects->Create->Image" << std::endl; + qDebug() << "ACTION: objects->Create->Image"; } @@ -1041,7 +1043,7 @@ namespace glabels /// void MainWindow::objectsCreateBarcode() { - std::cout << "ACTION: objects->Create->Barcode" << std::endl; + qDebug() << "ACTION: objects->Create->Barcode"; } @@ -1050,7 +1052,7 @@ namespace glabels /// void MainWindow::objectsOrderRaise() { - std::cout << "ACTION: objects->Order->Bring to front" << std::endl; + qDebug() << "ACTION: objects->Order->Bring to front"; } @@ -1059,7 +1061,7 @@ namespace glabels /// void MainWindow::objectsOrderLower() { - std::cout << "ACTION: objects->Order->Send to back" << std::endl; + qDebug() << "ACTION: objects->Order->Send to back"; } @@ -1068,7 +1070,7 @@ namespace glabels /// void MainWindow::objectsXformRotateLeft() { - std::cout << "ACTION: objects->Rotate/Flip->Rotate Left" << std::endl; + qDebug() << "ACTION: objects->Rotate/Flip->Rotate Left"; } @@ -1077,7 +1079,7 @@ namespace glabels /// void MainWindow::objectsXformRotateRight() { - std::cout << "ACTION: objects->Rotate/Flip->Rotate Right" << std::endl; + qDebug() << "ACTION: objects->Rotate/Flip->Rotate Right"; } @@ -1086,7 +1088,7 @@ namespace glabels /// void MainWindow::objectsXformFlipHoriz() { - std::cout << "ACTION: objects->Rotate/Flip->Flip Horizontally" << std::endl; + qDebug() << "ACTION: objects->Rotate/Flip->Flip Horizontally"; } @@ -1095,7 +1097,7 @@ namespace glabels /// void MainWindow::objectsXformFlipVert() { - std::cout << "ACTION: objects->Rotate/Flip->Flip Vertically" << std::endl; + qDebug() << "ACTION: objects->Rotate/Flip->Flip Vertically"; } @@ -1104,7 +1106,7 @@ namespace glabels /// void MainWindow::objectsAlignLeft() { - std::cout << "ACTION: objects->Align->Left" << std::endl; + qDebug() << "ACTION: objects->Align->Left"; } @@ -1113,7 +1115,7 @@ namespace glabels /// void MainWindow::objectsAlignHCenter() { - std::cout << "ACTION: objects->Align->Center Horizontally" << std::endl; + qDebug() << "ACTION: objects->Align->Center Horizontally"; } @@ -1122,7 +1124,7 @@ namespace glabels /// void MainWindow::objectsAlignRight() { - std::cout << "ACTION: objects->Align->Right" << std::endl; + qDebug() << "ACTION: objects->Align->Right"; } @@ -1131,7 +1133,7 @@ namespace glabels /// void MainWindow::objectsAlignTop() { - std::cout << "ACTION: objects->Align->Top" << std::endl; + qDebug() << "ACTION: objects->Align->Top"; } @@ -1140,7 +1142,7 @@ namespace glabels /// void MainWindow::objectsAlignVCenter() { - std::cout << "ACTION: objects->Align->Center Vertically" << std::endl; + qDebug() << "ACTION: objects->Align->Center Vertically"; } @@ -1149,7 +1151,7 @@ namespace glabels /// void MainWindow::objectsAlignBottom() { - std::cout << "ACTION: objects->Align->Bottom" << std::endl; + qDebug() << "ACTION: objects->Align->Bottom"; } @@ -1158,7 +1160,7 @@ namespace glabels /// void MainWindow::objectsCenterHoriz() { - std::cout << "ACTION: objects->Center->Horizontally" << std::endl; + qDebug() << "ACTION: objects->Center->Horizontally"; } @@ -1167,7 +1169,7 @@ namespace glabels /// void MainWindow::objectsCenterVert() { - std::cout << "ACTION: objects->Center->Vertically" << std::endl; + qDebug() << "ACTION: objects->Center->Vertically"; } @@ -1176,7 +1178,7 @@ namespace glabels /// void MainWindow::objectsMergeProperties() { - std::cout << "ACTION: objects->Merge Properties..." << std::endl; + qDebug() << "ACTION: objects->Merge Properties..."; } diff --git a/libglabels/Db.cpp b/libglabels/Db.cpp index 44da443..55e0e76 100644 --- a/libglabels/Db.cpp +++ b/libglabels/Db.cpp @@ -21,7 +21,7 @@ #include "Db.h" #include -#include +#include #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(); } diff --git a/libglabels/Template.cpp b/libglabels/Template.cpp index a46be27..424db36 100644 --- a/libglabels/Template.cpp +++ b/libglabels/Template.cpp @@ -20,7 +20,7 @@ #include "Template.h" -#include +#include #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; } } diff --git a/libglabels/XmlCategoryParser.cpp b/libglabels/XmlCategoryParser.cpp index d5a5709..f410089 100644 --- a/libglabels/XmlCategoryParser.cpp +++ b/libglabels/XmlCategoryParser.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #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."; } } } diff --git a/libglabels/XmlPaperParser.cpp b/libglabels/XmlPaperParser.cpp index 91fc03b..0c869d7 100644 --- a/libglabels/XmlPaperParser.cpp +++ b/libglabels/XmlPaperParser.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #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."; } } } diff --git a/libglabels/XmlTemplateParser.cpp b/libglabels/XmlTemplateParser.cpp index c2d43ed..0d705ea 100644 --- a/libglabels/XmlTemplateParser.cpp +++ b/libglabels/XmlTemplateParser.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #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."; } } } diff --git a/libglabels/XmlUtil.cpp b/libglabels/XmlUtil.cpp index 8ea5daf..66b3b86 100644 --- a/libglabels/XmlUtil.cpp +++ b/libglabels/XmlUtil.cpp @@ -21,7 +21,7 @@ #include "XmlUtil.h" #include -#include +#include 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; } diff --git a/libglabels/XmlVendorParser.cpp b/libglabels/XmlVendorParser.cpp index 0bcf4bb..65cf71c 100644 --- a/libglabels/XmlVendorParser.cpp +++ b/libglabels/XmlVendorParser.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #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."; } } }