Merge remote-tracking branch 'origin/test_pugi'

This commit is contained in:
Laurent Trinques
2020-01-26 14:43:48 +01:00
27 changed files with 15511 additions and 451 deletions

View File

@@ -97,7 +97,8 @@ INCLUDEPATH += sources \
sources/SearchAndReplace/ui \
sources/NameList \
sources/NameList/ui \
sources/utils
sources/utils \
sources/pugixml
# Fichiers sources
@@ -120,10 +121,11 @@ HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) \
$$files(sources/autoNum/ui/*.h) \
$$files(sources/ui/configpage/*.h) \
$$files(sources/SearchAndReplace/*.h) \
$$files(sources/SearchAndReplace/ui/*.h) \
$$files(sources/NameList/*.h) \
$$files(sources/NameList/ui/*.h) \
$$files(sources/utils/*.h)
$$files(sources/SearchAndReplace/ui/*.h) \
$$files(sources/NameList/*.h) \
$$files(sources/NameList/ui/*.h) \
$$files(sources/utils/*.h) \
$$files(sources/pugixml/*.hpp)
SOURCES += $$files(sources/*.cpp) \
$$files(sources/editor/*.cpp) \
@@ -144,11 +146,12 @@ SOURCES += $$files(sources/*.cpp) \
$$files(sources/autoNum/*.cpp) \
$$files(sources/autoNum/ui/*.cpp) \
$$files(sources/ui/configpage/*.cpp) \
$$files(sources/SearchAndReplace/*.cpp) \
$$files(sources/SearchAndReplace/ui/*.cpp) \
$$files(sources/NameList/*.cpp) \
$$files(sources/NameList/ui/*.cpp) \
$$files(sources/utils/*.cpp)
$$files(sources/SearchAndReplace/*.cpp) \
$$files(sources/SearchAndReplace/ui/*.cpp) \
$$files(sources/NameList/*.cpp) \
$$files(sources/NameList/ui/*.cpp) \
$$files(sources/utils/*.cpp) \
$$files(sources/pugixml/*.cpp)
# Liste des fichiers qui seront incorpores au binaire en tant que ressources Qt
RESOURCES += qelectrotech.qrc

View File

@@ -240,7 +240,6 @@ QList<ElementCollectionItem *> ElementCollectionItem::items() const
return list;
}
void setUpData(ElementCollectionItem *eci)
{
void setUpData(ElementCollectionItem *eci) {
eci->setUpData();
}

View File

@@ -24,8 +24,8 @@
#include "qetproject.h"
#include "elementcollectionhandler.h"
#include <QtConcurrent>
#include <QFutureWatcher>
#include <QtConcurrent>
/**
* @brief ElementsCollectionModel::ElementsCollectionModel
@@ -149,7 +149,7 @@ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAct
*/
bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
Q_UNUSED(action);
Q_UNUSED(action)
QStandardItem *qsi = itemFromIndex(parent.child(row, column));
if (!qsi)
@@ -218,15 +218,16 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
* Load the several collections in this model.
* Prefer use this method instead of addCommonCollection, addCustomCollection and addProject,
* because it use multithreading to speed up the loading.
* This method emit loadingMaxValue(int) for know the maximum progress value
* This method emit loadingProgressValue(int) for know the current progress value
* This method emit loadingProgressRangeChanged(int, int) for know the minimu and maximum progress value
* This method emit loadingProgressValueChanged(int) for know the current progress value
* This method emit loadingFinished for know when loading finished.
* @param common_collection : true for load the common collection
* @param custom_collection : true for load the custom collection
* @param projects : list of projects to load
*/
void ElementsCollectionModel::loadCollections(bool common_collection, bool custom_collection, QList<QETProject *> projects)
{
QList <ElementCollectionItem *> list;
m_items_list_to_setUp.clear();
if (common_collection)
addCommonCollection(false);
@@ -234,22 +235,21 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo
addCustomCollection(false);
if (common_collection || custom_collection)
list.append(items());
m_items_list_to_setUp.append(items());
foreach (QETProject *project, projects) {
for (QETProject *project : projects)
{
addProject(project, false);
list.append(projectItems(project));
}
QFutureWatcher<void> watcher;
QFuture<void> futur = QtConcurrent::map(list, setUpData);
watcher.setFuture(futur);
emit loadingMaxValue(futur.progressMaximum());
while (futur.isRunning()) {
emit loadingProgressValue(futur.progressValue());
m_items_list_to_setUp.append(projectItems(project));
}
auto *watcher = new QFutureWatcher<void>();
connect(watcher, &QFutureWatcher<void>::progressValueChanged, this, &ElementsCollectionModel::loadingProgressValueChanged);
connect(watcher, &QFutureWatcher<void>::progressRangeChanged, this, &ElementsCollectionModel::loadingProgressRangeChanged);
connect(watcher, &QFutureWatcher<void>::finished, this, &ElementsCollectionModel::loadingFinished);
connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater);
m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
watcher->setFuture(m_future);
}
/**

View File

@@ -60,8 +60,9 @@ class ElementsCollectionModel : public QStandardItemModel
QModelIndex indexFromLocation(const ElementsLocation &location);
signals:
void loadingMaxValue(int);
void loadingProgressValue(int);
void loadingProgressValueChanged(int);
void loadingProgressRangeChanged(int, int);
void loadingFinished();
private:
void elementIntegratedToCollection (const QString& path);
@@ -72,6 +73,8 @@ class ElementsCollectionModel : public QStandardItemModel
QList <QETProject *> m_project_list;
QHash <QETProject *, XmlProjectElementCollectionItem *> m_project_hash;
bool m_hide_element = false;
QFuture<void> m_future;
QList <ElementCollectionItem *> m_items_list_to_setUp;
};
#endif // ELEMENTSCOLLECTIONMODEL2_H

View File

@@ -83,20 +83,18 @@ void ElementsCollectionWidget::expandFirstItems()
* Add @project to be displayed
* @param project
*/
void ElementsCollectionWidget::addProject(QETProject *project) {
if (m_model) {
QList <QETProject *> prj; prj.append(project);
void ElementsCollectionWidget::addProject(QETProject *project)
{
if (m_model)
{
m_progress_bar->show();
connect(m_model, &ElementsCollectionModel::loadingMaxValue, m_progress_bar, &QProgressBar::setMaximum);
connect(m_model, &ElementsCollectionModel::loadingProgressValue, m_progress_bar, &QProgressBar::setValue);
m_tree_view->setDisabled(true);
QList <QETProject *> prj; prj.append(project);
m_model->loadCollections(false,false, prj);
disconnect(m_model, &ElementsCollectionModel::loadingMaxValue, m_progress_bar, &QProgressBar::setMaximum);
disconnect(m_model, &ElementsCollectionModel::loadingProgressValue, m_progress_bar, &QProgressBar::setValue);
m_progress_bar->hide();
m_model->highlightUnusedElement();
}
else
else {
m_waiting_project.append(project);
}
}
void ElementsCollectionWidget::removeProject(QETProject *project) {
@@ -533,7 +531,9 @@ void ElementsCollectionWidget::dirProperties()
void ElementsCollectionWidget::reload()
{
m_progress_bar->show();
ElementsCollectionModel *new_model = new ElementsCollectionModel(m_tree_view);
m_progress_bar->setValue(1); //Force to repaint now, else progress bar will be not displayed immediately
m_tree_view->setDisabled(true);
m_tree_view->repaint(); //Force to repaint now, else tree view will be not disabled immediately
QList <QETProject *> project_list;
project_list.append(m_waiting_project);
@@ -541,23 +541,40 @@ void ElementsCollectionWidget::reload()
if (m_model)
project_list.append(m_model->project());
if(m_new_model) {
m_new_model->deleteLater();
}
m_new_model = new ElementsCollectionModel(m_tree_view);
connect(m_new_model, &ElementsCollectionModel::loadingProgressRangeChanged, m_progress_bar, &QProgressBar::setRange);
connect(m_new_model, &ElementsCollectionModel::loadingProgressValueChanged, m_progress_bar, &QProgressBar::setValue);
connect(m_new_model, &ElementsCollectionModel::loadingFinished, this, &ElementsCollectionWidget::loadingFinished);
connect(new_model, &ElementsCollectionModel::loadingMaxValue, m_progress_bar, &QProgressBar::setMaximum);
connect(new_model, &ElementsCollectionModel::loadingProgressValue, m_progress_bar, &QProgressBar::setValue);
m_new_model->loadCollections(true, true, project_list);
}
new_model->loadCollections(true, true, project_list);
/**
* @brief ElementsCollectionWidget::loadingFinished
* Process when collection finished to be loaded
*/
void ElementsCollectionWidget::loadingFinished()
{
if (m_new_model)
{
m_new_model->highlightUnusedElement();
m_tree_view->setModel(m_new_model);
m_index_at_context_menu = QModelIndex();
m_showed_index = QModelIndex();
if (m_model) delete m_model;
m_model = m_new_model;
m_new_model = nullptr;
expandFirstItems();
}
else {
m_model->highlightUnusedElement();
}
disconnect(new_model, &ElementsCollectionModel::loadingMaxValue, m_progress_bar, &QProgressBar::setMaximum);
disconnect(new_model, &ElementsCollectionModel::loadingProgressValue, m_progress_bar, &QProgressBar::setValue);
new_model->highlightUnusedElement();
m_tree_view->setModel(new_model);
m_index_at_context_menu = QModelIndex();
m_showed_index = QModelIndex();
if (m_model) delete m_model;
m_model = new_model;
expandFirstItems();
m_progress_bar->hide();
m_tree_view->setEnabled(true);
}
/**

View File

@@ -79,13 +79,15 @@ class ElementsCollectionWidget : public QWidget
public slots:
void reload();
void loadingFinished();
private:
void locationWasSaved(const ElementsLocation& location);
private:
ElementsCollectionModel *m_model;
ElementsCollectionModel *m_model = nullptr;
ElementsCollectionModel *m_new_model = nullptr;
QLineEdit *m_search_field;
QTimer m_search_timer;
ElementsTreeView *m_tree_view;

View File

@@ -125,16 +125,6 @@ QString ElementsLocation::baseName() const {
return(QString());
}
/**
* @brief ElementsLocation::projectId
* This method is used to know if an element belongs to
* a project or not.
* @return Element Project Id
*/
int ElementsLocation::projectId() const {
return QETApp::projectId(m_project);
}
/**
* @brief ElementsLocation::collectionPath
* Return the path of the represented element relative to collection
@@ -494,8 +484,9 @@ NamesList ElementsLocation::nameList()
{
NamesList nl;
if (isElement())
nl.fromXml(xml());
if (isElement()) {
nl.fromXml(pugiXml());
}
if (isDirectory())
{
@@ -554,6 +545,64 @@ QDomElement ElementsLocation::xml() const
return QDomElement();
}
/**
* @brief ElementsLocation::pugiXml
* @return the xml document of this element or directory
* The definition can be null
*/
pugi::xml_document ElementsLocation::pugiXml() const
{
//Except for linux OS (because linux keep in cache the file), we keep in memory the xml
//to avoid multiple access to file.
//keep in memory the XML, consumes a little more RAM, for this reason we don't use it for linux to minimize the RAM footprint.
#ifndef Q_OS_LINUX
if (!m_string_stream.str().empty())
{
pugi::xml_document docu;
docu.load_string(m_string_stream.str().c_str());
return docu;
}
#endif
if (!m_project)
{
pugi::xml_document docu;
if (docu.load_file(m_file_system_path.toStdString().c_str()))
{
#ifndef Q_OS_LINUX
docu.save(m_string_stream);
#endif
return docu;
}
}
else
{
QString str = m_collection_path;
if (isElement())
{
//Get the xml dom from Qt xml and copie to pugi xml
QDomElement element = m_project->embeddedElementCollection()->element(str.remove("embed://"));
QDomDocument qdoc;
qdoc.appendChild(qdoc.importNode(element.firstChildElement("definition"), true));
pugi::xml_document docu;
docu.load_string(qdoc.toString(4).toStdString().c_str());
return docu;
}
else
{
QDomElement element = m_project->embeddedElementCollection()->directory(str.remove("embed://"));
QDomDocument qdoc;
qdoc.appendChild(qdoc.importNode(element, true));
pugi::xml_document docu;
docu.load_string(qdoc.toString(4).toStdString().c_str());
return docu;
}
}
return pugi::xml_document();
}
/**
* @brief ElementsLocation::setXml
* Replace the current xml description by @xml_element;
@@ -623,13 +672,16 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const
*/
QUuid ElementsLocation::uuid() const
{
//Get the uuid of element
QList<QDomElement> list_ = QET::findInDomElement(xml(), "uuid");
if (!isElement()) {
return QUuid();
}
if (!list_.isEmpty())
return QUuid(list_.first().attribute("uuid"));
return QUuid();
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());
}
/**
@@ -660,7 +712,7 @@ QIcon ElementsLocation::icon() const
QString ElementsLocation::name() const
{
NamesList nl;
nl.fromXml(xml());
nl.fromXml(pugiXml().document_element());
return nl.name(fileName());
}
@@ -692,18 +744,9 @@ DiagramContext ElementsLocation::elementInformations() const
if (isDirectory()) {
return context;
}
QDomElement dom = this->xml().firstChildElement("elementInformations");
context.fromXml(dom, "elementInformation");
return context;
}
/**
@param location A standard element location
@return a hash identifying this location
*/
uint qHash(const ElementsLocation &location) {
return(qHash(location.toString()));
context.fromXml(pugiXml().document_element().child("elementInformations"), "elementInformation");
return context;
}
QDebug operator<< (QDebug debug, const ElementsLocation &location)

View File

@@ -1,4 +1,4 @@
/*
/*
Copyright 2006-2019 The QElectroTech Team
This file is part of QElectroTech.
@@ -20,9 +20,14 @@
#include "nameslist.h"
#include "diagramcontext.h"
#include "pugixml.hpp"
#include <QString>
#include <QIcon>
#ifndef Q_OS_LINUX
#include "sstream"
#endif
class QETProject;
class XmlElementCollection;
@@ -45,7 +50,6 @@ class ElementsLocation
public:
QString baseName() const;
int projectId() const;
QString collectionPath(bool protocol = true) const;
QString projectCollectionPath() const;
@@ -73,6 +77,7 @@ class ElementsLocation
NamesList nameList();
QDomElement xml() const;
pugi::xml_document pugiXml() const;
bool setXml(const QDomDocument &xml_document) const;
QUuid uuid() const;
QIcon icon() const;
@@ -84,6 +89,9 @@ class ElementsLocation
QString m_collection_path;
QString m_file_system_path;
QETProject *m_project = nullptr;
#ifndef Q_OS_LINUX
mutable std::stringstream m_string_stream;
#endif
public:
static int MetaTypeId; ///< Id of the corresponding Qt meta type
@@ -92,5 +100,5 @@ class ElementsLocation
QDebug operator<<(QDebug debug, const ElementsLocation &location);
Q_DECLARE_METATYPE(ElementsLocation)
uint qHash(const ElementsLocation &);
//uint qHash(const ElementsLocation &);
#endif

View File

@@ -40,7 +40,8 @@ FileElementCollectionItem::FileElementCollectionItem()
bool FileElementCollectionItem::setRootPath(const QString& path, bool set_data, bool hide_element)
{
QDir dir(path);
if (dir.exists()) {
if (dir.exists())
{
m_path = path;
populate(set_data, hide_element);
return true;
@@ -120,21 +121,17 @@ QString FileElementCollectionItem::localName()
else
setText(QObject::tr("Collection inconnue"));
}
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());
}
else
{
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")
{
NamesList nl;
nl.fromXml(docu.document_element());
setText(nl.name());
}
}
}
@@ -147,6 +144,27 @@ QString FileElementCollectionItem::localName()
return text();
}
/**
* @brief FileElementCollectionItem::localName
* Surcharged method, unlike the default method, avoid to create an elementLocation and so, gain time.
* @param location
* @return
*/
QString FileElementCollectionItem::localName(const ElementsLocation &location)
{
if (!text().isNull())
return text();
else if (isDir()) {
localName();
}
else if (isElement()) {
setText(location.name());
}
return text();
}
/**
* @brief FileElementCollectionItem::name
* @return The collection name of this item
@@ -234,24 +252,24 @@ void FileElementCollectionItem::addChildAtPath(const QString &collection_name)
*/
void FileElementCollectionItem::setUpData()
{
//Setup the displayed name
localName();
if (isDir())
{
localName();
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
}
else
{
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
//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 = location.elementInformations();
ElementsLocation loc(collectionPath());
DiagramContext context = loc.elementInformations();
QStringList search_list;
for (QString key : context.keys()) {
search_list.append(context.value(key).toString());
}
search_list.append(localName());
search_list.append(localName(loc));
setData(search_list.join(" "));
}
@@ -274,10 +292,11 @@ void FileElementCollectionItem::setUpIcon()
else
setIcon(QIcon(":/ico/16x16/go-home.png"));
}
else {
if (isDir())
else
{
if (isDir()) {
setIcon(QET::Icons::Folder);
else {
} else {
ElementsLocation loc(collectionPath());
setIcon(loc.icon());
}
@@ -310,7 +329,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
QDir dir (fileSystemPath());
//Get all directory in this directory.
foreach(QString str, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
for(auto str : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
appendRow(feci);
@@ -324,7 +343,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
//Get all elmt file in this directory
dir.setNameFilters(QStringList() << "*.elmt");
foreach(QString str, dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
for(auto str : dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
appendRow(feci);

View File

@@ -19,6 +19,7 @@
#define FILEELEMENTCOLLECTIONITEM2_H
#include "elementcollectionitem.h"
#include "elementslocation.h"
/**
* @brief The FileElementCollectionItem class
@@ -40,6 +41,7 @@ class FileElementCollectionItem : public ElementCollectionItem
bool isDir() const override;
bool isElement() const override;
QString localName() override;
QString localName(const ElementsLocation &location);
QString name() const override;
QString collectionPath() const override;
bool isCollectionRoot() const override;
@@ -50,9 +52,6 @@ class FileElementCollectionItem : public ElementCollectionItem
void setUpData() override;
void setUpIcon() override;
void hire();
private:
void setPathName(const QString& path_name, bool set_data = true, bool hide_element = false);
void populate(bool set_data = true, bool hide_element = false);

View File

@@ -132,6 +132,39 @@ void NamesList::fromXml(const QDomElement &xml_element, const QHash<QString, QSt
}
}
/**
* @brief NamesList::fromXml
* Load the list of lang <-> name from an xml description.
* @xml_element must be the parent of a child element tagged "names"
* If a couple lang <-> name already exist, they will overwrited, else
* they will be appened.
* @param xml_element : xml element to analyze
* @param xml_options : A set of options related to XML parsing.
* @see getXmlOptions()
*/
void NamesList::fromXml(const pugi::xml_node &xml_element, const QHash<QString, QString> &xml_options)
{
QHash<QString, QString> xml_opt = getXmlOptions(xml_options);
//Walk the childs "names" of the xml element
for (auto names = xml_element.first_child() ; names ; names = names.next_sibling())
{
if (names.type() != pugi::node_element ||
QString(names.name()) != xml_opt["ParentTagName"]) {
continue;
}
for (auto name = names.first_child(); name; name = name.next_sibling()) {
if (name.type() != pugi::node_element ||
QString(name.name()) != xml_opt["TagName"]) {
continue;
}
QString lang_str(name.attribute(xml_opt["LanguageAttribute"].toStdString().c_str()).as_string());
QString name_str(name.text().get());
addName(lang_str, name_str);
}
}
}
/**
Exporte la liste des noms vers un element XML. Veillez a verifier que la
liste de noms n'est pas vide avant de l'exporter.

View File

@@ -18,6 +18,7 @@
#ifndef NAMES_LIST_H
#define NAMES_LIST_H
#include <QtXml>
#include "pugixml.hpp"
/**
Cette classe represente une liste de noms, utilisee
par les elements et categories pour embarquer un meme nom en plusieurs
@@ -57,6 +58,7 @@ class NamesList {
// methods relatives a XML
void fromXml(const QDomElement &, const QHash<QString, QString> & = QHash<QString, QString>());
void fromXml(const pugi::xml_node &xml_element, const QHash<QString, QString> &xml_options = QHash<QString, QString>());
QDomElement toXml(QDomDocument &, const QHash<QString, QString> & = QHash<QString, QString>()) const;
protected:

View File

@@ -1,269 +0,0 @@
/*
Copyright 2006-2019 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aboutqet.h"
#include "qet.h"
#include "qeticons.h"
#include <QTabWidget>
#include <QDialogButtonBox>
#include <QVBoxLayout>
#include <QLabel>
#include <QTextEdit>
#include <QScrollArea>
/**
* @brief AboutQET::AboutQET
* @param parent
*/
AboutQET::AboutQET(QWidget *parent) :
QDialog(parent)
{
setWindowTitle(tr("À propos de QElectrotech", "window title"));
setFixedSize (1200, 600);
//setMinimumHeight(600);
//setMinimumWidth(600);
setModal(true);
QTabWidget *tabs = new QTabWidget();
tabs -> addTab(aboutTab(), tr("À &propos", "tab title"));
tabs -> addTab(authorsTab(), tr("A&uteurs", "tab title"));
tabs -> addTab(translatorsTab(), tr("&Traducteurs", "tab title"));
tabs -> addTab(contributorsTab(), tr("&Contributeurs", "tab title"));
tabs -> addTab(titleTab(), tr("&Version", "tab title"));
tabs -> addTab(licenseTab(), tr("&Accord de licence", "tab title"));
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), this, SLOT(accept()));
QVBoxLayout *vlayout = new QVBoxLayout(this);
vlayout->addWidget(tabs);
vlayout->addWidget(buttons);
QScrollArea* scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setFixedSize (1090, 590);
scrollArea->setWidget(tabs);
}
/**
Destructeur
*/
AboutQET::~AboutQET() {
}
/**
@return The title QElectroTech with its icon
*/
QWidget *AboutQET::titleTab() const {
// label "QElectroTech"
QLabel *title = new QLabel("<span style=\"font-weight:0;font-size:16pt;\">QElectroTech V " + QET::displayedVersion + "</span>");
QString compilation_info = "<br />" + tr("Compilation : ");
#ifdef __GNUC__
#ifdef __APPLE_CC__
compilation_info += " CLANG " + QString(__clang_version__ );
compilation_info += " - built with Qt " + QString(QT_VERSION_STR);
compilation_info += " - Date : " + QString(__DATE__);
compilation_info += " : " + QString(__TIME__);
compilation_info += " - run with Qt "+ QString(qVersion());
compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
compilation_info += "<br>" " OS : " + QString(QSysInfo::kernelType());
compilation_info += " - " + QString(QSysInfo::currentCpuArchitecture());
compilation_info += " - Version : " + QString(QSysInfo::prettyProductName());
compilation_info += "</br>" " - Kernel : " + QString(QSysInfo::kernelVersion());
#else
compilation_info += " GCC " + QString(__VERSION__);
compilation_info += " - built with Qt " + QString(QT_VERSION_STR);
compilation_info += " - Date : " + QString(__DATE__);
compilation_info += " : " + QString(__TIME__);
compilation_info += " - run with Qt "+ QString(qVersion());
compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
compilation_info += "<br>" " OS : " + QString(QSysInfo::kernelType());
compilation_info += " - " + QString(QSysInfo::currentCpuArchitecture());
compilation_info += " - Version : " + QString(QSysInfo::prettyProductName());
compilation_info += "</br>" " - Kernel : " + QString(QSysInfo::kernelVersion());
#endif
#endif
title -> setAlignment(Qt::AlignCenter);
title -> setText(title->text() + compilation_info);
title -> setTextFormat(Qt::RichText);
title ->setTextInteractionFlags(Qt::TextSelectableByMouse);
return(title);
}
/**
@return The widget content tab "About"
*/
QWidget *AboutQET::aboutTab() const {
QLabel *about = new QLabel(
tr("QElectroTech, une application de réalisation de schémas électriques.", "about tab, description line") +
"<br><br>" +
tr("2006-2019 Les développeurs de QElectroTech", "about tab, developers line") +
"<br><br>"
"<a href=\"https://qelectrotech.org/\">https://qelectrotech.org/</a>"
"<br><br>" +
tr("Contact : <a href=\"mailto:qet@lists.tuxfamily.org\">qet@lists.tuxfamily.org</a>", "about tab, contact line")
);
about -> setAlignment(Qt::AlignCenter);
about -> setOpenExternalLinks(true);
about -> setTextFormat(Qt::RichText);
//about -> setFixedSize (690, 610);
return(about);
}
/**
@return The widget content by "Authors" tab
*/
QWidget *AboutQET::authorsTab() const {
QLabel *authors = new QLabel();
addAuthor(authors, "Benoît Ansieau", "benoit@qelectrotech.org", tr("Idée originale"));
addAuthor(authors, "Laurent Trinques", "scorpio@qelectrotech.org", tr("Développement"));
addAuthor(authors, "Joshua Claveau", "Joshua@qelectrotech.org", tr("Développement"));
addAuthor(authors, "Davi Fochi", "davi@fochi.com.br", tr("Développement"));
addAuthor(authors, "Ronny Desmedt", "r.desmedt@live.be", tr("Convertisseur DXF"));
addAuthor(authors, "Raul Roda", "raulroda8@gmail.com", tr("Plugin Bornier"));
addAuthor(authors, "Abhishek Bansal", "abhishek@qelectrotech.org", tr("Développement"));
authors -> setOpenExternalLinks(true);
authors -> setTextFormat(Qt::RichText);
QWidget *authors_widget = new QWidget();
QHBoxLayout *authors_layout = new QHBoxLayout(authors_widget);
authors_layout -> addWidget(authors, 0, Qt::AlignCenter);
return(authors_widget);
}
/**
@return The widget content via the "Translators" tab
*/
QWidget *AboutQET::translatorsTab() const {
QLabel *translators = new QLabel();
addAuthor(translators, "Alfredo Carreto", "electronicos_mx@yahoo.com.mx", tr("Traduction en espagnol"));
addAuthor(translators, "Edgar Robles Najar", "tgo.edrobles@gmail.com", tr("Traduction en espagnol"));
addAuthor(translators, "Yuriy Litkevich", "yuriy@qelectrotech.org", tr("Traduction en russe"));
addAuthor(translators, "Evgeny Kozlov", "Evgeny.Kozlov.mailbox@gmail.com",tr("Traduction en russe"));
addAuthor(translators, "José Carlos Martins", "jose@qelectrotech.org", tr("Traduction en portugais"));
addAuthor(translators, "Pavel Fric", "pavelfric@seznam.cz", tr("Traduction en tchèque"));
addAuthor(translators, "Pawe&#x0142; &#x015A;miech", "pawel32640@gmail.com", tr("Traduction en polonais"));
addAuthor(translators, "Markus Budde & Jonas Stein & Noah Braden", "news@jonasstein.de", tr("Traduction en allemand"));
addAuthor(translators, "Nuri", "nuri@qelectrotech.org", tr("Traduction en allemand"));
addAuthor(translators, "Gabi Mandoc", "gabriel.mandoc@gic.ro", tr("Traduction en roumain"));
addAuthor(translators, "Alessandro Conti & Silvio", "silvio@qelectrotech.org", tr("Traduction en italien"));
addAuthor(translators, "Mohamed Souabni", "souabnimohamed@yahoo.fr", tr("Traduction en arabe"));
addAuthor(translators, "Antun Marakovi&#x0107;", "antun.marakovic@lolaribar.hr", tr("Traduction en croate"));
addAuthor(translators, "Eduard Amorós", "amoros@marmenuda.com", tr("Traduction en catalan"));
addAuthor(translators, "Nikos Papadopoylos", "231036448@freemail.gr", tr("Traduction en grec"));
addAuthor(translators, "Yannis Gyftomitros", "yang@hellug.gr", tr("Traduction en grec"));
addAuthor(translators, "Paul Van Deelen", "shooter@home.nl", tr("Traduction en néerlandais"));
addAuthor(translators, "Dik Leenheer", "dleenheer@suzerein.nl", tr("Traduction en néerlandais"));
addAuthor(translators, "Ronny Desmedt", "r.desmedt@live.be", tr("Traduction en flamand"));
addAuthor(translators, "OSS au2mation", "OSSau2mation@OSSau2mation.dk", tr("Traduction en danois"));
addAuthor(translators, "Hilario Silveira", "hilario@soliton.com.br", tr("Traduction en brézilien"));
addAuthor(translators, "Aziz Karabudak", "aziz.karabudak@argevi.com", tr("Traduction en Turc"));
addAuthor(translators, "Emir Izmiroglu", "emirizmiroglu@gmail.com", tr("Traduction en Turc"));
addAuthor(translators, "Gábor Gubányi", "gubanyig@gmail.com", tr("Traduction en hongrois"));
translators -> setOpenExternalLinks(true);
translators -> setTextFormat(Qt::RichText);
QWidget *translators_widget = new QWidget();
QHBoxLayout *translators_layout = new QHBoxLayout(translators_widget);
translators_layout -> addWidget(translators, 0, Qt::AlignCenter);
return(translators_widget);
}
/**
@return The widget content via the "Contributors" tab
*/
QWidget *AboutQET::contributorsTab() const {
QLabel *contributors = new QLabel();
addAuthor(contributors, "Remi Collet", "remi@fedoraproject.org", tr("Paquets Fedora et Red Hat"));
addAuthor(contributors, "David Geiger", "david.david@mageialinux-online.org", tr("Paquets Mageia"));
addAuthor(contributors, "Laurent Trinques", "scorpio@qelectrotech.org", tr("Paquets Debian"));
addAuthor(contributors, "Denis Briand", "debian@denis-briand.fr", tr("Paquets Debian"));
addAuthor(contributors, "W. Martin Borgert", "debacle@debian.org", tr("Paquets Debian"));
addAuthor(contributors, "Markos Chandras", "hwoarang@gentoo.org.", tr("Paquets Gentoo"));
addAuthor(contributors, "Mbit", "", tr("Paquets Gentoo"));
addAuthor(contributors, "Elbert", "", tr("Paquets OS/2"));
addAuthor(contributors, "zloidemon", "", tr("Paquets FreeBSD"));
addAuthor(contributors, "Yoann Varenne", "yoann@tuxfamily.org", tr("Paquets MAC OS X"));
addAuthor(contributors, "Chipsterjulien", "", tr("Paquets Archlinux AUR"));
addAuthor(contributors, "Nuno Pinheiro", "nuno@nuno-icons.com", tr("Icônes"));
addAuthor(contributors, "Cyril Frausti", "cyril@qelectrotech.org", tr("Développement"));
addAuthor(contributors, "Fernando Mateu Palou de Comasema", "fdomateu@gmail.com", tr("Documentation"));
addAuthor(contributors, "Arun Kishore Eswara", "eswara.arun@gmail.com", tr("Documentation"));
addAuthor(contributors, "René Negre", "runsys@qelectrotech.org", tr("Développement"));
addAuthor(contributors, "Nuri", "nuri@qelectrotech.org", tr("Collection d'éléments"));
addAuthor(contributors, "Raul Roda", "", tr("Python plugin qet-tb-generator"));
addAuthor(contributors, "Maximilian Federle", "", tr("Paquets Snap"));
contributors -> setOpenExternalLinks(true);
contributors -> setTextFormat(Qt::RichText);
QWidget *contributors_widget = new QWidget();
QHBoxLayout *contributors_layout = new QHBoxLayout(contributors_widget);
contributors_layout -> addWidget(contributors, 0, Qt::AlignCenter);
return(contributors_widget);
}
/**
@return The widget content via the "License Agreement" tab
*/
QWidget *AboutQET::licenseTab() const {
QWidget *license = new QWidget();
// label
QLabel *title_license = new QLabel(tr("Ce programme est sous licence GNU/GPL."));
// Text of the GNU/GPL in a scrollable text box not editable
QTextEdit *text_license = new QTextEdit();
text_license -> setPlainText(QET::license());
text_license -> setReadOnly(true);
// All in a vertical arrangement
QVBoxLayout *license_layout = new QVBoxLayout();
license_layout -> addWidget(title_license);
license_layout -> addWidget(text_license);
license -> setLayout(license_layout);
return(license);
}
/**
Adds a person to the list of authors
@param label QLabel which will add the person
@param name Name of person
@param email E-mail address of the person
@param work Function / work done by the person
*/
void AboutQET::addAuthor(QLabel *label, const QString &name, const QString &email, const QString &work) const {
QString new_text = label -> text();
QString author_template = "<span style=\"text-decoration: underline;\">%1</span> : %2 &lt;<a href=\"mailto:%3\">%3</a>&gt;&lrm;<br/><br/>";
// Add the function of the person
new_text += author_template.arg(work).arg(name).arg(email);
label -> setText(new_text);
}

View File

@@ -1,46 +0,0 @@
/*
Copyright 2006-2019 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ABOUTQET_H
#define ABOUTQET_H
#include <QDialog>
class QLabel;
/**
This class represents the "About QElectroTech" dialog.
*/
class AboutQET : public QDialog {
Q_OBJECT
// constructors, destructor
public:
AboutQET(QWidget * = nullptr);
~AboutQET() override;
private:
AboutQET(AboutQET &);
// methods
private:
QWidget *titleTab() const;
QWidget *aboutTab() const;
QWidget *authorsTab() const;
QWidget *translatorsTab() const;
QWidget *contributorsTab() const;
QWidget *licenseTab() const;
void addAuthor(QLabel *, const QString &, const QString &, const QString &) const;
};
#endif

View File

@@ -154,6 +154,21 @@ void DiagramContext::fromXml(const QDomElement &e, const QString &tag_name) {
}
}
/**
* @brief DiagramContext::fromXml
* Read this context properties from the @dom_element, looking for tags named @tag_name
* @param dom_element : dom element to parse
* @param tag_name : tag name to find, by default "property"
*/
void DiagramContext::fromXml(const pugi::xml_node &dom_element, const QString &tag_name)
{
for(auto node = dom_element.child(tag_name.toStdString().c_str()) ; node ; node = node.next_sibling(tag_name.toStdString().c_str()))
{
addValue(node.attribute("name").as_string(), QVariant(node.text().as_string()));
m_content_show.insert(node.attribute("name").as_string(), node.attribute("show").empty()? 1 : node.attribute("show").as_int());
}
}
/**
Export this context properties to \a settings by creating an array named \a
array_name.

View File

@@ -23,6 +23,8 @@
#include <QString>
#include <QVariant>
#include <QStringList>
#include "pugixml.hpp"
/**
This class represents a diagram context, i.e. the data (a list of key/value
pairs) of a diagram at a given time. It is notably used by titleblock templates
@@ -74,6 +76,7 @@ class DiagramContext
void toXml(QDomElement &, const QString & = "property") const;
void fromXml(const QDomElement &, const QString & = "property");
void fromXml(const pugi::xml_node &dom_element, const QString &tag_name = "property");
void toSettings(QSettings &, const QString &) const;
void fromSettings(QSettings &, const QString &);

View File

@@ -168,9 +168,10 @@ bool ElementsCollectionCache::fetchElement(ElementsLocation &location)
}
else
{
auto uuid = location.uuid();
QString element_path = location.toString();
bool got_name = fetchNameFromCache(element_path, location.uuid());
bool got_pixmap = fetchPixmapFromCache(element_path, location.uuid());
bool got_name = fetchNameFromCache(element_path, uuid);
bool got_pixmap = fetchPixmapFromCache(element_path, uuid);
if (got_name && got_pixmap) {
return(true);
@@ -178,8 +179,8 @@ bool ElementsCollectionCache::fetchElement(ElementsLocation &location)
if (fetchData(location))
{
cacheName(element_path, location.uuid());
cachePixmap(element_path, location.uuid());
cacheName(element_path, uuid);
cachePixmap(element_path, uuid);
}
return(true);
}

View File

@@ -40,9 +40,10 @@ Element * ElementFactory::createElement(const ElementsLocation &location, QGraph
return nullptr;
}
if (location.xml().hasAttribute("link_type"))
auto doc = location.pugiXml();
if (doc.document_element().attribute("link_type"))
{
QString link_type = location.xml().attribute("link_type");
QString link_type(doc.document_element().attribute("link_type").as_string());
if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, state));
if (link_type == "master") return (new MasterElement (location, qgi, state));
if (link_type == "slave") return (new SlaveElement (location, qgi, state));

View File

@@ -83,15 +83,15 @@ QPixmap ElementPictureFactory::pixmap(const ElementsLocation &location)
if(build(location))
{
QDomElement dom = location.xml();
auto doc = location.pugiXml();
//size
int w = dom.attribute("width").toInt();
int h = dom.attribute("height").toInt();
int w = doc.document_element().attribute("width").as_int();
int h = doc.document_element().attribute("height").as_int();
while (w % 10) ++ w;
while (h % 10) ++ h;
//hotspot
int hsx = qMin(dom.attribute("hotspot_x").toInt(), w);
int hsy = qMin(dom.attribute("hotspot_y").toInt(), h);
int hsx = qMin(doc.document_element().attribute("hotspot_x").as_int(), w);
int hsy = qMin(doc.document_element().attribute("hotspot_y").as_int(), h);
QPixmap pix(w, h);
pix.fill(QColor(255, 255, 255, 0));

View File

@@ -0,0 +1,75 @@
/**
* pugixml parser - version 1.10
* --------------------------------------------------------
* Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/
#ifndef HEADER_PUGICONFIG_HPP
#define HEADER_PUGICONFIG_HPP
// Uncomment this to enable wchar_t mode
// #define PUGIXML_WCHAR_MODE
// Uncomment this to enable compact mode
// #define PUGIXML_COMPACT
// Uncomment this to disable XPath
// #define PUGIXML_NO_XPATH
// Uncomment this to disable STL
// #define PUGIXML_NO_STL
// Uncomment this to disable exceptions
// #define PUGIXML_NO_EXCEPTIONS
// Set this to control attributes for public classes/functions, i.e.:
// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
// #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL
// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead
// Tune these constants to adjust memory-related behavior
// #define PUGIXML_MEMORY_PAGE_SIZE 32768
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
// Uncomment this to switch to header-only version
// #define PUGIXML_HEADER_ONLY
// Uncomment this to enable long long support
// #define PUGIXML_HAS_LONG_LONG
#endif
/**
* Copyright (c) 2006-2019 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/

12929
sources/pugixml/pugixml.cpp Normal file

File diff suppressed because it is too large Load Diff

1491
sources/pugixml/pugixml.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,6 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qetapp.h"
#include "aboutqet.h"
#include "configdialog.h"
#include "configpages.h"
#include "qetdiagrameditor.h"
@@ -33,6 +32,7 @@
#include "qetmessagebox.h"
#include "projectview.h"
#include "elementpicturefactory.h"
#include "aboutqetdialog.h"
#include <cstdlib>
#include <iostream>
@@ -1502,12 +1502,11 @@ void QETApp::configureQET() {
*/
void QETApp::aboutQET()
{
AboutQET aq(qApp->activeWindow());
AboutQETDialog aqd(qApp->activeWindow());
#ifdef Q_OS_MACOS
aq.setWindowFlags(Qt::Sheet);
aqd.setWindowFlags(Qt::Sheet);
#endif
aq.exec();
aqd.exec();
}
/**

View File

@@ -0,0 +1,188 @@
/*
Copyright 2006-2019 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aboutqetdialog.h"
#include "ui_aboutqetdialog.h"
#include "qet.h"
AboutQETDialog::AboutQETDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutQETDialog)
{
ui->setupUi(this);
setAbout();
setAuthors();
setTranslators();
setContributors();
setVersion();
setLibraries();
setLicence();
}
AboutQETDialog::~AboutQETDialog()
{
delete ui;
}
void AboutQETDialog::setAbout()
{
QString str = tr("QElectroTech, une application de réalisation de schémas électriques.", "about tab, description line") +
"<br><br>" +
tr("2006-2019 Les développeurs de QElectroTech", "about tab, developers line") +
"<br><br>"
"<a href=\"https://qelectrotech.org/\">https://qelectrotech.org/</a>"
"<br><br>" +
tr("Contact : <a href=\"mailto:qet@lists.tuxfamily.org\">qet@lists.tuxfamily.org</a>", "about tab, contact line");
ui->m_about_label->setText(str);
}
void AboutQETDialog::setAuthors()
{
addAuthor(ui->m_author_label, "Benoît Ansieau", "benoit@qelectrotech.org", tr("Idée originale"));
addAuthor(ui->m_author_label, "Laurent Trinques", "scorpio@qelectrotech.org", tr("Développement"));
addAuthor(ui->m_author_label, "Joshua Claveau", "Joshua@qelectrotech.org", tr("Développement"));
addAuthor(ui->m_author_label, "Davi Fochi", "davi@fochi.com.br", tr("Développement"));
addAuthor(ui->m_author_label, "Ronny Desmedt", "r.desmedt@live.be", tr("Convertisseur DXF"));
addAuthor(ui->m_author_label, "Raul Roda", "raulroda8@gmail.com", tr("Plugin Bornier"));
addAuthor(ui->m_author_label, "Abhishek Bansal", "abhishek@qelectrotech.org", tr("Développement"));
}
void AboutQETDialog::setTranslators()
{
addAuthor(ui->m_translators_label, "Alfredo Carreto", "electronicos_mx@yahoo.com.mx", tr("Traduction en espagnol"));
addAuthor(ui->m_translators_label, "Edgar Robles Najar", "tgo.edrobles@gmail.com", tr("Traduction en espagnol"));
addAuthor(ui->m_translators_label, "Yuriy Litkevich", "yuriy@qelectrotech.org", tr("Traduction en russe"));
addAuthor(ui->m_translators_label, "Evgeny Kozlov", "Evgeny.Kozlov.mailbox@gmail.com",tr("Traduction en russe"));
addAuthor(ui->m_translators_label, "José Carlos Martins", "jose@qelectrotech.org", tr("Traduction en portugais"));
addAuthor(ui->m_translators_label, "Pavel Fric", "pavelfric@seznam.cz", tr("Traduction en tchèque"));
addAuthor(ui->m_translators_label, "Pawe&#x0142; &#x015A;miech", "pawel32640@gmail.com", tr("Traduction en polonais"));
addAuthor(ui->m_translators_label, "Markus Budde & Jonas Stein & Noah Braden", "news@jonasstein.de", tr("Traduction en allemand"));
addAuthor(ui->m_translators_label, "Nuri", "nuri@qelectrotech.org", tr("Traduction en allemand"));
addAuthor(ui->m_translators_label, "Gabi Mandoc", "gabriel.mandoc@gic.ro", tr("Traduction en roumain"));
addAuthor(ui->m_translators_label, "Alessandro Conti & Silvio", "silvio@qelectrotech.org", tr("Traduction en italien"));
addAuthor(ui->m_translators_label, "Mohamed Souabni", "souabnimohamed@yahoo.fr", tr("Traduction en arabe"));
addAuthor(ui->m_translators_label, "Antun Marakovi&#x0107;", "antun.marakovic@lolaribar.hr", tr("Traduction en croate"));
addAuthor(ui->m_translators_label, "Eduard Amorós", "amoros@marmenuda.com", tr("Traduction en catalan"));
addAuthor(ui->m_translators_label, "Nikos Papadopoylos", "231036448@freemail.gr", tr("Traduction en grec"));
addAuthor(ui->m_translators_label, "Yannis Gyftomitros", "yang@hellug.gr", tr("Traduction en grec"));
addAuthor(ui->m_translators_label, "Paul Van Deelen", "shooter@home.nl", tr("Traduction en néerlandais"));
addAuthor(ui->m_translators_label, "Dik Leenheer", "dleenheer@suzerein.nl", tr("Traduction en néerlandais"));
addAuthor(ui->m_translators_label, "Ronny Desmedt", "r.desmedt@live.be", tr("Traduction en flamand"));
addAuthor(ui->m_translators_label, "OSS au2mation", "OSSau2mation@OSSau2mation.dk", tr("Traduction en danois"));
addAuthor(ui->m_translators_label, "Hilario Silveira", "hilario@soliton.com.br", tr("Traduction en brézilien"));
addAuthor(ui->m_translators_label, "Aziz Karabudak", "aziz.karabudak@argevi.com", tr("Traduction en Turc"));
addAuthor(ui->m_translators_label, "Emir Izmiroglu", "emirizmiroglu@gmail.com", tr("Traduction en Turc"));
addAuthor(ui->m_translators_label, "Gábor Gubányi", "gubanyig@gmail.com", tr("Traduction en hongrois"));
}
void AboutQETDialog::setContributors()
{
addAuthor(ui->m_contrib_label, "Remi Collet", "remi@fedoraproject.org", tr("Paquets Fedora et Red Hat"));
addAuthor(ui->m_contrib_label, "David Geiger", "david.david@mageialinux-online.org", tr("Paquets Mageia"));
addAuthor(ui->m_contrib_label, "Laurent Trinques", "scorpio@qelectrotech.org", tr("Paquets Debian"));
addAuthor(ui->m_contrib_label, "Denis Briand", "debian@denis-briand.fr", tr("Paquets Debian"));
addAuthor(ui->m_contrib_label, "W. Martin Borgert", "debacle@debian.org", tr("Paquets Debian"));
addAuthor(ui->m_contrib_label, "Markos Chandras", "hwoarang@gentoo.org.", tr("Paquets Gentoo"));
addAuthor(ui->m_contrib_label, "Mbit", "", tr("Paquets Gentoo"));
addAuthor(ui->m_contrib_label, "Elbert", "", tr("Paquets OS/2"));
addAuthor(ui->m_contrib_label, "zloidemon", "", tr("Paquets FreeBSD"));
addAuthor(ui->m_contrib_label, "Yoann Varenne", "yoann@tuxfamily.org", tr("Paquets MAC OS X"));
addAuthor(ui->m_contrib_label, "Chipsterjulien", "", tr("Paquets Archlinux AUR"));
addAuthor(ui->m_contrib_label, "Nuno Pinheiro", "nuno@nuno-icons.com", tr("Icônes"));
addAuthor(ui->m_contrib_label, "Cyril Frausti", "cyril@qelectrotech.org", tr("Développement"));
addAuthor(ui->m_contrib_label, "Fernando Mateu Palou de Comasema", "fdomateu@gmail.com", tr("Documentation"));
addAuthor(ui->m_contrib_label, "Arun Kishore Eswara", "eswara.arun@gmail.com", tr("Documentation"));
addAuthor(ui->m_contrib_label, "René Negre", "runsys@qelectrotech.org", tr("Développement"));
addAuthor(ui->m_contrib_label, "Nuri", "nuri@qelectrotech.org", tr("Collection d'éléments"));
addAuthor(ui->m_contrib_label, "Raul Roda", "", tr("Python plugin qet-tb-generator"));
addAuthor(ui->m_contrib_label, "Maximilian Federle", "", tr("Paquets Snap"));
}
void AboutQETDialog::setVersion()
{
QString str = "<span style=\"font-weight:bold;font-size:16pt;\">QElectroTech V " + QET::displayedVersion + "</span>";
QString compilation_info = "<br />" + tr("Compilation : ");
#ifdef __GNUC__
#ifdef __APPLE_CC__
compilation_info += " CLANG " + QString(__clang_version__ );
compilation_info += " <br>Built with Qt " + QString(QT_VERSION_STR);
compilation_info += " - Date : " + QString(__DATE__);
compilation_info += " : " + QString(__TIME__);
compilation_info += " <br>Run with Qt "+ QString(qVersion());
compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
compilation_info += "<br>" " OS : " + QString(QSysInfo::kernelType());
compilation_info += " - " + QString(QSysInfo::currentCpuArchitecture());
compilation_info += " - Version : " + QString(QSysInfo::prettyProductName());
compilation_info += "</br>" " - Kernel : " + QString(QSysInfo::kernelVersion());
#else
compilation_info += " GCC " + QString(__VERSION__);
compilation_info += "<br>Built with Qt " + QString(QT_VERSION_STR);
compilation_info += " - Date : " + QString(__DATE__);
compilation_info += " : " + QString(__TIME__);
compilation_info += " <br>Run with Qt "+ QString(qVersion());
compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
compilation_info += "<br>" " OS : " + QString(QSysInfo::kernelType());
compilation_info += " - " + QString(QSysInfo::currentCpuArchitecture());
compilation_info += " - Version : " + QString(QSysInfo::prettyProductName());
compilation_info += "</br>" " - Kernel : " + QString(QSysInfo::kernelVersion());
#endif
#endif
ui->m_version_label->setText(str + compilation_info);
}
void AboutQETDialog::setLibraries()
{
addLibrary(ui->m_libraries_label, "KDE lib", "https://api.kde.org");
addLibrary(ui->m_libraries_label, "Single application", "https://github.com/itay-grudev/SingleApplication");
addLibrary(ui->m_libraries_label, "pugixml", "https://pugixml.org");
}
void AboutQETDialog::setLicence()
{
ui->m_license_text_edit->setPlainText(QET::license());
}
/**
* @brief AboutQETDialog::addAuthor
* Adds a person to the list of authors
* @param label : QLabel which will add the person
* @param name : Name of person
* @param email : E-mail address of the person
* @param work : Function / work done by the person
*/
void AboutQETDialog::addAuthor(QLabel *label, const QString &name, const QString &email, const QString &work)
{
QString new_text = label->text();
QString author_template = "<span style=\"text-decoration: underline;\">%1</span> : %2 &lt;<a href=\"mailto:%3\">%3</a>&gt;&lrm;<br/><br/>";
// Add the function of the person
new_text += author_template.arg(work).arg(name).arg(email);
label->setText(new_text);
}
void AboutQETDialog::addLibrary(QLabel *label, const QString &name, const QString &link)
{
QString new_text = label->text();
QString Library_template = "<span style=\"text-decoration: underline;\">%1</span> : &lt;<a href=\"%3\">%3</a>&gt;&lrm;<br/><br/>";
// Add the function of the person
new_text += Library_template.arg(name).arg(link);
label->setText(new_text);
}

View File

@@ -0,0 +1,52 @@
/*
Copyright 2006-2019 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ABOUTQETDIALOG_H
#define ABOUTQETDIALOG_H
#include <QDialog>
class QLabel;
namespace Ui {
class AboutQETDialog;
}
class AboutQETDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutQETDialog(QWidget *parent = nullptr);
~AboutQETDialog();
private:
void setAbout();
void setAuthors();
void setTranslators();
void setContributors();
void setVersion();
void setLibraries();
void setLicence();
void addAuthor(QLabel *label, const QString &name, const QString &email, const QString &work);
void addLibrary(QLabel *label, const QString &name, const QString &link);
private:
Ui::AboutQETDialog *ui;
};
#endif // ABOUTQETDIALOG_H

View File

@@ -0,0 +1,493 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutQETDialog</class>
<widget class="QDialog" name="AboutQETDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>500</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>À propos de QElectrotech</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>À propos</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="m_about_label">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Auteurs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>676</width>
<height>420</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_author_label">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Traducteurs</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>676</width>
<height>420</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_translators_label">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Contributeurs</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_3">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>676</width>
<height>420</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_contrib_label">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>Version</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_version_label">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_7">
<attribute name="title">
<string>Bibliothèques</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_4">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_4">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>676</width>
<height>420</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_libraries_label">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>Accord de licence</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QLabel" name="m_license_label">
<property name="text">
<string>Ce programme est sous licence GNU/GPL.</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="m_license_text_edit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AboutQETDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AboutQETDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -17,7 +17,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">