Fix indentation code

This commit is contained in:
Laurent Trinques
2020-07-15 20:20:07 +02:00
parent 6313319f80
commit 68e78a0de9
38 changed files with 2625 additions and 2625 deletions

View File

@@ -122,7 +122,7 @@ bool LineEditor::setPart(CustomElementPart *new_part)
{
if (part)
{
disconnectChangeConnections();
disconnectChangeConnections();
}
part = nullptr;
style_ -> setPart(nullptr);
@@ -133,12 +133,12 @@ bool LineEditor::setPart(CustomElementPart *new_part)
if (part == part_line) return true;
if (part)
{
disconnectChangeConnections();
disconnectChangeConnections();
}
part = part_line;
style_ -> setPart(part);
updateForm();
setUpChangeConnections();
setUpChangeConnections();
return(true);
}
return(false);
@@ -146,12 +146,12 @@ bool LineEditor::setPart(CustomElementPart *new_part)
bool LineEditor::setParts(QList <CustomElementPart *> parts)
{
if (parts.isEmpty())
return false;
if (!setPart(parts.first()))
return false;
return style_->setParts(parts);
if (parts.isEmpty())
return false;
if (!setPart(parts.first()))
return false;
return style_->setParts(parts);
}
/**
@@ -187,18 +187,18 @@ void LineEditor::updateLineEndType1()
if (m_locked) return;
m_locked = true;
QVariant end = end1_type -> itemData(end1_type->currentIndex());
for (auto part: style_->currentParts()) {
PartLine* line = static_cast<PartLine*>(part);
if (end != line->property("end1"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(line, "end1", line->property("end1"), end);
undo->setText(tr("Modifier une ligne"));
elementScene()->undoStack().push(undo);
}
}
for (auto part: style_->currentParts()) {
PartLine* line = static_cast<PartLine*>(part);
if (end != line->property("end1"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(line, "end1", line->property("end1"), end);
undo->setText(tr("Modifier une ligne"));
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
@@ -208,19 +208,19 @@ void LineEditor::updateLineEndLength1()
if (m_locked) return;
m_locked = true;
double length = end1_length->value();
for (auto part: style_->currentParts()) {
PartLine* line = static_cast<PartLine*>(part);
if (length != line->property("length1"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(line, "length1", line->property("length1"), length);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
for (auto part: style_->currentParts()) {
PartLine* line = static_cast<PartLine*>(part);
if (length != line->property("length1"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(line, "length1", line->property("length1"), length);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
@@ -230,18 +230,18 @@ void LineEditor::updateLineEndType2()
if (m_locked) return;
m_locked = true;
QVariant end = end2_type -> itemData(end2_type->currentIndex());
for (auto part: style_->currentParts()) {
PartLine* line = static_cast<PartLine*>(part);
if (end != line->property("end2"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(line, "end2", line->property("end2"), end);
undo->setText(tr("Modifier une ligne"));
elementScene()->undoStack().push(undo);
}
}
for (auto part: style_->currentParts()) {
PartLine* line = static_cast<PartLine*>(part);
if (end != line->property("end2"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(line, "end2", line->property("end2"), end);
undo->setText(tr("Modifier une ligne"));
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
@@ -251,19 +251,19 @@ void LineEditor::updateLineEndLength2()
if (m_locked) return;
m_locked = true;
double length = end2_length->value();
for (auto part: style_->currentParts()) {
PartLine* line = static_cast<PartLine*>(part);
if (length != line->property("length2"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(line, "length2", line->property("length2"), length);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
for (auto part: style_->currentParts()) {
PartLine* line = static_cast<PartLine*>(part);
if (length != line->property("length2"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(line, "length2", line->property("length2"), length);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
@@ -271,100 +271,100 @@ void LineEditor::lineEditingFinishedX1()
{
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
PartLine* l = static_cast<PartLine*>(part);
QLineF line = l->property("line").toLineF();
QPointF p1 = l->mapFromScene(x1->value(), y1->value());
if (p1.x() != line.p1().x())
{
p1.setY(line.p1().y()); // restore old y value
line.setP1(p1);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(l, "line", l->property("line"), line);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
for (auto part: style_->currentParts()) {
PartLine* l = static_cast<PartLine*>(part);
QLineF line = l->property("line").toLineF();
QPointF p1 = l->mapFromScene(x1->value(), y1->value());
if (p1.x() != line.p1().x())
{
p1.setY(line.p1().y()); // restore old y value
line.setP1(p1);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(l, "line", l->property("line"), line);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
void LineEditor::lineEditingFinishedY1()
{
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
PartLine* l = static_cast<PartLine*>(part);
QLineF line = l->property("line").toLineF();
QPointF p1 = l->mapFromScene(x1->value(), y1->value());
if (p1.y() != line.p1().y())
{
p1.setX(line.p1().x()); // restore old x value
line.setP1(p1);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(l, "line", l->property("line"), line);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
PartLine* l = static_cast<PartLine*>(part);
QLineF line = l->property("line").toLineF();
QPointF p1 = l->mapFromScene(x1->value(), y1->value());
if (p1.y() != line.p1().y())
{
p1.setX(line.p1().x()); // restore old x value
line.setP1(p1);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(l, "line", l->property("line"), line);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
void LineEditor::lineEditingFinishedX2()
{
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
PartLine* l = static_cast<PartLine*>(part);
QLineF line = l->property("line").toLineF();
QPointF p2 = l->mapFromScene(x2->value(), y2->value());
if (p2.x() != line.p1().x())
{
p2.setY(line.p2().y()); // restore old y value
line.setP2(p2);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(l, "line", l->property("line"), line);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
PartLine* l = static_cast<PartLine*>(part);
QLineF line = l->property("line").toLineF();
QPointF p2 = l->mapFromScene(x2->value(), y2->value());
if (p2.x() != line.p1().x())
{
p2.setY(line.p2().y()); // restore old y value
line.setP2(p2);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(l, "line", l->property("line"), line);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
void LineEditor::lineEditingFinishedY2()
{
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
PartLine* l = static_cast<PartLine*>(part);
QLineF line = l->property("line").toLineF();
QPointF p2 = l->mapFromScene(x2->value(), y2->value());
if (p2.y() != line.p1().y())
{
p2.setX(line.p2().x()); // restore old y value
line.setP2(p2);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(l, "line", l->property("line"), line);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
PartLine* l = static_cast<PartLine*>(part);
QLineF line = l->property("line").toLineF();
QPointF p2 = l->mapFromScene(x2->value(), y2->value());
if (p2.y() != line.p1().y())
{
p2.setX(line.p2().x()); // restore old y value
line.setP2(p2);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(l, "line", l->property("line"), line);
undo->setText(tr("Modifier une ligne"));
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
/**
@@ -398,10 +398,10 @@ void LineEditor::activeConnections(bool active)
{
if (active)
{
connect(x1, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedX1()));
connect(y1, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedY1()));
connect(x2, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedX2()));
connect(y2, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedY2()));
connect(x1, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedX1()));
connect(y1, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedY1()));
connect(x2, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedX2()));
connect(y2, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedY2()));
connect(end1_type, SIGNAL(currentIndexChanged(int)), this, SLOT(updateLineEndType1()));
connect(end1_length, SIGNAL(editingFinished()), this, SLOT(updateLineEndLength1()));
connect(end2_type, SIGNAL(currentIndexChanged(int)), this, SLOT(updateLineEndType2()));
@@ -409,10 +409,10 @@ void LineEditor::activeConnections(bool active)
}
else
{
disconnect(x1, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedX1()));
disconnect(y1, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedY1()));
disconnect(x2, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedX2()));
disconnect(y2, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedY2()));
disconnect(x1, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedX1()));
disconnect(y1, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedY1()));
disconnect(x2, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedX2()));
disconnect(y2, SIGNAL(editingFinished()), this, SLOT(lineEditingFinishedY2()));
disconnect(end1_type, SIGNAL(currentIndexChanged(int)), this, SLOT(updateLineEndType1()));
disconnect(end1_length, SIGNAL(editingFinished()), this, SLOT(updateLineEndLength1()));
disconnect(end2_type, SIGNAL(currentIndexChanged(int)), this, SLOT(updateLineEndType2()));