Conductor properties: added the "PEN" option, which enables users to merge neutral and ground symbols.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1933 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-08-12 20:32:53 +00:00
parent eb2acce3b6
commit b5430118e4
4 changed files with 90 additions and 34 deletions

View File

@@ -68,6 +68,21 @@ void ConductorPropertiesWidget::buildInterface() {
singleline = new QRadioButton(tr("Unifilaire"));
ground_checkbox = new QCheckBox(tr("terre"));
ground_checkbox -> setIcon(QET::Icons::Ground);
neutral_checkbox = new QCheckBox(tr("neutre"));
neutral_checkbox -> setIcon(QET::Icons::Neutral);
merge_checkbox = new QCheckBox(tr("PEN", "Protective Earth Neutral"));
merge_checkbox -> setToolTip(tr("Protective Earth Neutral", "Tooltip displaying the meaning of the 'PEN' acronym"));
QVBoxLayout *singleline_layout5 = new QVBoxLayout();
singleline_layout5 -> addWidget(ground_checkbox);
singleline_layout5 -> addWidget(neutral_checkbox);
QHBoxLayout *singleline_layout4 = new QHBoxLayout();
singleline_layout4 -> addLayout(singleline_layout5);
singleline_layout4 -> addWidget(merge_checkbox, 4, Qt::AlignVCenter | Qt::AlignLeft);
QHBoxLayout *singleline_layout3 = new QHBoxLayout();
phase_checkbox = new QCheckBox(tr("phase"));
phase_checkbox -> setIcon(QET::Icons::Phase);
@@ -80,12 +95,7 @@ void ConductorPropertiesWidget::buildInterface() {
singleline_layout3 -> addWidget(phase_spinbox);
QVBoxLayout *singleline_layout2 = new QVBoxLayout();
ground_checkbox = new QCheckBox(tr("terre"));
ground_checkbox -> setIcon(QET::Icons::Ground);
neutral_checkbox = new QCheckBox(tr("neutre"));
neutral_checkbox -> setIcon(QET::Icons::Neutral);
singleline_layout2 -> addWidget(ground_checkbox);
singleline_layout2 -> addWidget(neutral_checkbox);
singleline_layout2 -> addLayout(singleline_layout4);
singleline_layout2 -> addLayout(singleline_layout3);
QHBoxLayout *singleline_layout1 = new QHBoxLayout();
@@ -135,6 +145,7 @@ void ConductorPropertiesWidget::buildConnections() {
connect(phase_spinbox, SIGNAL(valueChanged(int)), phase_slider, SLOT(setValue(int)));
connect(ground_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
connect(neutral_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
connect(merge_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
connect(phase_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
connect(phase_slider, SIGNAL(valueChanged(int)), this, SLOT(updateConfig()));
connect(radio_buttons, SIGNAL(buttonClicked(int)), this, SLOT(updateConfig()));
@@ -178,6 +189,7 @@ void ConductorPropertiesWidget::destroyConnections() {
disconnect(phase_spinbox, SIGNAL(valueChanged(int)), phase_slider, SLOT(setValue(int)));
disconnect(ground_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
disconnect(neutral_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
disconnect(merge_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
disconnect(phase_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
disconnect(phase_slider, SIGNAL(valueChanged(int)), this, SLOT(updateConfig()));
disconnect(radio_buttons, SIGNAL(buttonClicked(int)), this, SLOT(updateConfig()));
@@ -198,6 +210,7 @@ void ConductorPropertiesWidget::updateConfig() {
properties_.text = text_field -> text();
properties_.singleLineProperties.hasGround = ground_checkbox -> isChecked();
properties_.singleLineProperties.hasNeutral = neutral_checkbox -> isChecked();
properties_.singleLineProperties.is_pen = merge_checkbox -> isChecked();
properties_.singleLineProperties.setPhasesCount(phase_checkbox -> isChecked() ? phase_spinbox -> value() : 0);
updateDisplay();
@@ -213,6 +226,8 @@ void ConductorPropertiesWidget::updateDisplay() {
text_field -> setText(properties_.text);
ground_checkbox -> setChecked(properties_.singleLineProperties.hasGround);
neutral_checkbox -> setChecked(properties_.singleLineProperties.hasNeutral);
merge_checkbox -> setChecked(properties_.singleLineProperties.is_pen);
merge_checkbox -> setEnabled(!isReadOnly() && ground_checkbox -> isChecked() && neutral_checkbox -> isChecked());
phase_spinbox -> setValue(properties_.singleLineProperties.phasesCount());
phase_slider -> setValue(properties_.singleLineProperties.phasesCount());
phase_checkbox -> setChecked(properties_.singleLineProperties.phasesCount());
@@ -257,6 +272,7 @@ void ConductorPropertiesWidget::setConductorType(ConductorProperties::ConductorT
phase_spinbox -> setEnabled(sl);
ground_checkbox -> setEnabled(sl);
neutral_checkbox -> setEnabled(sl);
merge_checkbox -> setEnabled(sl);
}
/// @param p les nouvelles proprietes
@@ -290,6 +306,7 @@ void ConductorPropertiesWidget::setReadOnly(bool ro) {
phase_spinbox -> setReadOnly(ro);
ground_checkbox -> setDisabled(ro);
neutral_checkbox -> setDisabled(ro);
merge_checkbox -> setDisabled(ro);
color_button -> setDisabled(ro);
dashed_checkbox -> setDisabled(ro);
// if the widget is not read-only, we still need to disable some widgets for consistency