Revert "some minor changes"

This commit is contained in:
Laurent Trinques
2024-04-10 14:31:01 +02:00
committed by GitHub
parent 7e6befdf0a
commit f4ac69a805
21 changed files with 727 additions and 759 deletions

View File

@@ -52,18 +52,18 @@ static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
QETProject::QETProject(QObject *parent) :
QObject (parent),
m_titleblocks_collection(this),
m_data_base(this, this),
m_project_properties_handler{this}
m_data_base(this, this),
m_project_properties_handler{this}
{
setDefaultTitleBlockProperties(TitleBlockProperties::defaultProperties());
m_elements_collection = new XmlElementCollection(this);
init();
init();
}
ProjectPropertiesHandler &QETProject::projectPropertiesHandler()
{
return m_project_properties_handler;
return m_project_properties_handler;
}
/**
@@ -75,8 +75,8 @@ ProjectPropertiesHandler &QETProject::projectPropertiesHandler()
QETProject::QETProject(const QString &path, QObject *parent) :
QObject (parent),
m_titleblocks_collection(this),
m_data_base(this, this),
m_project_properties_handler{this}
m_data_base(this, this),
m_project_properties_handler{this}
{
QFile file(path);
m_state = openFile(&file);
@@ -97,8 +97,8 @@ QETProject::QETProject(const QString &path, QObject *parent) :
QETProject::QETProject(KAutoSaveFile *backup, QObject *parent) :
QObject (parent),
m_titleblocks_collection(this),
m_data_base(this, this),
m_project_properties_handler{this}
m_data_base(this, this),
m_project_properties_handler{this}
{
m_state = openFile(backup);
//Failed to open from the backup, try to open the crashed
@@ -234,7 +234,7 @@ QETProject::ProjectState QETProject::openFile(QFile *file)
if(opened_here) {
file->close();
}
return m_state;
return m_state;
}
/**
@@ -244,23 +244,23 @@ QETProject::ProjectState QETProject::openFile(QFile *file)
*/
void QETProject::refresh()
{
DialogWaiting *dlgWaiting { nullptr };
if(DialogWaiting::hasInstance())
{
dlgWaiting = DialogWaiting::instance();
dlgWaiting->setModal(true);
dlgWaiting->show();
}
DialogWaiting *dlgWaiting { nullptr };
if(DialogWaiting::hasInstance())
{
dlgWaiting = DialogWaiting::instance();
dlgWaiting->setModal(true);
dlgWaiting->show();
}
for(const auto &diagram : diagrams())
{
if(dlgWaiting)
{
dlgWaiting->setProgressBar(dlgWaiting->progressBarValue()+1);
dlgWaiting->setDetail(diagram->title());
}
diagram->refreshContents();
}
for(const auto &diagram : diagrams())
{
if(dlgWaiting)
{
dlgWaiting->setProgressBar(dlgWaiting->progressBarValue()+1);
dlgWaiting->setDetail(diagram->title());
}
diagram->refreshContents();
}
}
/**
@@ -509,10 +509,10 @@ void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titl
case QET::Common :
collection = QETApp::commonTitleBlockTemplatesCollection();
break;
case QET::Company :
// collection = QETApp::companyTitleBlockTemplatesCollection();
break;
case QET::Custom :
case QET::Company :
// collection = QETApp::companyTitleBlockTemplatesCollection();
break;
case QET::Custom :
collection = QETApp::customTitleBlockTemplatesCollection();
break;
case QET::Embedded :
@@ -919,7 +919,7 @@ QDomDocument QETProject::toXml()
// racine du projet
QDomDocument xml_doc;
QDomElement project_root = xml_doc.createElement("project");
QetVersion::toXmlAttribute(project_root);
QetVersion::toXmlAttribute(project_root);
if (project_title_.isEmpty())
{
// if project_title_is Empty add title from m_file_path
@@ -1349,10 +1349,10 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
if (root_elmt.tagName() == QLatin1String("project"))
{
//Normal opening mode
m_project_qet_version = QetVersion::fromXmlAttribute(root_elmt);
if (!m_project_qet_version.isNull())
m_project_qet_version = QetVersion::fromXmlAttribute(root_elmt);
if (!m_project_qet_version.isNull())
{
if (QetVersion::currentVersion() < m_project_qet_version)
if (QetVersion::currentVersion() < m_project_qet_version)
{
int ret = QET::QetMessageBox::warning(
nullptr,
@@ -1362,7 +1362,7 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
"\n qui est ultérieure à votre version !"
" \n"
"Vous utilisez actuellement QElectroTech en version %2")
.arg(root_elmt.attribute(QStringLiteral("version")), QetVersion::currentVersion().toString() +
.arg(root_elmt.attribute(QStringLiteral("version")), QetVersion::currentVersion().toString() +
tr(".\n Il est alors possible que l'ouverture de tout ou partie de ce "
"document échoue.\n"
"Que désirez vous faire ?"),
@@ -1379,14 +1379,14 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
//Since QElectrotech 0.9 the compatibility with project made with
//Qet 0.6 or lower is break;
if (m_project_qet_version <= QetVersion::versionZeroDotSix())
if (m_project_qet_version <= QetVersion::versionZeroDotSix())
{
auto ret = QET::QetMessageBox::warning(
nullptr,
tr("Avertissement ", "message box title"),
tr("Le projet que vous tentez d'ouvrir est partiellement "
"compatible avec votre version %1 de QElectroTech.\n")
.arg(QetVersion::currentVersion().toString()) +
.arg(QetVersion::currentVersion().toString()) +
tr("Afin de le rendre totalement compatible veuillez ouvrir ce même projet "
"avec la version 0.8, ou 0.80 de QElectroTech et sauvegarder le projet "
"et l'ouvrir à nouveau avec cette version.\n"
@@ -1429,8 +1429,8 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
//Load the terminal strip
readTerminalStripXml(xml_project);
//Now that all are loaded we refresh content of the project.
refresh();
//Now that all are loaded we refresh content of the project.
refresh();
m_data_base.blockSignals(false);