mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Implemented QET::writeXmlFile() to handle every XML file generation in a single place.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1640 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -464,26 +464,16 @@ bool QETProject::write() {
|
||||
return(true);
|
||||
}
|
||||
|
||||
// ouvre le fichier en ecriture
|
||||
QFile file(file_path_);
|
||||
bool file_opening = file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
if (!file_opening) {
|
||||
qDebug() << qPrintable(QString("QETProject::write() : unable to open %1 with write access [%2]").arg(file_path_).arg(QET::pointerString(this)));
|
||||
return(false);
|
||||
}
|
||||
|
||||
qDebug() << qPrintable(QString("QETProject::write() : writing to file %1 [%2]").arg(file_path_).arg(QET::pointerString(this)));
|
||||
|
||||
// realise l'export en XML du projet dans le document XML interne
|
||||
document_root_.clear();
|
||||
document_root_.appendChild(document_root_.importNode(toXml().documentElement(), true));
|
||||
|
||||
QTextStream out(&file);
|
||||
out.setCodec("UTF-8");
|
||||
out << document_root_.toString(4);
|
||||
file.close();
|
||||
|
||||
return(true);
|
||||
QString error_message;
|
||||
bool writing = QET::writeXmlFile(document_root_, file_path_, &error_message);
|
||||
if (!writing) {
|
||||
qDebug() << qPrintable(QString("QETProject::write() : %1 [%2]").arg(error_message).arg(QET::pointerString(this)));
|
||||
}
|
||||
return(writing);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user