45 |
|
void backupFile(const QString &file, bool verboseEnabled){ |
46 |
|
if(!QFile::exists(file+".bak")){ |
47 |
|
if(!Util::backupFile(file)){ |
48 |
< |
std::cerr << "Couldn't backup file '" << file.toLatin1().constData() << "'. Aborting." << std::endl; |
48 |
> |
std::cerr << "Couldn't backup file '" << file.toUtf8().constData() << "'. Aborting." << std::endl; |
49 |
|
exit(1); |
50 |
|
} |
51 |
|
} |
52 |
|
else{ |
53 |
|
if(verboseEnabled){ |
54 |
< |
std::cout << "Backup file '" << file.toLatin1().constData() << "'' already exists. Skipping..." << std::endl; |
54 |
> |
std::cout << "Backup file '" << file.toUtf8().constData() << "'' already exists. Skipping..." << std::endl; |
55 |
|
} |
56 |
|
} |
57 |
|
} |
63 |
|
|
64 |
|
try |
65 |
|
{ |
66 |
< |
selectedNodes = doc.select_nodes(xPathExpression.toLatin1().constData()); |
66 |
> |
selectedNodes = doc.select_nodes(xPathExpression.toUtf8().constData()); |
67 |
|
} |
68 |
|
|
69 |
|
catch (const pugi::xpath_exception& e) |
90 |
|
|
91 |
|
try |
92 |
|
{ |
93 |
< |
selectedNode = doc.select_single_node(xPathExpression.toLatin1().constData()); |
93 |
> |
selectedNode = doc.select_single_node(xPathExpression.toUtf8().constData()); |
94 |
|
} |
95 |
|
|
96 |
|
catch (const pugi::xpath_exception& e) |
107 |
|
|
108 |
|
if ((*currNode).name() == filters.getElementName() && (filters.getParentElementName() == "" || filters.getParentElementName() == (*currNode).parent().name()) |
109 |
|
&& (filters.getAttributeName() == "" || |
110 |
< |
Util::toQString((*currNode).attribute(filters.getAttributeName().toLatin1().constData()).value()) == filters.getAttributeValue()) ){ // Seems node attribute must be converted to qtsring to remove \r\n needs to check in future! |
110 |
> |
Util::toQString((*currNode).attribute(filters.getAttributeName().toUtf8().constData()).value()) == filters.getAttributeValue()) ){ // Seems node attribute must be converted to qtsring to remove \r\n needs to check in future! |
111 |
|
|
112 |
|
result << *currNode; |
113 |
|
continue; |
124 |
|
{ |
125 |
|
if ((*currNode).name() == filters.getElementName() && (filters.getParentElementName() == "" || filters.getParentElementName() == (*currNode).parent().name()) |
126 |
|
&& (filters.getAttributeName() == "" || |
127 |
< |
Util::toQString((*currNode).attribute(filters.getAttributeName().toLatin1().constData()).value()) == filters.getAttributeValue()) ){ |
127 |
> |
Util::toQString((*currNode).attribute(filters.getAttributeName().toUtf8().constData()).value()) == filters.getAttributeValue()) ){ |
128 |
|
return *currNode; |
129 |
|
} |
130 |
|
|
141 |
|
|
142 |
|
void displaySuccessMessage(const int numberOperations, const QString &operation){ |
143 |
|
std::cout << "------------------------------------------------------------------------" << std::endl; |
144 |
< |
std::cout << numberOperations << " " << operation.toLatin1().constData() << " operation(s) completed with success!" << std::endl; |
144 |
> |
std::cout << numberOperations << " " << operation.toUtf8().constData() << " operation(s) completed with success!" << std::endl; |
145 |
|
std::cout << "------------------------------------------------------------------------" << std::endl; |
146 |
|
} |
147 |
|
|
148 |
|
void displayErrorMessage(const QString& operation, const QString &message, bool exitProgram){ |
149 |
|
std::cerr << "************************************************************************" << std::endl; |
150 |
< |
std::cerr << operation.toLatin1().constData() << " operation failed!" << std::endl << std::endl; |
151 |
< |
std::cerr << message.toLatin1().constData() << std::endl << std::endl; |
150 |
> |
std::cerr << operation.toUtf8().constData() << " operation failed!" << std::endl << std::endl; |
151 |
> |
std::cerr << message.toUtf8().constData() << std::endl << std::endl; |
152 |
|
if(exitProgram) std::cerr << "Aborting..." << std::endl; |
153 |
|
std::cerr << "************************************************************************" << std::endl; |
154 |
|
if(exitProgram) exit(1); |