Merge branch 'master' of ssh://git.tuxfamily.org/gitroot/qet/qet

This commit is contained in:
David Varley
2020-09-08 22:10:31 +10:00
212 changed files with 4662 additions and 2455 deletions

Binary file not shown.

View File

@@ -51,7 +51,7 @@
<message> <message>
<location filename="../sources/ui/aboutqetdialog.ui" line="449"/> <location filename="../sources/ui/aboutqetdialog.ui" line="449"/>
<source>log</source> <source>log</source>
<translation type="unfinished"></translation> <translation>Log</translation>
</message> </message>
<message> <message>
<location filename="../sources/ui/aboutqetdialog.cpp" line="58"/> <location filename="../sources/ui/aboutqetdialog.cpp" line="58"/>
@@ -103,7 +103,7 @@
<message> <message>
<location filename="../sources/ui/aboutqetdialog.cpp" line="85"/> <location filename="../sources/ui/aboutqetdialog.cpp" line="85"/>
<source>Collection</source> <source>Collection</source>
<translation type="unfinished">Collectie</translation> <translation>Collectie</translation>
</message> </message>
<message> <message>
<location filename="../sources/ui/aboutqetdialog.cpp" line="93"/> <location filename="../sources/ui/aboutqetdialog.cpp" line="93"/>
@@ -607,7 +607,7 @@ Noot: Geen van deze opties bepalen het wel of niet automatisch nummeren, alleen
<message> <message>
<location filename="../sources/ui/bomexportdialog.ui" line="14"/> <location filename="../sources/ui/bomexportdialog.ui" line="14"/>
<source>Dialog</source> <source>Dialog</source>
<translation type="unfinished"></translation> <translation>Exporteren</translation>
</message> </message>
<message> <message>
<location filename="../sources/ui/bomexportdialog.ui" line="20"/> <location filename="../sources/ui/bomexportdialog.ui" line="20"/>
@@ -617,12 +617,12 @@ Noot: Geen van deze opties bepalen het wel of niet automatisch nummeren, alleen
<message> <message>
<location filename="../sources/ui/bomexportdialog.ui" line="26"/> <location filename="../sources/ui/bomexportdialog.ui" line="26"/>
<source>inclure les en-têtes</source> <source>inclure les en-têtes</source>
<translation type="unfinished"></translation> <translation>Inclusief kopteksten</translation>
</message> </message>
<message> <message>
<location filename="../sources/ui/bomexportdialog.ui" line="36"/> <location filename="../sources/ui/bomexportdialog.ui" line="36"/>
<source>Formater en tant que liste de materiel</source> <source>Formater en tant que liste de materiel</source>
<translation type="unfinished"></translation> <translation>Volgens materiaallijst</translation>
</message> </message>
<message> <message>
<location filename="../sources/ui/bomexportdialog.cpp" line="65"/> <location filename="../sources/ui/bomexportdialog.cpp" line="65"/>
@@ -661,13 +661,13 @@ Noot: Geen van deze opties bepalen het wel of niet automatisch nummeren, alleen
<message> <message>
<location filename="../sources/ui/bomexportdialog.cpp" line="119"/> <location filename="../sources/ui/bomexportdialog.cpp" line="119"/>
<source>Position du folio</source> <source>Position du folio</source>
<translation type="unfinished">Plaats van het blad</translation> <translation>Plaats van het blad</translation>
</message> </message>
<message> <message>
<location filename="../sources/ui/bomexportdialog.cpp" line="121"/> <location filename="../sources/ui/bomexportdialog.cpp" line="121"/>
<source>Quantité numéro d&apos;article</source> <source>Quantité numéro d&apos;article</source>
<comment>Special field with name : designation quantity</comment> <comment>Special field with name : designation quantity</comment>
<translation type="unfinished"></translation> <translation>Aantal itemnummer</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -3311,7 +3311,7 @@ Hier kunt u de standaardtekst hiervoor opgeven voor nieuwe elementen :</translat
<message> <message>
<location filename="../sources/ui/configpage/generalconfigurationpage.cpp" line="271"/> <location filename="../sources/ui/configpage/generalconfigurationpage.cpp" line="271"/>
<source>Japonais</source> <source>Japonais</source>
<translation type="unfinished"></translation> <translation>Japans</translation>
</message> </message>
<message> <message>
<location filename="../sources/ui/configpage/generalconfigurationpage.cpp" line="272"/> <location filename="../sources/ui/configpage/generalconfigurationpage.cpp" line="272"/>
@@ -3490,7 +3490,7 @@ Hier kunt u de standaardtekst hiervoor opgeven voor nieuwe elementen :</translat
<message> <message>
<location filename="../sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.ui" line="234"/> <location filename="../sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.ui" line="234"/>
<source>TextLabel</source> <source>TextLabel</source>
<translation type="unfinished">Tekstlabel</translation> <translation>Tekstlabel</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.ui" line="250"/> <location filename="../sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.ui" line="250"/>
@@ -3592,7 +3592,8 @@ Hier kunt u de standaardtekst hiervoor opgeven voor nieuwe elementen :</translat
<location filename="../sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp" line="338"/> <location filename="../sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp" line="338"/>
<source>&lt;center&gt;ATTENTION :&lt;/center&gt; <source>&lt;center&gt;ATTENTION :&lt;/center&gt;
il manque %1 lignes afin d&apos;afficher l&apos;intégralité des informations</source> il manque %1 lignes afin d&apos;afficher l&apos;intégralité des informations</source>
<translation type="unfinished"></translation> <translation>&lt;center&gt;ATTENTIE :&lt;/center&gt;
er missen %1 regels om alle informatie weer te geven</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp" line="450"/> <location filename="../sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp" line="450"/>
@@ -4073,12 +4074,12 @@ Hiervoor gebruikt u de geavanceerde tekstbewerker.</translation>
<message> <message>
<location filename="../sources/machine_info.cpp" line="86"/> <location filename="../sources/machine_info.cpp" line="86"/>
<source>Compilation : </source> <source>Compilation : </source>
<translation type="unfinished">Compilatie: </translation> <translation>Compilatie: </translation>
</message> </message>
<message> <message>
<location filename="../sources/machine_info.cpp" line="306"/> <location filename="../sources/machine_info.cpp" line="306"/>
<source>Compilation : </source> <source>Compilation : </source>
<translation type="unfinished"></translation> <translation>Compilatie : </translation>
</message> </message>
</context> </context>
<context> <context>
@@ -4975,12 +4976,12 @@ Wilt u de wijzigingen opslaan?</translation>
<message> <message>
<location filename="../sources/projectview.cpp" line="726"/> <location filename="../sources/projectview.cpp" line="726"/>
<source>Revenir au debut du projet</source> <source>Revenir au debut du projet</source>
<translation type="unfinished"></translation> <translation>Ga terug naar het begin van het project</translation>
</message> </message>
<message> <message>
<location filename="../sources/projectview.cpp" line="729"/> <location filename="../sources/projectview.cpp" line="729"/>
<source>Aller à la fin du projet</source> <source>Aller à la fin du projet</source>
<translation type="unfinished"></translation> <translation>Ga naar het einde van het project</translation>
</message> </message>
<message> <message>
<location filename="../sources/projectview.cpp" line="743"/> <location filename="../sources/projectview.cpp" line="743"/>
@@ -5062,7 +5063,7 @@ Wilt u de wijzigingen opslaan?</translation>
<location filename="../sources/qetapp.cpp" line="192"/> <location filename="../sources/qetapp.cpp" line="192"/>
<source>LTR</source> <source>LTR</source>
<comment>Translate this string to RTL if you are translating to a Right-to-Left language, else translate to LTR</comment> <comment>Translate this string to RTL if you are translating to a Right-to-Left language, else translate to LTR</comment>
<translation type="unfinished">LTR</translation> <translation>LTR</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetapp.cpp" line="397"/> <location filename="../sources/qetapp.cpp" line="397"/>
@@ -5146,13 +5147,13 @@ Wilt u de wijzigingen opslaan?</translation>
<location filename="../sources/qetapp.cpp" line="519"/> <location filename="../sources/qetapp.cpp" line="519"/>
<source>Cartouches QET</source> <source>Cartouches QET</source>
<comment>title of the title block templates collection provided by QElectroTech</comment> <comment>title of the title block templates collection provided by QElectroTech</comment>
<translation type="unfinished">QElectroTech titelbloksjablonen</translation> <translation>QElectroTech titelbloksjablonen</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetapp.cpp" line="538"/> <location filename="../sources/qetapp.cpp" line="538"/>
<source>Cartouches utilisateur</source> <source>Cartouches utilisateur</source>
<comment>title of the user&apos;s title block templates collection</comment> <comment>title of the user&apos;s title block templates collection</comment>
<translation type="unfinished">Mijn titelbloksjablonen</translation> <translation>Mijn titelbloksjablonen</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetapp.cpp" line="1985"/> <location filename="../sources/qetapp.cpp" line="1985"/>
@@ -8654,7 +8655,7 @@ Wilt u deze vervangen ?</translation>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="2346"/> <location filename="../sources/qetdiagrameditor.cpp" line="2346"/>
<source>To install the plugin qet_tb_generator&lt;br&gt;Visit :&lt;br&gt;&lt;a href=&apos;https://pypi.python.org/pypi/qet-tb-generator&apos;&gt;qet-tb-generator&lt;/a&gt;&lt;br&gt;&lt;br&gt;Requires python 3.5 or above.&lt;br&gt;&lt;br&gt;&lt;B&gt;&lt;U&gt; First install on Linux&lt;/B&gt;&lt;/U&gt;&lt;br&gt;1. check you have pip3 installed: pip3 --version&lt;br&gt;If not install with: sudo apt-get install python3-pip&lt;br&gt;2. Install the program: sudo pip3 install qet_tb_generator&lt;br&gt;3. Run the program: qet_tb_generator&lt;br&gt;&lt;br&gt;&lt;B&gt;&lt;U&gt; Update on Linux&lt;/B&gt;&lt;/U&gt;&lt;br&gt;sudo pip3 install --upgrade qet_tb_generator&lt;br&gt;</source> <source>To install the plugin qet_tb_generator&lt;br&gt;Visit :&lt;br&gt;&lt;a href=&apos;https://pypi.python.org/pypi/qet-tb-generator&apos;&gt;qet-tb-generator&lt;/a&gt;&lt;br&gt;&lt;br&gt;Requires python 3.5 or above.&lt;br&gt;&lt;br&gt;&lt;B&gt;&lt;U&gt; First install on Linux&lt;/B&gt;&lt;/U&gt;&lt;br&gt;1. check you have pip3 installed: pip3 --version&lt;br&gt;If not install with: sudo apt-get install python3-pip&lt;br&gt;2. Install the program: sudo pip3 install qet_tb_generator&lt;br&gt;3. Run the program: qet_tb_generator&lt;br&gt;&lt;br&gt;&lt;B&gt;&lt;U&gt; Update on Linux&lt;/B&gt;&lt;/U&gt;&lt;br&gt;sudo pip3 install --upgrade qet_tb_generator&lt;br&gt;</source>
<translation type="unfinished"></translation> <translation>Installatie van de qet_tb_generator&lt;br&gt;Ga naar:&lt;br&gt;&lt;a href=&apos;https://pypi.python.org/pypi/qet-tb-generator&apos;&gt;qet-tb-generator&lt;/a&gt;&lt;br&gt;&lt;br&gt;Vereist Python 3.5 of hoger.&lt;br&gt;&lt;br&gt;&lt;B&gt;&lt;U&gt; Eerste installatie onder Linux&lt;/B&gt;&lt;/U&gt;&lt;br&gt;1. Controleer of je pip3 geinstalleerd hebt: pip3 --version&lt;br&gt;Indien nodig installeer met: sudo apt get install python3-pip&lt;br&gt;2. Installeer het programma: sudo pip3 install qet_tb_generator&lt;br&gt;3 Voer het programma uit: qet_tb_generator&lt;br&gt;&lt;br&gt;&lt;B&gt;&lt;U&gt; Updaten onder Linux&lt;/B&gt;&lt;/U&gt;&lt;br&gt;sudo pip3 install --upgrade qet_tb_generator&lt;br&gt;</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetdiagrameditor.cpp" line="2366"/> <location filename="../sources/qetdiagrameditor.cpp" line="2366"/>
@@ -8679,7 +8680,7 @@ Wilt u deze vervangen ?</translation>
<message> <message>
<location filename="../sources/editor/UndoCommand/pastepartscommand.cpp" line="45"/> <location filename="../sources/editor/UndoCommand/pastepartscommand.cpp" line="45"/>
<source>Coller</source> <source>Coller</source>
<translation type="unfinished"></translation> <translation>Plakken</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -8703,18 +8704,20 @@ Wilt u deze vervangen ?</translation>
<location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="108"/> <location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="108"/>
<source>Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par les tableaux. <source>Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par les tableaux.
Veuillez ajouter un nouveau tableau ou regler les tableaux existant afin d&apos;afficher l&apos;integralité des informations.</source> Veuillez ajouter un nouveau tableau ou regler les tableaux existant afin d&apos;afficher l&apos;integralité des informations.</source>
<translation type="unfinished"></translation> <translation>Er is meer informatie dan in de tabellen kan worden weergegeven.
Maak een nieuwe tabel of pas de huidige tabellen aan zodat alle informatie kan worden weergegeven.</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="111"/> <location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="111"/>
<source>Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par le tableau. <source>Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par le tableau.
Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d&apos;afficher l&apos;integralité des informations.</source> Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d&apos;afficher l&apos;integralité des informations.</source>
<translation type="unfinished"></translation> <translation>Er is meer informatie dan in de tabel kan worden weergegeven.
Maak een nieuwe tabel of pas de huidige tabel aan zodat alle informatie kan worden weergegeven.</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="114"/> <location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="114"/>
<source>Limitation de tableau</source> <source>Limitation de tableau</source>
<translation type="unfinished"></translation> <translation>Tabelgrenzen</translation>
</message> </message>
<message> <message>
<location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="761"/> <location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="761"/>
@@ -12901,13 +12904,13 @@ Maximale afmeting : %2px
<message> <message>
<location filename="../sources/main.cpp" line="213"/> <location filename="../sources/main.cpp" line="213"/>
<source>Unstable file format!</source> <source>Unstable file format!</source>
<translation type="unfinished"></translation> <translation>Instabiel bestandsformaat!</translation>
</message> </message>
<message> <message>
<location filename="../sources/main.cpp" line="216"/> <location filename="../sources/main.cpp" line="216"/>
<source>&lt;p&gt;&lt;b&gt;ATTENTION: This application version is UNSTABLE!&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Everything you do with this application can break your workspace, libraries or projects! Saved files will not be readable with stable releases of QElectroTech. It&apos;s highly recommended to create a backup before proceeding. If you are unsure, please download an official stable release instead.&lt;/p&gt;&lt;p&gt;Are you really sure to continue with the risk of breaking your files?!&lt;/p&gt;</source> <source>&lt;p&gt;&lt;b&gt;ATTENTION: This application version is UNSTABLE!&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Everything you do with this application can break your workspace, libraries or projects! Saved files will not be readable with stable releases of QElectroTech. It&apos;s highly recommended to create a backup before proceeding. If you are unsure, please download an official stable release instead.&lt;/p&gt;&lt;p&gt;Are you really sure to continue with the risk of breaking your files?!&lt;/p&gt;</source>
<comment>this text is not finished yet, expect changes!</comment> <comment>this text is not finished yet, expect changes!</comment>
<translation type="unfinished"></translation> <translation>&lt;p&gt;&lt;b&gt;ATTENTIE: Deze programmaversie is NIET STABIEL!&lt;/&gt;&lt;/p&gt;&lt;p&gt;Door het gebruik van deze versie kun je je werkomgeving, bibliotheken of projecten beschadigen! Hiermee opgeslagen bestanden zijn niet leesbaar voor stabiele versies van QElectroTech. Het wordt met klem aangeraden backups te maken voor je verder gaat. Als je enigszins twijfelt, download dan een officiele stabiel versie &lt;/p&gt;&lt;p&gt;Weet je zeker dat je verder wilt gaan met het risico je bestanden te beschadigen?!&lt;/p&gt;</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@@ -53,7 +53,8 @@ ElementsLocation::ElementsLocation(const QString &path, QETProject *project) :
@brief ElementsLocation::~ElementsLocation @brief ElementsLocation::~ElementsLocation
Destructeur Destructeur
*/ */
ElementsLocation::~ElementsLocation() { ElementsLocation::~ElementsLocation()
{
} }
/** /**
@@ -110,7 +111,8 @@ ElementsLocation &ElementsLocation::operator=(const ElementsLocation &other) {
\~French true si other et cet ElementsLocation sont identiques, \~French true si other et cet ElementsLocation sont identiques,
false sinon false sinon
*/ */
bool ElementsLocation::operator==(const ElementsLocation &other) const { bool ElementsLocation::operator==(const ElementsLocation &other) const
{
return( return(
m_collection_path == other.m_collection_path &&\ m_collection_path == other.m_collection_path &&\
m_project == other.m_project m_project == other.m_project
@@ -124,7 +126,8 @@ bool ElementsLocation::operator==(const ElementsLocation &other) const {
@return true si other et cet ElementsLocation sont differents, @return true si other et cet ElementsLocation sont differents,
false sinon false sinon
*/ */
bool ElementsLocation::operator!=(const ElementsLocation &other) const { bool ElementsLocation::operator!=(const ElementsLocation &other) const
{
return( return(
m_collection_path != other.m_collection_path ||\ m_collection_path != other.m_collection_path ||\
m_project != other.m_project m_project != other.m_project
@@ -139,7 +142,8 @@ bool ElementsLocation::operator!=(const ElementsLocation &other) const {
For exemple if this location represent an element they return myElement. For exemple if this location represent an element they return myElement.
@see fileName() @see fileName()
*/ */
QString ElementsLocation::baseName() const { QString ElementsLocation::baseName() const
{
QRegExp regexp("^.*([^/]+)\\.elmt$"); QRegExp regexp("^.*([^/]+)\\.elmt$");
if (regexp.exactMatch(m_collection_path)) { if (regexp.exactMatch(m_collection_path)) {
return(regexp.capturedTexts().at(1)); return(regexp.capturedTexts().at(1));
@@ -203,7 +207,8 @@ QString ElementsLocation::fileSystemPath() const
@return The path of this location. @return The path of this location.
@deprecated use instead collectionPath(true) @deprecated use instead collectionPath(true)
*/ */
QString ElementsLocation::path() const { QString ElementsLocation::path() const
{
return(m_collection_path); return(m_collection_path);
} }
@@ -343,7 +348,8 @@ bool ElementsLocation::addToPath(const QString &string)
@return the location of the parent category, or a copy of this location @return the location of the parent category, or a copy of this location
when it represents a root category. when it represents a root category.
*/ */
ElementsLocation ElementsLocation::parent() const { ElementsLocation ElementsLocation::parent() const
{
ElementsLocation copy(*this); ElementsLocation copy(*this);
QRegExp re1("^([a-z]+://)(.*)/*$"); QRegExp re1("^([a-z]+://)(.*)/*$");
if (re1.exactMatch(m_collection_path)) { if (re1.exactMatch(m_collection_path)) {
@@ -362,7 +368,8 @@ ElementsLocation ElementsLocation::parent() const {
\~French \~French
le projet de cet emplacement ou 0 si celui-ci n'est pas lie a un projet. le projet de cet emplacement ou 0 si celui-ci n'est pas lie a un projet.
*/ */
QETProject *ElementsLocation::project() const { QETProject *ElementsLocation::project() const
{
return(m_project); return(m_project);
} }
@@ -384,7 +391,8 @@ void ElementsLocation::setProject(QETProject *project) {
\~French \~French
true si l'emplacement semble utilisable (chemin virtuel non vide). true si l'emplacement semble utilisable (chemin virtuel non vide).
*/ */
bool ElementsLocation::isNull() const { bool ElementsLocation::isNull() const
{
return(m_collection_path.isEmpty()); return(m_collection_path.isEmpty());
} }
@@ -393,7 +401,8 @@ bool ElementsLocation::isNull() const {
@return A character string representing the location @return A character string representing the location
\~French Une chaine de caracteres representant l'emplacement \~French Une chaine de caracteres representant l'emplacement
*/ */
QString ElementsLocation::toString() const { QString ElementsLocation::toString() const
{
QString result; QString result;
if (m_project) { if (m_project) {
int project_id = QETApp::projectId(m_project); int project_id = QETApp::projectId(m_project);
@@ -409,7 +418,8 @@ QString ElementsLocation::toString() const {
@brief ElementsLocation::isElement @brief ElementsLocation::isElement
@return true if this location represent an element @return true if this location represent an element
*/ */
bool ElementsLocation::isElement() const { bool ElementsLocation::isElement() const
{
return m_collection_path.endsWith(".elmt"); return m_collection_path.endsWith(".elmt");
} }
@@ -417,7 +427,8 @@ bool ElementsLocation::isElement() const {
@brief ElementsLocation::isDirectory @brief ElementsLocation::isDirectory
@return true if this location represent a directory @return true if this location represent a directory
*/ */
bool ElementsLocation::isDirectory() const { bool ElementsLocation::isDirectory() const
{
return (!isElement() && !m_collection_path.isEmpty()); return (!isElement() && !m_collection_path.isEmpty());
} }

View File

@@ -107,7 +107,8 @@ XmlElementCollection::XmlElementCollection(const QDomElement &dom_element,
of the dom element is : collection of the dom element is : collection
@return The root QDomElement of the collection @return The root QDomElement of the collection
*/ */
QDomElement XmlElementCollection::root() const { QDomElement XmlElementCollection::root() const
{
return m_dom_document.documentElement(); return m_dom_document.documentElement();
} }
@@ -116,7 +117,8 @@ QDomElement XmlElementCollection::root() const {
@return The QDomElement import (the begining of a xml collection) or @return The QDomElement import (the begining of a xml collection) or
a null QDomElement if doesn't exist. a null QDomElement if doesn't exist.
*/ */
QDomElement XmlElementCollection::importCategory() const { QDomElement XmlElementCollection::importCategory() const
{
return root().firstChildElement("category"); return root().firstChildElement("category");
} }

View File

@@ -24,13 +24,15 @@ int NamesList::MetaTypeId = qRegisterMetaType<NamesList>("NamesList");
/** /**
Constructeur Constructeur
*/ */
NamesList::NamesList() { NamesList::NamesList()
{
} }
/** /**
Destructeur Destructeur
*/ */
NamesList::~NamesList() { NamesList::~NamesList()
{
} }
/** /**
@@ -56,28 +58,32 @@ void NamesList::removeName(const QString &lang) {
/** /**
Supprime tous les noms Supprime tous les noms
*/ */
void NamesList::clearNames() { void NamesList::clearNames()
{
hash_names.clear(); hash_names.clear();
} }
/** /**
@return La liste de toutes les langues disponibles @return La liste de toutes les langues disponibles
*/ */
QList<QString> NamesList::langs() const { QList<QString> NamesList::langs() const
{
return(hash_names.keys()); return(hash_names.keys());
} }
/** /**
@return true si la liste de noms est vide, false sinon @return true si la liste de noms est vide, false sinon
*/ */
bool NamesList::isEmpty() const { bool NamesList::isEmpty() const
{
return(hash_names.isEmpty()); return(hash_names.isEmpty());
} }
/** /**
@return Le nombre de noms dans la liste @return Le nombre de noms dans la liste
*/ */
int NamesList::count() const { int NamesList::count() const
{
return(hash_names.count()); return(hash_names.count());
} }
@@ -95,7 +101,8 @@ QString &NamesList::operator[](const QString &lang) {
@return Le nom dans la langue donnee ou QString() si ce nom n'est pas @return Le nom dans la langue donnee ou QString() si ce nom n'est pas
defini defini
*/ */
const QString NamesList::operator[](const QString &lang) const { const QString NamesList::operator[](const QString &lang) const
{
return(hash_names.value(lang)); return(hash_names.value(lang));
} }
@@ -166,7 +173,8 @@ void NamesList::fromXml(const pugi::xml_node &xml_element, const QHash<QString,
@return L'element XML correspondant a la section "names" @return L'element XML correspondant a la section "names"
@see count() @see count()
*/ */
QDomElement NamesList::toXml(QDomDocument &xml_document, const QHash<QString, QString> &xml_options) const { QDomElement NamesList::toXml(QDomDocument &xml_document, const QHash<QString, QString> &xml_options) const
{
QHash<QString, QString> xml_opt = getXmlOptions(xml_options); QHash<QString, QString> xml_opt = getXmlOptions(xml_options);
QDomElement names_elmt = xml_document.createElement(xml_opt["ParentTagName"]); QDomElement names_elmt = xml_document.createElement(xml_opt["ParentTagName"]);
QHashIterator<QString, QString> names_iterator(hash_names); QHashIterator<QString, QString> names_iterator(hash_names);
@@ -187,7 +195,8 @@ QDomElement NamesList::toXml(QDomDocument &xml_document, const QHash<QString, QS
* LanguageAttribute (falls back to "lang") * LanguageAttribute (falls back to "lang")
@return the same set, with at least all the known options @return the same set, with at least all the known options
*/ */
QHash<QString, QString> NamesList::getXmlOptions(const QHash<QString, QString> &xml_options) const { QHash<QString, QString> NamesList::getXmlOptions(const QHash<QString, QString> &xml_options) const
{
QHash<QString, QString> new_xml_options = xml_options; QHash<QString, QString> new_xml_options = xml_options;
if (!xml_options.contains("ParentTagName")) { if (!xml_options.contains("ParentTagName")) {
new_xml_options.insert("ParentTagName", "names"); new_xml_options.insert("ParentTagName", "names");
@@ -205,7 +214,8 @@ QHash<QString, QString> NamesList::getXmlOptions(const QHash<QString, QString> &
@param nl une autre liste de noms @param nl une autre liste de noms
@return true si les listes de noms sont differentes, false sinon @return true si les listes de noms sont differentes, false sinon
*/ */
bool NamesList::operator!=(const NamesList &nl) const { bool NamesList::operator!=(const NamesList &nl) const
{
return(hash_names != nl.hash_names); return(hash_names != nl.hash_names);
} }
@@ -213,7 +223,8 @@ bool NamesList::operator!=(const NamesList &nl) const {
@param nl une autre liste de noms @param nl une autre liste de noms
@return true si les listes de noms sont identiques, false sinon @return true si les listes de noms sont identiques, false sinon
*/ */
bool NamesList::operator==(const NamesList &nl) const { bool NamesList::operator==(const NamesList &nl) const
{
return(hash_names == nl.hash_names); return(hash_names == nl.hash_names);
} }
@@ -228,7 +239,8 @@ bool NamesList::operator==(const NamesList &nl) const {
@param fallback_name name to be returned when no adequate name has been found @param fallback_name name to be returned when no adequate name has been found
@return The adequate name regarding the current system locale. @return The adequate name regarding the current system locale.
*/ */
QString NamesList::name(const QString &fallback_name) const { QString NamesList::name(const QString &fallback_name) const
{
QString system_language = QETApp::langFromSetting(); QString system_language = QETApp::langFromSetting();
QString returned_name; QString returned_name;
if (!hash_names[system_language].isEmpty()) { if (!hash_names[system_language].isEmpty()) {

View File

@@ -35,7 +35,8 @@ NameListDialog::NameListDialog(QWidget *parent) :
#endif #endif
} }
NameListDialog::~NameListDialog() { NameListDialog::~NameListDialog()
{
delete ui; delete ui;
} }
@@ -48,7 +49,8 @@ void NameListDialog::setInformationText(const QString &text) {
@return the name list widget used by this dialog. @return the name list widget used by this dialog.
The ownership of the namelistwidget stay to this dialog The ownership of the namelistwidget stay to this dialog
*/ */
NameListWidget *NameListDialog::namelistWidget() const { NameListWidget *NameListDialog::namelistWidget() const
{
return m_namelist_widget; return m_namelist_widget;
} }
@@ -62,6 +64,7 @@ void NameListDialog::setHelpText(const QString &text)
} }
} }
void NameListDialog::showHelpDialog() { void NameListDialog::showHelpDialog()
{
QMessageBox::information(this, tr("Variables de cartouche"), m_help_text); QMessageBox::information(this, tr("Variables de cartouche"), m_help_text);
} }

View File

@@ -122,7 +122,8 @@ void NameListWidget::setReadOnly(bool ro)
@return true if empty. @return true if empty.
An empty dialog, is a dialog without any edited lang. An empty dialog, is a dialog without any edited lang.
*/ */
bool NameListWidget::isEmpty() const { bool NameListWidget::isEmpty() const
{
return names().isEmpty(); return names().isEmpty();
} }

View File

@@ -103,7 +103,8 @@ bool PropertiesEditorDockWidget::addEditor(PropertiesEditorWidget *editor,
@brief PropertiesEditorDockWidget::editors @brief PropertiesEditorDockWidget::editors
@return all editor used in this dock @return all editor used in this dock
*/ */
QList<PropertiesEditorWidget *> PropertiesEditorDockWidget::editors() const { QList<PropertiesEditorWidget *> PropertiesEditorDockWidget::editors() const
{
return m_editor_list; return m_editor_list;
} }

View File

@@ -41,7 +41,8 @@ QUndoCommand *PropertiesEditorWidget::associatedUndo() const{
@brief PropertiesEditorWidget::title @brief PropertiesEditorWidget::title
@return the title of this editor @return the title of this editor
*/ */
QString PropertiesEditorWidget::title() const { QString PropertiesEditorWidget::title() const
{
return QString(); return QString();
} }
@@ -68,6 +69,7 @@ bool PropertiesEditorWidget::setLiveEdit(bool live_edit) {
@return true if this editor is in live edit mode @return true if this editor is in live edit mode
else return fasle. else return fasle.
*/ */
bool PropertiesEditorWidget::isLiveEdit() const { bool PropertiesEditorWidget::isLiveEdit() const
{
return m_live_edit; return m_live_edit;
} }

View File

@@ -37,7 +37,8 @@ QetGraphicsHandlerItem::QetGraphicsHandlerItem(qreal size) :
@brief QetGraphicsHandlerItem::boundingRect @brief QetGraphicsHandlerItem::boundingRect
@return @return
*/ */
QRectF QetGraphicsHandlerItem::boundingRect() const { QRectF QetGraphicsHandlerItem::boundingRect() const
{
return m_br; return m_br;
} }

View File

@@ -319,7 +319,8 @@ void ReplaceConductorDialog::on_m_neutral_cb_toggled(bool checked)
} }
} }
void ReplaceConductorDialog::on_m_update_preview_pb_clicked() { void ReplaceConductorDialog::on_m_update_preview_pb_clicked()
{
updatePreview(); updatePreview();
} }

View File

@@ -140,7 +140,8 @@ ReplaceFolioDialog::~ReplaceFolioDialog()
@brief ReplaceFolioDialog::titleBlockProperties @brief ReplaceFolioDialog::titleBlockProperties
@return The title block properties edited by this dialog @return The title block properties edited by this dialog
*/ */
TitleBlockProperties ReplaceFolioDialog::titleBlockProperties() const { TitleBlockProperties ReplaceFolioDialog::titleBlockProperties() const
{
return m_widget->titleBlockProperties(); return m_widget->titleBlockProperties();
} }
@@ -152,49 +153,56 @@ void ReplaceFolioDialog::setTitleBlockProperties(
const TitleBlockProperties &properties) { const TitleBlockProperties &properties) {
m_widget->setTitleBlockProperties(properties); m_widget->setTitleBlockProperties(properties);
} }
void ReplaceFolioWidget::on_m_title_cb_clicked() { void ReplaceFolioWidget::on_m_title_cb_clicked()
{
ui->m_title_le->setText(ui->m_title_cb->isChecked() ui->m_title_le->setText(ui->m_title_cb->isChecked()
? SearchAndReplaceWorker::eraseText() ? SearchAndReplaceWorker::eraseText()
: QString()); : QString());
ui->m_title_le->setDisabled(ui->m_title_cb->isChecked()); ui->m_title_le->setDisabled(ui->m_title_cb->isChecked());
} }
void ReplaceFolioWidget::on_m_author_cb_clicked() { void ReplaceFolioWidget::on_m_author_cb_clicked()
{
ui->m_author_le->setText(ui->m_author_cb->isChecked() ui->m_author_le->setText(ui->m_author_cb->isChecked()
? SearchAndReplaceWorker::eraseText() ? SearchAndReplaceWorker::eraseText()
: QString()); : QString());
ui->m_author_le->setDisabled(ui->m_author_cb->isChecked()); ui->m_author_le->setDisabled(ui->m_author_cb->isChecked());
} }
void ReplaceFolioWidget::on_m_file_cb_clicked() { void ReplaceFolioWidget::on_m_file_cb_clicked()
{
ui->m_file_le->setText(ui->m_file_cb->isChecked() ui->m_file_le->setText(ui->m_file_cb->isChecked()
? SearchAndReplaceWorker::eraseText() ? SearchAndReplaceWorker::eraseText()
: QString()); : QString());
ui->m_file_le->setDisabled(ui->m_file_cb->isChecked()); ui->m_file_le->setDisabled(ui->m_file_cb->isChecked());
} }
void ReplaceFolioWidget::on_m_folio_cb_clicked() { void ReplaceFolioWidget::on_m_folio_cb_clicked()
{
ui->m_folio_le->setText(ui->m_folio_cb->isChecked() ui->m_folio_le->setText(ui->m_folio_cb->isChecked()
? SearchAndReplaceWorker::eraseText() ? SearchAndReplaceWorker::eraseText()
: QString()); : QString());
ui->m_folio_le->setDisabled(ui->m_folio_cb->isChecked()); ui->m_folio_le->setDisabled(ui->m_folio_cb->isChecked());
} }
void ReplaceFolioWidget::on_m_plant_cb_clicked() { void ReplaceFolioWidget::on_m_plant_cb_clicked()
{
ui->m_plant->setText(ui->m_plant_cb->isChecked() ui->m_plant->setText(ui->m_plant_cb->isChecked()
? SearchAndReplaceWorker::eraseText() ? SearchAndReplaceWorker::eraseText()
: QString()); : QString());
ui->m_plant->setDisabled(ui->m_plant_cb->isChecked()); ui->m_plant->setDisabled(ui->m_plant_cb->isChecked());
} }
void ReplaceFolioWidget::on_m_loc_cb_clicked() { void ReplaceFolioWidget::on_m_loc_cb_clicked()
{
ui->m_loc->setText(ui->m_loc_cb->isChecked() ui->m_loc->setText(ui->m_loc_cb->isChecked()
? SearchAndReplaceWorker::eraseText() ? SearchAndReplaceWorker::eraseText()
: QString()); : QString());
ui->m_loc->setDisabled(ui->m_loc_cb->isChecked()); ui->m_loc->setDisabled(ui->m_loc_cb->isChecked());
} }
void ReplaceFolioWidget::on_m_indice_cb_clicked() { void ReplaceFolioWidget::on_m_indice_cb_clicked()
{
ui->m_indice->setText(ui->m_indice_cb->isChecked() ui->m_indice->setText(ui->m_indice_cb->isChecked()
? SearchAndReplaceWorker::eraseText() ? SearchAndReplaceWorker::eraseText()
: QString()); : QString());

View File

@@ -70,7 +70,8 @@ SearchAndReplaceWidget::SearchAndReplaceWidget(QWidget *parent) :
@brief SearchAndReplaceWidget::~SearchAndReplaceWidget @brief SearchAndReplaceWidget::~SearchAndReplaceWidget
Destructor Destructor
*/ */
SearchAndReplaceWidget::~SearchAndReplaceWidget() { SearchAndReplaceWidget::~SearchAndReplaceWidget()
{
delete ui; delete ui;
} }

View File

@@ -44,7 +44,8 @@ namespace autonum
hundred_folio = other.hundred_folio; hundred_folio = other.hundred_folio;
} }
sequentialNumbers::~sequentialNumbers() {} sequentialNumbers::~sequentialNumbers()
{}
sequentialNumbers &sequentialNumbers::operator=( sequentialNumbers &sequentialNumbers::operator=(
const sequentialNumbers &other) const sequentialNumbers &other)

View File

@@ -23,7 +23,8 @@
/** /**
Constructor Constructor
*/ */
NumerotationContext::NumerotationContext(){ NumerotationContext::NumerotationContext()
{
} }
/** /**
@@ -36,7 +37,8 @@ NumerotationContext::NumerotationContext(QDomElement &e) {
/** /**
@brief NumerotationContext::clear, clear the content @brief NumerotationContext::clear, clear the content
*/ */
void NumerotationContext::clear () { void NumerotationContext::clear ()
{
content_.clear(); content_.clear();
} }
@@ -75,7 +77,8 @@ bool NumerotationContext::addValue(const QString &type,
@param i @param i
@return the string at position i @return the string at position i
*/ */
QString NumerotationContext::operator [] (const int &i) const { QString NumerotationContext::operator [] (const int &i) const
{
return (content_.at(i)); return (content_.at(i));
} }
@@ -90,7 +93,8 @@ void NumerotationContext::operator << (const NumerotationContext &other) {
@brief NumerotationContext::size @brief NumerotationContext::size
@return size of context @return size of context
*/ */
int NumerotationContext::size() const { int NumerotationContext::size() const
{
return (content_.size()); return (content_.size());
} }
@@ -98,7 +102,8 @@ int NumerotationContext::size() const {
@brief NumerotationContext::isEmpty @brief NumerotationContext::isEmpty
@return true if numerotation contet is empty @return true if numerotation contet is empty
*/ */
bool NumerotationContext::isEmpty() const { bool NumerotationContext::isEmpty() const
{
if (content_.size() > 0) return false; if (content_.size() > 0) return false;
return true; return true;
} }
@@ -107,7 +112,8 @@ bool NumerotationContext::isEmpty() const {
@param i @param i
@return the content at position i 1:type 2:value 3:increase @return the content at position i 1:type 2:value 3:increase
*/ */
QStringList NumerotationContext::itemAt(const int i) const { QStringList NumerotationContext::itemAt(const int i) const
{
return (content_.at(i).split("|")); return (content_.at(i).split("|"));
} }
@@ -115,7 +121,8 @@ QStringList NumerotationContext::itemAt(const int i) const {
@brief validRegExpNum @brief validRegExpNum
@return all type use to numerotation @return all type use to numerotation
*/ */
QString NumerotationContext::validRegExpNum () const { QString NumerotationContext::validRegExpNum () const
{
return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio|string|idfolio|folio|plant|locmach|elementline|elementcolumn|elementprefix"); return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio|string|idfolio|folio|plant|locmach|elementline|elementcolumn|elementprefix");
} }
@@ -123,7 +130,8 @@ QString NumerotationContext::validRegExpNum () const {
@brief NumerotationContext::validRegExpNumber @brief NumerotationContext::validRegExpNumber
@return all type represents a number @return all type represents a number
*/ */
QString NumerotationContext::validRegExpNumber() const { QString NumerotationContext::validRegExpNumber() const
{
return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio"); return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio");
} }
@@ -131,7 +139,8 @@ QString NumerotationContext::validRegExpNumber() const {
@brief NumerotationContext::keyIsAcceptable @brief NumerotationContext::keyIsAcceptable
@return true if type is acceptable @return true if type is acceptable
*/ */
bool NumerotationContext::keyIsAcceptable(const QString &type) const { bool NumerotationContext::keyIsAcceptable(const QString &type) const
{
return (type.contains(QRegExp(validRegExpNum()))); return (type.contains(QRegExp(validRegExpNum())));
} }
@@ -139,7 +148,8 @@ bool NumerotationContext::keyIsAcceptable(const QString &type) const {
@brief NumerotationContext::keyIsNumber @brief NumerotationContext::keyIsNumber
@return true if type represent a number @return true if type represent a number
*/ */
bool NumerotationContext::keyIsNumber(const QString &type) const { bool NumerotationContext::keyIsNumber(const QString &type) const
{
return (type.contains(QRegExp(validRegExpNumber()))); return (type.contains(QRegExp(validRegExpNumber())));
} }

View File

@@ -30,7 +30,8 @@ NumerotationContextCommands::NumerotationContextCommands(const NumerotationConte
/** /**
@brief Destructor @brief Destructor
*/ */
NumerotationContextCommands::~NumerotationContextCommands() { NumerotationContextCommands::~NumerotationContextCommands()
{
if (strategy_) delete strategy_; if (strategy_) delete strategy_;
} }
@@ -38,7 +39,8 @@ NumerotationContextCommands::~NumerotationContextCommands() {
@brief NumerotationContextCommands::next @brief NumerotationContextCommands::next
@return the next numerotation context @return the next numerotation context
*/ */
NumerotationContext NumerotationContextCommands::next() { NumerotationContext NumerotationContextCommands::next()
{
NumerotationContext contextnum; NumerotationContext contextnum;
for (int i=0; i<context_.size(); ++i) { for (int i=0; i<context_.size(); ++i) {
@@ -53,7 +55,8 @@ NumerotationContext NumerotationContextCommands::next() {
@brief NumerotationContextCommands::previous @brief NumerotationContextCommands::previous
@return the previous numerotation context @return the previous numerotation context
*/ */
NumerotationContext NumerotationContextCommands::previous() { NumerotationContext NumerotationContextCommands::previous()
{
NumerotationContext contextnum; NumerotationContext contextnum;
for (int i=0; i<context_.size(); ++i) { for (int i=0; i<context_.size(); ++i) {
@@ -68,7 +71,8 @@ NumerotationContext NumerotationContextCommands::previous() {
@brief NumerotationContextCommands::toFinalString @brief NumerotationContextCommands::toFinalString
@return the string represented by the numerotation context @return the string represented by the numerotation context
*/ */
QString NumerotationContextCommands::toRepresentedString() { QString NumerotationContextCommands::toRepresentedString()
{
QString num; QString num;
if (context_.size()) { if (context_.size()) {
for (int i=0; i<context_.size(); i++) { for (int i=0; i<context_.size(); i++) {
@@ -155,14 +159,16 @@ NumStrategy::NumStrategy (Diagram *d):
diagram_ (d) diagram_ (d)
{} {}
NumStrategy::~NumStrategy() {} NumStrategy::~NumStrategy()
{}
/** /**
@brief NumStrategy::nextString @brief NumStrategy::nextString
@return the next value of nc at position i @return the next value of nc at position i
*/ */
NumerotationContext NumStrategy::nextString (const NumerotationContext &nc, NumerotationContext NumStrategy::nextString (const NumerotationContext &nc,
const int i) const { const int i) const
{
QStringList strl = nc.itemAt(i); QStringList strl = nc.itemAt(i);
NumerotationContext newnc; NumerotationContext newnc;
newnc.addValue(strl.at(0), strl.at(1), strl.at(2).toInt()); newnc.addValue(strl.at(0), strl.at(1), strl.at(2).toInt());
@@ -174,7 +180,8 @@ NumerotationContext NumStrategy::nextString (const NumerotationContext &nc,
@return the next value of nc at position i @return the next value of nc at position i
*/ */
NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc,
const int i) const { const int i) const
{
QStringList strl = nc.itemAt(i); QStringList strl = nc.itemAt(i);
NumerotationContext newnc; NumerotationContext newnc;
QString value = QString::number( (strl.at(1).toInt()) + (strl.at(2).toInt()) ); QString value = QString::number( (strl.at(1).toInt()) + (strl.at(2).toInt()) );
@@ -187,7 +194,8 @@ NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc,
@return the previous value of nc at position i @return the previous value of nc at position i
*/ */
NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc, NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc,
const int i) const { const int i) const
{
QStringList strl = nc.itemAt(i); QStringList strl = nc.itemAt(i);
NumerotationContext newnc; NumerotationContext newnc;
QString value = QString::number( (strl.at(1).toInt()) - (strl.at(2).toInt()) ); QString value = QString::number( (strl.at(1).toInt()) - (strl.at(2).toInt()) );
@@ -206,7 +214,8 @@ UnitNum::UnitNum(Diagram *d):
@brief UnitNum::toRepresentedString @brief UnitNum::toRepresentedString
@return the represented string of num @return the represented string of num
*/ */
QString UnitNum::toRepresentedString(const QString num) const { QString UnitNum::toRepresentedString(const QString num) const
{
return (num); return (num);
} }
@@ -214,7 +223,8 @@ QString UnitNum::toRepresentedString(const QString num) const {
@brief UnitNum::next @brief UnitNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext UnitNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext UnitNum::next (const NumerotationContext &nc, const int i) const
{
return (nextNumber(nc, i)); return (nextNumber(nc, i));
} }
@@ -222,7 +232,8 @@ NumerotationContext UnitNum::next (const NumerotationContext &nc, const int i) c
@brief UnitNum::previous @brief UnitNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext UnitNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext UnitNum::previous(const NumerotationContext &nc, const int i) const
{
return (previousNumber(nc, i)); return (previousNumber(nc, i));
} }
@@ -237,7 +248,8 @@ UnitFNum::UnitFNum(Diagram *d):
@brief UnitFNum::toRepresentedString @brief UnitFNum::toRepresentedString
@return the represented string of num @return the represented string of num
*/ */
QString UnitFNum::toRepresentedString(const QString num) const { QString UnitFNum::toRepresentedString(const QString num) const
{
return (num); return (num);
} }
@@ -245,7 +257,8 @@ QString UnitFNum::toRepresentedString(const QString num) const {
@brief UnitFNum::next @brief UnitFNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext UnitFNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext UnitFNum::next (const NumerotationContext &nc, const int i) const
{
return (nextNumber(nc, i)); return (nextNumber(nc, i));
} }
@@ -253,7 +266,8 @@ NumerotationContext UnitFNum::next (const NumerotationContext &nc, const int i)
@brief UnitFNum::previous @brief UnitFNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext UnitFNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext UnitFNum::previous(const NumerotationContext &nc, const int i) const
{
return (previousNumber(nc, i)); return (previousNumber(nc, i));
} }
@@ -268,7 +282,8 @@ TenNum::TenNum (Diagram *d):
@brief TenNum::toRepresentedString @brief TenNum::toRepresentedString
@return the represented string of num @return the represented string of num
*/ */
QString TenNum::toRepresentedString(const QString num) const { QString TenNum::toRepresentedString(const QString num) const
{
int numint = num.toInt(); int numint = num.toInt();
QString numstr = num; QString numstr = num;
if (numint<10) numstr.prepend("0"); if (numint<10) numstr.prepend("0");
@@ -279,7 +294,8 @@ QString TenNum::toRepresentedString(const QString num) const {
@brief TenNum::next @brief TenNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext TenNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext TenNum::next (const NumerotationContext &nc, const int i) const
{
return (nextNumber(nc, i)); return (nextNumber(nc, i));
} }
@@ -287,7 +303,8 @@ NumerotationContext TenNum::next (const NumerotationContext &nc, const int i) co
@brief TenNum::previous @brief TenNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext TenNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext TenNum::previous(const NumerotationContext &nc, const int i) const
{
return (previousNumber(nc, i)); return (previousNumber(nc, i));
} }
@@ -302,7 +319,8 @@ TenFNum::TenFNum (Diagram *d):
@brief TenFNum::toRepresentedString @brief TenFNum::toRepresentedString
@return the represented string of num @return the represented string of num
*/ */
QString TenFNum::toRepresentedString(const QString num) const { QString TenFNum::toRepresentedString(const QString num) const
{
int numint = num.toInt(); int numint = num.toInt();
QString numstr = num; QString numstr = num;
if (numint<10) numstr.prepend("0"); if (numint<10) numstr.prepend("0");
@@ -313,7 +331,8 @@ QString TenFNum::toRepresentedString(const QString num) const {
@brief TenFNum::next @brief TenFNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext TenFNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext TenFNum::next (const NumerotationContext &nc, const int i) const
{
return (nextNumber(nc, i)); return (nextNumber(nc, i));
} }
@@ -321,7 +340,8 @@ NumerotationContext TenFNum::next (const NumerotationContext &nc, const int i) c
@brief TenFNum::previous @brief TenFNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext TenFNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext TenFNum::previous(const NumerotationContext &nc, const int i) const
{
return (previousNumber(nc, i)); return (previousNumber(nc, i));
} }
@@ -337,7 +357,8 @@ HundredNum::HundredNum (Diagram *d):
@brief HundredNum::toRepresentedString @brief HundredNum::toRepresentedString
@return the represented string of num @return the represented string of num
*/ */
QString HundredNum::toRepresentedString(const QString num) const { QString HundredNum::toRepresentedString(const QString num) const
{
int numint = num.toInt(); int numint = num.toInt();
QString numstr = num; QString numstr = num;
if (numint<100) { if (numint<100) {
@@ -353,7 +374,8 @@ QString HundredNum::toRepresentedString(const QString num) const {
@brief HundredNum::next @brief HundredNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext HundredNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext HundredNum::next (const NumerotationContext &nc, const int i) const
{
return (nextNumber(nc, i)); return (nextNumber(nc, i));
} }
@@ -361,7 +383,8 @@ NumerotationContext HundredNum::next (const NumerotationContext &nc, const int i
@brief HundredNum::previous @brief HundredNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext HundredNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext HundredNum::previous(const NumerotationContext &nc, const int i) const
{
return (previousNumber(nc, i)); return (previousNumber(nc, i));
} }
@@ -376,7 +399,8 @@ HundredFNum::HundredFNum (Diagram *d):
@brief HundredFNum::toRepresentedString @brief HundredFNum::toRepresentedString
@return the represented string of num @return the represented string of num
*/ */
QString HundredFNum::toRepresentedString(const QString num) const { QString HundredFNum::toRepresentedString(const QString num) const
{
int numint = num.toInt(); int numint = num.toInt();
QString numstr = num; QString numstr = num;
if (numint<100) { if (numint<100) {
@@ -392,7 +416,8 @@ QString HundredFNum::toRepresentedString(const QString num) const {
@brief HundredFNum::next @brief HundredFNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext HundredFNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext HundredFNum::next (const NumerotationContext &nc, const int i) const
{
return (nextNumber(nc, i)); return (nextNumber(nc, i));
} }
@@ -400,7 +425,8 @@ NumerotationContext HundredFNum::next (const NumerotationContext &nc, const int
@brief HundredFNum::previous @brief HundredFNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext HundredFNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext HundredFNum::previous(const NumerotationContext &nc, const int i) const
{
return (previousNumber(nc, i)); return (previousNumber(nc, i));
} }
@@ -415,7 +441,8 @@ StringNum::StringNum (Diagram *d):
@brief StringNum::toRepresentedString @brief StringNum::toRepresentedString
@return the represented string of num @return the represented string of num
*/ */
QString StringNum::toRepresentedString(const QString str) const { QString StringNum::toRepresentedString(const QString str) const
{
return (str); return (str);
} }
@@ -423,7 +450,8 @@ QString StringNum::toRepresentedString(const QString str) const {
@brief StringNum::next @brief StringNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext StringNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext StringNum::next (const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -431,7 +459,8 @@ NumerotationContext StringNum::next (const NumerotationContext &nc, const int i)
@brief StringNum::previous @brief StringNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext StringNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext StringNum::previous(const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -446,7 +475,8 @@ IdFolioNum::IdFolioNum (Diagram *d):
@brief IdFolioNum::toRepresentedString @brief IdFolioNum::toRepresentedString
@return the represented string of num @return the represented string of num
*/ */
QString IdFolioNum::toRepresentedString(const QString str) const { QString IdFolioNum::toRepresentedString(const QString str) const
{
Q_UNUSED(str); Q_UNUSED(str);
return ("%id"); return ("%id");
} }
@@ -455,7 +485,8 @@ QString IdFolioNum::toRepresentedString(const QString str) const {
@brief IdFolioNum::next @brief IdFolioNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext IdFolioNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext IdFolioNum::next (const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -463,7 +494,8 @@ NumerotationContext IdFolioNum::next (const NumerotationContext &nc, const int i
@brief IdFolioNum::previous @brief IdFolioNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext IdFolioNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext IdFolioNum::previous(const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -478,7 +510,8 @@ FolioNum::FolioNum (Diagram *d):
@brief FolioNum::toRepresentedString @brief FolioNum::toRepresentedString
@return the represented string of folio @return the represented string of folio
*/ */
QString FolioNum::toRepresentedString(const QString str) const { QString FolioNum::toRepresentedString(const QString str) const
{
Q_UNUSED(str); Q_UNUSED(str);
return ("%F"); return ("%F");
} }
@@ -487,7 +520,8 @@ QString FolioNum::toRepresentedString(const QString str) const {
@brief FolioNum::next @brief FolioNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext FolioNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext FolioNum::next (const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -495,7 +529,8 @@ NumerotationContext FolioNum::next (const NumerotationContext &nc, const int i)
@brief FolioNum::previous @brief FolioNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext FolioNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext FolioNum::previous(const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -510,7 +545,8 @@ PlantNum::PlantNum (Diagram *d):
@brief PlantNum::toRepresentedString @brief PlantNum::toRepresentedString
@return the represented string of folio @return the represented string of folio
*/ */
QString PlantNum::toRepresentedString(const QString str) const { QString PlantNum::toRepresentedString(const QString str) const
{
Q_UNUSED(str); Q_UNUSED(str);
return "%M"; return "%M";
} }
@@ -519,7 +555,8 @@ QString PlantNum::toRepresentedString(const QString str) const {
@brief PlantNum::next @brief PlantNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext PlantNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext PlantNum::next (const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -527,7 +564,8 @@ NumerotationContext PlantNum::next (const NumerotationContext &nc, const int i)
@brief PlantNum::previous @brief PlantNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext PlantNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext PlantNum::previous(const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -543,7 +581,8 @@ LocmachNum::LocmachNum (Diagram *d):
@brief LocmachNum::toRepresentedString @brief LocmachNum::toRepresentedString
@return the represented string of folio @return the represented string of folio
*/ */
QString LocmachNum::toRepresentedString(const QString str) const { QString LocmachNum::toRepresentedString(const QString str) const
{
Q_UNUSED(str); Q_UNUSED(str);
return "%LM"; return "%LM";
} }
@@ -552,7 +591,8 @@ QString LocmachNum::toRepresentedString(const QString str) const {
@brief LocmachNum::next @brief LocmachNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext LocmachNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext LocmachNum::next (const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -560,7 +600,8 @@ NumerotationContext LocmachNum::next (const NumerotationContext &nc, const int i
@brief LocmachNum::previous @brief LocmachNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext LocmachNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext LocmachNum::previous(const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -576,7 +617,8 @@ ElementLineNum::ElementLineNum (Diagram *d):
@brief ElementLineNum::toRepresentedString @brief ElementLineNum::toRepresentedString
@return the represented string of folio @return the represented string of folio
*/ */
QString ElementLineNum::toRepresentedString(const QString str) const { QString ElementLineNum::toRepresentedString(const QString str) const
{
Q_UNUSED(str); Q_UNUSED(str);
return "%l"; return "%l";
} }
@@ -585,7 +627,8 @@ QString ElementLineNum::toRepresentedString(const QString str) const {
@brief ElementLineNum::next @brief ElementLineNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext ElementLineNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext ElementLineNum::next (const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -593,7 +636,8 @@ NumerotationContext ElementLineNum::next (const NumerotationContext &nc, const i
@brief ElementLineNum::previous @brief ElementLineNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext ElementLineNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext ElementLineNum::previous(const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -608,7 +652,8 @@ ElementColumnNum::ElementColumnNum (Diagram *d):
@brief ElementColumnNum::toRepresentedString @brief ElementColumnNum::toRepresentedString
@return the represented string of folio @return the represented string of folio
*/ */
QString ElementColumnNum::toRepresentedString(const QString str) const { QString ElementColumnNum::toRepresentedString(const QString str) const
{
Q_UNUSED(str); Q_UNUSED(str);
return "%c"; return "%c";
} }
@@ -617,7 +662,8 @@ QString ElementColumnNum::toRepresentedString(const QString str) const {
@brief ElementColumnNum::next @brief ElementColumnNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext ElementColumnNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext ElementColumnNum::next (const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -625,7 +671,8 @@ NumerotationContext ElementColumnNum::next (const NumerotationContext &nc, const
@brief ElementColumnNum::previous @brief ElementColumnNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext ElementColumnNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext ElementColumnNum::previous(const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -640,7 +687,8 @@ ElementPrefixNum::ElementPrefixNum (Diagram *d):
@brief ElementPrefixNum::toRepresentedString @brief ElementPrefixNum::toRepresentedString
@return the represented string of folio @return the represented string of folio
*/ */
QString ElementPrefixNum::toRepresentedString(const QString str) const { QString ElementPrefixNum::toRepresentedString(const QString str) const
{
Q_UNUSED(str); Q_UNUSED(str);
return "%prefix"; return "%prefix";
} }
@@ -649,7 +697,8 @@ QString ElementPrefixNum::toRepresentedString(const QString str) const {
@brief ElementPrefixNum::next @brief ElementPrefixNum::next
@return the next NumerotationContext nc at position i @return the next NumerotationContext nc at position i
*/ */
NumerotationContext ElementPrefixNum::next (const NumerotationContext &nc, const int i) const { NumerotationContext ElementPrefixNum::next (const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }
@@ -657,7 +706,8 @@ NumerotationContext ElementPrefixNum::next (const NumerotationContext &nc, const
@brief ElementPrefixNum::previous @brief ElementPrefixNum::previous
@return the previous NumerotationContext nc at posiiton i @return the previous NumerotationContext nc at posiiton i
*/ */
NumerotationContext ElementPrefixNum::previous(const NumerotationContext &nc, const int i) const { NumerotationContext ElementPrefixNum::previous(const NumerotationContext &nc, const int i) const
{
return (nextString(nc, i)); return (nextString(nc, i));
} }

View File

@@ -157,7 +157,8 @@ void AutoNumberingDockWidget::setProject(QETProject *project,
@brief AutoNumberingDockWidget::setContext @brief AutoNumberingDockWidget::setContext
Add all itens to comboboxes Add all itens to comboboxes
*/ */
void AutoNumberingDockWidget::setContext() { void AutoNumberingDockWidget::setContext()
{
this->clear(); this->clear();
@@ -204,7 +205,8 @@ void AutoNumberingDockWidget::setConductorActive(DiagramView* dv) {
@brief AutoNumberingDockWidget::setActive @brief AutoNumberingDockWidget::setActive
Set current used autonumberings Set current used autonumberings
*/ */
void AutoNumberingDockWidget::setActive() { void AutoNumberingDockWidget::setActive()
{
if (m_project_view!=nullptr) { if (m_project_view!=nullptr) {
//Conductor //Conductor
@@ -233,7 +235,8 @@ void AutoNumberingDockWidget::setActive() {
@brief AutoNumberingDockWidget::conductorAutoNumChanged @brief AutoNumberingDockWidget::conductorAutoNumChanged
Add new or remove conductor auto num from combobox Add new or remove conductor auto num from combobox
*/ */
void AutoNumberingDockWidget::conductorAutoNumChanged() { void AutoNumberingDockWidget::conductorAutoNumChanged()
{
ui->m_conductor_cb->clear(); ui->m_conductor_cb->clear();
//Conductor Combobox //Conductor Combobox
@@ -263,7 +266,8 @@ void AutoNumberingDockWidget::on_m_conductor_cb_activated(int)
@brief AutoNumberingDockWidget::elementAutoNumChanged @brief AutoNumberingDockWidget::elementAutoNumChanged
Add new or remove element auto num from combobox Add new or remove element auto num from combobox
*/ */
void AutoNumberingDockWidget::elementAutoNumChanged() { void AutoNumberingDockWidget::elementAutoNumChanged()
{
ui->m_element_cb->clear(); ui->m_element_cb->clear();
@@ -290,7 +294,8 @@ void AutoNumberingDockWidget::on_m_element_cb_activated(int)
@brief AutoNumberingDockWidget::folioAutoNumChanged @brief AutoNumberingDockWidget::folioAutoNumChanged
Add new or remove folio auto num from combobox Add new or remove folio auto num from combobox
*/ */
void AutoNumberingDockWidget::folioAutoNumChanged() { void AutoNumberingDockWidget::folioAutoNumChanged()
{
ui->m_folio_cb->clear(); ui->m_folio_cb->clear();

View File

@@ -149,7 +149,8 @@ void NumPartEditorW::setVisibleItems()
@brief NumPartEditorW::toNumContext @brief NumPartEditorW::toNumContext
@return the display to NumerotationContext @return the display to NumerotationContext
*/ */
NumerotationContext NumPartEditorW::toNumContext() { NumerotationContext NumPartEditorW::toNumContext()
{
NumerotationContext nc; NumerotationContext nc;
QString type_str; QString type_str;
switch (type_) { switch (type_) {
@@ -214,7 +215,8 @@ NumerotationContext NumPartEditorW::toNumContext() {
@brief NumPartEditorW::isValid @brief NumPartEditorW::isValid
@return true if value field isn't empty or if type is folio @return true if value field isn't empty or if type is folio
*/ */
bool NumPartEditorW::isValid() { bool NumPartEditorW::isValid()
{
if (type_ == folio if (type_ == folio
|| type_ == idfolio || type_ == idfolio
|| type_ == elementline || type_ == elementline
@@ -266,7 +268,8 @@ void NumPartEditorW::on_type_cb_activated(int) {
@brief NumPartEditorW::on_value_field_textChanged @brief NumPartEditorW::on_value_field_textChanged
emit changed when value_field text changed emit changed when value_field text changed
*/ */
void NumPartEditorW::on_value_field_textEdited() { void NumPartEditorW::on_value_field_textEdited()
{
emit changed(); emit changed();
} }

View File

@@ -48,7 +48,8 @@ BorderProperties::BorderProperties() :
@brief BorderProperties::~BorderProperties @brief BorderProperties::~BorderProperties
destructor destructor
*/ */
BorderProperties::~BorderProperties() { BorderProperties::~BorderProperties()
{
} }
/** /**
@@ -95,7 +96,8 @@ bool BorderProperties::operator!=(const BorderProperties &bp) {
XML element to which attributes will be added XML element to which attributes will be added
\~French Element XML auquel seront ajoutes des attributs \~French Element XML auquel seront ajoutes des attributs
*/ */
void BorderProperties::toXml(QDomElement &e) const { void BorderProperties::toXml(QDomElement &e) const
{
e.setAttribute("cols", columns_count); e.setAttribute("cols", columns_count);
e.setAttribute("colsize", QString("%1").arg(columns_width)); e.setAttribute("colsize", QString("%1").arg(columns_width));
e.setAttribute("rows", rows_count); e.setAttribute("rows", rows_count);
@@ -134,7 +136,8 @@ void BorderProperties::fromXml(QDomElement &e) {
prefix to be added before the names of the parameters prefix to be added before the names of the parameters
\~French prefixe a ajouter devant les noms des parametres \~French prefixe a ajouter devant les noms des parametres
*/ */
void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const { void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const
{
settings.setValue(prefix + "cols", columns_count); settings.setValue(prefix + "cols", columns_count);
settings.setValue(prefix + "colsize", columns_width); settings.setValue(prefix + "colsize", columns_width);
settings.setValue(prefix + "displaycols", display_columns); settings.setValue(prefix + "displaycols", display_columns);

View File

@@ -71,7 +71,8 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) :
@brief BorderTitleBlock::~BorderTitleBlock @brief BorderTitleBlock::~BorderTitleBlock
\~French Destructeur - ne fait rien \~French Destructeur - ne fait rien
*/ */
BorderTitleBlock::~BorderTitleBlock() { BorderTitleBlock::~BorderTitleBlock()
{
} }
/** /**
@@ -96,7 +97,8 @@ QRectF BorderTitleBlock::titleBlockRect() const
@brief BorderTitleBlock::titleblockInformation @brief BorderTitleBlock::titleblockInformation
@return @return
*/ */
DiagramContext BorderTitleBlock::titleblockInformation() const { DiagramContext BorderTitleBlock::titleblockInformation() const
{
return m_titleblock_template_renderer->context(); return m_titleblock_template_renderer->context();
} }
@@ -131,7 +133,8 @@ QRectF BorderTitleBlock::titleBlockRectForQPainter() const
It's like unite outsideBorderRect and titleBlockRect. It's like unite outsideBorderRect and titleBlockRect.
The rect is in scene coordinate The rect is in scene coordinate
*/ */
QRectF BorderTitleBlock::borderAndTitleBlockRect() const { QRectF BorderTitleBlock::borderAndTitleBlockRect() const
{
return diagram_rect_ | titleBlockRect(); return diagram_rect_ | titleBlockRect();
} }
@@ -276,7 +279,8 @@ void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) {
@return the properties of the titleblock @return the properties of the titleblock
\~French les proprietes du cartouches \~French les proprietes du cartouches
*/ */
TitleBlockProperties BorderTitleBlock::exportTitleBlock() { TitleBlockProperties BorderTitleBlock::exportTitleBlock()
{
TitleBlockProperties ip; TitleBlockProperties ip;
ip.author = author(); ip.author = author();
@@ -330,7 +334,8 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
@return border properties @return border properties
\~French les proprietes de la bordure \~French les proprietes de la bordure
*/ */
BorderProperties BorderTitleBlock::exportBorder() { BorderProperties BorderTitleBlock::exportBorder()
{
BorderProperties bp; BorderProperties bp;
bp.columns_count = columnsCount(); bp.columns_count = columnsCount();
bp.columns_width = columnsWidth(); bp.columns_width = columnsWidth();
@@ -364,7 +369,8 @@ void BorderTitleBlock::importBorder(const BorderProperties &bp) {
@return the titleblock template used to render the titleblock @return the titleblock template used to render the titleblock
@see TitleBlockTemplateRenderer::titleBlockTemplate() @see TitleBlockTemplateRenderer::titleBlockTemplate()
*/ */
const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate() { const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate()
{
return(m_titleblock_template_renderer -> titleBlockTemplate()); return(m_titleblock_template_renderer -> titleBlockTemplate());
} }
@@ -384,7 +390,8 @@ void BorderTitleBlock::setTitleBlockTemplate(
@brief BorderTitleBlock::titleBlockTemplateName @brief BorderTitleBlock::titleBlockTemplateName
@return The name of the template used to render the titleblock. @return The name of the template used to render the titleblock.
*/ */
QString BorderTitleBlock::titleBlockTemplateName() const { QString BorderTitleBlock::titleBlockTemplateName() const
{
QString tbt_name = m_titleblock_template_renderer -> titleBlockTemplate() -> name(); QString tbt_name = m_titleblock_template_renderer -> titleBlockTemplate() -> name();
return((tbt_name == "default") ? "" : tbt_name); return((tbt_name == "default") ? "" : tbt_name);
} }

View File

@@ -79,14 +79,16 @@ class BorderTitleBlock : public QObject
@return the diagram width, @return the diagram width,
i.e. the width of the border without title block i.e. the width of the border without title block
*/ */
qreal diagramWidth() const { qreal diagramWidth() const
{
return(columnsTotalWidth() + rowsHeaderWidth()); } return(columnsTotalWidth() + rowsHeaderWidth()); }
/** /**
@brief diagramHeight @brief diagramHeight
@return the diagram height, @return the diagram height,
i.e. the height of the border without title block i.e. the height of the border without title block
*/ */
qreal diagramHeight() const { qreal diagramHeight() const
{
return(rowsTotalHeight() + columnsHeaderHeight()); } return(rowsTotalHeight() + columnsHeaderHeight()); }
QRectF titleBlockRect () const; QRectF titleBlockRect () const;

View File

@@ -53,7 +53,8 @@ ConductorAutoNumerotation::ConductorAutoNumerotation(
@brief ConductorAutoNumerotation::numerate @brief ConductorAutoNumerotation::numerate
execute the automatic numerotation execute the automatic numerotation
*/ */
void ConductorAutoNumerotation::numerate() { void ConductorAutoNumerotation::numerate()
{
if (!m_conductor) return; if (!m_conductor) return;
if (conductor_list.size() >= 1 ) numeratePotential(); if (conductor_list.size() >= 1 ) numeratePotential();
else if (m_conductor -> properties().type == ConductorProperties::Multi) else if (m_conductor -> properties().type == ConductorProperties::Multi)

View File

@@ -21,7 +21,8 @@
#include "terminal.h" #include "terminal.h"
/// Constructeur /// Constructeur
ConductorProfile::ConductorProfile() { ConductorProfile::ConductorProfile()
{
} }
/** /**
@@ -64,23 +65,27 @@ ConductorProfile &ConductorProfile::operator=(const ConductorProfile &c) {
} }
/// destructeur /// destructeur
ConductorProfile::~ConductorProfile() { ConductorProfile::~ConductorProfile()
{
setNull(); setNull();
} }
/// @return true si le profil est nul /// @return true si le profil est nul
bool ConductorProfile::isNull() const { bool ConductorProfile::isNull() const
{
return(segments.isEmpty()); return(segments.isEmpty());
} }
/// supprime les segments du profil de conducteur /// supprime les segments du profil de conducteur
void ConductorProfile::setNull() { void ConductorProfile::setNull()
{
foreach(ConductorSegmentProfile *csp, segments) delete csp; foreach(ConductorSegmentProfile *csp, segments) delete csp;
segments.clear(); segments.clear();
} }
/// @return la largeur occupee par le conducteur /// @return la largeur occupee par le conducteur
qreal ConductorProfile::width() const { qreal ConductorProfile::width() const
{
qreal width = 0.0; qreal width = 0.0;
foreach(ConductorSegmentProfile *csp, segments) { foreach(ConductorSegmentProfile *csp, segments) {
if (csp -> isHorizontal) width += csp -> length; if (csp -> isHorizontal) width += csp -> length;
@@ -101,7 +106,8 @@ qreal ConductorProfile::height() const{
@param type Type de Segments @param type Type de Segments
@return Le nombre de segments composant le conducteur. @return Le nombre de segments composant le conducteur.
*/ */
uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const { uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const
{
if (type == QET::Both) return(segments.count()); if (type == QET::Both) return(segments.count());
uint nb_seg = 0; uint nb_seg = 0;
foreach(ConductorSegmentProfile *csp, segments) { foreach(ConductorSegmentProfile *csp, segments) {
@@ -112,7 +118,8 @@ uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const {
} }
/// @return les segments horizontaux de ce profil /// @return les segments horizontaux de ce profil
QList<ConductorSegmentProfile *> ConductorProfile::horizontalSegments() { QList<ConductorSegmentProfile *> ConductorProfile::horizontalSegments()
{
QList<ConductorSegmentProfile *> segments_list; QList<ConductorSegmentProfile *> segments_list;
foreach(ConductorSegmentProfile *csp, segments) { foreach(ConductorSegmentProfile *csp, segments) {
if (csp -> isHorizontal) segments_list << csp; if (csp -> isHorizontal) segments_list << csp;
@@ -121,7 +128,8 @@ QList<ConductorSegmentProfile *> ConductorProfile::horizontalSegments() {
} }
/// @return les segments verticaux de ce profil /// @return les segments verticaux de ce profil
QList<ConductorSegmentProfile *> ConductorProfile::verticalSegments() { QList<ConductorSegmentProfile *> ConductorProfile::verticalSegments()
{
QList<ConductorSegmentProfile *> segments_list; QList<ConductorSegmentProfile *> segments_list;
foreach(ConductorSegmentProfile *csp, segments) { foreach(ConductorSegmentProfile *csp, segments) {
if (!csp -> isHorizontal) segments_list << csp; if (!csp -> isHorizontal) segments_list << csp;

View File

@@ -31,7 +31,8 @@ SingleLineProperties::SingleLineProperties() :
} }
/// Destructeur /// Destructeur
SingleLineProperties::~SingleLineProperties() { SingleLineProperties::~SingleLineProperties()
{
} }
/** /**
@@ -43,7 +44,8 @@ void SingleLineProperties::setPhasesCount(int n) {
} }
/// @return le nombre de phases (0, 1, 2, ou 3) /// @return le nombre de phases (0, 1, 2, ou 3)
unsigned short int SingleLineProperties::phasesCount() { unsigned short int SingleLineProperties::phasesCount()
{
return(phases); return(phases);
} }
@@ -52,7 +54,8 @@ unsigned short int SingleLineProperties::phasesCount() {
(Protective Earth Neutral) representation and if it features the ground and (Protective Earth Neutral) representation and if it features the ground and
the neutral. the neutral.
*/ */
bool SingleLineProperties::isPen() const { bool SingleLineProperties::isPen() const
{
return(hasNeutral && hasGround && is_pen); return(hasNeutral && hasGround && is_pen);
} }
@@ -211,7 +214,8 @@ void SingleLineProperties::drawPen(QPainter *painter,
ajoutes a l'element e. ajoutes a l'element e.
@param e Element XML auquel seront ajoutes des attributs @param e Element XML auquel seront ajoutes des attributs
*/ */
void SingleLineProperties::toXml(QDomElement &e) const { void SingleLineProperties::toXml(QDomElement &e) const
{
e.setAttribute("ground", hasGround ? "true" : "false"); e.setAttribute("ground", hasGround ? "true" : "false");
e.setAttribute("neutral", hasNeutral ? "true" : "false"); e.setAttribute("neutral", hasNeutral ? "true" : "false");
e.setAttribute("phase", phases); e.setAttribute("phase", phases);
@@ -251,7 +255,8 @@ ConductorProperties::ConductorProperties() :
/** /**
Destructeur Destructeur
*/ */
ConductorProperties::~ConductorProperties() { ConductorProperties::~ConductorProperties()
{
} }
@@ -802,7 +807,8 @@ void ConductorProperties::readStyle(const QString &style_string) {
Exporte le style du conducteur sous forme d'une chaine de caracteres Exporte le style du conducteur sous forme d'une chaine de caracteres
@return une chaine de caracteres decrivant le style du conducteur @return une chaine de caracteres decrivant le style du conducteur
*/ */
QString ConductorProperties::writeStyle() const { QString ConductorProperties::writeStyle() const
{
if (style == Qt::DashLine) { if (style == Qt::DashLine) {
return("line-style: dashed;"); return("line-style: dashed;");
} else if (style == Qt::DashDotLine) { } else if (style == Qt::DashDotLine) {
@@ -816,7 +822,8 @@ QString ConductorProperties::writeStyle() const {
@param other l'autre ensemble de proprietes avec lequel il faut effectuer la comparaison @param other l'autre ensemble de proprietes avec lequel il faut effectuer la comparaison
@return true si les deux ensembles de proprietes sont identiques, false sinon @return true si les deux ensembles de proprietes sont identiques, false sinon
*/ */
int SingleLineProperties::operator==(const SingleLineProperties &other) const { int SingleLineProperties::operator==(const SingleLineProperties &other) const
{
return( return(
other.hasGround == hasGround &&\ other.hasGround == hasGround &&\
other.hasNeutral == hasNeutral &&\ other.hasNeutral == hasNeutral &&\
@@ -829,7 +836,8 @@ int SingleLineProperties::operator==(const SingleLineProperties &other) const {
@param other l'autre ensemble de proprietes avec lequel il faut effectuer la comparaison @param other l'autre ensemble de proprietes avec lequel il faut effectuer la comparaison
@return true si les deux ensembles de proprietes sont differents, false sinon @return true si les deux ensembles de proprietes sont differents, false sinon
*/ */
int SingleLineProperties::operator!=(const SingleLineProperties &other) const { int SingleLineProperties::operator!=(const SingleLineProperties &other) const
{
return(!(other == (*this))); return(!(other == (*this)));
} }
@@ -838,7 +846,8 @@ int SingleLineProperties::operator!=(const SingleLineProperties &other) const {
@param prefix prefix a ajouter devant les noms des parametres @param prefix prefix a ajouter devant les noms des parametres
*/ */
void SingleLineProperties::toSettings(QSettings &settings, void SingleLineProperties::toSettings(QSettings &settings,
const QString &prefix) const { const QString &prefix) const
{
settings.setValue(prefix + "hasGround", hasGround); settings.setValue(prefix + "hasGround", hasGround);
settings.setValue(prefix + "hasNeutral", hasNeutral); settings.setValue(prefix + "hasNeutral", hasNeutral);
settings.setValue(prefix + "phases", phases); settings.setValue(prefix + "phases", phases);

View File

@@ -41,7 +41,8 @@ ConductorSegment::ConductorSegment(
/** /**
Destructeur - Relie le segment precedent au suivant Destructeur - Relie le segment precedent au suivant
*/ */
ConductorSegment::~ConductorSegment() { ConductorSegment::~ConductorSegment()
{
if (hasPreviousSegment()) previousSegment() -> setNextSegment(nextSegment()); if (hasPreviousSegment()) previousSegment() -> setNextSegment(nextSegment());
if (hasNextSegment()) nextSegment() -> setPreviousSegment(previousSegment()); if (hasNextSegment()) nextSegment() -> setPreviousSegment(previousSegment());
} }
@@ -54,7 +55,8 @@ ConductorSegment::~ConductorSegment() {
@param possible_dx La valeur du mouvement possible (au maximum) @param possible_dx La valeur du mouvement possible (au maximum)
@return true si le mouvement est possible ; false s'il doit etre limite @return true si le mouvement est possible ; false s'il doit etre limite
*/ */
bool ConductorSegment::canMove1stPointX(const qreal &asked_dx, qreal &possible_dx) const { bool ConductorSegment::canMove1stPointX(const qreal &asked_dx, qreal &possible_dx) const
{
Q_ASSERT_X(isVertical(), "ConductorSegment::canMove1stPointX", "segment non vertical"); Q_ASSERT_X(isVertical(), "ConductorSegment::canMove1stPointX", "segment non vertical");
@@ -113,7 +115,8 @@ bool ConductorSegment::canMove1stPointX(const qreal &asked_dx, qreal &possible_d
@param possible_dx La valeur du mouvement possible (au maximum) @param possible_dx La valeur du mouvement possible (au maximum)
@return true si le mouvement est possible ; false s'il doit etre limite @return true si le mouvement est possible ; false s'il doit etre limite
*/ */
bool ConductorSegment::canMove2ndPointX(const qreal &asked_dx, qreal &possible_dx) const { bool ConductorSegment::canMove2ndPointX(const qreal &asked_dx, qreal &possible_dx) const
{
Q_ASSERT_X(isVertical(), "ConductorSegment::canMove2ndPointX", "segment non vertical"); Q_ASSERT_X(isVertical(), "ConductorSegment::canMove2ndPointX", "segment non vertical");
@@ -172,7 +175,8 @@ bool ConductorSegment::canMove2ndPointX(const qreal &asked_dx, qreal &possible_d
@param possible_dy La valeur du mouvement possible (au maximum) @param possible_dy La valeur du mouvement possible (au maximum)
@return true si le mouvement est possible ; false s'il doit etre limite @return true si le mouvement est possible ; false s'il doit etre limite
*/ */
bool ConductorSegment::canMove1stPointY(const qreal &asked_dy, qreal &possible_dy) const { bool ConductorSegment::canMove1stPointY(const qreal &asked_dy, qreal &possible_dy) const
{
Q_ASSERT_X(isHorizontal(), "ConductorSegment::canMove1stPointY", "segment non horizontal"); Q_ASSERT_X(isHorizontal(), "ConductorSegment::canMove1stPointY", "segment non horizontal");
@@ -231,7 +235,8 @@ bool ConductorSegment::canMove1stPointY(const qreal &asked_dy, qreal &possible_d
@param possible_dy La valeur du mouvement possible (au maximum) @param possible_dy La valeur du mouvement possible (au maximum)
@return true si le mouvement est possible ; false s'il doit etre limite @return true si le mouvement est possible ; false s'il doit etre limite
*/ */
bool ConductorSegment::canMove2ndPointY(const qreal &asked_dy, qreal &possible_dy) const { bool ConductorSegment::canMove2ndPointY(const qreal &asked_dy, qreal &possible_dy) const
{
Q_ASSERT_X(isHorizontal(), "ConductorSegment::canMove2ndPointY", "segment non horizontal"); Q_ASSERT_X(isHorizontal(), "ConductorSegment::canMove2ndPointY", "segment non horizontal");
@@ -401,59 +406,68 @@ void ConductorSegment::setNextSegment(ConductorSegment *ns) {
} }
/// @return true si ce segment est un segment statique, cad un segment relie a une borne /// @return true si ce segment est un segment statique, cad un segment relie a une borne
bool ConductorSegment::isStatic() const { bool ConductorSegment::isStatic() const
{
return(isFirstSegment() || isLastSegment()); return(isFirstSegment() || isLastSegment());
} }
/// @return true si ce segment est le premier du conducteur /// @return true si ce segment est le premier du conducteur
bool ConductorSegment::isFirstSegment() const { bool ConductorSegment::isFirstSegment() const
{
return(!hasPreviousSegment()); return(!hasPreviousSegment());
} }
/// @return true si ce segment est le dernier du conducteur /// @return true si ce segment est le dernier du conducteur
bool ConductorSegment::isLastSegment() const { bool ConductorSegment::isLastSegment() const
{
return(!hasNextSegment()); return(!hasNextSegment());
} }
/** /**
@return Le segment precedent @return Le segment precedent
*/ */
ConductorSegment *ConductorSegment::previousSegment() const { ConductorSegment *ConductorSegment::previousSegment() const
{
return(previous_segment); return(previous_segment);
} }
/** /**
@return Le segment suivant @return Le segment suivant
*/ */
ConductorSegment *ConductorSegment::nextSegment() const { ConductorSegment *ConductorSegment::nextSegment() const
{
return(next_segment); return(next_segment);
} }
/** /**
@return true si le segment est vertical, false sinon @return true si le segment est vertical, false sinon
*/ */
bool ConductorSegment::isVertical() const { bool ConductorSegment::isVertical() const
{
return(point1.x() == point2.x()); return(point1.x() == point2.x());
} }
/** /**
@return true si le segment est horizontal, false sinon @return true si le segment est horizontal, false sinon
*/ */
bool ConductorSegment::isHorizontal() const { bool ConductorSegment::isHorizontal() const
{
return(point1.y() == point2.y()); return(point1.y() == point2.y());
} }
/** /**
@return le premier point du segment @return le premier point du segment
*/ */
QPointF ConductorSegment::firstPoint() const { QPointF ConductorSegment::firstPoint() const
{
return(point1); return(point1);
} }
/** /**
@return le second point du segment @return le second point du segment
*/ */
QPointF ConductorSegment::secondPoint() const { QPointF ConductorSegment::secondPoint() const
{
return(point2); return(point2);
} }
@@ -476,21 +490,24 @@ void ConductorSegment::setSecondPoint(const QPointF &p) {
/** /**
@return true si le segment a un segment precedent, false sinon @return true si le segment a un segment precedent, false sinon
*/ */
bool ConductorSegment::hasPreviousSegment() const { bool ConductorSegment::hasPreviousSegment() const
{
return(previous_segment != nullptr); return(previous_segment != nullptr);
} }
/** /**
@return true si le segment a un segment suivant, false sinon @return true si le segment a un segment suivant, false sinon
*/ */
bool ConductorSegment::hasNextSegment() const { bool ConductorSegment::hasNextSegment() const
{
return(next_segment != nullptr); return(next_segment != nullptr);
} }
/** /**
@return Le centre du rectangle delimitant le conducteur @return Le centre du rectangle delimitant le conducteur
*/ */
QPointF ConductorSegment::middle() const { QPointF ConductorSegment::middle() const
{
return( return(
QPointF( QPointF(
(point1.x()+ point2.x()) / 2.0, (point1.x()+ point2.x()) / 2.0,
@@ -502,7 +519,8 @@ QPointF ConductorSegment::middle() const {
/** /**
@return La longueur du conducteur @return La longueur du conducteur
*/ */
qreal ConductorSegment::length() const { qreal ConductorSegment::length() const
{
if (isHorizontal()) { if (isHorizontal()) {
return(secondPoint().x() - firstPoint().x()); return(secondPoint().x() - firstPoint().x());
} else { } else {
@@ -511,11 +529,13 @@ qreal ConductorSegment::length() const {
} }
/// @return QET::Horizontal si le segment est horizontal, QET::Vertical sinon /// @return QET::Horizontal si le segment est horizontal, QET::Vertical sinon
QET::ConductorSegmentType ConductorSegment::type() const { QET::ConductorSegmentType ConductorSegment::type() const
{
return(isHorizontal() ? QET::Horizontal : QET::Vertical); return(isHorizontal() ? QET::Horizontal : QET::Vertical);
} }
/// @return true si les deux points constituant le segment sont egaux /// @return true si les deux points constituant le segment sont egaux
bool ConductorSegment::isPoint() const { bool ConductorSegment::isPoint() const
{
return(point1 == point2); return(point1 == point2);
} }

View File

@@ -92,13 +92,15 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
} }
/// Destructeur /// Destructeur
ConfigDialog::~ConfigDialog() { ConfigDialog::~ConfigDialog()
{
} }
/** /**
Construit la liste des pages sur la gauche Construit la liste des pages sur la gauche
*/ */
void ConfigDialog::buildPagesList() { void ConfigDialog::buildPagesList()
{
pages_list -> clear(); pages_list -> clear();
foreach(ConfigPage *page, pages) { foreach(ConfigPage *page, pages) {
addPageToList(page); addPageToList(page);
@@ -119,7 +121,8 @@ void ConfigDialog::addPageToList(ConfigPage *page) {
/** /**
Applique la configuration de toutes les pages Applique la configuration de toutes les pages
*/ */
void ConfigDialog::applyConf() { void ConfigDialog::applyConf()
{
foreach(ConfigPage *page, pages) { foreach(ConfigPage *page, pages) {
page -> applyConf(); page -> applyConf();
} }

View File

@@ -103,7 +103,8 @@ NewDiagramPage::NewDiagramPage(QETProject *project,
/** /**
@brief NewDiagramPage::~NewDiagramPage @brief NewDiagramPage::~NewDiagramPage
*/ */
NewDiagramPage::~NewDiagramPage() { NewDiagramPage::~NewDiagramPage()
{
disconnect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab())); disconnect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
} }
@@ -113,7 +114,8 @@ NewDiagramPage::~NewDiagramPage() {
If there is a project, save in the project, If there is a project, save in the project,
else save to the default conf of QElectroTech else save to the default conf of QElectroTech
*/ */
void NewDiagramPage::applyConf() { void NewDiagramPage::applyConf()
{
if (m_project) { //If project we save to the project if (m_project) { //If project we save to the project
if (m_project -> isReadOnly()) return; if (m_project -> isReadOnly()) return;
bool modified_project = false; bool modified_project = false;
@@ -182,7 +184,8 @@ void NewDiagramPage::applyConf() {
@brief NewDiagramPage::icon @brief NewDiagramPage::icon
@return icon of this page @return icon of this page
*/ */
QIcon NewDiagramPage::icon() const { QIcon NewDiagramPage::icon() const
{
if (m_project) return(QET::Icons::NewDiagram); if (m_project) return(QET::Icons::NewDiagram);
return(QET::Icons::Projects); return(QET::Icons::Projects);
} }
@@ -191,7 +194,8 @@ QIcon NewDiagramPage::icon() const {
@brief NewDiagramPage::title @brief NewDiagramPage::title
@return title of this page @return title of this page
*/ */
QString NewDiagramPage::title() const { QString NewDiagramPage::title() const
{
if (m_project) return(tr("Nouveau folio", "configuration page title")); if (m_project) return(tr("Nouveau folio", "configuration page title"));
return(tr("Nouveau projet", "configuration page title")); return(tr("Nouveau projet", "configuration page title"));
} }
@@ -200,7 +204,8 @@ QString NewDiagramPage::title() const {
@brief NewDiagramPage::changeToAutoFolioTab @brief NewDiagramPage::changeToAutoFolioTab
Set the current tab to Autonum Set the current tab to Autonum
*/ */
void NewDiagramPage::changeToAutoFolioTab(){ void NewDiagramPage::changeToAutoFolioTab()
{
if (m_project){ if (m_project){
ppd_->setCurrentPage(ProjectPropertiesDialog::Autonum); ppd_->setCurrentPage(ProjectPropertiesDialog::Autonum);
ppd_->changeToFolio(); ppd_->changeToFolio();
@@ -222,7 +227,8 @@ void NewDiagramPage::setFolioAutonum(QString autoNum){
@brief NewDiagramPage::saveCurrentTbp @brief NewDiagramPage::saveCurrentTbp
Save current TBP to retrieve after auto folio num Save current TBP to retrieve after auto folio num
*/ */
void NewDiagramPage::saveCurrentTbp(){ void NewDiagramPage::saveCurrentTbp()
{
savedTbp = ipw->properties(); savedTbp = ipw->properties();
} }
@@ -230,7 +236,8 @@ void NewDiagramPage::saveCurrentTbp(){
@brief NewDiagramPage::loadSavedTbp @brief NewDiagramPage::loadSavedTbp
Retrieve saved auto folio num Retrieve saved auto folio num
*/ */
void NewDiagramPage::loadSavedTbp(){ void NewDiagramPage::loadSavedTbp()
{
ipw->setProperties(savedTbp); ipw->setProperties(savedTbp);
applyConf(); applyConf();
} }
@@ -260,7 +267,8 @@ ExportConfigPage::ExportConfigPage(QWidget *parent) : ConfigPage(parent) {
} }
/// Destructeur /// Destructeur
ExportConfigPage::~ExportConfigPage() { ExportConfigPage::~ExportConfigPage()
{
} }
/** /**
@@ -273,12 +281,14 @@ void ExportConfigPage::applyConf()
} }
/// @return l'icone de cette page /// @return l'icone de cette page
QIcon ExportConfigPage::icon() const { QIcon ExportConfigPage::icon() const
{
return(QET::Icons::DocumentExport); return(QET::Icons::DocumentExport);
} }
/// @return le titre de cette page /// @return le titre de cette page
QString ExportConfigPage::title() const { QString ExportConfigPage::title() const
{
return(tr("Export", "configuration page title")); return(tr("Export", "configuration page title"));
} }
@@ -308,7 +318,8 @@ PrintConfigPage::PrintConfigPage(QWidget *parent) : ConfigPage(parent) {
} }
/// Destructeur /// Destructeur
PrintConfigPage::~PrintConfigPage() { PrintConfigPage::~PrintConfigPage()
{
} }
/** /**
@@ -329,12 +340,14 @@ void PrintConfigPage::applyConf()
} }
/// @return l'icone de cette page /// @return l'icone de cette page
QIcon PrintConfigPage::icon() const { QIcon PrintConfigPage::icon() const
{
return(QET::Icons::Printer); return(QET::Icons::Printer);
} }
/// @return le titre de cette page /// @return le titre de cette page
QString PrintConfigPage::title() const { QString PrintConfigPage::title() const
{
return(tr("Impression", "configuration page title")); return(tr("Impression", "configuration page title"));
} }

View File

@@ -39,7 +39,7 @@ Createdxf::~Createdxf()
} }
/* Header section of every DXF file.*/ /* Header section of every DXF file.*/
void Createdxf::dxfBegin (const QString& fileName) void Createdxf::dxfBegin (const QString& fileName)
{ {
// Creation of an output stream object in text mode. // Creation of an output stream object in text mode.
@@ -75,7 +75,7 @@ void Createdxf::dxfBegin (const QString& fileName)
To_Dxf << 30 << "\r\n"; To_Dxf << 30 << "\r\n";
To_Dxf << "0.0" << "\r\n"; To_Dxf << "0.0" << "\r\n";
To_Dxf << 9 << "\r\n"; To_Dxf << 9 << "\r\n";
To_Dxf << "$EXTMIN" << "\r\n"; To_Dxf << "$EXTMIN" << "\r\n";
To_Dxf << 10 << "\r\n"; To_Dxf << 10 << "\r\n";
To_Dxf << "0.0" << "\r\n"; To_Dxf << "0.0" << "\r\n";
@@ -87,7 +87,7 @@ void Createdxf::dxfBegin (const QString& fileName)
To_Dxf << "4000.0" << "\r\n"; To_Dxf << "4000.0" << "\r\n";
To_Dxf << 20 << "\r\n"; To_Dxf << 20 << "\r\n";
To_Dxf << "4000.0" << "\r\n"; To_Dxf << "4000.0" << "\r\n";
To_Dxf << 9 << "\r\n"; To_Dxf << 9 << "\r\n";
To_Dxf << "$LIMMIN" << "\r\n"; To_Dxf << "$LIMMIN" << "\r\n";
To_Dxf << 10 << "\r\n"; To_Dxf << 10 << "\r\n";
@@ -109,7 +109,7 @@ void Createdxf::dxfBegin (const QString& fileName)
To_Dxf << 0 << "\r\n"; To_Dxf << 0 << "\r\n";
To_Dxf << "TABLE" << "\r\n"; To_Dxf << "TABLE" << "\r\n";
To_Dxf << 2 << "\r\n"; To_Dxf << 2 << "\r\n";
To_Dxf << "VPORT" << "\r\n"; To_Dxf << "VPORT" << "\r\n";
To_Dxf << 70 << "\r\n"; To_Dxf << 70 << "\r\n";
To_Dxf << 1 << "\r\n"; To_Dxf << 1 << "\r\n";
@@ -190,7 +190,7 @@ void Createdxf::dxfBegin (const QString& fileName)
To_Dxf << 0 << "\r\n"; To_Dxf << 0 << "\r\n";
To_Dxf << "TABLE" << "\r\n"; To_Dxf << "TABLE" << "\r\n";
To_Dxf << 2 << "\r\n"; To_Dxf << 2 << "\r\n";
To_Dxf << "LTYPE" << "\r\n"; To_Dxf << "LTYPE" << "\r\n";
To_Dxf << 70 << "\r\n"; To_Dxf << 70 << "\r\n";
To_Dxf << 1 << "\r\n"; To_Dxf << 1 << "\r\n";
@@ -209,7 +209,7 @@ void Createdxf::dxfBegin (const QString& fileName)
To_Dxf << 40 << "\r\n"; To_Dxf << 40 << "\r\n";
To_Dxf << 0.00 << "\r\n"; To_Dxf << 0.00 << "\r\n";
To_Dxf << 0 << "\r\n"; To_Dxf << 0 << "\r\n";
To_Dxf << "ENDTAB" << "\r\n"; To_Dxf << "ENDTAB" << "\r\n";
To_Dxf << 0 << "\r\n"; To_Dxf << 0 << "\r\n";
To_Dxf << "ENDSEC" << "\r\n"; To_Dxf << "ENDSEC" << "\r\n";
@@ -228,8 +228,12 @@ void Createdxf::dxfBegin (const QString& fileName)
} }
} }
/* End Section of every DXF File*/ /**
void Createdxf::dxfEnd (const QString& fileName) @brief Createdxf::dxfEnd
End Section of every DXF File
@param fileName
*/
void Createdxf::dxfEnd(const QString& fileName)
{ {
// Creation of an output stream object in text mode. // Creation of an output stream object in text mode.
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
@@ -251,9 +255,21 @@ void Createdxf::dxfEnd (const QString& fileName)
} }
} }
/**
/* draw circle in dxf format*/ @brief Createdxf::drawCircle
void Createdxf::drawCircle (const QString& fileName, double radius, double x, double y, int colour) draw circle in dxf format
@param fileName
@param radius
@param x
@param y
@param colour
*/
void Createdxf::drawCircle(
const QString& fileName,
double radius,
double x,
double y,
int colour)
{ {
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QFile file(fileName); QFile file(fileName);
@@ -285,9 +301,23 @@ void Createdxf::drawCircle (const QString& fileName, double radius, double x, do
} }
} }
/**
/* draw line in DXF Format*/ @brief Createdxf::drawLine
void Createdxf::drawLine (const QString &fileName, double x1, double y1, double x2, double y2,const int &colour) draw line in DXF Format
@param fileName
@param x1
@param y1
@param x2
@param y2
@param colour
*/
void Createdxf::drawLine (
const QString &fileName,
double x1,
double y1,
double x2,
double y2,
const int &colour)
{ {
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QFile file(fileName); QFile file(fileName);
@@ -323,7 +353,8 @@ void Createdxf::drawLine (const QString &fileName, double x1, double y1, double
} }
} }
long Createdxf::RGBcodeTable[255]{ long Createdxf::RGBcodeTable[255]
{
0x000000, 0xff0000, 0xffff00, 0x00ff00, 0x00ffff, 0x000000, 0xff0000, 0xffff00, 0x00ff00, 0x00ffff,
0x0000ff, 0xff00ff, 0xffffff, 0x414141, 0x808080, 0x0000ff, 0xff00ff, 0xffffff, 0x414141, 0x808080,
0xff0000, 0xffaaaa, 0xbd0000, 0xbd7e7e, 0x810000, 0xff0000, 0xffaaaa, 0xbd0000, 0xbd7e7e, 0x810000,
@@ -415,7 +446,11 @@ int Createdxf::getcolorCode (const long red, const long green, const long blue)
@param line @param line
@param colorcode @param colorcode
*/ */
void Createdxf::drawLine(const QString &filepath, const QLineF &line, const int &colorcode) { void Createdxf::drawLine(
const QString &filepath,
const QLineF &line,
const int &colorcode)
{
drawLine(filepath, line.p1().x() * xScale, drawLine(filepath, line.p1().x() * xScale,
sheetHeight - (line.p1().y() * yScale), sheetHeight - (line.p1().y() * yScale),
line.p2().x() * xScale, line.p2().x() * xScale,
@@ -423,7 +458,19 @@ void Createdxf::drawLine(const QString &filepath, const QLineF &line, const int
colorcode); colorcode);
} }
void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal spanAngle, qreal hotspot_x, qreal hotspot_y, qreal rotation_angle, const int &colorcode) { void Createdxf::drawArcEllipse(
const QString &file_path,
qreal x,
qreal y,
qreal w,
qreal h,
qreal startAngle,
qreal spanAngle,
qreal hotspot_x,
qreal hotspot_y,
qreal rotation_angle,
const int &colorcode)
{
// vector of parts of arc (stored as a pair of startAngle and spanAngle) for each quadrant. // vector of parts of arc (stored as a pair of startAngle and spanAngle) for each quadrant.
QVector< QPair<qreal,qreal> > arc_parts_vector; QVector< QPair<qreal,qreal> > arc_parts_vector;
@@ -534,7 +581,12 @@ void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal
arc_endAngle = temp; arc_endAngle = temp;
} }
QPointF transformed_point = ExportDialog::rotation_transformed(center_x, center_y, hotspot_x, hotspot_y, rotation_angle); QPointF transformed_point = ExportDialog::rotation_transformed(
center_x,
center_y,
hotspot_x,
hotspot_y,
rotation_angle);
center_x = transformed_point.x(); center_x = transformed_point.x();
center_y = transformed_point.y(); center_y = transformed_point.y();
arc_endAngle *= 180/3.142; arc_endAngle *= 180/3.142;
@@ -542,7 +594,14 @@ void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal
arc_endAngle -= rotation_angle; arc_endAngle -= rotation_angle;
arc_startAngle -= rotation_angle; arc_startAngle -= rotation_angle;
drawArc(file_path, center_x, center_y, radius, arc_startAngle, arc_endAngle, colorcode); drawArc(
file_path,
center_x,
center_y,
radius,
arc_startAngle,
arc_endAngle,
colorcode);
} }
} }
@@ -553,16 +612,37 @@ void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal
@param rect @param rect
@param colorcode @param colorcode
*/ */
void Createdxf::drawEllipse(const QString &filepath, const QRectF &rect, const int &colorcode) { void Createdxf::drawEllipse(
drawArcEllipse(filepath, rect.topLeft().x() * xScale, const QString &filepath,
sheetHeight - (rect.topLeft().y() * yScale), const QRectF &rect,
rect.width() * xScale, const int &colorcode)
rect.height() * yScale, {
0, 360, 0, 0, 0, colorcode); drawArcEllipse(
filepath,
rect.topLeft().x() * xScale,
sheetHeight - (rect.topLeft().y() * yScale),
rect.width() * xScale,
rect.height() * yScale,
0, 360, 0, 0, 0, colorcode);
} }
/* draw rectangle in dxf format */ /**
void Createdxf::drawRectangle (const QString &fileName, double x1, double y1, double width, double height, const int &colour) @brief Createdxf::drawRectangle
draw rectangle in dxf format
@param fileName
@param x1
@param y1
@param width
@param height
@param colour
*/
void Createdxf::drawRectangle (
const QString &fileName,
double x1,
double y1,
double width,
double height,
const int &colour)
{ {
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QFile file(fileName); QFile file(fileName);
@@ -654,40 +734,47 @@ void Createdxf::drawRectangle (const QString &fileName, double x1, double y1, do
/** /**
@brief Createdxf::drawRectangle @brief Createdxf::drawRectangle
Convenience function for draw rectangle Convenience function for draw rectangle
@param filepath @param filepath
@param rect @param rect
@param colorcode @param colorcode
*/ */
void Createdxf::drawRectangle(const QString &filepath, void Createdxf::drawRectangle(
const QRectF &rect, const QString &filepath,
const int &colorcode) { const QRectF &rect,
drawRectangle(filepath, rect.bottomLeft().x() * xScale, const int &colorcode) {
sheetHeight - (rect.bottomLeft().y() * yScale), drawRectangle(
rect.width() * xScale, filepath,
rect.height() * yScale, rect.bottomLeft().x() * xScale,
colorcode); sheetHeight - (rect.bottomLeft().y() * yScale),
rect.width() * xScale,
rect.height() * yScale,
colorcode);
} }
/** /**
@brief Createdxf::drawPolygon @brief Createdxf::drawPolygon
Convenience function for draw polygon Convenience function for draw polygon
@param filepath @param filepath
@param poly @param poly
@param colorcode @param colorcode
*/ */
void Createdxf::drawPolygon(const QString &filepath, void Createdxf::drawPolygon(
const QPolygonF &poly, const QString &filepath,
const int &colorcode) { const QPolygonF &poly,
int lc = 0; const int &colorcode)
QPointF plast; {
foreach(QPointF p, poly) { int lc = 0;
if(lc++) { QPointF plast;
QLineF ql(plast,p); foreach(QPointF p, poly)
drawLine(filepath,ql,colorcode); {
} if(lc++)
plast = p; {
} QLineF ql(plast,p);
drawLine(filepath,ql,colorcode);
}
plast = p;
}
} }
/** /**
@brief Createdxf::drawArc @brief Createdxf::drawArc
@@ -700,13 +787,14 @@ void Createdxf::drawPolygon(const QString &filepath,
@param endAngle @param endAngle
@param color @param color
*/ */
void Createdxf::drawArc(const QString& fileName, void Createdxf::drawArc(
double x, const QString& fileName,
double y, double x,
double rad, double y,
double startAngle, double rad,
double endAngle, double startAngle,
int color) double endAngle,
int color)
{ {
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QFile file(fileName); QFile file(fileName);
@@ -753,13 +841,14 @@ void Createdxf::drawArc(const QString& fileName,
@param rotation @param rotation
@param colour @param colour
*/ */
void Createdxf::drawText(const QString& fileName, void Createdxf::drawText(
const QString& text, const QString& fileName,
double x, const QString& text,
double y, double x,
double height, double y,
double rotation, double height,
int colour) double rotation,
int colour)
{ {
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QFile file(fileName); QFile file(fileName);
@@ -844,17 +933,17 @@ void Createdxf::drawTextAligned(
To_Dxf << 50 << "\r\n"; To_Dxf << 50 << "\r\n";
To_Dxf << rotation << "\r\n"; // Text Rotation To_Dxf << rotation << "\r\n"; // Text Rotation
#if 0 #if 0
// If "Fit to width", then check if width of text < width specified then change it "center align or left align" // If "Fit to width", then check if width of text < width specified then change it "center align or left align"
if (hAlign == 5) { if (hAlign == 5) {
int xDiff = xAlign - x; int xDiff = xAlign - x;
int len = text.length(); int len = text.length();
int t = xDiff/height; int t = xDiff/height;
if (text.length() < xDiff/height && !leftAlign) { if (text.length() < xDiff/height && !leftAlign) {
hAlign = 1; hAlign = 1;
xAlign = x+ (xAlign / 2); xAlign = x+ (xAlign / 2);
} else if (text.length() < xDiff/height && leftAlign) { } else if (text.length() < xDiff/height && leftAlign) {
hAlign = 0; hAlign = 0;
xAlign = x; xAlign = x;
// file.close(); // file.close();
// return; // return;
} }

View File

@@ -21,99 +21,112 @@
#include <QtCore> #include <QtCore>
#include <QtWidgets> #include <QtWidgets>
/**
/* This class exports the project to DXF Format */ @brief The Createdxf class
This class exports the project to DXF Format
*/
class Createdxf class Createdxf
{ {
public: public:
Createdxf(); Createdxf();
~Createdxf(); ~Createdxf();
static void dxfBegin (const QString&); static void dxfBegin (const QString&);
static void dxfEnd(const QString&); static void dxfEnd(const QString&);
// you can add more functions to create more drawings. // you can add more functions to create more drawings.
static void drawCircle(const QString&, static void drawCircle(
double, const QString&,
double, double,
double, double,
int); double,
static void drawArc(const QString&, int);
double x, static void drawArc(
double y, const QString&,
double rad, double x,
double startAngle, double y,
double endAngle, double rad,
int color); double startAngle,
static void drawDonut(QString,double,double,double,int); double endAngle,
int color);
static void drawDonut(QString,double,double,double,int);
static void drawArcEllipse (const QString &file_path, static void drawArcEllipse (
qreal x, const QString &file_path,
qreal y, qreal x,
qreal w, qreal y,
qreal h, qreal w,
qreal startAngle, qreal h,
qreal spanAngle, qreal startAngle,
qreal hotspot_x, qreal spanAngle,
qreal hotspot_y, qreal hotspot_x,
qreal rotation_angle, qreal hotspot_y,
const int &colorcode); qreal rotation_angle,
const int &colorcode);
static void drawEllipse (const QString &filepath, static void drawEllipse (const QString &filepath,
const QRectF &rect, const QRectF &rect,
const int &colorcode); const int &colorcode);
static void drawRectangle(const QString &filepath, static void drawRectangle(
double, const QString &filepath,
double, double,
double, double,
double, double,
const int &colorcode); double,
static void drawRectangle(const QString &filepath, const int &colorcode);
const QRectF &rect, static void drawRectangle(
const int &colorcode); const QString &filepath,
const QRectF &rect,
const int &colorcode);
static void drawPolygon(const QString &filepath, static void drawPolygon(
const QPolygonF &poly, const QString &filepath,
const int &colorcode); const QPolygonF &poly,
const int &colorcode);
static void drawLine(const QString &filapath, static void drawLine(
double, const QString &filapath,
double, double,
double, double,
double, double,
const int &clorcode); double,
static void drawLine(const QString &filepath, const int &clorcode);
const QLineF &line, static void drawLine(
const int &colorcode); const QString &filepath,
const QLineF &line,
const int &colorcode);
static void drawText(const QString&, static void drawText(
const QString&, const QString&,
double,double, const QString&,
double, double,double,
double, double,
int); double,
static void drawTextAligned(const QString& fileName, int);
const QString& text, static void drawTextAligned(
double x, const QString& fileName,
double y, const QString& text,
double height, double x,
double rotation, double y,
double oblique, double height,
int hAlign, double rotation,
int vAlign, double oblique,
double xAlign, int hAlign,
double xScale, int vAlign,
int colour); double xAlign,
double xScale,
int colour);
static int getcolorCode (const long red, static int getcolorCode (
const long green, const long red,
const long blue); const long green,
static long RGBcodeTable[]; const long blue);
static long RGBcodeTable[];
static const double sheetWidth; static const double sheetWidth;
static const double sheetHeight; static const double sheetHeight;
static double xScale; static double xScale;
static double yScale; static double yScale;
}; };
#endif // CREATEDXF_H #endif // CREATEDXF_H

View File

@@ -49,7 +49,8 @@ projectDataBase::projectDataBase(QETProject *project, const QString &connection_
@brief projectDataBase::~projectDataBase @brief projectDataBase::~projectDataBase
Destructor Destructor
*/ */
projectDataBase::~projectDataBase() { projectDataBase::~projectDataBase()
{
m_data_base.close(); m_data_base.close();
} }
@@ -71,7 +72,8 @@ void projectDataBase::updateDB()
@brief projectDataBase::project @brief projectDataBase::project
@return the project of this database @return the project of this database
*/ */
QETProject *projectDataBase::project() const { QETProject *projectDataBase::project() const
{
return m_project; return m_project;
} }

View File

@@ -98,7 +98,8 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
/** /**
@brief ElementQueryWidget::~ElementQueryWidget @brief ElementQueryWidget::~ElementQueryWidget
*/ */
ElementQueryWidget::~ElementQueryWidget() { ElementQueryWidget::~ElementQueryWidget()
{
delete ui; delete ui;
} }
@@ -413,7 +414,8 @@ void ElementQueryWidget::setCount(QString text, bool set)
/** /**
@brief ElementQueryWidget::updateQueryLine @brief ElementQueryWidget::updateQueryLine
*/ */
void ElementQueryWidget::updateQueryLine() { void ElementQueryWidget::updateQueryLine()
{
ui->m_sql_query->setText(queryStr()); ui->m_sql_query->setText(queryStr());
} }
@@ -464,7 +466,8 @@ void ElementQueryWidget::setUpItems()
@param key @param key
@return the filter associated to key @return the filter associated to key
*/ */
QPair<int, QString> ElementQueryWidget::FilterFor(const QString &key) const { QPair<int, QString> ElementQueryWidget::FilterFor(const QString &key) const
{
return m_filter.value(key, qMakePair(0, QString())); return m_filter.value(key, qMakePair(0, QString()));
} }

View File

@@ -153,7 +153,8 @@ void SummaryQueryWidget::fillSavedQuery()
/** /**
@brief SummaryQueryWidget::updateQueryLine @brief SummaryQueryWidget::updateQueryLine
*/ */
void SummaryQueryWidget::updateQueryLine() { void SummaryQueryWidget::updateQueryLine()
{
ui->m_user_query_le->setText(queryStr()); ui->m_user_query_le->setText(queryStr());
} }

View File

@@ -516,7 +516,8 @@ void Diagram::keyReleaseEvent(QKeyEvent *e)
@brief Diagram::uuid @brief Diagram::uuid
@return the uuid of this diagram @return the uuid of this diagram
*/ */
QUuid Diagram::uuid() { QUuid Diagram::uuid()
{
return m_uuid; return m_uuid;
} }
@@ -561,7 +562,8 @@ void Diagram::clearEventInterface()
@brief Diagram::conductorsAutonumName @brief Diagram::conductorsAutonumName
@return the name of autonum to use. @return the name of autonum to use.
*/ */
QString Diagram::conductorsAutonumName() const { QString Diagram::conductorsAutonumName() const
{
return m_conductors_autonum_name; return m_conductors_autonum_name;
} }
@@ -648,7 +650,8 @@ bool Diagram::toPaintDevice(QPaintDevice &pix,
\~ @return The size of the image generated by toImage() \~ @return The size of the image generated by toImage()
\~French La taille de l'image generee par toImage() \~French La taille de l'image generee par toImage()
*/ */
QSize Diagram::imageSize() const { QSize Diagram::imageSize() const
{
// determine la zone source = contenu du schema + marges // determine la zone source = contenu du schema + marges
qreal image_width, image_height; qreal image_width, image_height;
if (!use_border_) { if (!use_border_) {
@@ -677,7 +680,8 @@ QSize Diagram::imageSize() const {
\~French true si le schema est considere comme vide, false sinon. \~French true si le schema est considere comme vide, false sinon.
Un schema vide ne contient ni element, ni conducteur, ni champ de texte Un schema vide ne contient ni element, ni conducteur, ni champ de texte
*/ */
bool Diagram::isEmpty() const { bool Diagram::isEmpty() const
{
return(!items().count()); return(!items().count());
} }
@@ -687,7 +691,8 @@ bool Diagram::isEmpty() const {
each potential are in the QList each potential are in the QList
and each conductors of one potential are in the QSet and each conductors of one potential are in the QSet
*/ */
QList < QSet <Conductor *> > Diagram::potentials() { QList < QSet <Conductor *> > Diagram::potentials()
{
QList < QSet <Conductor *> > potential_List; QList < QSet <Conductor *> > potential_List;
if (content().conductors().size() == 0) if (content().conductors().size() == 0)
return (potential_List); //return an empty potential return (potential_List); //return an empty potential
@@ -1673,7 +1678,8 @@ void Diagram::setTitleBlockTemplate(const QString &template_name)
Select all schema objects Select all schema objects
\~French Selectionne tous les objets du schema \~French Selectionne tous les objets du schema
*/ */
void Diagram::selectAll() { void Diagram::selectAll()
{
if (items().isEmpty()) return; if (items().isEmpty()) return;
blockSignals(true); blockSignals(true);
@@ -1687,7 +1693,8 @@ void Diagram::selectAll() {
Deselects all selected objects Deselects all selected objects
\~French Deslectionne tous les objets selectionnes \~French Deslectionne tous les objets selectionnes
*/ */
void Diagram::deselectAll() { void Diagram::deselectAll()
{
if (items().isEmpty()) return; if (items().isEmpty()) return;
clearSelection(); clearSelection();
@@ -1698,7 +1705,8 @@ void Diagram::deselectAll() {
Reverses the selection state of all schema objects Reverses the selection state of all schema objects
Inverse l'etat de selection de tous les objets du schema Inverse l'etat de selection de tous les objets du schema
*/ */
void Diagram::invertSelection() { void Diagram::invertSelection()
{
if (items().isEmpty()) return; if (items().isEmpty()) return;
blockSignals(true); blockSignals(true);
@@ -1854,7 +1862,8 @@ void Diagram::changeZValue(QET::DepthOption option)
This class loads all folio sequential variables related This class loads all folio sequential variables related
to the current autonum to the current autonum
*/ */
void Diagram::loadElmtFolioSeq() { void Diagram::loadElmtFolioSeq()
{
QString title = project()->elementCurrentAutoNum(); QString title = project()->elementCurrentAutoNum();
NumerotationContext nc = project()->elementAutoNum(title); NumerotationContext nc = project()->elementAutoNum(title);
@@ -1939,7 +1948,8 @@ void Diagram::loadElmtFolioSeq() {
This class loads all conductor folio sequential variables related This class loads all conductor folio sequential variables related
to the current autonum to the current autonum
*/ */
void Diagram::loadCndFolioSeq() { void Diagram::loadCndFolioSeq()
{
//Conductor //Conductor
QString title = project()->conductorCurrentAutoNum(); QString title = project()->conductorCurrentAutoNum();
NumerotationContext nc = project()->conductorAutoNum(title); NumerotationContext nc = project()->conductorAutoNum(title);
@@ -2020,7 +2030,8 @@ void Diagram::loadCndFolioSeq() {
@return title of the titleblock @return title of the titleblock
\~Frenchle titre du cartouche \~Frenchle titre du cartouche
*/ */
QString Diagram::title() const { QString Diagram::title() const
{
return(border_and_titleblock.title()); return(border_and_titleblock.title());
} }
@@ -2028,7 +2039,8 @@ QString Diagram::title() const {
@brief Diagram::elements @brief Diagram::elements
@return the list containing all elements @return the list containing all elements
*/ */
QList <Element *> Diagram::elements() const { QList <Element *> Diagram::elements() const
{
QList<Element *> element_list; QList<Element *> element_list;
foreach (QGraphicsItem *qgi, items()) { foreach (QGraphicsItem *qgi, items()) {
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) if (Element *elmt = qgraphicsitem_cast<Element *>(qgi))
@@ -2041,7 +2053,8 @@ QList <Element *> Diagram::elements() const {
@brief Diagram::conductors @brief Diagram::conductors
@return the list containing all conductors @return the list containing all conductors
*/ */
QList <Conductor *> Diagram::conductors() const { QList <Conductor *> Diagram::conductors() const
{
QList<Conductor *> cnd_list; QList<Conductor *> cnd_list;
foreach (QGraphicsItem *qgi, items()) { foreach (QGraphicsItem *qgi, items()) {
if (Conductor *cnd = qgraphicsitem_cast<Conductor *>(qgi)) if (Conductor *cnd = qgraphicsitem_cast<Conductor *>(qgi))
@@ -2054,7 +2067,8 @@ QList <Conductor *> Diagram::conductors() const {
@brief Diagram::elementsMover @brief Diagram::elementsMover
@return @return
*/ */
ElementsMover &Diagram::elementsMover() { ElementsMover &Diagram::elementsMover()
{
return m_elements_mover; return m_elements_mover;
} }
@@ -2062,7 +2076,8 @@ ElementsMover &Diagram::elementsMover() {
@brief Diagram::elementTextsMover @brief Diagram::elementTextsMover
@return @return
*/ */
ElementTextsMover &Diagram::elementTextsMover() { ElementTextsMover &Diagram::elementTextsMover()
{
return m_element_texts_mover; return m_element_texts_mover;
} }
@@ -2111,7 +2126,8 @@ void Diagram::freezeElements(bool freeze) {
@brief Diagram::unfreezeElements @brief Diagram::unfreezeElements
Unfreeze every existent element label. Unfreeze every existent element label.
*/ */
void Diagram::unfreezeElements() { void Diagram::unfreezeElements()
{
foreach (Element *elmt, elements()) { foreach (Element *elmt, elements()) {
elmt->freezeLabel(false); elmt->freezeLabel(false);
} }
@@ -2129,7 +2145,8 @@ void Diagram::setFreezeNewElements(bool b) {
@brief Diagram::freezeNewElements @brief Diagram::freezeNewElements
@return current freeze new element status . @return current freeze new element status .
*/ */
bool Diagram::freezeNewElements() { bool Diagram::freezeNewElements()
{
return m_freeze_new_elements; return m_freeze_new_elements;
} }
@@ -2155,7 +2172,8 @@ void Diagram::setFreezeNewConductors(bool b) {
@brief Diagram::freezeNewConductors @brief Diagram::freezeNewConductors
@return current freeze new conductor status . @return current freeze new conductor status .
*/ */
bool Diagram::freezeNewConductors() { bool Diagram::freezeNewConductors()
{
return m_freeze_new_conductors_; return m_freeze_new_conductors_;
} }
@@ -2294,7 +2312,8 @@ void Diagram::setDrawColoredConductors(bool dcc) {
@return the list of conductors selected on the diagram @return the list of conductors selected on the diagram
\~French la liste des conducteurs selectionnes sur le schema \~French la liste des conducteurs selectionnes sur le schema
*/ */
QSet<Conductor *> Diagram::selectedConductors() const { QSet<Conductor *> Diagram::selectedConductors() const
{
QSet<Conductor *> conductors_set; QSet<Conductor *> conductors_set;
foreach(QGraphicsItem *qgi, selectedItems()) { foreach(QGraphicsItem *qgi, selectedItems()) {
if (Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) { if (Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) {
@@ -2309,7 +2328,8 @@ QSet<Conductor *> Diagram::selectedConductors() const {
@return true if the clipboard appears to contain a schema @return true if the clipboard appears to contain a schema
\~French true si le presse-papier semble contenir un schema \~French true si le presse-papier semble contenir un schema
*/ */
bool Diagram::clipboardMayContainDiagram() { bool Diagram::clipboardMayContainDiagram()
{
QString clipboard_text = QApplication::clipboard() -> text().trimmed(); QString clipboard_text = QApplication::clipboard() -> text().trimmed();
bool may_be_diagram = clipboard_text.startsWith("<diagram") bool may_be_diagram = clipboard_text.startsWith("<diagram")
&& clipboard_text.endsWith("</diagram>"); && clipboard_text.endsWith("</diagram>");
@@ -2323,7 +2343,8 @@ bool Diagram::clipboardMayContainDiagram() {
\~French le projet auquel ce schema appartient \~French le projet auquel ce schema appartient
ou 0 s'il s'agit d'un schema independant. ou 0 s'il s'agit d'un schema independant.
*/ */
QETProject *Diagram::project() const { QETProject *Diagram::project() const
{
return(m_project); return(m_project);
} }
@@ -2332,7 +2353,8 @@ QETProject *Diagram::project() const {
@return the folio number of this diagram within its parent project, @return the folio number of this diagram within its parent project,
or -1 if it is has no parent project or -1 if it is has no parent project
*/ */
int Diagram::folioIndex() const { int Diagram::folioIndex() const
{
if (!m_project) return(-1); if (!m_project) return(-1);
return(m_project -> folioIndex(this)); return(m_project -> folioIndex(this));
} }
@@ -2345,7 +2367,8 @@ int Diagram::folioIndex() const {
fallback_to_project is true. fallback_to_project is true.
@return the declared QElectroTech version of this diagram @return the declared QElectroTech version of this diagram
*/ */
qreal Diagram::declaredQElectroTechVersion(bool fallback_to_project) const { qreal Diagram::declaredQElectroTechVersion(bool fallback_to_project) const
{
if (diagram_qet_version_ != -1) { if (diagram_qet_version_ != -1) {
return diagram_qet_version_; return diagram_qet_version_;
} }
@@ -2372,7 +2395,8 @@ bool Diagram::isReadOnly() const
\~French Le contenu du schema. Les conducteurs sont tous places dans \~French Le contenu du schema. Les conducteurs sont tous places dans
conductorsToMove. conductorsToMove.
*/ */
DiagramContent Diagram::content() const { DiagramContent Diagram::content() const
{
DiagramContent dc; DiagramContent dc;
foreach(QGraphicsItem *qgi, items()) { foreach(QGraphicsItem *qgi, items()) {
if (Element *e = qgraphicsitem_cast<Element *>(qgi)) { if (Element *e = qgraphicsitem_cast<Element *>(qgi)) {

View File

@@ -410,7 +410,8 @@ inline QGIManager &Diagram::qgiManager() {
@brief Diagram::drawTerminals @brief Diagram::drawTerminals
@return true if terminals are rendered, false otherwise @return true if terminals are rendered, false otherwise
*/ */
inline bool Diagram::drawTerminals() const { inline bool Diagram::drawTerminals() const
{
return(draw_terminals_); return(draw_terminals_);
} }
@@ -418,7 +419,8 @@ inline bool Diagram::drawTerminals() const {
@brief Diagram::drawColoredConductors @brief Diagram::drawColoredConductors
@return true if conductors colors are rendered, false otherwise. @return true if conductors colors are rendered, false otherwise.
*/ */
inline bool Diagram::drawColoredConductors() const { inline bool Diagram::drawColoredConductors() const
{
return(draw_colored_conductors_); return(draw_colored_conductors_);
} }

View File

@@ -64,7 +64,8 @@ PasteDiagramCommand::PasteDiagramCommand( Diagram *dia, const DiagramContent &c,
@brief PasteDiagramCommand::~PasteDiagramCommand @brief PasteDiagramCommand::~PasteDiagramCommand
Destructor Destructor
*/ */
PasteDiagramCommand::~PasteDiagramCommand() { PasteDiagramCommand::~PasteDiagramCommand()
{
diagram -> qgiManager().release(content.items(filter)); diagram -> qgiManager().release(content.items(filter));
} }
@@ -162,7 +163,8 @@ CutDiagramCommand::CutDiagramCommand(
@brief CutDiagramCommand::~CutDiagramCommand @brief CutDiagramCommand::~CutDiagramCommand
Destructeur Destructeur
*/ */
CutDiagramCommand::~CutDiagramCommand() { CutDiagramCommand::~CutDiagramCommand()
{
} }
/** /**
@@ -210,14 +212,16 @@ MoveElementsCommand::MoveElementsCommand(
@brief MoveElementsCommand::~MoveElementsCommand @brief MoveElementsCommand::~MoveElementsCommand
Destructor Destructor
*/ */
MoveElementsCommand::~MoveElementsCommand() { MoveElementsCommand::~MoveElementsCommand()
{
delete m_anim_group; delete m_anim_group;
} }
/** /**
@brief MoveElementsCommand::undo @brief MoveElementsCommand::undo
*/ */
void MoveElementsCommand::undo() { void MoveElementsCommand::undo()
{
diagram -> showMe(); diagram -> showMe();
m_anim_group->setDirection(QAnimationGroup::Forward); m_anim_group->setDirection(QAnimationGroup::Forward);
m_anim_group->start(); m_anim_group->start();
@@ -227,7 +231,8 @@ void MoveElementsCommand::undo() {
/** /**
@brief MoveElementsCommand::redo @brief MoveElementsCommand::redo
*/ */
void MoveElementsCommand::redo() { void MoveElementsCommand::redo()
{
diagram -> showMe(); diagram -> showMe();
if (first_redo) { if (first_redo) {
first_redo = false; first_redo = false;
@@ -329,14 +334,16 @@ MoveConductorsTextsCommand::MoveConductorsTextsCommand(
@brief MoveConductorsTextsCommand::~MoveConductorsTextsCommand @brief MoveConductorsTextsCommand::~MoveConductorsTextsCommand
Destructeur Destructeur
*/ */
MoveConductorsTextsCommand::~MoveConductorsTextsCommand() { MoveConductorsTextsCommand::~MoveConductorsTextsCommand()
{
} }
/** /**
@brief MoveConductorsTextsCommand::undo @brief MoveConductorsTextsCommand::undo
annule le deplacement annule le deplacement
*/ */
void MoveConductorsTextsCommand::undo() { void MoveConductorsTextsCommand::undo()
{
diagram -> showMe(); diagram -> showMe();
foreach(ConductorTextItem *cti, texts_to_move_.keys()) { foreach(ConductorTextItem *cti, texts_to_move_.keys()) {
QPointF movement = texts_to_move_[cti].first; QPointF movement = texts_to_move_[cti].first;
@@ -353,7 +360,8 @@ void MoveConductorsTextsCommand::undo() {
@brief MoveConductorsTextsCommand::redo @brief MoveConductorsTextsCommand::redo
refait le deplacement refait le deplacement
*/ */
void MoveConductorsTextsCommand::redo() { void MoveConductorsTextsCommand::redo()
{
diagram -> showMe(); diagram -> showMe();
if (first_redo) { if (first_redo) {
first_redo = false; first_redo = false;
@@ -397,7 +405,8 @@ void MoveConductorsTextsCommand::addTextMovement(ConductorTextItem *text_item,
@brief MoveConductorsTextsCommand::regenerateTextLabel @brief MoveConductorsTextsCommand::regenerateTextLabel
Genere la description de l'objet d'annulation Genere la description de l'objet d'annulation
*/ */
void MoveConductorsTextsCommand::regenerateTextLabel() { void MoveConductorsTextsCommand::regenerateTextLabel()
{
QString moved_content_sentence = QET::ElementsAndConductorsSentence(0, 0, texts_to_move_.count()); QString moved_content_sentence = QET::ElementsAndConductorsSentence(0, 0, texts_to_move_.count());
setText( setText(
@@ -437,14 +446,16 @@ ChangeDiagramTextCommand::ChangeDiagramTextCommand(
@brief ChangeDiagramTextCommand::~ChangeDiagramTextCommand @brief ChangeDiagramTextCommand::~ChangeDiagramTextCommand
destructeur destructeur
*/ */
ChangeDiagramTextCommand::~ChangeDiagramTextCommand() { ChangeDiagramTextCommand::~ChangeDiagramTextCommand()
{
} }
/** /**
@brief ChangeDiagramTextCommand::undo @brief ChangeDiagramTextCommand::undo
annule la modification de texte annule la modification de texte
*/ */
void ChangeDiagramTextCommand::undo() { void ChangeDiagramTextCommand::undo()
{
diagram -> showMe(); diagram -> showMe();
text_item -> setHtml(text_before); text_item -> setHtml(text_before);
} }
@@ -488,14 +499,16 @@ ChangeConductorCommand::ChangeConductorCommand(
@brief ChangeConductorCommand::~ChangeConductorCommand @brief ChangeConductorCommand::~ChangeConductorCommand
Destructeur Destructeur
*/ */
ChangeConductorCommand::~ChangeConductorCommand() { ChangeConductorCommand::~ChangeConductorCommand()
{
} }
/** /**
@brief ChangeConductorCommand::undo @brief ChangeConductorCommand::undo
Annule la modification du conducteur Annule la modification du conducteur
*/ */
void ChangeConductorCommand::undo() { void ChangeConductorCommand::undo()
{
diagram -> showMe(); diagram -> showMe();
conductor -> setProfile(old_profile, path_type); conductor -> setProfile(old_profile, path_type);
conductor -> textItem() -> setPos(text_pos_before_mov_); conductor -> textItem() -> setPos(text_pos_before_mov_);
@@ -505,7 +518,8 @@ void ChangeConductorCommand::undo() {
@brief ChangeConductorCommand::redo @brief ChangeConductorCommand::redo
Refait la modification du conducteur Refait la modification du conducteur
*/ */
void ChangeConductorCommand::redo() { void ChangeConductorCommand::redo()
{
diagram -> showMe(); diagram -> showMe();
if (first_redo) { if (first_redo) {
first_redo = false; first_redo = false;
@@ -551,13 +565,15 @@ ResetConductorCommand::ResetConductorCommand(
/** /**
@brief ResetConductorCommand::~ResetConductorCommand @brief ResetConductorCommand::~ResetConductorCommand
*/ */
ResetConductorCommand::~ResetConductorCommand() { ResetConductorCommand::~ResetConductorCommand()
{
} }
/** /**
@brief ResetConductorCommand::undo @brief ResetConductorCommand::undo
*/ */
void ResetConductorCommand::undo() { void ResetConductorCommand::undo()
{
diagram -> showMe(); diagram -> showMe();
foreach(Conductor *c, conductors_profiles.keys()) { foreach(Conductor *c, conductors_profiles.keys()) {
c -> setProfiles(conductors_profiles[c]); c -> setProfiles(conductors_profiles[c]);
@@ -567,7 +583,8 @@ void ResetConductorCommand::undo() {
/** /**
@brief ResetConductorCommand::redo @brief ResetConductorCommand::redo
*/ */
void ResetConductorCommand::redo() { void ResetConductorCommand::redo()
{
diagram -> showMe(); diagram -> showMe();
foreach(Conductor *c, conductors_profiles.keys()) { foreach(Conductor *c, conductors_profiles.keys()) {
c -> textItem() -> forceMovedByUser (false); c -> textItem() -> forceMovedByUser (false);
@@ -601,14 +618,16 @@ ChangeBorderCommand::ChangeBorderCommand(Diagram *dia,
@brief ChangeBorderCommand::~ChangeBorderCommand @brief ChangeBorderCommand::~ChangeBorderCommand
Destructeur Destructeur
*/ */
ChangeBorderCommand::~ChangeBorderCommand() { ChangeBorderCommand::~ChangeBorderCommand()
{
} }
/** /**
@brief ChangeBorderCommand::undo @brief ChangeBorderCommand::undo
Annule les changements apportes au schema Annule les changements apportes au schema
*/ */
void ChangeBorderCommand::undo() { void ChangeBorderCommand::undo()
{
diagram -> showMe(); diagram -> showMe();
diagram -> border_and_titleblock.importBorder(old_properties); diagram -> border_and_titleblock.importBorder(old_properties);
} }
@@ -617,7 +636,8 @@ void ChangeBorderCommand::undo() {
@brief ChangeBorderCommand::redo @brief ChangeBorderCommand::redo
Refait les changements apportes au schema Refait les changements apportes au schema
*/ */
void ChangeBorderCommand::redo() { void ChangeBorderCommand::redo()
{
diagram -> showMe(); diagram -> showMe();
diagram -> border_and_titleblock.importBorder(new_properties); diagram -> border_and_titleblock.importBorder(new_properties);
} }

View File

@@ -32,7 +32,8 @@
/** /**
@brief DiagramContent::DiagramContent @brief DiagramContent::DiagramContent
*/ */
DiagramContent::DiagramContent() {} DiagramContent::DiagramContent()
{}
/** /**
@brief DiagramContent::DiagramContent @brief DiagramContent::DiagramContent

View File

@@ -67,14 +67,16 @@ QList<QString> DiagramContext::keys(DiagramContext::KeyOrder order) const
@param key string key @param key string key
@return true if that key is known to the diagram context, false otherwise @return true if that key is known to the diagram context, false otherwise
*/ */
bool DiagramContext::contains(const QString &key) const { bool DiagramContext::contains(const QString &key) const
{
return(m_content.contains(key)); return(m_content.contains(key));
} }
/** /**
@param key @param key
*/ */
const QVariant DiagramContext::operator[](const QString &key) const { const QVariant DiagramContext::operator[](const QString &key) const
{
return(m_content[key]); return(m_content[key]);
} }
@@ -97,14 +99,16 @@ bool DiagramContext::addValue(const QString &key, const QVariant &value, bool sh
return(false); return(false);
} }
QVariant DiagramContext::value(const QString &key) const { QVariant DiagramContext::value(const QString &key) const
{
return m_content.value(key); return m_content.value(key);
} }
/** /**
Clear the content of this diagram context. Clear the content of this diagram context.
*/ */
void DiagramContext::clear() { void DiagramContext::clear()
{
m_content.clear(); m_content.clear();
m_content_show.clear(); m_content_show.clear();
} }
@@ -112,7 +116,8 @@ void DiagramContext::clear() {
/** /**
@return the number of key/value pairs stored in this object. @return the number of key/value pairs stored in this object.
*/ */
int DiagramContext::count() { int DiagramContext::count()
{
return(m_content.count()); return(m_content.count());
} }
@@ -120,18 +125,21 @@ int DiagramContext::count() {
@brief DiagramContext::keyMustShow @brief DiagramContext::keyMustShow
@return the value pairs with key, if key no found, return false @return the value pairs with key, if key no found, return false
*/ */
bool DiagramContext::keyMustShow(const QString &key) const { bool DiagramContext::keyMustShow(const QString &key) const
{
if (m_content_show.contains(key)) if (m_content_show.contains(key))
return m_content_show[key]; return m_content_show[key];
return false; return false;
} }
bool DiagramContext::operator==(const DiagramContext &dc) const { bool DiagramContext::operator==(const DiagramContext &dc) const
{
return(m_content == dc.m_content && return(m_content == dc.m_content &&
m_content_show == dc.m_content_show); m_content_show == dc.m_content_show);
} }
bool DiagramContext::operator!=(const DiagramContext &dc) const { bool DiagramContext::operator!=(const DiagramContext &dc) const
{
return(!(*this == dc)); return(!(*this == dc));
} }
@@ -139,7 +147,8 @@ bool DiagramContext::operator!=(const DiagramContext &dc) const {
Export this context properties under the \a e XML element, using tags Export this context properties under the \a e XML element, using tags
named \a tag_name (defaults to "property"). named \a tag_name (defaults to "property").
*/ */
void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const { void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const
{
foreach (QString key, keys()) { foreach (QString key, keys()) {
QDomElement property = e.ownerDocument().createElement(tag_name); QDomElement property = e.ownerDocument().createElement(tag_name);
property.setAttribute("name", key); property.setAttribute("name", key);
@@ -182,7 +191,8 @@ void DiagramContext::fromXml(const pugi::xml_node &dom_element, const QString &t
Export this context properties to \a settings by creating an array named \a Export this context properties to \a settings by creating an array named \a
array_name. array_name.
*/ */
void DiagramContext::toSettings(QSettings &settings, const QString &array_name) const { void DiagramContext::toSettings(QSettings &settings, const QString &array_name) const
{
settings.beginWriteArray(array_name); settings.beginWriteArray(array_name);
int i = 0; int i = 0;
foreach (QString key, m_content.keys()) { foreach (QString key, m_content.keys()) {
@@ -213,7 +223,8 @@ void DiagramContext::fromSettings(QSettings &settings, const QString &array_name
@return the regular expression used to check whether a given key is acceptable. @return the regular expression used to check whether a given key is acceptable.
@see keyIsAcceptable() @see keyIsAcceptable()
*/ */
QString DiagramContext::validKeyRegExp() { QString DiagramContext::validKeyRegExp()
{
return("^[a-z0-9-_]+$"); return("^[a-z0-9-_]+$");
} }
@@ -228,7 +239,8 @@ bool DiagramContext::stringLongerThan(const QString &a, const QString &b) {
@param key a key string @param key a key string
@return true if that key is acceptable, false otherwise @return true if that key is acceptable, false otherwise
*/ */
bool DiagramContext::keyIsAcceptable(const QString &key) const { bool DiagramContext::keyIsAcceptable(const QString &key) const
{
QRegExp re(DiagramContext::validKeyRegExp()); QRegExp re(DiagramContext::validKeyRegExp());
return(re.exactMatch(key)); return(re.exactMatch(key));
} }

View File

@@ -29,7 +29,8 @@ DiagramEventInterface::DiagramEventInterface(Diagram *diagram) :
m_diagram -> clearSelection(); m_diagram -> clearSelection();
} }
DiagramEventInterface::~DiagramEventInterface() {}; DiagramEventInterface::~DiagramEventInterface()
{};
void DiagramEventInterface::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { void DiagramEventInterface::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
Q_UNUSED (event); Q_UNUSED (event);
@@ -71,7 +72,8 @@ void DiagramEventInterface::keyReleaseEvent(QKeyEvent *event){
Q_UNUSED (event); Q_UNUSED (event);
} }
bool DiagramEventInterface::isRunning() const { bool DiagramEventInterface::isRunning() const
{
return m_running; return m_running;
} }

View File

@@ -36,13 +36,15 @@ DiagramPosition::DiagramPosition(const QString &letter, unsigned int number) {
/** /**
Destructeur Destructeur
*/ */
DiagramPosition::~DiagramPosition() { DiagramPosition::~DiagramPosition()
{
} }
/** /**
@return les coordonnees stockees dans cet objet, ou un QPointF nul sinon. @return les coordonnees stockees dans cet objet, ou un QPointF nul sinon.
*/ */
QPointF DiagramPosition::position() const { QPointF DiagramPosition::position() const
{
return(position_); return(position_);
} }
@@ -56,7 +58,8 @@ void DiagramPosition::setPosition(const QPointF &position) {
/** /**
@return une representation textuelle de la position @return une representation textuelle de la position
*/ */
QString DiagramPosition::toString() { QString DiagramPosition::toString()
{
if (isOutOfBounds()) { if (isOutOfBounds()) {
return("-"); return("-");
} }
@@ -72,6 +75,7 @@ QString DiagramPosition::toString() {
/** /**
@return true si l'element est en dehors des bords du schema @return true si l'element est en dehors des bords du schema
*/ */
bool DiagramPosition::isOutOfBounds() const { bool DiagramPosition::isOutOfBounds() const
{
return(letter_.isEmpty() || !number_); return(letter_.isEmpty() || !number_);
} }

View File

@@ -48,7 +48,8 @@ DiagramPrintDialog::DiagramPrintDialog(QETProject *project, QWidget *parent) :
/** /**
Destructeur Destructeur
*/ */
DiagramPrintDialog::~DiagramPrintDialog() { DiagramPrintDialog::~DiagramPrintDialog()
{
delete dialog_; delete dialog_;
delete printer_; delete printer_;
Diagram::background_color = backup_diagram_background_color; Diagram::background_color = backup_diagram_background_color;
@@ -64,7 +65,8 @@ void DiagramPrintDialog::setFileName(const QString &name) {
/** /**
@return le nom du PDF @return le nom du PDF
*/ */
QString DiagramPrintDialog::fileName() const { QString DiagramPrintDialog::fileName() const
{
return(file_name_); return(file_name_);
} }
@@ -78,7 +80,8 @@ void DiagramPrintDialog::setDocName(const QString &name) {
/** /**
@return le nom du document @return le nom du document
*/ */
QString DiagramPrintDialog::docName() const { QString DiagramPrintDialog::docName() const
{
return(doc_name_); return(doc_name_);
} }
@@ -89,7 +92,8 @@ QString DiagramPrintDialog::docName() const {
@return the rectangle to be printed @return the rectangle to be printed
*/ */
QRect DiagramPrintDialog::diagramRect(Diagram *diagram, QRect DiagramPrintDialog::diagramRect(Diagram *diagram,
const ExportProperties &options) const { const ExportProperties &options) const
{
if (!diagram) return(QRect()); if (!diagram) return(QRect());
QRectF diagram_rect = diagram -> border_and_titleblock.borderAndTitleBlockRect(); QRectF diagram_rect = diagram -> border_and_titleblock.borderAndTitleBlockRect();
@@ -107,7 +111,8 @@ QRect DiagramPrintDialog::diagramRect(Diagram *diagram,
/** /**
Execute le dialogue d'impression Execute le dialogue d'impression
*/ */
void DiagramPrintDialog::exec() { void DiagramPrintDialog::exec()
{
// prise en compte du nom du document // prise en compte du nom du document
if (!doc_name_.isEmpty()) printer_ -> setDocName(doc_name_); if (!doc_name_.isEmpty()) printer_ -> setDocName(doc_name_);
@@ -172,7 +177,8 @@ void DiagramPrintDialog::exec() {
@return Le nombre de pages necessaires pour imprimer le schema @return Le nombre de pages necessaires pour imprimer le schema
avec l'orientation et le format papier utilise dans l'imprimante en cours. avec l'orientation et le format papier utilise dans l'imprimante en cours.
*/ */
int DiagramPrintDialog::pagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const { int DiagramPrintDialog::pagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const
{
return(horizontalPagesCount(diagram, options, fullpage) * verticalPagesCount(diagram, options, fullpage)); return(horizontalPagesCount(diagram, options, fullpage) * verticalPagesCount(diagram, options, fullpage));
} }
@@ -183,7 +189,8 @@ int DiagramPrintDialog::pagesCount(Diagram *diagram, const ExportProperties &opt
@return La largeur du "poster" en nombre de pages pour imprimer le schema @return La largeur du "poster" en nombre de pages pour imprimer le schema
avec l'orientation et le format papier utilise dans l'imprimante en cours. avec l'orientation et le format papier utilise dans l'imprimante en cours.
*/ */
int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const { int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const
{
// note : pageRect et Paper Rect tiennent compte de l'orientation du papier // note : pageRect et Paper Rect tiennent compte de l'orientation du papier
QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect(); QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect();
QRect diagram_rect = diagramRect(diagram, options); QRect diagram_rect = diagramRect(diagram, options);
@@ -199,7 +206,8 @@ int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportPrope
@return La largeur du "poster" en nombre de pages pour imprimer le schema @return La largeur du "poster" en nombre de pages pour imprimer le schema
avec l'orientation et le format papier utilise dans l'imprimante en cours. avec l'orientation et le format papier utilise dans l'imprimante en cours.
*/ */
int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const { int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const
{
// note : pageRect et Paper Rect tiennent compte de l'orientation du papier // note : pageRect et Paper Rect tiennent compte de l'orientation du papier
QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect(); QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect();
QRect diagram_rect = diagramRect(diagram, options); QRect diagram_rect = diagramRect(diagram, options);
@@ -212,7 +220,8 @@ int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportPropert
Construit un dialogue non standard pour demander a l'utilisateur quelle type Construit un dialogue non standard pour demander a l'utilisateur quelle type
d'impression il souhaite effectuer : PDF, PS ou imprimante physique d'impression il souhaite effectuer : PDF, PS ou imprimante physique
*/ */
void DiagramPrintDialog::buildPrintTypeDialog() { void DiagramPrintDialog::buildPrintTypeDialog()
{
// initialisation des widgets // initialisation des widgets
dialog_ = new QDialog(parentWidget()); dialog_ = new QDialog(parentWidget());
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
@@ -273,7 +282,8 @@ void DiagramPrintDialog::buildPrintTypeDialog() {
/** /**
Assure la coherence du dialogue permettant le choix du type d'impression Assure la coherence du dialogue permettant le choix du type d'impression
*/ */
void DiagramPrintDialog::updatePrintTypeDialog() { void DiagramPrintDialog::updatePrintTypeDialog()
{
// imprime-t-on vers un fichier ? // imprime-t-on vers un fichier ?
bool file_print = !(printer_choice_ -> isChecked()); bool file_print = !(printer_choice_ -> isChecked());
@@ -301,7 +311,8 @@ void DiagramPrintDialog::updatePrintTypeDialog() {
Verifie l'etat du dialogue permettant le choix du type d'impression lorsque Verifie l'etat du dialogue permettant le choix du type d'impression lorsque
l'utilisateur le valide. l'utilisateur le valide.
*/ */
void DiagramPrintDialog::acceptPrintTypeDialog() { void DiagramPrintDialog::acceptPrintTypeDialog()
{
bool file_print = !(printer_choice_ -> isChecked()); bool file_print = !(printer_choice_ -> isChecked());
if (file_print) { if (file_print) {
// un fichier doit avoir ete entre // un fichier doit avoir ete entre
@@ -322,7 +333,8 @@ void DiagramPrintDialog::acceptPrintTypeDialog() {
/** /**
Permet a l'utilisateur de choisir un fichier Permet a l'utilisateur de choisir un fichier
*/ */
void DiagramPrintDialog::browseFilePrintTypeDialog() { void DiagramPrintDialog::browseFilePrintTypeDialog()
{
QString extension; QString extension;
QString filter; QString filter;
if (printer_choice_ -> isChecked()) return; if (printer_choice_ -> isChecked()) return;

View File

@@ -47,20 +47,23 @@ DiagramsChooser::DiagramsChooser(QETProject *project, QWidget *parent) :
/** /**
Destructeur Destructeur
*/ */
DiagramsChooser::~DiagramsChooser() { DiagramsChooser::~DiagramsChooser()
{
} }
/** /**
@return le projet dont ce widget affiche les schemas @return le projet dont ce widget affiche les schemas
*/ */
QETProject *DiagramsChooser::project() const { QETProject *DiagramsChooser::project() const
{
return(project_); return(project_);
} }
/** /**
@return la liste des schemas selectionnes @return la liste des schemas selectionnes
*/ */
QList<Diagram *> DiagramsChooser::selectedDiagrams() const { QList<Diagram *> DiagramsChooser::selectedDiagrams() const
{
QList<Diagram *> selected_diagrams; QList<Diagram *> selected_diagrams;
foreach(Diagram *diagram, project_ -> diagrams()) { foreach(Diagram *diagram, project_ -> diagrams()) {
QCheckBox *check_box = diagrams_[diagram]; QCheckBox *check_box = diagrams_[diagram];
@@ -74,7 +77,8 @@ QList<Diagram *> DiagramsChooser::selectedDiagrams() const {
/** /**
@return la liste des schemas qui ne sont pas selectionnes @return la liste des schemas qui ne sont pas selectionnes
*/ */
QList<Diagram *> DiagramsChooser::nonSelectedDiagrams() const { QList<Diagram *> DiagramsChooser::nonSelectedDiagrams() const
{
QList<Diagram *> selected_diagrams; QList<Diagram *> selected_diagrams;
foreach(Diagram *diagram, diagrams_.keys()) { foreach(Diagram *diagram, diagrams_.keys()) {
if (!(diagrams_[diagram] -> isChecked())) { if (!(diagrams_[diagram] -> isChecked())) {
@@ -87,7 +91,8 @@ QList<Diagram *> DiagramsChooser::nonSelectedDiagrams() const {
/** /**
@param diagram Un schema cense etre present dans ce widget @param diagram Un schema cense etre present dans ce widget
*/ */
bool DiagramsChooser::diagramIsSelected(Diagram *const diagram) const { bool DiagramsChooser::diagramIsSelected(Diagram *const diagram) const
{
QCheckBox *checkbox = diagrams_.value(diagram); QCheckBox *checkbox = diagrams_.value(diagram);
if (!checkbox) return(false); if (!checkbox) return(false);
return(checkbox -> isChecked()); return(checkbox -> isChecked());
@@ -146,7 +151,8 @@ void DiagramsChooser::setSelectedAllDiagrams(bool select) {
/** /**
Met a jour la liste des schemas du projet Met a jour la liste des schemas du projet
*/ */
void DiagramsChooser::updateList() { void DiagramsChooser::updateList()
{
if (!project_) return; if (!project_) return;
// retient la liste des schemas deja selectionnes // retient la liste des schemas deja selectionnes
@@ -176,7 +182,8 @@ void DiagramsChooser::updateList() {
/** /**
Met en place la disposition du widget Met en place la disposition du widget
*/ */
void DiagramsChooser::buildLayout() { void DiagramsChooser::buildLayout()
{
if (vlayout0_) return; if (vlayout0_) return;
vlayout0_ = new QVBoxLayout(); vlayout0_ = new QVBoxLayout();
widget0_ = new QWidget(); widget0_ = new QWidget();

View File

@@ -113,27 +113,31 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
/** /**
Destructeur Destructeur
*/ */
DiagramView::~DiagramView() { DiagramView::~DiagramView()
{
} }
/** /**
Selectionne tous les objets du schema Selectionne tous les objets du schema
*/ */
void DiagramView::selectAll() { void DiagramView::selectAll()
{
m_diagram -> selectAll(); m_diagram -> selectAll();
} }
/** /**
Deslectionne tous les objets selectionnes Deslectionne tous les objets selectionnes
*/ */
void DiagramView::selectNothing() { void DiagramView::selectNothing()
{
m_diagram -> deselectAll(); m_diagram -> deselectAll();
} }
/** /**
Inverse l'etat de selection de tous les objets du schema Inverse l'etat de selection de tous les objets du schema
*/ */
void DiagramView::selectInvert() { void DiagramView::selectInvert()
{
m_diagram -> invertSelection(); m_diagram -> invertSelection();
} }
@@ -267,7 +271,8 @@ void DiagramView::handleTextDrop(QDropEvent *e) {
/** /**
Set the Diagram in visualisation mode Set the Diagram in visualisation mode
*/ */
void DiagramView::setVisualisationMode() { void DiagramView::setVisualisationMode()
{
setDragMode(ScrollHandDrag); setDragMode(ScrollHandDrag);
applyReadOnly(); applyReadOnly();
setInteractive(false); setInteractive(false);
@@ -277,7 +282,8 @@ void DiagramView::setVisualisationMode() {
/** /**
Set the Diagram in Selection mode Set the Diagram in Selection mode
*/ */
void DiagramView::setSelectionMode() { void DiagramView::setSelectionMode()
{
setDragMode(RubberBandDrag); setDragMode(RubberBandDrag);
setInteractive(true); setInteractive(true);
applyReadOnly(); applyReadOnly();
@@ -315,7 +321,8 @@ void DiagramView::zoom(const qreal zoom_factor)
schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema, schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema,
le zoom est reinitialise le zoom est reinitialise
*/ */
void DiagramView::zoomFit() { void DiagramView::zoomFit()
{
adjustSceneRect(); adjustSceneRect();
fitInView(m_diagram->sceneRect(), Qt::KeepAspectRatio); fitInView(m_diagram->sceneRect(), Qt::KeepAspectRatio);
adjustGridToZoom(); adjustGridToZoom();
@@ -324,7 +331,8 @@ void DiagramView::zoomFit() {
/** /**
Adjust zoom to fit all elements in the view, regardless of diagram borders. Adjust zoom to fit all elements in the view, regardless of diagram borders.
*/ */
void DiagramView::zoomContent() { void DiagramView::zoomContent()
{
fitInView(m_diagram -> itemsBoundingRect(), Qt::KeepAspectRatio); fitInView(m_diagram -> itemsBoundingRect(), Qt::KeepAspectRatio);
adjustGridToZoom(); adjustGridToZoom();
} }
@@ -332,7 +340,8 @@ void DiagramView::zoomContent() {
/** /**
Reinitialise le zoom Reinitialise le zoom
*/ */
void DiagramView::zoomReset() { void DiagramView::zoomReset()
{
resetTransform(); resetTransform();
adjustGridToZoom(); adjustGridToZoom();
} }
@@ -340,7 +349,8 @@ void DiagramView::zoomReset() {
/** /**
Copie les elements selectionnes du schema dans le presse-papier puis les supprime Copie les elements selectionnes du schema dans le presse-papier puis les supprime
*/ */
void DiagramView::cut() { void DiagramView::cut()
{
copy(); copy();
DiagramContent cut_content(m_diagram); DiagramContent cut_content(m_diagram);
m_diagram -> clearSelection(); m_diagram -> clearSelection();
@@ -350,7 +360,8 @@ void DiagramView::cut() {
/** /**
Copie les elements selectionnes du schema dans le presse-papier Copie les elements selectionnes du schema dans le presse-papier
*/ */
void DiagramView::copy() { void DiagramView::copy()
{
QClipboard *presse_papier = QApplication::clipboard(); QClipboard *presse_papier = QApplication::clipboard();
QString contenu_presse_papier = m_diagram -> toXml(false).toString(4); QString contenu_presse_papier = m_diagram -> toXml(false).toString(4);
if (presse_papier -> supportsSelection()) presse_papier -> setText(contenu_presse_papier, QClipboard::Selection); if (presse_papier -> supportsSelection()) presse_papier -> setText(contenu_presse_papier, QClipboard::Selection);
@@ -387,7 +398,8 @@ void DiagramView::paste(const QPointF &pos, QClipboard::Mode clipboard_mode) {
/** /**
Colle le contenu du presse-papier sur le schema a la position de la souris Colle le contenu du presse-papier sur le schema a la position de la souris
*/ */
void DiagramView::pasteHere() { void DiagramView::pasteHere()
{
paste(mapToScene(m_paste_here_pos)); paste(mapToScene(m_paste_here_pos));
} }
@@ -811,7 +823,8 @@ void DiagramView::scrollOnMovement(QKeyEvent *e)
la mention "Schema sans titre" est utilisee la mention "Schema sans titre" est utilisee
@see Diagram::title() @see Diagram::title()
*/ */
QString DiagramView::title() const { QString DiagramView::title() const
{
QString view_title; QString view_title;
QString diagram_title(m_diagram -> title()); QString diagram_title(m_diagram -> title());
if (diagram_title.isEmpty()) { if (diagram_title.isEmpty()) {
@@ -826,7 +839,8 @@ QString DiagramView::title() const {
@brief DiagramView::editDiagramProperties @brief DiagramView::editDiagramProperties
Edit the properties of the viewed digram Edit the properties of the viewed digram
*/ */
void DiagramView::editDiagramProperties() { void DiagramView::editDiagramProperties()
{
DiagramPropertiesDialog::diagramPropertiesDialog(m_diagram, diagramEditor()); DiagramPropertiesDialog::diagramPropertiesDialog(m_diagram, diagramEditor());
} }
@@ -854,14 +868,16 @@ void DiagramView::adjustSceneRect()
/** /**
Met a jour le titre du widget Met a jour le titre du widget
*/ */
void DiagramView::updateWindowTitle() { void DiagramView::updateWindowTitle()
{
emit(titleChanged(this, title())); emit(titleChanged(this, title()));
} }
/** /**
Enables or disables the drawing grid according to the amount of pixels display Enables or disables the drawing grid according to the amount of pixels display
*/ */
void DiagramView::adjustGridToZoom() { void DiagramView::adjustGridToZoom()
{
QRectF viewed_scene = viewedSceneRect(); QRectF viewed_scene = viewedSceneRect();
if (diagramEditor()->drawGrid()) if (diagramEditor()->drawGrid())
m_diagram->setDisplayGrid(viewed_scene.width() < 2000 || viewed_scene.height() < 2000); m_diagram->setDisplayGrid(viewed_scene.width() < 2000 || viewed_scene.height() < 2000);
@@ -872,7 +888,8 @@ void DiagramView::adjustGridToZoom() {
/** /**
@return le rectangle du schema (classe Diagram) visualise par ce DiagramView @return le rectangle du schema (classe Diagram) visualise par ce DiagramView
*/ */
QRectF DiagramView::viewedSceneRect() const { QRectF DiagramView::viewedSceneRect() const
{
// recupere la taille du widget viewport // recupere la taille du widget viewport
QSize viewport_size = viewport() -> size(); QSize viewport_size = viewport() -> size();
@@ -893,7 +910,8 @@ QRectF DiagramView::viewedSceneRect() const {
parent project before being applied to the current diagram, or false if it parent project before being applied to the current diagram, or false if it
can be directly applied can be directly applied
*/ */
bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocation &tbt_loc) const { bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocation &tbt_loc) const
{
// unlike elements, the integration of title block templates is mandatory, so we simply check whether the parent project of the template is also the parent project of the diagram // unlike elements, the integration of title block templates is mandatory, so we simply check whether the parent project of the template is also the parent project of the diagram
QETProject *tbt_parent_project = tbt_loc.parentProject(); QETProject *tbt_parent_project = tbt_loc.parentProject();
if (!tbt_parent_project) return(true); if (!tbt_parent_project) return(true);
@@ -905,7 +923,8 @@ bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocati
Fait en sorte que le schema ne soit editable que s'il n'est pas en lecture Fait en sorte que le schema ne soit editable que s'il n'est pas en lecture
seule seule
*/ */
void DiagramView::applyReadOnly() { void DiagramView::applyReadOnly()
{
if (!m_diagram) return; if (!m_diagram) return;
bool is_writable = !m_diagram -> isReadOnly(); bool is_writable = !m_diagram -> isReadOnly();
@@ -970,7 +989,8 @@ void DiagramView::editConductorColor(Conductor *edited_conductor)
/** /**
Reinitialise le profil des conducteurs selectionnes Reinitialise le profil des conducteurs selectionnes
*/ */
void DiagramView::resetConductors() { void DiagramView::resetConductors()
{
if (m_diagram -> isReadOnly()) return; if (m_diagram -> isReadOnly()) return;
// recupere les conducteurs selectionnes // recupere les conducteurs selectionnes
QSet<Conductor *> selected_conductors = m_diagram -> selectedConductors(); QSet<Conductor *> selected_conductors = m_diagram -> selectedConductors();
@@ -1103,7 +1123,8 @@ bool DiagramView::isCtrlShifting(QInputEvent *e) {
/** /**
@return true if there is a selected item and that item has the focus. @return true if there is a selected item and that item has the focus.
*/ */
bool DiagramView::selectedItemHasFocus() { bool DiagramView::selectedItemHasFocus()
{
return( return(
m_diagram -> hasFocus() && m_diagram -> hasFocus() &&
m_diagram -> focusItem() && m_diagram -> focusItem() &&
@@ -1115,7 +1136,8 @@ bool DiagramView::selectedItemHasFocus() {
@brief DiagramView::editSelection @brief DiagramView::editSelection
Edit the selected item if he can be edited and if only one item is selected Edit the selected item if he can be edited and if only one item is selected
*/ */
void DiagramView::editSelection() { void DiagramView::editSelection()
{
if (m_diagram -> isReadOnly() || m_diagram -> selectedItems().size() != 1 ) return; if (m_diagram -> isReadOnly() || m_diagram -> selectedItems().size() != 1 ) return;
QGraphicsItem *item = m_diagram->selectedItems().first(); QGraphicsItem *item = m_diagram->selectedItems().first();
@@ -1225,7 +1247,8 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e)
/** /**
@return l'editeur de schemas parent ou 0 @return l'editeur de schemas parent ou 0
*/ */
QETDiagramEditor *DiagramView::diagramEditor() const { QETDiagramEditor *DiagramView::diagramEditor() const
{
// remonte la hierarchie des widgets // remonte la hierarchie des widgets
QWidget *w = const_cast<DiagramView *>(this); QWidget *w = const_cast<DiagramView *>(this);
while (w -> parentWidget() && !w -> isWindow()) { while (w -> parentWidget() && !w -> isWindow()) {

View File

@@ -28,7 +28,8 @@ DVEventInterface::DVEventInterface(DiagramView *dv) :
{ {
} }
DVEventInterface::~DVEventInterface() { DVEventInterface::~DVEventInterface()
{
} }
bool DVEventInterface::mouseDoubleClickEvent(QMouseEvent *event) { bool DVEventInterface::mouseDoubleClickEvent(QMouseEvent *event) {
@@ -80,10 +81,12 @@ bool DVEventInterface::KeyReleaseEvent(QKeyEvent *event) {
return false; return false;
} }
bool DVEventInterface::isRunning() const { bool DVEventInterface::isRunning() const
{
return m_running; return m_running;
} }
bool DVEventInterface::isFinish() const { bool DVEventInterface::isFinish() const
{
return !m_running; return !m_running;
} }

View File

@@ -75,7 +75,8 @@ ArcEditor::ArcEditor(QETElementEditor *editor, PartArc *arc, QWidget *parent) :
} }
/// Destructeur /// Destructeur
ArcEditor::~ArcEditor() {} ArcEditor::~ArcEditor()
{}
void ArcEditor::setUpChangeConnections() void ArcEditor::setUpChangeConnections()
{ {
@@ -140,11 +141,13 @@ bool ArcEditor::setParts(QList <CustomElementPart *> parts)
@brief ArcEditor::currentPart @brief ArcEditor::currentPart
@return the curent edited part, or 0 if there is no edited part @return the curent edited part, or 0 if there is no edited part
*/ */
CustomElementPart *ArcEditor::currentPart() const { CustomElementPart *ArcEditor::currentPart() const
{
return(part); return(part);
} }
QList<CustomElementPart*> ArcEditor::currentParts() const { QList<CustomElementPart*> ArcEditor::currentParts() const
{
return style_->currentParts(); return style_->currentParts();
} }

View File

@@ -56,13 +56,15 @@ ElementEditionCommand::ElementEditionCommand(const QString &text,
/** /**
Destructor Destructor
*/ */
ElementEditionCommand::~ElementEditionCommand() { ElementEditionCommand::~ElementEditionCommand()
{
} }
/** /**
@return the element editor/scene the command should take place on @return the element editor/scene the command should take place on
*/ */
ElementScene *ElementEditionCommand::elementScene() const { ElementScene *ElementEditionCommand::elementScene() const
{
return(m_scene); return(m_scene);
} }
@@ -76,7 +78,8 @@ void ElementEditionCommand::setElementScene(ElementScene *scene) {
/** /**
@return the view the effect of the command should be rendered on @return the view the effect of the command should be rendered on
*/ */
ElementView *ElementEditionCommand::elementView() const { ElementView *ElementEditionCommand::elementView() const
{
return(m_view); return(m_view);
} }
@@ -108,14 +111,16 @@ DeletePartsCommand::DeletePartsCommand(
} }
/// Destructeur : detruit egalement les parties supprimees /// Destructeur : detruit egalement les parties supprimees
DeletePartsCommand::~DeletePartsCommand() { DeletePartsCommand::~DeletePartsCommand()
{
foreach(QGraphicsItem *qgi, deleted_parts) { foreach(QGraphicsItem *qgi, deleted_parts) {
m_scene -> qgiManager().release(qgi); m_scene -> qgiManager().release(qgi);
} }
} }
/// Restaure les parties supprimees /// Restaure les parties supprimees
void DeletePartsCommand::undo() { void DeletePartsCommand::undo()
{
m_scene -> blockSignals(true); m_scene -> blockSignals(true);
foreach(QGraphicsItem *qgi, deleted_parts) { foreach(QGraphicsItem *qgi, deleted_parts) {
m_scene -> addItem(qgi); m_scene -> addItem(qgi);
@@ -124,7 +129,8 @@ void DeletePartsCommand::undo() {
} }
/// Supprime les parties /// Supprime les parties
void DeletePartsCommand::redo() { void DeletePartsCommand::redo()
{
m_scene -> blockSignals(true); m_scene -> blockSignals(true);
foreach(QGraphicsItem *qgi, deleted_parts) { foreach(QGraphicsItem *qgi, deleted_parts) {
m_scene -> removeItem(qgi); m_scene -> removeItem(qgi);
@@ -150,7 +156,8 @@ CutPartsCommand::CutPartsCommand(
} }
/// Destructeur /// Destructeur
CutPartsCommand::~CutPartsCommand() { CutPartsCommand::~CutPartsCommand()
{
} }
/*** MovePartsCommand ***/ /*** MovePartsCommand ***/
@@ -175,16 +182,19 @@ MovePartsCommand::MovePartsCommand(
} }
/// Destructeur /// Destructeur
MovePartsCommand::~MovePartsCommand() { MovePartsCommand::~MovePartsCommand()
{
} }
/// Annule le deplacement /// Annule le deplacement
void MovePartsCommand::undo() { void MovePartsCommand::undo()
{
foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(-movement.x(), -movement.y()); foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(-movement.x(), -movement.y());
} }
/// Refait le deplacement /// Refait le deplacement
void MovePartsCommand::redo() { void MovePartsCommand::redo()
{
// le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire // le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire
if (first_redo) { if (first_redo) {
first_redo = false; first_redo = false;
@@ -215,17 +225,20 @@ AddPartCommand::AddPartCommand(
} }
/// Destructeur /// Destructeur
AddPartCommand::~AddPartCommand() { AddPartCommand::~AddPartCommand()
{
m_scene -> qgiManager().release(part); m_scene -> qgiManager().release(part);
} }
/// Annule l'ajout /// Annule l'ajout
void AddPartCommand::undo() { void AddPartCommand::undo()
{
m_scene -> removeItem(part); m_scene -> removeItem(part);
} }
/// Refait l'ajout /// Refait l'ajout
void AddPartCommand::redo() { void AddPartCommand::redo()
{
// le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire // le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire
if (first_redo) { if (first_redo) {
if (!part -> zValue()) { if (!part -> zValue()) {
@@ -262,16 +275,19 @@ ChangeNamesCommand::ChangeNamesCommand(
} }
/// Destructeur /// Destructeur
ChangeNamesCommand::~ChangeNamesCommand() { ChangeNamesCommand::~ChangeNamesCommand()
{
} }
/// Annule le changement /// Annule le changement
void ChangeNamesCommand::undo() { void ChangeNamesCommand::undo()
{
m_scene -> setNames(names_before); m_scene -> setNames(names_before);
} }
/// Refait le changement /// Refait le changement
void ChangeNamesCommand::redo() { void ChangeNamesCommand::redo()
{
m_scene -> setNames(names_after); m_scene -> setNames(names_after);
} }
@@ -312,16 +328,19 @@ ChangeZValueCommand::ChangeZValueCommand(
} }
/// Destructeur /// Destructeur
ChangeZValueCommand::~ChangeZValueCommand() { ChangeZValueCommand::~ChangeZValueCommand()
{
} }
/// Annule les changements de zValue /// Annule les changements de zValue
void ChangeZValueCommand::undo() { void ChangeZValueCommand::undo()
{
foreach(QGraphicsItem *qgi, undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]); foreach(QGraphicsItem *qgi, undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]);
} }
/// Refait les changements de zValue /// Refait les changements de zValue
void ChangeZValueCommand::redo() { void ChangeZValueCommand::redo()
{
foreach(QGraphicsItem *qgi, redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]); foreach(QGraphicsItem *qgi, redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]);
} }
@@ -423,16 +442,19 @@ ChangeInformationsCommand::ChangeInformationsCommand(ElementScene *elmt, const Q
} }
/// Destructeur /// Destructeur
ChangeInformationsCommand::~ChangeInformationsCommand() { ChangeInformationsCommand::~ChangeInformationsCommand()
{
} }
/// Annule le changement d'autorisation pour les connexions internes /// Annule le changement d'autorisation pour les connexions internes
void ChangeInformationsCommand::undo() { void ChangeInformationsCommand::undo()
{
m_scene -> setInformations(old_informations_); m_scene -> setInformations(old_informations_);
} }
/// Refait le changement d'autorisation pour les connexions internes /// Refait le changement d'autorisation pour les connexions internes
void ChangeInformationsCommand::redo() { void ChangeInformationsCommand::redo()
{
m_scene -> setInformations(new_informations_); m_scene -> setInformations(new_informations_);
} }
@@ -449,20 +471,23 @@ ScalePartsCommand::ScalePartsCommand(ElementScene *scene, QUndoCommand * parent)
/** /**
Destructor Destructor
*/ */
ScalePartsCommand::~ScalePartsCommand() { ScalePartsCommand::~ScalePartsCommand()
{
} }
/** /**
Undo the scaling operation Undo the scaling operation
*/ */
void ScalePartsCommand::undo() { void ScalePartsCommand::undo()
{
scale(new_rect_, original_rect_); scale(new_rect_, original_rect_);
} }
/** /**
Redo the scaling operation Redo the scaling operation
*/ */
void ScalePartsCommand::redo() { void ScalePartsCommand::redo()
{
if (first_redo) { if (first_redo) {
first_redo = false; first_redo = false;
return; return;
@@ -473,7 +498,8 @@ void ScalePartsCommand::redo() {
/** /**
@return the element editor/scene the command should take place on @return the element editor/scene the command should take place on
*/ */
ElementScene *ScalePartsCommand::elementScene() const { ElementScene *ScalePartsCommand::elementScene() const
{
return(m_scene); return(m_scene);
} }
@@ -488,7 +514,8 @@ void ScalePartsCommand::setScaledPrimitives(const QList<CustomElementPart *> &pr
/** /**
@return the list of primitives to be scaled by this command @return the list of primitives to be scaled by this command
*/ */
QList<CustomElementPart *> ScalePartsCommand::scaledPrimitives() const { QList<CustomElementPart *> ScalePartsCommand::scaledPrimitives() const
{
return(scaled_primitives_); return(scaled_primitives_);
} }
@@ -511,7 +538,8 @@ void ScalePartsCommand::setTransformation(const QRectF &original_rect,
are the bounding rectangles for all scaled primitives respectively before are the bounding rectangles for all scaled primitives respectively before
and after the operation. and after the operation.
*/ */
QPair<QRectF, QRectF> ScalePartsCommand::transformation() { QPair<QRectF, QRectF> ScalePartsCommand::transformation()
{
return(QPair<QRectF, QRectF>(original_rect_, new_rect_)); return(QPair<QRectF, QRectF>(original_rect_, new_rect_));
} }
@@ -532,7 +560,8 @@ void ScalePartsCommand::scale(const QRectF &before, const QRectF &after) {
/** /**
Generate the text describing what this command does exactly. Generate the text describing what this command does exactly.
*/ */
void ScalePartsCommand::adjustText() { void ScalePartsCommand::adjustText()
{
if (scaled_primitives_.count() == 1) { if (scaled_primitives_.count() == 1) {
setText(QObject::tr("redimensionnement %1", "undo caption -- %1 is the resized primitive type name").arg(scaled_primitives_.first() -> name())); setText(QObject::tr("redimensionnement %1", "undo caption -- %1 is the resized primitive type name").arg(scaled_primitives_.first() -> name()));
} else { } else {
@@ -562,7 +591,8 @@ ChangePropertiesCommand::ChangePropertiesCommand(
setText(QObject::tr("Modifier les propriétés")); setText(QObject::tr("Modifier les propriétés"));
} }
ChangePropertiesCommand::~ChangePropertiesCommand() {} ChangePropertiesCommand::~ChangePropertiesCommand()
{}
void ChangePropertiesCommand::undo() void ChangePropertiesCommand::undo()
{ {

View File

@@ -31,22 +31,26 @@ ElementItemEditor::ElementItemEditor(QETElementEditor *editor, QWidget *parent)
} }
/// @return le QETElementEditor auquel cet editeur appartient /// @return le QETElementEditor auquel cet editeur appartient
QETElementEditor *ElementItemEditor::elementEditor() const { QETElementEditor *ElementItemEditor::elementEditor() const
{
return(element_editor); return(element_editor);
} }
/// @return l'ElementScene contenant les parties editees par cet editeur /// @return l'ElementScene contenant les parties editees par cet editeur
ElementScene *ElementItemEditor::elementScene() const { ElementScene *ElementItemEditor::elementScene() const
{
return(element_editor -> elementScene()); return(element_editor -> elementScene());
} }
/// @return la QUndoStack a utiliser pour les annulations /// @return la QUndoStack a utiliser pour les annulations
QUndoStack &ElementItemEditor::undoStack() const { QUndoStack &ElementItemEditor::undoStack() const
{
return(elementScene() -> undoStack()); return(elementScene() -> undoStack());
} }
/// @return Le nom du type d'element edite /// @return Le nom du type d'element edite
QString ElementItemEditor::elementTypeName() const { QString ElementItemEditor::elementTypeName() const
{
return(element_type_name); return(element_type_name);
} }
@@ -60,6 +64,7 @@ void ElementItemEditor::setElementTypeName(const QString &name) {
Equivaut a setPart(0) Equivaut a setPart(0)
@see setPart @see setPart
*/ */
void ElementItemEditor::detach() { void ElementItemEditor::detach()
{
setPart(nullptr); setPart(nullptr);
} }

View File

@@ -48,7 +48,8 @@ ElementPrimitiveDecorator::~ElementPrimitiveDecorator()
@return the internal bouding rect, i.e. the smallest rectangle containing @return the internal bouding rect, i.e. the smallest rectangle containing
the bounding rectangle of every selected item. the bounding rectangle of every selected item.
*/ */
QRectF ElementPrimitiveDecorator::internalBoundingRect() const { QRectF ElementPrimitiveDecorator::internalBoundingRect() const
{
if (!decorated_items_.count() || !scene()) return(QRectF()); if (!decorated_items_.count() || !scene()) return(QRectF());
//if @decorated_items_ contain one item and if this item is a vertical or horizontal partline, apply a specific methode //if @decorated_items_ contain one item and if this item is a vertical or horizontal partline, apply a specific methode
@@ -139,14 +140,16 @@ void ElementPrimitiveDecorator::setItems(const QList<QGraphicsItem *> &items)
/** /**
@return the list of items this decorator is supposed to manipulate @return the list of items this decorator is supposed to manipulate
*/ */
QList<CustomElementPart *> ElementPrimitiveDecorator::items() const { QList<CustomElementPart *> ElementPrimitiveDecorator::items() const
{
return(decorated_items_); return(decorated_items_);
} }
/** /**
@return the list of items this decorator is supposed to manipulate @return the list of items this decorator is supposed to manipulate
*/ */
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const { QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const
{
QList<QGraphicsItem *> list; QList<QGraphicsItem *> list;
foreach (CustomElementPart *part_item, decorated_items_) { foreach (CustomElementPart *part_item, decorated_items_) {
if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) { if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) {
@@ -337,7 +340,8 @@ void ElementPrimitiveDecorator::init()
/** /**
Save the original bounding rectangle. Save the original bounding rectangle.
*/ */
void ElementPrimitiveDecorator::saveOriginalBoundingRect() { void ElementPrimitiveDecorator::saveOriginalBoundingRect()
{
original_bounding_rect_ = internalBoundingRect(); original_bounding_rect_ = internalBoundingRect();
} }
@@ -345,7 +349,8 @@ void ElementPrimitiveDecorator::saveOriginalBoundingRect() {
Adjust the effective bounding rect. This method should be called after the Adjust the effective bounding rect. This method should be called after the
modified_bouding_rect_ attribute was modified. modified_bouding_rect_ attribute was modified.
*/ */
void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() { void ElementPrimitiveDecorator::adjustEffectiveBoundingRect()
{
prepareGeometryChange(); prepareGeometryChange();
effective_bounding_rect_ = modified_bounding_rect_ | effective_bounding_rect_; effective_bounding_rect_ = modified_bounding_rect_ | effective_bounding_rect_;
update(); update();
@@ -355,7 +360,8 @@ void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() {
/** /**
Start a movement (i.e. either a move or scaling operation) Start a movement (i.e. either a move or scaling operation)
*/ */
void ElementPrimitiveDecorator::startMovement() { void ElementPrimitiveDecorator::startMovement()
{
adjust(); adjust();
foreach(CustomElementPart *item, decorated_items_) { foreach(CustomElementPart *item, decorated_items_) {
@@ -409,7 +415,8 @@ void ElementPrimitiveDecorator::applyMovementToRect(int movement_type, const QPo
} }
} }
CustomElementPart *ElementPrimitiveDecorator::singleItem() const { CustomElementPart *ElementPrimitiveDecorator::singleItem() const
{
if (decorated_items_.count() == 1) { if (decorated_items_.count() == 1) {
return(decorated_items_.first()); return(decorated_items_.first());
} }
@@ -450,7 +457,8 @@ void ElementPrimitiveDecorator::scaleItems(const QRectF &original_rect, const QR
/** /**
@return the bounding rectangle of \a item, in scene coordinates @return the bounding rectangle of \a item, in scene coordinates
*/ */
QRectF ElementPrimitiveDecorator::getSceneBoundingRect(QGraphicsItem *item) const { QRectF ElementPrimitiveDecorator::getSceneBoundingRect(QGraphicsItem *item) const
{
if (!item) return(QRectF()); if (!item) return(QRectF());
return(item -> mapRectToScene(item -> boundingRect())); return(item -> mapRectToScene(item -> boundingRect()));
} }
@@ -655,7 +663,8 @@ QPointF ElementPrimitiveDecorator::deltaForRoundScaling(const QRectF &original,
Round the coordinates of \a point so it is snapped to the grid defined by the Round the coordinates of \a point so it is snapped to the grid defined by the
grid_step_x_ and grid_step_y_ attributes. grid_step_x_ and grid_step_y_ attributes.
*/ */
QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) const { QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) const
{
return( return(
QPointF( QPointF(
qRound(point.x() / grid_step_x_) * grid_step_x_, qRound(point.x() / grid_step_x_) * grid_step_x_,
@@ -668,7 +677,8 @@ QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) co
Round the coordinates of \a point so it is snapped to the grid defined by the Round the coordinates of \a point so it is snapped to the grid defined by the
grid_step_x_ and grid_step_y_ attributes. grid_step_x_ and grid_step_y_ attributes.
*/ */
void ElementPrimitiveDecorator::snapPointToGrid(QPointF &point) const { void ElementPrimitiveDecorator::snapPointToGrid(QPointF &point) const
{
point.rx() = qRound(point.x() / grid_step_x_) * grid_step_x_; point.rx() = qRound(point.x() / grid_step_x_) * grid_step_x_;
point.ry() = qRound(point.y() / grid_step_y_) * grid_step_y_; point.ry() = qRound(point.y() / grid_step_y_) * grid_step_y_;
} }

View File

@@ -347,7 +347,8 @@ void ElementScene::setBehavior(ElementScene::Behavior b) {
m_behavior = b; m_behavior = b;
} }
ElementScene::Behavior ElementScene::behavior() const { ElementScene::Behavior ElementScene::behavior() const
{
return m_behavior; return m_behavior;
} }
@@ -356,7 +357,8 @@ ElementScene::Behavior ElementScene::behavior() const {
@return the horizontal size of the grid @return the horizontal size of the grid
\~French la taille horizontale de la grille \~French la taille horizontale de la grille
*/ */
int ElementScene::xGrid() const { int ElementScene::xGrid() const
{
return(m_x_grid); return(m_x_grid);
} }
@@ -365,7 +367,8 @@ int ElementScene::xGrid() const {
@return vertical grid size @return vertical grid size
\~French la taille verticale de la grille \~French la taille verticale de la grille
*/ */
int ElementScene::yGrid() const { int ElementScene::yGrid() const
{
return(m_y_grid); return(m_y_grid);
} }
@@ -580,7 +583,8 @@ QRectF ElementScene::elementSceneGeometricRect() const{
\~French true si l'element comporte au moins une borne, \~French true si l'element comporte au moins une borne,
false s'il n'en a aucune. false s'il n'en a aucune.
*/ */
bool ElementScene::containsTerminals() const { bool ElementScene::containsTerminals() const
{
foreach(QGraphicsItem *qgi,items()) { foreach(QGraphicsItem *qgi,items()) {
if (qgraphicsitem_cast<PartTerminal *>(qgi)) { if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
return(true); return(true);
@@ -594,7 +598,8 @@ bool ElementScene::containsTerminals() const {
@return the undo stack of this element editor @return the undo stack of this element editor
\~French la pile d'annulations de cet editeur d'element \~French la pile d'annulations de cet editeur d'element
*/ */
QUndoStack &ElementScene::undoStack() { QUndoStack &ElementScene::undoStack()
{
return(m_undo_stack); return(m_undo_stack);
} }
@@ -603,7 +608,8 @@ QUndoStack &ElementScene::undoStack() {
@return the QGraphicsItem manager of this item editor @return the QGraphicsItem manager of this item editor
\~French le gestionnaire de QGraphicsItem de cet editeur d'element \~French le gestionnaire de QGraphicsItem de cet editeur d'element
*/ */
QGIManager &ElementScene::qgiManager() { QGIManager &ElementScene::qgiManager()
{
return(m_qgi_manager); return(m_qgi_manager);
} }
@@ -612,7 +618,8 @@ QGIManager &ElementScene::qgiManager() {
@return true if the clipboard appears to contain an element @return true if the clipboard appears to contain an element
\~French true si le presse-papier semble contenir un element \~French true si le presse-papier semble contenir un element
*/ */
bool ElementScene::clipboardMayContainElement() { bool ElementScene::clipboardMayContainElement()
{
QString clipboard_text = QApplication::clipboard() -> text().trimmed(); QString clipboard_text = QApplication::clipboard() -> text().trimmed();
bool may_be_element = clipboard_text.startsWith("<definition") bool may_be_element = clipboard_text.startsWith("<definition")
&& clipboard_text.endsWith("</definition>"); && clipboard_text.endsWith("</definition>");
@@ -639,7 +646,8 @@ bool ElementScene::wasCopiedFromThisElement(const QString &clipboard_content) {
\~French Gere le fait de couper la selection \~French Gere le fait de couper la selection
= l'exporter en XML dans le presse-papier puis la supprimer. = l'exporter en XML dans le presse-papier puis la supprimer.
*/ */
void ElementScene::cut() { void ElementScene::cut()
{
copy(); copy();
QList<QGraphicsItem *> cut_content = selectedItems(); QList<QGraphicsItem *> cut_content = selectedItems();
clearSelection(); clearSelection();
@@ -653,7 +661,8 @@ void ElementScene::cut() {
\~French Gere le fait de copier la selection \~French Gere le fait de copier la selection
= l'exporter en XML dans lepresse-papier. = l'exporter en XML dans lepresse-papier.
*/ */
void ElementScene::copy() { void ElementScene::copy()
{
// accede au presse-papier // accede au presse-papier
QClipboard *clipboard = QApplication::clipboard(); QClipboard *clipboard = QApplication::clipboard();
@@ -674,7 +683,8 @@ void ElementScene::copy() {
@brief ElementScene::editor @brief ElementScene::editor
@return @return
*/ */
QETElementEditor* ElementScene::editor() const { QETElementEditor* ElementScene::editor() const
{
return m_element_editor; return m_element_editor;
} }
@@ -727,7 +737,8 @@ void ElementScene::slot_select(const ElementContent &content)
@brief ElementScene::slot_selectAll @brief ElementScene::slot_selectAll
Select all items Select all items
*/ */
void ElementScene::slot_selectAll() { void ElementScene::slot_selectAll()
{
slot_select(items()); slot_select(items());
} }
@@ -735,7 +746,8 @@ void ElementScene::slot_selectAll() {
@brief ElementScene::slot_deselectAll @brief ElementScene::slot_deselectAll
deselect all item deselect all item
*/ */
void ElementScene::slot_deselectAll() { void ElementScene::slot_deselectAll()
{
slot_select(ElementContent()); slot_select(ElementContent());
} }
@@ -744,7 +756,8 @@ void ElementScene::slot_deselectAll() {
Inverse Selection Inverse Selection
\~French Inverse la selection \~French Inverse la selection
*/ */
void ElementScene::slot_invertSelection() { void ElementScene::slot_invertSelection()
{
blockSignals(true); blockSignals(true);
foreach(QGraphicsItem *qgi, foreach(QGraphicsItem *qgi,
items()) qgi -> setSelected(!qgi -> isSelected()); items()) qgi -> setSelected(!qgi -> isSelected());
@@ -757,7 +770,8 @@ void ElementScene::slot_invertSelection() {
Delete selected items Delete selected items
\~French Supprime les elements selectionnes \~French Supprime les elements selectionnes
*/ */
void ElementScene::slot_delete() { void ElementScene::slot_delete()
{
// check that there is something selected // check that there is something selected
// verifie qu'il y a qqc de selectionne // verifie qu'il y a qqc de selectionne
QList<QGraphicsItem *> selected_items = selectedItems(); QList<QGraphicsItem *> selected_items = selectedItems();
@@ -781,7 +795,8 @@ void ElementScene::slot_delete() {
de cet element. Concretement, ce champ libre est destine a accueillir de cet element. Concretement, ce champ libre est destine a accueillir
des informations sur l'auteur de l'element, sa licence, etc. des informations sur l'auteur de l'element, sa licence, etc.
*/ */
void ElementScene::slot_editAuthorInformations() { void ElementScene::slot_editAuthorInformations()
{
bool is_read_only = m_element_editor && m_element_editor -> isReadOnly(); bool is_read_only = m_element_editor && m_element_editor -> isReadOnly();
// create a dialogue // create a dialogue
@@ -886,7 +901,8 @@ void ElementScene::slot_editNames()
@brief ElementScene::primitives @brief ElementScene::primitives
@return the list of primitives currently present on the scene. @return the list of primitives currently present on the scene.
*/ */
QList<CustomElementPart *> ElementScene::primitives() const { QList<CustomElementPart *> ElementScene::primitives() const
{
QList<CustomElementPart *> primitives_list; QList<CustomElementPart *> primitives_list;
foreach (QGraphicsItem *item, items()) { foreach (QGraphicsItem *item, items()) {
if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) { if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) {
@@ -902,7 +918,8 @@ QList<CustomElementPart *> ElementScene::primitives() const {
@return the parts of the element ordered by increasing zValue @return the parts of the element ordered by increasing zValue
\~French les parties de l'element ordonnes par zValue croissante \~French les parties de l'element ordonnes par zValue croissante
*/ */
QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const { QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const
{
// handle dummy request, i.e. when neither Selected nor NonSelected are set // handle dummy request, i.e. when neither Selected nor NonSelected are set
if (!(options & ElementScene::Selected) if (!(options & ElementScene::Selected)
&& &&
@@ -968,7 +985,8 @@ QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const {
@return the selected graphic parts @return the selected graphic parts
\~French les parties graphiques selectionnees \~French les parties graphiques selectionnees
*/ */
ElementContent ElementScene::selectedContent() const { ElementContent ElementScene::selectedContent() const
{
ElementContent content; ElementContent content;
foreach(QGraphicsItem *qgi, zItems()) { foreach(QGraphicsItem *qgi, zItems()) {
if (qgi -> isSelected()) content << qgi; if (qgi -> isSelected()) content << qgi;
@@ -1031,7 +1049,8 @@ void ElementScene::reset()
exprime dans les coordonnes de la scene exprime dans les coordonnes de la scene
*/ */
QRectF ElementScene::elementContentBoundingRect( QRectF ElementScene::elementContentBoundingRect(
const ElementContent &content) const { const ElementContent &content) const
{
QRectF bounding_rect; QRectF bounding_rect;
foreach(QGraphicsItem *qgi, content) { foreach(QGraphicsItem *qgi, content) {
// skip non-primitives QGraphicsItems (paste area, selection decorator) // skip non-primitives QGraphicsItems (paste area, selection decorator)
@@ -1234,7 +1253,8 @@ void ElementScene::addPrimitive(QGraphicsItem *primitive) {
Initializes the paste area Initializes the paste area
\~French Initialise la zone de collage \~French Initialise la zone de collage
*/ */
void ElementScene::initPasteArea() { void ElementScene::initPasteArea()
{
m_paste_area = new QGraphicsRectItem(); m_paste_area = new QGraphicsRectItem();
m_paste_area -> setZValue(1000000); m_paste_area -> setZValue(1000000);
@@ -1282,7 +1302,8 @@ bool ElementScene::zValueLessThan(QGraphicsItem *item1, QGraphicsItem *item2) {
try to center better is possible the element to the scene try to center better is possible the element to the scene
(the calcul isn't optimal but work good) (the calcul isn't optimal but work good)
*/ */
void ElementScene::centerElementToOrigine() { void ElementScene::centerElementToOrigine()
{
QRectF size= elementSceneGeometricRect(); QRectF size= elementSceneGeometricRect();
int center_x = qRound(size.center().x()); int center_x = qRound(size.center().x());
int center_y = qRound(size.center().y()); int center_y = qRound(size.center().y());

View File

@@ -192,7 +192,8 @@ inline void ElementScene::setNames(const NamesList &nameslist) {
@brief ElementScene::names @brief ElementScene::names
@return the list of names of the currently edited element @return the list of names of the currently edited element
*/ */
inline NamesList ElementScene::names() const { inline NamesList ElementScene::names() const
{
return(m_names_list); return(m_names_list);
} }
@@ -200,7 +201,8 @@ inline NamesList ElementScene::names() const {
@brief ElementScene::informations @brief ElementScene::informations
@return extra informations of the currently edited element @return extra informations of the currently edited element
*/ */
inline QString ElementScene::informations() const { inline QString ElementScene::informations() const
{
return(m_informations); return(m_informations);
} }

View File

@@ -41,18 +41,21 @@ ElementView::ElementView(ElementScene *scene, QWidget *parent) :
} }
/// Destructeur /// Destructeur
ElementView::~ElementView() { ElementView::~ElementView()
{
} }
/// @return l'ElementScene visualisee par cette ElementView /// @return l'ElementScene visualisee par cette ElementView
ElementScene *ElementView::scene() const { ElementScene *ElementView::scene() const
{
return(m_scene); return(m_scene);
} }
/** /**
@return le rectangle de l'element visualise par cet ElementView @return le rectangle de l'element visualise par cet ElementView
*/ */
QRectF ElementView::viewedSceneRect() const { QRectF ElementView::viewedSceneRect() const
{
// recupere la taille du widget viewport // recupere la taille du widget viewport
QSize viewport_size = viewport() -> size(); QSize viewport_size = viewport() -> size();
@@ -79,7 +82,8 @@ void ElementView::setScene(ElementScene *s) {
/** /**
Set the Diagram in visualisation mode Set the Diagram in visualisation mode
*/ */
void ElementView::setVisualisationMode() { void ElementView::setVisualisationMode()
{
setDragMode(ScrollHandDrag); setDragMode(ScrollHandDrag);
setInteractive(false); setInteractive(false);
emit(modeChanged()); emit(modeChanged());
@@ -88,7 +92,8 @@ void ElementView::setVisualisationMode() {
/** /**
Set the Diagram in Selection mode Set the Diagram in Selection mode
*/ */
void ElementView::setSelectionMode() { void ElementView::setSelectionMode()
{
setDragMode(RubberBandDrag); setDragMode(RubberBandDrag);
setInteractive(true); setInteractive(true);
emit(modeChanged()); emit(modeChanged());
@@ -97,7 +102,8 @@ void ElementView::setSelectionMode() {
/** /**
Agrandit le schema (+33% = inverse des -25 % de zoomMoins()) Agrandit le schema (+33% = inverse des -25 % de zoomMoins())
*/ */
void ElementView::zoomIn() { void ElementView::zoomIn()
{
adjustSceneRect(); adjustSceneRect();
scale(4.0/3.0, 4.0/3.0); scale(4.0/3.0, 4.0/3.0);
} }
@@ -105,7 +111,8 @@ void ElementView::zoomIn() {
/** /**
Retrecit le schema (-25% = inverse des +33 % de zoomPlus()) Retrecit le schema (-25% = inverse des +33 % de zoomPlus())
*/ */
void ElementView::zoomOut() { void ElementView::zoomOut()
{
adjustSceneRect(); adjustSceneRect();
scale(0.75, 0.75); scale(0.75, 0.75);
} }
@@ -113,14 +120,16 @@ void ElementView::zoomOut() {
/** /**
Agrandit le schema avec le trackpad Agrandit le schema avec le trackpad
*/ */
void ElementView::zoomInSlowly() { void ElementView::zoomInSlowly()
{
scale(1.02, 1.02); scale(1.02, 1.02);
} }
/** /**
Retrecit le schema avec le trackpad Retrecit le schema avec le trackpad
*/ */
void ElementView::zoomOutSlowly() { void ElementView::zoomOutSlowly()
{
scale(0.98, 0.98); scale(0.98, 0.98);
} }
@@ -129,7 +138,8 @@ void ElementView::zoomOutSlowly() {
schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema, schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema,
le zoom est reinitialise le zoom est reinitialise
*/ */
void ElementView::zoomFit() { void ElementView::zoomFit()
{
resetSceneRect(); resetSceneRect();
fitInView(sceneRect(), Qt::KeepAspectRatio); fitInView(sceneRect(), Qt::KeepAspectRatio);
} }
@@ -137,7 +147,8 @@ void ElementView::zoomFit() {
/** /**
Reinitialise le zoom Reinitialise le zoom
*/ */
void ElementView::zoomReset() { void ElementView::zoomReset()
{
resetSceneRect(); resetSceneRect();
resetTransform(); resetTransform();
scale(4.0, 4.0); scale(4.0, 4.0);
@@ -148,7 +159,8 @@ void ElementView::zoomReset() {
Adjust the scenRect, so that he include all primitives of element Adjust the scenRect, so that he include all primitives of element
plus the viewport of the scene with a margin of 1/3 of herself plus the viewport of the scene with a margin of 1/3 of herself
*/ */
void ElementView::adjustSceneRect() { void ElementView::adjustSceneRect()
{
QRectF esgr = m_scene -> elementSceneGeometricRect(); QRectF esgr = m_scene -> elementSceneGeometricRect();
QRectF vpbr = mapToScene(this -> viewport()->rect()).boundingRect(); QRectF vpbr = mapToScene(this -> viewport()->rect()).boundingRect();
QRectF new_scene_rect = vpbr.adjusted(-vpbr.width()/3, -vpbr.height()/3, vpbr.width()/3, vpbr.height()/3); QRectF new_scene_rect = vpbr.adjusted(-vpbr.width()/3, -vpbr.height()/3, vpbr.width()/3, vpbr.height()/3);
@@ -160,7 +172,8 @@ void ElementView::adjustSceneRect() {
reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que
celui-ci inclut uniquement les primitives de l'élément dessiné. celui-ci inclut uniquement les primitives de l'élément dessiné.
*/ */
void ElementView::resetSceneRect() { void ElementView::resetSceneRect()
{
setSceneRect(m_scene -> elementSceneGeometricRect()); setSceneRect(m_scene -> elementSceneGeometricRect());
} }
@@ -168,7 +181,8 @@ void ElementView::resetSceneRect() {
Gere le fait de couper la selection = l'exporter en XML dans le Gere le fait de couper la selection = l'exporter en XML dans le
presse-papier puis la supprimer. presse-papier puis la supprimer.
*/ */
void ElementView::cut() { void ElementView::cut()
{
// delegue cette action a la scene // delegue cette action a la scene
m_scene -> cut(); m_scene -> cut();
offset_paste_count_ = -1; offset_paste_count_ = -1;
@@ -178,7 +192,8 @@ void ElementView::cut() {
Gere le fait de copier la selection = l'exporter en XML dans le Gere le fait de copier la selection = l'exporter en XML dans le
presse-papier. presse-papier.
*/ */
void ElementView::copy() { void ElementView::copy()
{
// delegue cette action a la scene // delegue cette action a la scene
m_scene -> copy(); m_scene -> copy();
offset_paste_count_ = 0; offset_paste_count_ = 0;
@@ -194,7 +209,8 @@ void ElementView::copy() {
collage devra s'effectuer. collage devra s'effectuer.
@see pasteAreaDefined(const QRectF &) @see pasteAreaDefined(const QRectF &)
*/ */
void ElementView::paste() { void ElementView::paste()
{
QString clipboard_text = QApplication::clipboard() -> text(); QString clipboard_text = QApplication::clipboard() -> text();
if (clipboard_text.isEmpty()) return; if (clipboard_text.isEmpty()) return;
@@ -218,7 +234,8 @@ void ElementView::paste() {
Colle le contenu du presse-papier en demandant systematiquement a Colle le contenu du presse-papier en demandant systematiquement a
l'utilisateur de choisir une zone de collage l'utilisateur de choisir une zone de collage
*/ */
void ElementView::pasteInArea() { void ElementView::pasteInArea()
{
QString clipboard_text = QApplication::clipboard() -> text(); QString clipboard_text = QApplication::clipboard() -> text();
if (clipboard_text.isEmpty()) return; if (clipboard_text.isEmpty()) return;

View File

@@ -67,7 +67,8 @@ EllipseEditor::EllipseEditor(QETElementEditor *editor, PartEllipse *ellipse, QWi
} }
/// Destructeur /// Destructeur
EllipseEditor::~EllipseEditor() { EllipseEditor::~EllipseEditor()
{
} }
void EllipseEditor::setUpChangeConnections() void EllipseEditor::setUpChangeConnections()
@@ -126,11 +127,13 @@ bool EllipseEditor::setParts(QList <CustomElementPart *> parts)
/** /**
@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
*/ */
CustomElementPart *EllipseEditor::currentPart() const { CustomElementPart *EllipseEditor::currentPart() const
{
return(part); return(part);
} }
QList<CustomElementPart*> EllipseEditor::currentParts() const { QList<CustomElementPart*> EllipseEditor::currentParts() const
{
return style_->currentParts(); return style_->currentParts();
} }

View File

@@ -35,7 +35,8 @@ ESEventAddArc::ESEventAddArc(ElementScene *scene) :
/** /**
@brief ESEventAddArc::~ESEventAddArc @brief ESEventAddArc::~ESEventAddArc
*/ */
ESEventAddArc::~ESEventAddArc() { ESEventAddArc::~ESEventAddArc()
{
if (m_running || m_abort) if (m_running || m_abort)
delete m_arc; delete m_arc;
} }

View File

@@ -37,7 +37,8 @@ ESEventAddDynamicTextField::ESEventAddDynamicTextField(ElementScene *scene) :
/** /**
@brief ESEventAddDynamicTextField::~ESEventAddDynamicTextField @brief ESEventAddDynamicTextField::~ESEventAddDynamicTextField
*/ */
ESEventAddDynamicTextField::~ESEventAddDynamicTextField() { ESEventAddDynamicTextField::~ESEventAddDynamicTextField()
{
delete m_text; delete m_text;
} }

View File

@@ -34,7 +34,8 @@ ESEventAddEllipse::ESEventAddEllipse(ElementScene *scene) :
/** /**
@brief ESEventAddEllipse::~ESEventAddEllipse @brief ESEventAddEllipse::~ESEventAddEllipse
*/ */
ESEventAddEllipse::~ESEventAddEllipse() { ESEventAddEllipse::~ESEventAddEllipse()
{
if (m_running || m_abort){ if (m_running || m_abort){
delete m_ellipse; delete m_ellipse;
} }

View File

@@ -38,7 +38,8 @@ ESEventAddLine::ESEventAddLine(ElementScene *scene) :
@brief ESEventAddLine::~ESEventAddLine @brief ESEventAddLine::~ESEventAddLine
destructor destructor
*/ */
ESEventAddLine::~ESEventAddLine() { ESEventAddLine::~ESEventAddLine()
{
if (m_running || m_abort) if (m_running || m_abort)
delete m_line; delete m_line;
} }

View File

@@ -34,7 +34,8 @@ ESEventAddPolygon::ESEventAddPolygon(ElementScene *scene) :
/** /**
@brief ESEventAddPolygon::~ESEventAddPolygon @brief ESEventAddPolygon::~ESEventAddPolygon
*/ */
ESEventAddPolygon::~ESEventAddPolygon() { ESEventAddPolygon::~ESEventAddPolygon()
{
if (m_running || m_abort) if (m_running || m_abort)
delete m_polygon; delete m_polygon;
} }

View File

@@ -34,7 +34,8 @@ ESEventAddRect::ESEventAddRect(ElementScene *scene) :
/** /**
@brief ESEventAddRect::~ESEventAddRect @brief ESEventAddRect::~ESEventAddRect
*/ */
ESEventAddRect::~ESEventAddRect() { ESEventAddRect::~ESEventAddRect()
{
if (m_running || m_abort) if (m_running || m_abort)
delete m_rect; delete m_rect;
} }

View File

@@ -37,7 +37,8 @@ ESEventAddTerminal::ESEventAddTerminal(ElementScene *scene) :
/** /**
@brief ESEventAddTerminal::~ESEventAddTerminal @brief ESEventAddTerminal::~ESEventAddTerminal
*/ */
ESEventAddTerminal::~ESEventAddTerminal() { ESEventAddTerminal::~ESEventAddTerminal()
{
delete m_terminal; delete m_terminal;
} }

View File

@@ -37,7 +37,8 @@ ESEventAddText::ESEventAddText(ElementScene *scene) :
/** /**
@brief ESEventAddText::~ESEventAddText @brief ESEventAddText::~ESEventAddText
*/ */
ESEventAddText::~ESEventAddText() { ESEventAddText::~ESEventAddText()
{
delete m_text; delete m_text;
} }

View File

@@ -99,11 +99,13 @@ bool ESEventInterface::KeyReleaseEvent(QKeyEvent *event) {
return false; return false;
} }
bool ESEventInterface::isRunning() const { bool ESEventInterface::isRunning() const
{
return m_running; return m_running;
} }
bool ESEventInterface::isFinish() const { bool ESEventInterface::isFinish() const
{
return !m_running; return !m_running;
} }

View File

@@ -87,7 +87,8 @@ QRectF AbstractPartEllipse::boundingRect() const
and it is different from shape because it is a regular and it is different from shape because it is a regular
rectangle, not a complex shape. rectangle, not a complex shape.
*/ */
QRectF AbstractPartEllipse::sceneGeometricRect() const { QRectF AbstractPartEllipse::sceneGeometricRect() const
{
return(mapToScene(rect()).boundingRect()); return(mapToScene(rect()).boundingRect());
} }
@@ -95,7 +96,8 @@ QRectF AbstractPartEllipse::sceneGeometricRect() const {
@brief AbstractPartEllipse::sceneTopLeft @brief AbstractPartEllipse::sceneTopLeft
@return return the top left of rectangle, in scene coordinate @return return the top left of rectangle, in scene coordinate
*/ */
QPointF AbstractPartEllipse::sceneTopLeft() const { QPointF AbstractPartEllipse::sceneTopLeft() const
{
return(mapToScene(rect().topLeft())); return(mapToScene(rect().topLeft()));
} }
@@ -103,7 +105,8 @@ QPointF AbstractPartEllipse::sceneTopLeft() const {
@brief AbstractPartEllipse::rect @brief AbstractPartEllipse::rect
Returns the item's ellipse geometry as a QRectF. Returns the item's ellipse geometry as a QRectF.
*/ */
QRectF AbstractPartEllipse::rect() const { QRectF AbstractPartEllipse::rect() const
{
return m_rect; return m_rect;
} }
@@ -131,7 +134,8 @@ void AbstractPartEllipse::setRect(const QRectF &rect)
and does not deserve to be Retained / registered. and does not deserve to be Retained / registered.
An ellipse is relevant when is rect is not null. An ellipse is relevant when is rect is not null.
*/ */
bool AbstractPartEllipse::isUseless() const { bool AbstractPartEllipse::isUseless() const
{
return(rect().isNull()); return(rect().isNull());
} }

View File

@@ -19,7 +19,8 @@
#include "qetelementeditor.h" #include "qetelementeditor.h"
/// @return le QETElementEditor auquel cet editeur appartient /// @return le QETElementEditor auquel cet editeur appartient
QETElementEditor *CustomElementPart::elementEditor() const { QETElementEditor *CustomElementPart::elementEditor() const
{
return(element_editor); return(element_editor);
} }
@@ -27,24 +28,28 @@ QETElementEditor *CustomElementPart::elementEditor() const {
Appelle le slot updateCurrentPartEditor de l'editeur Appelle le slot updateCurrentPartEditor de l'editeur
@see QETElementEditor::updateCurrentPartEditor() @see QETElementEditor::updateCurrentPartEditor()
*/ */
void CustomElementPart::updateCurrentPartEditor() const { void CustomElementPart::updateCurrentPartEditor() const
{
if (element_editor) { if (element_editor) {
element_editor -> updateCurrentPartEditor(); element_editor -> updateCurrentPartEditor();
} }
} }
/// @return l'ElementScene contenant les parties editees par cet editeur /// @return l'ElementScene contenant les parties editees par cet editeur
ElementScene *CustomElementPart::elementScene() const { ElementScene *CustomElementPart::elementScene() const
{
return(element_editor -> elementScene()); return(element_editor -> elementScene());
} }
/// @return la QUndoStack a utiliser pour les annulations /// @return la QUndoStack a utiliser pour les annulations
QUndoStack &CustomElementPart::undoStack() const { QUndoStack &CustomElementPart::undoStack() const
{
return(elementScene() -> undoStack()); return(elementScene() -> undoStack());
} }
/// @return this primitive as a QGraphicsItem /// @return this primitive as a QGraphicsItem
QGraphicsItem *CustomElementPart::toItem() { QGraphicsItem *CustomElementPart::toItem()
{
return(dynamic_cast<QGraphicsItem *>(this)); return(dynamic_cast<QGraphicsItem *>(this));
} }
@@ -55,7 +60,8 @@ QGraphicsItem *CustomElementPart::toItem() {
The default implementation systematically returns The default implementation systematically returns
QET::SnapScalingPointToGrid QET::SnapScalingPointToGrid
*/ */
QET::ScalingMethod CustomElementPart::preferredScalingMethod() const { QET::ScalingMethod CustomElementPart::preferredScalingMethod() const
{
return(QET::SnapScalingPointToGrid); return(QET::SnapScalingPointToGrid);
} }

View File

@@ -95,7 +95,8 @@ void PartArc::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
@param xml_document : Xml document to use for create the xml element. @param xml_document : Xml document to use for create the xml element.
@return : an xml element that describe this arc @return : an xml element that describe this arc
*/ */
const QDomElement PartArc::toXml(QDomDocument &xml_document) const { const QDomElement PartArc::toXml(QDomDocument &xml_document) const
{
QDomElement xml_element = xml_document.createElement("arc"); QDomElement xml_element = xml_document.createElement("arc");
QPointF top_left(sceneTopLeft()); QPointF top_left(sceneTopLeft());
xml_element.setAttribute("x", QString("%1").arg(top_left.x())); xml_element.setAttribute("x", QString("%1").arg(top_left.x()));

View File

@@ -49,11 +49,13 @@ PartDynamicTextField::PartDynamicTextField(QETElementEditor *editor, QGraphicsIt
document() -> setDefaultTextOption(option); document() -> setDefaultTextOption(option);
} }
QString PartDynamicTextField::name() const { QString PartDynamicTextField::name() const
{
return tr("Champ de texte dynamique", "element part name"); return tr("Champ de texte dynamique", "element part name");
} }
QString PartDynamicTextField::xmlName() const { QString PartDynamicTextField::xmlName() const
{
return QString("dynamic_text"); return QString("dynamic_text");
} }
@@ -90,7 +92,8 @@ void PartDynamicTextField::handleUserTransformation(
@param dom_doc @param dom_doc
@return @return
*/ */
const QDomElement PartDynamicTextField::toXml(QDomDocument &dom_doc) const { const QDomElement PartDynamicTextField::toXml(QDomDocument &dom_doc) const
{
QDomElement root_element = dom_doc.createElement(xmlName()); QDomElement root_element = dom_doc.createElement(xmlName());
root_element.setAttribute("x", QString::number(pos().x())); root_element.setAttribute("x", QString::number(pos().x()));
@@ -260,7 +263,8 @@ void PartDynamicTextField::fromTextFieldXml(const QDomElement &dom_element)
@brief PartDynamicTextField::textFrom @brief PartDynamicTextField::textFrom
@return what the final text is created from. @return what the final text is created from.
*/ */
DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom() const { DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom() const
{
return m_text_from; return m_text_from;
} }
@@ -291,7 +295,8 @@ void PartDynamicTextField::setTextFrom(DynamicElementTextItem::TextFrom text_fro
@brief PartDynamicTextField::text @brief PartDynamicTextField::text
@return the text of this text @return the text of this text
*/ */
QString PartDynamicTextField::text() const { QString PartDynamicTextField::text() const
{
return m_text; return m_text;
} }
@@ -337,7 +342,8 @@ void PartDynamicTextField::setCompositeText(const QString &text) {
@brief PartDynamicTextField::compositeText @brief PartDynamicTextField::compositeText
@return the composite text of this text @return the composite text of this text
*/ */
QString PartDynamicTextField::compositeText() const { QString PartDynamicTextField::compositeText() const
{
return m_composite_text; return m_composite_text;
} }
@@ -354,7 +360,8 @@ void PartDynamicTextField::setColor(const QColor& color) {
@brief PartDynamicTextField::color @brief PartDynamicTextField::color
@return The color of this text @return The color of this text
*/ */
QColor PartDynamicTextField::color() const { QColor PartDynamicTextField::color() const
{
return defaultTextColor(); return defaultTextColor();
} }
@@ -364,7 +371,8 @@ void PartDynamicTextField::setFrame(bool frame) {
emit frameChanged(m_frame); emit frameChanged(m_frame);
} }
bool PartDynamicTextField::frame() const { bool PartDynamicTextField::frame() const
{
return m_frame; return m_frame;
} }
@@ -403,7 +411,8 @@ void PartDynamicTextField::setAlignment(Qt::Alignment alignment) {
emit alignmentChanged(m_alignment); emit alignmentChanged(m_alignment);
} }
Qt::Alignment PartDynamicTextField::alignment() const { Qt::Alignment PartDynamicTextField::alignment() const
{
return m_alignment; return m_alignment;
} }
@@ -532,7 +541,8 @@ void PartDynamicTextField::paint(QPainter *painter, const QStyleOptionGraphicsIt
Used to up to date this text field, Used to up to date this text field,
when the element information (see elementScene) changed when the element information (see elementScene) changed
*/ */
void PartDynamicTextField::elementInfoChanged() { void PartDynamicTextField::elementInfoChanged()
{
if(!elementScene()) if(!elementScene())
return; return;
@@ -543,11 +553,13 @@ void PartDynamicTextField::elementInfoChanged() {
m_composite_text, elementScene() -> elementInformation())); m_composite_text, elementScene() -> elementInformation()));
} }
void PartDynamicTextField::prepareAlignment() { void PartDynamicTextField::prepareAlignment()
{
m_alignment_rect = boundingRect(); m_alignment_rect = boundingRect();
} }
void PartDynamicTextField::finishAlignment() { void PartDynamicTextField::finishAlignment()
{
if(m_block_alignment) if(m_block_alignment)
return; return;

View File

@@ -346,7 +346,8 @@ void PartLine::removeHandler()
@brief PartLine::sceneP1 @brief PartLine::sceneP1
@return the point p1 in scene coordinate @return the point p1 in scene coordinate
*/ */
QPointF PartLine::sceneP1() const { QPointF PartLine::sceneP1() const
{
return(mapToScene(m_line.p1())); return(mapToScene(m_line.p1()));
} }
@@ -354,7 +355,8 @@ QPointF PartLine::sceneP1() const {
@brief PartLine::sceneP2 @brief PartLine::sceneP2
@return the point p2 in scen coordinate @return the point p2 in scen coordinate
*/ */
QPointF PartLine::sceneP2() const { QPointF PartLine::sceneP2() const
{
return(mapToScene(m_line.p2())); return(mapToScene(m_line.p2()));
} }
@@ -473,7 +475,8 @@ QRectF PartLine::firstEndCircleRect() const
@brief PartLine::secondEndCircleRect @brief PartLine::secondEndCircleRect
@return the rectangle bordering the entirety of the second extremity @return the rectangle bordering the entirety of the second extremity
*/ */
QRectF PartLine::secondEndCircleRect() const { QRectF PartLine::secondEndCircleRect() const
{
QList<QPointF> interesting_points = fourEndPoints(m_line.p2(), QList<QPointF> interesting_points = fourEndPoints(m_line.p2(),
m_line.p1(), m_line.p1(),
second_length); second_length);
@@ -543,7 +546,8 @@ QRectF PartLine::boundingRect() const
@return true if this part is irrelevant and does not deserve to be Retained / registered. @return true if this part is irrelevant and does not deserve to be Retained / registered.
A line is relevant when is two point is different A line is relevant when is two point is different
*/ */
bool PartLine::isUseless() const { bool PartLine::isUseless() const
{
return(m_line.p1() == m_line.p2()); return(m_line.p1() == m_line.p2());
} }
@@ -554,7 +558,8 @@ bool PartLine::isUseless() const {
to imply any margin, and it is different from shape because it is a regular to imply any margin, and it is different from shape because it is a regular
rectangle, not a complex shape. rectangle, not a complex shape.
*/ */
QRectF PartLine::sceneGeometricRect() const { QRectF PartLine::sceneGeometricRect() const
{
return(QRectF(sceneP1(), sceneP2())); return(QRectF(sceneP1(), sceneP2()));
} }
@@ -617,7 +622,8 @@ QList<QPointF> PartLine::fourEndPoints(const QPointF &end_point, const QPointF &
return(QList<QPointF>() << o << a << b << c); return(QList<QPointF>() << o << a << b << c);
} }
QLineF PartLine::line() const { QLineF PartLine::line() const
{
return m_line; return m_line;
} }

View File

@@ -150,7 +150,8 @@ bool PartPolygon::isUseless() const
to imply any margin, and it is different from shape because it is a regular to imply any margin, and it is different from shape because it is a regular
rectangle, not a complex shape. rectangle, not a complex shape.
*/ */
QRectF PartPolygon::sceneGeometricRect() const { QRectF PartPolygon::sceneGeometricRect() const
{
return(mapToScene(m_polygon.boundingRect()).boundingRect()); return(mapToScene(m_polygon.boundingRect()).boundingRect());
} }
@@ -185,7 +186,8 @@ void PartPolygon::handleUserTransformation(const QRectF &initial_selection_rect,
single primitive is being scaled. single primitive is being scaled.
@return : This reimplementation systematically returns QET::RoundScaleRatios. @return : This reimplementation systematically returns QET::RoundScaleRatios.
*/ */
QET::ScalingMethod PartPolygon::preferredScalingMethod() const { QET::ScalingMethod PartPolygon::preferredScalingMethod() const
{
return(QET::RoundScaleRatios); return(QET::RoundScaleRatios);
} }
@@ -193,7 +195,8 @@ QET::ScalingMethod PartPolygon::preferredScalingMethod() const {
@brief PartPolygon::polygon @brief PartPolygon::polygon
@return the item's polygon, or an empty polygon if no polygon has been set. @return the item's polygon, or an empty polygon if no polygon has been set.
*/ */
QPolygonF PartPolygon::polygon() const { QPolygonF PartPolygon::polygon() const
{
return m_polygon; return m_polygon;
} }

View File

@@ -34,7 +34,8 @@ PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent) :
/** /**
@brief PartRectangle::~PartRectangle @brief PartRectangle::~PartRectangle
*/ */
PartRectangle::~PartRectangle() { PartRectangle::~PartRectangle()
{
removeHandler(); removeHandler();
} }
@@ -126,7 +127,8 @@ void PartRectangle::fromXml(const QDomElement &qde)
@brief PartRectangle::rect @brief PartRectangle::rect
@return : Returns the item's rectangle. @return : Returns the item's rectangle.
*/ */
QRectF PartRectangle::rect() const { QRectF PartRectangle::rect() const
{
return m_rect; return m_rect;
} }
@@ -167,7 +169,8 @@ void PartRectangle::setYRadius(qreal Y)
to imply any margin, and it is different from shape because it is a regular to imply any margin, and it is different from shape because it is a regular
rectangle, not a complex shape. rectangle, not a complex shape.
*/ */
QRectF PartRectangle::sceneGeometricRect() const { QRectF PartRectangle::sceneGeometricRect() const
{
return(mapToScene(rect()).boundingRect()); return(mapToScene(rect()).boundingRect());
} }
@@ -175,7 +178,8 @@ QRectF PartRectangle::sceneGeometricRect() const {
@brief PartRectangle::sceneTopLeft @brief PartRectangle::sceneTopLeft
@return the top left of rectangle, in scene coordinate @return the top left of rectangle, in scene coordinate
*/ */
QPointF PartRectangle::sceneTopLeft() const { QPointF PartRectangle::sceneTopLeft() const
{
return(mapToScene(rect().topLeft())); return(mapToScene(rect().topLeft()));
} }
@@ -228,7 +232,8 @@ QRectF PartRectangle::boundingRect() const
@return true if this part is irrelevant and does not deserve to be Retained / registered. @return true if this part is irrelevant and does not deserve to be Retained / registered.
An rectangle is relevant when he's not null. An rectangle is relevant when he's not null.
*/ */
bool PartRectangle::isUseless() const { bool PartRectangle::isUseless() const
{
return(rect().isNull()); return(rect().isNull());
} }

View File

@@ -36,7 +36,8 @@ PartTerminal::PartTerminal(QETElementEditor *editor, QGraphicsItem *parent) :
} }
/// Destructeur /// Destructeur
PartTerminal::~PartTerminal() { PartTerminal::~PartTerminal()
{
} }
/** /**
@@ -54,7 +55,8 @@ void PartTerminal::fromXml(const QDomElement &xml_elmt) {
@param xml_document Document XML a utiliser pour creer l'element XML @param xml_document Document XML a utiliser pour creer l'element XML
@return un element XML decrivant la borne @return un element XML decrivant la borne
*/ */
const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const { const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const
{
return d -> toXml(xml_document); return d -> toXml(xml_document);
} }
@@ -97,7 +99,8 @@ void PartTerminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, Q
@brief PartTerminal::shape @brief PartTerminal::shape
@return the shape of this item @return the shape of this item
*/ */
QPainterPath PartTerminal::shape() const { QPainterPath PartTerminal::shape() const
{
QPainterPath shape; QPainterPath shape;
shape.lineTo(d -> second_point); shape.lineTo(d -> second_point);
@@ -111,7 +114,8 @@ QPainterPath PartTerminal::shape() const {
@brief PartTerminal::boundingRect @brief PartTerminal::boundingRect
@return the bounding rect of this item @return the bounding rect of this item
*/ */
QRectF PartTerminal::boundingRect() const { QRectF PartTerminal::boundingRect() const
{
QRectF br(QPointF(0, 0), d -> second_point); QRectF br(QPointF(0, 0), d -> second_point);
br = br.normalized(); br = br.normalized();
@@ -141,7 +145,8 @@ void PartTerminal::setName(QString& name) {
emit nameChanged(); emit nameChanged();
} }
void PartTerminal::setNewUuid() { void PartTerminal::setNewUuid()
{
d -> m_uuid = QUuid::createUuid(); d -> m_uuid = QUuid::createUuid();
} }
@@ -149,7 +154,8 @@ void PartTerminal::setNewUuid() {
Met a jour la position du second point en fonction de la position et de Met a jour la position du second point en fonction de la position et de
l'orientation de la borne. l'orientation de la borne.
*/ */
void PartTerminal::updateSecondPoint() { void PartTerminal::updateSecondPoint()
{
qreal ts = 4.0; // terminal size qreal ts = 4.0; // terminal size
switch(d -> m_orientation) { switch(d -> m_orientation) {
case Qet::North: d -> second_point = QPointF(0.0, ts); break; case Qet::North: d -> second_point = QPointF(0.0, ts); break;
@@ -165,7 +171,8 @@ void PartTerminal::updateSecondPoint() {
Une borne est toujours pertinente ; cette fonction renvoie donc Une borne est toujours pertinente ; cette fonction renvoie donc
toujours false toujours false
*/ */
bool PartTerminal::isUseless() const { bool PartTerminal::isUseless() const
{
return(false); return(false);
} }
@@ -175,7 +182,8 @@ bool PartTerminal::isUseless() const {
to imply any margin, and it is different from shape because it is a regular to imply any margin, and it is different from shape because it is a regular
rectangle, not a complex shape. rectangle, not a complex shape.
*/ */
QRectF PartTerminal::sceneGeometricRect() const { QRectF PartTerminal::sceneGeometricRect() const
{
return(sceneBoundingRect()); return(sceneBoundingRect());
} }

View File

@@ -58,7 +58,8 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent) :
} }
/// Destructeur /// Destructeur
PartText::~PartText() { PartText::~PartText()
{
} }
/** /**
@@ -95,7 +96,8 @@ void PartText::fromXml(const QDomElement &xml_element) {
@param xml_document Document XML a utiliser pour creer l'element XML @param xml_document Document XML a utiliser pour creer l'element XML
@return un element XML decrivant le texte statique @return un element XML decrivant le texte statique
*/ */
const QDomElement PartText::toXml(QDomDocument &xml_document) const { const QDomElement PartText::toXml(QDomDocument &xml_document) const
{
QDomElement xml_element = xml_document.createElement(xmlName()); QDomElement xml_element = xml_document.createElement(xmlName());
xml_element.setAttribute("x", QString::number(pos().x())); xml_element.setAttribute("x", QString::number(pos().x()));
@@ -111,7 +113,8 @@ const QDomElement PartText::toXml(QDomDocument &xml_document) const {
/** /**
@return Les coordonnees du point situe en bas a gauche du texte. @return Les coordonnees du point situe en bas a gauche du texte.
*/ */
QPointF PartText::margin() const { QPointF PartText::margin() const
{
QFont used_font = font(); QFont used_font = font();
QFontMetrics qfm(used_font); QFontMetrics qfm(used_font);
qreal document_margin = document() -> documentMargin(); qreal document_margin = document() -> documentMargin();
@@ -191,7 +194,8 @@ QVariant PartText::itemChange(GraphicsItemChange change, const QVariant &value)
/** /**
@return le rectangle delimitant cette partie. @return le rectangle delimitant cette partie.
*/ */
QRectF PartText::boundingRect() const { QRectF PartText::boundingRect() const
{
QRectF r = QGraphicsTextItem::boundingRect(); QRectF r = QGraphicsTextItem::boundingRect();
r.adjust(0.0, -1.1, 0.0, 0.0); r.adjust(0.0, -1.1, 0.0, 0.0);
return(r); return(r);
@@ -202,7 +206,8 @@ QRectF PartText::boundingRect() const {
conservee / enregistree. conservee / enregistree.
Un texte statique n'est pas pertinent lorsque son texte est vide. Un texte statique n'est pas pertinent lorsque son texte est vide.
*/ */
bool PartText::isUseless() const { bool PartText::isUseless() const
{
return(toPlainText().isEmpty()); return(toPlainText().isEmpty());
} }
@@ -212,7 +217,8 @@ bool PartText::isUseless() const {
to imply any margin, and it is different from shape because it is a regular to imply any margin, and it is different from shape because it is a regular
rectangle, not a complex shape. rectangle, not a complex shape.
*/ */
QRectF PartText::sceneGeometricRect() const { QRectF PartText::sceneGeometricRect() const
{
return(sceneBoundingRect()); return(sceneBoundingRect());
} }
@@ -327,7 +333,8 @@ void PartText::setEditable(bool editable) {
/** /**
Start text edition by storing the former value of the text. Start text edition by storing the former value of the text.
*/ */
void PartText::startEdition() { void PartText::startEdition()
{
// !previous_text.isNull() means the text is being edited // !previous_text.isNull() means the text is being edited
previous_text = toPlainText(); previous_text = toPlainText();
} }
@@ -336,7 +343,8 @@ void PartText::startEdition() {
End text edition, potentially generating a ChangePartCommand if the text End text edition, potentially generating a ChangePartCommand if the text
has changed. has changed.
*/ */
void PartText::endEdition() { void PartText::endEdition()
{
if (!previous_text.isNull()) { if (!previous_text.isNull()) {
// the text was being edited // the text was being edited
QString new_text = toPlainText(); QString new_text = toPlainText();

View File

@@ -89,7 +89,8 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent
} }
/// Destructeur /// Destructeur
LineEditor::~LineEditor() { LineEditor::~LineEditor()
{
} }
void LineEditor::setUpChangeConnections() void LineEditor::setUpChangeConnections()
@@ -155,11 +156,13 @@ bool LineEditor::setParts(QList <CustomElementPart *> parts)
/** /**
@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
*/ */
CustomElementPart *LineEditor::currentPart() const { CustomElementPart *LineEditor::currentPart() const
{
return(part); return(part);
} }
QList<CustomElementPart*> LineEditor::currentParts() const { QList<CustomElementPart*> LineEditor::currentParts() const
{
return style_->currentParts(); return style_->currentParts();
} }
@@ -167,7 +170,8 @@ QList<CustomElementPart*> LineEditor::currentParts() const {
@brief LineEditor::editedP1 @brief LineEditor::editedP1
@return The edited P1 in item coordinate @return The edited P1 in item coordinate
*/ */
QPointF LineEditor::editedP1() const { QPointF LineEditor::editedP1() const
{
return part -> mapFromScene(x1->value(), y1->value()); return part -> mapFromScene(x1->value(), y1->value());
} }
@@ -175,7 +179,8 @@ QPointF LineEditor::editedP1() const {
@brief LineEditor::editedP2 @brief LineEditor::editedP2
@return The edited P2 in item coordinate @return The edited P2 in item coordinate
*/ */
QPointF LineEditor::editedP2() const { QPointF LineEditor::editedP2() const
{
return part -> mapFromScene(x2->value(), y2->value()); return part -> mapFromScene(x2->value(), y2->value());
} }

View File

@@ -93,7 +93,8 @@ QETElementEditor::QETElementEditor(QWidget *parent) :
} }
/// Destructeur /// Destructeur
QETElementEditor::~QETElementEditor() { QETElementEditor::~QETElementEditor()
{
/* /*
retire le widget d'edition de primitives affiche par le dock retire le widget d'edition de primitives affiche par le dock
cela evite qu'il ne soit supprime par son widget parent cela evite qu'il ne soit supprime par son widget parent
@@ -135,7 +136,8 @@ void QETElementEditor::setFileName(const QString &fn) {
@brief QETElementEditor::setupActions @brief QETElementEditor::setupActions
Create action used in Element editor Create action used in Element editor
*/ */
void QETElementEditor::setupActions() { void QETElementEditor::setupActions()
{
new_element = new QAction(QET::Icons::DocumentNew, tr("&Nouveau"), this); new_element = new QAction(QET::Icons::DocumentNew, tr("&Nouveau"), this);
open = new QAction(QET::Icons::FolderOpen, tr("&Ouvrir"), this); open = new QAction(QET::Icons::FolderOpen, tr("&Ouvrir"), this);
open_file = new QAction(QET::Icons::FolderOpen, tr("&Ouvrir depuis un fichier"), this); open_file = new QAction(QET::Icons::FolderOpen, tr("&Ouvrir depuis un fichier"), this);
@@ -361,7 +363,8 @@ void QETElementEditor::setupActions() {
/** /**
@brief QETElementEditor::setupMenus @brief QETElementEditor::setupMenus
*/ */
void QETElementEditor::setupMenus() { void QETElementEditor::setupMenus()
{
file_menu = new QMenu(tr("&Fichier"), this); file_menu = new QMenu(tr("&Fichier"), this);
edit_menu = new QMenu(tr("&Édition"), this); edit_menu = new QMenu(tr("&Édition"), this);
display_menu = new QMenu(tr("Afficha&ge"), this); display_menu = new QMenu(tr("Afficha&ge"), this);
@@ -461,7 +464,8 @@ void QETElementEditor::contextMenu(QPoint p, QList<QAction *> actions) {
/** /**
Met a jour les menus Met a jour les menus
*/ */
void QETElementEditor::slot_updateMenus() { void QETElementEditor::slot_updateMenus()
{
bool selected_items = !read_only && !m_elmt_scene -> selectedItems().isEmpty(); bool selected_items = !read_only && !m_elmt_scene -> selectedItems().isEmpty();
bool clipboard_elmt = !read_only && ElementScene::clipboardMayContainElement(); bool clipboard_elmt = !read_only && ElementScene::clipboardMayContainElement();
@@ -497,7 +501,8 @@ void QETElementEditor::slot_updateMenus() {
/** /**
Met a jour le titre de la fenetre Met a jour le titre de la fenetre
*/ */
void QETElementEditor::slot_updateTitle() { void QETElementEditor::slot_updateTitle()
{
QString title = min_title; QString title = min_title;
title += " - " + m_elmt_scene -> names().name() + " "; title += " - " + m_elmt_scene -> names().name() + " ";
if (!filename_.isEmpty() || !location_.isNull()) { if (!filename_.isEmpty() || !location_.isNull()) {
@@ -514,7 +519,8 @@ void QETElementEditor::slot_updateTitle() {
/** /**
@brief QETElementEditor::setupInterface @brief QETElementEditor::setupInterface
*/ */
void QETElementEditor::setupInterface() { void QETElementEditor::setupInterface()
{
// editeur // editeur
m_elmt_scene = new ElementScene(this, this); m_elmt_scene = new ElementScene(this, this);
m_view = new ElementView(m_elmt_scene, this); m_view = new ElementView(m_elmt_scene, this);
@@ -592,14 +598,16 @@ void QETElementEditor::setupInterface() {
Passe l'editeur d'element en mode selection : le pointeur deplace les Passe l'editeur d'element en mode selection : le pointeur deplace les
elements selectionnes et il est possible d'utiliser un rectangle de selection. elements selectionnes et il est possible d'utiliser un rectangle de selection.
*/ */
void QETElementEditor::slot_setRubberBandToView() { void QETElementEditor::slot_setRubberBandToView()
{
m_view -> setDragMode(QGraphicsView::RubberBandDrag); m_view -> setDragMode(QGraphicsView::RubberBandDrag);
} }
/** /**
Passe l'editeur d'element en mode immobile (utilise pour la lecture seule) Passe l'editeur d'element en mode immobile (utilise pour la lecture seule)
*/ */
void QETElementEditor::slot_setNoDragToView() { void QETElementEditor::slot_setNoDragToView()
{
m_view -> setDragMode(QGraphicsView::NoDrag); m_view -> setDragMode(QGraphicsView::NoDrag);
} }
@@ -608,7 +616,8 @@ void QETElementEditor::slot_setNoDragToView() {
Si plusieurs primitives sont selectionnees, seule leur quantite est Si plusieurs primitives sont selectionnees, seule leur quantite est
affichee. Sinon, un widget d'edition approprie est mis en place. affichee. Sinon, un widget d'edition approprie est mis en place.
*/ */
void QETElementEditor::slot_updateInformations() { void QETElementEditor::slot_updateInformations()
{
QList<QGraphicsItem *> selected_qgis = m_elmt_scene -> selectedItems(); QList<QGraphicsItem *> selected_qgis = m_elmt_scene -> selectedItems();
if (selected_qgis.isEmpty()) { if (selected_qgis.isEmpty()) {
clearToolsDock(); clearToolsDock();
@@ -752,7 +761,8 @@ void QETElementEditor::slot_updateInformations() {
Do several check about element. Do several check about element.
If error is occurred return false If error is occurred return false
*/ */
bool QETElementEditor::checkElement() { bool QETElementEditor::checkElement()
{
//List of warning and error //List of warning and error
typedef QPair<QString, QString> QETWarning; typedef QPair<QString, QString> QETWarning;
QList<QETWarning> warnings; QList<QETWarning> warnings;
@@ -998,7 +1008,8 @@ void QETElementEditor::setReadOnly(bool ro) {
/** /**
@return true si l'editeur d'element est en mode lecture seule @return true si l'editeur d'element est en mode lecture seule
*/ */
bool QETElementEditor::isReadOnly() const { bool QETElementEditor::isReadOnly() const
{
return(read_only); return(read_only);
} }
@@ -1006,7 +1017,8 @@ bool QETElementEditor::isReadOnly() const {
@brief QETElementEditor::addLine @brief QETElementEditor::addLine
Set line creation interface to scene Set line creation interface to scene
*/ */
void QETElementEditor::addLine() { void QETElementEditor::addLine()
{
m_elmt_scene -> setEventInterface(new ESEventAddLine(m_elmt_scene)); m_elmt_scene -> setEventInterface(new ESEventAddLine(m_elmt_scene));
} }
@@ -1014,7 +1026,8 @@ void QETElementEditor::addLine() {
@brief QETElementEditor::addRect @brief QETElementEditor::addRect
Set rectangle creation interface to scene Set rectangle creation interface to scene
*/ */
void QETElementEditor::addRect() { void QETElementEditor::addRect()
{
m_elmt_scene -> setEventInterface(new ESEventAddRect(m_elmt_scene)); m_elmt_scene -> setEventInterface(new ESEventAddRect(m_elmt_scene));
} }
@@ -1022,7 +1035,8 @@ void QETElementEditor::addRect() {
@brief QETElementEditor::addEllipse @brief QETElementEditor::addEllipse
Set ellipse creation interface to scene Set ellipse creation interface to scene
*/ */
void QETElementEditor::addEllipse() { void QETElementEditor::addEllipse()
{
m_elmt_scene -> setEventInterface(new ESEventAddEllipse(m_elmt_scene)); m_elmt_scene -> setEventInterface(new ESEventAddEllipse(m_elmt_scene));
} }
@@ -1030,7 +1044,8 @@ void QETElementEditor::addEllipse() {
@brief QETElementEditor::addPolygon @brief QETElementEditor::addPolygon
Set polygon creation interface to scene Set polygon creation interface to scene
*/ */
void QETElementEditor::addPolygon() { void QETElementEditor::addPolygon()
{
m_elmt_scene -> setEventInterface(new ESEventAddPolygon(m_elmt_scene)); m_elmt_scene -> setEventInterface(new ESEventAddPolygon(m_elmt_scene));
} }
@@ -1038,7 +1053,8 @@ void QETElementEditor::addPolygon() {
@brief QETElementEditor::addArc @brief QETElementEditor::addArc
Set arc creation interface to scene Set arc creation interface to scene
*/ */
void QETElementEditor::addArc() { void QETElementEditor::addArc()
{
m_elmt_scene -> setEventInterface(new ESEventAddArc(m_elmt_scene)); m_elmt_scene -> setEventInterface(new ESEventAddArc(m_elmt_scene));
} }
@@ -1046,7 +1062,8 @@ void QETElementEditor::addArc() {
@brief QETElementEditor::addText @brief QETElementEditor::addText
Set text creation interface to scene Set text creation interface to scene
*/ */
void QETElementEditor::addText() { void QETElementEditor::addText()
{
m_elmt_scene -> setEventInterface(new ESEventAddText(m_elmt_scene)); m_elmt_scene -> setEventInterface(new ESEventAddText(m_elmt_scene));
} }
@@ -1054,7 +1071,8 @@ void QETElementEditor::addText() {
@brief QETElementEditor::addTerminal @brief QETElementEditor::addTerminal
Set terminal creation interface to scene Set terminal creation interface to scene
*/ */
void QETElementEditor::addTerminal() { void QETElementEditor::addTerminal()
{
m_elmt_scene -> setEventInterface(new ESEventAddTerminal(m_elmt_scene)); m_elmt_scene -> setEventInterface(new ESEventAddTerminal(m_elmt_scene));
} }
@@ -1062,7 +1080,8 @@ void QETElementEditor::addTerminal() {
@brief QETElementEditor::addDynamicTextField @brief QETElementEditor::addDynamicTextField
Set dynamic text field creation interface to scene Set dynamic text field creation interface to scene
*/ */
void QETElementEditor::addDynamicTextField() { void QETElementEditor::addDynamicTextField()
{
m_elmt_scene -> setEventInterface(new ESEventAddDynamicTextField(m_elmt_scene)); m_elmt_scene -> setEventInterface(new ESEventAddDynamicTextField(m_elmt_scene));
} }
@@ -1070,7 +1089,8 @@ void QETElementEditor::addDynamicTextField() {
@brief QETElementEditor::UncheckAddPrimitive @brief QETElementEditor::UncheckAddPrimitive
Uncheck all action related to primitive Uncheck all action related to primitive
*/ */
void QETElementEditor::UncheckAddPrimitive() { void QETElementEditor::UncheckAddPrimitive()
{
foreach(QAction *action, parts -> actions()) { foreach(QAction *action, parts -> actions()) {
action -> setChecked(false); action -> setChecked(false);
} }
@@ -1079,7 +1099,8 @@ void QETElementEditor::UncheckAddPrimitive() {
/** /**
Lance l'assistant de creation d'un nouvel element. Lance l'assistant de creation d'un nouvel element.
*/ */
void QETElementEditor::slot_new() { void QETElementEditor::slot_new()
{
NewElementWizard new_element_wizard(this); NewElementWizard new_element_wizard(this);
new_element_wizard.exec(); new_element_wizard.exec();
} }
@@ -1087,7 +1108,8 @@ void QETElementEditor::slot_new() {
/** /**
Ouvre un element Ouvre un element
*/ */
void QETElementEditor::slot_open() { void QETElementEditor::slot_open()
{
// demande le chemin virtuel de l'element a ouvrir a l'utilisateur // demande le chemin virtuel de l'element a ouvrir a l'utilisateur
ElementsLocation location = ElementDialog::getOpenElementLocation(this); ElementsLocation location = ElementDialog::getOpenElementLocation(this);
if (location.isNull()) { if (location.isNull()) {
@@ -1100,7 +1122,8 @@ void QETElementEditor::slot_open() {
Ouvre un fichier Ouvre un fichier
Demande un fichier a l'utilisateur et ouvre ce fichier Demande un fichier a l'utilisateur et ouvre ce fichier
*/ */
void QETElementEditor::slot_openFile() { void QETElementEditor::slot_openFile()
{
// repertoire a afficher initialement dans le dialogue // repertoire a afficher initialement dans le dialogue
QString open_dir = filename_.isEmpty() ? QETApp::customElementsDir() : QDir(filename_).absolutePath(); QString open_dir = filename_.isEmpty() ? QETApp::customElementsDir() : QDir(filename_).absolutePath();
@@ -1129,7 +1152,8 @@ void QETElementEditor::openRecentFile(const QString &filepath) {
/** /**
@brief QETElementEditor::slot_openDxf @brief QETElementEditor::slot_openDxf
*/ */
void QETElementEditor::slot_openDxf (){ void QETElementEditor::slot_openDxf ()
{
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
QString program = (QDir::homePath() + "/Application Data/qet/DXFtoQET.exe"); QString program = (QDir::homePath() + "/Application Data/qet/DXFtoQET.exe");
@@ -1174,7 +1198,8 @@ void QETElementEditor::openElement(const QString &filepath) {
@brief QETElementEditor::slot_reload @brief QETElementEditor::slot_reload
Reload the element from the file or location Reload the element from the file or location
*/ */
void QETElementEditor::slot_reload() { void QETElementEditor::slot_reload()
{
//If user already edit the element, ask confirmation to reload //If user already edit the element, ask confirmation to reload
if (!m_elmt_scene -> undoStack().isClean()) { if (!m_elmt_scene -> undoStack().isClean()) {
QMessageBox::StandardButton answer = QET::QetMessageBox::question(this, QMessageBox::StandardButton answer = QET::QetMessageBox::question(this,
@@ -1203,7 +1228,8 @@ void QETElementEditor::slot_reload() {
If the filepath or location is unknown, use save_as instead If the filepath or location is unknown, use save_as instead
@return true if save with success @return true if save with success
*/ */
bool QETElementEditor::slot_save() { bool QETElementEditor::slot_save()
{
// Check element befor writing // Check element befor writing
if (checkElement()) { if (checkElement()) {
//If we don't know the name of the current file, use save as instead //If we don't know the name of the current file, use save as instead
@@ -1242,7 +1268,8 @@ bool QETElementEditor::slot_save() {
to this location to this location
@return true if save with success @return true if save with success
*/ */
bool QETElementEditor::slot_saveAs() { bool QETElementEditor::slot_saveAs()
{
// Check element befor writing // Check element befor writing
if (checkElement()) { if (checkElement()) {
//Ask a location to user //Ask a location to user
@@ -1269,7 +1296,8 @@ bool QETElementEditor::slot_saveAs() {
Ask a file to user and save the current edited element to this file Ask a file to user and save the current edited element to this file
@return true if save with success @return true if save with success
*/ */
bool QETElementEditor::slot_saveAsFile() { bool QETElementEditor::slot_saveAsFile()
{
// Check element befor writing // Check element befor writing
if (checkElement()) { if (checkElement()) {
//Ask a filename to user, for save the element //Ask a filename to user, for save the element
@@ -1312,7 +1340,8 @@ bool QETElementEditor::slot_saveAsFile() {
Si l'element comporte des modifications, la question est posee a Si l'element comporte des modifications, la question est posee a
l'utilisateur. l'utilisateur.
*/ */
bool QETElementEditor::canClose() { bool QETElementEditor::canClose()
{
if (m_elmt_scene -> undoStack().isClean()) { if (m_elmt_scene -> undoStack().isClean()) {
return(true); return(true);
} }
@@ -1351,7 +1380,8 @@ bool QETElementEditor::canClose() {
parties. parties.
@return le widget enleve, ou 0 s'il n'y avait pas de widget a enlever @return le widget enleve, ou 0 s'il n'y avait pas de widget a enlever
*/ */
QWidget *QETElementEditor::clearToolsDock() { QWidget *QETElementEditor::clearToolsDock()
{
if (QWidget *previous_widget = m_tools_dock_stack -> widget(1)) { if (QWidget *previous_widget = m_tools_dock_stack -> widget(1)) {
m_tools_dock_stack -> removeWidget(previous_widget); m_tools_dock_stack -> removeWidget(previous_widget);
previous_widget -> setParent(nullptr); previous_widget -> setParent(nullptr);
@@ -1410,7 +1440,8 @@ void QETElementEditor::firstActivation(QEvent *event) {
/** /**
Remplit la liste des parties Remplit la liste des parties
*/ */
void QETElementEditor::slot_createPartsList() { void QETElementEditor::slot_createPartsList()
{
m_parts_list -> blockSignals(true); m_parts_list -> blockSignals(true);
m_parts_list -> clear(); m_parts_list -> clear();
QList<QGraphicsItem *> qgis = m_elmt_scene -> zItems(); QList<QGraphicsItem *> qgis = m_elmt_scene -> zItems();
@@ -1441,7 +1472,8 @@ void QETElementEditor::slot_createPartsList() {
/** /**
Met a jour la selection dans la liste des parties Met a jour la selection dans la liste des parties
*/ */
void QETElementEditor::slot_updatePartsList() { void QETElementEditor::slot_updatePartsList()
{
int items_count = m_elmt_scene -> items().count(); int items_count = m_elmt_scene -> items().count();
if (m_parts_list -> count() != items_count) { if (m_parts_list -> count() != items_count) {
slot_createPartsList(); slot_createPartsList();
@@ -1464,7 +1496,8 @@ void QETElementEditor::slot_updatePartsList() {
Met a jour la selection des parties de l'element a partir de la liste des Met a jour la selection des parties de l'element a partir de la liste des
parties parties
*/ */
void QETElementEditor::slot_updateSelectionFromPartsList() { void QETElementEditor::slot_updateSelectionFromPartsList()
{
m_elmt_scene -> blockSignals(true); m_elmt_scene -> blockSignals(true);
m_parts_list -> blockSignals(true); m_parts_list -> blockSignals(true);
for (int i = 0 ; i < m_parts_list -> count() ; ++ i) { for (int i = 0 ; i < m_parts_list -> count() ; ++ i) {
@@ -1484,7 +1517,8 @@ void QETElementEditor::slot_updateSelectionFromPartsList() {
@brief QETElementEditor::readSettings @brief QETElementEditor::readSettings
Read settings Read settings
*/ */
void QETElementEditor::readSettings() { void QETElementEditor::readSettings()
{
QSettings settings; QSettings settings;
// dimensions et position de la fenetre // dimensions et position de la fenetre
@@ -1507,7 +1541,8 @@ void QETElementEditor::readSettings() {
@brief QETElementEditor::writeSettings @brief QETElementEditor::writeSettings
Write the settings Write the settings
*/ */
void QETElementEditor::writeSettings() { void QETElementEditor::writeSettings()
{
QSettings settings; QSettings settings;
settings.setValue("elementeditor/geometry", saveGeometry()); settings.setValue("elementeditor/geometry", saveGeometry());
settings.setValue("elementeditor/state", saveState()); settings.setValue("elementeditor/state", saveState());
@@ -1517,7 +1552,8 @@ void QETElementEditor::writeSettings() {
@return les decalages horizontaux et verticaux (sous la forme d'un point) a @return les decalages horizontaux et verticaux (sous la forme d'un point) a
utiliser lors d'un copier/coller avec decalage. utiliser lors d'un copier/coller avec decalage.
*/ */
QPointF QETElementEditor::pasteOffset() { QPointF QETElementEditor::pasteOffset()
{
QPointF paste_offset(5.0, 0.0); QPointF paste_offset(5.0, 0.0);
return(paste_offset); return(paste_offset);
} }
@@ -1594,7 +1630,8 @@ void QETElementEditor::fromLocation(const ElementsLocation &location) {
Demande un fichier a l'utilisateur, l'ouvre en tant que fichier element, Demande un fichier a l'utilisateur, l'ouvre en tant que fichier element,
met son contenu dans le presse-papiers, et appelle ElementView::PasteInArea met son contenu dans le presse-papiers, et appelle ElementView::PasteInArea
*/ */
void QETElementEditor::pasteFromFile() { void QETElementEditor::pasteFromFile()
{
// demande le chemin du fichier a ouvrir a l'utilisateur // demande le chemin du fichier a ouvrir a l'utilisateur
QString element_file_path = getOpenElementFileName(this); QString element_file_path = getOpenElementFileName(this);
if (element_file_path.isEmpty()) { if (element_file_path.isEmpty()) {
@@ -1627,7 +1664,8 @@ void QETElementEditor::pasteFromFile() {
Ask an element to user, copy the xml definition of the element Ask an element to user, copy the xml definition of the element
to the clipboard and call ElementView::PasteInArea to the clipboard and call ElementView::PasteInArea
*/ */
void QETElementEditor::pasteFromElement() { void QETElementEditor::pasteFromElement()
{
//Ask for a location //Ask for a location
ElementsLocation location = ElementDialog::getOpenElementLocation(this); ElementsLocation location = ElementDialog::getOpenElementLocation(this);
if (location.isNull()) { if (location.isNull()) {
@@ -1659,7 +1697,8 @@ void QETElementEditor::pasteFromElement() {
Met a jour l'editeur de primitive actuellement visible. Met a jour l'editeur de primitive actuellement visible.
Si aucun editeur de primitive n'est visible, ce slot ne fait rien. Si aucun editeur de primitive n'est visible, ce slot ne fait rien.
*/ */
void QETElementEditor::updateCurrentPartEditor() { void QETElementEditor::updateCurrentPartEditor()
{
// si aucun widget d'edition n'est affiche, on ne fait rien // si aucun widget d'edition n'est affiche, on ne fait rien
if (!m_tools_dock_stack -> currentIndex()) { if (!m_tools_dock_stack -> currentIndex()) {
return; return;

View File

@@ -166,21 +166,24 @@ inline void QETElementEditor::setNames(const NamesList &nameslist) {
/** /**
@return the location of the currently edited element @return the location of the currently edited element
*/ */
inline ElementsLocation QETElementEditor::location() const { inline ElementsLocation QETElementEditor::location() const
{
return(location_); return(location_);
} }
/** /**
@return the filename of the currently edited element @return the filename of the currently edited element
*/ */
inline QString QETElementEditor::fileName() const { inline QString QETElementEditor::fileName() const
{
return(filename_); return(filename_);
} }
/** /**
@return the editing scene @return the editing scene
*/ */
inline ElementScene *QETElementEditor::elementScene() const { inline ElementScene *QETElementEditor::elementScene() const
{
return(m_elmt_scene); return(m_elmt_scene);
} }

View File

@@ -403,31 +403,37 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
} }
/// Destructeur /// Destructeur
StyleEditor::~StyleEditor() { StyleEditor::~StyleEditor()
{
} }
/// Update antialiasing with undo command /// Update antialiasing with undo command
void StyleEditor::updatePartAntialiasing() { void StyleEditor::updatePartAntialiasing()
{
makeUndo(tr("style antialiasing"), "antialias", antialiasing -> isChecked()); makeUndo(tr("style antialiasing"), "antialias", antialiasing -> isChecked());
} }
/// Update color with undo command /// Update color with undo command
void StyleEditor::updatePartColor() { void StyleEditor::updatePartColor()
{
makeUndo(tr("style couleur"),"color", outline_color->itemData(outline_color -> currentIndex())); makeUndo(tr("style couleur"),"color", outline_color->itemData(outline_color -> currentIndex()));
} }
/// Update style with undo command /// Update style with undo command
void StyleEditor::updatePartLineStyle() { void StyleEditor::updatePartLineStyle()
{
makeUndo(tr("style ligne"), "line_style", line_style->itemData(line_style -> currentIndex())); makeUndo(tr("style ligne"), "line_style", line_style->itemData(line_style -> currentIndex()));
} }
/// Update weight with undo command /// Update weight with undo command
void StyleEditor::updatePartLineWeight() { void StyleEditor::updatePartLineWeight()
{
makeUndo(tr("style epaisseur"), "line_weight", size_weight->itemData(size_weight -> currentIndex())); makeUndo(tr("style epaisseur"), "line_weight", size_weight->itemData(size_weight -> currentIndex()));
} }
/// Update color filling with undo command /// Update color filling with undo command
void StyleEditor::updatePartFilling() { void StyleEditor::updatePartFilling()
{
makeUndo(tr("style remplissage"), "filling", filling_color->itemData(filling_color -> currentIndex())); makeUndo(tr("style remplissage"), "filling", filling_color->itemData(filling_color -> currentIndex()));
} }
@@ -536,11 +542,13 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
/** /**
@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
*/ */
CustomElementPart *StyleEditor::currentPart() const { CustomElementPart *StyleEditor::currentPart() const
{
return(part); return(part);
} }
QList<CustomElementPart*> StyleEditor::currentParts() const { QList<CustomElementPart*> StyleEditor::currentParts() const
{
return m_cep_list; return m_cep_list;
} }

View File

@@ -47,9 +47,10 @@ TerminalEditor::TerminalEditor(QETElementEditor* editor, QWidget* parent):
@param parent : @param parent :
QWidget parent de ce widget QWidget parent de ce widget
*/ */
TerminalEditor::TerminalEditor(QETElementEditor *editor, TerminalEditor::TerminalEditor(
QList<PartTerminal *> &terms, QETElementEditor *editor,
QWidget *parent) : QList<PartTerminal *> &terms,
QWidget *parent) :
ElementItemEditor(editor, parent), ElementItemEditor(editor, parent),
m_terminals(terms), m_terminals(terms),
m_part(terms.first()) { m_part(terms.first()) {
@@ -59,9 +60,11 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor,
/** /**
@brief TerminalEditor::init @brief TerminalEditor::init
*/ */
void TerminalEditor::init() { void TerminalEditor::init()
{
qle_x = new QDoubleSpinBox(); qle_x = new QDoubleSpinBox();
qle_y = new QDoubleSpinBox(); qle_y = new QDoubleSpinBox();
name = new QLineEdit();
qle_x -> setRange(-5000, 5000); qle_x -> setRange(-5000, 5000);
qle_y -> setRange(-5000, 5000); qle_y -> setRange(-5000, 5000);
@@ -87,6 +90,11 @@ void TerminalEditor::init() {
ori -> addWidget(orientation ); ori -> addWidget(orientation );
main_layout -> addLayout(ori); main_layout -> addLayout(ori);
QHBoxLayout *lay_name = new QHBoxLayout();
lay_name -> addWidget(new QLabel(tr("Name : ")));
lay_name -> addWidget(name);
main_layout -> addLayout(lay_name);
main_layout -> addStretch(); main_layout -> addStretch();
setLayout(main_layout); setLayout(main_layout);
@@ -98,7 +106,8 @@ void TerminalEditor::init() {
@brief TerminalEditor::~TerminalEditor @brief TerminalEditor::~TerminalEditor
Destructeur Destructeur
*/ */
TerminalEditor::~TerminalEditor() { TerminalEditor::~TerminalEditor()
{
} }
/** /**
@@ -161,11 +170,13 @@ bool TerminalEditor::setParts(QList<CustomElementPart *> parts) {
/** /**
@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
*/ */
CustomElementPart *TerminalEditor::currentPart() const { CustomElementPart *TerminalEditor::currentPart() const
{
return(m_part); return(m_part);
} }
QList<CustomElementPart*> TerminalEditor::currentParts() const { QList<CustomElementPart*> TerminalEditor::currentParts() const
{
QList<CustomElementPart*> parts; QList<CustomElementPart*> parts;
for (auto term: m_terminals) { for (auto term: m_terminals) {
parts.append(static_cast<CustomElementPart*>(term)); parts.append(static_cast<CustomElementPart*>(term));
@@ -174,7 +185,8 @@ QList<CustomElementPart*> TerminalEditor::currentParts() const {
} }
/// Met a jour l'orientation de la borne et cree un objet d'annulation /// Met a jour l'orientation de la borne et cree un objet d'annulation
void TerminalEditor::updateTerminalO() { void TerminalEditor::updateTerminalO()
{
if (m_locked) return; if (m_locked) return;
m_locked = true; m_locked = true;
QVariant var(orientation -> itemData(orientation -> currentIndex())); QVariant var(orientation -> itemData(orientation -> currentIndex()));
@@ -194,7 +206,8 @@ void TerminalEditor::updateTerminalO() {
/** /**
@brief TerminalEditor::updateXPos @brief TerminalEditor::updateXPos
*/ */
void TerminalEditor::updateXPos() { void TerminalEditor::updateXPos()
{
if (m_locked) return; if (m_locked) return;
m_locked = true; m_locked = true;
QPointF new_pos(qle_x->value(), 0); QPointF new_pos(qle_x->value(), 0);
@@ -215,7 +228,8 @@ void TerminalEditor::updateXPos() {
/** /**
@brief TerminalEditor::updateYPos @brief TerminalEditor::updateYPos
*/ */
void TerminalEditor::updateYPos() { void TerminalEditor::updateYPos()
{
if (m_locked) return; if (m_locked) return;
m_locked = true; m_locked = true;
QPointF new_pos(0, qle_y->value()); // change only y value QPointF new_pos(0, qle_y->value()); // change only y value
@@ -232,17 +246,46 @@ void TerminalEditor::updateYPos() {
} }
m_locked=false; m_locked=false;
} }
/**
@brief TerminalEditor::updateName
SLOT set name to Terminal
*/
void TerminalEditor::updateName() {
if (m_locked) return;
m_locked = true;
QVariant var(name->text());
for (int i=0; i < m_terminals.length(); i++) {
PartTerminal* term = m_terminals[i];
if (var != term->property("name"))
{
QPropertyUndoCommand *undo;
undo = new QPropertyUndoCommand(term,
"name",
term->property("name"),
var);
undo->setText(tr("Modify name of the terminal"));
undoStack().push(undo);
}
}
m_locked=false;
}
/// update Number and name, create cancel object /// update Number and name, create cancel object
/** /**
Met a jour le formulaire d'edition Met a jour le formulaire d'edition
*/ */
void TerminalEditor::updateForm() { void TerminalEditor::updateForm()
{
if (!m_part) return; if (!m_part) return;
activeConnections(false); activeConnections(false);
qle_x -> setValue(m_part->property("x").toReal()); qle_x -> setValue(m_part->property("x").toReal());
qle_y -> setValue(m_part->property("y").toReal()); qle_y -> setValue(m_part->property("y").toReal());
orientation -> setCurrentIndex(orientation->findData(m_part->property("orientation"))); orientation -> setCurrentIndex(orientation->findData(m_part->property("orientation")));
name -> setText(m_part->name());
activeConnections(true); activeConnections(true);
} }
@@ -252,13 +295,26 @@ void TerminalEditor::updateForm() {
*/ */
void TerminalEditor::activeConnections(bool active) { void TerminalEditor::activeConnections(bool active) {
if (active) { if (active) {
connect(qle_x, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateXPos); connect(qle_x,
connect(qle_y, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateYPos); &QDoubleSpinBox::editingFinished,
connect(orientation, QOverload<int>::of(&QComboBox::activated), this, &TerminalEditor::updateTerminalO); this, &TerminalEditor::updateXPos);
connect(qle_y,
&QDoubleSpinBox::editingFinished,
this, &TerminalEditor::updateYPos);
connect(orientation,
QOverload<int>::of(&QComboBox::activated),
this, &TerminalEditor::updateTerminalO);
connect(name, &QLineEdit::editingFinished,
this, &TerminalEditor::updateName);
} }
else { else {
disconnect(qle_x, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateXPos); disconnect(qle_x, &QDoubleSpinBox::editingFinished,
disconnect(qle_y, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateYPos); this, &TerminalEditor::updateXPos);
disconnect(orientation, QOverload<int>::of(&QComboBox::activated), this, &TerminalEditor::updateTerminalO); disconnect(qle_y, &QDoubleSpinBox::editingFinished,
this, &TerminalEditor::updateYPos);
disconnect(orientation, QOverload<int>::of(&QComboBox::activated),
this, &TerminalEditor::updateTerminalO);
disconnect(name, &QLineEdit::editingFinished,
this, &TerminalEditor::updateName);
} }
} }

View File

@@ -20,6 +20,8 @@
#include "elementitemeditor.h" #include "elementitemeditor.h"
#include <QLineEdit>
class PartTerminal; class PartTerminal;
class QDoubleSpinBox; class QDoubleSpinBox;
class QComboBox; class QComboBox;
@@ -35,9 +37,10 @@ class TerminalEditor : public ElementItemEditor {
// Constructors, destructor // Constructors, destructor
public: public:
TerminalEditor(QETElementEditor *, TerminalEditor(
QList<PartTerminal *>& terms, QETElementEditor *,
QWidget * = nullptr); QList<PartTerminal *>& terms,
QWidget * = nullptr);
TerminalEditor(QETElementEditor *, QWidget * = nullptr); TerminalEditor(QETElementEditor *, QWidget * = nullptr);
~TerminalEditor() override; ~TerminalEditor() override;
private: private:
@@ -50,6 +53,7 @@ class TerminalEditor : public ElementItemEditor {
PartTerminal *m_part{nullptr}; PartTerminal *m_part{nullptr};
QDoubleSpinBox *qle_x, *qle_y; QDoubleSpinBox *qle_x, *qle_y;
QComboBox *orientation; QComboBox *orientation;
QLineEdit *name;
bool m_locked{false}; bool m_locked{false};
// methods // methods
@@ -63,6 +67,7 @@ class TerminalEditor : public ElementItemEditor {
void updateTerminalO(); void updateTerminalO();
void updateXPos(); void updateXPos();
void updateYPos(); void updateYPos();
void updateName();
void updateForm() override; void updateForm() override;
private: private:

View File

@@ -43,7 +43,8 @@ DynamicTextFieldEditor::DynamicTextFieldEditor(
fillInfoComboBox(); fillInfoComboBox();
} }
DynamicTextFieldEditor::~DynamicTextFieldEditor() { DynamicTextFieldEditor::~DynamicTextFieldEditor()
{
delete ui; delete ui;
if(!m_connection_list.isEmpty()) { if(!m_connection_list.isEmpty()) {
for(const QMetaObject::Connection& con : m_connection_list) { for(const QMetaObject::Connection& con : m_connection_list) {
@@ -108,11 +109,13 @@ bool DynamicTextFieldEditor::setParts(QList <CustomElementPart *> parts) {
@return The current edited part, note they can return nullptr if @return The current edited part, note they can return nullptr if
there is not a currently edited part. there is not a currently edited part.
*/ */
CustomElementPart *DynamicTextFieldEditor::currentPart() const { CustomElementPart *DynamicTextFieldEditor::currentPart() const
{
return m_text_field.data(); return m_text_field.data();
} }
QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const { QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const
{
QList<CustomElementPart*> parts; QList<CustomElementPart*> parts;
for (auto part: m_parts) { for (auto part: m_parts) {
parts.append(static_cast<CustomElementPart*>(part)); parts.append(static_cast<CustomElementPart*>(part));
@@ -120,7 +123,8 @@ QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const {
return parts; return parts;
} }
void DynamicTextFieldEditor::updateForm() { void DynamicTextFieldEditor::updateForm()
{
if(m_text_field) { if(m_text_field) {
ui -> m_x_sb -> setValue(m_text_field.data() -> x()); ui -> m_x_sb -> setValue(m_text_field.data() -> x());
ui -> m_y_sb -> setValue(m_text_field.data() ->y ()); ui -> m_y_sb -> setValue(m_text_field.data() ->y ());
@@ -152,7 +156,8 @@ void DynamicTextFieldEditor::updateForm() {
} }
} }
void DynamicTextFieldEditor::setUpConnections() { void DynamicTextFieldEditor::setUpConnections()
{
assert(m_connection_list.isEmpty()); assert(m_connection_list.isEmpty());
//Setup the connection //Setup the connection
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::colorChanged, m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::colorChanged,
@@ -177,7 +182,8 @@ void DynamicTextFieldEditor::setUpConnections() {
[this](){this -> updateForm();}); [this](){this -> updateForm();});
} }
void DynamicTextFieldEditor::disconnectConnections() { void DynamicTextFieldEditor::disconnectConnections()
{
//Remove previous connection //Remove previous connection
if(!m_connection_list.isEmpty()) if(!m_connection_list.isEmpty())
for(const QMetaObject::Connection& con : m_connection_list) { for(const QMetaObject::Connection& con : m_connection_list) {
@@ -190,7 +196,8 @@ void DynamicTextFieldEditor::disconnectConnections() {
@brief DynamicTextFieldEditor::fillInfoComboBox @brief DynamicTextFieldEditor::fillInfoComboBox
Fill the combo box "element information" Fill the combo box "element information"
*/ */
void DynamicTextFieldEditor::fillInfoComboBox() { void DynamicTextFieldEditor::fillInfoComboBox()
{
ui -> m_elmt_info_cb -> clear(); ui -> m_elmt_info_cb -> clear();
QStringList strl; QStringList strl;
@@ -212,7 +219,8 @@ void DynamicTextFieldEditor::fillInfoComboBox() {
ui -> m_elmt_info_cb -> addItem(key, info_map.value(key)); ui -> m_elmt_info_cb -> addItem(key, info_map.value(key));
} }
void DynamicTextFieldEditor::on_m_x_sb_editingFinished() { void DynamicTextFieldEditor::on_m_x_sb_editingFinished()
{
double value = ui -> m_x_sb -> value(); double value = ui -> m_x_sb -> value();
for (int i = 0; i < m_parts.length(); i++) { for (int i = 0; i < m_parts.length(); i++) {
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "x", m_parts[i] -> x(), value); QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "x", m_parts[i] -> x(), value);
@@ -222,7 +230,8 @@ void DynamicTextFieldEditor::on_m_x_sb_editingFinished() {
} }
} }
void DynamicTextFieldEditor::on_m_y_sb_editingFinished() { void DynamicTextFieldEditor::on_m_y_sb_editingFinished()
{
double value = ui -> m_y_sb -> value(); double value = ui -> m_y_sb -> value();
for (int i = 0; i < m_parts.length(); i++) { for (int i = 0; i < m_parts.length(); i++) {
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "y", m_parts[i] -> y(), value); QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "y", m_parts[i] -> y(), value);
@@ -232,7 +241,8 @@ void DynamicTextFieldEditor::on_m_y_sb_editingFinished() {
} }
} }
void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() { void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished()
{
int value = ui -> m_rotation_sb -> value(); int value = ui -> m_rotation_sb -> value();
for (int i = 0; i < m_parts.length(); i++) { for (int i = 0; i < m_parts.length(); i++) {
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "rotation", m_parts[i] -> rotation(), value); QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "rotation", m_parts[i] -> rotation(), value);
@@ -242,7 +252,8 @@ void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() {
} }
} }
void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() { void DynamicTextFieldEditor::on_m_user_text_le_editingFinished()
{
QString text = ui -> m_user_text_le -> text(); QString text = ui -> m_user_text_le -> text();
for (int i = 0; i < m_parts.length(); i++) { for (int i = 0; i < m_parts.length(); i++) {
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "text", m_parts[i] -> text(), text); QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "text", m_parts[i] -> text(), text);
@@ -251,7 +262,8 @@ void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() {
} }
} }
void DynamicTextFieldEditor::on_m_size_sb_editingFinished() { void DynamicTextFieldEditor::on_m_size_sb_editingFinished()
{
QFont font_ = m_text_field -> font(); QFont font_ = m_text_field -> font();
font_.setPointSize(ui -> m_size_sb -> value()); font_.setPointSize(ui -> m_size_sb -> value());
for (int i = 0; i < m_parts.length(); i++) { for (int i = 0; i < m_parts.length(); i++) {
@@ -261,7 +273,8 @@ void DynamicTextFieldEditor::on_m_size_sb_editingFinished() {
} }
} }
void DynamicTextFieldEditor::on_m_frame_cb_clicked() { void DynamicTextFieldEditor::on_m_frame_cb_clicked()
{
bool frame = ui -> m_frame_cb -> isChecked(); bool frame = ui -> m_frame_cb -> isChecked();
for (int i = 0; i < m_parts.length(); i++) { for (int i = 0; i < m_parts.length(); i++) {
@@ -273,7 +286,8 @@ void DynamicTextFieldEditor::on_m_frame_cb_clicked() {
} }
} }
void DynamicTextFieldEditor::on_m_width_sb_editingFinished() { void DynamicTextFieldEditor::on_m_width_sb_editingFinished()
{
qreal width = (qreal)ui -> m_width_sb -> value(); qreal width = (qreal)ui -> m_width_sb -> value();
for (int i = 0; i < m_parts.length(); i++) { for (int i = 0; i < m_parts.length(); i++) {
@@ -335,7 +349,8 @@ void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index) {
} }
} }
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() { void DynamicTextFieldEditor::on_m_composite_text_pb_clicked()
{
CompositeTextEditDialog ctd(m_text_field.data() -> compositeText(), this); CompositeTextEditDialog ctd(m_text_field.data() -> compositeText(), this);
if(ctd.exec()) { if(ctd.exec()) {
QString ct = ctd.plainText(); QString ct = ctd.plainText();
@@ -349,7 +364,8 @@ void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() {
} }
} }
void DynamicTextFieldEditor::on_m_alignment_pb_clicked() { void DynamicTextFieldEditor::on_m_alignment_pb_clicked()
{
AlignmentTextDialog atd(m_text_field.data() -> alignment(), this); AlignmentTextDialog atd(m_text_field.data() -> alignment(), this);
atd.exec(); atd.exec();
@@ -364,7 +380,8 @@ void DynamicTextFieldEditor::on_m_alignment_pb_clicked() {
} }
} }
void DynamicTextFieldEditor::on_m_font_pb_clicked() { void DynamicTextFieldEditor::on_m_font_pb_clicked()
{
bool ok; bool ok;
QFont font_ = QFontDialog::getFont(&ok, m_text_field -> font(), this); QFont font_ = QFontDialog::getFont(&ok, m_text_field -> font(), this);
if (ok && font_ != this -> font()) { if (ok && font_ != this -> font()) {

View File

@@ -48,7 +48,8 @@ PolygonEditor::PolygonEditor(QETElementEditor *editor,
/** /**
@brief PolygonEditor::~PolygonEditor @brief PolygonEditor::~PolygonEditor
*/ */
PolygonEditor::~PolygonEditor() { PolygonEditor::~PolygonEditor()
{
delete ui; delete ui;
} }
@@ -115,11 +116,13 @@ bool PolygonEditor::setPart(CustomElementPart *new_part)
@brief PolygonEditor::currentPart @brief PolygonEditor::currentPart
@return the curent edited part @return the curent edited part
*/ */
CustomElementPart *PolygonEditor::currentPart() const { CustomElementPart *PolygonEditor::currentPart() const
{
return m_part; return m_part;
} }
QList<CustomElementPart*> PolygonEditor::currentParts() const { QList<CustomElementPart*> PolygonEditor::currentParts() const
{
return m_style->currentParts(); return m_style->currentParts();
} }

View File

@@ -42,7 +42,8 @@ RectangleEditor::RectangleEditor(QETElementEditor *editor, PartRectangle *rect,
/** /**
@brief RectangleEditor::~RectangleEditor @brief RectangleEditor::~RectangleEditor
*/ */
RectangleEditor::~RectangleEditor() { RectangleEditor::~RectangleEditor()
{
delete ui; delete ui;
} }
@@ -112,11 +113,13 @@ bool RectangleEditor::setParts(QList <CustomElementPart *> parts)
@brief RectangleEditor::currentPart @brief RectangleEditor::currentPart
@return @return
*/ */
CustomElementPart *RectangleEditor::currentPart() const { CustomElementPart *RectangleEditor::currentPart() const
{
return m_part; return m_part;
} }
QList<CustomElementPart*> RectangleEditor::currentParts() const { QList<CustomElementPart*> RectangleEditor::currentParts() const
{
return m_style->currentParts(); return m_style->currentParts();
} }
@@ -124,7 +127,8 @@ QList<CustomElementPart*> RectangleEditor::currentParts() const {
@brief RectangleEditor::topLeft @brief RectangleEditor::topLeft
@return The edited topLeft already mapped to part coordinate @return The edited topLeft already mapped to part coordinate
*/ */
QPointF RectangleEditor::editedTopLeft() const { QPointF RectangleEditor::editedTopLeft() const
{
return m_part->mapFromScene(ui->m_x_sb->value(), ui->m_y_sb->value()); return m_part->mapFromScene(ui->m_x_sb->value(), ui->m_y_sb->value());
} }

View File

@@ -42,7 +42,8 @@ TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *paren
/** /**
@brief TextEditor::~TextEditor @brief TextEditor::~TextEditor
*/ */
TextEditor::~TextEditor() { TextEditor::~TextEditor()
{
delete ui; delete ui;
} }
@@ -79,14 +80,16 @@ void TextEditor::setUpChangeConnection(QPointer<PartText> part) {
m_change_connection << connect(part, &PartText::colorChanged, this, &TextEditor::updateForm); m_change_connection << connect(part, &PartText::colorChanged, this, &TextEditor::updateForm);
} }
void TextEditor::disconnectChangeConnection() { void TextEditor::disconnectChangeConnection()
{
for (QMetaObject::Connection c : m_change_connection) { for (QMetaObject::Connection c : m_change_connection) {
disconnect(c); disconnect(c);
} }
m_change_connection.clear(); m_change_connection.clear();
} }
void TextEditor::disconnectEditConnection() { void TextEditor::disconnectEditConnection()
{
for (QMetaObject::Connection c : m_edit_connection) { for (QMetaObject::Connection c : m_edit_connection) {
disconnect(c); disconnect(c);
} }
@@ -150,11 +153,13 @@ bool TextEditor::setParts(QList <CustomElementPart *> parts) {
@brief TextEditor::currentPart @brief TextEditor::currentPart
@return The current part @return The current part
*/ */
CustomElementPart *TextEditor::currentPart() const { CustomElementPart *TextEditor::currentPart() const
{
return m_text; return m_text;
} }
QList<CustomElementPart*> TextEditor::currentParts() const { QList<CustomElementPart*> TextEditor::currentParts() const
{
QList<CustomElementPart*> parts; QList<CustomElementPart*> parts;
for (auto part: m_parts) { for (auto part: m_parts) {
parts.append(static_cast<CustomElementPart*>(part)); parts.append(static_cast<CustomElementPart*>(part));
@@ -167,7 +172,8 @@ QList<CustomElementPart*> TextEditor::currentParts() const {
Setup the connection between the widgets of this editor and the undo command Setup the connection between the widgets of this editor and the undo command
use to apply the change to the edited text. use to apply the change to the edited text.
*/ */
void TextEditor::setUpEditConnection() { void TextEditor::setUpEditConnection()
{
disconnectEditConnection(); disconnectEditConnection();
m_edit_connection << connect(ui -> m_line_edit, &QLineEdit::editingFinished, [this]() { m_edit_connection << connect(ui -> m_line_edit, &QLineEdit::editingFinished, [this]() {
@@ -236,7 +242,8 @@ void TextEditor::setUpEditConnection() {
/** /**
@brief TextEditor::on_m_font_pb_clicked @brief TextEditor::on_m_font_pb_clicked
*/ */
void TextEditor::on_m_font_pb_clicked() { void TextEditor::on_m_font_pb_clicked()
{
bool ok; bool ok;
QFont font_ = QFontDialog::getFont(&ok, m_text -> font(), this); QFont font_ = QFontDialog::getFont(&ok, m_text -> font(), this);

View File

@@ -72,7 +72,8 @@ QList <Element *> ElementProvider::freeElement(const int filter) const{
@param uuid_list list of uuid must be found @param uuid_list list of uuid must be found
@return all elements with uuid corresponding to uuid in uuid_list @return all elements with uuid corresponding to uuid in uuid_list
*/ */
QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const { QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const
{
QList <Element *> found_element; QList <Element *> found_element;
foreach (Diagram *d, m_diagram_list) { foreach (Diagram *d, m_diagram_list) {
@@ -93,7 +94,8 @@ QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const {
the filter for search element the filter for search element
(You can find all filter with the define in Element.h) (You can find all filter with the define in Element.h)
*/ */
QList <Element *> ElementProvider::find(const int filter) const { QList <Element *> ElementProvider::find(const int filter) const
{
QList <Element *> elmt_; QList <Element *> elmt_;
//serch in all diagram //serch in all diagram

View File

@@ -87,7 +87,8 @@ ElementsCategoryEditor::ElementsCategoryEditor(const ElementsLocation &location,
@brief ElementsCategoryEditor::~ElementsCategoryEditor @brief ElementsCategoryEditor::~ElementsCategoryEditor
Destructor Destructor
*/ */
ElementsCategoryEditor::~ElementsCategoryEditor() { ElementsCategoryEditor::~ElementsCategoryEditor()
{
} }
/** /**

View File

@@ -104,7 +104,8 @@ ElementsCollectionCache::ElementsCollectionCache(const QString &database_path, Q
/** /**
Destructor Destructor
*/ */
ElementsCollectionCache::~ElementsCollectionCache() { ElementsCollectionCache::~ElementsCollectionCache()
{
delete select_name_; delete select_name_;
delete select_pixmap_; delete select_pixmap_;
delete insert_name_; delete insert_name_;
@@ -123,7 +124,8 @@ void ElementsCollectionCache::setLocale(const QString &locale) {
/** /**
@return The locale to be used when dealing with names. @return The locale to be used when dealing with names.
*/ */
QString ElementsCollectionCache::locale() const { QString ElementsCollectionCache::locale() const
{
return(locale_); return(locale_);
} }
@@ -145,7 +147,8 @@ bool ElementsCollectionCache::setPixmapStorageFormat(const QString &format) {
@return the pixmap storage format. Default is "PNG" @return the pixmap storage format. Default is "PNG"
@see setPixmapStorageFormat() @see setPixmapStorageFormat()
*/ */
QString ElementsCollectionCache::pixmapStorageFormat() const { QString ElementsCollectionCache::pixmapStorageFormat() const
{
return(pixmap_storage_format_); return(pixmap_storage_format_);
} }
@@ -190,14 +193,16 @@ bool ElementsCollectionCache::fetchElement(ElementsLocation &location)
/** /**
@return The last name fetched through fetchElement(). @return The last name fetched through fetchElement().
*/ */
QString ElementsCollectionCache::name() const { QString ElementsCollectionCache::name() const
{
return(current_name_); return(current_name_);
} }
/** /**
@return The last pixmap fetched through fetchElement(). @return The last pixmap fetched through fetchElement().
*/ */
QPixmap ElementsCollectionCache::pixmap() const { QPixmap ElementsCollectionCache::pixmap() const
{
return(current_pixmap_); return(current_pixmap_);
} }

View File

@@ -43,7 +43,8 @@ ElementsMover::ElementsMover() :
/** /**
@brief ElementsMover::~ElementsMover Destructor @brief ElementsMover::~ElementsMover Destructor
*/ */
ElementsMover::~ElementsMover() { ElementsMover::~ElementsMover()
{
} }
/** /**
@@ -51,7 +52,8 @@ ElementsMover::~ElementsMover() {
@return True if this element mover is ready to be used. @return True if this element mover is ready to be used.
A element mover is ready when the previous managed movement is finish. A element mover is ready when the previous managed movement is finish.
*/ */
bool ElementsMover::isReady() const { bool ElementsMover::isReady() const
{
return(!movement_running_); return(!movement_running_);
} }

View File

@@ -74,7 +74,8 @@ ElementsPanel::ElementsPanel(QWidget *parent) :
/** /**
Destructeur Destructeur
*/ */
ElementsPanel::~ElementsPanel() { ElementsPanel::~ElementsPanel()
{
} }
/** /**
@@ -111,7 +112,8 @@ void ElementsPanel::startTitleBlockTemplateDrag(const TitleBlockTemplateLocation
/** /**
Ensure the filter is applied again after the panel content has changed. Ensure the filter is applied again after the panel content has changed.
*/ */
void ElementsPanel::panelContentChange() { void ElementsPanel::panelContentChange()
{
if (!filter_.isEmpty()) { if (!filter_.isEmpty()) {
filter(filter_); filter(filter_);
} }
@@ -373,7 +375,8 @@ void ElementsPanel::projectWasClosed(QETProject *project) {
/** /**
Build filter list for multiple filter Build filter list for multiple filter
*/ */
void ElementsPanel::buildFilterList() { void ElementsPanel::buildFilterList()
{
if (filter_.isEmpty()) return; if (filter_.isEmpty()) return;
filter_list_ = filter_.split( '+' ); filter_list_ = filter_.split( '+' );
/* /*

View File

@@ -124,14 +124,16 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
/** /**
Destructeur Destructeur
*/ */
ElementsPanelWidget::~ElementsPanelWidget() { ElementsPanelWidget::~ElementsPanelWidget()
{
} }
/** /**
Require the desktop environment to open the directory containing the file Require the desktop environment to open the directory containing the file
represented by the selected item, if any. represented by the selected item, if any.
*/ */
void ElementsPanelWidget::openDirectoryForSelectedItem() { void ElementsPanelWidget::openDirectoryForSelectedItem()
{
if (QTreeWidgetItem *qtwi = elements_panel -> currentItem()) { if (QTreeWidgetItem *qtwi = elements_panel -> currentItem()) {
QString dir_path = elements_panel -> dirPathForItem(qtwi); QString dir_path = elements_panel -> dirPathForItem(qtwi);
if (!dir_path.isEmpty()) { if (!dir_path.isEmpty()) {
@@ -144,7 +146,8 @@ void ElementsPanelWidget::openDirectoryForSelectedItem() {
Copy the full path to the file represented by the selected item to the Copy the full path to the file represented by the selected item to the
clipboard. clipboard.
*/ */
void ElementsPanelWidget::copyPathForSelectedItem() { void ElementsPanelWidget::copyPathForSelectedItem()
{
if (QTreeWidgetItem *qtwi = elements_panel -> currentItem()) { if (QTreeWidgetItem *qtwi = elements_panel -> currentItem()) {
QString file_path = elements_panel -> filePathForItem(qtwi); QString file_path = elements_panel -> filePathForItem(qtwi);
file_path = QDir::toNativeSeparators(file_path); file_path = QDir::toNativeSeparators(file_path);
@@ -157,7 +160,8 @@ void ElementsPanelWidget::copyPathForSelectedItem() {
/** /**
Recharge le panel d'elements Recharge le panel d'elements
*/ */
void ElementsPanelWidget::reloadAndFilter() { void ElementsPanelWidget::reloadAndFilter()
{
// recharge tous les elements // recharge tous les elements
elements_panel -> reload(); elements_panel -> reload();
// reapplique le filtre // reapplique le filtre
@@ -169,7 +173,8 @@ void ElementsPanelWidget::reloadAndFilter() {
/** /**
* Emit the requestForProject signal with te selected project * Emit the requestForProject signal with te selected project
*/ */
void ElementsPanelWidget::activateProject() { void ElementsPanelWidget::activateProject()
{
if (QETProject *selected_project = elements_panel -> selectedProject()) { if (QETProject *selected_project = elements_panel -> selectedProject()) {
emit(requestForProject(selected_project)); emit(requestForProject(selected_project));
} }
@@ -178,7 +183,8 @@ void ElementsPanelWidget::activateProject() {
/** /**
Emet le signal requestForProjectClosing avec le projet selectionne Emet le signal requestForProjectClosing avec le projet selectionne
*/ */
void ElementsPanelWidget::closeProject() { void ElementsPanelWidget::closeProject()
{
if (QETProject *selected_project = elements_panel -> selectedProject()) { if (QETProject *selected_project = elements_panel -> selectedProject()) {
emit(requestForProjectClosing(selected_project)); emit(requestForProjectClosing(selected_project));
} }
@@ -187,7 +193,8 @@ void ElementsPanelWidget::closeProject() {
/** /**
Emet le signal requestForProjectPropertiesEdition avec le projet selectionne Emet le signal requestForProjectPropertiesEdition avec le projet selectionne
*/ */
void ElementsPanelWidget::editProjectProperties() { void ElementsPanelWidget::editProjectProperties()
{
if (QETProject *selected_project = elements_panel -> selectedProject()) { if (QETProject *selected_project = elements_panel -> selectedProject()) {
emit(requestForProjectPropertiesEdition(selected_project)); emit(requestForProjectPropertiesEdition(selected_project));
} }
@@ -196,7 +203,8 @@ void ElementsPanelWidget::editProjectProperties() {
/** /**
Emet le signal requestForDiagramPropertiesEdition avec le schema selectionne Emet le signal requestForDiagramPropertiesEdition avec le schema selectionne
*/ */
void ElementsPanelWidget::editDiagramProperties() { void ElementsPanelWidget::editDiagramProperties()
{
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramPropertiesEdition(selected_diagram)); emit(requestForDiagramPropertiesEdition(selected_diagram));
} }
@@ -205,7 +213,8 @@ void ElementsPanelWidget::editDiagramProperties() {
/** /**
Emet le signal requestForNewDiagram avec le projet selectionne Emet le signal requestForNewDiagram avec le projet selectionne
*/ */
void ElementsPanelWidget::newDiagram() { void ElementsPanelWidget::newDiagram()
{
if (QETProject *selected_project = elements_panel -> selectedProject()) { if (QETProject *selected_project = elements_panel -> selectedProject()) {
emit(requestForNewDiagram(selected_project)); emit(requestForNewDiagram(selected_project));
} }
@@ -214,7 +223,8 @@ void ElementsPanelWidget::newDiagram() {
/** /**
Emet le signal requestForDiagramDeletion avec le schema selectionne Emet le signal requestForDiagramDeletion avec le schema selectionne
*/ */
void ElementsPanelWidget::deleteDiagram() { void ElementsPanelWidget::deleteDiagram()
{
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramDeletion(selected_diagram)); emit(requestForDiagramDeletion(selected_diagram));
} }
@@ -223,7 +233,8 @@ void ElementsPanelWidget::deleteDiagram() {
/** /**
Emet le signal requestForDiagramMoveUpTop avec le schema selectionne Emet le signal requestForDiagramMoveUpTop avec le schema selectionne
+*/ +*/
void ElementsPanelWidget::moveDiagramUpTop() { void ElementsPanelWidget::moveDiagramUpTop()
{
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramMoveUpTop(selected_diagram)); emit(requestForDiagramMoveUpTop(selected_diagram));
} }
@@ -234,7 +245,8 @@ void ElementsPanelWidget::moveDiagramUpTop() {
/** /**
Emet le signal requestForDiagramMoveUp avec le schema selectionne Emet le signal requestForDiagramMoveUp avec le schema selectionne
*/ */
void ElementsPanelWidget::moveDiagramUp() { void ElementsPanelWidget::moveDiagramUp()
{
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramMoveUp(selected_diagram)); emit(requestForDiagramMoveUp(selected_diagram));
} }
@@ -243,7 +255,8 @@ void ElementsPanelWidget::moveDiagramUp() {
/** /**
Emet le signal requestForDiagramMoveDown avec le schema selectionne Emet le signal requestForDiagramMoveDown avec le schema selectionne
*/ */
void ElementsPanelWidget::moveDiagramDown() { void ElementsPanelWidget::moveDiagramDown()
{
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramMoveDown(selected_diagram)); emit(requestForDiagramMoveDown(selected_diagram));
} }
@@ -252,7 +265,8 @@ void ElementsPanelWidget::moveDiagramDown() {
/** /**
Emet le signal requestForDiagramMoveUpx10 avec le schema selectionne Emet le signal requestForDiagramMoveUpx10 avec le schema selectionne
*/ */
void ElementsPanelWidget::moveDiagramUpx10() { void ElementsPanelWidget::moveDiagramUpx10()
{
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramMoveUpx10(selected_diagram)); emit(requestForDiagramMoveUpx10(selected_diagram));
} }
@@ -261,7 +275,8 @@ void ElementsPanelWidget::moveDiagramUpx10() {
/** /**
Emet le signal requestForDiagramMoveDownx10 avec le schema selectionne Emet le signal requestForDiagramMoveDownx10 avec le schema selectionne
*/ */
void ElementsPanelWidget::moveDiagramDownx10() { void ElementsPanelWidget::moveDiagramDownx10()
{
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
emit(requestForDiagramMoveDownx10(selected_diagram)); emit(requestForDiagramMoveDownx10(selected_diagram));
} }
@@ -271,7 +286,8 @@ void ElementsPanelWidget::moveDiagramDownx10() {
/** /**
Opens a template editor to create a new title block template. Opens a template editor to create a new title block template.
*/ */
void ElementsPanelWidget::addTitleBlockTemplate() { void ElementsPanelWidget::addTitleBlockTemplate()
{
QTreeWidgetItem *current_item = elements_panel -> currentItem(); QTreeWidgetItem *current_item = elements_panel -> currentItem();
if (!current_item) return; if (!current_item) return;
@@ -285,7 +301,8 @@ void ElementsPanelWidget::addTitleBlockTemplate() {
/** /**
Opens an editor to edit the currently selected title block template, if any. Opens an editor to edit the currently selected title block template, if any.
*/ */
void ElementsPanelWidget::editTitleBlockTemplate() { void ElementsPanelWidget::editTitleBlockTemplate()
{
QTreeWidgetItem *current_item = elements_panel -> currentItem(); QTreeWidgetItem *current_item = elements_panel -> currentItem();
if (current_item && current_item -> type() == QET::TitleBlockTemplate) { if (current_item && current_item -> type() == QET::TitleBlockTemplate) {
QETApp::instance() -> openTitleBlockTemplate( QETApp::instance() -> openTitleBlockTemplate(
@@ -297,7 +314,8 @@ void ElementsPanelWidget::editTitleBlockTemplate() {
/** /**
Delete the currently selected title block template, if any. Delete the currently selected title block template, if any.
*/ */
void ElementsPanelWidget::removeTitleBlockTemplate() { void ElementsPanelWidget::removeTitleBlockTemplate()
{
QTreeWidgetItem *current_item = elements_panel -> currentItem(); QTreeWidgetItem *current_item = elements_panel -> currentItem();
if (current_item && current_item -> type() == QET::TitleBlockTemplate) { if (current_item && current_item -> type() == QET::TitleBlockTemplate) {
TitleBlockTemplateDeleter( TitleBlockTemplateDeleter(
@@ -310,7 +328,8 @@ void ElementsPanelWidget::removeTitleBlockTemplate() {
/** /**
Met a jour les boutons afin d'assurer la coherence de l'interface Met a jour les boutons afin d'assurer la coherence de l'interface
*/ */
void ElementsPanelWidget::updateButtons() { void ElementsPanelWidget::updateButtons()
{
QTreeWidgetItem *current_item = elements_panel -> currentItem(); QTreeWidgetItem *current_item = elements_panel -> currentItem();
int current_type = elements_panel -> currentItemType(); int current_type = elements_panel -> currentItemType();

View File

@@ -107,7 +107,8 @@ class ElementsPanelWidget : public QWidget {
@brief ElementsPanelWidget::elementsPanel @brief ElementsPanelWidget::elementsPanel
@return The elements panel embedded within this widget. @return The elements panel embedded within this widget.
*/ */
inline ElementsPanel &ElementsPanelWidget::elementsPanel() const { inline ElementsPanel &ElementsPanelWidget::elementsPanel() const
{
return(*elements_panel); return(*elements_panel);
} }

View File

@@ -25,14 +25,16 @@
/** /**
@brief ElementTextsMover::ElementTextsMover @brief ElementTextsMover::ElementTextsMover
*/ */
ElementTextsMover::ElementTextsMover() {} ElementTextsMover::ElementTextsMover()
{}
/** /**
@brief ElementTextsMover::isReady @brief ElementTextsMover::isReady
@return true if this ElementTextsMover is ready to process a new movement. @return true if this ElementTextsMover is ready to process a new movement.
False if this ElementTextsMover is actually process a movement False if this ElementTextsMover is actually process a movement
*/ */
bool ElementTextsMover::isReady() const { bool ElementTextsMover::isReady() const
{
return(!m_movement_running); return(!m_movement_running);
} }

View File

@@ -43,7 +43,10 @@
@param project Le projet a exporter @param project Le projet a exporter
@param parent Le Widget parent de ce dialogue @param parent Le Widget parent de ce dialogue
*/ */
ExportDialog::ExportDialog(QETProject *project, QWidget *parent) : QDialog(parent) { ExportDialog::ExportDialog(
QETProject *project,
QWidget *parent) : QDialog(parent)
{
if (!project) return; if (!project) return;
// recupere le projet a exporter // recupere le projet a exporter
@@ -105,13 +108,15 @@ ExportDialog::ExportDialog(QETProject *project, QWidget *parent) : QDialog(paren
/** /**
Destructeur - ne fait rien Destructeur - ne fait rien
*/ */
ExportDialog::~ExportDialog() { ExportDialog::~ExportDialog()
{
} }
/** /**
@return le nombre de schemas coches (donc a exporter) @return le nombre de schemas coches (donc a exporter)
*/ */
int ExportDialog::diagramsToExportCount() const { int ExportDialog::diagramsToExportCount() const
{
int checked_diagrams_count = 0; int checked_diagrams_count = 0;
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) { foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
if (diagram_line -> must_export -> isChecked()) ++ checked_diagrams_count; if (diagram_line -> must_export -> isChecked()) ++ checked_diagrams_count;
@@ -123,7 +128,8 @@ int ExportDialog::diagramsToExportCount() const {
Met en place la liste des schemas Met en place la liste des schemas
@return Le widget representant la liste des schemas @return Le widget representant la liste des schemas
*/ */
QWidget *ExportDialog::initDiagramsListPart() { QWidget *ExportDialog::initDiagramsListPart()
{
preview_mapper_ = new QSignalMapper(this); preview_mapper_ = new QSignalMapper(this);
width_mapper_ = new QSignalMapper(this); width_mapper_ = new QSignalMapper(this);
height_mapper_ = new QSignalMapper(this); height_mapper_ = new QSignalMapper(this);
@@ -186,13 +192,15 @@ QWidget *ExportDialog::initDiagramsListPart() {
return(scroll_diagrams_list); return(scroll_diagrams_list);
} }
void ExportDialog::slot_selectAllClicked() { void ExportDialog::slot_selectAllClicked()
{
foreach (ExportDiagramLine *diagramLine, diagram_lines_) { foreach (ExportDiagramLine *diagramLine, diagram_lines_) {
diagramLine -> must_export -> setChecked(true); diagramLine -> must_export -> setChecked(true);
} }
} }
void ExportDialog::slot_deSelectAllClicked() { void ExportDialog::slot_deSelectAllClicked()
{
foreach (ExportDiagramLine *diagramLine, diagram_lines_) { foreach (ExportDiagramLine *diagramLine, diagram_lines_) {
diagramLine -> must_export -> setChecked(false); diagramLine -> must_export -> setChecked(false);
} }
@@ -204,7 +212,8 @@ void ExportDialog::slot_deSelectAllClicked() {
@param diagram Un schema @param diagram Un schema
@return le rapport largeur / hauteur du schema @return le rapport largeur / hauteur du schema
*/ */
qreal ExportDialog::diagramRatio(Diagram *diagram) { qreal ExportDialog::diagramRatio(Diagram *diagram)
{
QSize diagram_size = diagramSize(diagram); QSize diagram_size = diagramSize(diagram);
qreal diagram_ratio = (qreal)diagram_size.width() / (qreal)diagram_size.height(); qreal diagram_ratio = (qreal)diagram_size.width() / (qreal)diagram_size.height();
return(diagram_ratio); return(diagram_ratio);
@@ -215,7 +224,8 @@ qreal ExportDialog::diagramRatio(Diagram *diagram) {
@return les dimensions du schema, en tenant compte du type d'export : cadre @return les dimensions du schema, en tenant compte du type d'export : cadre
ou elements ou elements
*/ */
QSize ExportDialog::diagramSize(Diagram *diagram) { QSize ExportDialog::diagramSize(Diagram *diagram)
{
// sauvegarde le parametre useBorder du schema // sauvegarde le parametre useBorder du schema
bool state_useBorder = diagram -> useBorder(); bool state_useBorder = diagram -> useBorder();
@@ -235,7 +245,8 @@ QSize ExportDialog::diagramSize(Diagram *diagram) {
activee pour ce schema. activee pour ce schema.
@param diagram_id numero du schema concerne @param diagram_id numero du schema concerne
*/ */
void ExportDialog::slot_correctWidth(int diagram_id) { void ExportDialog::slot_correctWidth(int diagram_id)
{
// recupere l'ExportDiagramLine concernee // recupere l'ExportDiagramLine concernee
ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id];
if (!current_diagram) return; if (!current_diagram) return;
@@ -258,7 +269,8 @@ void ExportDialog::slot_correctWidth(int diagram_id) {
activee pour ce schema. activee pour ce schema.
@param diagram_id numero du schema concerne @param diagram_id numero du schema concerne
*/ */
void ExportDialog::slot_correctHeight(int diagram_id) { void ExportDialog::slot_correctHeight(int diagram_id)
{
// recupere l'ExportDiagramLine concernee // recupere l'ExportDiagramLine concernee
ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id];
if (!current_diagram) return; if (!current_diagram) return;
@@ -280,7 +292,8 @@ void ExportDialog::slot_correctHeight(int diagram_id) {
proportions d'un des schemas proportions d'un des schemas
@param diagram_id numero du schema concerne @param diagram_id numero du schema concerne
*/ */
void ExportDialog::slot_keepRatioChanged(int diagram_id) { void ExportDialog::slot_keepRatioChanged(int diagram_id)
{
// recupere l'ExportDiagramLine concernee // recupere l'ExportDiagramLine concernee
ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id];
if (!current_diagram) return; if (!current_diagram) return;
@@ -303,7 +316,8 @@ void ExportDialog::slot_keepRatioChanged(int diagram_id) {
Reinitialise les dimensions d'un des schemas Reinitialise les dimensions d'un des schemas
@param diagram_id numero du schema concerne @param diagram_id numero du schema concerne
*/ */
void ExportDialog::slot_resetSize(int diagram_id) { void ExportDialog::slot_resetSize(int diagram_id)
{
// recupere l'ExportDiagramLine concernee // recupere l'ExportDiagramLine concernee
ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id];
if (!current_diagram) return; if (!current_diagram) return;
@@ -328,7 +342,12 @@ void ExportDialog::slot_resetSize(int diagram_id) {
@param keep_aspect_ratio True pour conserver le ratio, false sinon @param keep_aspect_ratio True pour conserver le ratio, false sinon
@return l'image a exporter @return l'image a exporter
*/ */
QImage ExportDialog::generateImage(Diagram *diagram, int width, int height, bool keep_aspect_ratio) { QImage ExportDialog::generateImage(
Diagram *diagram,
int width,
int height,
bool keep_aspect_ratio)
{
saveReloadDiagramParameters(diagram, true); saveReloadDiagramParameters(diagram, true);
QImage image(width, height, QImage::Format_RGB32); QImage image(width, height, QImage::Format_RGB32);
@@ -370,7 +389,13 @@ void ExportDialog::saveReloadDiagramParameters(Diagram *diagram, bool save) {
@param keep_aspect_ratio True pour conserver le ratio, false sinon @param keep_aspect_ratio True pour conserver le ratio, false sinon
@param io_device Peripherique de sortie pour le code SVG (souvent : un fichier) @param io_device Peripherique de sortie pour le code SVG (souvent : un fichier)
*/ */
void ExportDialog::generateSvg(Diagram *diagram, int width, int height, bool keep_aspect_ratio, QIODevice &io_device) { void ExportDialog::generateSvg(
Diagram *diagram,
int width,
int height,
bool keep_aspect_ratio,
QIODevice &io_device)
{
saveReloadDiagramParameters(diagram, true); saveReloadDiagramParameters(diagram, true);
// genere une QPicture a partir du schema // genere une QPicture a partir du schema
@@ -399,10 +424,12 @@ void ExportDialog::generateSvg(Diagram *diagram, int width, int height, bool kee
@param height Hauteur de l'export DXF @param height Hauteur de l'export DXF
@param file_path @param file_path
*/ */
void ExportDialog::generateDxf(Diagram *diagram, void ExportDialog::generateDxf(
Diagram *diagram,
int width, int width,
int height, int height,
QString &file_path) { QString &file_path)
{
saveReloadDiagramParameters(diagram, true); saveReloadDiagramParameters(diagram, true);
width -= 2*Diagram::margin; width -= 2*Diagram::margin;
@@ -691,7 +718,8 @@ QPointF ExportDialog::rotation_transformed(qreal px,
/** /**
Slot effectuant les exports apres la validation du dialogue. Slot effectuant les exports apres la validation du dialogue.
*/ */
void ExportDialog::slot_export() { void ExportDialog::slot_export()
{
// recupere la liste des schemas a exporter // recupere la liste des schemas a exporter
QList<ExportDiagramLine *> diagrams_to_export; QList<ExportDiagramLine *> diagrams_to_export;
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) { foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
@@ -817,7 +845,8 @@ void ExportDialog::exportDiagram(ExportDiagramLine *diagram_line) {
Slot appele lorsque l'utilisateur change la zone du schema qui doit etre Slot appele lorsque l'utilisateur change la zone du schema qui doit etre
exportee. Il faut alors ajuster les dimensions des schemas. exportee. Il faut alors ajuster les dimensions des schemas.
*/ */
void ExportDialog::slot_changeUseBorder() { void ExportDialog::slot_changeUseBorder()
{
// parcourt les schemas a exporter // parcourt les schemas a exporter
foreach(int diagram_id, diagram_lines_.keys()) { foreach(int diagram_id, diagram_lines_.keys()) {
ExportDiagramLine *diagram_line = diagram_lines_[diagram_id]; ExportDiagramLine *diagram_line = diagram_lines_[diagram_id];
@@ -835,7 +864,8 @@ void ExportDialog::slot_changeUseBorder() {
schemas coches, et il garde au plus un schema coche si on exporte vers schemas coches, et il garde au plus un schema coche si on exporte vers
le presse-papier. le presse-papier.
*/ */
void ExportDialog::slot_checkDiagramsCount() { void ExportDialog::slot_checkDiagramsCount()
{
QPushButton *export_button = buttons -> button(QDialogButtonBox::Save); QPushButton *export_button = buttons -> button(QDialogButtonBox::Save);
export_button -> setEnabled(diagramsToExportCount()); export_button -> setEnabled(diagramsToExportCount());
} }
@@ -1022,14 +1052,16 @@ ExportDialog::ExportDiagramLine::ExportDiagramLine(Diagram *dia, QSize diagram_s
/** /**
Destructeur Destructeur
*/ */
ExportDialog::ExportDiagramLine::~ExportDiagramLine() { ExportDialog::ExportDiagramLine::~ExportDiagramLine()
{
} }
/** /**
@return un layout contenant les widgets necessaires a la gestion de la @return un layout contenant les widgets necessaires a la gestion de la
taille d'un schema avant son export. taille d'un schema avant son export.
*/ */
QBoxLayout *ExportDialog::ExportDiagramLine::sizeLayout() { QBoxLayout *ExportDialog::ExportDiagramLine::sizeLayout()
{
QHBoxLayout *layout = new QHBoxLayout(); QHBoxLayout *layout = new QHBoxLayout();
layout -> addWidget(width); layout -> addWidget(width);
layout -> addWidget(x_label); layout -> addWidget(x_label);

View File

@@ -29,21 +29,19 @@ class ExportPropertiesWidget;
*/ */
class ExportDialog : public QDialog { class ExportDialog : public QDialog {
Q_OBJECT Q_OBJECT
// constructors, destructor
public: public:
// constructors, destructor
ExportDialog(QETProject *, QWidget * = nullptr); ExportDialog(QETProject *, QWidget * = nullptr);
~ExportDialog() override; ~ExportDialog() override;
private:
ExportDialog(const ExportDialog &);
// methods // methods
public:
int diagramsToExportCount() const; int diagramsToExportCount() const;
static QPointF rotation_transformed(qreal, qreal, qreal, qreal, qreal); static QPointF rotation_transformed(qreal, qreal, qreal, qreal, qreal);
private: private:
ExportDialog(const ExportDialog &);
class ExportDiagramLine { class ExportDiagramLine {
public: public:
ExportDiagramLine(Diagram *, QSize); ExportDiagramLine(Diagram *, QSize);
@@ -85,7 +83,6 @@ class ExportDialog : public QDialog {
QETProject *project_; QETProject *project_;
// methods // methods
private:
QWidget *initDiagramsListPart(); QWidget *initDiagramsListPart();
void saveReloadDiagramParameters(Diagram *, bool = true); void saveReloadDiagramParameters(Diagram *, bool = true);
void generateSvg(Diagram *, int, int, bool, QIODevice &); void generateSvg(Diagram *, int, int, bool, QIODevice &);

View File

@@ -44,7 +44,8 @@ ExportProperties::ExportProperties() :
/** /**
Destructeur Destructeur
*/ */
ExportProperties::~ExportProperties() { ExportProperties::~ExportProperties()
{
} }
/** /**
@@ -53,7 +54,8 @@ ExportProperties::~ExportProperties() {
@param prefix prefixe a ajouter devant les noms des parametres @param prefix prefixe a ajouter devant les noms des parametres
*/ */
void ExportProperties::toSettings(QSettings &settings, void ExportProperties::toSettings(QSettings &settings,
const QString &prefix) const { const QString &prefix) const
{
settings.setValue(prefix + "path", settings.setValue(prefix + "path",
QDir::toNativeSeparators( QDir::toNativeSeparators(
destination_directory.absolutePath())); destination_directory.absolutePath()));

View File

@@ -45,14 +45,16 @@ ExportPropertiesWidget::ExportPropertiesWidget(const ExportProperties &export_pr
@brief ExportPropertiesWidget::~ExportPropertiesWidget @brief ExportPropertiesWidget::~ExportPropertiesWidget
Destructeur Destructeur
*/ */
ExportPropertiesWidget::~ExportPropertiesWidget() { ExportPropertiesWidget::~ExportPropertiesWidget()
{
} }
/** /**
@brief ExportPropertiesWidget::exportProperties @brief ExportPropertiesWidget::exportProperties
@return les parametres d'export definis via le widget @return les parametres d'export definis via le widget
*/ */
ExportProperties ExportPropertiesWidget::exportProperties() const { ExportProperties ExportPropertiesWidget::exportProperties() const
{
ExportProperties export_properties; ExportProperties export_properties;
export_properties.destination_directory = QDir(dirpath -> text()); export_properties.destination_directory = QDir(dirpath -> text());
@@ -120,7 +122,8 @@ void ExportPropertiesWidget::setPrintingMode(bool mode) {
Slot asking the user to choose a folder Slot asking the user to choose a folder
/ Slot demandant a l'utilisateur de choisir un dossier / Slot demandant a l'utilisateur de choisir un dossier
*/ */
void ExportPropertiesWidget::slot_chooseADirectory() { void ExportPropertiesWidget::slot_chooseADirectory()
{
QString user_dir = QFileDialog::getExistingDirectory( QString user_dir = QFileDialog::getExistingDirectory(
this, this,
tr("Exporter dans le dossier", "dialog title"), tr("Exporter dans le dossier", "dialog title"),
@@ -136,7 +139,8 @@ void ExportPropertiesWidget::slot_chooseADirectory() {
Generated the ExportPropertiesWidget ui Generated the ExportPropertiesWidget ui
/ Cette methode construit le widget en lui-meme / Cette methode construit le widget en lui-meme
*/ */
void ExportPropertiesWidget::build() { void ExportPropertiesWidget::build()
{
// le dialogue est un empilement vertical d'elements // le dialogue est un empilement vertical d'elements
QVBoxLayout *vboxLayout = new QVBoxLayout(); QVBoxLayout *vboxLayout = new QVBoxLayout();
vboxLayout -> setContentsMargins(0, 0, 0, 0); vboxLayout -> setContentsMargins(0, 0, 0, 0);

View File

@@ -126,7 +126,8 @@ ElementPictureFactory::primitives ElementPictureFactory::getPrimitives(
return m_primitives_H.value(location.uuid()); return m_primitives_H.value(location.uuid());
} }
ElementPictureFactory::~ElementPictureFactory() { ElementPictureFactory::~ElementPictureFactory()
{
for (primitives p : m_primitives_H.values()) { for (primitives p : m_primitives_H.values()) {
qDeleteAll(p.m_texts); qDeleteAll(p.m_texts);
} }

View File

@@ -48,7 +48,8 @@ AddTableDialog::AddTableDialog(QWidget *content_widget, QWidget *parent) :
/** /**
@brief AddTableDialog::~AddNomenclatureDialog @brief AddTableDialog::~AddNomenclatureDialog
*/ */
AddTableDialog::~AddTableDialog() { AddTableDialog::~AddTableDialog()
{
delete ui; delete ui;
} }
@@ -65,7 +66,8 @@ void AddTableDialog::setQueryWidget(QWidget *widget) {
@brief AddTableDialog::adjustTableToFolio @brief AddTableDialog::adjustTableToFolio
@return @return
*/ */
bool AddTableDialog::adjustTableToFolio() const { bool AddTableDialog::adjustTableToFolio() const
{
return ui->m_adjust_table_size_cb->isChecked(); return ui->m_adjust_table_size_cb->isChecked();
} }
@@ -73,7 +75,8 @@ bool AddTableDialog::adjustTableToFolio() const {
@brief AddTableDialog::addNewTableToNewDiagram @brief AddTableDialog::addNewTableToNewDiagram
@return @return
*/ */
bool AddTableDialog::addNewTableToNewDiagram() const { bool AddTableDialog::addNewTableToNewDiagram() const
{
return ui->m_add_table_and_folio->isChecked(); return ui->m_add_table_and_folio->isChecked();
} }
@@ -81,7 +84,8 @@ bool AddTableDialog::addNewTableToNewDiagram() const {
@brief AddTableDialog::tableName @brief AddTableDialog::tableName
@return @return
*/ */
QString AddTableDialog::tableName() const { QString AddTableDialog::tableName() const
{
return ui->m_table_name_le->text(); return ui->m_table_name_le->text();
} }
@@ -89,7 +93,8 @@ QString AddTableDialog::tableName() const {
@brief AddTableDialog::headerMargins @brief AddTableDialog::headerMargins
@return @return
*/ */
QMargins AddTableDialog::headerMargins() const { QMargins AddTableDialog::headerMargins() const
{
return m_header_margins; return m_header_margins;
} }
@@ -113,7 +118,8 @@ Qt::Alignment AddTableDialog::headerAlignment() const
@brief AddTableDialog::headerFont @brief AddTableDialog::headerFont
@return @return
*/ */
QFont AddTableDialog::headerFont() const { QFont AddTableDialog::headerFont() const
{
return m_header_font; return m_header_font;
} }
@@ -121,7 +127,8 @@ QFont AddTableDialog::headerFont() const {
@brief AddTableDialog::tableMargins @brief AddTableDialog::tableMargins
@return @return
*/ */
QMargins AddTableDialog::tableMargins() const { QMargins AddTableDialog::tableMargins() const
{
return m_table_margins; return m_table_margins;
} }
@@ -145,11 +152,13 @@ Qt::Alignment AddTableDialog::tableAlignment() const
@brief AddTableDialog::tableFont @brief AddTableDialog::tableFont
@return @return
*/ */
QFont AddTableDialog::tableFont() const { QFont AddTableDialog::tableFont() const
{
return m_table_font; return m_table_font;
} }
QWidget *AddTableDialog::contentWidget() const { QWidget *AddTableDialog::contentWidget() const
{
return m_content_widget; return m_content_widget;
} }

View File

@@ -39,13 +39,15 @@ GenericPanel::GenericPanel(QWidget *parent) :
/** /**
Destructor Destructor
*/ */
GenericPanel::~GenericPanel() { GenericPanel::~GenericPanel()
{
} }
/** /**
@return the type of the current item @return the type of the current item
*/ */
int GenericPanel::currentItemType() { int GenericPanel::currentItemType()
{
QTreeWidgetItem *current_qtwi = currentItem(); QTreeWidgetItem *current_qtwi = currentItem();
if (!current_qtwi) return(0); if (!current_qtwi) return(0);
return(current_qtwi -> type()); return(current_qtwi -> type());
@@ -56,7 +58,8 @@ int GenericPanel::currentItemType() {
@param item @param item
@return nullptr @return nullptr
*/ */
QETProject *GenericPanel::projectForItem(QTreeWidgetItem *item) const { QETProject *GenericPanel::projectForItem(QTreeWidgetItem *item) const
{
if (item && item -> type() == QET::Project) { if (item && item -> type() == QET::Project) {
return(valueForItem<QETProject *>(item)); return(valueForItem<QETProject *>(item));
} }
@@ -69,7 +72,8 @@ QETProject *GenericPanel::projectForItem(QTreeWidgetItem *item) const {
@param item @param item
@return nullptr @return nullptr
*/ */
Diagram *GenericPanel::diagramForItem(QTreeWidgetItem *item) const { Diagram *GenericPanel::diagramForItem(QTreeWidgetItem *item) const
{
if (item && item -> type() == QET::Diagram) { if (item && item -> type() == QET::Diagram) {
return(valueForItem<Diagram *>(item)); return(valueForItem<Diagram *>(item));
} }
@@ -82,7 +86,8 @@ Diagram *GenericPanel::diagramForItem(QTreeWidgetItem *item) const {
@return TitleBlockTemplateLocation() @return TitleBlockTemplateLocation()
*/ */
TitleBlockTemplateLocation GenericPanel::templateLocationForItem( TitleBlockTemplateLocation GenericPanel::templateLocationForItem(
QTreeWidgetItem *item) const { QTreeWidgetItem *item) const
{
if (item && item -> type() & QET::TitleBlockTemplatesCollectionItem) { if (item && item -> type() & QET::TitleBlockTemplatesCollectionItem) {
return(valueForItem<TitleBlockTemplateLocation>(item)); return(valueForItem<TitleBlockTemplateLocation>(item));
} }
@@ -93,7 +98,8 @@ TitleBlockTemplateLocation GenericPanel::templateLocationForItem(
@brief GenericPanel::selectedProject @brief GenericPanel::selectedProject
@return projectForItem(currentItem()) @return projectForItem(currentItem())
*/ */
QETProject *GenericPanel::selectedProject() const { QETProject *GenericPanel::selectedProject() const
{
return(projectForItem(currentItem())); return(projectForItem(currentItem()));
} }
@@ -101,7 +107,8 @@ QETProject *GenericPanel::selectedProject() const {
@brief GenericPanel::selectedDiagram @brief GenericPanel::selectedDiagram
@return diagramForItem(currentItem()) @return diagramForItem(currentItem())
*/ */
Diagram *GenericPanel::selectedDiagram() const { Diagram *GenericPanel::selectedDiagram() const
{
return(diagramForItem(currentItem())); return(diagramForItem(currentItem()));
} }
@@ -109,7 +116,8 @@ Diagram *GenericPanel::selectedDiagram() const {
@brief GenericPanel::selectedTemplateLocation @brief GenericPanel::selectedTemplateLocation
@return templateLocationForItem(currentItem()) @return templateLocationForItem(currentItem())
*/ */
TitleBlockTemplateLocation GenericPanel::selectedTemplateLocation() const { TitleBlockTemplateLocation GenericPanel::selectedTemplateLocation() const
{
return(templateLocationForItem(currentItem())); return(templateLocationForItem(currentItem()));
} }
@@ -931,7 +939,8 @@ void GenericPanel::reparent(QTreeWidgetItem *item, QTreeWidgetItem *parent) {
QList<QTreeWidgetItem *> GenericPanel::childItems( QList<QTreeWidgetItem *> GenericPanel::childItems(
QTreeWidgetItem *item, QTreeWidgetItem *item,
QET::ItemType type, QET::ItemType type,
bool recursive) const { bool recursive) const
{
QList<QTreeWidgetItem *> items; QList<QTreeWidgetItem *> items;
if (!item) return(items); if (!item) return(items);
for (int i = 0 ; i < item -> childCount() ; ++ i) { for (int i = 0 ; i < item -> childCount() ; ++ i) {
@@ -976,7 +985,8 @@ void GenericPanel::removeObsoleteItems(
@return the value stored in \a item @return the value stored in \a item
*/ */
template<typename T> template<typename T>
T GenericPanel::valueForItem(QTreeWidgetItem *item) const { T GenericPanel::valueForItem(QTreeWidgetItem *item) const
{
return item -> data(0, GenericPanel::Item).value<T>(); return item -> data(0, GenericPanel::Item).value<T>();
} }
template TitleBlockTemplateLocation template TitleBlockTemplateLocation
@@ -1027,6 +1037,7 @@ bool GenericPanel::event(QEvent *event) {
@brief GenericPanel::emitFirstActivated @brief GenericPanel::emitFirstActivated
Emit the signal firstActivated(). Emit the signal firstActivated().
*/ */
void GenericPanel::emitFirstActivated() { void GenericPanel::emitFirstActivated()
{
emit(firstActivated()); emit(firstActivated());
} }

View File

@@ -51,7 +51,8 @@ NewElementWizard::NewElementWizard(QWidget *parent, Qt::WindowFlags f) :
/** /**
Destructeur Destructeur
*/ */
NewElementWizard::~NewElementWizard() { NewElementWizard::~NewElementWizard()
{
} }
/** /**
@@ -99,7 +100,8 @@ QWizardPage *NewElementWizard::buildStep1()
@brief NewElementWizard::buildStep2 @brief NewElementWizard::buildStep2
@return @return
*/ */
QWizardPage *NewElementWizard::buildStep2() { QWizardPage *NewElementWizard::buildStep2()
{
QWizardPage *page = new QWizardPage(); QWizardPage *page = new QWizardPage();
page -> setProperty("WizardState", Filename); page -> setProperty("WizardState", Filename);
page -> setTitle(tr("Étape 2/3 : Nom du fichier", "wizard page title")); page -> setTitle(tr("Étape 2/3 : Nom du fichier", "wizard page title"));
@@ -123,7 +125,8 @@ QWizardPage *NewElementWizard::buildStep2() {
@brief NewElementWizard::buildStep3 @brief NewElementWizard::buildStep3
@return @return
*/ */
QWizardPage *NewElementWizard::buildStep3() { QWizardPage *NewElementWizard::buildStep3()
{
QWizardPage *page = new QWizardPage(); QWizardPage *page = new QWizardPage();
page -> setProperty("WizardState", Names); page -> setProperty("WizardState", Names);
page -> setTitle(tr("Étape 3/3 : Noms de l'élément", "wizard page title")); page -> setTitle(tr("Étape 3/3 : Noms de l'élément", "wizard page title"));
@@ -202,7 +205,8 @@ bool NewElementWizard::validStep1()
Valid the step 2 Valid the step 2
@return true if step is valid @return true if step is valid
*/ */
bool NewElementWizard::validStep2() { bool NewElementWizard::validStep2()
{
QString file_name = m_qle_filename -> text(); QString file_name = m_qle_filename -> text();
if (file_name.isEmpty()) { if (file_name.isEmpty()) {
@@ -233,7 +237,8 @@ bool NewElementWizard::validStep2() {
@brief NewElementWizard::createNewElement @brief NewElementWizard::createNewElement
Lauch an element editor for create the new element Lauch an element editor for create the new element
*/ */
void NewElementWizard::createNewElement() { void NewElementWizard::createNewElement()
{
QETElementEditor *edit_new_element = new QETElementEditor(parentWidget()); QETElementEditor *edit_new_element = new QETElementEditor(parentWidget());
edit_new_element -> setNames(m_names_list -> names()); edit_new_element -> setNames(m_names_list -> names());

View File

@@ -46,13 +46,15 @@ ProjectConfigPage::ProjectConfigPage(QETProject *project, QWidget *parent) :
/** /**
Destructor Destructor
*/ */
ProjectConfigPage::~ProjectConfigPage() { ProjectConfigPage::~ProjectConfigPage()
{
} }
/** /**
@return the project being edited by this page @return the project being edited by this page
*/ */
QETProject *ProjectConfigPage::project() const { QETProject *ProjectConfigPage::project() const
{
return(m_project); return(m_project);
} }
@@ -81,7 +83,8 @@ QETProject *ProjectConfigPage::setProject(QETProject *new_project,
/** /**
Apply the configuration after user input Apply the configuration after user input
*/ */
void ProjectConfigPage::applyConf() { void ProjectConfigPage::applyConf()
{
if (!m_project || m_project -> isReadOnly()) return; if (!m_project || m_project -> isReadOnly()) return;
applyProjectConf(); applyProjectConf();
} }
@@ -91,7 +94,8 @@ void ProjectConfigPage::applyConf() {
readValuesFromProject() and adjustReadOnly() if a non-zero project has been readValuesFromProject() and adjustReadOnly() if a non-zero project has been
set. Typically, you should call this function in your subclass constructor. set. Typically, you should call this function in your subclass constructor.
*/ */
void ProjectConfigPage::init() { void ProjectConfigPage::init()
{
initWidgets(); initWidgets();
initLayout(); initLayout();
if (m_project) { if (m_project) {
@@ -116,27 +120,31 @@ ProjectMainConfigPage::ProjectMainConfigPage(QETProject *project, QWidget *paren
/** /**
Destructor Destructor
*/ */
ProjectMainConfigPage::~ProjectMainConfigPage() { ProjectMainConfigPage::~ProjectMainConfigPage()
{
} }
/** /**
@return the title for this page @return the title for this page
*/ */
QString ProjectMainConfigPage::title() const { QString ProjectMainConfigPage::title() const
{
return(tr("Général", "configuration page title")); return(tr("Général", "configuration page title"));
} }
/** /**
@return the icon for this page @return the icon for this page
*/ */
QIcon ProjectMainConfigPage::icon() const { QIcon ProjectMainConfigPage::icon() const
{
return(QET::Icons::Settings); return(QET::Icons::Settings);
} }
/** /**
Apply the configuration after user input Apply the configuration after user input
*/ */
void ProjectMainConfigPage::applyProjectConf() { void ProjectMainConfigPage::applyProjectConf()
{
bool modified_project = false; bool modified_project = false;
QString new_title = title_value_ -> text(); QString new_title = title_value_ -> text();
@@ -158,14 +166,16 @@ void ProjectMainConfigPage::applyProjectConf() {
/** /**
@return the project title entered by the user @return the project title entered by the user
*/ */
QString ProjectMainConfigPage::projectTitle() const { QString ProjectMainConfigPage::projectTitle() const
{
return(title_value_ -> text()); return(title_value_ -> text());
} }
/** /**
Initialize widgets displayed by the page. Initialize widgets displayed by the page.
*/ */
void ProjectMainConfigPage::initWidgets() { void ProjectMainConfigPage::initWidgets()
{
title_label_ = new QLabel(tr("Titre du projet :", "label when configuring")); title_label_ = new QLabel(tr("Titre du projet :", "label when configuring"));
title_value_ = new QLineEdit(); title_value_ = new QLineEdit();
title_information_ = new QLabel(tr("Ce titre sera disponible pour tous les folios de ce projet en tant que %projecttitle.", "informative label")); title_information_ = new QLabel(tr("Ce titre sera disponible pour tous les folios de ce projet en tant que %projecttitle.", "informative label"));
@@ -183,7 +193,8 @@ void ProjectMainConfigPage::initWidgets() {
/** /**
Initialize the layout of this page. Initialize the layout of this page.
*/ */
void ProjectMainConfigPage::initLayout() { void ProjectMainConfigPage::initLayout()
{
QVBoxLayout *main_layout0 = new QVBoxLayout(); QVBoxLayout *main_layout0 = new QVBoxLayout();
QHBoxLayout *title_layout0 = new QHBoxLayout(); QHBoxLayout *title_layout0 = new QHBoxLayout();
title_layout0 -> addWidget(title_label_); title_layout0 -> addWidget(title_label_);
@@ -201,7 +212,8 @@ void ProjectMainConfigPage::initLayout() {
/** /**
Read properties from the edited project then fill widgets with them. Read properties from the edited project then fill widgets with them.
*/ */
void ProjectMainConfigPage::readValuesFromProject() { void ProjectMainConfigPage::readValuesFromProject()
{
title_value_ -> setText(m_project -> title()); title_value_ -> setText(m_project -> title());
project_variables_ -> setContext(m_project -> projectProperties()); project_variables_ -> setContext(m_project -> projectProperties());
} }
@@ -210,7 +222,8 @@ void ProjectMainConfigPage::readValuesFromProject() {
Set the content of this page read only if the project is read only, Set the content of this page read only if the project is read only,
editable if the project is editable. editable if the project is editable.
*/ */
void ProjectMainConfigPage::adjustReadOnly() { void ProjectMainConfigPage::adjustReadOnly()
{
bool is_read_only = m_project -> isReadOnly(); bool is_read_only = m_project -> isReadOnly();
title_value_ -> setReadOnly(is_read_only); title_value_ -> setReadOnly(is_read_only);
} }
@@ -237,7 +250,8 @@ ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project,
Title of this config page Title of this config page
@return @return
*/ */
QString ProjectAutoNumConfigPage::title() const { QString ProjectAutoNumConfigPage::title() const
{
return tr("Numérotation auto"); return tr("Numérotation auto");
} }
@@ -246,14 +260,16 @@ QString ProjectAutoNumConfigPage::title() const {
Icon of this config pafe Icon of this config pafe
@return @return
*/ */
QIcon ProjectAutoNumConfigPage::icon() const { QIcon ProjectAutoNumConfigPage::icon() const
{
return QIcon (QET::Icons::AutoNum); return QIcon (QET::Icons::AutoNum);
} }
/** /**
@brief ProjectAutoNumConfigPage::applyProjectConf @brief ProjectAutoNumConfigPage::applyProjectConf
*/ */
void ProjectAutoNumConfigPage::applyProjectConf() {} void ProjectAutoNumConfigPage::applyProjectConf()
{}
/** /**
@brief ProjectAutoNumConfigPage::initWidgets @brief ProjectAutoNumConfigPage::initWidgets
@@ -314,7 +330,8 @@ void ProjectAutoNumConfigPage::readValuesFromProject()
@brief ProjectAutoNumConfigPage::adjustReadOnly @brief ProjectAutoNumConfigPage::adjustReadOnly
set this config page disable if project is read only set this config page disable if project is read only
*/ */
void ProjectAutoNumConfigPage::adjustReadOnly() { void ProjectAutoNumConfigPage::adjustReadOnly()
{
} }
/** /**
@@ -460,7 +477,8 @@ void ProjectAutoNumConfigPage::saveContextConductor()
@brief ProjectAutoNumConfigPage::saveContext_folio @brief ProjectAutoNumConfigPage::saveContext_folio
Save the current displayed folio context in project Save the current displayed folio context in project
*/ */
void ProjectAutoNumConfigPage::saveContextFolio() { void ProjectAutoNumConfigPage::saveContextFolio()
{
// If the text is the default text "Name of new numerotation" save the edited context // If the text is the default text "Name of new numerotation" save the edited context
// With the the name "No name" // With the the name "No name"
if (m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation")) { if (m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation")) {
@@ -483,7 +501,8 @@ void ProjectAutoNumConfigPage::saveContextFolio() {
@brief ProjectAutoNumConfigPage::applyAutoNum @brief ProjectAutoNumConfigPage::applyAutoNum
Apply auto folio numbering, New Folios or Selected Folios Apply auto folio numbering, New Folios or Selected Folios
*/ */
void ProjectAutoNumConfigPage::applyAutoNum() { void ProjectAutoNumConfigPage::applyAutoNum()
{
if (m_faw->newFolios){ if (m_faw->newFolios){
int foliosRemaining = m_faw->newFoliosNumber(); int foliosRemaining = m_faw->newFoliosNumber();
@@ -507,7 +526,8 @@ void ProjectAutoNumConfigPage::applyAutoNum() {
@brief ProjectAutoNumConfigPage::applyAutoManagement @brief ProjectAutoNumConfigPage::applyAutoManagement
Apply Management Options in Selected Folios Apply Management Options in Selected Folios
*/ */
void ProjectAutoNumConfigPage::applyManagement() { void ProjectAutoNumConfigPage::applyManagement()
{
int from; int from;
int to; int to;
//Apply to Entire Project //Apply to Entire Project
@@ -601,7 +621,8 @@ void ProjectAutoNumConfigPage::applyManagement() {
@brief ProjectAutoNumConfigPage::removeContext @brief ProjectAutoNumConfigPage::removeContext
Remove from project the current conductor numerotation context Remove from project the current conductor numerotation context
*/ */
void ProjectAutoNumConfigPage::removeContextConductor() { void ProjectAutoNumConfigPage::removeContextConductor()
{
//if default text, return //if default text, return
if ( m_saw_conductor->contextComboBox()-> currentText() == tr("Nom de la nouvelle numérotation") ) return; if ( m_saw_conductor->contextComboBox()-> currentText() == tr("Nom de la nouvelle numérotation") ) return;
m_project -> removeConductorAutoNum (m_saw_conductor->contextComboBox()-> currentText() ); m_project -> removeConductorAutoNum (m_saw_conductor->contextComboBox()-> currentText() );
@@ -613,7 +634,8 @@ void ProjectAutoNumConfigPage::removeContextConductor() {
@brief ProjectAutoNumConfigPage::removeContext_folio @brief ProjectAutoNumConfigPage::removeContext_folio
Remove from project the current folio numerotation context Remove from project the current folio numerotation context
*/ */
void ProjectAutoNumConfigPage::removeContextFolio() { void ProjectAutoNumConfigPage::removeContextFolio()
{
//if default text, return //if default text, return
if ( m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation") ) return; if ( m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
m_project -> removeFolioAutoNum (m_saw_folio->contextComboBox() -> currentText() ); m_project -> removeFolioAutoNum (m_saw_folio->contextComboBox() -> currentText() );

View File

@@ -54,7 +54,8 @@ ProjectView::ProjectView(QETProject *project, QWidget *parent) :
Destructeur Destructeur
Supprime les DiagramView embarquees Supprime les DiagramView embarquees
*/ */
ProjectView::~ProjectView() { ProjectView::~ProjectView()
{
for (auto dv_ : m_diagram_ids.values()) for (auto dv_ : m_diagram_ids.values())
dv_->deleteLater(); dv_->deleteLater();
} }
@@ -62,7 +63,8 @@ ProjectView::~ProjectView() {
/** /**
@return le projet actuellement visualise par le ProjectView @return le projet actuellement visualise par le ProjectView
*/ */
QETProject *ProjectView::project() { QETProject *ProjectView::project()
{
return(m_project); return(m_project);
} }
@@ -94,7 +96,8 @@ void ProjectView::setProject(QETProject *project)
/** /**
@return la liste des schemas ouverts dans le projet @return la liste des schemas ouverts dans le projet
*/ */
QList<DiagramView *> ProjectView::diagram_views() const { QList<DiagramView *> ProjectView::diagram_views() const
{
return(m_diagram_view_list); return(m_diagram_view_list);
} }
@@ -102,7 +105,8 @@ QList<DiagramView *> ProjectView::diagram_views() const {
@brief ProjectView::currentDiagram @brief ProjectView::currentDiagram
@return The current active diagram view or nullptr if there isn't diagramView in this project view. @return The current active diagram view or nullptr if there isn't diagramView in this project view.
*/ */
DiagramView *ProjectView::currentDiagram() const { DiagramView *ProjectView::currentDiagram() const
{
int current_tab_index = m_tab -> currentIndex(); int current_tab_index = m_tab -> currentIndex();
if (current_tab_index == -1) if (current_tab_index == -1)
return nullptr; return nullptr;
@@ -126,7 +130,8 @@ void ProjectView::closeEvent(QCloseEvent *qce) {
/** /**
@brief change current diagramview to next folio @brief change current diagramview to next folio
*/ */
void ProjectView::changeTabDown(){ void ProjectView::changeTabDown()
{
DiagramView *nextDiagramView = this->nextDiagram(); DiagramView *nextDiagramView = this->nextDiagram();
if (nextDiagramView!=nullptr){ if (nextDiagramView!=nullptr){
rebuildDiagramsMap(); rebuildDiagramsMap();
@@ -137,7 +142,8 @@ void ProjectView::changeTabDown(){
/** /**
@return next folio of current diagramview @return next folio of current diagramview
*/ */
DiagramView *ProjectView::nextDiagram() { DiagramView *ProjectView::nextDiagram()
{
int current_tab_index = m_tab -> currentIndex(); int current_tab_index = m_tab -> currentIndex();
int next_tab_index = current_tab_index + 1; //get next tab index int next_tab_index = current_tab_index + 1; //get next tab index
if (next_tab_index<m_diagram_ids.count()) //if next tab index >= greatest tab the last tab is activated so no need to change tab. if (next_tab_index<m_diagram_ids.count()) //if next tab index >= greatest tab the last tab is activated so no need to change tab.
@@ -149,7 +155,8 @@ DiagramView *ProjectView::nextDiagram() {
/** /**
@brief change current diagramview to previous tab @brief change current diagramview to previous tab
*/ */
void ProjectView::changeTabUp(){ void ProjectView::changeTabUp()
{
DiagramView *previousDiagramView = this->previousDiagram(); DiagramView *previousDiagramView = this->previousDiagram();
if (previousDiagramView!=nullptr){ if (previousDiagramView!=nullptr){
rebuildDiagramsMap(); rebuildDiagramsMap();
@@ -160,7 +167,8 @@ void ProjectView::changeTabUp(){
/** /**
@return previous folio of current diagramview @return previous folio of current diagramview
*/ */
DiagramView *ProjectView::previousDiagram() { DiagramView *ProjectView::previousDiagram()
{
int current_tab_index = m_tab -> currentIndex(); int current_tab_index = m_tab -> currentIndex();
int previous_tab_index = current_tab_index - 1; //get previous tab index int previous_tab_index = current_tab_index - 1; //get previous tab index
if (previous_tab_index>=0) //if previous tab index = 0 then the first tab is activated so no need to change tab. if (previous_tab_index>=0) //if previous tab index = 0 then the first tab is activated so no need to change tab.
@@ -172,7 +180,8 @@ DiagramView *ProjectView::previousDiagram() {
/** /**
@brief change current diagramview to last tab @brief change current diagramview to last tab
*/ */
void ProjectView::changeLastTab(){ void ProjectView::changeLastTab()
{
DiagramView *lastDiagramView = this->lastDiagram(); DiagramView *lastDiagramView = this->lastDiagram();
m_tab->setCurrentWidget(lastDiagramView); m_tab->setCurrentWidget(lastDiagramView);
} }
@@ -180,14 +189,16 @@ void ProjectView::changeLastTab(){
/** /**
@return last folio of current project @return last folio of current project
*/ */
DiagramView *ProjectView::lastDiagram(){ DiagramView *ProjectView::lastDiagram()
{
return(m_diagram_ids.last()); return(m_diagram_ids.last());
} }
/** /**
@brief change current diagramview to first tab @brief change current diagramview to first tab
*/ */
void ProjectView::changeFirstTab(){ void ProjectView::changeFirstTab()
{
DiagramView *firstDiagramView = this->firstDiagram(); DiagramView *firstDiagramView = this->firstDiagram();
m_tab->setCurrentWidget(firstDiagramView); m_tab->setCurrentWidget(firstDiagramView);
} }
@@ -195,7 +206,8 @@ void ProjectView::changeFirstTab(){
/** /**
@return first folio of current project @return first folio of current project
*/ */
DiagramView *ProjectView::firstDiagram(){ DiagramView *ProjectView::firstDiagram()
{
return(m_diagram_ids.first()); return(m_diagram_ids.first());
} }
@@ -208,7 +220,8 @@ DiagramView *ProjectView::firstDiagram(){
@see tryClosingElementEditors() @see tryClosingElementEditors()
@see tryClosingDiagrams() @see tryClosingDiagrams()
*/ */
bool ProjectView::tryClosing() { bool ProjectView::tryClosing()
{
if (!m_project) return(true); if (!m_project) return(true);
// First step: require external editors closing -- users may either cancel // First step: require external editors closing -- users may either cancel
@@ -257,7 +270,8 @@ bool ProjectView::tryClosing() {
d'un editeur d'element. d'un editeur d'element.
@return true si tous les editeurs d'element ont pu etre fermes, false sinon @return true si tous les editeurs d'element ont pu etre fermes, false sinon
*/ */
bool ProjectView::tryClosingElementEditors() { bool ProjectView::tryClosingElementEditors()
{
if (!m_project) return(true); if (!m_project) return(true);
/* /*
La QETApp permet d'acceder rapidement aux editeurs d'element La QETApp permet d'acceder rapidement aux editeurs d'element
@@ -281,7 +295,8 @@ bool ProjectView::tryClosingElementEditors() {
a dialog ask if user want to save the modification. a dialog ask if user want to save the modification.
@return the answer of dialog or discard if no change. @return the answer of dialog or discard if no change.
*/ */
int ProjectView::tryClosingDiagrams() { int ProjectView::tryClosingDiagrams()
{
if (!m_project) return(QMessageBox::Discard); if (!m_project) return(QMessageBox::Discard);
if (!project()->projectOptionsWereModified() && if (!project()->projectOptionsWereModified() &&
@@ -339,7 +354,8 @@ QString ProjectView::askUserForFilePath(bool assign) {
@return the QETResult object to be returned when it appears this project @return the QETResult object to be returned when it appears this project
view is not associated to any project. view is not associated to any project.
*/ */
QETResult ProjectView::noProjectResult() const { QETResult ProjectView::noProjectResult() const
{
QETResult no_project(tr("aucun projet affiché", "error message"), false); QETResult no_project(tr("aucun projet affiché", "error message"), false);
return(no_project); return(no_project);
} }
@@ -421,7 +437,8 @@ void ProjectView::showDiagram(Diagram *diagram) {
Enable the user to edit properties of the current project through a Enable the user to edit properties of the current project through a
configuration dialog. configuration dialog.
*/ */
void ProjectView::editProjectProperties() { void ProjectView::editProjectProperties()
{
if (!m_project) return; if (!m_project) return;
ProjectPropertiesDialog dialog(m_project, parentWidget()); ProjectPropertiesDialog dialog(m_project, parentWidget());
dialog.exec(); dialog.exec();
@@ -430,7 +447,8 @@ void ProjectView::editProjectProperties() {
/** /**
Edite les proprietes du schema courant Edite les proprietes du schema courant
*/ */
void ProjectView::editCurrentDiagramProperties() { void ProjectView::editCurrentDiagramProperties()
{
editDiagramProperties(currentDiagram()); editDiagramProperties(currentDiagram());
} }
@@ -561,7 +579,8 @@ void ProjectView::moveDiagramDownx10(Diagram *diagram) {
Ce slot demarre un dialogue permettant a l'utilisateur de parametrer et de Ce slot demarre un dialogue permettant a l'utilisateur de parametrer et de
lancer l'impression de toute ou partie du projet. lancer l'impression de toute ou partie du projet.
*/ */
void ProjectView::printProject() { void ProjectView::printProject()
{
if (!m_project) return; if (!m_project) return;
// transforme le titre du projet en nom utilisable pour le document // transforme le titre du projet en nom utilisable pour le document
@@ -591,7 +610,8 @@ void ProjectView::printProject() {
/** /**
Exporte le schema. Exporte le schema.
*/ */
void ProjectView::exportProject() { void ProjectView::exportProject()
{
if (!m_project) return; if (!m_project) return;
ExportDialog ed(m_project, parentWidget()); ExportDialog ed(m_project, parentWidget());
@@ -607,7 +627,8 @@ void ProjectView::exportProject() {
@see setFilePath() @see setFilePath()
@return a QETResult object reflecting the situation @return a QETResult object reflecting the situation
*/ */
QETResult ProjectView::save() { QETResult ProjectView::save()
{
return(doSave()); return(doSave());
} }
@@ -658,7 +679,8 @@ QETResult ProjectView::doSave()
@return an integer value above zero if elements and/or categories were @return an integer value above zero if elements and/or categories were
cleaned. cleaned.
*/ */
int ProjectView::cleanProject() { int ProjectView::cleanProject()
{
if (!m_project) return(0); if (!m_project) return(0);
// s'assure que le schema n'est pas en lecture seule // s'assure que le schema n'est pas en lecture seule
@@ -733,7 +755,8 @@ void ProjectView::initActions()
/** /**
Initialize child widgets for this widget. Initialize child widgets for this widget.
*/ */
void ProjectView::initWidgets() { void ProjectView::initWidgets()
{
setObjectName("ProjectView"); setObjectName("ProjectView");
setWindowIcon(QET::Icons::ProjectFileGP); setWindowIcon(QET::Icons::ProjectFileGP);
@@ -790,7 +813,8 @@ void ProjectView::initWidgets() {
/** /**
Initialize layout for this widget. Initialize layout for this widget.
*/ */
void ProjectView::initLayout() { void ProjectView::initLayout()
{
QVBoxLayout *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_); QVBoxLayout *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_);
fallback_widget_layout_ -> addWidget(fallback_label_); fallback_widget_layout_ -> addWidget(fallback_label_);
@@ -849,7 +873,8 @@ void ProjectView::loadDiagrams()
@brief ProjectView::updateWindowTitle @brief ProjectView::updateWindowTitle
Update the project view title Update the project view title
*/ */
void ProjectView::updateWindowTitle() { void ProjectView::updateWindowTitle()
{
QString title; QString title;
if (m_project) { if (m_project) {
title = m_project -> pathNameTitle(); title = m_project -> pathNameTitle();
@@ -863,7 +888,8 @@ void ProjectView::updateWindowTitle() {
Effectue les actions necessaires lorsque le projet visualise entre ou sort Effectue les actions necessaires lorsque le projet visualise entre ou sort
du mode lecture seule. du mode lecture seule.
*/ */
void ProjectView::adjustReadOnlyState() { void ProjectView::adjustReadOnlyState()
{
bool editable = !(m_project -> isReadOnly()); bool editable = !(m_project -> isReadOnly());
// prevent users from moving existing diagrams // prevent users from moving existing diagrams
@@ -984,7 +1010,8 @@ DiagramView *ProjectView::findDiagram(Diagram *diagram) {
/** /**
Reconstruit la map associant les index des onglets avec les DiagramView Reconstruit la map associant les index des onglets avec les DiagramView
*/ */
void ProjectView::rebuildDiagramsMap() { void ProjectView::rebuildDiagramsMap()
{
// vide la map // vide la map
m_diagram_ids.clear(); m_diagram_ids.clear();

View File

@@ -15,7 +15,8 @@ TerminalData::TerminalData(QGraphicsObject *parent):
init(); init();
} }
void TerminalData::init() { void TerminalData::init()
{
} }
TerminalData::~TerminalData() TerminalData::~TerminalData()

View File

@@ -42,7 +42,8 @@ XRefProperties::XRefProperties()
@param prefix: prefix before properties name @param prefix: prefix before properties name
*/ */
void XRefProperties::toSettings(QSettings &settings, void XRefProperties::toSettings(QSettings &settings,
const QString prefix) const { const QString prefix) const
{
settings.setValue(prefix + "showpowerctc", m_show_power_ctc); settings.setValue(prefix + "showpowerctc", m_show_power_ctc);
QString display = m_display == Cross? "cross" : "contacts"; QString display = m_display == Cross? "cross" : "contacts";
settings.setValue(prefix + "displayhas", display); settings.setValue(prefix + "displayhas", display);
@@ -96,7 +97,8 @@ void XRefProperties::fromSettings(const QSettings &settings,
@param xml_document : QDomElement to use for saving @param xml_document : QDomElement to use for saving
@return QDomElement @return QDomElement
*/ */
QDomElement XRefProperties::toXml(QDomDocument &xml_document) const { QDomElement XRefProperties::toXml(QDomDocument &xml_document) const
{
QDomElement xml_element = xml_document.createElement("xref"); QDomElement xml_element = xml_document.createElement("xref");
xml_element.setAttribute("type", m_key); xml_element.setAttribute("type", m_key);
@@ -191,7 +193,8 @@ bool XRefProperties::operator ==(const XRefProperties &xrp) const{
m_xref_pos == xrp.m_xref_pos ); m_xref_pos == xrp.m_xref_pos );
} }
bool XRefProperties::operator !=(const XRefProperties &xrp) const { bool XRefProperties::operator !=(const XRefProperties &xrp) const
{
return (! (*this == xrp)); return (! (*this == xrp));
} }

View File

@@ -371,7 +371,8 @@ QList<QDomElement> QET::findInDomElement(const QDomElement &e,
} }
/// @return le texte de la licence de QElectroTech (GNU/GPL) /// @return le texte de la licence de QElectroTech (GNU/GPL)
QString QET::license() { QString QET::license()
{
// Recuperation du texte de la GNU/GPL dans un fichier integre a l'application // Recuperation du texte de la GNU/GPL dans un fichier integre a l'application
QFile *file_license = new QFile(":/LICENSE"); QFile *file_license = new QFile(":/LICENSE");
QString txt_license; QString txt_license;
@@ -399,7 +400,8 @@ QString QET::license() {
@return la liste des caracteres interdits dans les noms de fichiers sous @return la liste des caracteres interdits dans les noms de fichiers sous
Windows Windows
*/ */
QList<QChar> QET::forbiddenCharacters() { QList<QChar> QET::forbiddenCharacters()
{
return(QList<QChar>() << '\\' << '/' << ':' << '*' << '?' << '"' return(QList<QChar>() << '\\' << '/' << ':' << '*' << '?' << '"'
<< '<' << '>' << '|'); << '<' << '>' << '|');
} }

Some files were not shown because too many files have changed in this diff Show More