mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-15 10:04:13 +02:00
Speed up opening big projects with lazy folios
This commit is contained in:
+20
-2
@@ -770,6 +770,15 @@ bool QET::compareCanonicalFilePaths(const QString &first, const QString &second)
|
||||
@return false if an error occurred, true otherwise
|
||||
*/
|
||||
bool QET::writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *error_message)
|
||||
{
|
||||
return writeXmlText(xml_doc.toString(4), filepath, error_message);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QET::writeXmlText
|
||||
writeXmlFile() for a document already written as @p text
|
||||
*/
|
||||
bool QET::writeXmlText(const QString &text, const QString &filepath, QString *error_message)
|
||||
{
|
||||
QSaveFile file(filepath);
|
||||
|
||||
@@ -789,7 +798,7 @@ bool QET::writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *
|
||||
QTextStream out(&file);
|
||||
out.setEncoding(QStringConverter::Utf8);
|
||||
out.setGenerateByteOrderMark(false);
|
||||
out << xml_doc.toString(4);
|
||||
out << text;
|
||||
if (!file.commit())
|
||||
{
|
||||
if (error_message) {
|
||||
@@ -895,6 +904,15 @@ QActionGroup *QET::depthActionGroup(QObject *parent)
|
||||
}
|
||||
|
||||
bool QET::writeToFile(QDomDocument &xml_doc, QFile *file, QString *error_message)
|
||||
{
|
||||
return writeTextToFile(xml_doc.toString(4), file, error_message);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QET::writeTextToFile
|
||||
writeToFile() for a document already written as @p text
|
||||
*/
|
||||
bool QET::writeTextToFile(const QString &text, QFile *file, QString *error_message)
|
||||
{
|
||||
bool opened_here = file->isOpen() ? false : true;
|
||||
|
||||
@@ -920,7 +938,7 @@ bool QET::writeToFile(QDomDocument &xml_doc, QFile *file, QString *error_message
|
||||
out.seek(0);
|
||||
out.setEncoding(QStringConverter::Utf8);
|
||||
out.setGenerateByteOrderMark(false);
|
||||
out << xml_doc.toString(4);
|
||||
out << text;
|
||||
if (opened_here) {
|
||||
file->close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user