diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index 9b3301b00..b87d6575d 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -25,7 +25,6 @@ #include "elementcollectionhandler.h" #include -#include #include /** @@ -238,23 +237,17 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo list.append(items()); - foreach (QETProject *project, projects) { + for (QETProject *project : projects) + { addProject(project, false); list.append(projectItems(project)); } - ElementsLocation::clearAcces(); - qDebug() << "acces count " << ElementsLocation::accesCount(); - QTime t; - t.start(); - QFuture futur = QtConcurrent::map(list, setUpData); - emit loadingMaxValue(futur.progressMaximum()); - while (futur.isRunning()) { - emit loadingProgressValue(futur.progressValue()); + emit loadingMaxValue(list.size()); + QFuture future = QtConcurrent::map(list, setUpData); + while (future.isRunning()) { + emit loadingProgressValue(future.progressValue()); } - int ms = t.elapsed(); - - QMessageBox::about(nullptr, tr("Chargement collection d'élément"), tr("Le chargement de la collection d'éléments à été éffectué en %1 ms %2 acces").arg(ms).arg(ElementsLocation::accesCount())); } /** diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index d698a530e..739ed1251 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -25,7 +25,6 @@ #include "qetxml.h" #include -static int acces; // make this class usable with QVariant int ElementsLocation::MetaTypeId = qRegisterMetaType("ElementsLocation"); @@ -539,7 +538,6 @@ QDomElement ElementsLocation::xml() const { if (!m_project) { - ++acces; QFile file (m_file_system_path); QDomDocument docu; if (docu.setContent(&file)) @@ -583,7 +581,6 @@ pugi::xml_document ElementsLocation::pugiXml() const #endif if (!m_project) { - ++acces; pugi::xml_document docu; if (docu.load_file(m_file_system_path.toStdString().c_str())) { @@ -695,25 +692,12 @@ QUuid ElementsLocation::uuid() const return QUuid(); } - QSettings set; - if(set.value("use_pugixml").toBool()) - { - auto document = pugiXml(); - auto uuid_node = document.document_element().child("uuid"); - if (uuid_node.empty()) { - return QUuid(); - } - return QUuid(uuid_node.attribute("uuid").as_string()); + auto document = pugiXml(); + auto uuid_node = document.document_element().child("uuid"); + if (uuid_node.empty()) { + return QUuid(); } - - //Get the uuid of element - QList list_ = QET::findInDomElement(xml(), "uuid"); - - if (!list_.isEmpty()) - return QUuid(list_.first().attribute("uuid")); - - return QUuid(); - //Get the uuid of element + return QUuid(uuid_node.attribute("uuid").as_string()); } /** @@ -744,14 +728,7 @@ QIcon ElementsLocation::icon() const QString ElementsLocation::name() const { NamesList nl; - - QSettings set; - if(set.value("use_pugixml").toBool()) { - nl.fromXml(pugiXml().document_element()); - } else { - nl.fromXml(xml()); - } - + nl.fromXml(pugiXml().document_element()); return nl.name(fileName()); } @@ -783,38 +760,11 @@ DiagramContext ElementsLocation::elementInformations() const if (isDirectory()) { return context; } - - QSettings set; - if (set.value("use_pugixml").toBool()) - { - context.fromXml(pugiXml().document_element().child("elementInformations"), "elementInformation"); - } - else - { - QDomElement dom = this->xml().firstChildElement("elementInformations"); - context.fromXml(dom, "elementInformation"); - } + + context.fromXml(pugiXml().document_element().child("elementInformations"), "elementInformation"); return context; } -void ElementsLocation::clearAcces() -{ - acces =0; -} - -int ElementsLocation::accesCount() -{ - return acces; -} - -///** -// @param location A standard element location -// @return a hash identifying this location -//*/ -//uint qHash(const ElementsLocation &location) { -// return(qHash(location.toString())); -//} - QDebug operator<< (QDebug debug, const ElementsLocation &location) { QDebugStateSaver saver(debug); diff --git a/sources/ElementsCollection/elementslocation.h b/sources/ElementsCollection/elementslocation.h index 5283f2699..2e2425c40 100644 --- a/sources/ElementsCollection/elementslocation.h +++ b/sources/ElementsCollection/elementslocation.h @@ -96,8 +96,6 @@ class ElementsLocation public: static int MetaTypeId; ///< Id of the corresponding Qt meta type - static void clearAcces(); - static int accesCount(); }; QDebug operator<<(QDebug debug, const ElementsLocation &location); diff --git a/sources/ElementsCollection/fileelementcollectionitem.cpp b/sources/ElementsCollection/fileelementcollectionitem.cpp index db6d14b53..f804f8743 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.cpp +++ b/sources/ElementsCollection/fileelementcollectionitem.cpp @@ -124,44 +124,20 @@ QString FileElementCollectionItem::localName() } else { - QSettings set; - if (set.value("use_pugixml").toBool()) + QString str(fileSystemPath() + "/qet_directory"); + pugi::xml_document docu; + if(docu.load_file(str.toStdString().c_str())) { - QString str(fileSystemPath() + "/qet_directory"); - pugi::xml_document docu; - if(docu.load_file(str.toStdString().c_str())) + if (QString(docu.document_element().name()) == "qet-directory") { - if (QString(docu.document_element().name()) == "qet-directory") - { - NamesList nl; - nl.fromXml(docu.document_element()); - setText(nl.name()); - } - } - } - else - { - //Open the qet_directory file, to get the traductions name of this dir - QFile dir_conf(fileSystemPath() + "/qet_directory"); - - if (dir_conf.exists() && dir_conf.open(QIODevice::ReadOnly | QIODevice::Text)) { - - //Get the content of the file - QDomDocument document; - if (document.setContent(&dir_conf)) { - QDomElement root = document.documentElement(); - if (root.tagName() == "qet-directory") { - NamesList nl; - nl.fromXml(root); - setText(nl.name()); - } - } + NamesList nl; + nl.fromXml(docu.document_element()); + setText(nl.name()); } } } } else if (isElement()) { -// ElementsLocation loc(collectionPath()); setText(m_location.name()); } @@ -266,7 +242,6 @@ void FileElementCollectionItem::setUpData() //Set the local name and all informations of the element //in the data Qt::UserRole+1, these data will be use for search. -// ElementsLocation location(collectionPath()); DiagramContext context = m_location.elementInformations(); QStringList search_list; for (QString key : context.keys()) { @@ -295,11 +270,11 @@ void FileElementCollectionItem::setUpIcon() else setIcon(QIcon(":/ico/16x16/go-home.png")); } - else { - if (isDir()) + else + { + if (isDir()) { setIcon(QET::Icons::Folder); - else { -// ElementsLocation loc(collectionPath()); + } else { setIcon(m_location.icon()); } } diff --git a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp index 3efcf6bd7..720312a44 100644 --- a/sources/ui/configpage/generalconfigurationpage.cpp +++ b/sources/ui/configpage/generalconfigurationpage.cpp @@ -126,8 +126,6 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ui->m_custom_tbt_path_cb->setItemData(1, path, Qt::DisplayRole); ui->m_custom_tbt_path_cb->blockSignals(false); } - - ui->m_use_pugi_xml->setChecked(settings.value("use_pugixml").toBool()); fillLang(); } @@ -236,8 +234,6 @@ void GeneralConfigurationPage::applyConf() if (path != settings.value("elements-collections/custom-tbt-path").toString()) { QETApp::resetUserElementsDir(); } - - settings.setValue("use_pugixml", ui->m_use_pugi_xml->isChecked()? true : false); } /** diff --git a/sources/ui/configpage/generalconfigurationpage.ui b/sources/ui/configpage/generalconfigurationpage.ui index 24b11d972..6a5d51aa2 100644 --- a/sources/ui/configpage/generalconfigurationpage.ui +++ b/sources/ui/configpage/generalconfigurationpage.ui @@ -325,13 +325,6 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments - - - - Utiliser pugi xml pour le chargement des collections. - - -