Wrap code for better readability

This commit is contained in:
Simon De Backer
2020-09-07 22:03:40 +02:00
parent 8ee38fab9e
commit 5d92393ee7
202 changed files with 4031 additions and 2153 deletions

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

@@ -228,7 +228,11 @@ void Createdxf::dxfBegin (const QString& fileName)
} }
} }
/* End Section of every DXF File*/ /**
@brief Createdxf::dxfEnd
End Section of every DXF File
@param fileName
*/
void Createdxf::dxfEnd(const QString& 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.
@@ -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,
const QRectF &rect,
const int &colorcode)
{
drawArcEllipse(
filepath,
rect.topLeft().x() * xScale,
sheetHeight - (rect.topLeft().y() * yScale), sheetHeight - (rect.topLeft().y() * yScale),
rect.width() * xScale, rect.width() * xScale,
rect.height() * yScale, rect.height() * yScale,
0, 360, 0, 0, 0, colorcode); 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);
@@ -659,10 +739,13 @@ void Createdxf::drawRectangle (const QString &fileName, double x1, double y1, do
@param rect @param rect
@param colorcode @param colorcode
*/ */
void Createdxf::drawRectangle(const QString &filepath, void Createdxf::drawRectangle(
const QString &filepath,
const QRectF &rect, const QRectF &rect,
const int &colorcode) { const int &colorcode) {
drawRectangle(filepath, rect.bottomLeft().x() * xScale, drawRectangle(
filepath,
rect.bottomLeft().x() * xScale,
sheetHeight - (rect.bottomLeft().y() * yScale), sheetHeight - (rect.bottomLeft().y() * yScale),
rect.width() * xScale, rect.width() * xScale,
rect.height() * yScale, rect.height() * yScale,
@@ -676,13 +759,17 @@ void Createdxf::drawRectangle(const QString &filepath,
@param poly @param poly
@param colorcode @param colorcode
*/ */
void Createdxf::drawPolygon(const QString &filepath, void Createdxf::drawPolygon(
const QString &filepath,
const QPolygonF &poly, const QPolygonF &poly,
const int &colorcode) { const int &colorcode)
{
int lc = 0; int lc = 0;
QPointF plast; QPointF plast;
foreach(QPointF p, poly) { foreach(QPointF p, poly)
if(lc++) { {
if(lc++)
{
QLineF ql(plast,p); QLineF ql(plast,p);
drawLine(filepath,ql,colorcode); drawLine(filepath,ql,colorcode);
} }
@@ -700,7 +787,8 @@ void Createdxf::drawPolygon(const QString &filepath,
@param endAngle @param endAngle
@param color @param color
*/ */
void Createdxf::drawArc(const QString& fileName, void Createdxf::drawArc(
const QString& fileName,
double x, double x,
double y, double y,
double rad, double rad,
@@ -753,7 +841,8 @@ 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& fileName,
const QString& text, const QString& text,
double x, double x,
double y, double y,

View File

@@ -21,8 +21,10 @@
#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:
@@ -31,12 +33,14 @@ class 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(
const QString&,
double, double,
double, double,
double, double,
int); int);
static void drawArc(const QString&, static void drawArc(
const QString&,
double x, double x,
double y, double y,
double rad, double rad,
@@ -45,7 +49,8 @@ class Createdxf
int color); int color);
static void drawDonut(QString,double,double,double,int); static void drawDonut(QString,double,double,double,int);
static void drawArcEllipse (const QString &file_path, static void drawArcEllipse (
const QString &file_path,
qreal x, qreal x,
qreal y, qreal y,
qreal w, qreal w,
@@ -61,37 +66,44 @@ class Createdxf
const QRectF &rect, const QRectF &rect,
const int &colorcode); const int &colorcode);
static void drawRectangle(const QString &filepath, static void drawRectangle(
const QString &filepath,
double, double,
double, double,
double, double,
double, double,
const int &colorcode); const int &colorcode);
static void drawRectangle(const QString &filepath, static void drawRectangle(
const QString &filepath,
const QRectF &rect, const QRectF &rect,
const int &colorcode); const int &colorcode);
static void drawPolygon(const QString &filepath, static void drawPolygon(
const QString &filepath,
const QPolygonF &poly, const QPolygonF &poly,
const int &colorcode); const int &colorcode);
static void drawLine(const QString &filapath, static void drawLine(
const QString &filapath,
double, double,
double, double,
double, double,
double, double,
const int &clorcode); const int &clorcode);
static void drawLine(const QString &filepath, static void drawLine(
const QString &filepath,
const QLineF &line, const QLineF &line,
const int &colorcode); const int &colorcode);
static void drawText(const QString&, static void drawText(
const QString&,
const QString&, const QString&,
double,double, double,double,
double, double,
double, double,
int); int);
static void drawTextAligned(const QString& fileName, static void drawTextAligned(
const QString& fileName,
const QString& text, const QString& text,
double x, double x,
double y, double y,
@@ -105,7 +117,8 @@ class Createdxf
int colour); int colour);
static int getcolorCode (const long red, static int getcolorCode (
const long red,
const long green, const long green,
const long blue); const long blue);
static long RGBcodeTable[]; static long RGBcodeTable[];

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

@@ -59,7 +59,8 @@ 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();
@@ -98,7 +99,8 @@ void TerminalEditor::init() {
@brief TerminalEditor::~TerminalEditor @brief TerminalEditor::~TerminalEditor
Destructeur Destructeur
*/ */
TerminalEditor::~TerminalEditor() { TerminalEditor::~TerminalEditor()
{
} }
/** /**
@@ -161,11 +163,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 +178,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 +199,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 +221,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
@@ -237,7 +244,8 @@ void TerminalEditor::updateYPos() {
/** /**
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());

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

@@ -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>() << '\\' << '/' << ':' << '*' << '?' << '"'
<< '<' << '>' << '|'); << '<' << '>' << '|');
} }

View File

@@ -261,7 +261,8 @@ void QETApp::systray(QSystemTrayIcon::ActivationReason reason) {
Minimizes all application windows in the systray Minimizes all application windows in the systray
\~French Reduit toutes les fenetres de l'application dans le systray \~French Reduit toutes les fenetres de l'application dans le systray
*/ */
void QETApp::reduceEveryEditor() { void QETApp::reduceEveryEditor()
{
reduceDiagramEditors(); reduceDiagramEditors();
reduceElementEditors(); reduceElementEditors();
reduceTitleBlockTemplateEditors(); reduceTitleBlockTemplateEditors();
@@ -273,7 +274,8 @@ void QETApp::reduceEveryEditor() {
Restores all application windows in the systray Restores all application windows in the systray
\~French Restaure toutes les fenetres de l'application dans le systray \~French Restaure toutes les fenetres de l'application dans le systray
*/ */
void QETApp::restoreEveryEditor() { void QETApp::restoreEveryEditor()
{
restoreDiagramEditors(); restoreDiagramEditors();
restoreElementEditors(); restoreElementEditors();
restoreTitleBlockTemplateEditors(); restoreTitleBlockTemplateEditors();
@@ -285,7 +287,8 @@ void QETApp::restoreEveryEditor() {
Minimize all schema editors in the systray Minimize all schema editors in the systray
\~French Reduit tous les editeurs de schemas dans le systray \~French Reduit tous les editeurs de schemas dans le systray
*/ */
void QETApp::reduceDiagramEditors() { void QETApp::reduceDiagramEditors()
{
setMainWindowsVisible<QETDiagramEditor>(false); setMainWindowsVisible<QETDiagramEditor>(false);
} }
@@ -294,7 +297,8 @@ void QETApp::reduceDiagramEditors() {
Restore all schema editors in the systray Restore all schema editors in the systray
\~French Restaure tous les editeurs de schemas dans le systray \~French Restaure tous les editeurs de schemas dans le systray
*/ */
void QETApp::restoreDiagramEditors() { void QETApp::restoreDiagramEditors()
{
setMainWindowsVisible<QETDiagramEditor>(true); setMainWindowsVisible<QETDiagramEditor>(true);
} }
@@ -304,7 +308,8 @@ void QETApp::restoreDiagramEditors() {
Minimize all element editors in systray Minimize all element editors in systray
\~French Reduit tous les editeurs d'element dans le systray \~French Reduit tous les editeurs d'element dans le systray
*/ */
void QETApp::reduceElementEditors() { void QETApp::reduceElementEditors()
{
setMainWindowsVisible<QETElementEditor>(false); setMainWindowsVisible<QETElementEditor>(false);
} }
@@ -313,7 +318,8 @@ void QETApp::reduceElementEditors() {
Restore all element editors in the systray Restore all element editors in the systray
\~French Restaure tous les editeurs d'element dans le systray \~French Restaure tous les editeurs d'element dans le systray
*/ */
void QETApp::restoreElementEditors() { void QETApp::restoreElementEditors()
{
setMainWindowsVisible<QETElementEditor>(true); setMainWindowsVisible<QETElementEditor>(true);
} }
@@ -321,7 +327,8 @@ void QETApp::restoreElementEditors() {
@brief QETApp::reduceTitleBlockTemplateEditors @brief QETApp::reduceTitleBlockTemplateEditors
Reduce all known template editors Reduce all known template editors
*/ */
void QETApp::reduceTitleBlockTemplateEditors() { void QETApp::reduceTitleBlockTemplateEditors()
{
setMainWindowsVisible<QETTitleBlockTemplateEditor>(false); setMainWindowsVisible<QETTitleBlockTemplateEditor>(false);
} }
@@ -329,7 +336,8 @@ void QETApp::reduceTitleBlockTemplateEditors() {
@brief QETApp::restoreTitleBlockTemplateEditors @brief QETApp::restoreTitleBlockTemplateEditors
Restore all known template editors Restore all known template editors
*/ */
void QETApp::restoreTitleBlockTemplateEditors() { void QETApp::restoreTitleBlockTemplateEditors()
{
setMainWindowsVisible<QETTitleBlockTemplateEditor>(true); setMainWindowsVisible<QETTitleBlockTemplateEditor>(true);
} }
@@ -338,7 +346,8 @@ void QETApp::restoreTitleBlockTemplateEditors() {
launches a new schema editor launches a new schema editor
\~French lance un nouvel editeur de schemas \~French lance un nouvel editeur de schemas
*/ */
void QETApp::newDiagramEditor() { void QETApp::newDiagramEditor()
{
new QETDiagramEditor(); new QETDiagramEditor();
} }
@@ -347,7 +356,8 @@ void QETApp::newDiagramEditor() {
launches a new element editor launches a new element editor
\~French lance un nouvel editeur d'element \~French lance un nouvel editeur d'element
*/ */
void QETApp::newElementEditor() { void QETApp::newElementEditor()
{
new QETElementEditor(); new QETElementEditor();
} }
@@ -355,7 +365,8 @@ void QETApp::newElementEditor() {
@brief QETApp::collectionCache @brief QETApp::collectionCache
@return the collection cache provided by the application itself. @return the collection cache provided by the application itself.
*/ */
ElementsCollectionCache *QETApp::collectionCache() { ElementsCollectionCache *QETApp::collectionCache()
{
return(collections_cache_); return(collections_cache_);
} }
@@ -510,7 +521,8 @@ QString QETApp::diagramTranslatedInfoKey(const QString &key)
@return the common title block templates collection, @return the common title block templates collection,
i.e. the one provided by QElecrotTech i.e. the one provided by QElecrotTech
*/ */
TitleBlockTemplatesFilesCollection *QETApp::commonTitleBlockTemplatesCollection() { TitleBlockTemplatesFilesCollection *QETApp::commonTitleBlockTemplatesCollection()
{
if (!m_common_tbt_collection) { if (!m_common_tbt_collection) {
m_common_tbt_collection = m_common_tbt_collection =
new TitleBlockTemplatesFilesCollection( new TitleBlockTemplatesFilesCollection(
@@ -530,7 +542,8 @@ TitleBlockTemplatesFilesCollection *QETApp::commonTitleBlockTemplatesCollection(
@return the custom title block templates collection, @return the custom title block templates collection,
i.e. the one managed by the end user i.e. the one managed by the end user
*/ */
TitleBlockTemplatesFilesCollection *QETApp::customTitleBlockTemplatesCollection() { TitleBlockTemplatesFilesCollection *QETApp::customTitleBlockTemplatesCollection()
{
if (!m_custom_tbt_collection) { if (!m_custom_tbt_collection) {
m_custom_tbt_collection = m_custom_tbt_collection =
new TitleBlockTemplatesFilesCollection( new TitleBlockTemplatesFilesCollection(
@@ -549,7 +562,8 @@ TitleBlockTemplatesFilesCollection *QETApp::customTitleBlockTemplatesCollection(
@return the list of all available title block tempaltes collections, @return the list of all available title block tempaltes collections,
beginning with the common and custom ones, plus the projects-embedded ones. beginning with the common and custom ones, plus the projects-embedded ones.
*/ */
QList<TitleBlockTemplatesCollection *> QETApp::availableTitleBlockTemplatesCollections() { QList<TitleBlockTemplatesCollection *> QETApp::availableTitleBlockTemplatesCollections()
{
QList<TitleBlockTemplatesCollection *> collections_list; QList<TitleBlockTemplatesCollection *> collections_list;
collections_list << commonTitleBlockTemplatesCollection(); collections_list << commonTitleBlockTemplatesCollection();
@@ -718,7 +732,8 @@ void QETApp::resetUserElementsDir()
@return the path of the directory containing the common title block @return the path of the directory containing the common title block
templates collection. templates collection.
*/ */
QString QETApp::commonTitleBlockTemplatesDir() { QString QETApp::commonTitleBlockTemplatesDir()
{
#ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION #ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION
if (common_tbt_dir_ != QString()) return(common_tbt_dir_); if (common_tbt_dir_ != QString()) return(common_tbt_dir_);
#endif #endif
@@ -747,7 +762,8 @@ QString QETApp::commonTitleBlockTemplatesDir() {
@return the path of the directory containing the custom title block @return the path of the directory containing the custom title block
templates collection. templates collection.
*/ */
QString QETApp::customTitleBlockTemplatesDir() { QString QETApp::customTitleBlockTemplatesDir()
{
if (m_user_custom_tbt_dir.isEmpty()) if (m_user_custom_tbt_dir.isEmpty())
{ {
QSettings settings; QSettings settings;
@@ -794,7 +810,8 @@ QString QETApp::customTitleBlockTemplatesDir() {
\~ @return The path of the QElectroTech configuration folder \~ @return The path of the QElectroTech configuration folder
\~French Le chemin du dossier de configuration de QElectroTech \~French Le chemin du dossier de configuration de QElectroTech
*/ */
QString QETApp::configDir() { QString QETApp::configDir()
{
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION #ifdef QET_ALLOW_OVERRIDE_CD_OPTION
if (config_dir != QString()) return(config_dir); if (config_dir != QString()) return(config_dir);
#endif #endif
@@ -888,7 +905,8 @@ QString QETApp::symbolicPath(const QString &real_path) {
@return the list of file extensions QElectroTech is able to open and @return the list of file extensions QElectroTech is able to open and
supposed to handle. Note they are provided with no leading point. supposed to handle. Note they are provided with no leading point.
*/ */
QStringList QETApp::handledFileExtensions() { QStringList QETApp::handledFileExtensions()
{
static QStringList ext; static QStringList ext;
if (!ext.count()) { if (!ext.count()) {
ext << "qet"; ext << "qet";
@@ -1036,7 +1054,8 @@ void QETApp::overrideLangDir(const QString &new_ld) {
@return The path of the folder containing the language files @return The path of the folder containing the language files
\~French Le chemin du dossier contenant les fichiers de langue \~French Le chemin du dossier contenant les fichiers de langue
*/ */
QString QETApp::languagesPath() { QString QETApp::languagesPath()
{
if (!lang_dir.isEmpty()) { if (!lang_dir.isEmpty()) {
return(lang_dir); return(lang_dir);
} else { } else {
@@ -1076,7 +1095,8 @@ QString QETApp::languagesPath() {
\~French true si l'utilisateur a accepte toutes les fermetures, \~French true si l'utilisateur a accepte toutes les fermetures,
false sinon false sinon
*/ */
bool QETApp::closeEveryEditor() { bool QETApp::closeEveryEditor()
{
// make sure all windows are visible before leaving // make sure all windows are visible before leaving
// s'assure que toutes les fenetres soient visibles avant de quitter // s'assure que toutes les fenetres soient visibles avant de quitter
restoreEveryEditor(); restoreEveryEditor();
@@ -1203,7 +1223,8 @@ QFont QETApp::indiTextsItemFont(qreal size)
@return schema editors @return schema editors
\~French les editeurs de schemas \~French les editeurs de schemas
*/ */
QList<QETDiagramEditor *> QETApp::diagramEditors() { QList<QETDiagramEditor *> QETApp::diagramEditors()
{
return(QETApp::instance() -> detectWindows<QETDiagramEditor>()); return(QETApp::instance() -> detectWindows<QETDiagramEditor>());
} }
@@ -1212,7 +1233,8 @@ QList<QETDiagramEditor *> QETApp::diagramEditors() {
@return element editors @return element editors
\~French les editeurs d'elements \~French les editeurs d'elements
*/ */
QList<QETElementEditor *> QETApp::elementEditors() { QList<QETElementEditor *> QETApp::elementEditors()
{
return(QETApp::instance() -> detectWindows<QETElementEditor>()); return(QETApp::instance() -> detectWindows<QETElementEditor>());
} }
@@ -1220,7 +1242,8 @@ QList<QETElementEditor *> QETApp::elementEditors() {
@brief QETApp::titleBlockTemplateEditors @brief QETApp::titleBlockTemplateEditors
@return the title block template editors @return the title block template editors
*/ */
QList<QETTitleBlockTemplateEditor *> QETApp::titleBlockTemplateEditors() { QList<QETTitleBlockTemplateEditor *> QETApp::titleBlockTemplateEditors()
{
return(QETApp::instance() -> detectWindows<QETTitleBlockTemplateEditor>()); return(QETApp::instance() -> detectWindows<QETTitleBlockTemplateEditor>());
} }
@@ -1261,7 +1284,8 @@ QList<QETTitleBlockTemplateEditor *> QETApp::titleBlockTemplateEditors(
\~ @return \~ @return
\~ @see QTextOrientationSpinBoxWidget \~ @see QTextOrientationSpinBoxWidget
*/ */
QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() { QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget()
{
QTextOrientationSpinBoxWidget *widget = new QTextOrientationSpinBoxWidget(); QTextOrientationSpinBoxWidget *widget = new QTextOrientationSpinBoxWidget();
widget -> orientationWidget() -> setFont(QETApp::diagramTextsFont()); widget -> orientationWidget() -> setFont(QETApp::diagramTextsFont());
widget -> orientationWidget() -> setUsableTexts(QList<QString>() widget -> orientationWidget() -> setUsableTexts(QList<QString>()
@@ -1283,7 +1307,8 @@ QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() {
@brief QETApp::defaultTitleBlockTemplate @brief QETApp::defaultTitleBlockTemplate
@return the default titleblock template for diagrams @return the default titleblock template for diagrams
*/ */
TitleBlockTemplate *QETApp::defaultTitleBlockTemplate() { TitleBlockTemplate *QETApp::defaultTitleBlockTemplate()
{
if (!QETApp::default_titleblock_template_) { if (!QETApp::default_titleblock_template_) {
TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(QETApp::instance()); TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(QETApp::instance());
if (titleblock_template -> loadFromXmlFile(":/titleblocks/default.titleblock")) { if (titleblock_template -> loadFromXmlFile(":/titleblocks/default.titleblock")) {
@@ -1349,7 +1374,8 @@ void QETApp::receiveMessage(int instanceId, QByteArray message)
@param T a class inheriting QMainWindow @param T a class inheriting QMainWindow
@return the list of windows of type T @return the list of windows of type T
*/ */
template <class T> QList<T *> QETApp::detectWindows() const { template <class T> QList<T *> QETApp::detectWindows() const
{
QList<T *> windows; QList<T *> windows;
foreach(QWidget *widget, qApp->topLevelWidgets()) { foreach(QWidget *widget, qApp->topLevelWidgets()) {
if (!widget -> isWindow()) continue; if (!widget -> isWindow()) continue;
@@ -1375,7 +1401,8 @@ template <class T> void QETApp::setMainWindowsVisible(bool visible) {
@return The list of recent files for projects @return The list of recent files for projects
\~French La liste des fichiers recents pour les projets \~French La liste des fichiers recents pour les projets
*/ */
RecentFiles *QETApp::projectsRecentFiles() { RecentFiles *QETApp::projectsRecentFiles()
{
return(m_projects_recent_files); return(m_projects_recent_files);
} }
@@ -1384,7 +1411,8 @@ RecentFiles *QETApp::projectsRecentFiles() {
@return The list of recent files for the elements @return The list of recent files for the elements
\~French La liste des fichiers recents pour les elements \~French La liste des fichiers recents pour les elements
*/ */
RecentFiles *QETApp::elementsRecentFiles() { RecentFiles *QETApp::elementsRecentFiles()
{
return(m_elements_recent_files); return(m_elements_recent_files);
} }
@@ -1464,7 +1492,8 @@ void QETApp::useSystemPalette(bool use) {
\~French Demande la fermeture de toutes les fenetres ; \~French Demande la fermeture de toutes les fenetres ;
si l'utilisateur les accepte, l'application quitte si l'utilisateur les accepte, l'application quitte
*/ */
void QETApp::quitQET() { void QETApp::quitQET()
{
#pragma message("@TODO Segmentation fault when closing program before loading elements is finished") #pragma message("@TODO Segmentation fault when closing program before loading elements is finished")
if (closeEveryEditor()) { if (closeEveryEditor()) {
qApp->quit(); qApp->quit();
@@ -1478,7 +1507,8 @@ void QETApp::quitQET() {
\~French Verifie s'il reste des fenetres (cachees ou non) \~French Verifie s'il reste des fenetres (cachees ou non)
et quitte s'il n'en reste plus. et quitte s'il n'en reste plus.
*/ */
void QETApp::checkRemainingWindows() { void QETApp::checkRemainingWindows()
{
/* little hack: /* little hack:
* the slot remembers after 500 ms of waiting in order to compensate * the slot remembers after 500 ms of waiting in order to compensate
* for the fact that some windows can still appear alive when they * for the fact that some windows can still appear alive when they
@@ -1733,7 +1763,8 @@ void QETApp::openTitleBlockTemplateFiles(const QStringList &files_list) {
en lancant un dialogue approprie. en lancant un dialogue approprie.
\~ @see ConfigDialog \~ @see ConfigDialog
*/ */
void QETApp::configureQET() { void QETApp::configureQET()
{
// determine the parent widget to use for the dialog // determine the parent widget to use for the dialog
// determine le widget parent a utiliser pour le dialogue // determine le widget parent a utiliser pour le dialogue
QWidget *parent_widget = qApp->activeWindow(); QWidget *parent_widget = qApp->activeWindow();
@@ -1783,7 +1814,8 @@ void QETApp::aboutQET()
\~French les barres d'outils et dock flottants de la fenetre \~French les barres d'outils et dock flottants de la fenetre
*/ */
QList<QWidget *> QETApp::floatingToolbarsAndDocksForMainWindow( QList<QWidget *> QETApp::floatingToolbarsAndDocksForMainWindow(
QMainWindow *window) const { QMainWindow *window) const
{
QList<QWidget *> widgets; QList<QWidget *> widgets;
foreach(QWidget *qw, qApp->topLevelWidgets()) { foreach(QWidget *qw, qApp->topLevelWidgets()) {
if (!qw -> isWindow()) continue; if (!qw -> isWindow()) continue;
@@ -1822,7 +1854,8 @@ QList<QWidget *> QETApp::floatingToolbarsAndDocksForMainWindow(
S'ils existent, ils sont juste memorises dans l'attribut arguments_files_. S'ils existent, ils sont juste memorises dans l'attribut arguments_files_.
Sinon, ils sont memorises dans l'attribut arguments_options_. Sinon, ils sont memorises dans l'attribut arguments_options_.
*/ */
void QETApp::parseArguments() { void QETApp::parseArguments()
{
// get the arguments // get the arguments
// recupere les arguments // recupere les arguments
QList<QString> arguments_list(qApp->arguments()); QList<QString> arguments_list(qApp->arguments());
@@ -1877,7 +1910,8 @@ void QETApp::parseArguments() {
\~French Initialise le splash screen si et seulement si l'execution est \~French Initialise le splash screen si et seulement si l'execution est
interactive. Autrement, l'attribut splash_screen_ vaut 0. interactive. Autrement, l'attribut splash_screen_ vaut 0.
*/ */
void QETApp::initSplashScreen() { void QETApp::initSplashScreen()
{
if (non_interactive_execution_) return; if (non_interactive_execution_) return;
m_splash_screen = new QSplashScreen(QPixmap(":/ico/splash.png")); m_splash_screen = new QSplashScreen(QPixmap(":/ico/splash.png"));
m_splash_screen -> show(); m_splash_screen -> show();
@@ -1909,7 +1943,8 @@ void QETApp::setSplashScreenStep(const QString &message) {
Determine and apply the language to use for the application Determine and apply the language to use for the application
\~French Determine et applique le langage a utiliser pour l'application \~French Determine et applique le langage a utiliser pour l'application
*/ */
void QETApp::initLanguage() { void QETApp::initLanguage()
{
setLanguage(langFromSetting()); setLanguage(langFromSetting());
} }
@@ -1917,7 +1952,8 @@ void QETApp::initLanguage() {
@brief QETApp::initStyle @brief QETApp::initStyle
Setup the gui style Setup the gui style
*/ */
void QETApp::initStyle() { void QETApp::initStyle()
{
initial_palette_ = qApp->palette(); initial_palette_ = qApp->palette();
//Apply or not the system style //Apply or not the system style
@@ -1939,7 +1975,8 @@ void QETApp::initStyle() {
- le dossier de la collection perso - le dossier de la collection perso
- the directory for custom title blocks - the directory for custom title blocks
*/ */
void QETApp::initConfiguration() { void QETApp::initConfiguration()
{
// create configuration files if necessary // create configuration files if necessary
// cree les dossiers de configuration si necessaire // cree les dossiers de configuration si necessaire
QDir config_dir(QETApp::configDir()); QDir config_dir(QETApp::configDir());
@@ -1974,7 +2011,8 @@ void QETApp::initConfiguration() {
Build the icon in the systray and its menu Build the icon in the systray and its menu
\~French Construit l'icone dans le systray et son menu \~French Construit l'icone dans le systray et son menu
*/ */
void QETApp::initSystemTray() { void QETApp::initSystemTray()
{
setSplashScreenStep(tr("Chargement... icône du systray", setSplashScreenStep(tr("Chargement... icône du systray",
"splash screen caption")); "splash screen caption"));
// initialization of the icon menus in the systray // initialization of the icon menus in the systray
@@ -2093,7 +2131,8 @@ QETProject *QETApp::projectFromString(const QString &url) {
builds the icon menu in the systray builds the icon menu in the systray
\~French construit le menu de l'icone dans le systray \~French construit le menu de l'icone dans le systray
*/ */
void QETApp::buildSystemTrayMenu() { void QETApp::buildSystemTrayMenu()
{
menu_systray -> clear(); menu_systray -> clear();
// get editors // get editors
@@ -2295,7 +2334,8 @@ bool QETApp::eventFiltrer(QObject *object, QEvent *e) {
Display help and usage on standard output Display help and usage on standard output
\~French Affiche l'aide et l'usage sur la sortie standard \~French Affiche l'aide et l'usage sur la sortie standard
*/ */
void QETApp::printHelp() { void QETApp::printHelp()
{
QString help( QString help(
tr("Usage : ") tr("Usage : ")
+ QFileInfo(qApp->applicationFilePath()).fileName() + QFileInfo(qApp->applicationFilePath()).fileName()
@@ -2324,7 +2364,8 @@ void QETApp::printHelp() {
Print version to standard output Print version to standard output
\~French Affiche la version sur la sortie standard \~French Affiche la version sur la sortie standard
*/ */
void QETApp::printVersion() { void QETApp::printVersion()
{
std::cout << qPrintable(QET::displayedVersion) << std::endl; std::cout << qPrintable(QET::displayedVersion) << std::endl;
} }
@@ -2333,7 +2374,8 @@ void QETApp::printVersion() {
Display license on standard output Display license on standard output
\~French Affiche la licence sur la sortie standard \~French Affiche la licence sur la sortie standard
*/ */
void QETApp::printLicense() { void QETApp::printLicense()
{
std::cout << qPrintable(QET::license()) << std::endl; std::cout << qPrintable(QET::license()) << std::endl;
} }
@@ -2342,7 +2384,8 @@ void QETApp::printLicense() {
@return the list of projects with their associated ids @return the list of projects with their associated ids
\~French la liste des projets avec leurs ids associes \~French la liste des projets avec leurs ids associes
*/ */
QMap<uint, QETProject *> QETApp::registeredProjects() { QMap<uint, QETProject *> QETApp::registeredProjects()
{
return(registered_projects_); return(registered_projects_);
} }

View File

@@ -100,7 +100,8 @@ QETArguments &QETArguments::operator=(const QETArguments &qet_arguments) {
/** /**
Destructeur Destructeur
*/ */
QETArguments::~QETArguments() { QETArguments::~QETArguments()
{
} }
/** /**
@@ -117,7 +118,8 @@ void QETArguments::setArguments(const QList<QString> &args) {
dans l'ordre suivant : options connues puis inconnues, fichiers de types dans l'ordre suivant : options connues puis inconnues, fichiers de types
projet puis element. projet puis element.
*/ */
QList<QString> QETArguments::arguments() const { QList<QString> QETArguments::arguments() const
{
return(options_ + unknown_options_ + project_files_ + element_files_ + tbt_files_); return(options_ + unknown_options_ + project_files_ + element_files_ + tbt_files_);
} }
@@ -125,49 +127,56 @@ QList<QString> QETArguments::arguments() const {
@return tous les fichiers (projets et elements) passes en parametres. @return tous les fichiers (projets et elements) passes en parametres.
Les fichiers de type projet viennent avant les fichiers de type element. Les fichiers de type projet viennent avant les fichiers de type element.
*/ */
QList<QString> QETArguments::files() const { QList<QString> QETArguments::files() const
{
return(project_files_ + element_files_ + tbt_files_); return(project_files_ + element_files_ + tbt_files_);
} }
/** /**
@return les fichiers de type projet @return les fichiers de type projet
*/ */
QList<QString> QETArguments::projectFiles() const { QList<QString> QETArguments::projectFiles() const
{
return(project_files_); return(project_files_);
} }
/** /**
@return les fichiers de type element @return les fichiers de type element
*/ */
QList<QString> QETArguments::elementFiles() const { QList<QString> QETArguments::elementFiles() const
{
return(element_files_); return(element_files_);
} }
/** /**
@return title block template files @return title block template files
*/ */
QList<QString> QETArguments::titleBlockTemplateFiles() const { QList<QString> QETArguments::titleBlockTemplateFiles() const
{
return(tbt_files_); return(tbt_files_);
} }
/** /**
@return les options reconnues @return les options reconnues
*/ */
QList<QString> QETArguments::options() const { QList<QString> QETArguments::options() const
{
return(options_); return(options_);
} }
/** /**
@return les options non reconnues @return les options non reconnues
*/ */
QList<QString> QETArguments::unknownOptions() const { QList<QString> QETArguments::unknownOptions() const
{
return(unknown_options_); return(unknown_options_);
} }
/** /**
Oublie tous les arguments de cet objet Oublie tous les arguments de cet objet
*/ */
void QETArguments::clear() { void QETArguments::clear()
{
project_files_.clear(); project_files_.clear();
element_files_.clear(); element_files_.clear();
options_.clear(); options_.clear();
@@ -290,7 +299,8 @@ void QETArguments::handleOptionArgument(const QString &option) {
@return true si l'utilisateur a specifie un dossier pour la collection @return true si l'utilisateur a specifie un dossier pour la collection
commune. commune.
*/ */
bool QETArguments::commonElementsDirSpecified() const { bool QETArguments::commonElementsDirSpecified() const
{
return(!common_elements_dir_.isEmpty()); return(!common_elements_dir_.isEmpty());
} }
@@ -298,7 +308,8 @@ bool QETArguments::commonElementsDirSpecified() const {
@return le dossier de la collection commune specifie par l'utilisateur. @return le dossier de la collection commune specifie par l'utilisateur.
Si l'utilisateur n'en a pas specifie, une chaine vide est retournee. Si l'utilisateur n'en a pas specifie, une chaine vide est retournee.
*/ */
QString QETArguments::commonElementsDir() const { QString QETArguments::commonElementsDir() const
{
return(common_elements_dir_); return(common_elements_dir_);
} }
#endif #endif
@@ -308,7 +319,8 @@ QString QETArguments::commonElementsDir() const {
@return true if the user has specified a directory for the common title @return true if the user has specified a directory for the common title
block templates collection block templates collection
*/ */
bool QETArguments::commonTitleBlockTemplatesDirSpecified() const { bool QETArguments::commonTitleBlockTemplatesDirSpecified() const
{
return(!common_tbt_dir_.isEmpty()); return(!common_tbt_dir_.isEmpty());
} }
@@ -316,7 +328,8 @@ bool QETArguments::commonTitleBlockTemplatesDirSpecified() const {
@return the directory of the common title block templates collection @return the directory of the common title block templates collection
specified by the user. If none were specified, return an empty string. specified by the user. If none were specified, return an empty string.
*/ */
QString QETArguments::commonTitleBlockTemplatesDir() const { QString QETArguments::commonTitleBlockTemplatesDir() const
{
return(common_tbt_dir_); return(common_tbt_dir_);
} }
#endif #endif
@@ -325,7 +338,8 @@ QString QETArguments::commonTitleBlockTemplatesDir() const {
/** /**
@return true si l'utilisateur a specifie un dossier pour la configuration. @return true si l'utilisateur a specifie un dossier pour la configuration.
*/ */
bool QETArguments::configDirSpecified() const { bool QETArguments::configDirSpecified() const
{
return(!config_dir_.isEmpty()); return(!config_dir_.isEmpty());
} }
@@ -333,7 +347,8 @@ bool QETArguments::configDirSpecified() const {
@return le dossier de configuration specifie par l'utilisateur. @return le dossier de configuration specifie par l'utilisateur.
Si l'utilisateur n'en a pas specifie, une chaine vide est retournee. Si l'utilisateur n'en a pas specifie, une chaine vide est retournee.
*/ */
QString QETArguments::configDir() const { QString QETArguments::configDir() const
{
return(config_dir_); return(config_dir_);
} }
#endif #endif
@@ -341,7 +356,8 @@ QString QETArguments::configDir() const {
/** /**
@return true si l'utilisateur a specifie un dossier pour les fichiers de langue @return true si l'utilisateur a specifie un dossier pour les fichiers de langue
*/ */
bool QETArguments::langDirSpecified() const { bool QETArguments::langDirSpecified() const
{
return(!lang_dir_.isEmpty()); return(!lang_dir_.isEmpty());
} }
@@ -349,7 +365,8 @@ bool QETArguments::langDirSpecified() const {
@return le dossier de langue specifie par l'utilisateur. @return le dossier de langue specifie par l'utilisateur.
Si l'utilisateur n'en a pas specifie, une chaine vide est retournee. Si l'utilisateur n'en a pas specifie, une chaine vide est retournee.
*/ */
QString QETArguments::langDir() const { QString QETArguments::langDir() const
{
return(lang_dir_); return(lang_dir_);
} }
@@ -357,7 +374,8 @@ QString QETArguments::langDir() const {
@return true si les arguments comportent une demande d'affichage de l'aide, @return true si les arguments comportent une demande d'affichage de l'aide,
false sinon false sinon
*/ */
bool QETArguments::printHelpRequested() const { bool QETArguments::printHelpRequested() const
{
return(print_help_); return(print_help_);
} }
@@ -365,7 +383,8 @@ bool QETArguments::printHelpRequested() const {
@return true si les arguments comportent une demande d'affichage de la @return true si les arguments comportent une demande d'affichage de la
licence, false sinon licence, false sinon
*/ */
bool QETArguments::printLicenseRequested() const { bool QETArguments::printLicenseRequested() const
{
return(print_license_); return(print_license_);
} }
@@ -373,6 +392,7 @@ bool QETArguments::printLicenseRequested() const {
@return true si les arguments comportent une demande d'affichage de la @return true si les arguments comportent une demande d'affichage de la
version, false sinon version, false sinon
*/ */
bool QETArguments::printVersionRequested() const { bool QETArguments::printVersionRequested() const
{
return(print_version_); return(print_version_);
} }

View File

@@ -106,8 +106,14 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
setMinimumSize(QSize(500, 350)); setMinimumSize(QSize(500, 350));
setWindowState(Qt::WindowMaximized); setWindowState(Qt::WindowMaximized);
connect (&m_workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActivated(QMdiSubWindow*))); connect (&m_workspace,
connect (QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slot_updatePasteAction())); SIGNAL(subWindowActivated(QMdiSubWindow *)),
this,
SLOT(subWindowActivated(QMdiSubWindow*)));
connect (QApplication::clipboard(),
SIGNAL(dataChanged()),
this,
SLOT(slot_updatePasteAction()));
readSettings(); readSettings();
show(); show();
@@ -128,14 +134,16 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
/** /**
Destructeur Destructeur
*/ */
QETDiagramEditor::~QETDiagramEditor() { QETDiagramEditor::~QETDiagramEditor()
{
} }
/** /**
@brief QETDiagramEditor::setUpElementsPanel @brief QETDiagramEditor::setUpElementsPanel
Setup the element panel and element panel widget Setup the element panel and element panel widget
*/ */
void QETDiagramEditor::setUpElementsPanel() { void QETDiagramEditor::setUpElementsPanel()
{
//Add the element panel as a QDockWidget //Add the element panel as a QDockWidget
qdw_pa = new QDockWidget(tr("Projets", "dock title"), this); qdw_pa = new QDockWidget(tr("Projets", "dock title"), this);
@@ -184,7 +192,8 @@ void QETDiagramEditor::setUpElementsCollectionWidget()
@brief QETDiagramEditor::setUpUndoStack @brief QETDiagramEditor::setUpUndoStack
Setup the undostack and undo stack widget Setup the undostack and undo stack widget
*/ */
void QETDiagramEditor::setUpUndoStack() { void QETDiagramEditor::setUpUndoStack()
{
QUndoView *undo_view = new QUndoView(&undo_group, this); QUndoView *undo_view = new QUndoView(&undo_group, this);
@@ -711,7 +720,8 @@ void QETDiagramEditor::setUpToolBar()
/** /**
@brief QETDiagramEditor::setUpMenu @brief QETDiagramEditor::setUpMenu
*/ */
void QETDiagramEditor::setUpMenu() { void QETDiagramEditor::setUpMenu()
{
QMenu *menu_fichier = new QMenu(tr("&Fichier")); QMenu *menu_fichier = new QMenu(tr("&Fichier"));
QMenu *menu_edition = new QMenu(tr("&Édition")); QMenu *menu_edition = new QMenu(tr("&Édition"));
@@ -729,7 +739,8 @@ void QETDiagramEditor::setUpMenu() {
// File menu // File menu
QMenu *recentfile = menu_fichier -> addMenu(QET::Icons::DocumentOpenRecent, tr("&Récemment ouverts")); QMenu *recentfile = menu_fichier -> addMenu(QET::Icons::DocumentOpenRecent, tr("&Récemment ouverts"));
recentfile->addActions(QETApp::projectsRecentFiles()->menu()->actions()); recentfile->addActions(QETApp::projectsRecentFiles()->menu()->actions());
connect(QETApp::projectsRecentFiles(), SIGNAL(fileOpeningRequested(const QString &)), this, SLOT(openRecentFile(const QString &))); connect(QETApp::projectsRecentFiles(), SIGNAL(fileOpeningRequested(const QString &)),
this, SLOT(openRecentFile(const QString &)));
menu_fichier -> addActions(m_file_actions_group.actions()); menu_fichier -> addActions(m_file_actions_group.actions());
menu_fichier -> addSeparator(); menu_fichier -> addSeparator();
//menu_fichier -> addAction(import_diagram); //menu_fichier -> addAction(import_diagram);
@@ -804,7 +815,8 @@ void QETDiagramEditor::setUpMenu() {
Permet de quitter l'application lors de la fermeture de la fenetre principale Permet de quitter l'application lors de la fermeture de la fenetre principale
@param qce Le QCloseEvent correspondant a l'evenement de fermeture @param qce Le QCloseEvent correspondant a l'evenement de fermeture
*/ */
void QETDiagramEditor::closeEvent(QCloseEvent *qce) { void QETDiagramEditor::closeEvent(QCloseEvent *qce)
{
// quitte directement s'il n'y a aucun projet ouvert // quitte directement s'il n'y a aucun projet ouvert
bool can_quit = true; bool can_quit = true;
if (openedProjects().count()) { if (openedProjects().count()) {
@@ -850,7 +862,8 @@ bool QETDiagramEditor::event(QEvent *e)
@brief QETDiagramEditor::save @brief QETDiagramEditor::save
Ask the current active project to save Ask the current active project to save
*/ */
void QETDiagramEditor::save() { void QETDiagramEditor::save()
{
if (ProjectView *project_view = currentProjectView()) { if (ProjectView *project_view = currentProjectView()) {
QETResult saved = project_view -> save(); QETResult saved = project_view -> save();
@@ -874,7 +887,8 @@ void QETDiagramEditor::save() {
@brief QETDiagramEditor::saveAs @brief QETDiagramEditor::saveAs
Ask the current active project to save as Ask the current active project to save as
*/ */
void QETDiagramEditor::saveAs() { void QETDiagramEditor::saveAs()
{
if (ProjectView *project_view = currentProjectView()) { if (ProjectView *project_view = currentProjectView()) {
QETResult save_file = project_view -> saveAs(); QETResult save_file = project_view -> saveAs();
if (save_file.isOk()) { if (save_file.isOk()) {
@@ -914,7 +928,8 @@ bool QETDiagramEditor::newProject()
@param filepath Fichier a ouvrir @param filepath Fichier a ouvrir
@see openAndAddDiagram @see openAndAddDiagram
*/ */
bool QETDiagramEditor::openRecentFile(const QString &filepath) { bool QETDiagramEditor::openRecentFile(const QString &filepath)
{
// small hack to prevent all diagram editors from trying to topen the required // small hack to prevent all diagram editors from trying to topen the required
// recent file at the same time // recent file at the same time
if (qApp -> activeWindow() != this) return(false); if (qApp -> activeWindow() != this) return(false);
@@ -925,7 +940,8 @@ bool QETDiagramEditor::openRecentFile(const QString &filepath) {
Cette fonction demande un nom de fichier a ouvrir a l'utilisateur Cette fonction demande un nom de fichier a ouvrir a l'utilisateur
@return true si l'ouverture a reussi, false sinon @return true si l'ouverture a reussi, false sinon
*/ */
bool QETDiagramEditor::openProject() { bool QETDiagramEditor::openProject()
{
// demande un chemin de fichier a ouvrir a l'utilisateur // demande un chemin de fichier a ouvrir a l'utilisateur
QString filepath = QFileDialog::getOpenFileName( QString filepath = QFileDialog::getOpenFileName(
this, this,
@@ -948,7 +964,8 @@ bool QETDiagramEditor::openProject() {
@return true si la fermeture du projet a reussi, false sinon @return true si la fermeture du projet a reussi, false sinon
Note : cette methode renvoie true si project est nul Note : cette methode renvoie true si project est nul
*/ */
bool QETDiagramEditor::closeProject(ProjectView *project_view) { bool QETDiagramEditor::closeProject(ProjectView *project_view)
{
if (project_view) { if (project_view) {
activateProject(project_view); activateProject(project_view);
if (QMdiSubWindow *sub_window = subWindowForWidget(project_view)){ if (QMdiSubWindow *sub_window = subWindowForWidget(project_view)){
@@ -964,7 +981,8 @@ bool QETDiagramEditor::closeProject(ProjectView *project_view) {
@return true si la fermeture du fichier a reussi, false sinon @return true si la fermeture du fichier a reussi, false sinon
Note : cette methode renvoie true si project est nul Note : cette methode renvoie true si project est nul
*/ */
bool QETDiagramEditor::closeProject(QETProject *project) { bool QETDiagramEditor::closeProject(QETProject *project)
{
if (ProjectView *project_view = findProject(project)) { if (ProjectView *project_view = findProject(project)) {
return(closeProject(project_view)); return(closeProject(project_view));
} }
@@ -977,7 +995,9 @@ bool QETDiagramEditor::closeProject(QETProject *project) {
@param interactive true pour afficher des messages a l'utilisateur, false sinon @param interactive true pour afficher des messages a l'utilisateur, false sinon
@return true si l'ouverture a reussi, false sinon @return true si l'ouverture a reussi, false sinon
*/ */
bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interactive) bool QETDiagramEditor::openAndAddProject(
const QString &filepath,
bool interactive)
{ {
if (filepath.isEmpty()) return(false); if (filepath.isEmpty()) return(false);
@@ -1086,7 +1106,8 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti
@param update_panel Whether the elements panel should be warned this @param update_panel Whether the elements panel should be warned this
project has been added. Defaults to true. project has been added. Defaults to true.
*/ */
bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) { bool QETDiagramEditor::addProject(QETProject *project, bool update_panel)
{
// enregistre le projet // enregistre le projet
QETApp::registerProject(project); QETApp::registerProject(project);
@@ -1111,7 +1132,8 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) {
/** /**
@return la liste des projets ouverts dans cette fenetre @return la liste des projets ouverts dans cette fenetre
*/ */
QList<ProjectView *> QETDiagramEditor::openedProjects() const { QList<ProjectView *> QETDiagramEditor::openedProjects() const
{
QList<ProjectView *> result; QList<ProjectView *> result;
QList<QMdiSubWindow *> window_list(m_workspace.subWindowList()); QList<QMdiSubWindow *> window_list(m_workspace.subWindowList());
foreach(QMdiSubWindow *window, window_list) { foreach(QMdiSubWindow *window, window_list) {
@@ -1126,7 +1148,8 @@ QList<ProjectView *> QETDiagramEditor::openedProjects() const {
@return Le projet actuellement edite (= qui a le focus dans l'interface @return Le projet actuellement edite (= qui a le focus dans l'interface
MDI) ou 0 s'il n'y en a pas MDI) ou 0 s'il n'y en a pas
*/ */
ProjectView *QETDiagramEditor::currentProjectView() const { ProjectView *QETDiagramEditor::currentProjectView() const
{
QMdiSubWindow *current_window = m_workspace.activeSubWindow(); QMdiSubWindow *current_window = m_workspace.activeSubWindow();
if (!current_window) return(nullptr); if (!current_window) return(nullptr);
@@ -1159,7 +1182,8 @@ QETProject *QETDiagramEditor::currentProject() const
@return Le schema actuellement edite (= l'onglet ouvert dans le projet @return Le schema actuellement edite (= l'onglet ouvert dans le projet
courant) ou 0 s'il n'y en a pas courant) ou 0 s'il n'y en a pas
*/ */
DiagramView *QETDiagramEditor::currentDiagramView() const { DiagramView *QETDiagramEditor::currentDiagramView() const
{
if (ProjectView *project_view = currentProjectView()) { if (ProjectView *project_view = currentProjectView()) {
return(project_view -> currentDiagram()); return(project_view -> currentDiagram());
} }
@@ -1190,7 +1214,8 @@ Element *QETDiagramEditor::currentElement() const
@param diagram_view Schema dont il faut retrouver @param diagram_view Schema dont il faut retrouver
@return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas @return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas
*/ */
ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const { ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const
{
foreach(ProjectView *project_view, openedProjects()) { foreach(ProjectView *project_view, openedProjects()) {
if (project_view -> diagram_views().contains(diagram_view)) { if (project_view -> diagram_views().contains(diagram_view)) {
return(project_view); return(project_view);
@@ -1204,7 +1229,8 @@ ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const {
@param diagram Schema dont il faut retrouver @param diagram Schema dont il faut retrouver
@return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas @return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas
*/ */
ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const { ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const
{
foreach(ProjectView *project_view, openedProjects()) { foreach(ProjectView *project_view, openedProjects()) {
foreach(DiagramView *diagram_view, project_view -> diagram_views()) { foreach(DiagramView *diagram_view, project_view -> diagram_views()) {
if (diagram_view -> diagram() == diagram) { if (diagram_view -> diagram() == diagram) {
@@ -1219,7 +1245,8 @@ ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const {
@param project Projet dont il faut trouver la vue @param project Projet dont il faut trouver la vue
@return la vue du projet passe en parametre @return la vue du projet passe en parametre
*/ */
ProjectView *QETDiagramEditor::findProject(QETProject *project) const { ProjectView *QETDiagramEditor::findProject(QETProject *project) const
{
foreach(ProjectView *opened_project, openedProjects()) { foreach(ProjectView *opened_project, openedProjects()) {
if (opened_project -> project() == project) { if (opened_project -> project() == project) {
return(opened_project); return(opened_project);
@@ -1233,7 +1260,8 @@ ProjectView *QETDiagramEditor::findProject(QETProject *project) const {
@return le ProjectView correspondant au chemin passe en parametre, ou 0 si @return le ProjectView correspondant au chemin passe en parametre, ou 0 si
celui-ci n'a pas ete trouve celui-ci n'a pas ete trouve
*/ */
ProjectView *QETDiagramEditor::findProject(const QString &filepath) const { ProjectView *QETDiagramEditor::findProject(const QString &filepath) const
{
foreach(ProjectView *opened_project, openedProjects()) { foreach(ProjectView *opened_project, openedProjects()) {
if (QETProject *project = opened_project -> project()) { if (QETProject *project = opened_project -> project()) {
if (project -> filePath() == filepath) { if (project -> filePath() == filepath) {
@@ -1249,7 +1277,8 @@ ProjectView *QETDiagramEditor::findProject(const QString &filepath) const {
@return La sous-fenetre accueillant le widget passe en parametre, ou 0 si @return La sous-fenetre accueillant le widget passe en parametre, ou 0 si
celui-ci n'a pas ete trouve. celui-ci n'a pas ete trouve.
*/ */
QMdiSubWindow *QETDiagramEditor::subWindowForWidget(QWidget *widget) const { QMdiSubWindow *QETDiagramEditor::subWindowForWidget(QWidget *widget) const
{
foreach(QMdiSubWindow *sub_window, m_workspace.subWindowList()) { foreach(QMdiSubWindow *sub_window, m_workspace.subWindowList()) {
if (sub_window -> widget() == widget) { if (sub_window -> widget() == widget) {
return(sub_window); return(sub_window);
@@ -1470,7 +1499,8 @@ void QETDiagramEditor::slot_updateActions()
@brief QETDiagramEditor::slot_updateAutoNumDock @brief QETDiagramEditor::slot_updateAutoNumDock
Update Auto Num Dock Widget when changing Project Update Auto Num Dock Widget when changing Project
*/ */
void QETDiagramEditor::slot_updateAutoNumDock() { void QETDiagramEditor::slot_updateAutoNumDock()
{
if ( m_workspace.subWindowList().indexOf(m_workspace.activeSubWindow()) != activeSubWindowIndex) { if ( m_workspace.subWindowList().indexOf(m_workspace.activeSubWindow()) != activeSubWindowIndex) {
activeSubWindowIndex = m_workspace.subWindowList().indexOf(m_workspace.activeSubWindow()); activeSubWindowIndex = m_workspace.subWindowList().indexOf(m_workspace.activeSubWindow());
if (currentProjectView() != nullptr && currentDiagramView() != nullptr) { if (currentProjectView() != nullptr && currentDiagramView() != nullptr) {
@@ -1672,7 +1702,8 @@ void QETDiagramEditor::slot_updateModeActions()
@brief QETDiagramEditor::slot_updatePasteAction @brief QETDiagramEditor::slot_updatePasteAction
Gere les actions ayant besoin du presse-papier Gere les actions ayant besoin du presse-papier
*/ */
void QETDiagramEditor::slot_updatePasteAction() { void QETDiagramEditor::slot_updatePasteAction()
{
DiagramView *dv = currentDiagramView(); DiagramView *dv = currentDiagramView();
bool editable_diagram = (dv && !dv -> diagram() -> isReadOnly()); bool editable_diagram = (dv && !dv -> diagram() -> isReadOnly());
@@ -1742,7 +1773,8 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view)
/** /**
@return la liste des fichiers edites par cet editeur de schemas @return la liste des fichiers edites par cet editeur de schemas
*/ */
QList<QString> QETDiagramEditor::editedFiles() const { QList<QString> QETDiagramEditor::editedFiles() const
{
QList<QString> edited_files_list; QList<QString> edited_files_list;
foreach (ProjectView *project_view, openedProjects()) { foreach (ProjectView *project_view, openedProjects()) {
QString diagram_file(project_view -> project() -> filePath()); QString diagram_file(project_view -> project() -> filePath());
@@ -1759,7 +1791,8 @@ QList<QString> QETDiagramEditor::editedFiles() const {
@return le ProjectView editant le fichier filepath, ou 0 si ce fichier n'est @return le ProjectView editant le fichier filepath, ou 0 si ce fichier n'est
pas edite par cet editeur de schemas. pas edite par cet editeur de schemas.
*/ */
ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const { ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const
{
if (filepath.isEmpty()) return(nullptr); if (filepath.isEmpty()) return(nullptr);
QString searched_can_file_path = QFileInfo(filepath).canonicalFilePath(); QString searched_can_file_path = QFileInfo(filepath).canonicalFilePath();
@@ -1780,7 +1813,8 @@ ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const {
@brief QETDiagramEditor::drawGrid @brief QETDiagramEditor::drawGrid
@return true if the grid of folio must be displayed @return true if the grid of folio must be displayed
*/ */
bool QETDiagramEditor::drawGrid() const { bool QETDiagramEditor::drawGrid() const
{
return m_draw_grid->isChecked(); return m_draw_grid->isChecked();
} }
@@ -1800,8 +1834,11 @@ void QETDiagramEditor::openBackupFiles(QList<KAutoSaveFile *> backup_files)
{ {
if (project -> state() != QETProject::FileOpenDiscard) if (project -> state() != QETProject::FileOpenDiscard)
{ {
QET::QetMessageBox::warning(this, tr("Échec de l'ouverture du projet", "message box title"), QET::QetMessageBox::warning(
QString(tr("Une erreur est survenue lors de l'ouverture du fichier %1.", this,
tr("Échec de l'ouverture du projet", "message box title"),
QString(tr(
"Une erreur est survenue lors de l'ouverture du fichier %1.",
"message box content")).arg(file->managedFile().fileName())); "message box content")).arg(file->managedFile().fileName()));
} }
delete project; delete project;
@@ -1815,7 +1852,8 @@ void QETDiagramEditor::openBackupFiles(QList<KAutoSaveFile *> backup_files)
/** /**
met a jour le menu "Fenetres" met a jour le menu "Fenetres"
*/ */
void QETDiagramEditor::slot_updateWindowsMenu() { void QETDiagramEditor::slot_updateWindowsMenu()
{
// nettoyage du menu // nettoyage du menu
foreach(QAction *a, windows_menu -> actions()) windows_menu -> removeAction(a); foreach(QAction *a, windows_menu -> actions()) windows_menu -> removeAction(a);
@@ -1859,7 +1897,8 @@ void QETDiagramEditor::slot_updateWindowsMenu() {
Edite les proprietes du schema diagram Edite les proprietes du schema diagram
@param diagram_view schema dont il faut editer les proprietes @param diagram_view schema dont il faut editer les proprietes
*/ */
void QETDiagramEditor::editDiagramProperties(DiagramView *diagram_view) { void QETDiagramEditor::editDiagramProperties(DiagramView *diagram_view)
{
if (ProjectView *project_view = findProject(diagram_view)) { if (ProjectView *project_view = findProject(diagram_view)) {
activateProject(project_view); activateProject(project_view);
project_view -> editDiagramProperties(diagram_view); project_view -> editDiagramProperties(diagram_view);
@@ -1870,7 +1909,8 @@ void QETDiagramEditor::editDiagramProperties(DiagramView *diagram_view) {
Edite les proprietes du schema diagram Edite les proprietes du schema diagram
@param diagram schema dont il faut editer les proprietes @param diagram schema dont il faut editer les proprietes
*/ */
void QETDiagramEditor::editDiagramProperties(Diagram *diagram) { void QETDiagramEditor::editDiagramProperties(Diagram *diagram)
{
if (ProjectView *project_view = findProject(diagram)) { if (ProjectView *project_view = findProject(diagram)) {
activateProject(project_view); activateProject(project_view);
project_view -> editDiagramProperties(diagram); project_view -> editDiagramProperties(diagram);
@@ -1880,7 +1920,8 @@ void QETDiagramEditor::editDiagramProperties(Diagram *diagram) {
/** /**
Affiche les projets dans des fenetres. Affiche les projets dans des fenetres.
*/ */
void QETDiagramEditor::setWindowedMode() { void QETDiagramEditor::setWindowedMode()
{
m_workspace.setViewMode(QMdiArea::SubWindowView); m_workspace.setViewMode(QMdiArea::SubWindowView);
m_windowed_view_mode -> setChecked(true); m_windowed_view_mode -> setChecked(true);
slot_updateWindowsMenu(); slot_updateWindowsMenu();
@@ -1889,7 +1930,8 @@ void QETDiagramEditor::setWindowedMode() {
/** /**
Affiche les projets dans des onglets. Affiche les projets dans des onglets.
*/ */
void QETDiagramEditor::setTabbedMode() { void QETDiagramEditor::setTabbedMode()
{
m_workspace.setViewMode(QMdiArea::TabbedView); m_workspace.setViewMode(QMdiArea::TabbedView);
m_tabbed_view_mode -> setChecked(true); m_tabbed_view_mode -> setChecked(true);
slot_updateWindowsMenu(); slot_updateWindowsMenu();
@@ -1935,7 +1977,8 @@ void QETDiagramEditor::writeSettings()
Active le schema passe en parametre Active le schema passe en parametre
@param diagram Schema a activer @param diagram Schema a activer
*/ */
void QETDiagramEditor::activateDiagram(Diagram *diagram) { void QETDiagramEditor::activateDiagram(Diagram *diagram)
{
if (QETProject *project = diagram -> project()) { if (QETProject *project = diagram -> project()) {
if (ProjectView *project_view = findProject(project)) { if (ProjectView *project_view = findProject(project)) {
activateWidget(project_view); activateWidget(project_view);
@@ -1950,7 +1993,8 @@ void QETDiagramEditor::activateDiagram(Diagram *diagram) {
Active le projet passe en parametre Active le projet passe en parametre
@param project Projet a activer @param project Projet a activer
*/ */
void QETDiagramEditor::activateProject(QETProject *project) { void QETDiagramEditor::activateProject(QETProject *project)
{
activateProject(findProject(project)); activateProject(findProject(project));
} }
@@ -1958,12 +2002,14 @@ void QETDiagramEditor::activateProject(QETProject *project) {
Active le projet passe en parametre Active le projet passe en parametre
@param project_view Projet a activer @param project_view Projet a activer
*/ */
void QETDiagramEditor::activateProject(ProjectView *project_view) { void QETDiagramEditor::activateProject(ProjectView *project_view)
{
if (!project_view) return; if (!project_view) return;
activateWidget(project_view); activateWidget(project_view);
} }
/*** @brief QETDiagramEditor::projectWasClosed /**
@brief QETDiagramEditor::projectWasClosed
Manage the close of a project. Manage the close of a project.
@param project_view @param project_view
*/ */
@@ -1990,7 +2036,8 @@ void QETDiagramEditor::projectWasClosed(ProjectView *project_view)
Edite les proprietes du projet project_view. Edite les proprietes du projet project_view.
@param project_view Vue sur le projet dont il faut editer les proprietes @param project_view Vue sur le projet dont il faut editer les proprietes
*/ */
void QETDiagramEditor::editProjectProperties(ProjectView *project_view) { void QETDiagramEditor::editProjectProperties(ProjectView *project_view)
{
if (!project_view) return; if (!project_view) return;
activateProject(project_view); activateProject(project_view);
project_view -> editProjectProperties(); project_view -> editProjectProperties();
@@ -2000,7 +2047,8 @@ void QETDiagramEditor::editProjectProperties(ProjectView *project_view) {
Edite les proprietes du projet project. Edite les proprietes du projet project.
@param project Projet dont il faut editer les proprietes @param project Projet dont il faut editer les proprietes
*/ */
void QETDiagramEditor::editProjectProperties(QETProject *project) { void QETDiagramEditor::editProjectProperties(QETProject *project)
{
editProjectProperties(findProject(project)); editProjectProperties(findProject(project));
} }
@@ -2026,7 +2074,8 @@ void QETDiagramEditor::addDiagramToProject(QETProject *project)
Supprime un schema de son projet Supprime un schema de son projet
@param diagram Schema a supprimer @param diagram Schema a supprimer
*/ */
void QETDiagramEditor::removeDiagram(Diagram *diagram) { void QETDiagramEditor::removeDiagram(Diagram *diagram)
{
if (!diagram) return; if (!diagram) return;
// recupere le projet contenant le schema // recupere le projet contenant le schema
@@ -2048,7 +2097,8 @@ void QETDiagramEditor::removeDiagram(Diagram *diagram) {
la gauche la gauche
@param diagram Schema a decaler vers le haut / la gauche @param diagram Schema a decaler vers le haut / la gauche
*/ */
void QETDiagramEditor::moveDiagramUp(Diagram *diagram) { void QETDiagramEditor::moveDiagramUp(Diagram *diagram)
{
if (!diagram) return; if (!diagram) return;
// recupere le projet contenant le schema // recupere le projet contenant le schema
@@ -2067,7 +2117,8 @@ void QETDiagramEditor::moveDiagramUp(Diagram *diagram) {
la droite la droite
@param diagram Schema a decaler vers le bas / la droite @param diagram Schema a decaler vers le bas / la droite
*/ */
void QETDiagramEditor::moveDiagramDown(Diagram *diagram) { void QETDiagramEditor::moveDiagramDown(Diagram *diagram)
{
if (!diagram) return; if (!diagram) return;
// recupere le projet contenant le schema // recupere le projet contenant le schema
@@ -2086,7 +2137,8 @@ void QETDiagramEditor::moveDiagramDown(Diagram *diagram) {
la gauche en position 0 la gauche en position 0
@param diagram Schema a decaler vers le haut / la gauche en position 0 @param diagram Schema a decaler vers le haut / la gauche en position 0
*/ */
void QETDiagramEditor::moveDiagramUpTop(Diagram *diagram) { void QETDiagramEditor::moveDiagramUpTop(Diagram *diagram)
{
if (!diagram) return; if (!diagram) return;
// recupere le projet contenant le schema // recupere le projet contenant le schema
@@ -2106,7 +2158,8 @@ void QETDiagramEditor::moveDiagramUpTop(Diagram *diagram) {
la gauche x10 la gauche x10
@param diagram Schema a decaler vers le haut / la gauche x10 @param diagram Schema a decaler vers le haut / la gauche x10
*/ */
void QETDiagramEditor::moveDiagramUpx10(Diagram *diagram) { void QETDiagramEditor::moveDiagramUpx10(Diagram *diagram)
{
if (!diagram) return; if (!diagram) return;
// recupere le projet contenant le schema // recupere le projet contenant le schema
@@ -2125,7 +2178,8 @@ void QETDiagramEditor::moveDiagramUpx10(Diagram *diagram) {
la droite x10 la droite x10
@param diagram Schema a decaler vers le bas / la droite x10 @param diagram Schema a decaler vers le bas / la droite x10
*/ */
void QETDiagramEditor::moveDiagramDownx10(Diagram *diagram) { void QETDiagramEditor::moveDiagramDownx10(Diagram *diagram)
{
if (!diagram) return; if (!diagram) return;
// recupere le projet contenant le schema // recupere le projet contenant le schema
@@ -2139,7 +2193,8 @@ void QETDiagramEditor::moveDiagramDownx10(Diagram *diagram) {
} }
} }
void QETDiagramEditor::reloadOldElementPanel() { void QETDiagramEditor::reloadOldElementPanel()
{
pa->reloadAndFilter(); pa->reloadAndFilter();
} }
@@ -2187,7 +2242,8 @@ void QETDiagramEditor::findElementInPanel(const ElementsLocation &location)
Lance l'editeur d'element pour l'element filename Lance l'editeur d'element pour l'element filename
@param location Emplacement de l'element a editer @param location Emplacement de l'element a editer
*/ */
void QETDiagramEditor::editElementInEditor(const ElementsLocation &location) { void QETDiagramEditor::editElementInEditor(const ElementsLocation &location)
{
QETApp::instance() -> openElementLocations(QList<ElementsLocation>() QETApp::instance() -> openElementLocations(QList<ElementsLocation>()
<< location); << location);
} }
@@ -2196,7 +2252,8 @@ void QETDiagramEditor::editElementInEditor(const ElementsLocation &location) {
Launch an element editor to edit the selected element in the current Launch an element editor to edit the selected element in the current
diagram view. diagram view.
*/ */
void QETDiagramEditor::editSelectedElementInEditor() { void QETDiagramEditor::editSelectedElementInEditor()
{
if (Element *selected_element = currentElement()) { if (Element *selected_element = currentElement()) {
editElementInEditor(selected_element -> location()); editElementInEditor(selected_element -> location());
} }
@@ -2205,7 +2262,8 @@ void QETDiagramEditor::editSelectedElementInEditor() {
/** /**
Show the error message contained in \a result. Show the error message contained in \a result.
*/ */
void QETDiagramEditor::showError(const QETResult &result) { void QETDiagramEditor::showError(const QETResult &result)
{
if (result.isOk()) return; if (result.isOk()) return;
showError(result.errorMessage()); showError(result.errorMessage());
} }
@@ -2213,7 +2271,8 @@ void QETDiagramEditor::showError(const QETResult &result) {
/** /**
Show the \a error message. Show the \a error message.
*/ */
void QETDiagramEditor::showError(const QString &error) { void QETDiagramEditor::showError(const QString &error)
{
if (error.isEmpty()) return; if (error.isEmpty()) return;
QET::QetMessageBox::critical(this, tr("Erreur", "message box title"), error); QET::QetMessageBox::critical(this, tr("Erreur", "message box title"), error);
} }

View File

@@ -52,14 +52,10 @@ class QETDiagramEditor : public QETMainWindow
Q_OBJECT Q_OBJECT
public: public:
QETDiagramEditor(const QStringList & = QStringList(), QETDiagramEditor(
const QStringList & = QStringList(),
QWidget * = nullptr); QWidget * = nullptr);
~QETDiagramEditor() override; ~QETDiagramEditor() override;
private:
QETDiagramEditor(const QETDiagramEditor &);
public:
void closeEvent (QCloseEvent *) override; void closeEvent (QCloseEvent *) override;
QList<ProjectView *> openedProjects () const; QList<ProjectView *> openedProjects () const;
void addProjectView (ProjectView *); void addProjectView (ProjectView *);
@@ -73,8 +69,8 @@ class QETDiagramEditor : public QETMainWindow
protected: protected:
bool event(QEvent *) override; bool event(QEvent *) override;
private: private:
QETDiagramEditor(const QETDiagramEditor &);
void setUpElementsPanel (); void setUpElementsPanel ();
void setUpElementsCollectionWidget(); void setUpElementsCollectionWidget();
void setUpUndoStack (); void setUpUndoStack ();
@@ -148,70 +144,78 @@ class QETDiagramEditor : public QETMainWindow
void selectionChanged(); void selectionChanged();
public: public:
QAction *m_edit_diagram_properties; ///< Show a dialog to edit diagram properties QAction
QAction *m_conductor_reset; ///< Reset paths of selected conductors *m_edit_diagram_properties, ///< Show a dialog to edit diagram properties
QAction *m_cut; ///< Cut selection to clipboard *m_conductor_reset, ///< Reset paths of selected conductors
QAction *m_copy; ///< Copy selection to clipboard *m_cut, ///< Cut selection to clipboard
*m_copy; ///< Copy selection to clipboard
QActionGroup m_row_column_actions_group; /// Action related to add/remove rows/column in diagram QActionGroup
QActionGroup m_selection_actions_group; ///Action related to edit a selected item m_row_column_actions_group, /// Action related to add/remove rows/column in diagram
QActionGroup *m_depth_action_group = nullptr; m_selection_actions_group, ///Action related to edit a selected item
*m_depth_action_group = nullptr;
private: private:
QActionGroup *grp_visu_sel; ///< Action group for visualisation vs edition mode QActionGroup
QActionGroup *m_group_view_mode; ///< Action group for project *grp_visu_sel, ///< Action group for visualisation vs edition mode
QActionGroup m_add_item_actions_group; ///Action related to adding (add text image shape...) *m_group_view_mode, ///< Action group for project
QActionGroup m_zoom_actions_group; ///Action related to zoom for diagram m_add_item_actions_group, ///Action related to adding (add text image shape...)
QActionGroup m_select_actions_group; ///Action related to global selections m_zoom_actions_group, ///Action related to zoom for diagram
QActionGroup m_file_actions_group; ///Actions related to file (open, close, save...) m_select_actions_group, ///Action related to global selections
m_file_actions_group; ///Actions related to file (open, close, save...)
QAction
*m_tabbed_view_mode, ///< Display projects as tabs
*m_windowed_view_mode, ///< Display projects as windows
*m_mode_selection, ///< Set edition mode
*m_mode_visualise, ///< Set visualisation mode
*m_export_diagram, ///< Export diagrams of the current project as imagess
*m_print, ///< Print diagrams of the current project
*m_quit_editor, ///< Quit the diagram editor
*undo, ///< Cancel the latest action
*redo, ///< Redo the latest cancelled operation
*m_paste, ///< Paste clipboard content on the current diagram
*m_auto_conductor, ///< Enable/Disable the use of auto conductor
*conductor_default, ///< Show a dialog to edit default conductor properties
*m_grey_background, ///< Switch the background color in white or grey
*m_draw_grid, ///< Switch the background grid display or not
*m_project_edit_properties, ///< Edit the properties of the current project.
*m_project_add_diagram, ///< Add a diagram to the current project.
*m_remove_diagram_from_project, ///< Delete a diagram from the current project
*m_clean_project, ///< Clean the content of the curent project by removing useless items
*m_project_folio_list, ///< Sommaire des schemas
*m_csv_export, ///< generate nomenclature
*m_add_nomenclature, ///< Add nomenclature graphics item;
*m_add_summary, ///<Add summary graphics item
*m_project_terminalBloc, ///< generate terminal block
*m_project_export_conductor_num,///<Export the wire num to csv
*m_export_project_db, ///Export to file the internal database of the current project
*m_tile_window, ///< Show MDI subwindows as tile
*m_cascade_window, ///< Show MDI subwindows as cascade
*m_previous_window, ///< Switch to the previous document
*m_next_window, ///< Switch to the next document
*m_edit_selection, ///< To edit selected item
*m_delete_selection, ///< Delete selection
*m_rotate_selection, ///< Rotate selected elements and text items by 90 degrees
*m_rotate_texts, ///< Direct selected text items to a specific angle
*m_find_element, ///< Find the selected element in the panel
*m_group_selected_texts = nullptr,
*m_close_file, ///< Close current project file
*m_save_file, ///< Save current project
*m_save_file_as, ///< Save current project as a specific file
*m_find = nullptr;
QAction *m_tabbed_view_mode; ///< Display projects as tabs
QAction *m_windowed_view_mode; ///< Display projects as windows
QAction *m_mode_selection; ///< Set edition mode
QAction *m_mode_visualise; ///< Set visualisation mode
QAction *m_export_diagram; ///< Export diagrams of the current project as imagess
QAction *m_print; ///< Print diagrams of the current project
QAction *m_quit_editor; ///< Quit the diagram editor
QAction *undo; ///< Cancel the latest action
QAction *redo; ///< Redo the latest cancelled operation
QAction *m_paste; ///< Paste clipboard content on the current diagram
QAction *m_auto_conductor; ///< Enable/Disable the use of auto conductor
QAction *conductor_default; ///< Show a dialog to edit default conductor properties
QAction *m_grey_background; ///< Switch the background color in white or grey
QAction *m_draw_grid; ///< Switch the background grid display or not
QAction *m_project_edit_properties; ///< Edit the properties of the current project.
QAction *m_project_add_diagram; ///< Add a diagram to the current project.
QAction *m_remove_diagram_from_project; ///< Delete a diagram from the current project
QAction *m_clean_project; ///< Clean the content of the curent project by removing useless items
QAction *m_project_folio_list; ///< Sommaire des schemas
QAction *m_csv_export; ///< generate nomenclature
QAction *m_add_nomenclature; ///< Add nomenclature graphics item;
QAction *m_add_summary; ///<Add summary graphics item
QAction *m_project_terminalBloc; ///< generate terminal block
QAction *m_project_export_conductor_num; ///<Export the wire num to csv
QAction *m_export_project_db; ///Export to file the internal database of the current project
QAction *m_tile_window; ///< Show MDI subwindows as tile
QAction *m_cascade_window; ///< Show MDI subwindows as cascade
QAction *m_previous_window; ///< Switch to the previous document
QAction *m_next_window; ///< Switch to the next document
QAction *m_edit_selection; ///< To edit selected item
QList <QAction *> m_zoom_action_toolBar; ///Only zoom action must displayed in the toolbar QList <QAction *> m_zoom_action_toolBar; ///Only zoom action must displayed in the toolbar
QAction *m_delete_selection; ///< Delete selection
QAction *m_rotate_selection; ///< Rotate selected elements and text items by 90 degrees
QAction *m_rotate_texts; ///< Direct selected text items to a specific angle
QAction *m_find_element; ///< Find the selected element in the panel
QAction *m_group_selected_texts = nullptr;
QAction *m_close_file; ///< Close current project file
QAction *m_save_file; ///< Save current project
QAction *m_save_file_as; ///< Save current project as a specific file
QAction *m_find = nullptr;
QMdiArea m_workspace; QMdiArea m_workspace;
QSignalMapper windowMapper; QSignalMapper windowMapper;
QDir open_dialog_dir; /// Directory to use for file dialogs such as File > save QDir open_dialog_dir; /// Directory to use for file dialogs such as File > save
QDockWidget *qdw_pa; /// Dock for the elements panel
QDockWidget *m_qdw_elmt_collection; QDockWidget
QDockWidget *qdw_undo; /// Dock for the undo list *qdw_pa, /// Dock for the elements panel
*m_qdw_elmt_collection,
*qdw_undo; /// Dock for the undo list
ElementsCollectionWidget *m_element_collection_widget; ElementsCollectionWidget *m_element_collection_widget;
DiagramPropertiesEditorDockWidget *m_selection_properties_editor; DiagramPropertiesEditorDockWidget *m_selection_properties_editor;
@@ -219,7 +223,8 @@ class QETDiagramEditor : public QETMainWindow
ElementsPanelWidget *pa; ElementsPanelWidget *pa;
QMenu *windows_menu; QMenu *windows_menu;
QToolBar *main_tool_bar = nullptr, QToolBar
*main_tool_bar = nullptr,
*view_tool_bar = nullptr, *view_tool_bar = nullptr,
*diagram_tool_bar = nullptr, *diagram_tool_bar = nullptr,
*m_add_item_tool_bar = nullptr, *m_add_item_tool_bar = nullptr,

View File

@@ -215,11 +215,13 @@ void ProjectDBModel::setQuery(const QString &query)
@brief ProjectDBModel::queryString @brief ProjectDBModel::queryString
@return the current query used by this model @return the current query used by this model
*/ */
QString ProjectDBModel::queryString() const { QString ProjectDBModel::queryString() const
{
return m_query; return m_query;
} }
QETProject *ProjectDBModel::project() const { QETProject *ProjectDBModel::project() const
{
return m_project.data(); return m_project.data();
} }

View File

@@ -34,7 +34,9 @@
@param table @param table
@param parent @param parent
*/ */
GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor(QetGraphicsTableItem *table, QWidget *parent) : GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor(
QetGraphicsTableItem *table,
QWidget *parent) :
PropertiesEditorWidget(parent), PropertiesEditorWidget(parent),
ui(new Ui::GraphicsTablePropertiesEditor) ui(new Ui::GraphicsTablePropertiesEditor)
{ {
@@ -59,7 +61,8 @@ GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor(QetGraphicsTableIte
/** /**
@brief GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor @brief GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor
*/ */
GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor() { GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor()
{
delete ui; delete ui;
} }
@@ -84,8 +87,14 @@ void GraphicsTablePropertiesEditor::setTable(QetGraphicsTableItem *table)
m_table_item = table; m_table_item = table;
m_connect_list.clear(); m_connect_list.clear();
m_connect_list << connect(m_table_item.data(), &QetGraphicsTableItem::xChanged, this, &GraphicsTablePropertiesEditor::updateUi); m_connect_list << connect(m_table_item.data(),
m_connect_list << connect(m_table_item.data(), &QetGraphicsTableItem::yChanged, this, &GraphicsTablePropertiesEditor::updateUi); &QetGraphicsTableItem::xChanged,
this,
&GraphicsTablePropertiesEditor::updateUi);
m_connect_list << connect(m_table_item.data(),
&QetGraphicsTableItem::yChanged,
this,
&GraphicsTablePropertiesEditor::updateUi);
if (auto editor = PropertiesEditorFactory::propertiesEditor(table->model(), this)) if (auto editor = PropertiesEditorFactory::propertiesEditor(table->model(), this))
@@ -121,63 +130,103 @@ QUndoCommand *GraphicsTablePropertiesEditor::associatedUndo() const
if (m_live_edit) if (m_live_edit)
{ {
if (!qFuzzyCompare(ui->m_x_pos->value(), m_table_item->pos().x())) { if (!qFuzzyCompare(ui->m_x_pos->value(), m_table_item->pos().x())) {
auto undo = new QPropertyUndoCommand(m_table_item.data(), "x", m_table_item->pos().x(), ui->m_x_pos->value()); auto undo = new QPropertyUndoCommand(
m_table_item.data(),
"x",
m_table_item->pos().x(),
ui->m_x_pos->value());
undo->setAnimated(true, false); undo->setAnimated(true, false);
undo->setText(tr("Déplacer un tableau")); undo->setText(tr("Déplacer un tableau"));
return undo; return undo;
} }
if (!qFuzzyCompare(ui->m_y_pos->value(), m_table_item->pos().y())) { if (!qFuzzyCompare(ui->m_y_pos->value(), m_table_item->pos().y())) {
auto undo = new QPropertyUndoCommand(m_table_item.data(), "y", m_table_item->pos().y(), ui->m_y_pos->value()); auto undo = new QPropertyUndoCommand(
m_table_item.data(),
"y",
m_table_item->pos().y(),
ui->m_y_pos->value());
undo->setAnimated(true, false); undo->setAnimated(true, false);
undo->setText(tr("Déplacer un tableau")); undo->setText(tr("Déplacer un tableau"));
return undo; return undo;
} }
if (ui->m_display_n_row_sb->value() != m_table_item->displayNRow()) { if (ui->m_display_n_row_sb->value() != m_table_item->displayNRow()) {
auto undo = new QPropertyUndoCommand(m_table_item.data(), "displayNRow", m_table_item->displayNRow(), ui->m_display_n_row_sb->value()); auto undo = new QPropertyUndoCommand(
m_table_item.data(),
"displayNRow",
m_table_item->displayNRow(),
ui->m_display_n_row_sb->value());
undo->setText(tr("Modifier le nombre de ligne affiché par un tableau")); undo->setText(tr("Modifier le nombre de ligne affiché par un tableau"));
return undo; return undo;
} }
QMargins edited_header_margins(ui->m_header_left_margin->value(), QMargins edited_header_margins(
ui->m_header_left_margin->value(),
ui->m_header_top_margin->value(), ui->m_header_top_margin->value(),
ui->m_header_right_margin->value(), ui->m_header_right_margin->value(),
ui->m_header_bottom_margin->value()); ui->m_header_bottom_margin->value());
auto model_header_margins = QETUtils::marginsFromString(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::UserRole+1).toString()); auto model_header_margins = QETUtils::marginsFromString(
m_table_item->model()->headerData(
0,
Qt::Horizontal,
Qt::UserRole+1).toString());
if (edited_header_margins != model_header_margins) if (edited_header_margins != model_header_margins)
{ {
auto undo = new ModelHeaderDataCommand(m_table_item->model()); auto undo = new ModelHeaderDataCommand(m_table_item->model());
undo->setData(0, Qt::Horizontal, QETUtils::marginsToString(edited_header_margins), Qt::UserRole+1); undo->setData(
0,
Qt::Horizontal,
QETUtils::marginsToString(edited_header_margins),
Qt::UserRole+1);
undo->setText(tr("Modifier les marges d'une en tête de tableau")); undo->setText(tr("Modifier les marges d'une en tête de tableau"));
return undo; return undo;
} }
QMargins edited_table_margins(ui->m_table_left_margin->value(), QMargins edited_table_margins(
ui->m_table_left_margin->value(),
ui->m_table_top_margin->value(), ui->m_table_top_margin->value(),
ui->m_table_right_margin->value(), ui->m_table_right_margin->value(),
ui->m_table_bottom_margin->value()); ui->m_table_bottom_margin->value());
auto model_margins = QETUtils::marginsFromString(m_table_item->model()->index(0,0).data(Qt::UserRole+1).toString()); auto model_margins = QETUtils::marginsFromString(
m_table_item->model()->index(0,0).data(Qt::UserRole+1).toString());
if (edited_table_margins != model_margins) if (edited_table_margins != model_margins)
{ {
auto undo = new ModelIndexCommand(m_table_item->model(), m_table_item->model()->index(0,0)); auto undo = new ModelIndexCommand(
undo->setData(QETUtils::marginsToString(edited_table_margins), Qt::UserRole+1); m_table_item->model(),
m_table_item->model()->index(0,0));
undo->setData(
QETUtils::marginsToString(edited_table_margins),
Qt::UserRole+1);
undo->setText(tr("Modifier les marges d'un tableau")); undo->setText(tr("Modifier les marges d'un tableau"));
return undo; return undo;
} }
if (m_header_button_group->checkedId() != m_table_item->model()->headerData(0, Qt::Horizontal, Qt::TextAlignmentRole).toInt()) if (m_header_button_group->checkedId()
!= m_table_item->model()->headerData(
0,
Qt::Horizontal,
Qt::TextAlignmentRole).toInt())
{ {
auto undo = new ModelHeaderDataCommand(m_table_item->model()); auto undo = new ModelHeaderDataCommand(m_table_item->model());
undo->setData(0, Qt::Horizontal, m_header_button_group->checkedId(), Qt::TextAlignmentRole); undo->setData(
0,
Qt::Horizontal,
m_header_button_group->checkedId(),
Qt::TextAlignmentRole);
undo->setText(tr("Modifier l'alignement d'une en tête de tableau")); undo->setText(tr("Modifier l'alignement d'une en tête de tableau"));
return undo; return undo;
} }
if (m_table_button_group->checkedId() != m_table_item->model()->index(0,0).data(Qt::TextAlignmentRole).toInt()) if (m_table_button_group->checkedId()
!= m_table_item->model()->index(0,0).data(Qt::TextAlignmentRole).toInt())
{ {
auto undo = new ModelIndexCommand(m_table_item->model(), m_table_item->model()->index(0,0)); auto undo = new ModelIndexCommand(
undo->setData(m_table_button_group->checkedId(), Qt::TextAlignmentRole); m_table_item->model(),
m_table_item->model()->index(0,0));
undo->setData(
m_table_button_group->checkedId(),
Qt::TextAlignmentRole);
undo->setText(tr("Modifier l'alignement des textes d'un tableau")); undo->setText(tr("Modifier l'alignement des textes d'un tableau"));
return undo; return undo;
} }
@@ -205,13 +254,21 @@ void GraphicsTablePropertiesEditor::on_m_header_font_pb_clicked()
if (m_table_item && m_table_item->model()) if (m_table_item && m_table_item->model())
{ {
bool ok; bool ok;
auto font = QFontDialog::getFont(&ok, auto font = QFontDialog::getFont(
m_table_item->model()->headerData(0, Qt::Horizontal, Qt::FontRole).value<QFont>(), &ok,
m_table_item->model()->headerData(
0,
Qt::Horizontal,
Qt::FontRole).value<QFont>(),
this); this);
if (ok && m_table_item->model()) if (ok && m_table_item->model())
{ {
auto undo = new ModelHeaderDataCommand(m_table_item->model()); auto undo = new ModelHeaderDataCommand(m_table_item->model());
undo->setData(0, Qt::Horizontal, QVariant::fromValue(font), Qt::FontRole); undo->setData(
0,
Qt::Horizontal,
QVariant::fromValue(font),
Qt::FontRole);
undo->setText(tr("Modifier la police d'une en tête de tableau")); undo->setText(tr("Modifier la police d'une en tête de tableau"));
m_table_item->diagram()->undoStack().push(undo); m_table_item->diagram()->undoStack().push(undo);
} }
@@ -227,12 +284,15 @@ void GraphicsTablePropertiesEditor::on_m_table_font_pb_clicked()
{ {
bool ok; bool ok;
auto index = m_table_item->model()->index(0,0); auto index = m_table_item->model()->index(0,0);
auto old_font = m_table_item->model()->data(index, Qt::FontRole).value<QFont>(); auto old_font = m_table_item->model()->data(
index,
Qt::FontRole).value<QFont>();
auto new_font = QFontDialog::getFont(&ok, old_font, this); auto new_font = QFontDialog::getFont(&ok, old_font, this);
if (ok && m_table_item->diagram()) if (ok && m_table_item->diagram())
{ {
auto undo = new ModelIndexCommand(m_table_item->model(), index); auto undo = new ModelIndexCommand(
m_table_item->model(), index);
undo->setData(QVariant::fromValue(new_font), Qt::FontRole); undo->setData(QVariant::fromValue(new_font), Qt::FontRole);
undo->setText(tr("Changer la police d'un tableau")); undo->setText(tr("Changer la police d'un tableau"));
m_table_item->diagram()->undoStack().push(undo); m_table_item->diagram()->undoStack().push(undo);
@@ -268,8 +328,12 @@ void GraphicsTablePropertiesEditor::updateUi()
if (auto item_ = m_table_item->previousTable()) //Add the current previous table if (auto item_ = m_table_item->previousTable()) //Add the current previous table
{ {
m_other_table_vector.append(item_); m_other_table_vector.append(item_);
ui->m_previous_table_cb->addItem(item_->tableName(), m_other_table_vector.indexOf(item_)); ui->m_previous_table_cb->addItem(
ui->m_previous_table_cb->setCurrentIndex(ui->m_previous_table_cb->findData(m_other_table_vector.indexOf(item_))); item_->tableName(),
m_other_table_vector.indexOf(item_));
ui->m_previous_table_cb->setCurrentIndex(
ui->m_previous_table_cb->findData(
m_other_table_vector.indexOf(item_)));
} }
ElementProvider ep(m_table_item->diagram()->project()); ElementProvider ep(m_table_item->diagram()->project());
@@ -279,19 +343,27 @@ void GraphicsTablePropertiesEditor::updateUi()
item_->nextTable() == nullptr) item_->nextTable() == nullptr)
{ {
m_other_table_vector.append(item_); m_other_table_vector.append(item_);
ui->m_previous_table_cb->addItem(item_->tableName(), m_other_table_vector.indexOf(item_)); ui->m_previous_table_cb->addItem(
item_->tableName(),
m_other_table_vector.indexOf(item_));
} }
} }
updateInfoLabel(); updateInfoLabel();
auto margin = QETUtils::marginsFromString(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::UserRole+1).toString()); auto margin = QETUtils::marginsFromString(
m_table_item->model()->headerData(
0,
Qt::Horizontal,
Qt::UserRole+1).toString());
ui->m_header_top_margin ->setValue(margin.top()); ui->m_header_top_margin ->setValue(margin.top());
ui->m_header_left_margin ->setValue(margin.left()); ui->m_header_left_margin ->setValue(margin.left());
ui->m_header_right_margin ->setValue(margin.right()); ui->m_header_right_margin ->setValue(margin.right());
ui->m_header_bottom_margin->setValue(margin.bottom()); ui->m_header_bottom_margin->setValue(margin.bottom());
margin = QETUtils::marginsFromString(m_table_item->model()->index(0,0).data(Qt::UserRole+1).toString()); margin = QETUtils::marginsFromString(
m_table_item->model()->index(0,0).data(
Qt::UserRole+1).toString());
ui->m_table_top_margin ->setValue(margin.top()); ui->m_table_top_margin ->setValue(margin.top());
ui->m_table_left_margin ->setValue(margin.left()); ui->m_table_left_margin ->setValue(margin.left());
ui->m_table_right_margin ->setValue(margin.right()); ui->m_table_right_margin ->setValue(margin.right());
@@ -302,9 +374,16 @@ void GraphicsTablePropertiesEditor::updateUi()
return; return;
} }
if (auto button = m_header_button_group->button(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::TextAlignmentRole).toInt())) if (auto button = m_header_button_group->button(
m_table_item->model()->headerData(
0,
Qt::Horizontal,
Qt::TextAlignmentRole).toInt()))
button->setChecked(true); button->setChecked(true);
if (auto button = m_table_button_group->button(m_table_item->model()->data(m_table_item->model()->index(0,0), Qt::TextAlignmentRole).toInt())) if (auto button = m_table_button_group->button(
m_table_item->model()->data(
m_table_item->model()->index(0,0),
Qt::TextAlignmentRole).toInt()))
button->setChecked(true); button->setChecked(true);
setUpEditConnection(); setUpEditConnection();
@@ -378,7 +457,8 @@ void GraphicsTablePropertiesEditor::setUpEditConnection()
} }
} }
void GraphicsTablePropertiesEditor::on_m_table_name_le_textEdited(const QString &arg1) { void GraphicsTablePropertiesEditor::on_m_table_name_le_textEdited(const QString &arg1)
{
m_table_item->setTableName(arg1); m_table_item->setTableName(arg1);
} }
@@ -387,7 +467,9 @@ void GraphicsTablePropertiesEditor::on_m_previous_table_cb_activated(int index)
if (index == 0) { if (index == 0) {
m_table_item->setPreviousTable(); m_table_item->setPreviousTable();
} else { } else {
m_table_item->setPreviousTable(m_other_table_vector.at(ui->m_previous_table_cb->currentData().toInt())); m_table_item->setPreviousTable(
m_other_table_vector.at(
ui->m_previous_table_cb->currentData().toInt()));
} }
} }
@@ -424,7 +506,10 @@ void GraphicsTablePropertiesEditor::on_m_auto_geometry_pb_clicked()
*/ */
void GraphicsTablePropertiesEditor::on_m_apply_geometry_to_linked_table_pb_clicked() void GraphicsTablePropertiesEditor::on_m_apply_geometry_to_linked_table_pb_clicked()
{ {
if (m_table_item.isNull() || !m_table_item->diagram() || (!m_table_item->nextTable() && !m_table_item->previousTable())) { if (m_table_item.isNull()
|| !m_table_item->diagram()
|| (!m_table_item->nextTable()
&& !m_table_item->previousTable())) {
return; return;
} }
auto first_table = m_table_item; auto first_table = m_table_item;

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