Add TODO compile var + Fix doxygen issue

You can make your code warn on compile time for the TODO's
In order to do so, uncomment the following line. in pro file
DEFINES += TODO_LIST
This commit is contained in:
Simon De Backer
2020-09-24 17:01:33 +02:00
parent 65ba816859
commit 36dbe65457
40 changed files with 1147 additions and 966 deletions

View File

@@ -1,17 +1,17 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -41,14 +41,14 @@ ArcEditor::ArcEditor(QETElementEditor *editor, PartArc *arc, QWidget *parent) :
angle = new QSpinBox();
start_angle -> setRange(-360, 360);
angle -> setRange(-360, 360);
x->setRange(-5000, 5000);
y->setRange(-5000, 5000);
h->setRange(-5000, 5000);
v->setRange(-5000, 5000);
QVBoxLayout *v_layout = new QVBoxLayout(this);
QGridLayout *grid = new QGridLayout();
grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0);
grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight);
@@ -64,13 +64,13 @@ ArcEditor::ArcEditor(QETElementEditor *editor, PartArc *arc, QWidget *parent) :
grid -> addWidget(start_angle, 5, 1);
grid -> addWidget(new QLabel(tr("Angle :")), 6, 0);
grid -> addWidget(angle, 6, 1);
v_layout -> addWidget(style_);
v_layout -> addLayout(grid);
v_layout->addStretch();
updateForm();
activeConnections(true);
}
@@ -83,6 +83,9 @@ void ArcEditor::setUpChangeConnections()
m_change_connections << connect(part, &PartArc::rectChanged, this, &ArcEditor::updateForm);
m_change_connections << connect(part, &PartArc::spanAngleChanged, this, &ArcEditor::updateForm);
m_change_connections << connect(part, &PartArc::startAngleChanged, this, &ArcEditor::updateForm);
#if TODO_LIST
#pragma message("@TODO implement position changes!")
#endif
// TODO: implement position changes!
//m_change_connections << connect(part, &PartArc::)
}
@@ -90,7 +93,7 @@ void ArcEditor::setUpChangeConnections()
void ArcEditor::disconnectChangeConnections()
{
for (QMetaObject::Connection c : m_change_connections) {
disconnect(c);
disconnect(c);
}
m_change_connections.clear();
}

View File

@@ -1,17 +1,17 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -307,10 +307,10 @@ ChangeZValueCommand::ChangeZValueCommand(
{
// retrieve all primitives but terminals
QList<QGraphicsItem *> items_list = m_scene -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
// prend un snapshot des zValues
foreach(QGraphicsItem *qgi, items_list) undo_hash.insert(qgi, qgi -> zValue());
// choisit le nom en fonction du traitement
if (m_option == QET::BringForward) {
setText(QObject::tr("amener au premier plan", "undo caption"));
@@ -368,14 +368,16 @@ void ChangeZValueCommand::applyBringForward(const QList<QGraphicsItem *> &items_
*/
void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
QList<QGraphicsItem *> my_items_list = items_list;
for (int i = my_items_list.count() - 2 ; i >= 0 ; -- i) {
if (my_items_list[i] -> isSelected()) {
if (!my_items_list[i +1] -> isSelected()) {
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
my_items_list.swap(i, i + 1);
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 5.13 or later")
#endif
my_items_list.swapItemsAt(i, i + 1);
#endif
}
@@ -391,20 +393,22 @@ void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
*/
void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
QList<QGraphicsItem *> my_items_list = items_list;
for (int i = 1 ; i < my_items_list.count() ; ++ i) {
if (my_items_list[i] -> isSelected()) {
if (!my_items_list[i - 1] -> isSelected()) {
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
my_items_list.swap(i, i - 1);
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 5.13 or later")
#endif
my_items_list.swapItemsAt(i, i - 1);
#endif
}
}
}
int z = 1;
foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++);
}
@@ -550,7 +554,7 @@ void ScalePartsCommand::scale(const QRectF &before, const QRectF &after) {
if (!scaled_primitives_.count()) return;
if (before == after) return;
if (!before.width() || !before.height()) return; // cowardly flee division by zero FIXME?
foreach (CustomElementPart *part_item, scaled_primitives_) {
part_item -> startUserTransformation(before);
part_item -> handleUserTransformation(before, after);

View File

@@ -515,7 +515,9 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts);
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 5.14 or later")
#endif
QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts);
#endif

View File

@@ -1,17 +1,17 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -174,6 +174,9 @@ void PartDynamicTextField::fromXml(const QDomElement &dom_elmt) {
setFont(font_);
}
else {
#if TODO_LIST
#pragma message("@TODO remove in futur")
#endif
//Keep compatibility TODO remove in futur
setFont(QETApp::dynamicTextsItemFont(9));
}
@@ -393,7 +396,7 @@ void PartDynamicTextField::setPlainText(const QString &text) {
prepareAlignment();
QGraphicsTextItem::setPlainText(text);
//User define a text width
if(m_text_width > 0) {
if(document() -> size().width() > m_text_width) {
@@ -477,8 +480,8 @@ void PartDynamicTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
QVariant PartDynamicTextField::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) {
if (change == QGraphicsItem::ItemPositionHasChanged || change == QGraphicsItem::ItemSceneHasChanged) {
updateCurrentPartEditor();
if(change == QGraphicsItem::ItemSceneHasChanged &&
m_first_add &&
if(change == QGraphicsItem::ItemSceneHasChanged &&
m_first_add &&
elementScene() != nullptr)
{
connect(elementScene(), &ElementScene::elementInfoChanged,
@@ -499,7 +502,7 @@ void PartDynamicTextField::paint(QPainter *painter, const QStyleOptionGraphicsIt
painter -> save();
painter -> setFont(this -> font());
//Adjust the thickness according to the font size,
//Adjust the thickness according to the font size,
qreal w=0.3;
if(this -> font().pointSize() >= 5) {
w = this -> font().pointSizeF()*0.1;
@@ -590,6 +593,6 @@ void PartDynamicTextField::finishAlignment()
QPointF p = transform.map(QPointF(x,y));
QPointF pa = transform.map(QPointF(xa,ya));
QPointF diff = pa-p;
setPos(this -> pos() - diff);
}

View File

@@ -672,6 +672,9 @@ void QETElementEditor::slot_updateInformations()
//We add the editor widget
ElementItemEditor *editor = static_cast<ElementItemEditor*>(m_editors[selection_xml_name]);
#if TODO_LIST
#pragma message("@TODO Check if it takes longer than setting the parts again to the editor.")
#endif
// TODO: Check if it takes longer than setting the parts again to the editor.
bool equal = true;
QList<CustomElementPart*> parts = editor -> currentParts();
@@ -710,6 +713,9 @@ void QETElementEditor::slot_updateInformations()
return;
}
else if (selection_xml_name == "polygon" && cep_list.length() == 1) {
#if TODO_LIST
#pragma message("@TODO maybe allowing multipart edit when number of points is the same?")
#endif
// multi edit for polygons makes no sense
// TODO: maybe allowing multipart edit when number of points is the same?
//We add the editor widget

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "lineeditor.h"
#include "ui_lineeditor.h"
@@ -25,28 +25,68 @@
#include "qeticons.h"
/**
* @brief LineEditor::LineEditor
* @param editor : Element editor who belong this editor
* @param part : part line to edit
* @param parent : parent widget
*/
LineEditor::LineEditor(QETElementEditor *editor, PartLine *part, QWidget *parent) :
ElementItemEditor(editor, parent),
ui(new Ui::LineEditor)
@brief LineEditor::LineEditor
@param editor : Element editor who belong this editor
@param part : part line to edit
@param parent : parent widget
*/
LineEditor::LineEditor(
QETElementEditor *editor, PartLine *part, QWidget *parent) :
ElementItemEditor(editor, parent),ui(new Ui::LineEditor)
{
ui->setupUi(this);
ui->setupUi(this);
ui->m_end1_cb->addItem(QET::Icons::EndLineNone, tr("Normale", "type of the 1st end of a line"), Qet::None );
ui->m_end1_cb->addItem(QET::Icons::EndLineSimple, tr("Flèche simple", "type of the 1st end of a line"), Qet::Simple );
ui->m_end1_cb->addItem(QET::Icons::EndLineTriangle, tr("Flèche triangulaire", "type of the 1st end of a line"), Qet::Triangle);
ui->m_end1_cb->addItem(QET::Icons::EndLineCircle, tr("Cercle", "type of the 1st end of a line"), Qet::Circle );
ui->m_end1_cb->addItem(QET::Icons::EndLineDiamond, tr("Carré", "type of the 1st end of a line"), Qet::Diamond );
ui->m_end1_cb->addItem(
QET::Icons::EndLineNone,
tr("Normale",
"type of the 1st end of a line"),
Qet::None );
ui->m_end1_cb->addItem(
QET::Icons::EndLineSimple,
tr("Flèche simple",
"type of the 1st end of a line"),
Qet::Simple );
ui->m_end1_cb->addItem(
QET::Icons::EndLineTriangle,
tr("Flèche triangulaire",
"type of the 1st end of a line"),
Qet::Triangle);
ui->m_end1_cb->addItem(
QET::Icons::EndLineCircle,
tr("Cercle",
"type of the 1st end of a line"),
Qet::Circle );
ui->m_end1_cb->addItem(
QET::Icons::EndLineDiamond,
tr("Carré",
"type of the 1st end of a line"),
Qet::Diamond );
ui->m_end2_cb->addItem(QET::Icons::EndLineNone, tr("Normale", "type of the 1st end of a line"), Qet::None );
ui->m_end2_cb->addItem(QET::Icons::EndLineSimple, tr("Flèche simple", "type of the 1st end of a line"), Qet::Simple );
ui->m_end2_cb->addItem(QET::Icons::EndLineTriangle, tr("Flèche triangulaire", "type of the 1st end of a line"), Qet::Triangle);
ui->m_end2_cb->addItem(QET::Icons::EndLineCircle, tr("Cercle", "type of the 1st end of a line"), Qet::Circle );
ui->m_end2_cb->addItem(QET::Icons::EndLineDiamond, tr("Carré", "type of the 1st end of a line"), Qet::Diamond );
ui->m_end2_cb->addItem(
QET::Icons::EndLineNone,
tr("Normale",
"type of the 1st end of a line"),
Qet::None );
ui->m_end2_cb->addItem(
QET::Icons::EndLineSimple,
tr("Flèche simple",
"type of the 1st end of a line"),
Qet::Simple );
ui->m_end2_cb->addItem(
QET::Icons::EndLineTriangle,
tr("Flèche triangulaire",
"type of the 1st end of a line"),
Qet::Triangle);
ui->m_end2_cb->addItem(
QET::Icons::EndLineCircle,
tr("Cercle",
"type of the 1st end of a line"),
Qet::Circle );
ui->m_end2_cb->addItem(
QET::Icons::EndLineDiamond,
tr("Carré",
"type of the 1st end of a line"),
Qet::Diamond );
m_style = new StyleEditor(editor);
ui->m_main_layout->insertWidget(0, m_style);
@@ -56,18 +96,19 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *part, QWidget *parent
}
/**
* @brief LineEditor::~LineEditor
*/
LineEditor::~LineEditor() {
delete ui;
@brief LineEditor::~LineEditor
*/
LineEditor::~LineEditor()
{
delete ui;
}
/**
* @brief LineEditor::setPart
* Reimplemented from @ElementItemEditor
* @param part : part line to edit
* @return : true if the given part can be edited
*/
@brief LineEditor::setPart
Reimplemented from ElementItemEditor
@param part : part line to edit
@return : true if the given part can be edited
*/
bool LineEditor::setPart(CustomElementPart *part)
{
if (m_part == part) {
@@ -100,7 +141,7 @@ bool LineEditor::setPart(CustomElementPart *part)
/**
* @brief LineEditor::setParts
* Reimplemented from @ElementItemEditor
* Reimplemented from ElementItemEditor
* @param parts : parts to edit
* @return true if the parts can be edited
*/
@@ -134,9 +175,9 @@ QList<CustomElementPart *> LineEditor::currentParts() const {
}
/**
* @brief LineEditor::updateForm
* Reimplemented from @ElementItemEditor
*/
@brief LineEditor::updateForm
Reimplemented from ElementItemEditor
*/
void LineEditor::updateForm()
{
if (!m_part) {

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LINEEDITOR_H
#define LINEEDITOR_H
@@ -29,15 +29,15 @@ class StyleEditor;
/**
* @brief The LineEditor class
* Provide a widget editor used to edit the properties of a @PartLine
* Provide a widget editor used to edit the properties of a PartLine
*/
class LineEditor : public ElementItemEditor
{
Q_OBJECT
public:
explicit LineEditor(QETElementEditor *editor, PartLine *part = nullptr, QWidget *parent = nullptr);
~LineEditor() override;
explicit LineEditor(QETElementEditor *editor, PartLine *part = nullptr, QWidget *parent = nullptr);
~LineEditor() override;
bool setPart(CustomElementPart *part) override;
bool setParts(QList <CustomElementPart *> parts) override;
@@ -58,7 +58,7 @@ class LineEditor : public ElementItemEditor
private:
PartLine *m_part = nullptr;
Ui::LineEditor *ui;
Ui::LineEditor *ui;
StyleEditor *m_style = nullptr;
QList <QMetaObject::Connection> m_change_connections;
bool m_locked = false;