mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Search and replace : conductors properties can now be replaced
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5641 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
Copyright 2006-2018 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
@@ -23,18 +23,12 @@
|
||||
#include "qetapp.h"
|
||||
#include "independenttextitem.h"
|
||||
#include "diagramcommands.h"
|
||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
|
||||
|
||||
SearchAndReplaceWorker::SearchAndReplaceWorker()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::clear
|
||||
* All registred properties
|
||||
*/
|
||||
void SearchAndReplaceWorker::clear()
|
||||
{
|
||||
m_titleblock_properties = TitleBlockProperties();
|
||||
m_conductor_properties = invalidConductorProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +162,7 @@ void SearchAndReplaceWorker::replaceElement(QList<Element *> list)
|
||||
}
|
||||
}
|
||||
|
||||
project_->undoStack()->beginMacro(QObject::tr("Chercher/remplacer les propriétés d'éléments"));
|
||||
project_->undoStack()->beginMacro(QObject::tr("Chercher/remplacer les propriétés d'éléments."));
|
||||
for (Element *elmt : list)
|
||||
{
|
||||
//We apply change only for master, slave, and terminal element.
|
||||
@@ -244,3 +238,134 @@ void SearchAndReplaceWorker::replaceIndiText(IndependentTextItem *text)
|
||||
list.append(text);
|
||||
replaceIndiText(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceConductor
|
||||
* Replace all properties of each conductor in @list
|
||||
* All conductor must belong to the same project, if not this function do nothing.
|
||||
* All change are made through a undo command append to undo list of the project.
|
||||
* @param list
|
||||
*/
|
||||
void SearchAndReplaceWorker::replaceConductor(QList<Conductor *> list)
|
||||
{
|
||||
if (list.isEmpty() || !list.first()->diagram()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QETProject *project_ = list.first()->diagram()->project();
|
||||
for (Conductor *c : list) {
|
||||
if (!c->diagram() ||
|
||||
c->diagram()->project() != project_) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
project_->undoStack()->beginMacro(QObject::tr("Chercher/remplacer les propriétés de conducteurs."));
|
||||
for (Conductor *c : list)
|
||||
{
|
||||
ConductorProperties cp = applyChange(c->properties(), m_conductor_properties);
|
||||
|
||||
if (cp != c->properties())
|
||||
{
|
||||
QSet <Conductor *> conductors_list = c->relatedPotentialConductors(true);
|
||||
conductors_list << c;
|
||||
for (Conductor *cc : conductors_list)
|
||||
{
|
||||
QVariant old_value, new_value;
|
||||
old_value.setValue(cc->properties());
|
||||
new_value.setValue(cp);
|
||||
project_->undoStack()->push(new QPropertyUndoCommand(cc, "properties", old_value, new_value));
|
||||
}
|
||||
}
|
||||
}
|
||||
project_->undoStack()->endMacro();
|
||||
}
|
||||
|
||||
void SearchAndReplaceWorker::replaceConductor(Conductor *conductor)
|
||||
{
|
||||
QList<Conductor *>list;
|
||||
list.append(conductor);
|
||||
replaceConductor(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::setupLineEdit
|
||||
* With search and replace, when the variable to edit is a text,
|
||||
* the editor is always the same no matter if it is for a folio, element or conductor.
|
||||
* The editor is a QLineEdit to edit the text and checkbox to erase the text if checked.
|
||||
* This function fill the editor
|
||||
* @param l
|
||||
* @param cb
|
||||
* @param str
|
||||
*/
|
||||
void SearchAndReplaceWorker::setupLineEdit(QLineEdit *l, QCheckBox *cb, QString str)
|
||||
{
|
||||
l->setText(str);
|
||||
cb->setChecked(str == eraseText() ? true : false);
|
||||
}
|
||||
|
||||
ConductorProperties SearchAndReplaceWorker::invalidConductorProperties()
|
||||
{
|
||||
ConductorProperties cp;
|
||||
|
||||
//init with invalid value the conductor properties
|
||||
cp.text_size = 0;
|
||||
cp.text.clear();
|
||||
cp.m_vertical_alignment = Qt::AlignAbsolute;
|
||||
cp.m_horizontal_alignment = Qt::AlignAbsolute;
|
||||
cp.verti_rotate_text = -1;
|
||||
cp.horiz_rotate_text = -1;
|
||||
cp.color = QColor();
|
||||
cp.style = Qt::NoPen;
|
||||
cp.cond_size = 0;
|
||||
cp.m_color_2 = QColor();
|
||||
cp.m_dash_size = 0;
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::applyChange
|
||||
* @param original : the original properties
|
||||
* @param change : the change properties, to be merged with @original
|
||||
* @return a new conductor properties with the change applyed.
|
||||
*/
|
||||
ConductorProperties SearchAndReplaceWorker::applyChange(const ConductorProperties &original, const ConductorProperties &change)
|
||||
{
|
||||
ConductorProperties new_properties = original;
|
||||
|
||||
if (change.text_size > 2) {new_properties.text_size = change.text_size;}
|
||||
new_properties.m_formula = applyChange(new_properties.m_formula, change.m_formula);
|
||||
new_properties.text = applyChange(new_properties.text, change.text);
|
||||
new_properties.m_show_text = change.m_show_text;
|
||||
new_properties.m_function = applyChange(new_properties.m_function, change.m_function);
|
||||
new_properties.m_tension_protocol = applyChange(new_properties.m_tension_protocol, change.m_tension_protocol);
|
||||
if(change.m_vertical_alignment == Qt::AlignLeft ||
|
||||
change.m_vertical_alignment == Qt::AlignRight) {new_properties.m_vertical_alignment = change.m_vertical_alignment;}
|
||||
if(change.m_horizontal_alignment == Qt::AlignTop ||
|
||||
change.m_horizontal_alignment == Qt::AlignBottom) {new_properties.m_horizontal_alignment = change.m_horizontal_alignment;}
|
||||
if (change.verti_rotate_text >= 0) {new_properties.verti_rotate_text = change.verti_rotate_text;}
|
||||
if (change.horiz_rotate_text >= 0) {new_properties.horiz_rotate_text = change.horiz_rotate_text;}
|
||||
if (change.color.isValid()) {new_properties.color = change.color;}
|
||||
if (change.style != Qt::NoPen) {new_properties.style = change.style;}
|
||||
if (change.cond_size >= 0.4) {new_properties.cond_size = change.cond_size;}
|
||||
new_properties.m_bicolor = change.m_bicolor;
|
||||
if (change.m_color_2.isValid()) {new_properties.m_color_2 = change.m_color_2;}
|
||||
if (change.m_dash_size >= 2) {new_properties.m_dash_size = change.m_dash_size;}
|
||||
new_properties.singleLineProperties = change.singleLineProperties;
|
||||
|
||||
return new_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::applyChange
|
||||
* @param original : the original string
|
||||
* @param change : the changed string:
|
||||
* @return the string to be use in the properties
|
||||
*/
|
||||
QString SearchAndReplaceWorker::applyChange(const QString &original, const QString &change)
|
||||
{
|
||||
if (change.isEmpty()) {return original;}
|
||||
else if (change == eraseText()) {return QString();}
|
||||
else {return change;}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,14 @@
|
||||
#include <QDate>
|
||||
|
||||
#include "titleblockproperties.h"
|
||||
#include "conductorproperties.h"
|
||||
|
||||
class Diagram;
|
||||
class Element;
|
||||
class IndependentTextItem;
|
||||
class Conductor;
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
|
||||
/**
|
||||
* @brief The SearchAndReplaceWorker class
|
||||
@@ -35,21 +39,28 @@ class SearchAndReplaceWorker
|
||||
public:
|
||||
SearchAndReplaceWorker();
|
||||
|
||||
void clear();
|
||||
void replaceDiagram(QList <Diagram *> diagram_list);
|
||||
void replaceDiagram(Diagram *diagram);
|
||||
void replaceElement(QList <Element *> list);
|
||||
void replaceElement(Element *element);
|
||||
void replaceIndiText(QList<IndependentTextItem *> list);
|
||||
void replaceIndiText(IndependentTextItem *text);
|
||||
void replaceConductor(QList <Conductor *> list);
|
||||
void replaceConductor(Conductor *conductor);
|
||||
|
||||
static QString eraseText() {return QString("XXXXXXXXXXXXXXXXXXX");}
|
||||
static QDate eraseDate() {return QDate(1900, 1, 1);}
|
||||
static void setupLineEdit(QLineEdit *l, QCheckBox *cb, QString str);
|
||||
static ConductorProperties invalidConductorProperties();
|
||||
|
||||
static ConductorProperties applyChange(const ConductorProperties &original, const ConductorProperties &change);
|
||||
static QString applyChange(const QString &original, const QString &change);
|
||||
|
||||
private:
|
||||
TitleBlockProperties m_titleblock_properties;
|
||||
DiagramContext m_element_context;
|
||||
QString m_indi_text;
|
||||
ConductorProperties m_conductor_properties;
|
||||
|
||||
friend class SearchAndReplaceWidget;
|
||||
};
|
||||
|
||||
266
sources/SearchAndReplace/ui/replaceconductordialog.cpp
Normal file
266
sources/SearchAndReplace/ui/replaceconductordialog.cpp
Normal file
@@ -0,0 +1,266 @@
|
||||
/*
|
||||
Copyright 2006-2018 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "replaceconductordialog.h"
|
||||
#include "ui_replaceconductordialog.h"
|
||||
#include "searchandreplaceworker.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QColorDialog>
|
||||
|
||||
typedef SearchAndReplaceWorker sarw;
|
||||
|
||||
/**
|
||||
* @brief ReplaceConductorDialog::ReplaceConductorDialog
|
||||
* @param parent
|
||||
*/
|
||||
ReplaceConductorDialog::ReplaceConductorDialog(const ConductorProperties &properties, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ReplaceConductorDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
initWidget();
|
||||
setProperties(properties);
|
||||
}
|
||||
|
||||
ReplaceConductorDialog::~ReplaceConductorDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceConductorDialog::updatePreview
|
||||
* Update the preview for single line
|
||||
* @param b true: update from the value displayed by this widget
|
||||
* false: update from the properties given at the constructor of this widget
|
||||
*/
|
||||
void ReplaceConductorDialog::updatePreview(bool b)
|
||||
{
|
||||
const QRect pixmap_rect(0, 0, 96, 96);
|
||||
QPixmap pixmap(pixmap_rect.width(), pixmap_rect.height());
|
||||
QPainter painter;
|
||||
painter.begin(&pixmap);
|
||||
painter.eraseRect(pixmap_rect);
|
||||
painter.drawRect(pixmap_rect.adjusted(0,0,-1,-1));
|
||||
painter.drawLine(QLineF(0, pixmap_rect.height() / 2, pixmap_rect.width(), pixmap_rect.height() / 2));
|
||||
|
||||
if (b) {
|
||||
properties().singleLineProperties.draw(&painter, QET::Horizontal, pixmap_rect);
|
||||
} else {
|
||||
m_properties.singleLineProperties.draw(&painter, QET::Horizontal, pixmap_rect);
|
||||
}
|
||||
|
||||
painter.end();
|
||||
ui -> m_preview_label -> setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::setProperties(const ConductorProperties &properties)
|
||||
{
|
||||
m_properties = properties;
|
||||
|
||||
if (m_properties.type == ConductorProperties::Single) {
|
||||
ui->m_singlewire_gb->setChecked(true);
|
||||
} else {
|
||||
ui->m_multi_gb->setChecked(true);
|
||||
}
|
||||
ui->m_text_size_sb->setValue(m_properties.text_size);
|
||||
ui->m_show_text->setChecked(m_properties.m_show_text);
|
||||
sarw::setupLineEdit(ui->m_formula_le, ui->m_erase_formula_cb, m_properties.m_formula);
|
||||
sarw::setupLineEdit(ui->m_text_le, ui->m_erase_text_cb, m_properties.text);
|
||||
sarw::setupLineEdit(ui->m_function_le, ui->m_erase_function_cb, m_properties.m_function);
|
||||
sarw::setupLineEdit(ui->m_tension_protocol_le, ui->m_erase_tension_protocol_cb, m_properties.m_tension_protocol);
|
||||
switch (m_properties.m_vertical_alignment) {
|
||||
case Qt::AlignLeft: ui->m_vertical_align_cb->setCurrentIndex(1);break;
|
||||
case Qt::AlignRight: ui->m_vertical_align_cb->setCurrentIndex(2);break;
|
||||
default: ui->m_vertical_align_cb->setCurrentIndex(0); break;
|
||||
}
|
||||
switch (m_properties.m_horizontal_alignment) {
|
||||
case Qt::AlignTop: ui->m_horizontal_align_cb->setCurrentIndex(1); break;
|
||||
case Qt::AlignBottom: ui->m_horizontal_align_cb->setCurrentIndex(2); break;
|
||||
default: ui->m_horizontal_align_cb->setCurrentIndex(0); break;
|
||||
}
|
||||
ui->m_vertical_angle_sb->setValue(m_properties.verti_rotate_text);
|
||||
ui->m_horizontal_angle_sb->setValue(m_properties.horiz_rotate_text);
|
||||
if (m_properties.color.isValid())
|
||||
{
|
||||
setColorButton(m_properties.color);
|
||||
ui->m_mod_color_cb->setChecked(true);
|
||||
}
|
||||
int index = ui->m_line_style_cb->findData(QPen(m_properties.style));
|
||||
if (index != -1) {
|
||||
ui->m_line_style_cb->setCurrentIndex(index);
|
||||
}
|
||||
ui->m_second_color_gb->setChecked(m_properties.m_bicolor);
|
||||
if (m_properties.m_color_2.isValid())
|
||||
{
|
||||
setColorButton2(m_properties.m_color_2);
|
||||
ui->m_mod_color_2_cb->setChecked(true);
|
||||
}
|
||||
ui->m_color_2_dash_size_sb->setValue(m_properties.m_dash_size);
|
||||
|
||||
ui->m_earth_cb ->setChecked (m_properties.singleLineProperties.hasGround);
|
||||
ui->m_neutral_cb ->setChecked (m_properties.singleLineProperties.hasNeutral);
|
||||
ui->m_pen_cb ->setChecked (m_properties.singleLineProperties.isPen());
|
||||
ui->m_phase_cb ->setChecked (m_properties.singleLineProperties.phasesCount());
|
||||
ui->m_phase_slider->setValue (m_properties.singleLineProperties.phasesCount());
|
||||
|
||||
updatePreview(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceConductorDialog::properties
|
||||
* @return the properties edited by this widget
|
||||
*/
|
||||
ConductorProperties ReplaceConductorDialog::properties() const
|
||||
{
|
||||
ConductorProperties properties_;
|
||||
if (ui->m_multi_gb->isChecked()) {
|
||||
properties_.type = ConductorProperties::Multi;
|
||||
} else {
|
||||
properties_.type = ConductorProperties::Single;
|
||||
}
|
||||
|
||||
properties_.text_size = ui->m_text_size_sb->value();
|
||||
properties_.m_formula = ui->m_formula_le->text();
|
||||
properties_.text = ui->m_text_le->text();
|
||||
properties_.m_show_text = ui->m_show_text->isChecked();
|
||||
properties_.m_function = ui->m_function_le->text();
|
||||
properties_.m_tension_protocol = ui->m_tension_protocol_le->text();
|
||||
switch (ui->m_vertical_align_cb->currentIndex()) {
|
||||
case 0: properties_.m_vertical_alignment = Qt::AlignAbsolute; break;
|
||||
case 1: properties_.m_vertical_alignment = Qt::AlignLeft; break;
|
||||
case 2: properties_.m_vertical_alignment = Qt::AlignRight; break;
|
||||
default:break;
|
||||
}
|
||||
switch (ui->m_horizontal_align_cb->currentIndex()) {
|
||||
case 0: properties_.m_horizontal_alignment = Qt::AlignAbsolute; break;
|
||||
case 1: properties_.m_horizontal_alignment = Qt::AlignTop; break;
|
||||
case 2: properties_.m_horizontal_alignment = Qt::AlignBottom; break;
|
||||
default: break;
|
||||
}
|
||||
properties_.verti_rotate_text = ui->m_vertical_angle_sb->value();
|
||||
properties_.horiz_rotate_text = ui->m_horizontal_angle_sb->value();
|
||||
properties_.color = ui->m_mod_color_cb->isChecked() ? ui->m_color_pb->palette().color(QPalette::Button) : QColor();
|
||||
properties_.style = ui->m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).value<QPen>().style();
|
||||
properties_.cond_size = ui->m_cond_size_sb->value();
|
||||
properties_.m_bicolor = ui->m_second_color_gb->isChecked();
|
||||
properties_.m_color_2 = ui->m_mod_color_2_cb->isChecked() ? ui->m_color_2_pb->palette().color(QPalette::Button) : QColor();
|
||||
properties_.m_dash_size = ui->m_color_2_dash_size_sb->value();
|
||||
|
||||
properties_.singleLineProperties.hasGround = ui->m_earth_cb->isChecked();
|
||||
properties_.singleLineProperties.hasNeutral = ui->m_neutral_cb->isChecked();
|
||||
properties_.singleLineProperties.is_pen = ui->m_pen_cb->isChecked();
|
||||
properties_.singleLineProperties.setPhasesCount(ui->m_phase_cb->isChecked() ? ui->m_phase_sb->value() : 0);
|
||||
|
||||
return properties_;
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::initWidget()
|
||||
{
|
||||
connect(ui->m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_) {
|
||||
this->done(ui->m_button_box->buttonRole(button_));
|
||||
});
|
||||
|
||||
ui->m_update_preview_pb->setHidden(true);
|
||||
|
||||
ui->m_line_style_cb->addItem(tr("Inchanger"), QPen(Qt::NoPen));
|
||||
ui->m_line_style_cb->addItem(tr("Trait plein", "conductor style: solid line"), QPen(Qt::SolidLine));
|
||||
ui->m_line_style_cb->addItem(tr("Trait en pointillés", "conductor style: dashed line"), QPen(Qt::DashLine));
|
||||
ui->m_line_style_cb->addItem(tr("Traits et points", "conductor style: dashed and dotted line"), QPen(Qt::DashDotLine));
|
||||
|
||||
connect(ui->m_multi_gb, &QGroupBox::toggled, [this](bool toggle) {this->ui->m_singlewire_gb->setChecked(!toggle);});
|
||||
connect(ui->m_singlewire_gb, &QGroupBox::toggled, [this](bool toggle) {this->ui->m_multi_gb->setChecked(!toggle);});
|
||||
connect(ui->m_formula_le, &QLineEdit::textChanged, [this](QString text) {this->ui->m_text_le->setEnabled(text.isEmpty());});
|
||||
ui->m_multi_gb->setChecked(true);
|
||||
ui->m_singlewire_gb->setChecked(true);
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::setColorButton(const QColor &color)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Button, color);
|
||||
ui->m_color_pb->setStyleSheet(QString("background-color: %1; min-height: 1.5em; border-style: outset; border-width: 2px; border-color: gray; border-radius: 4px;").arg(color.name()));
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::setColorButton2(const QColor &color)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Button, color);
|
||||
ui->m_color_2_pb->setStyleSheet(QString("background-color: %1; min-height: 1.5em; border-style: outset; border-width: 2px; border-color: gray; border-radius: 4px;").arg(color.name()));
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_formula_cb_clicked()
|
||||
{
|
||||
ui->m_formula_le->setText(ui->m_erase_formula_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_formula_le->setDisabled(ui->m_erase_formula_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_text_cb_clicked()
|
||||
{
|
||||
ui->m_text_le->setText(ui->m_erase_text_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_text_le->setDisabled(ui->m_erase_text_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_function_cb_clicked()
|
||||
{
|
||||
ui->m_function_le->setText(ui->m_erase_function_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_function_le->setDisabled(ui->m_erase_function_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_tension_protocol_cb_clicked()
|
||||
{
|
||||
ui->m_tension_protocol_le->setText(ui->m_erase_tension_protocol_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_tension_protocol_le->setDisabled(ui->m_erase_tension_protocol_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_earth_cb_toggled(bool checked)
|
||||
{
|
||||
if (checked && ui->m_neutral_cb -> isChecked()) {
|
||||
ui -> m_pen_cb -> setEnabled(true);
|
||||
} else {
|
||||
ui -> m_pen_cb -> setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_neutral_cb_toggled(bool checked)
|
||||
{
|
||||
if (checked && ui->m_earth_cb->isChecked()) {
|
||||
ui->m_pen_cb->setEnabled(true);
|
||||
} else {
|
||||
ui->m_pen_cb->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_update_preview_pb_clicked() {
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_color_pb_clicked()
|
||||
{
|
||||
QColor color = QColorDialog::getColor(m_properties.color, this);
|
||||
if (color.isValid()) {
|
||||
setColorButton(color);
|
||||
}
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_color_2_pb_clicked()
|
||||
{
|
||||
QColor color = QColorDialog::getColor(m_properties.m_color_2, this);
|
||||
if (color.isValid()) {
|
||||
setColorButton2(color);
|
||||
}
|
||||
}
|
||||
65
sources/SearchAndReplace/ui/replaceconductordialog.h
Normal file
65
sources/SearchAndReplace/ui/replaceconductordialog.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright 2006-2018 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef REPLACECONDUCTORDIALOG_H
|
||||
#define REPLACECONDUCTORDIALOG_H
|
||||
|
||||
#include "conductorproperties.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class ReplaceConductorDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The ReplaceConductorDialog class
|
||||
* A Qdialog to edit a conductor properties, use for the search and replace feature of QElectrotech.
|
||||
*/
|
||||
class ReplaceConductorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReplaceConductorDialog(const ConductorProperties &properties, QWidget *parent = 0);
|
||||
~ReplaceConductorDialog();
|
||||
void updatePreview(bool b=true);
|
||||
void setProperties(const ConductorProperties &properties);
|
||||
ConductorProperties properties() const;
|
||||
|
||||
private:
|
||||
void initWidget();
|
||||
void setColorButton(const QColor &color);
|
||||
void setColorButton2(const QColor &color);
|
||||
|
||||
private slots:
|
||||
void on_m_erase_formula_cb_clicked();
|
||||
void on_m_erase_text_cb_clicked();
|
||||
void on_m_erase_function_cb_clicked();
|
||||
void on_m_erase_tension_protocol_cb_clicked();
|
||||
void on_m_earth_cb_toggled(bool checked);
|
||||
void on_m_neutral_cb_toggled(bool checked);
|
||||
void on_m_update_preview_pb_clicked();
|
||||
void on_m_color_pb_clicked();
|
||||
void on_m_color_2_pb_clicked();
|
||||
|
||||
private:
|
||||
Ui::ReplaceConductorDialog *ui;
|
||||
ConductorProperties m_properties;
|
||||
};
|
||||
|
||||
#endif // REPLACECONDUCTORDIALOG_H
|
||||
753
sources/SearchAndReplace/ui/replaceconductordialog.ui
Normal file
753
sources/SearchAndReplace/ui/replaceconductordialog.ui
Normal file
@@ -0,0 +1,753 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReplaceConductorDialog</class>
|
||||
<widget class="QDialog" name="ReplaceConductorDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>636</width>
|
||||
<height>523</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Type</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_multi_gb">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&Multifilaire</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0,0,0,0">
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="m_horizontal_align_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inchanger</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>En haut</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>En bas</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Texte sur conducteur horizontal :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="m_formula_le">
|
||||
<property name="placeholderText">
|
||||
<string>Non modifier</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Tension / protocol :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="m_function_le">
|
||||
<property name="placeholderText">
|
||||
<string>Non modifier</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<widget class="QCheckBox" name="m_erase_text_cb">
|
||||
<property name="toolTip">
|
||||
<string>Supprimer ce texte</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Fonction :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Formule du texte :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QCheckBox" name="m_show_text">
|
||||
<property name="toolTip">
|
||||
<string>Texte visible</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Angle :</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="m_tension_protocol_le">
|
||||
<property name="placeholderText">
|
||||
<string>Non modifier</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="4">
|
||||
<widget class="QSpinBox" name="m_text_size_sb">
|
||||
<property name="specialValueText">
|
||||
<string>Inchanger</string>
|
||||
</property>
|
||||
<property name="accelerated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Texte sur conducteur vertical :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Taille du texte :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Texte :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<widget class="QCheckBox" name="m_erase_tension_protocol_cb">
|
||||
<property name="toolTip">
|
||||
<string>Supprimer ce texte</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="5">
|
||||
<widget class="QCheckBox" name="m_erase_function_cb">
|
||||
<property name="toolTip">
|
||||
<string>Supprimer ce texte</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="m_vertical_align_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inchanger</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>À gauche</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>À droite</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QCheckBox" name="m_erase_formula_cb">
|
||||
<property name="toolTip">
|
||||
<string>Supprimer ce texte</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Angle :</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3" colspan="2">
|
||||
<widget class="QSpinBox" name="m_vertical_angle_sb">
|
||||
<property name="wrapping">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="specialValueText">
|
||||
<string>Inchanger</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>°</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>359</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3" colspan="2">
|
||||
<widget class="QSpinBox" name="m_horizontal_angle_sb">
|
||||
<property name="wrapping">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="specialValueText">
|
||||
<string>Inchanger</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>°</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>359</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="m_text_le">
|
||||
<property name="placeholderText">
|
||||
<string>Non modifier</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_singlewire_gb">
|
||||
<property name="title">
|
||||
<string>Unifilaire</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="m_pen_cb">
|
||||
<property name="toolTip">
|
||||
<string>Protective Earth Neutral</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PEN</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="m_phase_cb">
|
||||
<property name="toolTip">
|
||||
<string>Phase</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>phase</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/phase.png</normaloff>:/ico/16x16/phase.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="m_phase_sb">
|
||||
<property name="toolTip">
|
||||
<string>Nombre de phase</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="m_neutral_cb">
|
||||
<property name="toolTip">
|
||||
<string>Neutre</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>neutre</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/neutral.png</normaloff>:/ico/16x16/neutral.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSlider" name="m_phase_slider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Nombre de phase</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="m_earth_cb">
|
||||
<property name="toolTip">
|
||||
<string>Terre</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>terre</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/ground.png</normaloff>:/ico/16x16/ground.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="QLabel" name="m_preview_label">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_update_preview_pb">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget">
|
||||
<attribute name="title">
|
||||
<string>Apparence</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,1,0">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Taille :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Couleur :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_color_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Style :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="m_mod_color_cb">
|
||||
<property name="toolTip">
|
||||
<string>Modifier</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QGroupBox" name="m_second_color_gb">
|
||||
<property name="title">
|
||||
<string>Couleur secondaire :</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1,0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_color_2_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Taille de trait :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Couleur :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="m_mod_color_2_cb">
|
||||
<property name="toolTip">
|
||||
<string>Modifier</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="m_color_2_dash_size_sb">
|
||||
<property name="specialValueText">
|
||||
<string>Inchanger</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>px</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="m_cond_size_sb">
|
||||
<property name="specialValueText">
|
||||
<string>Inchanger</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="m_line_style_cb"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="m_button_box">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../qelectrotech.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>m_mod_color_cb</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>m_color_pb</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>605</x>
|
||||
<y>57</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>328</x>
|
||||
<y>58</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_earth_cb</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>m_update_preview_pb</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>243</x>
|
||||
<y>372</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>392</x>
|
||||
<y>373</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_neutral_cb</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>m_update_preview_pb</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>243</x>
|
||||
<y>404</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>392</x>
|
||||
<y>373</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_phase_cb</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>m_update_preview_pb</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>243</x>
|
||||
<y>434</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>392</x>
|
||||
<y>373</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_pen_cb</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>m_update_preview_pb</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>392</x>
|
||||
<y>404</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>392</x>
|
||||
<y>373</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_phase_slider</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>m_update_preview_pb</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>392</x>
|
||||
<y>434</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>392</x>
|
||||
<y>373</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_phase_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>m_update_preview_pb</receiver>
|
||||
<slot>click()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>540</x>
|
||||
<y>435</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>392</x>
|
||||
<y>373</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_phase_slider</sender>
|
||||
<signal>sliderMoved(int)</signal>
|
||||
<receiver>m_phase_sb</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>392</x>
|
||||
<y>434</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>540</x>
|
||||
<y>435</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_phase_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>m_phase_slider</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>540</x>
|
||||
<y>435</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>392</x>
|
||||
<y>434</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_mod_color_2_cb</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>m_color_2_pb</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>597</x>
|
||||
<y>200</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>341</x>
|
||||
<y>201</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "replacefoliowidget.h"
|
||||
#include "replaceelementdialog.h"
|
||||
#include "qetapp.h"
|
||||
#include "replaceconductordialog.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
@@ -911,6 +912,14 @@ void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
||||
}
|
||||
|
||||
}
|
||||
else if (ui->m_conductor_pb->text().endsWith(tr(" [édité]")) &&
|
||||
m_conductor_hash.keys().contains(qtwi))
|
||||
{
|
||||
QPointer<Conductor> c = m_conductor_hash.value(qtwi);
|
||||
if (c) {
|
||||
m_worker.replaceConductor(c.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
activateNextChecked();
|
||||
ui->m_replace_pb->setEnabled(ui->m_next_pb->isEnabled());
|
||||
@@ -972,6 +981,23 @@ void SearchAndReplaceWidget::on_m_replace_all_pb_clicked()
|
||||
m_worker.replaceIndiText(text_list );
|
||||
}
|
||||
|
||||
//Replace conductor
|
||||
if (ui->m_conductor_pb->text().endsWith(tr(" [édité]")))
|
||||
{
|
||||
QList <Conductor *> conductor_list;
|
||||
for (QTreeWidgetItem *qtwi : m_conductor_hash.keys())
|
||||
{
|
||||
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
||||
{
|
||||
QPointer <Conductor> c = m_conductor_hash.value(qtwi);
|
||||
if (c) {
|
||||
conductor_list.append(c.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
m_worker.replaceConductor(conductor_list);
|
||||
}
|
||||
|
||||
//Change was made, we reload the panel
|
||||
//and search again to keep up to date the tree widget
|
||||
//and the match item of search
|
||||
@@ -1027,3 +1053,32 @@ void SearchAndReplaceWidget::on_m_case_sensitive_cb_stateChanged(int arg1)
|
||||
Q_UNUSED(arg1);
|
||||
search();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::on_m_conductor_pb_clicked
|
||||
* Open a dialog to edit the condutor properties
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_conductor_pb_clicked()
|
||||
{
|
||||
ReplaceConductorDialog *dialog = new ReplaceConductorDialog(m_worker.m_conductor_properties, this);
|
||||
int result = dialog->exec();
|
||||
|
||||
if (result == QDialogButtonBox::AcceptRole)
|
||||
{
|
||||
QString text = ui->m_conductor_pb->text();
|
||||
if (!text.endsWith(tr(" [édité]"))) {
|
||||
text.append(tr(" [édité]"));
|
||||
}
|
||||
ui->m_conductor_pb->setText(text);
|
||||
m_worker.m_conductor_properties = dialog->properties();
|
||||
}
|
||||
else if (result == QDialogButtonBox::ResetRole)
|
||||
{
|
||||
QString text = ui->m_conductor_pb->text();
|
||||
if (text.endsWith(tr(" [édité]"))) {
|
||||
text.remove(tr(" [édité]"));
|
||||
}
|
||||
ui->m_conductor_pb->setText(text);
|
||||
m_worker.m_conductor_properties = m_worker.invalidConductorProperties();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ class SearchAndReplaceWidget : public QWidget
|
||||
void on_m_element_pb_clicked();
|
||||
void on_m_mode_cb_currentIndexChanged(int index);
|
||||
void on_m_case_sensitive_cb_stateChanged(int arg1);
|
||||
void on_m_conductor_pb_clicked();
|
||||
|
||||
private:
|
||||
Ui::SearchAndReplaceWidget *ui;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/ico/16x16/view-refresh.png</normaloff>:/ico/16x16/view-refresh.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -49,7 +49,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/ico/16x16/go-bottom.png</normaloff>:/ico/16x16/go-bottom.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
@@ -66,7 +66,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/ico/16x16/configure-toolbars.png</normaloff>:/ico/16x16/configure-toolbars.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
@@ -110,7 +110,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/ico/16x16/go-top.png</normaloff>:/ico/16x16/go-top.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
@@ -140,7 +140,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/ico/16x16/window-close.svg</normaloff>:/ico/16x16/window-close.svg</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
@@ -196,9 +196,6 @@
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QPushButton" name="m_conductor_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Définir les propriétés à remplacer dans les conducteurs</p></body></html></string>
|
||||
</property>
|
||||
@@ -291,8 +288,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../qelectrotech.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user